Water flooding alarm systems are mostly used in warehouses, libraries, residences and other places where alarms are required when there is water accumulation. For some special applications such as different liquids to be detected, an alarm system with adjustable sensitivity is required; some alarm systems must meet both on-site alarms and remote wireless alarms.
The application of GSM (Global System for Mobile Communications) network is mostly concentrated on GSM mobile phone calls and SMS services. As a basic service of GSM network, short message service can send and receive short messages on mobile terminals, which has been paid more and more attention by system operators and system developers. Now more and more application products have shortened the communication distance between people and objects, and the perception ability of the scene has been greatly extended. Regardless of whether the channel is congested or not, the SMS service provides stable information transmission, thus ensuring the stability and reliability of the alarm system.
The alarm system designed in this paper is applied to the solution overflow detection of biological laboratories. Experimenters can control the start and stop of the alarm system, configure the filtering mode, add new users and customize the alarm SMS content through SMS. When the solution overflows, the alarm system can send an alarm SMS to inform the designated experimenter in time. The SMS control method makes full use of the convenience of the GSM network to save the system's hardware resources and meet the laboratory's requirements for low power consumption and small size.
1 System hardware structure
1.1 System structure
The alarm system is shown in Figure 1, which mainly consists of three parts: a single-chip system module, a GSM module, and a detection module. The single-chip microcomputer uses TI's MSP430F5438; the GSM module uses Siemens' TC35; and the detection module uses a self-made circuit board.
1.2 TC35 module
The TC35 module is a dual-band 900 MHz/1 800 MHz GSM network modem. The TC35 module is connected to the external processor via the RS 232 serial port, which can realize the wireless transmission of voice and data on the GSM network application platform. The operating voltage of the TC35 module is between 3.3 and 5.5 V, and the transmission power is 1 to 2 W. The TC35 processor contains the entire GSM protocol stack and communicates with the terminal device via the UART interface. The system developed using the TC35 module is controlled by AT commands.
1.3 MSP430F5438 microcontroller
The MSP430 series microcontroller is a 16-bit ultra-low power microcontroller launched by the American
Texas Instruments
(TI) company. It adopts a reduced instruction set (RISC) structure and is powered by a power supply voltage of 1.8 to 3.6 V. The chip integrates a wealth of peripherals, such as timers, comparators, ADCs, and a large number of interface units, which facilitates the design and development of application products. The MSP430F5438 microcontroller used in this paper has a program storage space of 256 KB, 16 KB SRAM, works at a 16 MHz external clock, has 83 I/Os, 4 configurable USARTs, and 16-channel 12-bit ADC on-chip peripherals.
1.4 Water immersion detection module design
The two wires of the detection module are placed in the area to be detected for water immersion, as shown in Figure 2. Point A is connected to the input end of the ADC. The relative heights of the wires in the vertical direction are different, and water levels at different heights can be detected for alarm. When water immersion occurs, the wires are immersed in water to form a conductive path, and R2 is the equivalent resistance of water immersion. The selection of R1 should follow several principles: First, ensure that the voltage division of R1 is higher than the environmental interference voltage and the sampling accuracy of the ADC.
The measured tap water equivalent resistance R2 is 300 kΩ, the ADC reference voltage is 2.5 V, the sampling accuracy is 0.6 mV, and the environmental noise interference is about 10 mV. Therefore, the voltage division of R2 should be greater than 10 mV. It can be concluded that the selected resistance value of R1 should be greater than 400 Ω. Secondly, the ADC input resistance should not be too large. The larger the resistance R1//R2, the longer the ADC sampling time. The sampling time satisfies:
tsample>(Rs+2 kΩ)ln213×40 pF+800 ns (1)
Where Rs is the input resistance. When R1 is equal to 100 kΩ, tsample>36μs. [page]
2 Software Design
2.1 Software Flow
The software flow is shown in Figure 3, which is mainly divided into the following parts: MCU and TC35 initialization, filter detection, sending alarm SMS, receiving SMS and decoding processing, low power mode.
2.2 AT command set
AT command set is the communication protocol between GSM module and external processor. Users can control calls, text messages, phone book, data services, fax, etc. through AT commands. All microcontrollers control TC35 by sending AT commands through the UART serial port. The sending of AT commands must follow the specified syntax format. Each command line must start with AT (or at) and end with
2.3 Initialization process
The initialization process is divided into microcontroller initialization and TC35 initialization. The initialization of the microcontroller includes turning off the watchdog, initializing the system clock, initializing the port, initializing the UART serial port, and initializing the ADC module; the initialization of TC35 includes sending AT commands "AT&F", "AT+CMGF=1", "AT+CNMI=3,1,0,2", and "AT+CMGD=1".
The initialization system clock of the microcontroller is 16 MHz, using an external clock source. The port initialization includes the input and output direction configuration of I/O and the initialization port value configuration. When receiving serial port data from the microcontroller system, the TC35 module can adapt the transmission rate from 300 b/s to 115 Kb/s. However, the microcontroller system cannot adapt to the serial port rate of TC35. Therefore, the microcontroller and the TC35 module should be set to the same transmission rate, such as the UART serial port of the microcontroller system is set to 9600 b/s. The UART serial port selects the shift register low bit first (LSB first), 8 data bits, 1 stop bit, UART synchronous mode, and the transmission rate is 9600 b/s. The ADC reference voltage is 2.5 V. TC35 initialization is configured through AT commands between the microcontroller and the TC35 module. Send "AT+CMGF=1" to set the SMS format to TEXT, and send "AT+CNMI=3,1,0,2" to set the new SMS reminder. When TC35 receives a new SMS, it will actively report to the microcontroller and display the storage address, such as "+CMTI: "SM", 1". Send "AT+CMGD=1" to delete the SMS at address 1. Every time TC35 is used, the SMS at address 1 must be cleared. When a new SMS is received, the SMS can be stored at address 1. After decoding the SMS, the command to delete the SMS must also be executed. It should be noted that a SIM card that has been registered with a gateway does not need to set the SMS center number.
[page]
2.4 Receive SMS and decode
After TC35 is initialized, the user can send SMS to the SIM card number of the alarm system. Configure the system status to control the alarm to start and stop; configure the software filter mode to adjust the alarm sensitivity; update the user list to send alarm SMS to different users; customize the alarm SMS content, the user can define the alarm prompt SMS according to the actual situation. The user sends SMS to change the alarm system configuration through the mobile phone. When the GSM module receives the SMS, it sends "+CMTI: "SM", 1" to the microcontroller. After receiving the SMS, the microcontroller sends the SMS read instruction "AT+CMGR=1" to the GSM module. 1 is the address where the GSM module stores SMS. GSM then sends the received user SMS to the microcontroller for decoding. The receiving format is:
"
The MCU program determines that the SMS has been received by searching for "OK". Next, the location of the SMS content can be determined by searching the number of quotation marks and the SMS "F1" can be read into the register read_sm. The hexadecimal value after F is used as the corresponding filter mode enable.
The agreement between the alarm system and the user in this article stipulates that all sent SMS must be ensured to consist of only uppercase English letters A to Z, Arabic numbers 0 to 9, and spaces. Users can change the filter mode of the alarm system, add new user mobile phone numbers, and customize the alarm SMS content by sending SMS through their mobile phones. For example, sending "1M138xxxxxxxx" to the SIM card number of the alarm system can set a new user mobile phone number. To add a second user mobile phone number, you can send "2M132xxxxxxxx". After the GSM module receives the SMS, the MCU sends the corresponding AT command to the GSM module, and the SMS is read into the register of the MCU. After decoding the SMS, it is determined which function the user wants to achieve. If it is "1M", the number is stored in the target number table for sending SMS. When the next flood occurs, an alarm SMS is sent to all target user mobile phone numbers to realize SMS group alarm. If it is "C", the
characters after it are used as the content of the custom alarm SMS. If it is "S", the characters after it are used as the start or stop enable of the system status. The decoding process is shown in Figure 4.
2.5 Filter detection
The ADC module is integrated in the MSP430 microcontroller. The voltage values at both ends of the wire are collected at a certain period. The converted digital signal is filtered by software to determine whether it reaches the lower limit of the trigger voltage. The system uses arithmetic mean filtering, sums the N sampling values and divides them by the number of sampling times. The result is compared with the trigger voltage lower limit set by the system. If the trigger voltage lower limit is reached after filtering, an alarm is triggered, otherwise the voltage continues to be collected and filtered. Users can change the filtering parameters, such as the trigger voltage lower limit, sampling period and sampling number, by sending mobile phone text messages according to the actual situation. In order to facilitate user operation, the filtering parameters are defined as 16 different modes, see Table 2.
[page]
2.6 Sending alarm SMSThe GSM module should be inserted with a registered SIM card. After flooding occurs, the buzzer sound alarm and SMS alarm are triggered. After TC35 is initialized successfully, sending alarm SMS requires three steps: First, the microcontroller sends the configuration target mobile phone number "AT+CMGS=138xxxxxxxx"; then, send the text message "WARNING" in TEXT format, and finally, send the hexadecimal number 1a. Through these three steps, "WARNING" can be sent to the user's mobile phone.
After the microcontroller sends the AT command, the TC35 module will return a response character. Taking the configuration of the target number as an example, how to implement software design is explained. After the microcontroller sends "AT+CMGS=138xxxxxxxx", the TC35 module returns the ">" character after receiving it, indicating that the target number is successfully configured. The microcontroller program determines whether the ">" character is received and decides to send the TEXT text. In order to prevent the program from looping indefinitely when the configuration fails, a counter needs to be set to allow the program to jump out.
Program for sending alarm SMS:
3 Test results
Send the "AT&F
In order to debug and verify the alarm system functions more intuitively, the 8-bit digital tube of the single-chip system module is fully utilized in the design. As shown in Figure 6, "3111" indicates that the program is running normally, the first two digits "05" from the right indicate that the current filter mode is 05, the third digit "1" from the right indicates that a new SMS has been received, and the fourth digit "2" from the right indicates that 2 alarm SMS have been sent.
4 Conclusion
The alarm system in this paper uses GSM as the network core and the low-power single-chip MSP430 as the processor core to design an alarm system for water immersion detection. Through the test of the biological laboratory, the system realizes remote monitoring and flexible configuration of water immersion sensitivity in the laboratory environment. Adding short-range wireless communication function and designing a multi-node wireless communication protocol on the basis of this system will give the system a broader application space.
Previous article:PWM Buck three-level converter based on SG3525 voltage regulator chip
Next article:Design of Temperature Detector Based on Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 15:57
- 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
- How to measure the output impedance of an amplifier circuit
- MLX90614 infrared temperature measurement module program msp430 source code and data sharing
- EEWORLD University Hall - Learn about CE Mark in one minute
- msp430f5529 interrupt notes--interrupt nesting
- Wearable ECG monitoring
- General test methods for wireless communication equipment
- I started to enter the Huada MCU again
- Research on Airport Runway Identification Algorithm and Implementation
- Regarding the clamping problem, discuss
- How to drive FT232+stm32?