the development of society, air conditioning systems are widely used in modern office buildings and high-rise buildings. While improving and enhancing the quality of the internal environment of buildings, air conditioning also brings huge energy consumption. In modern buildings, most of the energy consumption of buildings in summer and winter is occupied by air conditioning. Therefore, how to reduce air conditioning energy consumption through scientific methods is an urgent problem to be solved.
Actively developing and rationally using energy-saving control technology and centralizing and unifying the management of decentralized air conditioners is an effective way to reduce air conditioning energy consumption. With the development of sensor technology, network technology, and computer technology, the detection, transmission, analysis and processing of various information data have the conditions and means to be realized, which has promoted the rapid development of the core technology of the Internet of Things and made the centralization and networking of split air conditioning control possible.
By studying the composition and actual application mode of the Internet of Things, we explore the introduction of it into the split air conditioning centralized control system and build a split air conditioning energy-saving control system based on the Internet of Things. Due to the wide distribution of various sensing nodes, the traditional single wired transmission method has the disadvantages of unstable transmission, poor human-computer interaction, weak real-time control, insufficient network integration, and inconvenient wiring in some applications. Therefore, the information transmission network should be built into a hybrid network architecture combining wired and wireless networks based on the Internet of Things technology, which can aggregate data to a concentrator for unified management and achieve accurate and stable transmission of data such as the operating status, energy consumption, and environmental conditions of the split air-conditioning system. The system structure is shown in Figure 1.
1 Introduction to LPC1766 and Si4432 Chips
LPC1766 is a LPC1700 series microcontroller based on the Cortex-M3 core launched by NXP. It integrates 10/100M Ethernet MAC, CAN bus channel, SPI interface, I2C bus interface, ADC module, etc. It has a wealth of peripheral interfaces and is suitable for embedded occasions that require high integration and low power consumption. The hardware components mainly include Ethernet module, RS485 module, sensor module, relay module, etc. The
RF transceiver uses the Si4432 chip from Silicon Labs. The chip has high integration, small size, low power consumption, and an ultra-high sensitivity of -118 dBm. It can provide excellent link quality and minimize power consumption while expanding the transmission range. Its operating frequency range is 240~930 MHz, the maximum output power can reach +20 dBm, and the transmission distance is long. Si4432 integrates antenna diversity, sleep wake-up timer, 64-byte transceiver FIFO and other functions. At the same time, the Si4432 chip also has functions such as frequency hopping and channel signal strength assessment. Its peripheral circuit only requires a 30 MHz crystal oscillator and several resistors, capacitors, inductors, etc. The circuit design is simple and low-cost. Therefore, it is very suitable for applications in mass production that are sensitive to size and cost.
2 Hardware Design
The LPC1700 series has two SSP interfaces that are compatible with SPI, SSI and Microwire buses, which can be flexibly configured according to the application. In this system, LPC1766 and Si4432 chips are connected through SSP1. LPC1766 configures Si4432 internal registers through the SSP interface and realizes data reading and writing. The PORT0 and PORT3 ports of the chip have interrupt functions. When the pin level meets the set value, an interrupt will be triggered. Here, the P0.5 pin is connected to SDN to control Si4432 to enter the non-shutdown (SHUTDOWN) state.
The P0.4 pin is connected to nIRQ, and Si4432 can notify LPC1766 to handle interrupts through this pin. The TX pin of Si4432 is the RF signal transmitter, and the RXp pin is the differential signal receiver. Because a single antenna is used for data transmission, the RF signal transmitter and receiver must be connected to the antenna through the RF switch chip UPG2164 to switch the transmission and reception states. When GPIO0 is high and GPI01 is low, it is in the transmission state; when GPIO0 is low and GPIO1 is high, it is in the reception state. The circuit is shown in Figure 2.
3 Software Design
3.1 Basic Principles of Wireless
The state transition diagram of the Si4432 chip is shown in Figure 3. The chip has four states: disconnect, suspend, transmit and receive. When the chip switches between the receive/transmit states, it usually goes through the suspend state first. The suspend state here generally refers to the standby mode and the tuning mode. In the standby mode, the crystal oscillator remains in the start-up state, so that the crystal oscillator startup time can be eliminated when the chip switches from the suspend state to the receive/transmit mode. In the tuning mode, the PLL remains enabled. In this mode, the chip's receive/transmit conversion time response is the fastest, but the current consumption is very high.
3.2 SSP interface programming timing
When porting the Si4432 driver to different MCU platforms, the most critical thing is to ensure that the MCU can read and write the values of the Si4432 internal registers. The Si4432 and MCU can communicate through a standard 3-wire SPI interface: SCLK, SDI and nSEL. The host MCU obtains data through the SDO output pin of the Si4432. The LPC1766 has two SSP bus interfaces that are compatible with the SPI bus. However, there are differences in the hardware principles between the SSP and SPI interfaces. The SSP has a hardware FIFO, while the SPI does not. The following focuses on the method of using the SSP1 interface of the LPC1766 to interact with the Si4432. [page]
3.2.1 Pin initialization configuration
In order to facilitate the chip selection operation of Si4432 by P0.6 pin, the replacement text content of the name symbols LVL_H and LVL_L is specified through macro definition, which are the high and low level conversion of the control pins respectively:
#define LVL_H(GPIO0->FIOSET|=(0x01<<6))
//Pull the P0.6 level high
#define LVL_L(GPIO0->FIOCLR|=(0x01<<6))
//Pull the P0.6 level low
Configure the pin function selection register, specify the P0.5 pin as the GPIO default output low level, and connect it to the SDN pin of Si4432 to control Si4432 to enter the non-shutdown (SHUTDOWN) state. Initialize P0.7, P0.8, and P0.9 as SSP1 interface pins:
Designate P0.4 pin as GPIO interrupt and connect it to nIRQ pin of Si4432. When Si4432 has corresponding interrupt condition, it can notify LPC1766 to execute interrupt handler:
3.2.2 Write mode
function vSpiWriteRegister writes value to Si4432 internal register reg. After chip selection, first read SSP1 status register to confirm that transmit FIFO is not full. Before sending register address, the highest position of reg needs to be set to 1, and then detect whether SSP1 controller is idle. The process of sending value is similar, and its program code is as follows:
3.2.3 Read mode
function bSpiReadRegister reads the value of Si4432 internal register reg.
It should be noted here that because the SSP controller has a receive/transmit FIFO, before normal read mode communication, the "junk" data in the receive FIFO needs to be read out and discarded. Similarly, referring to the read mode timing diagram shown in Figure 4, because the SSP is full-duplex, when the SDI pin sends the register address, the SDO pin is in a low level state, then the receive FIFO will first save 0x00, and the second byte received thereafter is the value of the Si4432 specified register. The program code is as follows:
3.3 Wireless data transmission and reception
3.3.1 RF chip initialization and parameter setting
Si4432 has two read-only registers: Reg00 (register with internal address 00h) represents the device type code, and Reg01 represents the version code. Its value is fixed when the chip leaves the factory and cannot be changed later. Here, you can read the values of Reg00 and Reg01 during initialization to determine whether Si4432 has started normally. [page]
First initialize LPC1766 and start the SSP1 controller. Reading Reg03 and Reg04 of Si4432 will automatically clear the interrupt flag and release the nIRQ pin. Writing 0x80 to Reg07, that is, the highest position is 1, will reset all internal registers to the default state. After a delay of 10 ms, wait for Si4432 to work normally, and then count the number of startups. After the values of Reg00 and Reg01 meet the conditions, fill in the communication parameters in the corresponding registers, and then immediately enter the receiving state. The process is shown in Figure 5.
3.3.2 Wireless Transmission Program
Before sending data, first set the chip to the IDLE state. Specify the length of the data packet to be sent, and then fill the corresponding number of bytes of data into the transmit FIFO. Configure the interrupt return type to "data packet transmission completion interrupt", that is, after Si4432 successfully sends the data, it notifies LPC1766 through an interrupt. Then enable transmission, and Si4432 will automatically add parameters such as synchronization words to the data frame. The process is shown in Figure 6.
3.3.3 Wireless receiving program
When Si4432 receives data, it will notify LPC1766 to process it through interrupt triggering. First, get the interrupt status and determine the type of interrupt. If it is a "data packet transmission completion interrupt", switch the RF to the receiving state; if it is a "valid data packet reception interrupt", read the length value of the data packet, and then take out the data of the specified length value from the FIFO. Reconfigure the "valid data packet reception interrupt", reset the receiving FIFO, and set the module to the receiving state. When the interrupt processing function ends, return to the program processed before the interrupt. The process is shown in Figure 7.
Conclusion
This article introduces a wireless communication system based on LPC1766 and Si4432. The specific hardware circuit connection and software system design are introduced in detail, and the timing programming method of interacting with Si4432 through the SSP controller is emphasized. After a large number of experiments, it is proved that the system has reliable communication, strong stability, and good engineering application effect.
Previous article:Local and remote monitoring of smart homes on Linux
Next article:Design of STM32 motion control card based on PCI bus
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Is anyone interested in this building automation sensor module?
- Please tell me how the following two circuit diagrams work
- TI Smart Building Systems: Using mmWave to count and track people
- RF front-end market in the 5G era
- What is a thick film non-inductive resistor? What is its main use?
- LC Application Circuit Collection
- Keysight's new DAQ970A data acquisition instrument solves measurement problems
- Fortunately, the inner screen is not broken
- Handmade Arduino
- Help! STM32F407 SWD circuit problem?