Hi everyone,

Today we are playing with the Watson IoT Platform with a ESP8266 board, DHT21 temperature sensor and one Node-red on the top of IBM Bluemix making an end to end IoT solution sending sensor data (temperature) to the IBM Cloud, processing, storing and tweeting it.

Internet of Things is radically changing the way businesses operate and people interact with the physical world.

The PoC that we are making is really simple but powerful showing what we can do with a micro controller and Watson IoT.

First things first, the device part.

We have here one ESP8266 board and one temperature sensor. The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any micro controller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.

So, the first thing to do is connect the ESP8266 to the Wifi network, we can do this using the setup function and passing the ssid wifi and password.

After that, we can get the sensor temperature and send it to Watson IoT, you can get the library from here https://github.com/adafruit/DHT-sensor-library and add it to the Arduino IDE (Add library zip file).

It’s very important to add the properly library to the Arduino IDE to get the sensor information.

Here is the code to get temperature information from the DTH.

Now we have collected the data so we need to send it to IBM Watson IoT, we can do this in 2 ways, with HTTP and MQTT, in this post we are using the new HTTP integration (just for testing purpose). Here is all the code that we need.

Watson IoT Quickstart

Enter the Watson IoT quickstart page and put the same deviceId that we use before and we are done.

In next posts we are going to show what we can do with this data.