My Pi Description

My Experiences With the Raspberry Pi -- Tracking My Learning -- My Pi Projects

Thursday, July 25, 2013

Gertboard - Modifying the Board

Modified Circuit For Buffers Without Switches (Nine Circuits)
Modified Circuit for Buffers With Switches (Three Circuits)
To modify the Gertboard, I added a 4.7k pulldown resistor to each of the lower (lower according to the schematics above) buffers to keep their LEDs normally off and to provide anti-static protection. 100k pullup resistors were added to each upper (upper according to the schematics above) buffers for anti-static protection.
Modifications To The Bottom Of Gertboard.
The modifications were made by soldering surface mount resistors to the underside of the Gertboard. The resistors were of the 1206 size - 0.12" x 0.07" x 0.02" thick. These are about the smallest parts I can solder by hand. The 4.7k resistors (pulldowns to lower buffers) are soldered between adjacent pins of J10. This was fairly easy as the distance between these pins was 0.1". Refer to the photograph above this paragraph. You can see these resistors along the bottom edge.
Soldering the 100k resistors was a little more difficult since this was done at the ICs pins themselves. A copper wire was soldered to pins 20 of the ICs. The resistors were soldered between these copper wires and pins 2, 4, 6, and 8 of the ICs. You can see these connections in the photograph above. I suggest you use the single strand, 30 AWG, wire-wrap wire for this purpose. This is available from Sparkfun for about $9 for 100ft.
If you are using any of the three switches on the Gertboard, the 100K resistors are sufficient to pull the level up to 3.3V when the switch is not pressed. Therefore, it is not necessary to use the Raspberry Pi's internal pull-ups.

Monday, July 22, 2013

Gertboard - What the Heck! Why are those LEDs Flashing On and Off?

So, I unpacked the Gertboard, attached the stand-offs, connected it to the Raspberry Pi, and applied power.
And - All twelve LEDs on the Gertboard lit, then some went off, then different ones just started to flash on and off. When I touched the metal shell of the Ethernet, USB, or HDMI connectors all of the LEDs went off.
I looked at the schematics to find if there was a fault with the Gertboard. Did I find a problem? Yes a DESIGN problem. Refer to Figure 8 on page 15 of the "Gertboard User Manual" (version 2 manual). I have recreated that figure here except for the 10K pullup resistor. I'll talk about that below the diagram.
Buffer and LED circuit. Represents one of twelve circuits
Now here is where things get a bit tricky. If you look at that figure 8 in the manual, you see a 10k resistor connected between the input of the lower buffer and 3.3V. Why doesn't my diagram above show that resistor? When I purchased my Gertboard, only version 1 of the user's manual was available. I didn't know there was a new version until I started to write the post before this one. The version 1 manual, and schematics did not show this resistor. I did not know these resistors (R201 - R212) even existed on my board. Even so, the combination of the 10k pullup resistor and the 74HC244 buffer chip did not do the job. The 10k was not strong enough of a pullup (10k is too high a value) to prevent the LEDs from randomly turning off when no jumpers or wires connect the buffers to other circuitry.
The version 1 manual did talk about the problem. It said, "Depending on the type of 74xx244 buffer chosen, the LED could behave randomly if the port is not driven properly. In that case it may easily switch state, switching on or off with the smallest of electronic changes, for example, when the board is simply touched." That was what I saw even with the 10k pullup resistor. The text says that you need to drive the port properly. If your project only needs one port, then the other eleven are not being driven at all. Is it proper operation to have to look at eleven LEDs flash on and off? Version 2 of the manual changes that information to: "The resistor on the right side of Figure 8 is a pull-up. If it were not there, the LED would turn off and on with the smallest of electronic changes, for example, when the board is simply touched. Turning the LED on when it is not being driven prevents this seemingly random behaviour and also serves as an indicator that your Gertboard is receiving power properly. Note that if the output jumper is installed but the ‘Raspi’ point is not driven, the random behaviour will return."
Even if the pullups worked and the LEDs connected to the unused buffers turned on, that to me, is not proper operation. If a circuit is not being used, the LED should be OFF. The manual says that the LEDs being on indicates "that your Gertboard is receiving power properly". Do we need up to 12 indicators that the board is under power?
There is another issue when no jumper or wire connects the input of a buffer to anything else. The buffer IC is a CMOS device. These devices are highly susceptible to destruction by static electricity. If the inputs are not connected to anything except to a connector pin, a pullup resistor is always connected to the input. This provides protection when the connector is not connected to anything else. Often an IC has multiple, identical, circuits. For example, the 74HC244, has eight buffers. If your circuit only needs 7 buffers, the eighth one will always have a pullup resistor (or, if you are the circuit designer, you get fired). For this purpose, a value of about 100k is acceptable. You probably have noticed that electronic circuit boards, like the Gertboard and the Raspberry Pi, are packed on foam and in one of those ubiquitous black bags. That foam and that bag are to prevent static electricity from reaching the board and blowing up ICs when the board is not connected into a circuit.
The Gertboard greatly exacerbates this static problem because of the way it is used. The human body is a great source of static electricity discharge. You, the user of the Gertboard, will be handling the board, connecting and disconnecting the Pi, and installing and removing jumpers, wires, and devices. The board does not have to be under power for damage to occur.
OK, there are 10k pullup resistors on the board - in fact there are 12 of them. However, there are TWENTY FOUR BUFFERS, not just 12. In the figure above, the input of the buffer on the bottom, the one that connects to the LED has the 10k pullup - so should be protected from static discharge. But, what about the upper buffer? According to the schematic it looks like the input of that buffer connects to the Raspberry Pi. That is only correct if you use a wire and connect that point to the Pi (make a connection between a J2 and a J3 pair of pins). If you don't, that input is not connected to anything except a connector pin, which is not connected to anything else. Don't forget that this diagram represents one of 12 circuits. Chances are that you will not always be using all 12 of these circuits in your projects.
My next blog post will tell what I did about this problem.

