Real-time sampling of AD sampling based on STC12C5A60S2 microcontroller is used to detect whether the circuit is normal or not.

Based on the STC12C5A60S2 single-chip AD sampling real-time sampling is used to detect whether the circuit is normal, using NRF24L01 to communicate with the host, the main microcontroller uses 12864 to show whether the circuit is normal, if the main circuit fails, automatically switch to the standby circuit, when the main circuit is repaired, the circuit Automatically switch from the standby circuit to the main circuit, and the circuit can be freely switched by pressing the button.

hardware design

Figure 1 system block diagram

The overall structure is shown in Figure 1, including the control module, 12864 display, buttons, NRF24L01 communication system and AD sampling module. The detection module detects whether the main circuit is intact by AD sampling, and continuously transmits the result of the detection to the main control module through the NRF24L01. The main control module displays the result through 12864. If there is a problem in the main circuit, the switch is automatically switched to the standby circuit, and the circuit can be freely switched by the button. .

software design

The software part includes AD sampling design, button control, 12864 display design and 2.4G wireless transmission, the program flow chart is as follows.

Figure 2 main flow chart of the detection module; Figure 3 main flow chart of the main control module

The difficulty of software design lies in the synchronous switching between the main control module and the wireless transmission module on the monitoring module. After all the team members work together, the problem is finally solved successfully.

Testing and analysis

This time, the LED lighting circuit was used as the test object, and a complete intelligent optimization circuit function test was carried out. The test results are as follows:

Circuit self-repair function test

Figure 4 diode normal illumination

Figure 5 The main circuit works normally

When the main circuit is in normal use, the white and red diodes indicate that the line works normally as shown in Figure 4. The LCD screen of the main control module shows that the main circuit is working normally, as shown in Figure 5.

Figure 6 shows the use of channels

Figure 7 white diode is extinguished

Figure 8 is normal

When the main circuit fails, the sampling analysis circuit sends the information wirelessly, the main control circuit instantaneously completes the function switching, and displays the result, as shown in Figure 6. The white LED is off, the red LED is on, indicating that the main circuit is damaged, and the standby circuit Normal work, as shown in Figure 7; Figure 8 shows that the LED lighting circuit is working properly, the main and auxiliary circuits are smoothly switched.

Manual selection circuit function test

Within the specified time, if the main control circuit does not autonomously eliminate the fault, the system enters the manual selection mode, as shown in Figure IX, Figure 10, and Figure 11;

Figure 9 manual mode

Figure 10 selects the main circuit


Figure 11 selects the alternate circuit

Hydrogel Screen Protector Sheets

Universal Screen Protector, TPU Screen Protector, Hydrogel Protective Film, Mobile Phone Screen Protector, Hydrogel Screen Protector, TPU Protective Film

Shenzhen Jianjiantong Technology Co., Ltd. , https://www.mct-sz.com