GoPiGo3 robot vehicle with a Rasp Pi core

Go Pi Go

© Lead Image © Pavel Romanchenko,

© Lead Image © Pavel Romanchenko,

Article from Issue 218/2019

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.

Figure 1: The fully built GoPiGo3 offers everything a robot car needs. With optional accessories, you can add sensors and actuators to the structure as desired.

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 in a browser. The web server running on the kit responds to this URL (Figure 2).

Figure 2: You program the robot in a web front end. The GoPiGo3 website takes you to the various programming environments and documentation.

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.

Figure 3: The first sample program in Bloxter: The GoPiGo3 changes its eye color according to readings from the proximity sensor.

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.

Figure 4: The Bloxter program instructs the GoPiGo3 to drive straight ahead until it encounters an obstacle. It then tries to avoid the obstacle and continue its journey.

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




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 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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • This Month's DVD

    This month we bring you CentOS 7 (64-bit), a community enterprise operating system based on Red Hat Enterprise Linux, and the Fedora 20 Robotics spin (32-bit).

  • Nao Humanoid Robot

    At the end of April, Aldebaran Robotics let their 57cm-long humanoid Nao robots loose on a human audience of mostly open source developers. The robots possess 25 degrees of freedom, a child’s gaze, and anthropomorphic interactions.

  • Free Software Projects

    Python inventor Guido van Rossum is known to have a good sense of humor and probably had a good laugh when he heard about the Guido van Robot project. If you are learning how to program, or would like to teach others, this software gives you a light-hearted introduction.

  • Programmable USB Hub

    The Programmable USB Hub promises to resolve common issues with USB reliability in the short term, making way for future open hardware testing and debugging.

  • Free Software Projects

    The Open PC helps the dream of free hardware come true, and robot simulations fire the imagination.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95