Friday, July 19, 2013

The Gertboard - What Is It?

Gertboard Connected to Raspberry Pi
The Gertboard extends the usefulness of the Pi by allowing a variety of devices to be connected to the Pi, and, thus be controlled by the Pi. It is made up of individual circuits that have connector pins at their inputs and outputs. These circuits are connected to each other, to the Pi's GPIO pins, or to external devices. Jumpers are used to connect adjacent connector pins, and wires, with a socket on each end are used for other connections. Please note the colored wires in the photo above.
The Gertboard is available from SparkFun for $53 (USD). Newark Electronics has it for $50. Adafruit does not seem to carry it.
As is usual with most things you buy for the Pi (and the Pi, itself) the Gertboard does not come with any documentation. Yes, it ships with a CD, but that is simply a marketing tool to sell ARM development software. There is, however, a very comprehensive user's manual that explains every circuit. All circuits have at least one test routine. The manual shows how to connect the circuits for each test and explains the test software. The test software, in C++ and Python must be downloaded to the Pi. The manual details how to get, and install that software. Even though the user's manual references the schematic diagram for the board, these schematics are not included in the manual. However, these schematics are available as a separate file. The best way to get both the user's manual and the schematics is from the SparkFun page. So click here.
Gertboard - Illustration from "Gertboard User Manual". I added "Proto Area" to the illustration
So what are the features of the Gertboard?
  • The Gertboard plugs onto the GPIO connector of the Pi. Because the Gertboard's GPIO bottom facing connector socket connects directly to the top facing pins of the Pi's connector, it forms a single, physically stable, unit consisting of the two devices (see note below).
  • Twelve buffers for inputs to the Pi and twelve buffers to drive outputs from the Pi. Input buffers protect the Pi from inputs like sensors while output buffers reduce the loading of the Pi by output devices (like LEDs).
  • 12 LEDs
  • 3 Momentary push button switches
  • 6 High Voltage/High Current Outputs (open collector drivers). Each of these circuits can drive half an amp at 50 volts
  • A fused motor controller. Uses the pulse width modulation (PWM) capabilities of the Pi to control the speed and turning direction of the motor. This circuit can drive 2A at 18V.
  • Two 8 bit digital to analog (D to A) circuits.
  • Two 10 bit analog to digital (A to D) circuits.
  • And best of all an Atmel ATmega328 microcontroller IC. This is the same microcontroller as used by Arduino boards. Gordon Henderson, of Drogon Systems has developed all of the methods and procedures to interface the microcontroller to the Pi. The instructions to obtain all of the software, including the Arduino IDE (Integrated Development Environment) are provided by Gordon. To write programs (in C++) on the Pi for the Atmega328, and to get those programs loaded in the Atmega328, you use the Arduino IDE running on the Pi. The Gertboard User Manual provides the link to Gordon's web page. The Arduino IDE provides many sample programs and C++ help to get you started.
  • Prototyping area (outlined in blue in the figure above) to wire in your own circuitry. You will see where I use this area in my next blog post.
I have version 2 of the Gertboard. As I mentioned above, the Gertboard and the Pi connect directly together. This is not true for version 1. Version 1 requires a ribbon cable to connect to the Pi. I believe only Version 2 is available now. Version 1 came as a kit requiring the purchaser to assemble and solder parts to the board. Version 2 cones completely assembled. Version 1 used thru-hole parts with all IC's in sockets. Version 2 uses mostly surface mounted parts. In version 2, most IC's are thru-hole but only one IC, the ATmega microcontroller is in a socket. The other ICs are soldered to the PC board.

Thursday, July 4, 2013

A Pi In The Fridge

I did find a practical use for the the temperature measurements using the Pi (see my past several blog posts). We thought the temperature in our refrigerator was a bit too high. To check it out, I put the Pi with the DS18B20 temperature sensors in the refrigerator. The Pi was powered by SparkFun's solar charger and battery back. The Pi was on a lower shelf while the cable sensor was in a glass of water on an upper shelf. The whole assembly was in the refrigerator for several hours. It all worked well at the temperature that got down to just under 40F (a little too warm for the food though).
Raspberry Pi on Lower Shelf of Refrigerator
The lower left corner of the switch (white square with the 4 printed on it) is pointing to the DS18B20 To-92 sensor. It's just a small black blob in the photo (not one of my best photographs. I didn't want to hold the refrigerator door open too long to get that perfect shot). The three pin connector for the DS18B20 cable sensor is just under the TO-92 sensor. I made that little connector to interface the three leads of the cable to the breadboard.
Probe In Glass of Water - Hunk of Cheese Holding Cable in Place