Subscribe to Blog via Email
Follow me on TwitterMy Tweets
With me traveling to Redwood City next week to visit HQ and then Oracle Open World the week after, I’m busy during many of my off hours preparing a new Raspberry Pi STEAM setup for a maker’s faire the beginning of October.
I’d heard that many were having challenges with installing different HATs on their new RPI 3, especially older ones like the Pibrella.
This is still one of my favorite accessories for my RPI due to the button, speaker and three LEDs, but also since I can hot swap jump wires without risk of shorting out the unit like when you’re using the direct GPIO on the RPI.
I have a great new setup for travel for my Raspberry Pi that has the newest 7in touchscreen and protective case, which opens on the back. Could I install my Pibrella with the constricted opening and the GPIO wires still powering the enhanced touchscreen card?
The Pibrella requires 26 of the pins to function and installation asks you to place the unit to the 1st pin. It has a mini USB connector for power, but can run off of the GPIO. The challenge is that the new 7inch touchscreen ALSO is powered by the RPI GPIO, connecting to pin 2, (5V) and 6, (Ground.)
When a competing configuration is found for GPIO, its important to inspect the GPIO map and see what is available:
Now using the above map, you’ll notice that pins 1, 2 and 3 are all power. The Pibrella ONLY needs one 5V power source, which means that installing it from the first pin may be best practice, but it’s not required. OK, so that means we can still use Pin 2 for the touchscreen. Now, if we move down the Pibrella one, that leaves 6 rows of pins free at the other end. The 6 pin, which is the second necessary pin for the touch screen to ground it, can be shifted to the 39 pin, which is another ground pin!
I then moved the GPIO pins for the touchscreen and installed the Pibrella to the RPI 3. It was a tight fit, but it did install:
The next thing was to test it all. Each of the GPIO connected match to the GPIO attached. These will have to all be tested to see if there are any mismatches between the board and the RPI. The Pibrella library that is installed is just functions that have been written to tell what pins correspond to what commands.
So I run a small test script:
import pibrella import time pibrella.light.red.on() time.sleep(2) pibrella.alarm.on() pibrella.light.red.off()
This script is to turn on the red light for 2 seconds, ring an alarm and then shut off the red light.
What happened? The amber light lit on and then off. No alarm- yep, may have my monitor working and power to the pibrella, but as suspected, the GPIO orientation is off for each of the LEDs, alarm and I expect, the GPIO connections on the board.
Now I could give up my pibrella….or the touchscreen, but what if I’m just plain stubborn and want both?
So the files I need to work with are in the distribution packages for Pibrella. I had to go to /usr/local/lib/python2.7
Now you may be wondering why this was in the Python 2.7 instead of the 3.4 distribution… RPI 3 still has the 2.7 python set as default. If you don’t change this, then this is where you go. I prefer RPI 3 and write my code per Python 3 standards, but I’m not surprised the Pibrella library installed here.
Inside this directory, under the dist-packages is the Pibrella directory and it’s just a matter of .py, (python) files. There is one called pins.py that I had to update to reflect the changes I made to my match my installation. Now, we can fun the red light script and it actually lights up the correct LED.
It appears the alarm and button are set up in a different set of code, so now I need to just locate the other python scripts for the alarm and such and get that corrected.
That doesn’t mean I can’t get motors and other devices working from the new setup….
Although the Raspberry Pi 3 is now available, many people are still interested in it’s cheaper, smaller version, the Raspberry Pi Zero. This version isn’t just smaller, it also requires a Wi-Fi dongle for internet access, (one of the new, great features on the 3 Model!) and one of my main reasons for not recommending it to newbies to the Raspberry Pi, (RPI) world, is that it doesn’t come with the GPIO pins pre-soldered.
GPIO, which stands for General Purpose Input and Output is an excellent feature on this single board computer, allowing an RPI to connect easily with sensors, motors and other external components. The original RPI came with a 26 pin GPIO setup, but since the Module B, it’s been a standard 40 pin GPIO that offers a myriad of project and hardware possibilities.
Now those that are seasoned RPI geeks will simply say to wrap wires around the appropriate GPIO connector or with jumper wires, just stick the connector through the hole-
Those that introduce RPI to those new to single board computers know that the quickest way to suffer a short out to one is by performing breadboard and other experiments that utilize the GPIO and we see the wrapping of wires and leaving more chance for wires for power, grounding and control to touch a penchant for human error. These errors leave us asking students to be prepared with a backup image of the software on hand to address the most common victim of a shorted out unit.
Now I could go into the dangers of GPIO, ampage current with a recommendation that all newbies start with an Ardruino or discuss the importance of transistors, but eliminating some of the risk by having the GPIO pin connectors makes sense.
Ardruinos are better at GPIO ampage handling, but they shouldn’t be confused with a single board computer and are limited in their application. The RPI and Arduino are both capable of sinking 50 ma through their GPIO pins, the difference being where you to acually sink 50ma, the RPI may very well be damaged, but the arduino will survive and doesn’t have an Operating System and software that may be seriously impacted.
Due to this, for those that may be intermediates, I recommend if you’re going to get the Raspberry Pi Zero, consider soldering the GPIO pins for it. It’s not difficult and there are a lot of videos that can teach you how to solder effectively.
A 60 watt 110V soldering gun with a couple of different soldering tips is all you need to do the work with just about any RPI project. Purchase the right kind of solder for the project you’re taking on. Note I have a picture of the solder I’m using below. Pins can be purchased from Radio Shack, MicroCenter and other “geek stores” or you can steal them from kits that can be purchased online, like this cobbler kit. The pins can be “broken” into the correct count to fit in the holes to be soldered and you’ll be soldering from the back side of the unit.
If the unit is in a case, please remove the case and ensure you remove any cables, micro SDCards, etc. that could get in the way or be in danger of harm by the soldering gun before you begin.
Set up your work area and I keep a piece of thick cardboard around to clean off any remnants of solder from my solder gun to keep it clean as I work. Add the correct number of pins and if you don’t have a single set of 40 pin addition you can add, work with one line at a time.
Once the first line of pins are added, turn the unit over and brace it so that the pins are straight. You don’t want them “leaning”, otherwise the pins could be soldered crooked and you could have challenges attaching units like a PiHat or other components that have configured GPIO attachments. I used the corner of my keyboard, as it was the right height and balanced it out nicely while I did the work. Make sure to use the right solder,- you can see what I used in the picture below:
Solder across the first line, taking care not to touch the actual Pi Zero with the soldering iron and once done with the first line, add the second line and solder it into place in the same way as you did the first:
Once finished, let it cool and check the connections. Are the pins tight and are they straight. If there is some angle to the pins, you can use the soldering iron to *carefully* loosen the solder and straighten them out some, but it’s better to be cautious and check it as you go to begin with.
Once it’s cooled and you’re satisfied with the pin placement, plug back in the Micro SDCard and if you had a case, put the RPI zero back into it. That’s all there is to it! You’re ready to create all kinds of fun projects with your RPI Zero and not worry so much about those pesky GPIO wires being exposed! Oh, yeah, still make a backup of your image using Win32 Image Writer….PLEASE!! 🙂