December 14, 2014 | Raspberry Pi |
Internet Of Things
Feeling left behind, I too want to get on board the Internet Of Things bandwagon by putting a sensor on the net. For this experiment, I decided to attach a DHT11 Temperature/Humidity sensor to a Raspberry Pi Model B+ and use thingspeak.com to plot the data. I also looked at data.sparkfun.com which offers a similar service, but it doesn’t actually plot your data.
ThingSpeak is an “open data platform for the Internet Of Things”. To get started, you need to create a channel that specifies what you are plotting - title, range, number of fields, etc. You then update data in your channel with an HTTP request of the form:
The data stream itself can be viewed at the following URL:
ThingSpeak provides a lot of options for displaying your channel’s data - make it public/private, changing extents, layouts, etc. The only limitation is the rate of data updates - it has to be no more frequent than 15 seconds. But the whole software is Open Source, which means you could host it on your own if you need faster updates.
Raspberry Pi and DHT11
I’ve written before about the DHT11 sensor here. Here is how I connected it to Raspberry Pi:
Here is how it looks on a breadboard:
Now we need to connect this to the internet.
I used Python to communicate with the DHT11 sensor and put the data on ThingSpeak. To talk to the sensor, I used the Adafruit DHT Library. Here is the code, and the output from ThingSpeak is what you saw at the beginning of this article.
You run it by uploading it to your Pi and doing:
I was looking for a quick way to put sensor data on the Internet, and ThingSpeak fits the bill. And now I can claim to be part of the IOT buzz. ;-)
We love hearing from our readers. Email us at email@example.com for questions or comments on this article. If you found this article useful, please support us by buying some of our Open Source hardware products - like ZeroDriver - an Arduino Zero compatible motor driver for robotics. ZeroDriver is crowdfunding right now. Please click here to support our campaign. and bring this product to market!