Basics project 083c ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – DHT11 sensor readings on LCD1602 I2C module


Basic: Project 083c

Project name:  ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF  transceiver moduleDHT11 sensor readings on LCD1602 I2C module

Tags: Arduino IDE, ESP8266 ESP-12E module, Nodemcu v3, Lolin, nRF Serial Adapter, nRF24L01, 2.4GHZ NRF24L01 Module, with PA LNA SMA antenna, NRF24L01 transceiver module, WINGONEER, PA, SMA and LNA with antenna , 2.4G NRF24L01 antenna wireless transceiver module,  Arduino, Arduino Uno, Arduino Mega, Arduino Nano, Arduino using NRF24L01 RF module, RF transceiver module,  2.4G, antenna in antistatic foam, wireless transceiver module kit, SPI wireless data transmission module, wireless data acquisition, NRF serial adapter, 5V-3.3V VCC adapter board for NRF24L01 wireless module, breakout adapter for NRF24L01, shield for NRF24L01 with ATMEGA48, base module for nRF24L01 with 3.3V regulator, socket adapter plate for 8pin NRF24L01, ATMEGA48 and NRF24L01 interface, USB adapter for NRF24L01, YL-105, YL 105, AS01-ML01DP3, Arduino Wireless Communication, nRF24L01 – 2.4GHz RF Transceiver With Arduino, nRF24L01 Arduino, LCD1602 I2C module, DHT 11, temperature and humidity

Attachments: transmittersketch, receiversketch, library1, library3, library2, library4

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. ESP8266 ESP-12E module and Micro USB cable 1pc

A6 GSM GPRS module

2.Arduino IDE (you can download it here)

3. Breadboard 1 pc

breadboard

4. NRF24L01 2.4GHZ RF transceiver module without or with external antenna PA LNA SMA  – 2pcs

NRF24L01

5. Jumper wires F-M, F-F

wires

6. Arduino Nano with Mini-B USB cable 1pc

arduino nano

7. LCD 1602 I2C module 1 pc

lcd 1602 i2c

8.DHT11 Humidity Temperature Sensor 1 pc

http://acoptex.com/uploads/D0.jpg

General

We will learn how to get the real-time temperature and humidity using DHT11 sensor module attached to ESP8266 ESP-12E module and transmit it to Arduino Nano via NRF24L01 transceiver module and print it on LCD1602 I2C module connected to Arduino Nano. The transmitter will be ESP8266 ESP-12E module with NRF24L01 transceiver module and receiver – Arduino Nano with NRF24L01 transceiver module.

Project steps:

  • ESP8266 ESP-12E module will get the real-time temperature and humidity (data) from DHT11 sensor module;
  • ESP8266 ESP-12E module will transmit the data to the Arduino Nano using NRF24L01 transceiver module;
  • Arduino Nano will receive the data from ESP8266 ESP-12E module using NRF24L01 transceiver module;
  • Arduino Nano will display data on LCD1602 I2C module.

Understanding the DHT 11 sensor module

You can read more about it here.

Understanding the LCD1602 I2C module

You can read more about it here.

Understanding the Arduino Nano

You can read more about it here.

Undestanding the NRF24L01 2.4GHZ RF transceiver module

You can read more about it here.

Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

You can read more about it here.

Signals and connections of the NRF24L01 2.4GHZ RF transceiver module

You can read more about it here.

Signals and connections of DHT11 sensor module

There are 3 : VCC (+5V), Data, GND (-)

Signals and connections of the Arduino Nano

You can read more about it here.

Signals and connections of the LCD1602 I2C module

LCD 1602 I2C module has 4 connections: GND (-), VCC (+5V), Serial Data Line (SDA) and Serial Clock Line (SCL).

Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

A6 GSM GPRS module

TX – transmit pin. GPIO pin

RX  – receive pin.  GPIO pin

3V3 (or 3V or 3.3V)- power supply pin (3-3.6V). 

GND ( or G) – ground pin.

RST – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

EN – Chip enable. Keep it on high (3.3V) for normal operation.

Vin – External power supply 5VDC.

D0-D8 – GPIO (General Purpose Input Output) pins 

D5-D8 – SPI interface

D1-D2– I²C/TWI Interface

SC (or CMD) – (Chip Select) – the pin that the master can use to enable and disable specific devices. GPIO pin

SO (or SDO) – Master In Slave Out (MISO) – SPI communication. The Slave line for sending data to the master. GPIO pin

SK (or CLK) – SCK (Serial Clock) – SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin

S1 (or SD1) – Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin

S2 (or SD2) – GPIO pin

S3 (or SD3) – GPIO pin

VU (or VUSB) – external power 5VDC.

A0 – ADC output.

RSV – reserved

Wiring

1.Trasmitter side

NRF24L01 transceiver module  adapter
NRF24L01 transceiver module adapter ESP8266 ESP-12E module
VCCVV (5V)
GNDGND (G)
CED4 (GPIO2)
CSND2 (GPIO4)
SCK D5 (GPIO14)
MOSI (MO)D7 (GPIO13)
MISO (MI)D6 (GPIO12)
IRQ NOT USED
DHT11 sensor module ESP8266 ESP-12E module
GNDGND
DATAD3 (GPIO0)
VCCVV(5V)

2.Receiver side

NRF24L01 transceiver module adapterArduino Nano
VCC5V
GNDGND
CED8
CSND10
SCKD13
MOSI (MO)D11
MISO (MI)D12
LCD1602 I2C moduleArduino Nano
GNDGND
VCC5V
SDAA4
SCLA5

