This page describes my attempts to make a robot based on the Raspberry Pi 'brain' and using non-Lego parts.
The main parts of a simple Pi-based robot vehicle are:
Instead of purchasing each part separately and hoping they will work well together I decided to buy one of the many kits that are available - after a few more hours of research I narrowed the choice down to three:
I eventually chose the GoPiGo because it seems to have better electronics and software, has encoders for the wheels and compatibility with the Pi camera. It really is rather flimsy though - I cannot imagine using this robot in the classroom. My GoPiGo cost about 90 Euros from Generation Robots, not including the Pi, the Pi camera, the batteries, the battery charger, the micro SD card or the servo attachment. I regret not buying the servo attachment with the robot for it's important to learn how to work with this kind of motor as well as with DC motors like those included with the GoPiGo. The GoPiGo servo attachment, not shown in this photo but shown in the video below, is designed to rotate the camera, or the ultrasound sensor.
The above image shows where the battery pack would go (8 x AA batteries) but does not actually show the pack. Note the camera board standing vertically on the top level and the green Raspberry Pi board sitting above (and plugged into) the red motor controller board. These two boards are connected together via the General Purpose Input/Output (GPIO) pins of the Pi. The battery pack is supposed to be good for at least an hour of robot use. When working on the programming it's a good idea to power the Pi with a USB charger instead of the battery pack - this will power the Pi but not the motors or most sensors. Dexter Industries has a good set of instruction pages to get you started but be warned: it will probably take you several hours to figure everything out and set everything up, including perhaps one hour to physically assemble the robot.
Let's take a closer look at the motor controller board. Note that the ATMega microcontroller chip is the same one used in the Arduino microcontroller board.
Earlier, I pointed out that you don't want to have to connect up a keyboard, mouse and monitor to the Raspberry Pi on the robot each time you want to modify its program. You need to be able to modify it from another computer, connected to the Pi via WiFi. The simplest way of dong that is (on a Windows computer) to install a free program called Putty on the Windows machine and then communicate with Pi via a Secure SHell (SSH). But this will only give you a command line interface, as if you were using LXterminal on the Pi, and that is very limiting. The ideal would be to be able to see the Pi's normal GUI (desktop) on the Windows (or Linux, or other) machine, and that's possible using a Virtual Network Computing (VNC)connection. I believe this is easier to set up than a Virtual Private Network (VPN), which is similar. The most popular free choice for VNC communication seems to beTightVNC, which can be downloaded HERE. You need to run TightVNC Server on the Pi and TightVNC Viewer on the client machine. See HERE or HERE orHERE for help setting up TightVNC. It took me about an hour to get a TightVNC connection going between my Pi (version 2) and my Windows machine. Or so I thought. In the end I had tens of hours of frustration trying to get a reliable, stable VNC connection between the Pi and a couple of different computers. I had particularly bad problems using a Pi B+ as opposed to a B2, presumably because the B+ is so much slower. I also had much more trouble getting VNC to work with the Dexter Industries robot-ready SD card image than I did with a standard Raspian SD card image. Part of the problem is that the Dexter Industries website does a poor job explaining how to set up the VNC connection - it doesn't even make it clear that their image already includes a VNC server. Also, I was never able to get the raspberrypi.local address to work, as suggested on the DexterIndustries/GoPiGo website. I could only make the connection via a normal IP address. I was able, however, to instruct my router to give the GoPiGo a static IP address.
The TightVNC website recommends that additional free software called DFMirage mirror display driver be installed on the Windows client (viewer) to reduce the network load caused by running VNC - see HERE. Note that a version of TightVNC is also available for Android devices, with the name Remote Ripple - I haven't tried it yet...
By the way, another option for working remotely with the Pi might be to use theAdafruit webide. Adafruit describes this as 'by far the easiest way to run code on your Raspberry Pi'. I started trying to install this but before I could get it going I decided to uninstall it because I thought it might be conflicting in some way with my TightVNC installation and might explain why I was having so much trouble getting TightVNC working.
Problem: I wanted to be able to demonstrate my GoPiGo robot at my local computer club, Pobot, but that would mean working outside my home WiFi network so my TightVNC setup would no longer work. Worse, they don't even have a WiFi network at my club. Solution: I set up my Galaxy S4 phone as a WiFi hotspot and connected both the GoPiGo and my Windows laptop to that - it worked. Even better: it seems the S4 always give the GoPiGo the same IP address, even though I have not specifically set up a static IP address for the GoPiGo on my phone.
Problem: I wanted a simpler solution, bypassing the need to use my phone as a hotspot. Solution: I used Connectify on my Windows laptop to make my laptop become a hotspot, then connected the GoPiGo directly to that. (Connectify will interrupt your connection regularly unless you pay...)
Although I was able to get a basic GoPiGo program going I was not able yet to run the setup that streams video from the robot to the remote computer. The server did not launch correctly only the Pi. I'm still trying...
Come back to this page to see what I was able to do with my GoPiGo. Actually, working with the GoPiGo makes me appreciate even more how robust and satisfying it is to work with the Lego EV3 robot - what a shame there is no easy way to program the Lego EV3 system in Python. I tried using EV3dev / EV3 Python for this on more than one occasion but each time found the experience to be so frustrating that I gave up. I also considered using BrickPi for this but decided against it - see this page.