Soldering a slice of pi/o

A few weeks ago I bought some interface adapter boards, including a Slice of PI/O, which came as a kit of parts in a little zip-lock bag.

I had a day off work today. Not for a good reason, unfortunately – it was my aunt’s funeral in the afternoon. But it did give me an hour or so to do some raspberry Pi stuff in the daylight. As well as having a go at tidying up all the wires, SD cards and expansion bits I had lying around my desk, I fetched my soldering iron to assemble the Slice of PI/O.

I must point out that it is a long time since I last did any soldering. At the back end of the 1970s I used to do some hobby electronics (mostly projects from magazines, which I was rarely able to get working) and I was part of a three-boy-team who designed and built a robot lawnmower and got our 1 minute 55 seconds of fame on BBC TV’s “Tomorrows World” show. About a decade later I spent a few years working for a small electronics company. Although my main job was writing software, I did sometimes pitch in with bits of assembly or re-work. Since then, however, my soldering iron has remained cold and unloved.

As you might imagine, it was with some trepidation that I set out on assembling this board. Luckily it is very simple to assemble, and most of the soldering is headers and sockets rather than components which might overheat or be damaged by static. The only real component which I had to solder was a little dipped capacitor, and they are pretty tough.

SANYO DIGITAL CAMERA

The main problem was a lack of hands – to get everything in exactly the right place, and get a really good joint, you need: one hand on the board, holding the component in place, one hand on the soldering iron to direct it to the right pin, and one hand on the solder reel to place the tip of the solder against the tip of the iron and the pin. A quick count shows that’s three hands! This becomes even more complicated if you want to take a photo at the same time, so no action shots with a curl of smoke rising as the solder melts, I’m afraid.

I tried holding the board in a home-made vice, but holding the board still is not much use if the component jumps around in its holes as you apply the solder. Fairly quickly though, I got into the swing of the following steps:

  1. prop the tail of the solder so that it sticks in the air
  2. arrange the board and component in my left hand so that the component is aligned correctly and the pins are all visible on the solder side of the board
  3. touch the soldering iron against the tail of the solder so that it gets a 1-2mm blob of molten solder on the tip
  4. quickly move the soldering iron across to one of the end pins, and let the solder flow around the pin
  5. adjust the component while touching the iron against the solder if required until it is properly aligned
  6. repeat the solder blob technique for the opposite pin
  7. once the solder on the end pins has cooled the component should be held fast, and can be placed on the work surface and soldered using a more normal two handed method
  8. after all the rest of the pins are soldered, go along and inspect each one (especially the end pins), with a magnifying glass if it helps, to make sure that the solder is shiny and nicely shaped in a smooth curve from the pin to the board. If any of the joints looks dull or lumpy, or does not seem to have enough solder, melt it with the tip of the iron and add a little more solder. If any of the joints has too much solder, remove it with a wick or a pump, and try that pin again.

After soldering all the sockets, headers, and the capacitor, all that was left was to choose an address using the solder pads and then fit the MCP23017 IC.

Choosing an address was a bit of a head-scratcher. The instructions said how to do it, but did not really suggest a particular configuration, nor did they explain what the impact of choosing different settings might be. Eventually I opted for the low-low-low (address 0x20) option as shown in the picture.

Fitting Dual-In-Line ICs can also be tricky. As supplied, the legs always seem to bend outwards so that they are too wide for the socket. If you try and just wiggle or force the chip into the socket there is a high risk of bending or damaging some of the legs. In extreme cases this can mean you have to throw the whole chip in the bin. A trick I leaned years ago is to hold the IC horizontally in both hands with the pins facing away from you, then place the IC on the workbench and very gently roll it away from you, as if you are making a tortilla wrap, or a sushi roll. You only need to roll it a few degrees to bring the pins into a more reasonable line for insertion. Flip the chip over and do the same with the other row of legs and you should find it much easier to get it into the socket.

With everything in place it was time to attach the board to the Raspberry Pi. Another slightly nervous step. Although I’m pretty sure I soldered it right, I have blown up enough electronics with my overconfident tinkering in the past that it is always a concern.

The Pi booted into Linux fine, and I logged in over ssh to install the driver software. I had already enabled i2c on this SD, so the first step was sudo nano /etc/modules to add a line

i2c-dev

Next, get some i2c tools: sudo apt-get install i2c-tools and enable them for the default user with sudo adduser pi i2c.

The final step should be i2cdetect -y 0, but this gave

Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory

Looking back at the output, I’m guessing this is related to an error message which appeared during the apt-get:

Setting up i2c-tools (3.1.0-2) ...
/run/udev or .udevdb or .udev presence implies active udev.  Aborting MAKEDEV invocation.

.

A quick google search does now show me anything particularly appropriate to this problem. I tried a few things, including killing the udevd process with no luck. Eventually I rebooted the Pi and was then at least able to run the i2cdetect -y 0 command.

