Optically Isolated Input Board V2
The objective of this project is to update our generic optically isolated input board for use with an even wider range of digital sensors and to make it easier to replace and update them if required. We use these boards with both our USB IO Board and Ethernet IO boards connected to our Home Control System (HCS). It is also designed to be able to work with the Raspberry Pi.
- The first version of this board used a common ground on both sides of the opto-isolator. Version 2 will include an optional link to join the grounds if required but, we don't envisage this ever being required.
- This design will support devices like the Raspberry Pi, where GPIO pins can be configured as input or outputs by mistake. In order to protect them, an optional 1KΩ resistor is supported in series with the processor input pin. When not required, this can be bridged with a wire link.
- This design supports optional pull-down resistors on the processor side.
- This design supports an individually fused +12V supply to each input sensor/device. This means shorting or over-loading the supply to one of the sensors, will have no impact on the others.
- The PCB design supports (3-way) screw terminals or in-line 4-way header plugs.
A requirement of this new board is to have mounting holes that enable it to be mounted on spacers and fully supported. It is essential that it doesn't flex too much when fuses or sensors are installed or removed. We have optimised the mounting hole spacing to make it easy to mount on our vented 19" shelves.
We currently expose the connections for sensors using a PCB mounted 4-pin plug. NOTE: for this second version, we have made the decision to change the pin order. This is something we really wanted to avoid but, it means we can use 3-way screw terminals. The fourth pin is used when a common connection is required to pass a signal to sensors connected to a board. The main example we have in mind here is the output from our twilight sensor. This means that some of our sensors can use this signal locally.
The PCB has designed to accommodate 3 types of connectors, for the connection of various sensors:
One of the key improvements we want to add to this new board is the provision of an in-line fuse for the power to each input device. This means that if a short circuit occurs, it only takes out the one sensor and not all eight connected to each input board. The plan was to use PCB mounted blade fuse holders but these are quite expensive.
To reduce costs we have decided to use PCB mount fuse holders that accept a 20mm × 5mm fuse. Purchased in bulk, these work out at less than 12 pence each.
Because we have individual fuse protection on each sensor, we don't require any other fuses.
This board will support a jumper, to optionally enable the first input to be fed down the wiring to all of the other sensors. These pins are all linked across the board.
Typically, this is used to pass twilight sensor signal to other sensors and devices connected. This will also be passed via an in-line 1A fuse. The components to support this only need to be installed if needed, thus reducing the costs slightly.
Optical isolation is achieved using two ILQ74 quad opto-isolators. The sensors switch a 12Vdc supply to each input via a 3k9Ω current limiting resistor but other resistors and voltages could be used. This drives the ILQ74 input with about 3mA.
Many of the input sensors used are normally closed, such as door contacts sensors. This means the ILQ74 input LED is normally on. The output side is designed to pull up the output when the input is active. This inverting effect means that a normally closed door contact sensor results in an active high signal at the I/O board when open. It doesn't really matter much because our software understands sensor types and can handle both active high or active low configurations.
Our circuit supports an option pull-down resistor but, many processors like the Raspberry Pi have built-in pull-down and pull-up resistors, meaning these don't need to be fitted. Most digital circuits use a 10kΩ to 47kΩ resistor for pull-down. The exact value doesn't actually matter, so long as it is high enough to prevent too much current from flowing. We have used a 47kΩ resistor to minimise the current consumption.
Processor Pin Protection
When connected to a processor like the Raspberry Pi, whose GPIO pins are configurable, it is possible that a GPIO pin could be misconfigured as an output, when it needs to be an input. This could result in a high output effectively being shorted to ground by the output stage of the ILQ74 IC. To prevent any damage, a 1kΩ resistor is used in series with the input pin, to limit the current in event of this situation occurring.
The GPIO pins on the Raspberry Pi supply 16mA maximum. The +3.3V supply can source 50mA maximum. The +5V pin is connected directly to the USB port.
I/O Board Connector
This board has 8 inputs and the required ground and +5V (or +3.3V), which need to be connected to a processor board. Because it is designed to be flexible and used in many situations, we simply expose these connections as pads using 10-way PCB header.
A matching 10-way header socket is used to link this board to other devices. In the case of the Raspberry Pi, we use an adaptor board to provide 16 digital inputs.
Header pins designation.
This is our first prototype built on Veroboard:
We have used the DesignSpark PCB tool to capture our circuit board design.
This is the PCB layout V2.0:
We have looked at a number of PCB manufacturers and obtained quotes from them. The main thing driving the cost of this board is its size. We want it to be quite big, in order to simplify construction and to make it easy to use in our home but, have compromised a little bit to reduce the cost of manufacturing.
Our initial PCB design resulted in a board that was 132mm × 110mm but this was too expensive to get manufactured. We spent a fair bit of time optimising the layout and have now got the board size down to 110mm × 85mm.
PCB Train have been recommended and quoted £30.00 + £5.00 delivery + VAT. They seem to be more competitive on price if ordering higher volumes.
For our first manufactured board we have used Ragworm. They were one of the cheapest at £40.58 (delivered) and came highly recommended. In order to submit the board for manufacturing, you need to export it into a number of 'Gerber' formatted files.
This is the top face of our manufactured PCB V2.0. There are 5 mounting holes to ensure the board is well supported when plugging in sensors. A big part of the board is taken up with the fuses but, we consider these an essential part of our design.
This is the bottom face of our manufactured PCB V2.0.
This is the completed up V2.0 board. On this one, we have not added the pull-down resistors.
Testing the first version of our manufactured PCB proved to be time well spent. We had missed one vital connection in the schedule, which had to be corrected with a piece of wire on the underside of the board.
We use a test device to check each input. This is just a micro-switch and and LED + resistor to check that +12V is present.
To test the output stage we fabricated this test device. It has 8 LEDs and uses a 3Vdc power source (two AAA batteries). As each input is triggered the corrresponding LED lights up.
This is the basic circuit behind this test device:
Having fully tested the board we reached version 2.1 and had 10 PCBs manufactured by Ragworm at a cost of £20.15 each.
Prior to this project we had 4 prototypes produced using Veroboard in constant use. It was the need to add more to our home automation system that drove us to get them professionally manufactured.
We are also using four of these on one of our smart home digital input shelves.
This is one of (if not) the most important elements in our home automation system. It provides a means to interface a large number and a diverse set of dumb (low-cost) binary sensors at very low cost. It also provides the best reliability and performance. It home automation terms this is 'commercial grade' hardware.
The only down-side to this approach is that it requires hard-wiring of sensors back to a central point but, for many kinds of sensors this is simply the best way to do it.
This is not the cheapest way to solve this particular problem! We have designed and built the best possible solution, based upon our experience and knowledge gained whilst building our home automation system. Compared to using wireless sensors, it is much cheaper way to implement this functionality though. Each board supports 8 digital sensors (PIR sensors, door contact sensors, etc.) and with each room and door wired up in our next home, we could be installing as many as ten of these boards.
This approach is massively cheaper than using wireless sensors and it is also much more reliable and provides much lower latency. If you are getting started in home automation, then you need to be using something very similar to this design.
The other obvious thing that can be connected to this board is simple buttons, such as panic buttons, buttons to invoke scenes, operate lighting, etc.