Raspberry Pi

Gertboard stability modifications

Introduction.

Eighteen months ago I ordered the Gertboard for my Raspberry Pi. It is a cool add-on that gives you buttons to press, LEDs to flash, A-D and D-A converters, a motor driver, a relay driver and on top of all that an Atmel AVR Mega386 which could be programmed using the Arduino environment using the RPi as a programming device. I bought the early "self assemble" version - Note that these modifications may not apply to the newer pre-assembled version.

One thing that irritated me about it was the way the LEDs would flash and flicker if they where not connected to an output that was configured as an output. The cause of this would be obvious to anyone who has dealt with CMOS logic - floating inputs. They have a VERY high impedance that means even the slightest capacitive coupling can drive the input up to a voltage that registers as a logic '1' and switches on the gate. I imagine Gert omitted them to save parts, because if they are connected either to the Pi or an external circuit there is no problem - I just found it annoying and worried a little about the problem of static build up killing the the buffers.

raspberry/gertbuf2.png

If we look at the circuit of the buffered inputs (RolfeCAD drawing to the right) you can see where the extra resistors need to go. The inputs to the buffers need to be pulled either to 0v or +3.3v by a high-value resistor so that if nothing is driving it then it will return to a known state. The obvious is to pull it to 0v, which is what I did to the INPUT [1] buffers, but the OUTPUT buffers are different, a pull-down resistor there would be in opposition to the internal pull-ups inside the Pi even when the buffer is jumpered as an input. Therefore I chose to use a pull-up to +v which would only paralell any pullup on the Pi.

That leaves only 2 matters - what value of resistor, and how to mount them?

Resistor value

There is no "right" value for the pullups/downs (hereafter referred to as "resistors"!). If the resistor is too high in value then it will not be effective in supressing the capacitive coupling from the wiring - too small and it will overload the circuits driving the I/O lines.

I found on this very useful site that the Pi has programmable pull-up or pull-downs of 50k available for every pin. This means that I could just program the pullups on the input to the buffers that way - however I wanted to use the Gertboard to interface with other devices so some kind of hardware pullup so the board can be operated without the Pi attached (and thereby attached to something else...). To make my pullups not interfere the Pi pull up/dowsn I'd have to make the value > 100k at least, which I did not feel would work to cancel the capacitive coupling (a purely "gut" feeling, and probably wrong, but there you are!) In the end I decided to "ignore" that problem - if the pin was program then my pullup will be helping, if its programmed with a pulldown then there would be trouble, so I just have to make sure I don't do that!

The I2C pins on the Pi already have a 1.8k pull-up so I needed a value that was at least an order of higher. In the end I calculated (well, guessed!) a 33k resistor is the value but I figure anything in the 30k-50k region would be a good compromise. In paralell with the 1.8k resistor 33k will lower the overall resistance to 1.7k, which will not tax the I2C bus at all.

Physical implementation

So, according to the diagram above I need to add 2 resistors to each of 24 channels. I briefly considered using the small 'prototyping' on the relay driver side of the Gertboard, but decided that would be better set aside for other purposes. In the end I dreamed up a scheme to solder SMT resistors onto the underside of the board!

raspberry/gbmod1.jpg

The I/O pins on the edge of the Gertboard are alternately I/O and GND. So all I had to do was solder a resistor betweem the pins. To stop myself burning through the solder mask and shorting everything out, I was going to put a layer of Kapton tape down to insulate things. Kapton tape is like "insulating tape" except is is made from a plastic that has a high resilience to temperature - electrical tape is PVC and melts on a hot day. The tape has an additional effect of raising up the resistors from the surface of the board and reducing the risk of shorting the pins to earth, because the ground plane comes up VERY close to the I/O pins!

To solder the resistors, I applied some flux from a flux pen to the pins, manuvered the SMT resistor into place & held it down with tweezers, then put some solder onto the iron and dabbed it onto the pin & resistor. Once one end is done the other is a piece of cake, because the resistor can't run away or cling to the soldering iron!

raspberry/gbmod2.jpg

On the other side I used the Kapton tape as before and solder one end of each resistor to a pin, and use a fine wire to join together the other ends and to the +3.3v rail. I used a piece of Wire Wrapping wire (also known as "Mod Wire") with the insulation stripped off. If you don't have any (and it can be expensive to get) then strip some cheap 7/0.2 hookup wire and use a single strand. I held it in place with electrical tape then soldered it to the resistors.

raspberry/gbmod3.jpg

Once all the resistors had been soldered in, and the board tested, I used some hot melt glue to cover the resistors and wire to stop them being snagged and pulling off.

This latter technique proved to be easier and neater that soldering the devices between pins, so if I was to do it again I'd do both the same way, (see pictures!).

The end result is a stable Gertboard with LED outputs you can rely on. This may not be a mod you require, but at least now you know its something that can be done for the cost of a few cheap SMT resistors and a bit of wire..

If all this sounds daunting, don't be put off - I found it straightforward despite the SMT resistors tendancy to have their own idea about where they wanted to be, and I am waiting for cataracts to be removed from both eyes, so my eyesight is not as good as most peoples!

Note:

When I was googling for the buffer schematic I found another page where someone has made a very similar modification, and it appears there have been a few revisions of the gertboard and one of them addresses this problem.

Footnotes

[1]INPUT and OUTPUT directions given here are from the perspective of the Raspberry Pi. I.E. INPUTS are signals going IN to the Pi and OUTPUTS are signals going OUT to external circuits.

Version 2 updated 9 Dec 2013, 1:08 p.m.