TLDR: Our Products Work with the Raspberry Pi 2
Too long, didn’t read the rest of the post: all of our boards and robots work with the Raspberry Pi 2 – just needs a simple update.
- If you are using Raspbian for Robots, upgrade the SD card image to the latest version of the Dexter Industries “Raspbian for Robots” image. You can download it here and follow step by step instructions here.
- If you are using your own image for the GoPiGo, the GrovePi, and the Arduberry, all you need to do is to run the Raspberry Pi Configuration program (raspi-config) and enable I2C (see below for more detailed instructions). You can also run the configuration scripts for the GoPiGo and the GrovePi.
Dexter Still Shipping B+
The Raspberry Pi V2 is awesome — it has great power, runs a lot faster, and opens the doors to some new, awesome hardware possibilities. The Raspberry Pi B+ requires a lot less power than the Raspberry Pi 2. Since we power mobile robotics with batteries, that’s a big deal. So, the Raspberry Pi 2 still makes more sense for most of our products.
So, for now, we’re still shipping the Raspberry Pi B+ and we will continue to ship our 2014 version of Raspbian for Robots. We will update our shipped SD cards in the near future with the new image that will work with any Raspberry Pi (A, B, B+ & 2) .
Your Raspberry Pi relies on the SD card image to know what to do. The Raspberry Pi Foundation has updated the image (they call Raspbian) for the new Raspberry Pi 2. Dexter Industires has our own version of Raspbian, called “Raspbian for Robots”.
We took the Dexter Industries Raspbian for Robots, which we last built in July ’14, and put it into the Raspberry Pi 2. Queue sad trombones and sad-faces.
We weren’t alone. Going though the Raspberry Pi Forums, we found that a lot of folks found issues with hardware and the Pi 2.
So we had to do some testing and make some updates. In the end, it’s all for the better. Here’s what we did.
Setup and Changes
We were as excited as everyone else to hear the news last week of the release of the Raspberry Pi 2. Soon after cooing over the upgraded speed and memory, we realized that we had to test the new Raspberry Pi 2. Although the footprint was very similar, a lot of the new hardware came with new software.
This required an update to our image. So we set out to upgrade Raspbian for Robots and make sure that all of our hardware and software worked with the new Raspberry Pi 2.
Our new version of Raspbian for Robots is Version 5.0.
How we did our update.
We wanted to avoid rebuilding our Raspbian for Robots image from the ground up. So we took our 2014 version of Raspbian for Robots and began to upgrade it so that it will work on the Raspberry Pi V2.
Helpful advice was given by the element14 community. We started with a Raspberry Pi Model B+ and we ran the following commands in bash:
sudo apt-get update sudo apt-get upgrade -y sudo apt-get dist-upgrade -y sudo rpi-update sudo apt-get install raspberrypi-ui-mods
We also removed VLC, to open up some extra space:
sudo apt-get purge vlc
And finally, we clean it all up, freeing up space on our image.
sudo apt-get clean
Thousands of packages were updated! This process can take some time. Get some coffee, write some e-mails, go for a walk. Once our update was complete, we shut the Pi down:
Healing the GPIO and I2C
We pulled the microSD card out of the Raspberry Pi B+ and moved it over to the Raspberry Pi 2. As soon as we ran our first python program, we ran into trouble:
pi@raspberrypi ~/Desktop/BrickPi_Python/Sensor_Examples $ sudo python LED_PWM.py Error importing RPi.GPIO. You need to run this with superuser privileges. Try sudo python "LED PWM.py" or sudo idle Traceback (most recent call last): File "LED_PWM.py", line 21, in <module> GPIO.setmode(GPIO.BOARD) NameError: name 'GPIO' is not defined
GPIO was not working right! This could be disaster for the Raspberry Pi 2.
We found Adafruit’s handy tutorial on repairing the GPIO functions for Python. There has been a lot of discussion about this: GPIO was not ready as soon as the new Raspbian image was. There were a few discussions in the forums on this, that were interesting and helpful.
We started by updating the python serial installation:
sudo apt-get install python-dev sudo pip install -U RPi.GPIO sudo apt-get install raspberrypi-ui-mods sudo apt-get autoremove sudo reboot
Now we just needed to enable I2C . . .
First, we added “dtparam=i2c_arm=on” to our “config.txt” file.
Then, select “Advanced Options”, then “A7 I2C” then select “Yes”.
Just to check, we ran i2cdetect to make sure that a device was recognized
sudo i2cdetect -y 1
and saw a response. Later we found out these two steps were probably redundant, we only had to make the change using raspi-config.
Updating BrickPi C Files
If you’re a fan of C and the BrickPi, We took some time rewrite the BrickPi C files. This was long overdue. The previous version of the BrickPi_C relied on wiringPi, which we had to customize to run on 500,000 baud. No more! We updated the files to run on termios. You can check out the details of the most recent changes in BrickPi.h here.
If you’re intimidated by C on the Raspberry Pi or gcc, give it a look: we added some extra documentation that should make compiling and running the programs a lot more straightforward.
Just to make sure everything worked in practice, we ran a bunch of tests. We ran tests with both the Raspberry Pi 2, and the Model B+.
- Tested: GrovePi + Pi2 – Works!
- Tested: GoPiGo + Pi2 – Works!
- Tested: GoPiGo + Pi B+ – Works!
- Tested: GrovePi + Pi B+ – Works!
- Tested: Arduberry + Pi2 – Works!
- Tested: BrickPi + Pi2 – Works!
- Tested: BrickPi + C + Pi2 – Works!
- Tested: Arduberry + Pi B+ – Works!
- Tested: BrickPi + Pi B+ – Works!
- Tested: BrickPi + C + Pi B+ – Works!
For those of you wanting to use the Raspberry Pi 2 — the GoPiGo, BrickPi, Arduberry, and GrovePi are all ready. You will need to make a few updates and you will need to enable I2C using “raspi-config”. You should also, as always, update the Github repositories to make sure you have the latest code.
For everyone wanting to use the Raspbian for Robots distribution, we have an updated version here on Sourceforge. We’ll have something up on Google Docs shortly. As of February 15, this is in beta. We will probably update the image again as we get feedback.
For the time being, we’ll keep the Raspberry Pi B+ in stock, and shipping with our Starter Kits. While the Pi2 has some awesome processing power, it slurps down a lot of power.
Thoughts? Let us know below!
Problems? Report em!