Setting up GoPiGo Robot
Setting up a GoPiGo Robot to work with Scratch
Purpose of this Post
GoPiGo is a robot kit designed to be used with a Raspberry Pi. It’s fun to assemble and operate, and it’s a great way to introduce kids and adults to a number of CS and hardware concepts. Raspberry Pi projects are a great, relatively inexpensive, way to learn a number of skills.
That said, there are some snags you should be aware of if you’re going to embark on a GoPiGo project, especially if you’re new to the Raspberry Pi world. My goal is to document some of those snags for you, in an attempt to make the process as easy as possible for beginners.
Prerequisites
- Raspberry Pi3
- Cost: $39.99 on Amazon
- I actually did this with an earlier model Raspberry Pi, but to do so you have to set up wifi through a dongle. The latest version of Raspberry Pi is not any more expensive than previous versions, and comes with wifi and bluetooth out of the box. You shouldn’t need a dongle.
- Caveat: I used an older version of the Raspberry Pi and did need a dongle. I have found on the GoPiGo forums multiple references to people using GoPiGo on Raspberry Pi3 without a dongle just fine. It should work, but if it doesn’t you might check there.
- It will actually cost you more to use any other Raspberry Pi version, unless you already have the wifi dongle.
- MicroUSB Power Supply for the Raspberry Pi3
- Cost: Varies up to $9.99
- Normally, for a Raspberry Pi project, I would suggest using linked-to $9.99 Canakit Power supply because it gives you the best possible power to your Pi without overloading it. If this were a project like a RetroPie gaming console, that would be a must. In this case, we are just using it while we aren’t using the AA battery power and during software and firmware updates. You can get away with using any MicroUSB power supply you just have lying around.
- GoPiGo Robot Base Kit purchased from Dexter Industries.
- Cost: $99.99 + tax
- This guide was written using the Base Kit. It should work on any of the kits, but your mileage may vary.
- SD Card with Raspbian for Robots purchased from Dexter Industries.
- Cost: $14.99 + tax
- Raspian for Robots is open source and free to use. It is possible to image your own SD card if you have one lying around, but if you’re going to purchase an SD card anyway, I suggest using the one that is already imaged the way you want. It is much less of a hassle, and this guide is not going to go into how to image your own SD card. If you decide that is something you want to do, you may find out more information, here
- 8 AA Batteries
- Cost: Approximately $2.00
- Ethernet Cable
- I would recommend at least 5 feet.
- Cost: Approximately $2.00
- A laptop with Windows, Mac or Linux-based operating system.
- In theory, you could do all of this with a PC, but since your child is actually going to be controlling the robot from this, you probably want something portable.
- Wifi.
- If you’re going to be using your robot in a classroom, or other place where wifi might not be readily available, see Step 4 below for more information.
- Philips head screw driver
- Cost: You have one of those already, right?
Total Cost: Approximately $170.00
Alternative Prerequisites
GoPiGo offers a Starter Kit, which comes with a everything you need purchase (excepting batteries), including a Raspberry Pi3. It also includes a Servo Package and an UltraSonic Sensor, which are not included in the Base Kit. This is a very good deal at $199.99, and I recommend getting it if you don’t already have a Raspberry Pi and power supply. My only complaint is that it includes a Wifi Dongle, which is entirely unnecessary for the Raspberry Pi3, as it has built-in wifi. They could have cut a few dollars off of the price. I’d recommend keeping the dongle for your other micro-computer projects. You never know when you’re going to need it for your old Raspberry Pi or Cubox.
Before Getting Started
This guide is going to assume you’re following the Getting Started guide here. My post will go into details where I think you might need them, or draw your attention to snags or things you might want to be aware of when following the Getting Started guide.
Step 1: Assemble your Robot
Snag: Knowing which kind of GoPiGo robot you have
You probably have a GoPiGo2 if you’re reading this post, but that isn’t necessarily the case. I had my GoPiGo for over a year before I assembled it, and I have a GoPiGo1. It is documented on their website how to tell the difference, but isn’t always obvious where to find that information. The best way to tell is based on the battery pack. If your battery pack has straps, then you’re using a GoPiGo2. If your GoPiGo kit doesn’t come with velcro straps, you’re using a GoPiGo1.
Here are the assembly instructions for the GoPiGo1.
Here are the assembly instructions for the GoPiGo2.
Step 2: SD Card
We are following option 1 in the guide. Using a Dexter Industries card. You will still want to expand the SD card as described in the guide, but this isn’t the step in the process where we are going to do that, so I’ll bring us back to it when it is time.
Step 3: Powering your Robot
Snag: What power to use when.
There are three instances when you’re going to be powering your robot, and each has different rules about the power supply.
- Initial setup and installing updates:
- DO NOT USE BATTERIES FOR THIS. DISCONNECT THE WIRES CONNECTING YOUR MOTORS WITH YOUR RED ARDUINO BOARD FOR THIS.
- You are going to want to power your Raspberry Pi with the power cord during this part. Doing anything else can cause serious problems. If your batteries don’t supply enough power/die, it could cause serious headaches. Also, these updates take a while. Just don’t trust the batteries for this part.
- Playing with the robot:
- Use batteries for this. It’s the only way you get to take advantage of your robot being truly wireless.
- Programming your robot:
- There are trade-offs here.
- Batteries can get expensive fast, though GoPiGo isn’t TOO bad of a power hog. Maybe rely on rechargeables if you decide to go the battery route.
- If you’re using Scratch with a kid, as this guide intends, you’re going to want the programmer to play around within her program while she is creating it. The only really safe way to do this is with the robot on the floor, untethered.
I suggest using batteries and working fully remote while programming the robot, at least at first and until your programmer starts making projects that take a long time and really cut into battery supply.
Useful Tip: Checking battery power.
Once you have finished setting up your robot, you can check the voltage being supplied by your batteries (should be above 10) by running the Control Panel application which appears as a shortcut on the Raspberry Pi desktop once you’ve run the update script we’ll discuss later.
Step 4: Connecting to your Robots
Snag: Cinch vs Normal Connection
Dexter Industries has two different MicroSD cards they sell. One has Raspbian for Robots, an operating system designed to be used with Raspberry Pi and robots, installed on it. The other is a version of Raspbian for Robots called Cinch. There are trade-offs on which of these you choose to use, and I have Raspbian for Robots as the default. I haven’t used Cinch, but if I do another GoPiGo project, I will try it out and update this post with any relevant details.
Raspbian for Robots
- Lets you connect to your Robot over wifi.
- Gives your robot access to the internet.
- Once your robot is set up on your wifi, it should automatically connect whenever you turn it on in range of that wifi.
- You don’t have to run your robot’s desktop through a web browser.
Cinch
- Lets you connect to your robot remotely without having to be online.
- Apparently, you WILL still need a wifi dongle, even on Raspberry Pi3.
- You have to buy Cinch separately from purchasing the Starter Kit, which already comes with a MicroSD card with Raspbian for Robots installed on it. If they offered a choice between Cinch and the regular Raspbian for Robots, or made Cinch the default card. Best I can tell, they even make you buy Cinch separately when you order the classroom kit, which is five GoPiGo Starter Kits.
- Every time you want to do an update, you have to tether to another computer.
- You run your robot through a web browser, which potentially introduces it’s own complications.
- You can easily use your robot from a tablet with Cinch.
- As long as your robot has battery power, and you are close by the robot with your controlling device (laptop/tablet) you don’t need to worry about being within range of a wifi signal. This expands the range of your robot considerably.
Snag: Desktop vs Ethernet
The Getting Started Guide outlines two options for connecting to your robot and setting up wifi. It acts like setting it up as a Desktop is more complicated and for more experienced people. I would argue that it is by far the easiest option if you have the things you need. You will need:
- A keyboard that connects through USB.
- A monitor that connects through HDMI. If you have a high-def tv, that will work as well. Just connect it to the HDMI port on the Raspberry Pi.
- You could probably get away without having a mouse if you had the other two, but it would be easier for people who aren’t familiar with navigating the Linux terminal. If you have those three things, save yourself some headache and use them.
Snag: Make sure you download the VNC to the right machine
There is a portion on downloading a VNC in the getting started guide immediately after it discusses how to connect to your Pi through ssh. Do not make the mistake of thinking this means you should download the VNC onto the Raspberry Pi. The VNC should be installed onto your laptop or tablet. There is a VNC Viewer application for iPhone and iPad. I haven’t tried it out yet, but I will update this post with information on how it works once I have.
Step 5: Using the GoPiGo for the First Time
DISCONNECT THE WIRES TO THE MOTORS ON YOUR ROBOT.
They say that clearly in the guide, but I wanted to repeat it here just so it’s clear. Please don’t run any software or firmware updates while the motors are connected. Also, this is the time you should be using the power supply…not the batteries.
Snag: I ran the update script but Scratch isn’t working
Yeah, this happened to me too. The reason is, if you look in the script output, that the filepath to the firmware update isn’t correct, or at least it wasn’t in the Dexter Industries card I got through Amazon.
If, for example, the Control Panel and basic_test_all.py
script are both working for you, but when you give commands in Scratch nothing happens to the robot, you need to run a firmware update on the GoPiGo.
To do that, you should first look in the GoPiGo
folder on your desktop. Inside that folder will be another Firmware
folder. That folder will contain a number of folders with the following format fw_ver_##
with ##
being a number. At the time of writing this post, the highest number is 16
, standing for version 1.6
. Substitute the numbers in the following command with the latest number accordingly.
Open a terminal and run the following command:
sudo ~/GoPiGo/Firmware/fw_ver_16/firmware_update_16.sh
This will take a while. Don’t interrupt it.
Once you finish, Scratch programs should be able to interact with the robot.