Friday, January 16, 2015

[IoT] streaming temperature data acquired with DS18B20 to thingspeak using ESP8266 on Arduino Mega

IoT streaming temperature data acquired with DS18B20 to thingspeak using ESP8266 on Arduino Mega

Streaming data to internet could not have been easier with the release of ESP8266.
Gone are the days of using a concoction of software, permanently tether a microcontroller based temperature sensor to a computer for it's internet connecting capability, and visualizing the data. back in 2012, yours truly have dabbled in such complex setup of hardware and software URL: http://shin-ajaran.blogspot.sg/2012/07/iot-how-to-stream-temperature-sensor.html for the purpose of demonstrating IoT and of course to stream the office's temperature to the internet http://shin-ajaran.blogspot.sg/2012/07/iot-diy-solar-air-conditioning-with.html . the sole purpose is to make an informed choice of coming to office or not on the weekends, based on the reading of the temperature data.


If you wonder what is ESP8266, check out previous post http://shin-ajaran.blogspot.sg/2014/12/noobs-guide-to-esp8266-with-arduino.html  ESP8266 is a very low cost WiFi upgrade to "Internet Enable" any microcontroller based systems that are able to speak serial with it. It is retailing for S$9.5 here or ~USD5 on friendly website of middle kingdom. Earlier, A C&C (command & control) type of application is created with ESP8266 http://shin-ajaran.blogspot.sg/2015/01/internet-controlled-ac-appliances-with.html allowing appliances to be controlled from the Internet. This round, let's explore uplink type of application; to stream real and live data to the internet. The IoT data store of choice is thingspeak https://thingspeak.com/docs/tutorials/ for the fact that it is easy to register for an account, clear and concise documentation, and any microcontroller based system can be setup to stream data to in in practically no time.


Your truly is no stranger to sensor for the purpose of temperature data acquisition. The matter of fact, expensive sensor does matter http://shin-ajaran.blogspot.sg/2013/07/expensive-sensor-does-matter-ds18b20.html. Obviously, the weapon of choice in this application will be the trusty DS18B20 temperature probe, or it's variant. Setting up DS18B20 can be slightly tedious as compared to LM35, but it is well worth the effort. As far as my DIY sous vide  setup is concerned, DS18B20 temperature sensor served it's purpose.

If you can't wait to make it yourself and want to jump straight into the visualization of the temperature in the office from the internet, follow this URL https://thingspeak.com/channels/22051

iframe of the channel is here:


Parts needed for this uplink IoT setup
1. Arduino Mega
2. ESP8266
3. DS18B20 temperature sensor

Wiring:
please refer to the previous posts mentioned earlier on hooking up the ESP8266 with Arduino Mega, and DS18B20 temperature sensor.

Once every partss are wired accordingly and dandy, the final outcome should look somewhat similar to the following.

















API:

Go to the thingspeak website to register for an account. it is FREE!!!!
Once registration is done, navigate to the following to acquire the API key.
This API key will allow ESP8266 and Arduino Mega to send data to thingspeak server.

















program arduino mega with the code that is available at the footer.
then observe from the serial monitor whether data has been sent successfully. On the thingspeak channel of yours, a simple graph is available to visualize the data received via IoT.


















there are several cool features on thingspeak, such as public view and private view of streaming data; data can be downloaded in CSV for later manipulations.

the following is the said temperature sensor data from the office, streamed to thingspeak using ESP8266 and Arduino Mega since 31dec14.























can you spot the trend of the visualization and make some sense out of it?
code here: 

2 comments:

Rotten Ronnie said...

The images connected to your dropbox account are no longer viewable.

Thanks for sharing the project!

benm said...

Thanks for Sharing Shin,

I have used this to make a fish tank temperature sensor. You also introduced me to the thing speak web service.

https://youtu.be/Qexn9HP7zd4