IMG_6557 (1).jpg



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 ...


I again used Cadsoft's Eagle PCB Design Software - and again I was very grateful to the help given by James Macfarlane, who uses the software regularly.


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:


My DescriptionEagle LibraryDevicePackageValue (User input)Farnell Part NumberFarnell Link
Header: 4 pins x 1 rowpinheadPINHD-1X41X042356153
Resistor: 680 ohmrclR-EU_0207/10 (R-EU_)0207/10680R9342168
Resistor: 10K ohmrclR-EU_0207/10 (R-EU_)0207/1010K9341110
Terminal Block: AK500/2con-ptr500AK500/2AK500/2PWR1641947
Diode: 1N4148diode1N4148DO35-7 (1N4148)DO35-71N41481081177


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:

Screen Shot 2015-07-10 at 12.21.21.png

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:


IMG_6545.jpgIMG_6547.jpg IMG_6550.jpg


IMG_6554.jpg IMG_6558.jpgIMG_6557.jpg


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.*