This week I am going to show you how to get up and running with the 3pi by Pololu. I will be going through all the steps needed to upload the line following program that is included from Pololu. Getting started with the 3pi isn’t too difficult, but there are a few applications and drivers that need to be installed.
Note: In this tutorial I will be using a PC running Vista. You can program the 3pi on a Mac running OSX or Linux, but it’s a different procedure. You can even program the 3pi through the Arduino IDE!
What you need:
- Pololu 3pi Robot – Available in the Maker Shed
- Orangutan USB Programmer – Available in the Maker Shed
- USB A to Mini-B cable – Available at most electronics stores
- (4) AAA batteries
- Electrical tape
- Computer running Vista or XP
Optional Items:
- 3pi Expansion Kit with Cutouts – Available in the Maker Shed
- 3pi Expansion Kit without Cutout – Available in the Maker Shed
Part 1: Setting up the 3pi
Unpack and add the 4 AAA batteries. You need to remove the LCD to insert (2) of the (4) batteries. Just carefully lift it up and it will come off easily.
Replace the LCD and press the power button. The 3pi comes with a demo program already installed. It goes over several different features of the 3pi.
Part 2: Downloading & installing custom programs
Start by downloading the Orangutan USB Programmer drivers. Follow the installation instructions. The installer takes care of everything.
Download and instal WinAVR. This is a set of free open-source tools for programming Atmel AVR series (or RISC) microprocessors. Follow the installation instructions.
Next, download Atmel’s free ARV Studio. This is the integrated development environment (IDE) that we will use to program the 3pi. Follow the installation instructions.
Finally download and install the Pololu C/C++ AVR Library. Extract all the files somewhere convenient.
Part 3: Installing the libraries
Inside new folder called “libpololu-avr” is a file called “libpololu.a”. Copy that file over to the “lib” subdirectory of the “avr” directory found inside the WinAVR folder. (C:WinAVR-20080610avrlib)
Note: Make sure you copy the “libpololu.a” file in thecorrect “lib” directory. It should go in C:WinAVR-20081205avrlib NOT C:WinAVR-20081205lib.
Next, copy the entire “pololu” folder into the “include” subdirectory of your “avr” directory. (C:WinAVR-20080610avrincludepololu)
Now you are all ready to start programming your 3pi.
Part 4: Uploading code
In the Pololu folder there is a subfolder called “examples”. Open that folder and you will find a line follower example program. Click on the “test” file in the “3pi-linefollower” folder and WinAVR should start loading.
To compile the program, click “Build” (F7) and check to see that the code is OK. If there are errors you will find them on the bottom of the screen. They will be highlighted with a red dot.
If everything compiles OK, it’s time to upload the file to the 3pi.
Connect your Orangutan programmer to the 3pi and press the power button.
Select “Program AVR” and click on “Connect”. Select “STK500 or AVRISP” and “Auto” AVR Studio should open a new window called “AVRISP in ISP mode with ATmega168”. In that window click on the “…” button in the “Flash” section. Select the “test.hex” file that can be found inside the demo line follow folder. Now you can click “Program in the “Flash” section and the code should upload to the 3pi.
Part 4: Making a course
Making a course is easy. Just use some electrical tape on a large piece of paper. Set the 3pi down on the line and press the power button. Now press the “B” button twice and watch the 3pi go!
ADVERTISEMENT