Carambola IO board with 8 relays and 8 inputs

Time to interface this great Carambola board I have. The I2C board I made up in the last post worked really nicely with the Carambola development board, so this seemed the natural progression.. Piggyback the Carambola on the 8 channel IO board, give it some power, an Ethernet jack, and this should be a nice little board for control / monitoring.  The board can work either wired or wireless, and by using a LM2575 Buck switching regulator, the board can run from 5V to 40V.

Here is first sheet of the schematic:

Schematic for Carambola IO Board with relays (1 of 2)

Schematic for Carambola IO Board with relays (1 of 2)

The second:

Schematic for Carambola IO Board with relays (2 of 2)

Schematic for Carambola IO Board with relays (2 of 2)

All done in KiCad. Below is the PCB layout.  Might have got it onto a single sided PCB with a few links, but pushed the boat and went double sided for this one! The components are all through hole so this should be easy to make when the parts arrive. I’ve designed in a header on the right hand side that would allow a 1-wire DS18B20 to be connected along with breaking out the i2c, SPI and UART. The PCB layout fits neatly on a Eurocard PCB (100 x 160mm).

Two layered PCB for Carambola IO Board with relays

Two layered PCB for Carambola IO Board with relays

All the info you need should be here: Carambola IO Board.tar (KiCad project files, BOM for Farnell parts, etc)

Home PCB Production – I2C 8 channel IO board

Time to start making the I2C Relay IO board I designed up a month ago.  It’s taken me this long to get around to production because I have had to get a few things together to make this happen!

So for PCB production here is my list of things you’ll need:

  1. Artwork (KiCAD will give you PS or SVG)
  2. Artwork printed onto OHP film with either a laser or inkjet printer
  3. A light box/UV exposure box
  4. Photoresist developer (I’m using Electrolube PDN, 1 part to 4 water by vol.)
  5. Etch solution (either Ferric Choride or Sodium Persulphate)
  6. A selection of glassware
  7. Rubber gloves and eye protection (all very “Breaking Bad” sounding!)

The artwork needs to be printed out on clear overhead projector film. I always print two copies and tape the two together to get an extra dark image.

PCB Artwork doubled up

PCB Artwork doubled up

I don’t yet have a UV source so I used the sun.. works fine, 5 minutes exposure and into the developer.  The developer is spec’ed at 20C but I turned up the heat to about 28C as it was taking all day to do anything!

PCB Development - traces just starting to show up

PCB Development – traces just starting to show up

Once the image was good and clear time to take it out of the developer and rinse with water, at this point the copper should be shiny.  This takes about 5 to 7 minutes.

Into an etch bath at about 50C..

PCB Etching - start, good sharp lines, looks good..

PCB Etching – start, good sharp lines, looks good..

5 minutes later we have some action, the last of the copper is being removed.

PCB Etching - near the end of process

PCB Etching – near the end of process

Rinse again under water and dry.  The resist comes off with wire-wool or nail polish remover.

Dremel at the ready, with diameter 0.8, 1.0 and 1.2mm bits.  Forget HSS bits, drop some more cash and get solid-carbide drills, they last much better!

PCB Drilling - 0.8, 1.0 and 1.2mm drills needed for this PCB

PCB Drilling – 0.8, 1.0 and 1.2mm drills needed for this PCB

Mount up the parts.. and I’m very happy, worked first time!

I2C Relay Board - top side - Finished

I2C Relay Board – top side – Finished

Here is a close up of the tracks:

PCB track close up

PCB track close up

Raspberry Pi Heater Controller

UPDATE (2013-02-15): I’ve discovered why the DS18B20 was giving out the wrong temperature! Silly mistake.. I had wired the Vdd to 5V instead of 3.3V. In the process I’ve blown GPIO pin 4 on one of my Raspberry Pi’s.. bummer but installed a new Pi and re-wired the Vdd on the DS18B20 to 3.3V, now it’s working fine.

Over the last few evenings I’ve been working on my Raspberry Pi heater controller… The hardware is now finished and I’ve started on the software.  The controller uses a DS18B20 to monitor the temperature and one of the GPIO pins to drive a relay which in turn drives a contactor (the heater is a 1.5kW air blower, that is why the contactor is required). Here is a quick overview of the setup so far.

Circuit diagram:

Heater control schematic (in KiCAD)

Heater control schematic (in KiCAD)

The parts in their box:

Heater control in it's box...!

Heater control in it’s box…!

The 1-wire input through a 3.5mm stereo jack and the relay drive transistor:

Relay drive transistor (under shrink wrap)

Relay drive transistor (under shrink wrap)

The recycled phone charger PSU:

The recycled phone charger switch-mode PSU

The recycled phone charger switch-mode PSU

The relay and contactor combo:

Relay and contactor piggy backed

Relay and contactor piggy backed

The control software is going to be web based and will allow me to set a temperature set point, override the control, and if I get to it, will also have some sort of timer to allow the heater be set to come on and go off at pre-set times.

There is a pile of info out there on 1-wire temperature sensors and connecting them to the RasPi.  One of the better sites I found was: www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/temperature/

Setting the GPIO pin is simple, this script gets run at boot up:

echo "17" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio17/direction
echo "0" > /sys/class/gpio/gpio17/value
chmod 777 /sys/class/gpio/gpio17/value

Now the lighttp web server can have access to the GPIO pin.  Here is a snippet of the PHP that does the business…

$s = $_REQUEST["s"];

if ( $s == 'on' ) {
        $cmd = 'echo "1" > /sys/class/gpio/gpio17/value';
        exec( $cmd );
        }

if ( $s == 'off' ) {
        $cmd = 'echo "0" > /sys/class/gpio/gpio17/value';
        exec( $cmd );
        }

I’m having an interesting problem with my 1-wire readings at the moment. For the first five minutes or so the reading are correct, but after a while the readings jump by 40 degrees! The 1-wire CRC is fine so I don’t think there is a problem with the bus, but I’ll have to take a look with the scope to see if I can get to the bottom of it… very strange!