THE PROBLEM: I had often the problem, that my Raspberry Pi got stuck while I was connected to it via UART console. This is not such a big deal, when I sit directly beside the SBC. But sometimes I use setups where I am remotely connected to a PC which uses a USB-UART-Converter. This setup is then usually somewhere else. And then resetting the Raspi is a big pain in the a**.

I thought that the software watchdog of the Raspberry OS would help, but it did not. I also could not find any Raspberry Pi HATs for that kind of problem. I found hardware watchdog HATs. But with these HATs it is not possible to make a power cycle remotely.

THE SOLUTION: In the beginning I thought just to use a USB-UART converter and to toggle a MOSFET switch the DTR signal. But if I am already making the effort to build something, then why should not I also use some other connection that is usual for a remote connection (e.g. ethernet).

I found the Pico-ETH-CH9121, which is a breakout-module that uses the CH9121 chip. This chip connects ethernet port to two UART ports. The CH9121 can be configured in different ways and settings. For the setting, that I am using in this project, I wrote a python script (see link down below). With this script the CH9121 can be programmed via the UART1.

In this setting the CH9121 creates a TCP server. Each UART has its own port. For example, I can connect to my Raspi which is connected to the UART1 of the CH9121 via telnet by connecting to 192.168.1.10:100. With the commands “on” and “off” via UART2 a STM8 turns on and off the MOSFET switch. The STM8 code can also be found under the GitHub link down below.

In the picture gallery you can find the block diagram. There are also four toggle switches which are used to set the Powerswitch-UART as a ETH-UART-Converter, a USB-UART-Converter or for programming the CH9121 via the USB-UART-Converter.

For now, the Powerswitch-UART only exists on a breadboard. I hope to have soon enough time to solder it and place everything in a box.