Remote Wi-Fi DHT11 Temperature and Humidity I2C 2 X 16 LCD Display With Two ESP8266 and Visuino

49,076

520

44

Published

Introduction: Remote Wi-Fi DHT11 Temperature and Humidity I2C 2 X 16 LCD Display With Two ESP8266 and Visuino

ESP8266 modules are great low cost stand alone controllers with built in Wi-Fi, and I already made a simple Blink instructable with ESP8266 NodeMCU module.

The advantage of the ESP8266 over Arduino and other controllers is the builtin Wi-Fi. In this Instructable I will show you how with the help of Visuino you can use two ESP8266 modules to make a remote LCD Display for Temperature and Humidity DHT11 sensor.

In the Instructable, I will use 2 NodeMCU modules. One version 0.9, and the other 1.0. The NodeMCU are the easiest way to program and experiment with ESP8266 controllers. This Instructable however can easily be done with other modules, and the Sensor module can even use ESP-01 module as it needs only one GPIO pin to connect to the DHT11 sensor.

Step 1: Components

  1. 2 NodeMCU ESP8266 boards (I used both NodeMCU 0.9, and NodeMCU 1.0 versions, but any other combination, or even stand alone ESP-12 will work)
  2. One DHT11 Sensor module I got from this cheap 37 sensors set
  3. One I2C 16x2 LCD Display (Back side of the LCD with the I2C adapter showed on Picture 2)
  4. 7 Female-Female jumper wires

Step 2: Connect the DHT11 to the First NodeMCU ESP8266 Module

  1. Connect Power(Red wire), Ground(Black wire), and Data(Gray wire) to the DHT11 Module (Picture 1 shows 2 different types of DHT11 sensor modules. As you can see the pins may differ, so connect carefully!)
  2. Connect the other end of the Ground wire(Black wire) to the Ground pin of the ESP8266 module (Picture 2)
  3. Connect the other end of the Power wire(Red wire) to the 3.3V Power pin of the ESP8266 module (Picture 2)
  4. Connect the other end of the Data wire(Gray wire) to the Digital pin 2 of the ESP8266 module (Picture 3)
  5. Picture 4 shows where are the Ground, 3.3V Power, and Digital 2 pins of the NodeMCU 0.9

Step 3: Connect the I2C LCD Display to the Second NodeMCU ESP8266 Module

  1. Connect Ground(Black wire), Power(Red wire), SDA(Green wire), and SCL(Yellow wire) to the LCD Module (Picture 1)
  2. Connect the other end of the SCL wire(Yellow wire) to SCL/Digital pin 1 of the ESP8266 NodeMCU board (Picture 2)
  3. Connect the other end of the SDA wire(Green wire) to SDA/Digital pin 2 of the ESP8266 NodeMCU board (Picture 2)
  4. Connect the other end of the Ground wire(Black wire) to the Ground pin of the ESP8266 NodeMCUboard (Picture 3)
  5. Connect the other end of the Power wire(Red wire) to the 5V(Called "Vin" in version 1.0) Power pin of the ESP8266 NodeMCUboard (Picture 3)
  6. Picture 4 shows where are the Ground, 5V(Vin) Power, Digital 1, and Digital 2 pins of the NodeMCU 1.0

Step 4: Start Visuino, and Select the ESP8266 Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6.

Make sure that you install 1.6.7 or 1.6.5, otherwise this Instructable will not work!

If you have not done follow the steps in this Instructable to setup the Arduino IDE to program ESP 8266!

The Visuino: https://www.visuino.com also needs to be installed.

  1. Start Visuinoas shown in the first picture
  2. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino
  3. When the dialog appears, select "NodeMCU ESP-12" as shown on Picture 2

Step 5: In Visuino: Setup the Module As Access Point

  1. In the Object Inspector, expand the "Modules" property, then the "WiFi" sub property, then the "AccessPoint" sub property (Picture 1)
  2. Set the value of the "SSID" sub property of the "AccessPoint", to “Thermometer” (Picture 1)

To make sure the Access Point will be on the 200.200.200.X subnet, we need to assign a fixed address.

  1. In the Object Inspector, expand the "Config" sub property of the "AccessPoint" property (Picture 2)
  2. Set the value of the “Enabled” sub property of the Config to “True” (Picture 2)
  3. Set the value of the “IP” sub property to "200.200.200.100" (Picture 3)

Step 6: In Visuino: Add an UDP Socket for the Communication

Next we need to add an UDP socket for the communication.

  1. In the Object Inspector, click on the "..." button next to the value of the "Sockets" sub property of the "WiFi" property (Picture 1)
  2. In the Sockets editor select “UDP Socket” on the right, and then click on the "+" button on the left (Picture 2)
  3. In the Object Inspector, set the value “RemoteIPAddress” property to “200.200.200.200” (Picture 3) – this is the fixed IP address that we will assign to the other module later on
  4. In the Object Inspector set the value of the “RemotePort” to “8888” (Picture 4)

