Page last updated: 21/10/2012

Clocked Serial IO 16 Relay Driver


    Clocked serial devices are ideally suited to the expansion of many microcontrollers I/O ports. In the example shown here we gain 16 bits of output each driving a relay at the expense of just 3 bits of output on the associated microcontroller, though depending upon the specific application the output capability is n x8 bits simply by cascading multiple 8 bit shift registers.




Circuit description

    Here is shown the basic concept in block diagram form for 8 bits of output derived from 3 bits of I/O on the associated microcontroller, to add a further bits of output (as in the final design shown later) at no additional cost in terms of I/O on the microcontrollers part further shift registers are simply cascaded. In practise there are three primary factors limiting how many devices that can be cascaded, increasing drive requirements, increasing capacitance, and software overhead as more devices are added reducing the possible data transfer rate, thus taking more time to move data between the microcontroller and shift registers.




    The 4094 CMOS shift register is unable to drive all but the smallest of relays, therefore here we use a buffer between the 4094 shift register and the relay. The ULN2803 provides this functionality, with each of its eight ports capable of supporting a load current of 500mA (600mA peak) and can withstand at least 50v in the off state. Furthermore the ULN2803 also contains integral suppression diodes for inductive loads essential when driving relays.

        Serial 16 Relay Driver schematic:

        Serial 16 Relay Driver component placement / layout:

          Serial 16 Relay Driver PCB bottom trace:


Driver Software:

    Included here are some drivers I wrote for the PIC12F509 microcontroller. Three versions, the original in which both input and output devices were implemented, and two cut down versions one for input devices only and one for output devices only. The original realised 32 bits of input and 32 bits of output from five lines I/O on the microcontroller.

    Combined I/O driver CKSIO.ASM

    Input only driver CKSIOinput.ASM

    Output only driver CKSIOoutput.ASM


Original Files:

    Further to the details of the pages above - the original CAD files created using EAGLE PCB Design software are included below, along with associated PDF files of both schematics and PCB layouts suitable for printing directly.

    To use the original CAD files, they must be opened with EAGLE. Visit the CADsoft web site for more details, the software (including a freeware version), part libraries, tutorials, for EAGLE are available.

    Serial 16 Relay Driver schematic PDF

    Serial 16 Relay Driver PCB component layout PDF

    Serial 16 Relay Driver PCB bottom track layout PDF

    Serial 16 Relay Driver EAGLE schematic

    Serial 16 Relay Driver EAGLE board