Jump to content

Thingspeak and other sites ...


PeterW

Recommended Posts

As way of an experiment I've resurrected the old Raspberry Pi to see what sort of monitoring I can put in place with low cost components such as DHT11 and DS18B20 sensors. 

 

An hour or two of dodgy scripting on my part (god my python and bash is rusty..) and I've got a nice neat cron script that is logging data every 2 minutes pretty reliably. 

 

As I'm inherently lazy when it comes to backups and other stuff, I decided to use one of the online services for IoT to log to. Logic is that if I log at short enough intervals then any lost data points would be averaged out. I can also download the data if needed so it's not like I can't review the data offline 

 

Has anyone else done anything similar ..??

 

 

Link to comment
Share on other sites

I would never expect this to be free - whoever you are using to store the data is incurring a cost. But obviously there are free ways of doing it.

 

You can get an AWS account and this usage will easily be in their free tier. I would store the data in S3. You could either upload the data using something that knows about S3 or create an API which accepts a more generic form (just post some data to a HTTP server using Lambda or Elastic Beanstalk), which then stores the data in S3.

 

You can use a self signed cert for SSL if you think your temperature and humidity data is sensitive. You can actually get free certs via AWS Certificate Manager, or use Lets Encrypt.

 

Later you might want a more flexible way of storing the data to make retrieval and analysis easier. If you wanted you could use a relational data store but personally I think that's overblown complicated. Just get something working and improve it incrementally.

 

And there are loads of alternatives to AWS.

Link to comment
Share on other sites

All pretty simple really.

A Raspberry Pi is a small, fully functional computer.  Some people criticise it because it does not accept an analogue input, but there are enough sensors around that output a digital signal that it can read.

The ftps and AWS is just remote storage, and the SSL is just a security method to stop other people reading it.  Everything should really be sent securely, just think of it as a well wrapped package rather than something in a clear plastic bag. 

 

What gets hard is setting these things up reliably so that they can be left unattended and unchecked for a few months.  That is generally where 'computer' based systems rather than dedicated systems fall down.

 

Now if anyone on here knows how to write good code and set up a Raspberry Pi to run reliably for months, let us all know.

Edited by SteamyTea
Link to comment
Share on other sites

Pardon my ignorance, but wouldn't something along the lines of an Arduino would be more suited to this kind of long-term task?  (Not saying PeteW should have gone and bought one just for this task since he had a Pi sitting around - I'm more asking in case someone comes along and is inspired to try and do something similar).

Link to comment
Share on other sites

Not sure, they are similar, both have limitations and different prices.  I don't think there is anything fundamentally wrong with the RPi, probably more down to the scripts that I write for it.

I have actually gone and dug one of my old ones out (an RPi Model B) and am just downloading the latest Debian for it (on my very slow 3G, so probably be morning when I can do anything more with it.

Link to comment
Share on other sites

RPi is pretty easy as it can be scripted with python - I can write c and I could program an Arduino if I wanted but it was more about what was sat on the shelf ..!

 

By using cron it means I'm less susceptible to failures of looping scripts etc and yes there is an overhead of using a Linux distribution as the OS but it makes my life easier when I want to expand it to do more. 

 

pi zero has  come out but I'm not sure I want one as they have removed most of the useful connectors ..! Mine will probably end up as PoE eventually too

Link to comment
Share on other sites

3 hours ago, SteamyTea said:

Not sure, they are similar, both have limitations and different prices. 

 

Agreed there's nothing at all wrong with the Pi!  I love Pi! xD

 

1 hour ago, PeterW said:

RPi is pretty easy as it can be scripted with python - I can write c and I could program an Arduino if I wanted but it was more about what was sat on the shelf ..! 

 

Absolutely.  I'd never for a moment suggest going and buying something new when you have something perfectly useful sitting there ready to go.

 

I was specifically responding to Steamytea's comments about the difficulties of getting a Pi to run reliably for months.  In these "embedded" type situations, there's a lot less to go wrong, stability-wise, with a microprocessor that isn't running a general purpose operating system.  

 

That's basically the end of my understanding (I hesitate to use the word "knowledge"!)  

Link to comment
Share on other sites

I've got an RPi server that been running for about a year. Zero problems.  I have it eNet connected to my router with SSH and HTTPS ports open (not the defaults) and private self certified certificates.  I don't bother with openDNS.  Peter comments that the Linux distro is an overhead, but running it rather than some other OS might cost s few extra watts or a kW or so extra per year. But Linux means that so many open-source packages can be downloaded for free and with minimum hassle. 

 

But IMO, using one for an IoT (Internet of Things) device is not it's sweet spot.  Better an Arduino, PIC or an ESP chip for this type of role.  I personally prefer the ESP8266 series, though I do have a couple of their next generation ESP32 chips, but I am a bit biased because I am one of the team that develops the Lua firmware build for the ESP devices.

 

As far as integrating my IoT devices directly with any cloud service, then my paranoia kicks in: any direct portal to the web can create a back path to hack into your systems.  So I am not going to have any direct paths from my IoT devices to the wider Internet.  None.  My IoT devices each typically do a single job and they talk simple encrypted protocols to a locked down server (which is an RPi).   I access this RPi when needed via my public internet-facing shared service using an HTTPS tunnelled service. 

 

All geeky crap, but I am a geek so you'll have to excuse me.

 

 

Edited by TerryE
  • Like 1
Link to comment
Share on other sites

Agree to all that Terry - when I said Linux was an overhead I meant against something like a PIC. Being able to download packages as you say makes things easy. 

 

thingspeak uses a https post for the data using an API write key - there is also a read key but I've not enabled that as I'm only using the private service as it also gives me access to matlab ..!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...