This design uses industrial-grade built-in hardware link layer protocol low-cost single-chip nRF24E01 wireless transceiver device to achieve wireless communication between systems, complete wireless signal reception, display and alarm functions. The temperature information collected by the temperature acquisition system is usually transmitted to the upper computer through RS485, CAN bus communication, 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 Complex, expensive, and high operating costs later. nRF24E01 Introduction System hardware design The system hardware design is mainly composed of acquisition, sending, receiving and displaying. Figure 1 is a schematic diagram of the acquisition and transmission circuit, the circuit is mainly composed of the temperature sensor DS18B20 and nRF24E01. Figure 1 Schematic diagram of the acquisition and transmission circuit DSl8B20 is a single-bus digital 1-Wire temperature sensor produced by DALLAS, which can directly convert the temperature signal into a serial digital signal for single-chip processing. It uses a 1-Wire interface, and the data terminal DQ is connected to NRF24E01 through a 4.7kΩ pull-up resistor. Any IO port of nRF24E01 can simulate DQ communication signal through the program, but need to pay attention to when programming, here connect to P1 port. The collected temperature data is wirelessly transmitted to the receiving module after internal modulation and frequency mixing of NRF24E01. The receiving module can display or send the collected data to the PC through the serial port for processing. After the system software design data collection and transmission part is powered on, first configure the relevant registers of nRF24E01. Make it work in the launch state, then reset the DS18B20, send a temperature conversion command to the DS18B20, read the converted temperature value, and then send it by nRF24E01. Because the DS18B20 uses a single-wire read-write method, software simulation is required to implement 1-WIRE communication. Therefore, it should be written strictly according to the timing requirements of 1-Wire. Reset requires nRF24E01 to pull down the data line for 500μs and then release. When DS18B20 receives the signal, it waits for 16 ~ 60μs, and then sends out a low pulse of 60 ~ 240μs. The main CPU receives this signal to indicate that the reset is successful. . Figure 2 Flow chart of temperature data collection and sending The main program code of RF24E01 is as follows: (1) nRF24E01 reads and writes data to DSl8B20 through time gap processing bits and command words to confirm information exchange. The design procedure according to the timing diagram of "single-wire reset pulse timing and 1-wire presence detect" is as follows: Inverter Charge System,Commercial Storage Inverter,Pv Generation System,Solar Power Inverter Charger System Bosin Power Limited , https://www.bosinsolar.com
The nRF24E1 transceiver is a system-level chip introduced by Nordic VLSI. It adopts advanced 0.18μs CMOS process and 36-pin QFN package. Based on the nRF2401 / 02 chip structure, the radio frequency, 8051 MCU, 9-input 12-bit ADC, 125 channels, UART, SPI, PWM, RTC, WDT are all integrated into a single chip. nRF24E01 is an industrial-grade low-cost wireless transceiver with built-in hardware link layer protocol. The device works in the 2.4GHz global open ISM band, built-in frequency synthesizer, power amplifier, crystal oscillator, modulator and other functional modules, and integrated enhanced ShockBurst technology, its output power and communication channel can be configured by the program. It has two data transmission modes: ShockBurst and Enhanced ShockBurst. nRF24E01 has low power consumption. When transmitting at -6dBm, the operating current is only 9mA; when receiving, the operating current is only 12.3mA. A variety of low-power operating modes (power-down and idle mode) are more conducive to energy-saving designs. nRF24E1 / nRF24E2 is suitable for wireless mouse and keyboard, wireless handheld terminal, wireless frequency identification, digital video, remote control and automotive electronics and other short-range wireless high-speed applications.
uint get_temperature ()
{
float wendu;
uchar a, b;
ds_reset ();
delay (1); // about 2ms
ds_write_byte (0xcc);
ds_write_byte (0xbe);
a = ds_read_byte ();
b = ds_read_byte ();
temp = b;
return temp;
// Return temperature related data
}
(2) Send function, transmit the temperature data through wireless, the realization function is as follows:
void Transmitter (unsigned char b) {// Sending function
unsigned char mtemp;
CS = 1;
Delay100us (0);
for (mtemp = 0; mtemp
}
CS = 0;
TransmitPacket (b);
// Send data packet
}
}