Links

Introduction

8 Bit TDM System

TDM Systems are used to transmit and receive the state of switch/relay contacts to and from remote locations using 2/4 wire
telecom transmissiion. This historically has been by 'Direct Wire', also known as 'Leased Line' or in some cases PCM systems were used.
Now that IP systems are becoming common place I thought it would be fun to write a python script that would turn two Raspberry Pi's
into a small 8 in - 8 out TDM system, sending the date via a network connection. A TDM is made up from an 'Office' and a 'Field' system
that functions as a parallel to serial/serial to parallel converter. At the Office, switches and button's (on a control panel) are
converted to serial data, sent to the Field and converted back to relay contacts to control equipment and the same process
is performed from Field to Office, generally for indication purposes.

I set myself a limit of eight bits in each direction as it fits well with the standard GPIO on the Pi. Using add
on boards and some script changes this could easily be increased to 128 bits, split in any ratio in either direction. The script is
very basic, it provides packing of bit states for the transmission and has a GUI to display the state of each input/output
(switch/relay contact state). On the GUI there is a 'watchdog' (WD) indication so it can be easily seen if the Pi has stopped
running the script. At present there are no external alarms but the WD could easily be programmed to output on a spare GPIO pin.

A little bit of work is still required on the scripts as at present the Field end must be started before the Office end.