Design of wireless temperature acquisition system based on nRF24L01

Publisher:未来感觉Latest update time:2011-08-06 Keywords:nRF24L01 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
The temperature collected by the temperature acquisition system is usually transmitted to the host computer through RS485 and CAN bus communication methods, but this method is difficult to maintain and is not conducive to industrial field production; while the wireless communication GPRS technology has a long transmission distance and reliable and stable communication, but the design is complex and the cost is expensive. Here, a low-cost single-chip nRF24L01 wireless transceiver with an industrial-grade built-in hardware link layer protocol is used to realize wireless communication between systems and complete the reception, display and alarm functions of wireless signals.

2 Introduction to nRF24L01
nRF24L01 is an industrial-grade low-cost wireless transceiver with a built-in hardware link layer protocol. The device operates in the 2.4 GHz global open ISM band, with built-in frequency synthesizers, power amplifiers, crystal oscillators, modulators and other functional modules, and integrates enhanced ShockBurst technology. Its output power and communication channel can be configured through the program. It has two data transmission modes: ShockBurst and Enhanced ShockBurst. It can be directly connected to the microcontroller I/O, with a small number of external components. nRF24L01 has low power consumption. When transmitting at -6 dBm power, the working current is only 9 mA; when receiving, the working current is only 12.3 mA. Multiple low-power working modes (power-down and idle modes) are more conducive to energy-saving design.

3 System hardware design
The system hardware design mainly consists of two parts: acquisition and transmission and reception and display. Figure 1 is the schematic diagram of the acquisition and transmission circuit. The circuit mainly consists of temperature sensor DS18B20, microcontroller STC12LE5408 and nRF24L01.




STC12LE5408 is an enhanced 8051 microcontroller with fast speed, high integration, wide voltage range (2.2~3.8 V), and is fully compatible with the MCS-51 series microcontroller instruction system. It also has 8 KB Flash program memory, 512 bytes RAM, 2 KB EEPROM, 4-channel PWM and hardware watchdog (WDT) and other resources. It has high cost performance.
DS18B20 is a single bus digital 1-Wire temperature sensor produced by DALLAS. It can directly convert temperature signals into serial digital signals for single chip microcomputer processing and adopts 1-Wire interface. The data terminal DQ of DS18B20 can be connected to STC12LE5408 through a 4.7 kΩ pull-up resistor. The CE, CSN, SCK, MOSI, MISO, and IRQ pins of nRF24L01 can be connected to any port of STC12LE5408, but it should be noted during programming that they are connected to the P1 port here. Since nRF24L01 has the function of receiving data, the receiving and displaying circuit is composed of single chip microcomputer STC12LE5408, nRF24L01 and display circuit. The collected data is also sent to the PC through the serial port for processing.
[page]

4 System Software Design
4.1 Software Settings of nRF24L01
Since STC12LE5408 does not have a standard SPI bus interface, software simulation is required to implement the SPI bus. Therefore, it should be written strictly in accordance with the timing requirements of SPI, otherwise the operation of nRF24L01 will fail. The various command words of nRF24L01 are only one byte, divided into read register, write register, read data receive buffer, write send data buffer, etc. When any command word is input, MISO outputs the content of the STATUS register. The read and write program code for RF24L01 is as follows:



The difference between the ShockBurst and Enhanced ShockBurst data modes of nRF24L01 is that the latter has one more signal to confirm data transmission than the former to ensure the reliability of data transmission. Initialize according to the Enhanced ShockBurst mode, the retransmission wait time is 250μs, the number of retransmissions is 10 times, the address is RX_ADR_WIDTH, the output power is 0 dBm, and the speed is 1 Mb/s. nRF24L01 is in POWER_UP state. In the function, WRITE_REG is the base address of the write command 0x20. The relevant program is as follows:

[page]

At the receiving end, configure nRF24L01 to receive mode, the address is RX_AW, the load data width is TX_PL_W, enable the interrupt after receiving data, the CRC check bit is 2 bytes, and nRF24L01 is in POWER_UP state. The relevant program code is as follows:




4.2 Data acquisition and transmission subroutine
After the data acquisition and transmission part is powered on, first configure the relevant registers of nRF24L01. Make it work in the transmission state, then reset DS18B20, send the temperature conversion command to DS18B20, read the converted temperature value, and then send it by nRF24L01. The process is shown in Figure 2.


[page]

It should be noted here that DS18B20 is a single bus device. Its hardware interface is relatively simple, which is at the expense of relatively complex software programming. The interface protocol between DS18B20 and the microcontroller is also implemented through strict timing. Although the software overhead is increased, the STC12LE5408 can meet the system requirements due to its fast running speed. In addition, the program for operating DS18B20 must be performed in the order of initialization, ROM operation command, memory operation command, and execution/data. If there is only one DS18B20 on the bus, the ROM command can be skipped after initialization, and then the temperature conversion command can be sent. After the temperature conversion is completed, the temperature value is temporarily stored in the transmission buffer tx_buf, and then sent through nRF24L01. The relevant program code is as follows:




4.3 Data reception display subroutine
nRF24L01 is in the receiving state in the data reception display. When the nRF24L01 module is configured in the receiving mode, when a data interrupt is received, the data is read from the receiving FIFO. Then it is stored in the receiving buffer rX_bur. The relevant program code is as follows:




5 Conclusion
This paper introduces the wireless temperature acquisition system composed of nRF24L01 and STC12LE5408. The highly integrated nRF24L01 device is used. The system hardware and software design is greatly simplified, the volume is reduced, and the reliability of the system operation is improved. The new generation enhanced 8051 microcontroller STC12LE5408 is used to reduce the system cost and shorten the development time. Practice has proved that the system is simple in design, low in cost, reliable in communication, stable in operation, reliable in performance, and has high practical value.

Keywords:nRF24L01 Reference address:Design of wireless temperature acquisition system based on nRF24L01

Previous article:Wireless Data Acquisition System Based on S3C2410
Next article:Design of CAN adapter card in generator status monitor

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

STC89C52 MCU receiving (RX) C language program based on NRF24L01 wireless module
This program is the receiving program of NRF24L01 wireless module. RevTempDate is used to store the received data, and the last digit is used to store the end code. #include reg52.h #define unchar unsigned char #define unint unsigned int /****************************************************** ******/ #define TX_
[Microcontroller]
Latest Test Measurement Articles
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号