Hands on With Raspberry Pi
I was extremely fortunate to get access to a Raspberry Pi alpha board for the past couple of weeks. For those of you who haven’t already heard about it, the Raspberry Pi project was started to provide a tiny computer for kids to learn to program. It’s a credit card sized computer with a 700 MHz ARM 11 CPU, 256 MB RAM, USB ports to connect a keyboard and mouse and HDMI out so you can plug it in to a TV or monitor - that’s enough power to run Linux, a web browser etc. What’s truly revolutionary is the price point - all of this comes for $25. At that price, the potential for a full blown computer in lots of homebrew embedded electronics projects could be transformational and the initial release of board for pre-order sold out in a matter of hours.
So, what’s it like in practice? I had a chance to play with the Debian “squeeze” distribution - the official Fedora based image was not yet available. Getting the image written onto an SD card (I recommend 4 GB min as the default image leaves not a lot of empty space to install new software on a 2 GB card) was simple enough following these instructions. I decided that it would be fun to try to get my Neural Network controlled RC car working on Raspberry Pi. The Rasp Pi team are working on an add on ”Gertboard” for I/O but since those aren’t available yet and the device already has USB ports, connecting an Arduino UNO board should work great, right? Well, yes, but the debian image doesn’t come with kernel driver support or prebuilt modules for the usb/serial interface Arduino uses. It took quite a bit of digging to find all the info I needed to build these myself, but I’ve made prebuilt modules available at the end of this post if you’d like to repeat this yourself.
This also means that Rasp Pi can be a great development environment for anyone getting started with Arduino who doesn’t have an expensive PC to connect it to (e.g. at school).
Next step was to get the Rasp Pi driving the car. After installing the default Java JVM (open jdk), I got the camera streaming to the board - the screen shot you can see here is live video from an android phone for the self-driving car… woo!
Unfortunately, openjdk does not do JIT (just in time compilation) on ARM, so the performance of this set up was not going to get fast enough to drive the car (it managed about 1 frame per second without the neural network running). This was just the inspiration I needed to re-implement the project in C++! So, after a few further evenings’ work I was able to claim what I think is the world’s first self driving (RC) car powered by Raspberry Pi! The new C++ code can be found at github.com/dps/nnrccar/tree/master/cpp-driver.
Overall impressions? Rasp Pi is not going to let the throng of enthusiasts awaiting delivery down - it’s enchanting to have a self contained fully fledged linux box and I know I’d have saved my pocket money to buy one when I was a kid. The Debian image had by no means a non-techy friendly setup process, but Eben has been very clear that the software is expected to get much better now that the initial batch are being unleashed on an army of motivated geeks, and what I’ve read about the official Fedora Remix image so far sounds like it’s a big step in the right direction.
I hope some of you also have fun with Arduino on this platform:
Arduino on Rasp Pi
Install the Arduino software
sudo apt-get install arduino
Download the pre-built rasp pi / debian kernel modules I built.
Enable the modules
sudo insmod drivers/usb/class/cdc-acm sudo insmod drivers/usb/serial/usbserial sudo insmod drivers/usb/serial/ftdi_sio
Plug in your Arduino UNO.
You should now have a USB serial port for the board on