Thingatrons (blog post here) - the open collector driver boards that I (Lucy Rogers) made to control outputs from the GPIO pins on a Raspberry Pi - were great, but I realised I also needed to use various inputs to trigger the outputs.
And because I want my *things* to work out in the real world, and not just on my workbench, I use inputs that trigger on 12V, such as a motion detector or PIR.
If there's any kind of fault on the wiring or in the input, I could easily fry the Pi. Therefore I wanted to electrically isolate my inputs from the Pi. Fortunately there's a cunning way of doing this, using something called an optoisolator (also known as optocoupler or photo-coupler) . These are component that use a light emitting diode to trigger a light sensitive transistor. There's a nice article on optoisolators here.
Although I could make a one-off using some veroboard, I knew one would never be enough ... so I made a couple of PCB's ...
Finding which parts to use and their corresponding items in the Eagle libraries was still the most difficult part. I used a dual-channel optoisolator (photo below), which means there are two LED's and two transistors inside the one component - therefore I could run two inputs through one PCB.
Here's the schematic:
Here's what I used, which Eagle library they were in and what they were called and their Farnell Part Number:
Once the schematic was drawn, I could move on to board. I spent ages re-arranging everything so I could use the smallest board possible (the PCB manufacturers charge by the size of board).
I was advised to route the board by hand since the autorouter is overkill for such a simple board. Also, the autorourter needs quite a lot of set-up in order for it not to do strange things.
Some other hints and tips included:
- If you want to re-route a track you can use the "Rip-Up" icon. Double clicking a track rips-up the whole signal and returns it to the airwires, or yellow straight lines.
- Use the "ERC" button to check the electrical connections
- Use the "DRC" button to check if the design fits. This shows things like if the track is too close to the edge of the board.
- Some tracks can be made thicker, particularly if they have a larger load on them. This can be done a few ways, but I find changing the "width" in "Properties" the simplest. (Use the "i" for info icon).
- By "smashing" a component, you can separate the name or value from a part. This lets you move the name to a more convenient position.
- Add mounting holes to the board, so you can secure it later.
Here's the finished board in Eagle:
I then made the gerber files (search online for how to do this) and sent them off to Ragworm. I may have got a little bit over-excited when the boards arrived. I then added the components and ran some tests:
Once I was happy that everything worked, I used it in my first application - the Firecrackers - blog post and video here.
The photo below shows the optoisolator in the top left corner of the Firecrackers control box (the three other orange PCB's are the Thingatrons).
UPDATE 6th August 2015
The optoisolator Gerber files are available to buy here.
*Note this PCB is designed to protect the Pi from damage due to Earth Loops - it is not designed to withstand to mains voltage levels between input and output.*