ESP8266IOT Projects

LM75 with ESP8266 & Blynk, IoT temperature Sensor WiFi

LM75 with ESP8266 and Blynk:

 

LM75 with ESP8266 & Blynk, IoT temperature Sensor WiFi- In this article, you will learn how to make an IoT temperature monitoring system using I2C supported CJMCU-75 or LM75A temperature sensor, ESP8266 Wemos D1 Mini, SSD1306 I2C supported Oled display module, a 5V buzzer, and Blynk application.

In my previous article, I used the LM75A temperature sensor with the Arduino, which was basically a getting-started tutorial. In that article, I covered the most basic things including the LM75A features, specifications, Pinout, applications, its interfacing with Arduino, LM75A library installation, and it’s programming. So, if you want to learn about the most basic things, then I highly recommend; read my previous article.

allpcb circuit

Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.




Anyway, the reason behind writing this article is, that the LM75A temperature sensor is not yet so popular and there is not enough data available on the internet. So, I thought I should make a complete series on this temperature sensor. So, that’s why, first, I used the LM75A sensor with the Arduino, and today I will be using it with the ESP8266 WiFi module. Because I believe many of you guys might be interested in sending the temperature values to the Blynk application, I am sure you know about the Blynk application. Anyway, Blynk is an IoT platform designed for Android and IOS which you use to design dashboards for monitoring different types of sensors and for controlling electronic devices from any part of the world.

LM75 with ESP8266

One more thing that I would like to talk about is, right from the beginning I have been using the Nodemcu version of the ESP8266 WiFi module which is no doubt one of the most popular WiFi boards for IoT projects and personally this is my favorite one. But there are also some other versions of the ESP8266 which are low-cost and much smaller in size.

Like the one you can see on the screen is the ESP8266 d1 mini which is also known as Lolin Wemos D1 R2 Mini. You may also call this as the mini Nodemcu ESP8266 WiFi module. The only difference between the two boards are d1 mini is smaller in size and it has less IO pins. The programming is 100% the same. Any program which is written for the Nodemcu ESP8266 WiFi module will also run on the D1 Mini version of the ESP8266. Just don’t use the pins which are not available in D1 Mini version of the ESP8266.

So, today, I will be using this mini D1 module. But you can also use the Nodemcu ESP8266. Anyway, before I explain the circuit diagram and programming first let’s watch the LM75A sensor based IoT temperature monitoring system in action.



LM75 with ESP8266

I have connected the SSD1306 Oled display module, LM75A temperature sensor, and the 5V buzzer as per the circuit diagram which I will explain in a minute. You can power up the ESP8266 D1 Mini using a 3.7V Lipo battery or you can use your laptop or computer. For now, I am going to use my laptop to power up this project.

LM75 with ESP8266

My Blynk application and ESP8266 D1 Mini both are connected with the WiFi. You can see the temperature in Celsius and Fahrenheit on the Oled display module and also on the Blynk application. I have done its programming in a way that when the temperature exceeds 45 Celsius a notification message is sent to the Blynk application.

LM75 with ESP8266

I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started.



Amazon Links:

SSD1306 Oled display Module

LM75A I2C supported Temperature Sensor

5V buzzer

ESP8266 D1 Mini

ESP8266 Nodemcu

ESP32 WiFi + Bluetooth Module (Recommended)

Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.

LM75A Temperature Sensor:

LM75 with ESP8266

This is the CJMCU-75 I2C supported temperature sensor which is also known as LM75 or LM75A temperature sensor. With this temperature sensor, you can read temperature in both Celsius and Fahrenheit. The temperature range is from -55 Celsius to +125 degree Celsius.

The LM75A is an industrial standard digital temperature sensor with an integrated sigma-delta analog-to-digital converter (ADC). The LM75A provides 9-bit digital temperature readings with an accuracy of ±2°C from –25°C to 100°C and with an accuracy of ±3°C over –55°C to 125°C.

The LM75A operates with a single supply from 2.7 V to 5.5 V. Due to this wide range of input voltages it can be easily used with 3.3V compatible controller boards like esp8266, ESP32, etc., and 5V compatible controller boards.

LM75 with ESP8266

Communication is accomplished over a 2-wire interface which operates up to 400 kHz. LM75A has three selectable logic address pins A0, A1, and A2, allowing up to eight LM75A devices to operate on the same 2-wire bus. A0, A1, and A2 can be used to set an I2C address. You can short any of these address pins with the VCC or ground. This way you will be able to connect 8 temperature sensors without any address conflict.

The LM75A has a dedicated over-temperature output (O.S.) with programmable limit and hysteresis.

LM75A temperature sensor can be used in base stations, electronic test equipment, office electronics, personal computers, Environmental Monitoring, and any other system in which thermal management is critical to performance.



ESP8266 D1 mini (Wemos Lolin):

LM75 with ESP8266