Step 7: In Visuino: Add and Connect DHT11 Component

  1. Type "dht" in the Filter box of the Component Toolbox then select the "Humidity and Thermometer DHT11/21/22/AM2301" component (Picture 1), and drop it in the design area
  2. Connect the "Sensor" pin of the HumidityThermometer1 component to the "Digital" input pin of the "Digital[ 2 ]" channel of the "NodeMCU ESP-12" component (Picture 4)

Step 8: In Visuino: Add Make Structure Component, and Add Analog Channels to It

We need to send a packet of 2 analog values. To do this we will make a structure with 2 analog values and will send it over the UDP socket.

  1. Type "stru" in the Filter box of the Component Toolbox then select the "Make Structure" component (Picture 1), and drop it in the design area
  2. Click on the "Tools" button (Picture 2) to open the "Elements" editor (Picture 3)
  3. In the "Elements" editor select the “Analog” element on the right, and then click 2 times on the "+" button on the left (Picture 3) to add 2 Analog elements (Picture 4)
  4. Close the "Elements" editor.

Step 9: In Visuino: Connect the Make Structure Component

  1. Connect the “Temperature” pin of the HumidityThermometer1 component to the “In” pin of the “Elements.Analog1” element of the MakeStructure1 component (Picture 1)
  2. Connect the “Humidity” pin of the HumidityThermometer1 component to the “In” pin of the “Elements.Analog2” element of the MakeStructure1 component (Picture 2)
  3. Connect the “Out” pin of the MakeStructure1 component to the “In” pin of the "Modules.WiFi.Sockets.UDPSocket1” of the “NodeMCU ESP-12” component (Picture 3)

Step 10: In Visuino: Add and Connect Clock Generator Component

The project can be used as it is, but if you run it it will overwhelm the network with UDP packets, as it will keep sending thermometer readings very fast one after another. It is better to read the thermometer only once a second. The Thermometer component has a “Clock” pin, that can be used to control when the thermometer will perform a reading and send the value to the socket. We will use a Clock Generator component to control the Thermometer.

  1. Type "clo" in the Filter box of the Component Toolbox then select the "Clock Generator" component (Picture 1), and drop it in the design area
  2. Connect the "Out" pin of the ClockGenerator1 component to the "Clock" input pin of the HumidityThermometer1 component (Picture 2)

Step 11: Generate, Compile, and Upload the ESP8266 Code for the Thermometer

  1. In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
  2. Connect the first NodeMCU module (The one with the DHT11) with USB cable to the computer
  3. Select the board type and serial port as I have shown you in this Instructable
  4. Make sure you have installed the latest staging version of the ESP support! The stable release does not have some of the latest features, and you will have errors when you try to compile!
  5. In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 12: in Visuino: Select the ESP8266 Board Type, and Configure It to Connect to the Access Point

Now lets program the Display module.

  1. Start new project.
  2. Click on the "Tools" button on the Arduino component, and when the dialog appears, select "NodeMCU ESP-12" as you did in Step 4 for the Thermometer module

Next we need to configure the module to connect to the Access Point of the Thermometer module, and use a fixed IP Address of 200.200.200.200

  1. In the Object Inspector, expand the “Modules” property, then the “WiFi” sub property, then the “AccessPoints” sub property, and click on the "..." button next to its value (Picture 1)
  2. In the "AccessPoins" editor, select “WiFi Access Point”, and then click on the "+" button on the left, to add the access point (Picture 2)
  3. In the Object Inspector, set the value of the "SSID" property to “Thermometer” (Picture 3)
  4. In the Object Inspector, expand the “Config” property, and set the value of the “Enabled” sub property to “True” (Picture 4)
  5. In the Object Inspector, set the value of the “IP” sub property to “200.200.200.200” (Picture 5)

Step 13: In Visuino: Add an UDP Socket for the Communication

Next we need to add an UDP socket for the communication.

  1. In the Object Inspector, click on the "..." button next to the value of the "Sockets" sub property of the WiFi (Picture 1)
  2. In the Sockets editor select “UDP Socket” on the right, and then click on the "+" button on the left (Picture 2)
  3. In the Object Inspector, set the value “RemoteIPAddress” property to “200.200.200.200” (Picture 3)
  4. In the Object Inspector set the value of the “Port” to “8888” (Picture 4)
  5. Close the "Sockets" dialog

