Tutorial on Connecting Temperature Sensor to Cloud with Arduino Nodemcu ESP8266
NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module. The term "NodeMCU" by default refers to the firmware rather than the development kits. The firmware uses the Lua scripting language. It is based on the eLua project, and built on the Espressif Non-OS SDK for ESP8266.
Some creative ESP8266 enthusiasts have developed an Arduino core for the ESP8266 WiFi SoC that is available at the GitHub ESP8266 Core webpage. This is what is popularly called the "ESP8266 Core for the Arduino IDE" and it has become one of the leading software development platforms for the various ESP8266 based modules and development boards, including NodeMCUs.
Let's start with setting up the Arduino
Part I: Installation and settings of Arduino IDE
- If you have not already done, follow the installation and settings of Arduino IDE through this link https://youtu.be/4Ih39hGcPzg
- Follow the settings of ESP8266 through this link https://youtu.be/G6CqvhXpBKM
- To create the temperature sensor project, go in options file New
- You can add the library files from sketch --> include library --> manage library
- Add all the libraries specified in the program
Arduino side is done, let's shift to Cloud side to set up things
Part II: Setting up Cloud Account on Thingsio.AI
ThingsIO.AI is a IoT Platform for developers. As a developer we understood the pain of not having a seamless place to connect, analyze and process device data. Many pure analytics platforms does not offer device management, which is core for the iot. That is the reason of ThingsIO.AI
- Register the account via this link http://thingsio.ai/#/register
- Create a project:
- Write the name of the project:
- Now, you will be on the project dashboard of your account. Click on the new project option:
- Click on the add a new device option:
- Enter the device name and click on the create and configure device:
- Click on the add a new device option:
- Track your device’s special parameters here. This can be set in device configuration (default to null).
- You can see your real time and special parameter’s graph.
- You can see your all data points.
- You can see here your last 5 data points.
- You can see here all the list of created graphs.
- Go in sample device code options and click on the NodeMCU. You will get the sample code from there and paste into your Arduino IDE.
- Click on the “Send trial data” to send a trial data to the server:
- Go in sample device code options in http://thingsio.ai/ account and click on the Node MCU. You will get the sample code from there.
- Copy and paste the sample code into your IDE
- Compile the sketch by clicking on the compile icon on the top left corner
- connect the node MCU(ESP8266) via the USB cable
- Upload the sketch by clicking on the upload icon
- You can connect the temperature sensor to the 3.3 v pin of Node MCU and check the output on the serial monitor
- Now, click on the configuration device option.
- You can set the special parameters (this is tracked on the device dashboard) & transform it accordingly and add new parameters (Parameters are updated automatically as you send them from your device).
- Click on the update device option:
- You can also set your device geographical location.
- To create a graph for your device click on the “create graph option”.
- Click on the preview option. You will see your created graph and click save changes.
- You can monitor the response from the server, connection with the Wi-Fi etc on the serial monitor (make sure that the baud rate is same as that specified in the program ie,115200)
Part III: Setting up NodeMCU and Completing the Project
Now switch back to your NodeMCU Project. The new few steps you have to do it you Arduino project and is related to NodeMCU ESP8266.
Now your NodeMCU is configured and it is sending data to the cloud, thingsio.ai. Last part is to visualize the data