The D1 Mini V2 NodeMcu is 4M Bytes Lua WIFI Internet Of Things Development Board Based ESP8266, it is a mini WIFI board based on ESP-8266EX. 11 digital input/output pins, all pins have interrupt/PWM/I2C/one-wire supported(except D0) 1 analog input(3.3V max input) and a Micro USB connection.

The development board features WiFi-SoC ESP8266 and is made for fast Internet-of-Things (IoT) prototyping. It is flashed with the latest firmware version and can be set up and programmed right away with the onboard micro USB connection. With only a few lines of code, the NodeMCU Dev Kit connects to your local network and ready for control by other network members like computers and smartphones.

The d1 mini is an ESP8266 development board that is compact, versatile and very easy to use with the Arduino IDE. It supports natively by the Expressive SDK.

Pins Description:

Pin Function ESP-8266 mini Pin
TX TXD TXD
RX RXD RXD
A0 Analog input, max 3.2V A0
D0 IO GPIO16
D1 IO, SCL GPIO5
D2 IO, SDA GPIO4
D3 IO, 10k Pull-up GPIO0
D4 IO, 10k Pull-up, BUILTIN_LED GPIO2
D5 IO, SCK GPIO14
D6 IO, MISO GPIO12
D7 IO, MOSI GPIO13
D8 IO, 10k Pull-down, SS GPIO15
G Ground GND
5V 5V
3V3 3.3V 3.3V
RST Reset RST

Features:

  1. 11 digital input/output pins
  2. Interrupt/PWM/I2C/one-wire
  3. 1 analog input(3.2V max input)
  4. 16M bytes(128M bit) Flash
  5. External antenna connector
  6. Built-in ceramic antenna
  7. New CP2104 USB-TO-UART IC

Now, let’s take a look at the circuit diagram.




LM75 interfacing with the ESP8266:

LM75 with ESP8266

The SCL and SDA pins of the LM75A temperature sensor and Oled display module are connected together and then connected with the ESP8266 D1 and D2 pins. D1 is the SCL and D2 is the SDA. While the VCC and GND pins are connected with the 3.3V and GND pins.

The 5V buzzer is controlled using D6 pin of the ESP8266 D1 mini. We use 2n2222 NPN transistor and a 10K ohm resistor to control the 5V buzzer. The transistor and resistor make the driver circuit. Now, let’s work on the Blynk application. Follow the same exact steps.

Creating a Dashboard in Blynk application:

Open the Blynk application and click on the New Project.

LM75 with ESP8266



As we are using ESP8266, so click on the ESP8266 and give name to the project which is LM75 Temp monitor.

LM75 with ESP8266

After that click on the create button an authentication token will be sent on a registered email id.

LM75 with ESP8266

After that click on the add button and add the gauge for the Centigrade.

LM75 with ESP8266



The gauge name will be Centigrade and in pin select virtual pin V1 and set the maximum value to 200.

LM75 with ESP8266

Similarly, add another gauge for the Fahrenheit and set the pin to V2 and the maximum value to 200.

LM75 with ESP8266

After that, we will add a notification widget in order to receive the exceeded temperature notification.

LM75 with ESP8266

My dashboard is completed, as you can see in the image given below.

LM75 with ESP8266



Required Libraries:

Before, you start the programming, first of all, make sure you download all the necessary libraries. The Adafruit_GFX.h and Adafruit_SSD1306.h libraries I have been using for quite a long time and I have already explained how to download and use these libraries.

Download: Adafruit_GFX.h

Download: Adafruit_SSD1306.h

I have also a very detailed getting started tutorial on the ESP8266 WiFi module, in which I have explained how to install the ESP8266 using the Boards manager URL link and how to install and use the BlynkSimpleEsp8266.h.

You will also need the LM75A library.

Download LM75A

LM75 with ESP8266

To add this library simply click on the Sketch menu and then go to Include Library and click on the Add ZIP library… browse to the desired location and select the zip folder and then finally click on the open button.

LM75 with ESP8266

As I have already added this library so I will click on the cancel button.




LM75 ESP8266 Programming:

 

This code is the modified version of the code I used with the Arduino. This time I made a few changes in order to send temperature values to the Blynk application. The first addition is the BlynkSimpleEsp8266.h header file. I also added the authorization and WiFi credentials. This time, I am using D6 pin to control the buzzer, while previously I was using digital pin 3 on the Arduino.

In the void setup() function, I activated the Blynk.

In the loop() function I only added 4 lines.

The Blynk.run()

Blynk.virtualWrite(V1,temperature_in_degrees);

Blynk.virtualWrite(V2,LM75A::degreesToFahrenheit(temperature_in_degrees));

These two instructions sends the temperature values in Celsius and Fahrenheit on the virtual pins V1 and V2 which I defined while making the Blynk application. And

Finally, I added this Blynk.notify() to send a notification message. So, that’s all about the programming.

Now, to upload the program, go to the Tools menu, then to boards, and select LOLIN(WEMOS) D1 R2 & mini.

LM75 with ESP8266

Again go to the Tools menu and this time check if the correct communication port is selected. Finally, click on the upload button and wait for a while.



Watch Video Tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button