Step 14: In Visuino: Add and Connect LCD Component, and Add Elements to Display the Temperature

  1. Type "lcd" in the Filter box of the Component Toolbox then select the "Liquid Crystal Display (LCD) - I2C" component (Picture 1), and drop it in the design area
  2. Click on the "Tools" button (Picture 2) to open the "Elements" editor (Picture 3)

We will add a Text field with the description of the value, and Analog field to display the value for the Temperature and Humidity values.
First we will add Description and value fields for the Temperature:

  1. Add Text field for the Temperature description text by select the "Text Field" in the right window of the "Elements" editor, and clicking on the "+" button (Picture 3)
  2. In the Object Inspector set the "InitialValue" property of the element to "Temp:" (Picture 4) - This will specify the text to be displayed
  3. Add Analog field for the Temperature value by selecting the "Analog Field" in the right window of the "Elements" editor, and clicking on the "+" button (Picture 5)
  4. In the Object Inspector set the "Column" property of the element to "10"(Picture 6) - This will specify the staring column of the field

Step 15: in Visuino: Add, and Setup Text and Analog Value Elements to Display the Humidity

Next we will repeat the same steps for the Humidity:

  1. Add Text field for the Humidity description text selecting the "Text Field" in the right window of the "Elements" editor, and clicking on the "+" button (Picture 1)
  2. In the Object Inspector set the "InitialValue" property of the element to "Humidity:" (Picture 2)
  3. In the Object Inspector set the "Row" property of the element to "1" (Picture 3) - This will specify that the field will be shown in the second row of the Display
  4. Add Analog field for the Humidity value by selecting the "Analog Field" in the right window of the "Elements" editor, and clicking on the "+" button (Picture 4)
  5. In the Object Inspector set the "Column" property of the element to "10"(Picture 5)
  6. In the Object Inspector set the "Row" property of the element to "1" (Picture 6)

Step 16: In Visuino: Add Split Structure Component, and Add Analog Channels to It

The Thermometer module sends the temperature and humidity in binary floating point form as a structure. We need to decode it properly. For this we need a “Split Structure” component with 2 “Analog” elements in it.

  1. Type "split" in the Filter box of the Component Toolbox then select the "Split Structure" component (Picture 1), and drop it in the design area
  2. Click on the "Tools" button of the SplitStructure1 component (Picture 2) to open the Elements editor (Picture 3)
  3. In the "Elements" editor select the “Analog” element, and then click 2 times on the "+" button (Picture 3) to add 2 Analog elements (Picture 4)
  4. Close the "Elements" editor

Step 17: In Visuino: Connect the Components

  1. Connect the "Out" pin of the "Elements.Analog1" of the SplitStructure1 component to the "In" pin of the "Elements.AnalogField1" element of the LiquidCrystalDisplay1 component (Picture 1)
  2. Connect the "Out" pin of the "Elements.Analog2" of the SplitStructure1 component to the "In" pin of the "Elements.AnalogField2" element of the LiquidCrystalDisplay1 component (Picture 2)
  3. Connect the "Out" pin of the LiquidCrystalDisplay1 component to the to the "In" pin of the I2C channel of the “NodeMCU ESP-12” component (Picture 3)
  4. Connect the “Out” pin of the “Modules.WiFi.Sockets.UDPSocket1” (Picture 4) of the “NodeMCU ESP-12” component, to the “In” pin of the SplitStructure1 component (Picture 5)

Step 18: Generate, Compile, and Upload the ESP8266 Code for the Display

  1. In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
  2. Connect the second NodeMCU module (The one with the Display) with USB cable to the computer
  3. Select the board type and serial port as I have shown you in this Inctructable
  4. In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 19: And Play...

Congratulations! You have completed the project.

Picture 1 shows the connected and powered up project. As you can see on the picture the Display will show the temperature and the Humidity.

On Picture 2 you can see the complete Visuino diagram for the Temperature and Humidity measuring module.

On Picture 3 you can see the complete Visuino diagram for the I2C LCD Display module.

Also attached are the Visuino projects, that I created for this Instructable. You can download and open them in Visuino: https://www.visuino.com

3 People Made This Project!

Recommendations

  • Make it Move Contest

    Make it Move Contest
  • Casting Contest

    Casting Contest
  • Woodworking Contest

    Woodworking Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

I've completed the wifi temp project. The lcd shows no data, until I power up the esp8266 connected to the dht11. Then the LCD screen shows temp and humidity values of zero. Any idea what I've done wrong?

44 Comments

Cool :-) Thank you! It requires power injector and splitter circuitry that I don't have at the moment, and most people don't have either, but is a very cool approach for remotely powering the sensors :-)

I tried to make Instructable with ready, easily accessible off the shelf components.

I am still learning Visuino and still impressed with it.. I am still a little confused on adding programming or sending data. Could you do this with 2 nanos and two NRFL2401's for an example?

