| This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (September 2016)|
Reason: Seems a lot like advertising; much second person
|This article documents something which is not associated with Scratch, the Lifelong Kindergarten Group, or the Massachusetts Institute of Technology.|
|This page has links to sites outside of the Scratch website and Wikipedia. Always remember to stay safe when using the Internet, since we can't guarantee the safety of other sites.|
The Dexter Industries GoPiGo is a robot built on the Raspberry Pi. The GoPiGo can be programmed using the native Scratch installed on the Raspberry Pi. You can write programs that move the robot, control LEDs, and read sensors connected to the robot using Scratch.
The GoPiGo can be used with the Raspberry Pi A, A+, B, B+, 2 and 3!
- 1 Features
- 2 Setting Up Scratch on the GoPiGo
- 3 Starting Scratch on the Raspberry Pi
- 4 Controlling Motors with Scratch on the GoPiGo
- 5 GoPiGo Broadcast Events
- 6 Reading Sensors with Scratch on the GoPiGo
- 7 Buying
- 8 External Links
- Works with the Raspberry Pi Model A, B, and B+, 2 and 3.
- Powered by 8 AA batteries.
- Kit takes less than 20 minutes to assemble, requires no soldering, just a screwdriver.
- Works with many different sensors such as a light sensor, ultrasonic sensor, sound sensor, and line follower.
- Has two programmable red LEDs.
Setting Up Scratch on the GoPiGo
There are three methods for setting up Scratch on the GoPiGo.
- You can purchase Rasbpian for Robots, a pre-installed SD card SD card with all the required software ready to go.
- You can download Rasbpian for Robots here and install it on an SD Card using the directions found here. You should use an SD Card that is at least 4 GB.
- You can install it yourself on your own version of Raspbian (Wheezy or Jessie). Installation requires some knowledge of Python and running Python scripts in the Linux environment. You can find directions to do this here.
Starting Scratch on the Raspberry Pi
Start the Scratch for Robots communicator. Double click the “Scratch” icon to start the program which handles all communications between the GoPiGo and Scratch. This will be located on your Desktop.
Writing your First Program in Scratch
You can find a video on how to write your first program for the Raspberry Pi Robot GoPiGo in Scratch here.
Scratch for Robots
Two windows will open up for you simultaneously.
- The Scratch Controller is the black Terminal window, with white text. It's very important NOT to close that window! This is the communication hub between Scratch and the robot. GoPiGo depends on that window!
- The second window is the Scratch for Robots window. Select the GoPiGo option if it's not already there. The robot should be displayed in the picture.
Open an Example Project
In the Scratch for Robots window, click the Open Examples button. This will open the folder containing all the provided examples.
Double click a Scratch program in the directory, or double click any Scratch program you have saved, to launch the Scratch application itself
Start Programming Your Own Project
In the Scratch for Robots window, click the Start Programming button.
Whether you decided to take a look at the Dexter projects, or to jump in right away, you will get the Scratch Robot Selector window. Select the GoPiGo in the dropdown menu, and press “Start Programming”.
You will get a warning that all the Scratch programs running will be closed. You can only run one Scratch program at a time.
After clicking the Ok button, you will get into Scratch itself, either with a blank project to start your own, or with one of the provided examples. You will see an alert that communications have started. Click “Ok” and begin!
Controlling Motors with Scratch on the GoPiGo
The Raspberry Pi controls the GoPiGo robot using Broadcast commands.
To see how to control motors on the GoPiGo, open the GoPiGo_Basic_Tests example program. Press the Green Flag on the top right corner to start the program. To control the GoPiGo, press:
- Up arrow– move forward
- Down arrow– move back
- Left arrow– turn left
- Right arrow– turn right
- w-Increase speed
- s-Decrease speed
- o & p – control left LED
- k & l – control right LED
- Space– stop
Stop the program once you are done by pressing the stop sign.
GoPiGo Broadcast Events
The following Broadcast events are supported by GoPiGo:
- FORWARD : sets both motors to forward
- BACKWARD : sets both motors to backward
- LEFT : sets the left motor to forward, the right motor stays idle
- RIGHT : sets the right motor to forward, the left motor stays idle
- LEDL <int> : sets the left LED to a value between 0 and 255. 0 is off, 255 is full intensity
- LEDR <int> : sets the right LED to a value between 0 and 255. 0 is off, 255 is full intensity
- INCREASE SPEED : sets both motors to a faster speed, until a maximum is reached. At that point, INCREASE SPEED will have no effect.
- DECREASE SPEED : sets both motors to a lower speed, until they reach a full stop.
- STOP : stops both motors, does not turn the LEDs off.
To interact with the Scratch program, there is a Python program running in the background (GoPiGoScratch.py). This program catches the commands from the Scratch interface and runs a command on the GoPiGo. This program is automatically launched by the Scratch icon in Raspbian for Robots.
You can edit it to add your own broadcast commands
Reading Sensors with Scratch on the GoPiGo
The GoPiGo supports GrovePi sensors. There are four ports on the board, one digital, one analog, one serial, and one I2C.
Standard sensors are as follows:
- light sensor
- sound sensor
- line follower
Ask a parent/guardian before you buy a GoPiGo robot.
- You can purchase individual GoPigo from the Dexter Industries website here.
- You can purchase a classroom package of GoPiGo from the Dexter Industries website here.