In one company there were many terminals, and one of the ungrateful tasks for technical support is to travel to points and restart the operating system inside the terminals. It was decided to challenge this problem in the form of developing a hardware watchdog timer.
As a result, we got a device that connects to the expansion paired USB-connector on the motherboard.

')
This device has the following features:
- Simulation of pressing buttons POWER and RESET;
- USB power management (provided it does not have a separate source);
- Control galvanically isolated contact group (relay). You can put in the cut of the food chain;
- Indicator LEDs (one can be controlled, the second shows the modes of operation).
The operation algorithm is simple: inside there are two adjustable timers that constantly count down the specified time, after which the press of the corresponding buttons (POWER and RESET) is simulated. To prevent an accidental reboot, you must periodically send a timer reset command.
It is better that the target application be responsible for the reset of the timers, and not a third-party or system (Cron, scheduling service) due to the fact that the probability of a system failure is less than in the application (although, who has it).
The exchange of information is similar to the console.
Command system:
team | Description | Example |
---|
help | Command Summary | help |
LED1 | LED control off by default | LED1 ON LED1 OFF |
Relay | Relay control, enabled by default | RELAY ON RELAY OFF |
KEY1 | Imitation of pressing the button 1, not pressed by default | KEY1 ON KEY1 OFF |
KEY2 | Imitation of pressing a button 2, not pressed by default | KEY2 ON KEY2 OFF |
C1 | Control of timer 1 associated with button 1. Set the time in seconds, the maximum value of 32767. To disable the timer function, you must set the time to 0. | C1 res C1 SET 60 C1 SET 0 |
C2 | Timer 2 control associated with button 2. Set the time in seconds, the maximum value of 32767. To disable the timer function, you must set the time to 0. | C2 RES C2 SET 60 C2 SET 0 |
USB | USB power management enabled by default | USB ON USB OFF |
If successful, the command returns "OK".
In case of incorrect data returns “ERROR”.
A sign of the end of the line is the carriage return character "\ r". Also supported mode is "\ r \ n".

The device is based on an STM32F103CA controller with USB hardware support. Library of work with USB version V4.0.0. 3.3V operation voltage is obtained using a 5V line to USB stabilizer. All control circuits use transistors in key mode. Also, do not forget about the protective diode from self-induction currents in the relay coil (in my case it turned out to be built-in).
That's all - simple and angry =).
Github