Design of wireless temperature and humidity detection system based on nRF24L01

Publisher:collectorsLatest update time:2014-03-03 Source: elecfansKeywords:nRF24L01 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

  In today's industrial and agricultural production, there are more and more occasions where temperature and humidity collection is required, and accurate and convenient temperature measurement has become crucial. Traditional wired temperature measurement methods have problems such as complex wiring, easy aging of lines, difficulty in troubleshooting line faults, and re-layout of equipment. Especially when the wired network is not smooth or it is inconvenient to set up lines due to limitations of on-site environmental factors, it brings great trouble to the data collection of temperature and humidity. In order to monitor real-time temperature and humidity data, it is necessary to use wireless transmission to collect, send, and receive data, and process the wirelessly collected data through the host computer to control and monitor the operation of the equipment and reduce unnecessary line equipment expenses.

  1 System Block Diagram

  The multi-channel wireless temperature and humidity detection system designed in this paper combines the single-chip detection control system with the radio frequency communication system. The system consists of two parts: the host and the slave. The slave is responsible for detecting temperature and humidity, and sends the collected data to the host through the radio frequency system. The host receives the signal sent by the slave and communicates with the PC through the serial port to record the data. At the same time, the upper and lower limits of the alarm data can be set through the PC. The system composition block diagram is shown in Figure 1.

Figure 1 System composition block diagram

Figure 1 System composition block diagram

  2 System Hardware Circuit

  The system's temperature and humidity data are collected using a digital temperature and humidity sensor DHT11. The 51 series enhanced single-chip microcomputer STC12C5A08S2 is used as the core and the wireless radio frequency nRF2401 constitutes the transceiver circuit. The slave uses LCD1602 for display, and the host uses LCD12864 for display. The entire display system can be connected to a PC host computer.

  2.1 Temperature and humidity acquisition circuit design

  DHT11 is a temperature and humidity composite sensor with calibrated digital signal output. The sensor uses dedicated digital module acquisition technology and temperature and humidity sensing technology, with extremely high reliability and excellent long-term stability. Figure 2 shows its temperature acquisition circuit. The DHT11 sensor includes a resistive humidity sensing element and an NTC temperature measuring element, which can be connected to a high-performance 8-bit microcontroller. The calibration coefficients are stored in the OTP memory in the form of a program, and these calibration coefficients can be called in the sensor during the signal detection process. The single-wire serial interface makes system integration simple and fast, and the signal transmission distance can reach more than 20m. When the length of the connection line is shorter than 20m, a 5kΩ pull-up resistor should be used. When it is greater than 20m, a suitable pull-up resistor should be used according to the situation.

Figure 2 Temperature acquisition circuit

Figure 2 Temperature acquisition circuit

  2.2 Wireless transmission and receiving circuit design

  nRF24L01 is a wireless communication chip produced by NORDIC. It adopts FSK modulation and integrates NORDIC's own Enhanced Short Burst protocol. It can realize point-to-point or 1-to-6 wireless communication. The wireless communication speed can reach 2 Mb/s. The circuit schematic diagram of NORDIC wireless transmission and receiving chip nRF24L01 is shown in Figure 3.

Figure 3 Schematic diagram of wireless transmission and reception

Figure 3 Schematic diagram of wireless transmission and reception

  nRF24L01 is a single-chip RF transceiver chip that operates in the 2.4~2.5 GHz ISM band. The chip has built-in frequency synthesizer, power amplifier, crystal oscillator and modulator and other functional modules. The output power and communication channel can be configured through the program. The energy consumption of the nRF24L01 chip is very low. When transmitting at a power of -5 dBm, the operating current is only 10.5 mA, and when receiving, the operating current is only 18 mA. It has a variety of low-power operating modes, energy-saving and environmentally friendly, and easy to design. [page]

  The functions of the pins of the nRF24L01 wireless transceiver module are listed in Table 1. Figure 4 shows the circuit diagram when the nRF24L01 is connected to the microcontroller.

Figure 4: Circuit diagram of wireless module and CPU connection

Figure 4: Circuit diagram of wireless module and CPU connection

  The power supply required by this wireless transmitting and receiving module is 1.9~3.6 V. In this system, a 3.3 V DC power supply is used to directly power the wireless transmitting and receiving module. The 5 V power supply can be converted by the ASM1117-3.3 chip to obtain a stable DC power supply. The power conversion circuit is shown in Figure 5.

Figure 5 Wireless module power conversion circuit

Figure 5 Wireless module power conversion circuit

  2.3 Serial Communication Module

  After the host microcontroller receives the data from nRF24L01, it can realize the download and upgrade of the microcontroller program through the MAX232 level conversion. At the same time, it can realize the communication between the microcontroller and the PC (host computer), so that the display data information can be transmitted to the PC through this circuit and displayed on the PC. The serial communication circuit is shown in Figure 6.

Figure 6 Serial communication circuit between MAX232CPE and PC