It’s a bit tough to work out whether the results are what I should expect, though, as this is where the web instructions run out. What came back was:

pi@raspberrypi ~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

This does not seem very promising, as all the slots are empty.

Luckily a quick look at the reviews on the Ciseco product page for this board gave the answer. I’m running this on a rev2 raspberry Pi, so I need to use 12c channel 1. Entering i2cdetect -y 1 gave:

pi@raspberrypi ~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Looks like the board is detected, now I just need to find out how to use it. That seems as though it might be a more complicated task, so I’ll leave that for another post.

7 Comments

  1. Great to hear someone else buys these expansion boards just for the hell of it :-) I’ve just received a BerryClip from Raspberry Pi Spy which will similarly need assembling. I’m not too sure that the blob method of soldering is a great idea (I’ve always been told – heat the component, not the solder, first) but I daresay it helped with doing all the other soldering after that.
    Looking forward to seeing what you do with it :-)

    • D’Oh. Now you have suggested another one I’ll have to take a look at :)

      I agree that the blob approach is a bit risky, but going back and re-flowing the first pins once the others are in place seems to do the job. When I used to do this for a job we had rotatable jigs which would snugly hold a whole board’s worth of stuff, but that’s a bit to far to go for small bits and bobs like this.

      Thanks for the comment. Makes me think I really should set up a blogroll.

  2. Hi Frank

    I got the same board and have got exactly as far as yourself.

    I just want to send the Slice of Pi/O board’s pins high to switch relays – a 5V 8 channel module similar to this one:
    http://tinyurl.com/bu7hgrd
    I bought two on Ebay (search “relay board 5V 8 channel module” – for US $17.62 (£12.00 GBP, March 2013)
    They’re rated to switch 250V 10A so good to switch most mains powered devices in the UK.

    I’m wiring the 5V pin on the Slice of Pi/O board to the VCC power on the relay board. And grounding the relay’s ground to the Slice of Pi/O’s pin(s) ground (each pin has a corresponding ground). Nothing’s blown up yet. And I can do:
    i2cdetect -y 1
    to get the same result as yourself (I also left the address pads alone for the same default: low-low-low (address 0×20) option.) Similarly, the instructions made me scratch my head, a little, too – but I s’pose it’s only relevant if you have more than one board being controlled by the Raspberry PI.

    I want to use PHP or Python to do timing and switching. If I were to set up a webserver on the Raspberry Pi (Apache, PHP, myPHPadmin, mySQL etc) then this could be the basis of a neat (and cheap) remote home automation system.

    I have several remote switchable sockets at home so if I can figure it out, I can wire up the remote to the Pi and be able to control any mains socket in the house.

    Nevertheless, have you managed to write to this board? I’ve been scratching around for days now, trying to find out how to do just a simple thing like switching a pin on the Slice of Pi/IO high!

    Did you get any further, or know of any (simple ;-) tutorials to use I2C (for example) on this board?

    TIA
    John

    • I’ve got one of those relay boards on order, but things take a while from China…

      In the meanwhile I’ll have a go at some software to drive the slice of Pi/O. Just something that takes the pins up and down to drive LEDs or whatever should be enough for you to work with, I hope?

      • That would be really great, Frank.

        I’ve been trying to research this subject for what seems like weeks now, but I haven’t been able to find anything approaching the Dummies Guide to I2C on the Raspberry Pi, just yet.

        Although, I have been configuring the Raspi in preparation and so far I’ve identified Quick2Wire Python API, with an code example that talks to the little sister chip (MCP23008) of the Slice of Pi/O’s MCP23017 @ http://tinyurl.com/brddxqd

        Yeah, those relay boards seem really great value and I don’t think we need to worry about 3V / 5V voltage translations ‘cos we’re only _writing_ to the board (although I have a board too for reading signals if I need them for sensors).

        Once I can get some I2C examples going then I have a few other projects to incorporate including heat / humidity sensors, real time clock (Pi’s not got one!?), LCDs, servos, PWM drivers board and a proximity sensor.

        Thanks for your help.

  3. Ages ago I wrote a very simple “i2c setup tutorial” as part of http://elinux.org/RPi_ADC_I2C_Python (although this obviously doesn’t cover the MCP23017 so ignore everything after step 4).
    And there’s a much more detailed i2c setup tutorial at http://quick2wire.com/articles/physical-python-part-1/

    IIRC the /etc/modules and /etc/modprobe.d/raspi-blacklist.conf only get read at boot time, which is why a reboot is necessary before things work properly ;)

    And just in case you missed it John, Frank’s written another blog article covering this chip here.

    • Thanks for that Andrew. I had spotted the need to reboot, but not noted it consciously enough to write about it. I guess I need to be more methodical with my notes, and not get caught up in the excitement of trying to get stuff working!

Leave a Reply

Your email address will not be published. Required fields are marked *