Step by Step instruction

1. Adding ESP8266 platform to Arduino IDE

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 64 bit OS.

Download and install the Arduino IDE. You can download it here 

Open Arduino IDE. 

Open the Preferences window from the Arduino IDE. Go to File -> Preferences.

A6 GSM GPRS module

Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)

A6 GSM GPRS module

Open Boards manager. Go to Tools -> Board -> Boards Manager…

A6 GSM GPRS module

There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install

A6 GSM GPRS module

The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.

A6 GSM GPRS module
A6 GSM GPRS module

2. Uploading sketch to ESP8266 ESP-12E development board

If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. 

Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture’s driver (CH340)  for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.

If you have CP2102 chip then  you need to download the manufacture’s driver for this chip and install it in your PC. Driver for MacWindowsLinux or more.. 

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your ESP8266 ESP-12E module into your PC USB port.
  4. Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
  5. Select the correct com port.
  6. Open the transmittersketch , verify and upload it to your ESP8266 ESP-12E module.

3. Uploading sketch to Arduino Nano

  1. Do wiring.
  2. Open Arduino IDE.
  3. Connect the Arduino Nano to your PC with Mini-B USB cable. 
  4. Go to Tools->Board and select Arduino Nano.
  5. Go to Tools-> Processor and select ATmega328P (from January 2018 sold NEW Arduino NANO boards). To program old boards you need to choose ATmega328P (Old Bootloader). If you get an error while uploading or you are not sure which bootloader you have, try each type of processor 328P until your board gets properly programmed.
  6. Go to Tools->Port and select correct serial port. If you have an origianl Arduino Nano the driver for it will be installed automatically, if you have chineese Arduino Nano (non-original) if you can not see your board check the project here
  7. Open the receiversketch .
  8. Find your I2C address. Each device has an I2C address that it uses to  accept commands or send messages. Load the sketch over at http://playground.arduino.cc/Main/I2cScanner and follow the instructions to use it.  By opening up the Serial monitor at 9600 bps in Arduino IDE after you upload the sketch, Arduino will scan the address range looking for a reply.  Even though the documentation said it was 0x27, this scanner can detect different (in our case 0x3F)
    Modify the line LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE) (See part marked bold)
  9. Compile and upload the receiversketch to your Arduino Nano. To upload the sketch to the Arduino Nano, click the Upload button in the upper left to load and run the sketch on your board.
NRF24L01 transceiver module DHT11 NODEMCU

Code

1. Transmitter side

First we need to include the necessary libraries and create an RF24 and DHT objects. The two arguments of RF24 object are the CSN and CE pins : RF24 radio(2, 4); // CE, CSN . The two arguments of dht object are the DHT_PIN and DHT_TYPE. Next we need to create a so called pipe through which the two modules will communicate. We create the data array of 2 elements to send the temperature and humidity: float data[2].

We can change the value of this address to any string and this enables to choose to which receiver we will talk, so in our case we will have the same address at both the receiver and the transmitter.

In the setup section we need to initialize the radio object and using the radio.openWritingPipe() function we set the address of the receiver to which we will send data.radio. We setup and configure the RF radio: radio.begin(); We setup and configure the dht: dht.begin();

In the loop section using the radio.write() function we will send that data message (temperature in Celsius and humidity) to the receiver. The first argument here is the variable that we want to be sent. The second argument is the number of bytes that we want to take from that variable. In this case the sizeof() function gets all bytes of the data array. At the end of the program we will add half a second delay.

2.Receiver side

First we need to include the necessary libraries and create an RF24 and LiquidCrystal_I2C objects. The two arguments of RF24 object are the CSN and CE pins : RF24 radio(8, 10); // CE, CSN . We initialize the LCD -LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); Next we need to create a so called pipe through which the two modules will communicate. We create the data array of 2 elements to send the temperature and humidity: float data[2].

Using the radio.openReadingPipe() function we set the same pipe (address) as in the transmitter sketch and in that way we enable the communication between the two modules.We have the radio.startListening() function which sets the module as receiver.

in the loop section using the radio.available() function we check whether there is data to be received. If that’s true, first we create an data array of 2 elements, called “data”, in which we will save the incoming data.Using the radion.read() function we read and store the data into the “data” variable and diplay on LCD.

Summary

We have learnt how to get the real-time temperature and humidity from the DHT sensor module using ESP8266 ESP-12E module and transmit it to Arduino Nano via NRF24L01 transceiver module and print it on LCD1602 I2C module connected to Arduino Nano.

Thank you for reading and supporting us.

Libraries:

  • See attachments on the beginning of this project description
  • We have used the library – NewliquidCrystal which we downloaded, unzipped, changed the name of folder to LiquidCristal and added to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. If you have LiquidCristal folder in this location already – delete this folder and copy folder, which was made by you, to this location.
  • NRF24 library attached. You can read more about it here.Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.
  • Adafruit_Sensor library included.Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. 
  • DHT-sensor library included. You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries OR You can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->install . If it will be problem with compilation – remove 2 files from the library – DHT_U.cpp and DHT_U.h.

Project resources:

  • See attachments on the beginning of this project description

AcoptexCom

Has one comment to “Basics project 083c ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – DHT11 sensor readings on LCD1602 I2C module”

You can leave a reply or Trackback this post.
  1. ปั๊มไลค์ - 2020 June 2 Reply

    Like!! Really appreciate you sharing this blog post.Really thank you! Keep writing.

Leave a Reply

Your email address will not be published.