Figure 6 Serial communication circuit between MAX232CPE and PC

  3 Software Design

  3.1 Lower computer software

  This system is programmed using C language. The complete structure of the system program should be determined according to the requirements of the design task. Modular programming methods should be used as much as possible to divide the tasks into relatively independent functional modules, and the functions, time sequence and relationships of each module should be clarified. The system software design can be divided into several parts. The first is the writing of the underlying driver programs of each module, followed by system online debugging, and finally the writing of the system program for the host computer.

  The main program is the core of control and management. After the system is powered on, it is initialized first. After the system starts to operate normally, it then performs operations such as temperature and humidity monitoring and processing.

  3.2 Host computer software design

  The functions that the system host computer can complete include displaying the serial port number and prompting whether the serial port has been successfully opened; at the same time, the host computer can display the temperature synchronously with the lower computer, and can display the temperature in real-time curves; the host computer can set the lower limit temperature and humidity and the upper limit temperature and humidity, and can also alarm when it is higher than the upper limit temperature and humidity or lower than the lower limit temperature and humidity. After connecting the control circuit serial interface of the host microcontroller with the computer serial port through level conversion, select the correct communication protocol, set the baud rate, and then communication can be carried out. Figure 7 shows the operation interface of the host computer.

Figure 7 Host computer operation interface

Figure 7 Host computer operation interface

  The host computer software can be written on a PC using VC6.0, mainly to operate the MSComm control and the CserialPort class.

  First is the serial port setting. This system uses the initialization function InitPort (this, nport, nbtl, 'N', 8, 1, m_dwCommEvents, 512) in the CSERIALPORT class. nport is the serial port number, and nbtl is the baud rate. The nport and nbtl in the initialization function can be obtained by using the serial port number and baud rate combo boxes in the serial port setting dialog box.

  The second is to set the upper and lower limits of temperature and humidity. You can use the Start Monitoring function in the CSERIALPORT class, the WriteToPort function to send a string, and the StopMonitoring function to close the serial port process to set the upper and lower limits of temperature. The information is sent to the serial port through these functions. After the microcontroller receives the data from RS232, it compares it with its own temperature and then performs corresponding processing.

  The third is curve display. Dynamic curve display can use the SetRange (200, 400) and SetPos (temp) functions in the CHistogram class. SetRange sets the upper and lower limits, SetPos displays the corresponding data points on the graph, and temp is the processing result of the temperature and humidity data transmitted from the single-chip microcomputer. The specific moving curve can be realized by the functions in the CHistogram class.

  4 Conclusion

  After testing, it is found that in most cases, the data transmission distance of the wireless transmitter and receiver module is about 200 m without an antenna. The transmission power of the transmitter head and the receiving sensitivity of the receiver head may affect the transmission distance. If an antenna is added, the transmission distance will be greatly increased. In addition, during the debugging process, the oscillation resistor must be matched, otherwise the receiving distance will be shortened or even unable to receive.

  The digital signal of this system is sampled by the single-chip microcomputer. The real-time monitoring system composed of the digital temperature and humidity sensor based on DHT11 has many advantages such as high accuracy, strong anti-interference ability, simple circuit, etc. Then, the data can be sent to the PC for data storage, post-processing and display by using the communication between the single-chip microcomputer and the PC. This system has powerful data processing functions, intuitive display, friendly interface, and high cost performance. It can be widely used in many fields such as industrial control, instruments, meters, agricultural breeding and smart home.

Keywords:nRF24L01 Reference address:Design of wireless temperature and humidity detection system based on nRF24L01

Previous article:Design and implementation of temperature controller based on single chip microcomputer and fuzzy control
Next article:Design of intelligent control system for LED street lamps

Recommended ReadingLatest update time:2024-11-16 16:24

Multi-channel wireless temperature detection system based on MSP430 single chip microcomputer
0 Introduction Temperature plays an extremely important role in human daily life. At the same time, temperature detection is of great significance in the process of industrial and agricultural production. At present, temperature detection is mainly wired fixed-point temperature detection. The principle of temper
[Microcontroller]
Multi-channel wireless temperature detection system based on MSP430 single chip microcomputer
Design of nRF24L01 transmission and reception based on AVR microcontroller
#include "iom16v.h" #include "macros.h" #include "12864.h" //spi flag #define DDR_SPI DDRB #define DD_MOSI 5 #define DD_MISO 6 #define DD_SCK 7 #define DD_SS 4 #define CE PB3 #define IRQ PB2 //#define NRF24L01_MISOPB6 //Input 0 #defineHign_24L01_MISOPORTB|=(1 PB6) #defineLow_24L01_MISOPORTB &= ~(1 PB6) #defineRea
[Microcontroller]
Design of nRF24L01 transmission and reception based on AVR microcontroller
STM32 software simulates SPI timing to drive NRF24L01
In fact, the hardware SPI of stm32 itself is also very easy to use, but I still want to use software to simulate the timing of PSI.    SPI is a high-speed, full-duplex, synchronous serial communication bus. The SPI communication method is equivalent to a ring structure, consisting of four lines: CSN, MISO, MOSI, and S
[Microcontroller]
STM32 software simulates SPI timing to drive NRF24L01
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号