GoPiGo3 robot vehicle with a Rasp Pi core
Go Pi Go
The GoPiGo3 kit provides components and software for a small robot car with a Raspberry Pi brain.
The easiest way to learn programming is hands on. The GoPiGo3 robot kit [1], based on a Raspberry Pi, supports programming with the Bloxter graphical programming language, up to and including the development of complex applications with Python, Node.js, or C/C++.
The GoPiGo3 design makes a solid, robust impression (Figure 1). The basic frame comprises two Plexiglas plates screwed together with threaded bolts. The direct-drive motors are mounted on stable metal brackets. With a little skill, assembling the kit takes less than an hour. The manufacturer provides detailed instructions on their homepage [2] to make it easy to assemble the robots.
The power supply for the robot uses rechargeable batteries; two sets are necessary if you don't want to wait several hours for the batteries to recharge between programming sessions. To conserve battery power while programming the GoPiGo3, you can connect a USB power supply to the Rasp Pi.
A detailed manual [3] helps you set up the robot. After booting, the model creates an unencrypted WiFi network with the GoPiGo SSID, which you log into on your PC. Please note that you might lose access to the Internet as a result. Now enter the address http://bloxter.com in a browser. The web server running on the kit responds to this URL (Figure 2).
A simple menu under the Drive button lets you control the car remotely for the first function tests. The Learn button provides a variety of exercises to help you familiarize yourself with graphical programming in Bloxter [4], a simple graphical environment based on Scratch.
Under Code in Bloxter, you develop your own programs. With a little experience you will see which Bloxter functions are available in highlighted menu items. The individual commands are structured like pieces of a puzzle that you can arrange into a program by dragging and dropping into place. Only pieces that work together can be clicked together, so it's impossible to make a mistake in syntax. The examples in this article were created in Bloxter.
Alternatively, the editor under Code in Python lets you control the robot with a lower-level programming language. As with Bloxter, you run the programs by clicking the hardware Start button. The GoPiGo_Python_Examples
folder contains many examples that can be used as a basis for your own experiments. I use two of these programs to illustrate the programming in detail.
Proximity Sensor
In this example, the GoPiGo3 uses its proximity sensor to control "eye" color as a function of measured distance. The two LEDs on the top side of the board act as eyes. If the sensor detects a large distance in front of the robot, the eyes glow green. If the sensor detects an obstacle, the eyes become yellow. If space is cramped, red eyes signal danger.
Figure 3 shows the required Bloxter program. The first thing you notice is that you don't have to import any additional libraries. All the required functions are available by default. The individual function groups in the left sidebar differ in color: Light green stands for loops, orange for reading sensors, and red for actuators. The outer loop ensures that the robot executes the program infinitely. If necessary, you can interrupt an endless loop by clicking on Stop.
The first if
block in the loop checks whether the distance to the next obstacle is greater than 5
inches and switches the eyes to green if the result is positive. (If desired, the value output by the sensor can be converted to centimeters.) The constant number for the comparison can be found at the top of the Math functions list. If the sensor outputs a shorter distance, the next if
block decides whether the eyes should glow red or yellow. That is all it takes to convert the values measured by the proximity sensor to colors.
Avoiding Obstacles
To really bring the GoPiGo to life, you have to engage the motors to move the robot. The spectrum of possible algorithms for this programming task is enormous, but many roads lead to Rome. In the next example, I explain the basic functions of setting the GoPiGo3 into motion while avoiding complicated routines.
The program (Figure 4) starts with a while
loop that queries the proximity sensor. The robot moves forward until it encounters an obstacle (i.e., until the proximity sensor returns a value less than 5
cm). For your first driving attempts with the GoPiGo3, you should always set the speed to slow
. The robot is quite robust, but you should still make sure it doesn't go around a corner too fast or fall down stairs.
As soon as GoPiGo detects an obstacle, the program leaves the while
loop and starts a routine to dodge the obstacle: Like an evasive maneuver test (i.e., moose test), the robot turns 90 degrees to the left and moves 15 cm forward, turns 90 degrees to the right and moves 15 cm forward, and so on; the rest of the commands are self-explanatory. As soon as the robot has driven completely around the obstacle, it moves a little farther and then stops.
The robot is best driven on a smooth surface – but not too smooth – otherwise the tires will lose traction. Carpet is not a recommended substrate. Depending on the structure of the carpet, the support wheel can sink so far that it restricts the robot's mobility. You will notice that the robot no longer turns precisely (e.g., 60 degrees instead of 90 degrees) or that it moves forward at an uneven speed.
Hardware, Modules, and Software
The GoPiGo3 is available in different versions. The simplest is the GoPiGo3 Base Kit for $99 (CAN$132; UK£111, EUR107, excl. VAT) [5]. It includes the controller board, the chassis, the motors with encoders, the battery holder (without batteries), and a package with screws – more than you need for assembly. Even if you lose a screw, you should still be able to complete the robot.
The next stage, the GoPiGo3 Starter Kit for beginners ($200; CAN$ 263; UK£ 228, EUR239, excl. VAT) costs about twice as much [6]. The package contains all the components of the GoPiGo3 Base Kit, plus a Rasp Pi 3, additional servos, a proximity sensor, an SD card with DexterOS preinstalled, an 8GB USB stick, and a USB power supply for the Raspberry Pi.
The GoPiGo3 Starter Kit gives you all the components you need to start programming directly in Bloxter or Python. The free Raspbian for Robots download [7] lets you connect your robot to the Internet and program in C, Java, or Node.js. In addition to the different versions, you can purchase more sensors and accessories in the shop [8]. If you are not in the US, Dexter Industries has a number of distributors around the world [9].
Table 1 shows an overview of additional parts available individually, so you can assemble the appropriate modules for your own experiments. The various shops also offer various kits specially tailored for classroom situations.
Table 1
Accessories
>Component | Description |
---|---|
Light & Color Sensor |
Detects brightness and different colors |
Line Follower |
Lets the GoPiGo3 follow a line (black adhesive tape) on the floor |
Grove Infrared Receiver |
A receiver for IR remote control |
Infrared Remote |
IR remote control |
Loudness Sensor |
Lets the robot react to noises |
Grove Buzzer |
A simple buzzer |
Grove Button |
A button |
Speaker |
Speaker for the Raspberry Pi |
Grove LED (red, white, blue, green) |
Light-emitting diodes |
Servo Package |
A servomotor and mounting hardware |
IMU Sensor |
Detects motion, orientation, and position for building a balancing robot |
Temperature, Humidity, & Pressure Sensor |
Gathers environmental data |
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.