February 11, 2011
Evicting the bread
Breadboards are great for prototyping and testing, but not so amazing for sticking in a aquarium cabinet. Bits fall off, dust and food gets stuck in the holes, that sort of thing. So let’s get our Palantir hardware onto a more solid basis with some copper stripboard (aka Veroboard). If you’ve done electronics prototyping before you’ll probably know what this is but if not we suggest this brief introduction. Read it? Good.
Arduino ate my hamster
Due to an 11th-hour bug with the original PCB design, the Arduino pin layout has a rather annoying feature. Despite using standard 0.1inch spacing, the header positions do not allow stripboard to be directly stacked on top in the same as shields. There are some effort requiring solutions to this problem, or you can buy custom prototyping shields if you don’t mind spending a bit. Alternatively we can work around the problem using three separate mini-chunks of stripboard.
Here we have a 7 x 7 (strips x holes), a 6 x 7 and a 14 x 7 piece cut from a larger stripboard (to cut this stuff – score with a sharp knife and snap it over a hard edge, copper side down). Since the two smaller boards need to fit together tightly, you’ll also have to nibble down the inner edges with side-cutters to just off the copper. Then cut your length of pinstrip to give you three 6-pin and one 7-pin lengths and solder them onto the mini-boards as appropriate. It’s easiest to do this if you i) insert the pinstrip segment into the correct header on the Ethershield; ii) place the mini-board on it copper-side up (and the right way round!); iii) get it flat and held in place with a lump of bluetac; iv) then solder one pin in place; v) unplug it before soldering the rest. Once they’re all done, put all three back on the shield and check for misaligned pins or if you need to nibble down any further edges. Then unplug again and use a multimeter to check that your soldering didn’t short any of the strips together.
I have a plan
Take a bit of time to study this schematic and compare it to your breadboard:
Unfortunately all three mini-boards will need to be wired together but we’ve tried to maximise the spacing and there’s no need to actually cut any of the copper traces (as that’s no fun). The two smaller boards sit above the digital pins and feed the LEDs, the buzzer and the temperature sensor socket. The larger board sits on the analogue pins and is connected to the reset button and the six analogue sensor sockets. Two power feeds cross between the sides, the first is the Arduino supplied 5v line that is used to pull-up the OneWire bus, the second is from digital pin 9 and supplies the on/off switchable power for the analogue sensors. A couple of things to keep in mind while looking at this schematic: this view is from the top however the wires will actually have to inserted through from below and then soldered on this top face. Also, for neatness only one ‘common’ 5v and GND line is shown for the analogue sockets, in actuality six wires will need soldering into each of the attached strips.
|Mini-board 1||Mini-board 2||Mini-board 3|
|1 and 2 connected||All three connected…||.. and stacked|
Some hints: i) use thin, flexible wiring – the grey ribbon cables used for PC hard drives are a good source; ii) put each mini-board together separately first, then connect them; iii) test for shorts between the copper strips regularly; iv) leave your breadboarded set up together and working for the time being – you may need it while testing.
It’s probably easiest to wire up the sockets at this point too. Exactly how they connect will depend on the model of plugs and sockets you’ve bought but in any case you’ll want to connect the tip of the jack plug to +ve, the middle to Signal and the butt/surround to GND. Make sure you double check your polarities, mark the wires appropriately (if not using colours) and note which socket will connect to which analogue pin. Once they’re soldered to mini-board 3, it’s also worth checking that all the GNDs are inter-connected, all the 5v lines are inter-connected, but that none of the signal lines are.
|Analogue sensor socket||Polarity of the jack plug & socket||Reset button & capacitor||LEDs and limiting resistors|
Putting the voltage limiting resistors next to the LEDs and the reset capacitor across the button, keeps these components off the mini-boards and is a bit neater. Cover them with electrical tape to prevent shorts.
Hooking it up
Right so, here’s the octopus we’re aiming for:
How you connect your sensors depends on your configuration, the size of your aquarium cabinet etc. We suggest that you make up a collection of ‘sensor cables’ a couple of metres long, with a jack plug at one end and the sensor mounted at the other. That gives you enough length to place the sensors where they’re needed and snake through to connect to the sockets on the Arduino. We used: 1 per sensor 3.5mm jack plug (tip +ve, mid signal, base GND), 2m per of either scavenged mouse cable or stereo audio cable, various PC fan and internal audio plugs to interface to the sensors, electrical tape, 6mm shrink wrap, and lots of swearing. See the photos back on page 1 for how these came out. Some specific hints/suggestions
- jack plugs – don’t forget to thread the barrel (and insulator tube if required) on to the cable before you start (!) Double check the polarity before, then after soldering and make sure none of the wires short to the barrel (if it’s metal).
- fan plugs – the pins can be carefully removed and replaced with pliers, it may be helpful to match any coloured wires to the sensor pins (red to 5v etc.)
- light sensor – both the LDR and the balance resistor should go at the sensor end (connect up: 5v -> LDR -> Signal -> resistor -> GND). Cover all bare metal with tape/shrink wrap, then bend the LDR head over 90o and you can tape it flat against the side of the aquarium glass
- pressure sensors – these should be just outside the lip of your aquarium so they don’t get wet but there’s not too much airline reducing the pressure. Consider the use of non-return valves but you’ll have to experiment to check what signal you’re getting with the filter on or off. Make sure you know which port on the sensor is ‘pressure’ and which is ‘vacuum’ :)
- hall effect – splay the pins outward and mount in a small socket, then cover with tape/shrinkwrap. Placing these on the filter body takes some experimentation to get a good signal, once you have it, tape the sensor in place so it doesn’t escape
- temperature – with the default setting you can have up to five of these. Make sure you know which is which via its internal ID (see Palantir’s Serial output. They all need to connect to the same socket, so buy a number of N-to-1 audio splitters (as used to connect multiple headphones to a single iPod or whatever). The 5-way Belkin RockStar adaptor is useful if you have lots of sensors. Try not to let the wire length between the Arduino and the sensors get more than a couple of metres, or you may find that the parasite power starts getting flaky
- check everything – before you rig up your tank, maybe you’re perfect but we’re certainly not!
Finally you can stick it in a container if you like (our project box didn’t fit [grump] but Tupperware or any other alternative will do):
Ok now so the hardware is done – what can we do with the data?