Design of data collection box based on NRF24L01

For the increasingly demanding of real-time temperature monitoring in industrial and agricultural production, a data collection box based on wireless communication module NRF24L01 is designed, temperature is collected by a high-precision temperature sensor AD590.Design method of hardware and software of the system is described in detail, the configuration method of NRF24L01 is given. The application of this design in wireless temperature collection system is discussed.The experimental result shows that the design has realized two real-time monitoring on temperature of two points, it can display the value in different environment, a sounder is equipped in the design to alarm for over-temperature.


INTRODUCTION
With the development of the information technology, traditional data recorded in the register using manually has been far from satisfying the requirements of industrial production now , while the data acquisition system which using wireless transmission module and Micro Control Unit (MCU) with characteristics of automated and unattended, making them widely used in many situations. With the industrialization of agriculture, many farmers realize that they must get rid of the backward traditional farming method, using the modern science and technology to meet the challenges of agricultural imports, then enter foreign market. A growing number of new greenhouses are established in all parts of a country [1], planting the turn over season vegetables and flowers. The construction of a large number of thermostat refrigerator provides a broad market for measurement and control technology of temperature and humidity generally, the collected temperature by acquisition system is typically communicated by RS485 \ CAN bus [2] . But in this way, it is more difficult to maintain and is not conducive to the production of industrial field. The paper presents a temperature acquisition box based on NRF24L01, it collects temperature information by wireless means, the system structure is simple and easy to install.

The overall architecture of the system
The temperature acquisition box designed in this paper is mainly composed by temperature acquisition module, wireless communication module, display module and alarm module. The overall block diagram of the system is shown in Figure 1.   sensor AD590. Converts the current which from AD590 into a voltage by conditioning circuit, then processing it through the amplifier circuit and AD conversion circuit, sends the converted data into microcontroller, at last converts the data into temperature. Corresponding to the environment after analysis and processing. Output the temperature data to LCD1602 to display through the I/O ports , comparing the collected data with the limit number set by the keyboard and determine whether to execute sound and light alarm or not . Finally transmit it by the wireless transceiver module NRF24L01. When the receiver module receives the data it will transfer the data to the microcontroller. Then temperature will be displayed on the LCD1602 by the keyboard after analysis and processing. Determine whether to execute sound and light alarm or not.

Hardware system design
Hardware system is mainly composed by a temperature acquisition and signal conditioning modules, analog to digital conversion module, and wireless transceiver module.

3.1Temperature Acquisition and Signal Conditioning Module
AD590 is a 2-terminal integrated circuit temperature transducer that produces an output current proportional to absolute temperature. It has normalized output and inherent linearity. Supply voltages between 4V and 30V, wide temperature range -55 ℃ to +150℃ . Since the AD590 is a current output element, constant current regulator passing 1 uA/k , therefore it's output current I=298uA at room temperature 25℃.

Figure .2.temperature acquisition module
In order to measure the voltage and ensure that the output current I is not diverted, use voltage follower, the output voltage applied to the AD converter. The chip op07 is a kind of low noise, with high open-loop gain, is unsurpassed for amplification of very-low-level signals.

Wireless communication module
NRF24L01 is a single chip radio transceiver for the world wide 2.4-2.5GHz ISM band , the transceiver consist of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator , modulator and Enhanced ShockBurst protocol engine . Output power, frequency channels and protocol setup are easily programmable through a SPI interface. Current consumption is very low, only 9.0 mA at an output power of -6dB and 12.3 mA in RX mode. Built-in Power Down and Standby modes makes power saving easily realizable. The module is connected with the microcontroller shown in Figure 3.

Software system design
The software mainly including two parts, one is the measurement module which collects signal and then transmit, the other is the control module receives signal and processes it and then displays on the LCD. The flow chart is shown in Figure 4.
When transmitting data, we should configure the NRF24L01 as TX mode , including write the notes TX_ADDR and TX_PLD into the TX FIFO according to the timings, configure automatic responses, set the transfer rate and enable the CRC and so on . TX_PLD must be written sequentially when the CSN is low, while TX_ADDR can be only write one time when transmitting , then make CE pin maintain high for 10 μ s , transmit the data after a delay 130 μs.
If turn on auto-answer, NRF24L01 goes into RX mode when the data is transmitted completely to receive the ACK signal. If a valid packet is found, believes that the communication is successful, set the TX_DS high, meanwhile Clear the TX_PLD from the TX FIFO.
If a valid packet is not found, it will re-transmit the data automatically(turn on automatic retransmission) , if reach the ARC limit , set the MAX_RT high , the data in the TX FIFO is retained to resend again . When the MAX_RT or the TX_DS is high, set the IRQ low and interrupt is generated to notify the MCU. If CE=0 NRF24L01 returns to standby-I mode. If CE=1, next action is determined by the status of the TX FIFO.If the TX FIFO is empty and CE=1 the nRF24L01 goes into standby-II mode.
When receiving data , we should configure the NRF24L01 as RX mode , delay 130 μs and then enter the receiving state waiting for the data . If a valid packet is found(by a matching address and a valid CRC) the payload of the packet is presented in a vacant slot in the RX FIFO.Meantime have the RX_DR set high and IRQ set low , and interrupt is generated to notify the MCU to take the data . If turn on auto-answer, the receiver terminal will enter the TX mode to post back the response signal. Finally, when receiving success, If CE=0 BRF24L01 returns to standby-I mode. Be sure the NRF24L01 enter the standby mode or power-down mode before write data into the register. SPI_RW_Reg(WRITE_REG + RX_PW_P1, RX_PLOAD_WIDTH); //Set up the receive data length SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x0f); //TX_PWR:0dBm , Data rate:1Mbps SPI_RW_Reg(WRITE_REG + CONFIG, 0x0f); // IRQ receive complete interrupt，16 bit CRC It should make the following procedures to ensure the NRF24L01 to do the dual-channel communication: (1) Set the register EN_AA and EN_RXADDR to 0x3f, to make all channels receiving data and automatic Response.
(2) The register RX_PW_Px(x represents the channels) is used to set the length of the received data, the maximum is 32 bytes.
(3) Write the address of receiver channel, 40-bit address for P0 and P1, but only 8-bit address for P2 to P5, because their high 32 bits are same to P1, so just to write one-byte address.
(4) Particularly, when write the receiver channel address it should write the low address first.

System Verification Experiments
The whole functional test of the system including NRF24L01 wireless communication and the measure accuracy of the temperature is given. Test two point temperature data, the transmitter collect temperature, the MCU process the data and then display it on the LCD, finally transmit it through the NRF24L01. At the receiver terminal use the LCD to show the received temperature data, and determine whether to execute sound and light alarm or not. After starting the system, it can do the wireless communication normally, the user interface can display the acquisition temperature data correctly. After calibration, the relationship between the actual temperature and measuring temperature are shown in Table 1 and Table 2.

Conlusion
The paper describes the wireless temperature acquisition system composed of NRF24L01 and AT89S52 microcontroller. It adopts the highly integrated devices NRF24L01, simplifies the hardware and software design of the system, reduces the volume, improves the reliability of the system. Finally, the test results show that the design of the data collection box which is based on the wireless transmission, can successfully collect temperature data, and send and receive it through wireless mode, display the collected temperature data on the LCD screen, through LEDs and buzzer implements producing an alarm signal. The design of the data acquisition system will eventually be able to collect twopoint temperature. The receiver module can use the two channels of the NRF24L01 successfully, avoiding the waste of the resources.