Introduction
Cortex-MO is a low-power, small-size processor among 32-bit ARM processors. It perfectly combines the advantages of ultra-low power consumption, high efficiency and low gate count, which make it suitable as a processor for wireless sensor network nodes. This article introduces a solution for designing a temperature detection network node based on LPC1114.
1 Introduction to temperature detection system
A temperature detection wireless network consists of several temperature detection nodes, and each temperature detection node uses wireless sensors to communicate. All temperature detection nodes use ZigBee technology to form a wireless network. The functions of each node include collecting temperature and sending it through the ZigBee network. This system uses the Simplified TI protocol in the simplified version of the ZigBee protocol provided by TI to form a star network. The network consists of an access point (AP) and several terminal nodes (ED). Among them, the AP is equivalent to a full-function device, responsible for establishing the entire network and receiving the temperature information collected by the ED. All temperature detection nodes are powered by battery devices.
2 Hardware design of temperature detection node
The temperature detection node is mainly composed of LPC1100 series processor (LPC1114 is used here), temperature sensor, ZigBee module, LCD display, etc., as shown in Figure 1. The temperature sensor uses LM75 with I2C interface of National Semiconductor, the ZigBee module uses CC2500 chip with SPI interface of TI, and the LCD display uses LCD1602 character display screen. The entire node is powered by battery equipment. Considering the power consumption factor, the LCD screen adopts slot design, and some nodes that do not need to display can be disconnected from LCD. In addition to the above main parts, there are some optional units, such as UART serial port, LED, button, buzzer BEEP, etc. of general I/O interface.
3 Software Design of Temperature Detection Node
The functions of the temperature detection node are as follows:
◆ Set a timer to detect the temperature regularly and display the current temperature value on the LCD;
◆ Send the detected temperature value through the ZigBee module;
◆ When the temperature is too high, the buzzer will sound for a certain period of time;
◆ The node is in sleep mode except for temperature detection and transmission;
◆ The timer wakes up the processor every 1 s to detect and transmit the temperature.
According to these functions, the software of the entire temperature node is divided into the following modules: power management module, LCD module, temperature sensor module, ZigBee module.
This section will focus on the power management module, temperature sensor module and ZigBee module.
3.1 Power management module
The power management of the LPC1100 series chip has three modes, namely sleep mode, deep sleep mode and deep power-down mode.
3.1.1 Entering and exiting the three modes
The entry and exit methods of the three modes are listed in Table 1.
[page]
3.1.2 Differences between the three modes
In sleep mode, if the peripheral clock is provided in the software, the peripheral function can still be executed in sleep mode, and an interrupt can be generated to cause the processor to resume operation. In deep sleep mode, the user can configure the power-down module during deep sleep and the power-on module after wake-up. In these two sleep modes, the processor state, registers, peripheral registers, internal SRAM values are maintained, and the logic level of the pins remains unchanged. Deep sleep uses 13 wake-up interrupts to wake up. Its advantage is that the user can turn off the clock generation module, thereby reducing dynamic power consumption more than sleep mode.
In deep power-down mode, except for the WAKEUP pin, the power and clock on the entire chip are turned off, and the content in the SRAM cannot be maintained, but 4 general registers can be used to save data. If you want to wake up the chip in deep power-down mode, you must connect a low level to the WAKEUP pin through an external connection component.
3.1.3 Select sleep mode
In this system, the main function of the temperature detection node is to detect the temperature once every certain period of time, so the chip is put into sleep mode during the interval of collecting temperature. When the temperature needs to be collected, it is woken up by a timer interrupt. For example, the temperature is collected every 1 second, a timer interrupt is set after the temperature is collected and sent, and then the WFI instruction is called to put the chip in sleep mode. For easy observation, an LED light is set to flash to indicate the frequency of temperature collection. At the same time, if the temperature is detected to be too high, a buzzer is used to alarm. If an LCD screen is connected, the temperature value can also be displayed on the LCD screen.
The main code in the main function is as follows:
After calling the WFI instruction, the program stops running. When the timer interrupt occurs, the processor can be woken up and the program continues to run the code after the WFI instruction. The code for the timer interrupt is as follows:
3.2 Temperature sensor module
The temperature sensor LM75 uses a standard I2C interface. In this node, the hardware interface between LPC1114 and LM75 is shown in Figure 2.
The address lines A0~A2 of LM75 are all grounded, and the 0S pin is floating, so this node only uses its basic temperature measurement function. There are 5 registers inside LM75: pointer register, configuration register, temperature register, temperature setting register and temperature hysteresis register. The pointer register is used to select the remaining 4 registers for operation. This node mainly reads the temperature value in the temperature register. The high 9-bit value in the temperature register is the valid temperature value. The value read out of this register is given in the format of binary complement, and each unit of its LSB (least significant bit) represents 0.5℃, for example, +0.5℃ corresponds to 001H. The range it can represent is -55~+125℃.
[page]
When using this temperature sensor, you need to call the following two API functions:
3.3 ZigBee module
The ZigBee module of this node uses
the
CC2500
chip of T1 company and uses the SimpliciTI protocol to build a network. Its hardware connection is shown in Figure 3.
When using CC2500, you first need to configure the SPI pins of LPC1114. In addition, you also need to configure pins GD00 and GDO1 as MCU interrupts to control the sending and receiving of network data packets. Then initialize the CC2500 chip according to the CC2500 initialization sequence, and then hand it over to the upper-level networking function for calling. The initialization steps of CC2500 are as follows:
① Initialize the SPI interface connected to the MCU;
② SCLK=1, SI=O;
③ CSn=0;
④ CSn-1, delay 40μs;
⑤ CSn=0;
⑥ Wait for the S0 pin to become low;
⑦ Send the command SRES on the SI pin;
⑧ Wait for the SO pin to become low again.
At this time, if the corresponding registers can be read and written normally, it means that CC2500 has been initialized successfully.
After CC2500 is initialized successfully, you need to configure the CC2500 registers and set the sending and receiving interrupts of data packets. Since CC2500 has many registers, please refer to the reference code on the CC2500 official website. The interrupt of sending and receiving data packets is controlled by the value of the configuration register. By setting the values of these registers, GDO0 and GDO1 can be configured to send and receive data. Here, the value of the IOCFG0 register is configured to 0x6, that is, when a data packet is received or sent, a high level jump is generated on the GDO0 pin; after receiving or sending, it returns to a low level. Therefore, the GDO0 pin, that is, PIO2_5, is configured as an input pin, and the rising edge interrupt is set. The code is as follows:
At this point, if data is sent or received, an interrupt can be generated. If data is received, a receiving function must be called in the interrupt handler function PIOINT2-IRQHandler.
There are also some places involving low-level communication that need to be modified, such as:
After modifying the underlying hardware-related functions, you can use the upper-level networking functions. The CC2500 networking API functions mainly include the following functions:
When networking, you need to call SMPL_Init to initialize, and then call SMPL_Link or SMPL_LinkListen function according to the function of the node to form a wireless network. Finally, call SMPL_Receive and SMPL_Send functions to send and receive data.
Conclusion
This article introduces a design method for temperature detection network nodes based on LPC1114. The LPC1114 chip has the characteristics of low power consumption and high performance, and with standard I2C, SSP and other interfaces, it facilitates the transplantation of many standard interface components. The temperature sensor with I2C interface can also be replaced with humidity sensor, gas sensor, etc. with I2C interface to establish a wireless sensor network based on ZigBee. This design scheme has certain reference value for node design in wireless sensor networks such as wireless environmental monitoring network and wireless meter reading network.
Previous article:Design of an intelligent electronic blood pressure meter based on LPC3250
Next article:Design of LPC1768 and AD7656 sampling system with time stamp
- 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
- 【FAQ】Microchip Live|Wireless Power Consortium (WPC) compliant wireless charging authentication
- Recruiting part-time dsp training instructors
- Software platform installation for SILICON LABS PG22-DK2503A development board
- CCS CMD file invalidation causes memory allocation failure
- [ADI Practical Knowledge Sharing] The hidden costs of isolation system design cannot be ignored!
- EEWORLD University - Amplifier Design in Test and Measurement
- TI mmWave Radar China Tour
- What is the io write speed of R16 itself?
- MSP430G2553 electronic clock experiment
- When the open-drain output enable of a pin is changed from 1 to 0, what is the difference between this output state and push-pull output?