Quozl's Desk Charger Timer

| quozl@us.netrek.org | up |

Gadgets Don't Need Power Always


Computer control of a rack of device chargers, for mobile phones, amateur radio transceivers, a torch, and occasionally a laptop.


The wiring from the RS-232 connector to the solid state relay was done so that the relay would only energise if RTS was off and DTR was on.

The reason for this was that the two signals are normally found either both on or both off, except in rare circumstances. It is this rare circumstance which is desirable. We don't want activation during boot.

condition DTR RTS difference
system power off unpowered unpowered none
system booting off off none
system booted off off none
serial port opened by conventional software on on none
serial port closed by conventional software off off none
serial port opened by software designed to lower RTS on off full swing

Since control signals such as RTS and DTR are logically inverted, a positive voltage with respect to ground occurs when the signal is on. So with RTS off the signal has a voltage of -5V to -15V depending on the serial port internal power supply. With DTR on the signal has a voltage of 5V to 15V. Therefore the difference will be between 10V and 30V, current limited.



A Python program that opens a serial port, lowers RTS in order to energise the relay, and then waits for a signal. Once a signal is received, it raises RTS, then closes the port.

Depends on the Debian package python-serial.

import sys, serial, signal

# raises DTR and RTS, null effect
device = serial.Serial('/dev/ttyS2')

# lowers RTS, powers charger

# pause until signal received, e.g. from parent

# raises RTS, depowers charger

# lowers DTR and RTS, null effect



A shell script that stops the charger. Useful in the context of a task scheduler like cron.

killall --signal SIGUSR1 charger


A shell script that runs the charger for an hour. Depends on the Debian package timeout, which is a program that runs a command for a given number of seconds then sends a signal. In this case we send SIGUSR1, also known as 10.

timeout -10 3600 charger

| quozl@us.netrek.org | up |