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.
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
- Popular Resources
- Popular amplifiers
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Design of high-speed counter based on FPGA.pdf
- Problems encountered in learning C programming language
- 5G Common Terms and Abbreviations
- I found a very good introductory book on 51 single-chip microcomputers and recommend it to beginners. It is suitable for self-study by novices (Wang Yun)
- Application of Bypass Capacitors in High-Speed Circuit Environment
- Design of software and hardware C delay program for MSP430
- IC layout Seeking talents Seeking talents Seeking talents Seeking talents Coordinates: Shanghai, Shandong, Nanjing
- Optical module SFF-8472 problem solving
- Develop smart devices based on ESP32 to access the smart home ecosystem HomeAssistant
- ST Value Series NUCLEO-G071RB Development Board Introduction