Temperature Control with Ubidots MQTT and NodeMcu

This guide details how to make a temperature control with Ubidots and a simple NodeMCU to send email or SMS alerts when your “variable” (in this case, the temperature) gets too hot, too cold, or reaches a certain design rule.

We are going to use a pre-wired and waterproof version of the DS18B20 sensor (OneWire temperature sensor). It’s handy when you need to measure something far away, or in wet conditions. The OneWire temperature sensor has different versions; one of them has a resistor integrated and others don’t, so make sure the version you’re using is correct before starting with the project. For the control, we are going to use a NodeMcu using a digital pin.

Select the .ZIP files of Ubidots ESPMQTT, OneWire, and DallasTemperature and then “Accept” or “Choose” for all the libraries. If you can’t add the libraries, try manually: unzip the downloaded rar/zip and copy the folder from the library to the path C:UsersubidotsDocumentsArduinolibraries.

Close the Arduino IDE and open it again.

Code

Once everything is connected correctly, we will go to the IDE and write the following code: