Railway signal outdoor equipment temperature and humidity detection device and working method

CN122258975APending Publication Date: 2026-06-23SHENYANG RAILWAY SIGNAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENYANG RAILWAY SIGNAL
Filing Date
2026-03-19
Publication Date
2026-06-23

Smart Images

  • Figure CN122258975A_ABST
    Figure CN122258975A_ABST
Patent Text Reader

Abstract

The application discloses a kind of railway signal outdoor equipment temperature and humidity detection device and working method, it is related to railway equipment state monitoring technical field, including battery power supply unit, watchdog power management unit, microprocessor unit, temperature and humidity detection unit and wireless communication unit;The power input of the watchdog power management unit is connected with the output of battery power supply unit, and the output of battery power supply unit power is controlled by watchdog power management unit, and microprocessor unit, temperature and humidity detection unit and wireless communication unit are powered by system power bus;The application has innovative watchdog power management unit design, uses intelligent dynamic power consumption management mode, perfects fault isolation and fault tolerance, has comprehensive remote interaction and operation and maintenance capability and uses the mode of strategy intelligent cooperation, realizes the optimal balance of functionality and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of railway equipment condition monitoring technology, specifically to a temperature and humidity detection device and its working method for outdoor railway signal equipment. Background Technology

[0002] Railway outdoor signaling equipment, such as track circuit boxes, signals, and switch machines, are exposed to harsh environments for extended periods. Abnormal changes in internal temperature and humidity directly affect the electrical performance, insulation strength, and mechanical lifespan of these devices, and are a significant cause of equipment failure. Real-time monitoring of the internal environment of critical equipment enclosures has become an urgent requirement for intelligent railway operation and maintenance.

[0003] Currently, existing temperature and humidity detection solutions on the market typically employ an architecture of "temperature and humidity sensor + microcontroller (MCU) + communication module." This architecture continuously or periodically collects temperature and humidity data within the enclosure and transmits the data via wireless networks (such as GPRS, 4G, NB-IoT) or wired networks (such as RS485, Ethernet). Existing detection solutions generally suffer from the following drawbacks when applied to railway outdoor signaling equipment: Insufficient reliability: The microprocessor unit is susceptible to interference, which can cause the program to "run away" or "deadlock", resulting in system crashes that cannot be recovered remotely. Manual on-site reset is required, which is costly. High power consumption and short battery life: Sensors and communication modules often work continuously, resulting in poor battery life in battery-powered scenarios, requiring frequent battery replacements and increasing the maintenance burden. Poor fault tolerance: Multiple sensors are usually connected in parallel on the same power supply and the same bus. A short circuit in any sensor can easily cause the power supply of the entire monitoring system to fail. A communication failure in any sensor can easily cause a communication bus failure, resulting in a monitoring blind spot. Inflexible management strategy: The fixed working mode cannot adaptively adjust the working frequency or enter the protection state according to the remaining battery power, which may lead to over-discharge and damage to the battery; Lack of remote interaction capabilities: Most are one-way data reporting terminals, unable to receive remote commands for parameter configuration, real-time diagnosis or reset operations, resulting in weak remote operation and maintenance capabilities. Summary of the Invention

[0004] To address the aforementioned shortcomings of the prior art, this invention provides a temperature and humidity detection device and operating method for outdoor railway signal equipment, in order to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention is implemented through the following technical solution: a temperature and humidity detection device for outdoor railway signal equipment, comprising a battery power supply unit, a watchdog power management unit, a microprocessor unit, a temperature and humidity detection unit, and a wireless communication unit; The battery power unit provides energy to the entire device and integrates overcurrent protection circuit and electrostatic protection circuit; The power input terminal of the watchdog power management unit is connected to the output terminal of the battery power supply unit. The watchdog power management unit controls the power output of the battery power supply unit and supplies power to the microprocessor unit, temperature and humidity detection unit and wireless communication unit through the system power bus. The microprocessor unit includes two GPIO ports, which are respectively connected to the watchdog power management unit's feed signal input and wake-up signal output, and are used to receive the wake-up signal and output a feed pulse. The microprocessor unit integrates an analog-to-digital converter and a battery voltage detection channel. The battery voltage detection channel is connected to the system power bus through a voltage divider resistor network. The analog-to-digital converter and battery voltage detection channel are used to proportionally reduce the battery voltage to the ADC range and perform acquisition and conversion. The temperature and humidity detection unit includes at least two digital temperature and humidity sensors. The positive power terminal of each temperature and humidity sensor is connected to the system power bus through an electronic switch connected in series with a resettable fuse. The control terminal of each electronic switch is connected to a GPIO pin of the microprocessor unit, enabling independent power supply control for the temperature and humidity sensor and ensuring that a short circuit in the power supply does not affect the system power bus. The data communication pin of each temperature and humidity sensor is connected to a GPIO pin of the microprocessor unit, enabling independent communication and diagnostics. The power input terminal of the wireless communication unit is connected to the system power bus via an electronic switch. The control terminal of the electronic switch is connected to a GPIO pin of the microprocessor unit. The wireless communication unit includes a wake-up signal output pin and a communication pin. The wake-up signal output pin is connected to the external interrupt interface of the microprocessor unit, and the communication pin is connected to the communication interface of the microprocessor unit. After the wireless communication unit is woken up by a remote command, a wake-up pulse signal is first generated to wake up the microprocessor unit in a dormant state, and then the received complete instruction data is transmitted through the communication interface.

[0006] Preferably, the watchdog power management unit includes a watchdog chip, which can generate periodic hardware wake-up signals and receive feed signals from the microprocessor unit. When no valid feed signal is received within a preset feed cycle, the watchdog power management unit performs a complete power-off operation on the system power bus and starts the discharge circuit of the parallel system power bus during the power-off period to release residual charge and ensure that the microprocessor unit can be reset.

[0007] Preferably, the temperature and humidity sensor is connected to a designated location inside the railway signal outdoor equipment via a cable to achieve redundant or gradient monitoring of temperature and humidity.

[0008] A method for operating a temperature and humidity detection device for outdoor railway signal equipment, comprising the following steps: Step S100: System Initialization After the system is powered on via the watchdog power management unit, the microcontroller of the microprocessor unit executes the software and hardware initialization program. Step S200: Task scheduling judgment After the microprocessor unit is woken up, it first performs task scheduling judgment and executes the corresponding task branch. The task branches include temporary tasks, periodic reporting, periodic self-checks and default processing. Step S300: Execute a temporary task In response to the wake-up interrupt of the wireless communication unit, the microprocessor unit receives and parses the remote command, collects the current battery voltage, dynamically switches the working mode and adjusts the reporting and self-test cycle according to the comparison result of the voltage value and the preset threshold. Then, in the current working mode, it performs the corresponding operation according to the command type and returns the execution result through the wireless communication unit. Finally, it resets the communication interface to a low power state and clears the interrupt flag to enter the sleep process. Step S400: Execute the periodic reporting task After the periodic reporting task is triggered, the microprocessor unit first clears the period counter and self-test counter to zero, and collects the current battery voltage. Based on the comparison result of the voltage value and the preset threshold, it dynamically switches the working mode and adjusts the period parameters. If it is currently in protection mode, it directly enters the sleep process. Otherwise, it controls each temperature and humidity sensor channel to power on independently in sequence. After stabilization, it performs communication status judgment and temperature and humidity data reading, and then immediately cuts off the power. Finally, it packages the status data of all sensors, battery voltage and device information, reports them to the monitoring center through the wireless communication unit, and resets the communication interface to a low power state before entering the sleep process. Step S500: Execute the cycle self-check task After the periodic self-test task is triggered, the microprocessor unit first clears the self-test counter and the abnormal flag, and collects the current battery voltage. Based on the comparison result of the voltage value and the preset threshold, it dynamically switches the working mode and adjusts the periodic parameters. If it is currently in protection mode, it directly enters the sleep process. Otherwise, it controls each temperature and humidity sensor channel to power on independently to complete data acquisition and communication status judgment, and performs threshold over-limit checks on the collected temperature and humidity data to mark abnormal status. Then, it conducts command interaction tests on the wireless communication unit. If multiple communication failures occur, its power supply is cut off. Finally, if there is any abnormal situation such as sensor communication abnormality, data over-limit, or working mode change, the battery voltage, the status of each sensor, and the temperature and humidity data are packaged and reported to the monitoring center, and then the sleep process is entered. Step S600: Feeding the dog before hibernation After completing any task and before the microcontroller enters low-power sleep mode, a level transition is generated on the P6.7 pin to the watchdog power management unit to reset the watchdog's internal timer, preventing it from triggering an erroneous power-off restart due to timeout during system sleep. After feeding the watchdog, the microcontroller enters sleep mode.

[0009] Step S700: Interrupt handling The microprocessor is woken up through two interrupt responses: one is wake-up during watchdog time, where the counter increments after triggering and the system resumes operation periodically; the other is wake-up via wireless communication unit, where the interrupt flag is set after triggering and the system prioritizes temporary tasks.

[0010] Preferably, step S100 is as follows: Load system parameters from the microcontroller's internal FALSH: reporting cycle M = 8640, self-test cycle N = 720, battery voltage threshold V_th1 = 2785, battery voltage threshold V_th2 = 2457, temperature threshold [-40°C, 70°C], humidity threshold [0%RH, 60%RH]; Configure system variables as follows: Periodic reporting counter Counter_M = M, Periodic self-test counter Counter_N = 0, Periodic self-test reporting flag SelfCheck_Abnormal_Flag = 0, Wireless communication unit interrupt flag wireless_wakeup_flag = 0, Working mode flag work_mode = 0; Configure the wireless communication module: Output a low level on the P3.0 pin of the microcontroller to keep the power supply of the wireless communication module on, set the sleep cycle of the wireless communication module to 5s, and then enable the low power consumption of the wireless communication module; under this configuration, the wireless communication module is in sleep mode normally, and automatically wakes up once every 5s to check if there is a wireless communication command. Configure interrupts: Configure the microcontroller pins P1.0 and P1.1 as rising edge interrupts, and then proceed to step 200.

[0011] Preferably, step S200 is as follows: Step S210: Check the wireless communication unit interrupt flag wireless_wakeup_flag. If wireless_wakeup_flag is 1, then proceed to step S300. Step S220: If wireless_wakeup_flag is not 1, check if Counter_M is greater than or equal to the reporting period value. If Counter_M is greater than or equal to the reporting period value, proceed to step S400. Step S230: If all of the above are false, check whether Counter_N is greater than or equal to the self-check period value. If Counter_N is greater than or equal to the self-check period value, jump to and execute Step S500; Step S240: If none of the above holds, directly enter Step S600.

[0012] Preferably, Step S300 is specifically as follows: Step S310: The single-chip microcomputer configures P3.4 and P3.5 as serial communication pins to receive remote instructions, and jumps to Step S320; Step S320: Analyze the remote instructions and jump to Step S330; The corresponding instructions include: 1. 0x03: Immediately collect and report all data; 0x04: Receive and save new parameters, including M, N, V_th1, and V_th2; 0x05: Individually enable / disable a certain sensor channel; 0x06: Software reset or trigger watchdog reset; 0x07: Return the current working mode, counter value, and status of each sensor; Step S330: The single-chip microcomputer starts the internal ADC to collect the battery voltage, calculates the current battery voltage value V_bat, then turns off the ADC, and jumps to Step S340; Step S340: Perform working mode judgment and switching. The working modes include: Normal mode: If V_bat ≥ V_th1, the system is in the normal mode, set work_mode = 0, the reporting period T_report = M, and the self-check period T_check = N; Energy-saving mode: If V_th2 ≤ V_bat < V_th1, the system enters the energy-saving mode, set work_mode = 1; Execute the first-level energy-saving strategy: extend the reporting period to M', that is, the reporting period T_report = M', and extend the self-check period to N', that is, T_check = N'; Protection mode: If V_bat < V_th2, the system enters the protection mode, set work_mode = 2; In the protection mode, immediately clear the count values of Counter_M and Counter_N, and set the reporting period to M' and the self-check period to N'; Hysteresis control: To avoid frequent mode switching caused by voltage fluctuations near the threshold, a higher threshold is used for the upgraded judgment; If the working mode of this judgment is different from that of the previous judgment, set SelfCheck_Abnormal_Flag = 1, and then jump to step S350 after completion; Step S350: If the current mode is non-protected, perform the corresponding operation according to the parsed instructions, and then jump to step S360; otherwise, jump directly to step S370. Step S360: Return the execution result through the wireless communication unit, and then proceed to step S370; Step S370: Configure P3.4 and P3.5 as normal GPIO input mode, set the wireless communication unit interrupt flag wireless_wakeup_flag to 0, and then jump to step S600.

[0013] Preferably, step S400 is as follows: Step S410: Clear Counter_M and Counter_N to zero, then proceed to step S420; Step S420: Collect battery voltage and perform the same working mode judgment and switching as in S300, then jump to step S430; Step S430: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S440. Step S440: The microprocessor unit sequentially controls the electronic switch of each temperature and humidity sensor channel to power on. After a delay and stabilization, it performs communication judgment and temperature and humidity reading, and then immediately controls the channel to power off; records the communication status and data of each temperature and humidity sensor; jumps to step S450. Step S450: Configure P3.4 and P3.5 as serial communication pins, package the information including device address, function code, battery voltage, status of each sensor and temperature and humidity data, and send it to the monitoring center through the wireless communication unit. Then configure P3.4 and P3.5 as ordinary GPIO input mode and jump to step S600. Preferably, step S500 is as follows: Step S510: Clear Counter_N and SelfCheck_Abnormal_Flag, then proceed to step S520; Step S520: Collect battery voltage and perform the same working mode judgment and switching as in S300, then jump to step S530; Step S530: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S540. Step S540: Perform the same sensor data acquisition process as in S400, then jump to S550; Step S550: Perform data threshold judgment. If the temperature and humidity range collected by any temperature and humidity sensor is not within [-40°C, 70°C] or [0%RH, 60%RH], set SelfCheck_Abnormal_Flag = 1 and jump to step S560. Step S560: Conduct a command interaction test of the wireless communication unit. If the communication is still abnormal after three power-off and restart, control the P3.0 pin to output a high level to stop the power supply of the wireless communication unit and jump directly to S600; otherwise, jump to step S570. Step S570: If SelfCheck_Abnormal_Flag>=1 is true, configure P3.4 and P3.5 as serial communication pins, package the information including device address, function code, battery voltage, status of each sensor and temperature and humidity data, and send it to the monitoring center through the wireless communication unit. Then configure P3.4 and P3.5 as ordinary GPIO input mode and jump to step S600. If not true, jump directly to step S600.

[0014] Preferably, step S700 is as follows: Watchdog cycle wake-up interrupt: When the microcontroller's P1.1 pin detects the rising edge pulse generated by the watchdog chip, an interrupt is triggered; in the interrupt service routine, after executing Counter_M = Counter_M + 1 and Counter_N = Counter_N + 1, the program exits sleep mode; the main program will resume from sleep state and start execution from step S200. Wireless communication unit wake-up interrupt: When the microcontroller's P1.0 pin detects the rising edge pulse generated by the wireless module's BUSY pin, an interrupt is triggered; in the interrupt service routine, the wireless communication unit interrupt flag is set to 1 and the program exits the sleep mode; the main program will resume from the sleep state, start judging and executing from step S200, and will prioritize the execution of the temporary task S300 because the flag is 1.

[0015] This invention provides a temperature and humidity detection device and its working method for outdoor railway signal equipment, which has the following beneficial effects: 1. Absolute hardware-level reliability: The innovative "watchdog power management unit" design upgrades the traditional software watchdog to a power-level hardware watchdog, which can force the entire system to shut down and restart when any software failure in the microprocessor unit causes the watchdog to stop. This achieves a physical-layer closed loop from "crash" to "self-healing", and the reliability reaches the highest industrial-grade standard. 2. Intelligent dynamic power consumption management: The judgment logic of power management strategy is creatively embedded into the battery voltage acquisition step in the task, realizing "all acquisitions must be judged and all abnormalities must be responded to in advance". This enables the system to detect the voltage drop trend in time during routine reporting and enter the energy saving mode in advance, resulting in more timely response, more refined energy consumption management, and maximizing battery life. 3. Comprehensive fault isolation and fault tolerance: Each temperature and humidity sensor channel adopts a triple isolation design with independent power supply control, independent communication line, and series self-resetting fuse. A short circuit in a single sensor only triggers its own self-resetting fuse. The microprocessor unit can detect the fault through communication failure and report it. Other parts of the system and the remaining sensors are completely unaffected, which greatly improves the overall availability of the system. 4. Comprehensive remote interaction and operation and maintenance capabilities: Supports a complete instruction set from parameter configuration and status query to remote reset, making the device a remotely manageable smart IoT node. Operation and maintenance personnel can complete most of the debugging, diagnosis and recovery operations without going to the site, which greatly reduces operation and maintenance costs and time. 5. Strategic Intelligent Collaboration: The remote command processing mechanism and the autonomous low-power strategy work together in a deep collaboration. When the power is sufficient, it provides all interactive functions; when the power is critical, it automatically degrades to the minimum system that only guarantees the core survival capabilities and notifies the background, thus achieving the optimal balance between functionality and reliability. Attached Figure Description

[0016] Figure 1 This is a system block diagram of a temperature and humidity detection device for outdoor railway signal equipment according to the present invention; Figure 2 This is the electrical schematic diagram of the watchdog power management unit of the present invention; Figure 3 This is a flowchart illustrating the overall process of this invention. Figure 4 This is the electrical schematic diagram of the microprocessor unit, temperature and humidity detection unit, and wireless communication unit of the present invention.

[0017] In the diagram: 1. Battery power supply unit; 2. Watchdog power management unit; 3. Microprocessor unit; 4. Temperature and humidity detection unit; 5. Wireless communication unit. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] The present invention will now be described in detail through specific embodiments, as follows: According to the instruction manual Figures 1-2 As can be seen, the present invention provides a temperature and humidity detection device for outdoor railway signal equipment, comprising a battery power supply unit 1, a watchdog power management unit 2, a microprocessor unit 3, a temperature and humidity detection unit 4, and a wireless communication unit 5.

[0020] Battery power supply unit 1 is the sole energy source for the entire device and integrates overcurrent protection and electrostatic discharge (ESD) protection circuits. Battery power supply unit 1 can use a disposable lithium-ion battery, employs a PTC resettable fuse for overcurrent protection, and connects an ESD transistor in parallel at the power input terminal to form an ESD protection circuit.

[0021] The power input terminal of the watchdog power management unit 2 is connected to the battery power supply unit 1. The power output of the controlled battery power supply unit 1 serves as the system power bus, supplying power to the microprocessor unit 3, the temperature and humidity detection unit 4, and the wireless communication unit 5. The watchdog power management unit 2 includes a watchdog chip configured to generate periodic hardware wake-up signals and receive feed signals from the microprocessor unit 3. When no valid feed signal is received within a preset feed cycle, the watchdog power management unit 2 performs a complete power-off operation on the system power bus and activates the discharge circuit connected to the parallel system power bus during the power-off period to release residual charge and ensure reliable reset of the microprocessor unit 3.

[0022] Watchdog power management unit 2 circuit as follows Figure 2 As shown, the watchdog circuit includes a watchdog chip U3, an N-type transistor Q2, and several resistors and capacitors. Pin 5 of the watchdog chip U3 is a periodic wake-up signal output pin, connected to the external interrupt input pin or a dedicated wake-up pin of the microprocessor unit 3; pin 3 is grounded through resistor R8, the resistance of which determines the output period of the wake-up signal; pin 1 is connected to the battery power supply unit 1, pin 2 is grounded, and capacitors C2 and C6 are connected in parallel between pins 1 and 2, with a capacitance ratio of C2 to C6 not less than 100, used for voltage regulation and filtering of the input power supply; pin 4 is connected to the microprocessor unit 33 through a low-pass filter circuit composed of resistor R5 and capacitor C12, used to receive the watchdog feed signal; pin 6 is connected to the battery power supply unit 1 through resistor R7, causing the output of this pin to change from a high-impedance state to a high level. Pin 6 of the watchdog chip U3 is also connected to an inverting circuit composed of N-type transistor Q2, resistor R10, and resistor R2, used to invert the level before inputting it to the subsequent circuit. Among them, one end of resistor R10 is connected to pin 6 of U3, and the other end is connected to the base of N-type transistor Q2; the emitter of N-type transistor Q2 is connected to battery power supply unit 1, its collector is connected to one end of resistor R2, and the other end of resistor R2 is grounded.

[0023] The watchdog power management unit 2 circuit includes a power output control circuit, which comprises a P-type MOSFET Q1, an N-type transistor Q4, a capacitor C1, and several resistors. The source of the P-type MOSFET Q1 is connected to the battery power supply unit 1, and its drain outputs the system main power supply VCC_SYS. A capacitor C1 is connected in parallel between its source and gate, and the gate is also connected to the collector of the P-type transistor Q2 through a resistor R19. Resistor R19 and capacitor C1 form a capacitor charging and discharging circuit, enabling the slow turn-on and slow turn-off of the P-type MOSFET Q1. The power output control circuit also includes a fast discharge circuit composed of the N-type transistor Q4. The collector of the N-type transistor Q4 is connected to the controlled power output terminal VCC_SYS through a resistor R1, and its base is connected to the collector of the P-type transistor Q2 through a resistor R11. The emitter is grounded, and a resistor R18 is connected in parallel between the emitter and the base.

[0024] The watchdog chip U3 uses the TPL5010DDCR chip manufactured by TI. The chip has an operating current of 35nA and a reset signal duration of approximately 320ms. When the resistance of resistor R8 is 11kΩ, the output cycle interval of the wake-up signal is T = 10s.

[0025] Microprocessor unit 3 is powered by the system power bus. The microprocessor in microprocessor unit 3 is a low-power MSP430F1611IPM microcontroller manufactured by TI. This microcontroller has 48KB Flash, 10KB SRAM, and a 12-bit ADC. In shutdown mode, its standby current is 0.2uA, and it can retain data in SRAM without loss. Microprocessor unit 3 serves as the system control core, responsible for executing data acquisition, processing, communication, and all control logic. Figure 4 As shown, in this device, the microcontroller's P1.1 pin is configured for rising edge interrupt and electrically connected to the wake-up signal output port of the watchdog power management unit 2, and the P6.7 pin is electrically connected to the feed signal input port of the watchdog power management unit 2. When battery voltage acquisition is enabled, the microcontroller's internal ADC reference source is configured to 2.5V, and the input is configured to half the system power bus voltage.

[0026] The temperature and humidity monitoring unit uses two DHT30 digital temperature and humidity sensors manufactured by Guangzhou Aosong. One sensor's power supply is connected to the system power bus via a P-type transistor controlled by the microcontroller's P2.0 pin, and the other sensor's power supply is also connected to the system power bus via a P-type transistor controlled by the microcontroller's P2.1 pin. Each temperature and humidity sensor's power circuit includes a series resettable fuse for protection, ensuring that a short circuit in the temperature and humidity detection unit will not affect the system power bus. Each temperature and humidity sensor's data communication pin is independently electrically connected to the microcontroller's pins P2.2 to P2.5. See details... Figure 4U4 / U5 are the electrical schematics of the temperature and humidity sensor, which are existing technologies.

[0027] The temperature and humidity sensor can be installed inside this device, or it can be connected by cable and installed at a designated location inside the outdoor equipment of the railway signal system to achieve redundant or gradient monitoring of temperature and humidity.

[0028] The power input of wireless communication unit 5 is connected to the system power bus via a P-type MOSFET controlled by the microcontroller's P3.0 pin. Wireless communication unit 5 uses the L-LRNWB26-37PN4 low-power LORA wireless communication module manufactured by Lidaer. This module supports low-power sleep mode and over-the-air wake-up function, and has a wake-up signal output pin BUSY and a serial communication pin. The BUSY pin is connected to the microcontroller's P1.0 pin, and the serial communication pin is electrically connected to the microcontroller's serial communication pins P3.4 and P3.5. This is used to generate a pulse wake-up signal to wake up the microcontroller from sleep mode after wireless communication unit 5 is remotely woken up by an over-the-air command, and then transmit the received complete command data via the serial port. See details... Figure 4 U2 is the electrical schematic diagram of wireless communication unit 5, which is existing technology.

[0029] This invention relates to a temperature and humidity detection device for outdoor railway signaling equipment. The device's operating method is described, executed by a microprocessor unit 3. The microprocessor unit 3's operating logic is based on dual wake-up signals and battery voltage detection. The periodic wake-up signal output by the watchdog power management unit 2 serves as the system timing reference, driving regular task scheduling. The wake-up signal output by the wireless communication unit 5 serves as the event trigger reference, responding to temporary tasks. The system automatically switches between normal mode, energy-saving mode, and protection mode based on the battery voltage value detected during task execution.

[0030] The overall process is as follows Figure 3 As shown, the specific steps are as follows: Step S100: System Initialization After the system is powered on via the watchdog power management unit 2, the microcontroller performs software and hardware initialization, as follows: Load system parameters from the microcontroller's internal FALSH: Reporting cycle M = 8640 (watchdog wake-up cycle is 10 seconds, corresponding to 24 hours), self-test cycle N = 720 (2 hours), battery voltage threshold V_th1 = 2785 (corresponding to voltage 3.4V), battery voltage threshold V_th2 = 2457 (corresponding to voltage 3.0V), temperature threshold [-40°C, 70°C], humidity threshold [0%RH, 60%RH]; Configure system variables: Periodic reporting counter Counter_M = M, Periodic self-test counter Counter_N = 0, Periodic self-test reporting flag SelfCheck_Abnormal_Flag = 0, Wireless communication unit 5 interrupt flag wireless_wakeup_flag = 0, Working mode flag work_mode = 0 (0 for normal mode, 1 for power saving mode, other values ​​for protection mode); Configure the wireless communication module: Output a low level on the microcontroller's P3.0 pin to keep the wireless communication module powered on. Set the module's sleep cycle to 5 seconds, then enable low-power mode. With this configuration, the wireless communication module is normally in sleep mode, automatically waking up every 5 seconds to check for wireless communication commands. Configure interrupts: Configure the microcontroller pins P1.0 and P1.1 as rising edge interrupts, and then proceed to step 200.

[0031] Step S200: Task scheduling judgment After the microprocessor is woken up (whether by watchdog cycle or wireless module wake-up), the first step is to determine task scheduling: Step S210: Check the interrupt flag of wireless communication unit 5, wireless_wakeup_flag. If it is 1, proceed to step S300 (temporary task). That is, when the interrupt flag of wireless communication unit 5 is 1, execute the temporary task, including: receiving remote communication instructions, acquiring battery voltage through ADC, judging and parsing communication instructions, performing corresponding operations according to function codes, returning execution results, and setting the interrupt flag of wireless communication unit 5 to 0. Respondable remote instruction types include, but are not limited to: real-time reporting instructions, parameter configuration instructions, sensor channel control instructions, remote reset instructions, and status query instructions. Step S220: If not 1, check if Counter_M is greater than or equal to the reporting period value (M, M', etc.). If yes, proceed to step S400 (periodic reporting task). That is, when Counter_M>= reporting period, execute the periodic reporting task, including: clearing Counter_M and Counter_N to zero, acquiring battery voltage through ADC, controlling the power-on of each sensor channel in a time-division manner to perform communication detection and acquire temperature and humidity data and then powering off, exchanging instructions with the wireless communication unit 5, and finally reporting the device address, function code, battery voltage, temperature and humidity sensor status, temperature and humidity data, etc. Step S230: If none of the above applies, check if Counter_N is greater than or equal to the self-test cycle value (N, N', etc.). If yes, proceed to step S500 (periodic self-test task). When Counter_N>= self-test cycle, execute the periodic self-test task, including: clearing Counter_N to zero, performing the same battery voltage acquisition, temperature and humidity sensor communication status judgment, temperature and humidity acquisition and wireless communication unit 5 communication judgment as the periodic reporting task, and simultaneously performing threshold judgment on the acquired data. If any abnormality is found, immediately report the device address, function code, battery voltage, temperature and humidity sensor status, temperature and humidity data, etc. Step S240: If none of the above applies, proceed directly to step S600 (feeding the dog before hibernation).

