In this Project “Nodemcu ESP8266 DS18b20 Waterproof Temperature Sensor Monitoring using Blynk”, you will learn how to use the ds18b20 waterproof temperature sensor with the Nodemcu esp8266 wifi module and display the temperature on Gauges using the Blynk Application. This is an IOT “Internet of things” based project. With the help of Nodemcu esp8266 wifi module and Blynk application, the temperature can be monitored in Real-Time from anywhere around the world.
This is version2 of the DS18b20 waterproof temperature sensor monitoring system while in version1; I used the same temperature sensor with the Arduino and displayed the temperature value on a 16×2 LCD. Following is the video explaining how the DS18B20 waterproof Temperature Sensor is interfaced with the Arduino and the temperature is displayed on the 16×2 LCD. Maximum of the instructions used in Version1 will be used in this Tutorial.
In this tutorial, we will cover.
- DS18B20 introduction
- Complete Circuit diagram
- Blynk application designing and finally number
Other Tools and Components:
Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
About the DS18B20 Waterproof Temperature Sensor:
One-wire temperature sensors like the DS18B20 are devices that can measure temperature with a minimal amount of hardware and wiring. These sensors use a digital protocol to send accurate temperature readings directly to your development board without the need of an analog to digital converter or other extra hardware. You can get one-wire sensors in different form factors like waterproof and high-temperature probes–these are perfect for sensing temperature in many different projects and applications. And since these sensors use the one-wire protocol you can even have multiple of them connected to the same pin and read all their temperature values independently.
The DS18B20 Waterproof Temperature Sensor has three wires
- The red wire is the VCC wire: the operating voltage is 3 to 5 volts. In my case, I will use 3.3 volts.
- Yellow Wire is the Data wire: we usually connect a resistor between the data wire and VCC wire, I will explain this in the circuit diagram.
- The black wire is the Ground wire. This wire is connected with the Nodemcu Esp8266 wifi module ground.
This temperature sensor is capable of measuring the temperature ranging from -55°C to 125°C
Circuit Diagram of the Nodemcu Esp8266 DS18B20:
This is the complete circuit diagram of the Nodemcu esp8266 DS18B20 Waterproof temperature sensor monitoring system. This Schematic is designed in cadsoft Eagle 9.1.0 version. If you want to learn how to make a schematic and PCB then you can watch the following video.
Let’s first of all, start with the 5v regulated Power supply which is used to power up the Nodemcu esp8266 wifi module. This Power Supply is based on the famous LM7805 voltage regulator. J1 is the female power jack and this is where we connect a 12v adaptor, battery or a solar panel. Two 470uf capacitors are connected at the input and output sides of the voltage regulator. A 330-ohm resistor is connected in series with a 2.5v led. This is a current limiting resistor. The output of the voltage regulator is connected with the Vin pin of the Nodemcu esp8266 wifi module and the ground is connected with the ground. SV1 and SV2 are the female headers.
As you can see a 4.7 Kilo ohm resistor is connected between the VCC and data wire. You can also use a 10k resistor. The VCC is connected with 3.3 volts. The ground is connected with the Nodemcu esp8266 module ground. While the Data wire is connected with digital Pin D4 of the Nodemcu ESP8266 wifi module.
This is the Final Power Supply Circuit Board of the Nodemcu Esp8266 wifi Module. The Schematic and PCB designing is already explained in the video above.
DS18B12 interfacing with Nodemcu ESP8266 Interfacing:
As you can see the red wire which is the VCC wire is connected with the 3.3v, the ground wire of the DS18b20 temperature sensor is connected with the Nodemcu module ground pin, while the yellow wire which is the data wire is connected with the digital Pin D4 of the Nodemcu module. You can also see in the Picture above, a 10 kilo Ohm resistor is connected between the VCC and data wire. Usually, this resistor is 4.7 kilo Ohm but you can also use a 10k Resistor.
Blynk Application designing for the Nodemcu ESP8266 DS18b20:
- First of all, open the blynk application.
- set the project name as ds18b20.
- Click on the choose device and select Nodemcu.
- make sure you set the connection type to wifi and then click on the create button, an authentication token will be sent on your email id, which will be then used in the programming, simply copy and paste it in programming. This step is already explained in the video given at the end of this Article.
- Now click anywhere on the screen and search for the Gauge and add it. Resize the Gauge as per your requirement. Click on the Gauge and set the name as Celcius. Then click on the PIN and select Virtual Pin V3, change the Font size and make sure you click on the push button and you select 1 second.
- Now again click on the screen and add another gauge and follow the same exact steps.
Our application is ready and now let’s discuss the programming.
Nodemcu esp8266 ds18b20 Programming:
Before you start the programming for the Nodemcu esp8266 DS18B20 project, first of all, make sure that you download all the necessary libraries, and also make sure you update the Nodemcu board. These are the same libraries I have been using in all of my IoT based projects. The OneWire library and DallasTemperature are already used in Version1. The video link is already given above in the description section. For the complete program explanation watch video Tutorial given at the End of this Article.
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
char auth = "f24df138e4fe4d74967a74b95d475cf7";
/* WiFi credentials */
char ssid = "ZONG MBB-E8231-6E63";
char pass = "romeo1234";
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board "D4 pin on the ndoemcu Module"
Blynk.begin(auth, ssid, pass);
timer.run(); // Initiates SimpleTimer
* Send Sensor data to Blynk
temp = DS18B20.getTempCByIndex(0); // Celcius
Fahrenheit = DS18B20.toFahrenheit(temp); // Fahrenheit
Blynk.virtualWrite(V3, temp); //virtual pin V3
Blynk.virtualWrite(V4, Fahrenheit); //virtual pin V4