Controlling a TOSR0x USB Relay Module Using Python

As part of a forthcoming project to build a computerised thermostat, I require a means of programatically controlling a pair of relays to switch mains power.

The brains of my thermostat will be a Raspberry Pi. This credit-card-sized computer is overkill for such a project, but having access to a complete Linux environment will make it relatively simple to do interesting things such as produce graphs, send Twitter updates and expose temperatures via SNMP. It also allows me to code my thermostat in any language that I choose and in this case, I've chosen Python.

One of the Raspberry Pi's key features is its GPIO interface, allowing it to control all manner of electronics. However for v1 of my thermostat I want to focus on software rather than hardware, so I went looking for a relay controller with a USB interface. What I found was the TOSR0x:

Continue Reading Comments