2 replies

Thank you!
The NRFL2401 is not yet supported, but I am working to add support for it. Will post tutorials too. For now the connection between Nanos can be done with Wi-Fi, although I prefer to directly program NodeMCUs instead ;-)

Thanks. I have a ton of NRF that I got cheap. It will take a while for esp8266 to arrive

Anyone just got the code as I do not want to use Visuino

Hello,

Im trying to verify and to write to the NODEMCU 0.9 but im getting the following error:

In file included from C:\Users\Pedro Maia\Documents\Visuino\Generated\Generated.ino:17:0:

C:\Users\Pedro Maia\Documents\Arduino\libraries\Mitov/Mitov_FormattedSerial.h:18:8: error: 'SerialConfig' does not name a type

const SerialConfig CSerialInits[] =

^

In file included from C:\Users\Pedro Maia\Documents\Visuino\Generated\Generated.ino:17:0:

C:\Users\Pedro Maia\Documents\Arduino\libraries\Mitov/Mitov_FormattedSerial.h: In member function 'virtual void Mitov::SerialPort<T_SERIAL_TYPE, T_SERIAL>::StartPort()':

C:\Users\Pedro Maia\Documents\Arduino\libraries\Mitov/Mitov_FormattedSerial.h:123:40: error: 'CSerialInits' was not declared in this scope

T_SERIAL->begin( inherited::Speed, CSerialInits[ AIndex ], SERIAL_FULL );

^

C:\Users\Pedro Maia\Documents\Arduino\libraries\Mitov/Mitov_FormattedSerial.h:126:40: error: 'CSerialInits' was not declared in this scope

T_SERIAL->begin( inherited::Speed, CSerialInits[ AIndex ], SERIAL_RX_ONLY );

^

C:\Users\Pedro Maia\Documents\Arduino\libraries\Mitov/Mitov_FormattedSerial.h:129:40: error: 'CSerialInits' was not declared in this scope

T_SERIAL->begin( inherited::Speed, CSerialInits[ AIndex ], SERIAL_TX_ONLY );

What should i do?


INFORMATION:

Windows 10 64 Bits

Arduino 1.6.7 (Package version: 2.1.0 RC2)

Visuino 7.7.0.74

8 replies

Hello PedroM104,

Update to the "Stable" 2.1.0.
The Stable 2.1.0 is not compatible with the 2.1.0 RC2 and this is the reason for the error. Visuino was updated to be compatible with the Stable "2.1.0" version.
To update:
1. Uninstall 2.1.0 RC2
2. Delete manually the "C:\Users\[USER_NAME]\AppData\Local\Arduino15\packages\esp8266" !
3. Change the preferences to point to the "stable" release as described here : https://www.instructables.com/id/Setting-Up-the-Arduino-IDE-to-Program-ESP8266/
4. Install the stable 2.1.0

Make sure you do step 2! Otherwise you will have errors, and will not be able to compile any ESP 8266 projects!

It worked, i managed to pass a few errors after this, i changed to COM5 and recompiled everything and its working ! YES ! My first Projected completed ! Thanks a lot !!!

Great! :-) You can post a picture of it ;-) . There is the "I made it" button on the top. It will be cool :-)

I will :) Thanks for the help.

You got any advice to make this a more portable device?
Currently im using two Smartphone Chargers connected to the devices.

Tomorrow i will take a further look, to tweak, make a few changes to learn more about this :)

I will :) Thanks for the help.

You got any advice to make this a more portable device?
Currently im using two Smartphone Chargers connected to the devices.

Tomorrow i will take a further look, to tweak, make a few changes to learn more about this :)

I will :) Thanks for the help.

You got any advice to make this a more portable device?
Currently im using two Smartphone Chargers connected to the devices.

Tomorrow i will take a further look, to tweak, make a few changes to learn more about this :)

I will :) Thanks for the help.

You got any advice to make this a more portable device?
Currently im using two Smartphone Chargers connected to the devices.

Tomorrow i will take a further look, to tweak, make a few changes to learn more about this :)

I will :) Thanks for the help.

You got any advice to make this a more portable device?
Currently im using two Smartphone Chargers connected to the devices.

Tomorrow i will take a further look, to tweak, make a few changes to learn more about this :)

Not sure :-( .

The Compilation went fine right ?

You can try a different USB port.

If I read this corectly then it only reads Celcius and only goes to 0 degree or 32 F is there a F sensor?

1 reply

The DHT11 component in Visuino has "InFahrenheit" boolean property ;-) . Check it, and you are in F ;-)

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16

tail 0

chksum 0x42

csum 0x42

~ld

get this error on the sensor board any help would be great

1 reply

What sensor board you use? DHT11?