[0032] Step S300: Execute a temporary task Step S300 is as follows: Step S310: Configure the microcontroller to use P3.4 and P3.5 as serial communication pins to receive remote commands, and then jump to step S320; Step S320: Parse the remote command and proceed to step S330; Response commands include, for example: 0x03 (Real-time Reporting): Immediately collect and report all data; 0x04 (Parameter Configuration): Receives and saves new parameters such as M, N, V_th1, and V_th2; 0x05 (Channel Control): Enable / disable a specific sensor channel individually; 0x06 (Remote Reset): Software reset or watchdog reset triggered; 0x07 (Status Query): Returns the current operating mode, counter value, and status of each sensor, etc. Step S330: The microcontroller starts its internal ADC to collect the battery voltage, calculates the current battery voltage value V_bat, then turns off the ADC and jumps to step S340; Step S340: Perform working mode judgment and switching. That is, immediately after the task completes battery voltage acquisition, perform a three-level voltage threshold working mode judgment (this judgment is performed every time any task involving voltage acquisition is executed). After completion, proceed to step S350. Working modes include: Normal mode: If the battery voltage V_bat ≥ normal threshold V_th1, the system is in normal mode, and work_mode = 0 is set; the reporting cycle T_report = M, and the self-check cycle T_check = N; Energy-saving mode: If the energy-saving threshold V_th2 ≤ battery voltage V_bat < normal threshold V_th1, the system enters energy-saving mode and sets work_mode = 1; executes the first-level energy-saving strategy: extends the reporting cycle to M' (e.g., M'=17280, i.e., 48 hours), i.e., the reporting cycle T_report = M', and extends the self-check cycle to N' (e.g., N'=1440, i.e., 4 hours), i.e., T_check = N', where M'>M, N'>N; Protection Mode: If the battery voltage V_bat < energy-saving threshold V_th2, the system enters protection mode and sets work_mode = 2. In this mode, the counter values ​​of Counter_M and Counter_N are immediately cleared, and the reporting cycle is set to M' and the self-test cycle is set to N' (which can be set to a larger value or the same as M' and N'). The key point is that after entering this mode, subsequent high-power steps in the current task, such as collecting sensor data and interacting with the wireless module, will be skipped. Only necessary background settings will be performed, and then the system will return to sleep mode as soon as possible to maximize power conservation. Hysteresis control can be introduced during mode switching: the original threshold is used for degradation judgment, and an offset ΔV is added to V_th1 and V_th2 during upgrade judgment to avoid frequent mode switching caused by voltage fluctuations near the threshold. For example, to upgrade from energy-saving mode back to normal mode, V_bat ≥ (V_th1 + ΔV), where ΔV can be 40 (0.05V). If the working mode of this judgment is different from that of the previous judgment, set SelfCheck_Abnormal_Flag = 1; Step S350: If the current mode is non-protection mode, perform the corresponding operation according to the parsed instructions (such as collecting sensor data) and then jump to step S360; otherwise, jump directly to step S370. Step S360: Return the execution result through wireless communication unit 5, and then jump to step S370; Step S370: Configure P3.4 and P3.5 as normal GPIO input mode (to reduce power consumption), set the wireless communication unit 5 interrupt flag wireless_wakeup_flag to 0, and then jump to step S600; Step S400: Execute the periodic reporting task Step S400 is as follows: Step S410: Clear Counter_M and Counter_N to zero, then proceed to step S420; Step S420: Collect battery voltage and perform the same working mode judgment and switching as in S300 (step S340), then jump to step S430; Step S430: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S440. Step S440: The microprocessor sequentially controls the electronic switches of each temperature and humidity sensor channel to power on. After a delay and stabilization, it performs communication judgment (if communication is abnormal, set SelfCheck_Abnormal_Flag = 1) and temperature and humidity reading. Then, it immediately controls the channel to power off, records the communication status (normal / fault) and data of each sensor, and jumps to step S450. Step S450: Configure P3.4 and P3.5 as serial communication pins, package the device address, function code (0x01), battery voltage, status of each sensor, temperature and humidity data, etc., and send them to the monitoring center through the wireless communication unit 5. Then configure P3.4 and P3.5 as ordinary GPIO input mode (to reduce power consumption) and jump to step S600. Step S500: Execute the cycle self-check task Step S500 is as follows: Step S510: Clear Counter_N and SelfCheck_Abnormal_Flag, then proceed to step S520; Step S520: Collect battery voltage and perform the same working mode judgment and switching as in S300 (step S340), then jump to step S530; Step S530: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S540. Step S540: Perform the same sensor data acquisition process as in S400 (step S440), then jump to S550; Step S550: Perform data threshold judgment. If the temperature and humidity range collected by any temperature and humidity sensor is not within [-40°C, 70°C] or [0%RH, 60%RH], set SelfCheck_Abnormal_Flag = 1 and jump to step S560. Step S560: Conduct instruction interaction test of wireless communication unit 5. If communication is still abnormal after three power-off and restart, control the P3.0 pin to output a high level to stop the power supply of wireless communication unit 5, and directly jump to S600; otherwise, jump to step S570. Step S570: If SelfCheck_Abnormal_Flag>=1 is true, configure P3.4 and P3.5 as serial communication pins, package the device address, function code (0x02), battery voltage, sensor status, temperature and humidity data, etc., and send them to the monitoring center through wireless communication unit 5. Then configure P3.4 and P3.5 as ordinary GPIO input mode (to reduce power consumption) and jump to step S600. If not true, jump directly to step S600. Step S600: Feeding the dog before hibernation Before the microprocessor enters hibernation, it must output a dog-feed signal once to prevent a timeout and power-off restart, as follows: After completing any task and before the microcontroller enters low-power sleep mode, a level transition (watchdog signal) must be generated via pin P6.7 to the watchdog power management unit 2 to reset the watchdog's internal timer and prevent it from triggering an erroneous power-off restart due to timeout during system sleep. After the watchdog signal is fed, the microcontroller enters sleep mode. Step S700: Interrupt handling Watchdog Cycle Wake-up Interrupt: When the microcontroller's P1.1 pin detects a rising edge pulse generated by the watchdog chip, an interrupt is triggered. In the interrupt service routine, after executing Counter_M = Counter_M + 1 and Counter_N = Counter_N + 1, the program exits sleep mode. The main program will then resume from sleep mode and begin execution from step S200.

[0033] Wireless communication unit 5 wake-up interrupt: When the microcontroller's P1.0 pin detects a rising edge pulse generated by the wireless module's BUSY pin, an interrupt is triggered. In the interrupt service routine, the interrupt flag of wireless communication unit 5 is set to 1, and the program exits sleep mode. The main program will resume from sleep mode, starting from step S200, and will prioritize the execution of the temporary task S300 because the flag is 1.

[0034] It is important to emphasize that during the execution of tasks S300, S400, and S500, if the task execution time is long and may approach or exceed the watchdog timer feeding cycle, a watchdog feeding operation (step S600) needs to be inserted in a timely manner during the task loop or before and after time-consuming operations to ensure that the watchdog timer does not time out and to ensure stable system operation.

[0035] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A temperature and humidity detection device for outdoor railway signal equipment, characterized in that, It includes a battery power supply unit (1), a watchdog power management unit (2), a microprocessor unit (3), a temperature and humidity detection unit (4), and a wireless communication unit (5); The power input terminal of the watchdog power management unit (2) is connected to the output terminal of the battery power supply unit (1). The watchdog power management unit (2) controls the power output of the battery power supply unit (1) and supplies power to the microprocessor unit (3), temperature and humidity detection unit (4) and wireless communication unit (5) through the system power bus. The microprocessor unit (3) includes two GPIO ports, which are respectively connected to the watchdog power management unit (2) for feeding signal input and wake-up signal output, and are used to output feeding pulse after receiving wake-up signal; the microprocessor unit (3) integrates an analog-to-digital converter and a battery voltage detection channel. The battery voltage detection channel is connected to the system power bus through a voltage divider resistor network. The analog-to-digital converter and the battery voltage detection channel are used to proportionally reduce the battery voltage to the range of the ADC and collect and convert it. The temperature and humidity detection unit (4) includes at least two digital temperature and humidity sensors. The positive power terminal of each temperature and humidity sensor is connected to the system power bus through an electronic switch and a self-resetting fuse in series. The control terminal of each electronic switch is connected to a GPIO pin of the microprocessor unit (3). Each temperature and humidity sensor communicates with the microprocessor unit (3) via data. The power input terminal of the wireless communication unit (5) is connected to the system power bus via an electronic switch. The control terminal of the electronic switch is connected to a GPIO pin of the microprocessor unit (3). The wireless communication unit (5) includes a wake-up signal output pin and a communication pin. The wake-up signal output pin is connected to the external interrupt interface of the microprocessor unit (3). The communication pin is connected to the communication interface of the microprocessor unit (3). The wireless communication unit (5) receives a remote wake-up command and generates a wake-up pulse signal to wake up the microprocessor unit (3) in a dormant state. The wireless communication unit (5) transmits the received command data to the microprocessor unit (3).

2. The temperature and humidity detection device for outdoor railway signal equipment according to claim 1, characterized in that, The watchdog power management unit (2) includes a watchdog chip, which can generate periodic hardware wake-up signals and receive a dog-feeding signal from the microprocessor unit (3). When no valid dog-feeding signal is received within a preset dog-feeding cycle, the watchdog power management unit (2) performs a complete power-off operation on the system power bus and starts the discharge circuit of the parallel system power bus during the power-off period to release residual charge and ensure that the microprocessor unit (3) can be reset.

3. The temperature and humidity detection device for outdoor railway signal equipment according to claim 1, characterized in that, The temperature and humidity sensor is connected to a designated location inside the railway signal outdoor equipment via a cable to achieve redundant or gradient monitoring of temperature and humidity.

4. The operating method of the temperature and humidity detection device for outdoor railway signal equipment as described in any one of claims 1-3, characterized in that, The steps are as follows: Step S100: System Initialization After the system is powered on via the watchdog power management unit (2), the microcontroller of the microprocessor unit (3) performs system initialization; Step S200: Task scheduling judgment After the microprocessor unit (3) is woken up, it performs task scheduling judgment and executes the corresponding task branch. The task branch includes temporary task, periodic reporting, periodic self-check and default processing. Step S300: Execute a temporary task In response to the wake-up interrupt of the wireless communication unit (5), the microprocessor unit (3) receives and parses the remote instruction, collects the current battery voltage, dynamically switches the working mode and adjusts the reporting and self-test cycle according to the comparison result between the voltage value and the preset threshold. In the current working mode, it performs the corresponding operation according to the instruction type and returns the execution result through the wireless communication unit (5). It resets the communication interface to a low power state and clears the interrupt flag to enter the sleep process. Step S400: Execute the periodic reporting task After the periodic reporting task is triggered, the microprocessor unit (3) clears the period counter and self-test counter, collects the current battery voltage, dynamically switches the working mode and adjusts the period parameters according to the comparison result of the voltage value and the preset threshold. If it is currently in the protection mode, it directly enters the sleep process. Otherwise, it controls each temperature and humidity sensor channel to be powered on independently in sequence. After stabilization, it performs communication status judgment and temperature and humidity data reading, and then immediately cuts off the power. It packages the status data of all sensors, battery voltage and device information, and reports them to the monitoring center through the wireless communication unit (5). After resetting the communication interface to the low power state, it enters the sleep process. Step S500: Execute the cycle self-check task After the periodic self-test task is triggered, the microprocessor unit (3) first clears the self-test counter and the abnormal flag, and collects the current battery voltage. Based on the comparison result between the voltage value and the preset threshold, it dynamically switches the working mode and adjusts the periodic parameters. If it is currently in the protection mode, it directly enters the sleep process. Otherwise, it sequentially controls each temperature and humidity sensor channel to independently power on to complete data acquisition and communication status judgment, and performs threshold over-limit checks on the collected temperature and humidity data to mark the abnormal status. Then, it conducts instruction interaction tests on the wireless communication unit (5). If multiple communication failures occur, its power supply is cut off. If any abnormal situation occurs, such as sensor communication failure, data exceeding limits, or change of working mode, the battery voltage, status of each sensor, and temperature and humidity data will be packaged and reported to the monitoring center, and then the process will enter the sleep mode. Step S600: Feeding the dog before hibernation After completing any task and before the microcontroller is about to enter low-power sleep mode, a level transition is generated to the watchdog power management unit (2) to reset the watchdog's internal timer; after feeding the watchdog, the microcontroller enters sleep mode. Step S700: Interrupt handling The microprocessor is woken up by two interrupt responses: watchdog cycle wake-up, after which the counter increments and the system periodically resumes operation; wireless communication unit (5) wake-up, after which the interrupt flag is set and the system prioritizes temporary tasks.

5. The working method according to claim 4, characterized in that, Step S100 is as follows: Load system parameters from the microcontroller's internal FALSH: reporting cycle M = 8640, self-test cycle N = 720, battery voltage threshold V_th1 = 2785, battery voltage threshold V_th2 = 2457, temperature threshold [-40°C, 70°C], humidity threshold [0%RH, 60%RH]; Set system variables: periodic reporting counter Counter_M = M, periodic self-check counter Counter_N = 0, periodic self-check reporting flag SelfCheck_Abnormal_Flag = 0, wireless communication unit (5) interrupt flag wireless_wakeup_flag = 0, work mode flag work_mode = 0; Configure the wireless communication module: Output a low level on the P3.0 pin of the microcontroller to keep the power supply of the wireless communication module on, set the sleep cycle of the wireless communication module to 5s, and then enable the low power consumption of the wireless communication module; under this configuration, the wireless communication module is in sleep mode normally, and automatically wakes up once every 5s to check if there is a wireless communication command. Configure interrupts: Configure the microcontroller pins P1.0 and P1.1 as rising edge interrupts, and then proceed to step 200.

6. The working method according to claim 5, characterized in that, Step S200 is as follows: Step S210: Check the interrupt flag wireless_wakeup_flag of the wireless communication unit (5). If wireless_wakeup_flag is 1, then proceed to step S300. Step S220: If wireless_wakeup_flag is not 1, check if Counter_M is greater than or equal to the reporting period value. If Counter_M is greater than or equal to the reporting period value, proceed to step S400. Step S230: If none of the above applies, check if Counter_N is greater than or equal to the self-test cycle value. If Counter_N is greater than or equal to the self-test cycle value, proceed to step S500. Step S240: If none of the above are true, proceed directly to step S600.

7. The working method according to claim 6, characterized in that, Step S300 is as follows: Step S310: Configure P3.4 and P3.5 of the microcontroller as serial communication pins to receive remote commands, and jump to step S320; Step S320: Parse the remote command and proceed to step S330; the commands to be responded to include immediate reporting, parameter configuration, channel control, remote reset, and status query. Step S330: The microcontroller starts its internal ADC to collect the battery voltage, calculates the current battery voltage value, turns off the ADC, and jumps to step S340; Step S340: Perform working mode judgment and switching. Working modes include: Normal mode: If the battery voltage value is ≥ the normal threshold, the system is in normal mode, set work_mode = 0, reporting cycle T_report = M, and self-check cycle T_check = N; Energy saving mode: If the energy saving threshold ≤ battery voltage value < normal threshold, the system enters energy saving mode and sets work_mode = 1; executes the first-level energy saving strategy: extends the reporting cycle to M', that is, the reporting cycle T_report = M', and extends the self-check cycle to N', that is, T_check = N'; Protection mode: If the battery voltage value is less than the energy saving threshold, the system enters protection mode and sets work_mode = 2; In protection mode, the counter values ​​of Counter_M and Counter_N are immediately cleared, and the reporting cycle is set to M' and the self-test cycle is set to N'. If the working mode of this judgment is different from that of the previous judgment, set SelfCheck_Abnormal_Flag = 1, and then jump to step S350 after completion; Step S350: If the current mode is non-protected, perform the corresponding operation according to the parsed instructions, and then jump to step S360; otherwise, jump directly to step S370. Step S360: Return the execution result through the wireless communication unit (5), and then jump to step S370; Step S370: Configure P3.4 and P3.5 as normal GPIO input mode, set the wireless communication unit (5) interrupt flag wireless_wakeup_flag to 0, and then jump to step S600.

8. The working method according to claim 7, characterized in that, Step S400 is as follows: Step S410: Clear Counter_M and Counter_N to zero, then proceed to step S420; Step S420: Collect battery voltage and perform the same working mode judgment and switching as in S300, then jump to step S430; Step S430: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S440. Step S440: The microprocessor unit (3) sequentially controls the electronic switch of each temperature and humidity sensor channel to power on, and after a delay and stabilization, performs communication judgment and temperature and humidity reading, and then immediately controls the channel to power off; records the communication status and data of each temperature and humidity sensor; Proceed to step S450; Step S450: The microcontroller configures P3.4 and P3.5 as serial communication pins, packages the information including device address, function code, battery voltage, sensor status and temperature and humidity data, and sends it to the monitoring center through the wireless communication unit (5). Then, after configuring P3.4 and P3.5 as ordinary GPIO input mode, it jumps to step S600.

9. The working method according to claim 8, characterized in that, Step S500 is as follows: Step S510: Clear Counter_N and SelfCheck_Abnormal_Flag, then proceed to step S520; Step S520: Collect battery voltage and perform the same working mode judgment and switching as in S300, then jump to step S530; Step S530: If the current mode is protection mode, proceed to step S600; otherwise, proceed to step S540. Step S540: Perform the same sensor data acquisition process as in S400, then jump to S550; Step S550: Perform data threshold judgment. If the temperature and humidity range collected by any temperature and humidity sensor is not within [-40°C, 70°C] or [0%RH, 60%RH], set SelfCheck_Abnormal_Flag = 1 and jump to step S560. Step S560: Conduct instruction interaction test of wireless communication unit (5). If communication is still abnormal after three power outages and restarts, control microprocessor unit (3) to output high level to stop power supply to wireless communication unit (5), and jump directly to S600; otherwise, jump to step S570. Step S570: If SelfCheck_Abnormal_Flag >= 1 is true, configure P3.4 and P3.5 as serial communication pins, package the information including device address, function code, battery voltage, status of each sensor and temperature and humidity data, and send it to the monitoring center through the wireless communication unit (5). Then configure P3.4 and P3.5 as ordinary GPIO input mode and jump to step S600. If not true, jump directly to step S600.

10. The working method according to claim 4, characterized in that, Step S700 is as follows: Watchdog cycle wake-up interrupt: When the microcontroller's P1.1 pin detects the rising edge pulse generated by the watchdog chip, an interrupt is triggered; in the interrupt service routine, after executing Counter_M = Counter_M + 1 and Counter_N = Counter_N + 1, the program exits sleep mode; the main program will resume from sleep state and start execution from step S200. Wireless communication unit (5) wake-up interrupt: When the P1.0 pin of the microcontroller detects the rising edge pulse generated by the BUSY pin of the wireless module, an interrupt is triggered; in the interrupt service routine, the interrupt flag of the wireless communication unit (5) is set to 1 and then the hibernation mode is exited; the main program will resume from the hibernation state, start judging and executing from step S200, and will prioritize the execution of the temporary task S300 because the flag is 1.