Programming Orangutans and the 3pi Robot from the Arduino Environment.pdf

(1909 KB) Pobierz
Pololu - Programming Orangutans and the 3pi Robot from the Arduino Environment
Programming Orangutans and the 3pi Robot from the Arduino Environment
© 2001–2009 Pololu Corporation
Page 1 of 53
 
301767362.011.png
Programming Orangutans and the 3pi Robot from the Arduino Environment
© 2001–2009 Pololu Corporation
1. Introduction
The Orangutan LV-168 attached to a 3-AA battery
holder.
Baby Orangutan B-48/168 with included header pins soldered in for breadboard
installation.
Arduino [http://www.arduino.cc/] is a popular, open-source prototyping platform that makes it easy for people with little
electronics experience to get into the world of microcontrollers and embedded programming. The Arduino environment
consists of an open-source integrated development environment (IDE) and compiler, software libraries, and programmable
hardware boards based on the powerful ATmega168 microcontroller. Because our Orangutan
Orangutan B-168 [http://www.pololu.com/catalog/product/1216] robot controllers use this same microcontroller, they have a
substantial degree of overlap with Arduinos. Our Orangutan robot controllers can therefore be an attractive alternative to
official Arduino hardware for those already familiar with the Arduino environment, and the environment can be a
beginner-friendly alternative to AVR Studio for those looking to get started with Orangutans.
Note: the Pololu 3pi robot [http://www.pololu.com/catalog/product/975] effectively has an Orangutan SV-168 as its
core, so this guide and the Orangutan Arduino libraries apply to the 3pi as well. For more information on the
The Orangutans and 3pi robot offer integrated hardware that Arduinos do not, such as on-board dual motor drivers. This
makes them well suited for applications involving control of small- to medium-sized robots. The Orangutan SV-168,
Orangutan LV-168, and 3pi robot also have integrated pushbuttons, a piezo buzzer, and a removable LCD, all of which are
additional features not found on official Arduinos.
With some minor changes to the Arduino software configuration files, it becomes possible to program our Orangutans and
3pi robot using the Arduino IDE and libraries. This guide will step you through the process of reconfiguring the Arduino
IDE, and it will provide a series of custom libraries that will make it easy for you to interface with all of the Orangutan’s/
3pi’s onboard hardware.
1. Introduction
Page 2 of 53
301767362.012.png 301767362.013.png 301767362.001.png 301767362.002.png 301767362.003.png
Programming Orangutans and the 3pi Robot from the Arduino Environment
© 2001–2009 Pololu Corporation
One key difference between standard Arduino boards and the Orangutan robot controllers is that most Arduinos come with
integrated USB-to-serial adapters, which allow you to connect them to your computer and program them through pre-
loaded bootloaders, while Orangutans lack integrated USB-to-serial adapters. As such, we recommend you program the
Orangutans or 3pi robot using an AVR ISP (referred to as ICSP in the Arduino world) programmer such as our
bootloader, you gain an extra 2 KB of program space (so you have the full 16 KB to work with rather than 14 KB). You
also avoid the bootloader delay when you power up or reset the board.
Pololu Orangutan USB Programmer with included cable
Note: This document applies only to the 3pi robot [http://www.pololu.com/catalog/product/975] and Orangutan
and Baby Orangutan B-168 [http://www.pololu.com/catalog/product/1216] robot controllers. For simplicity, the latter
three devices will be referred to from this point on as “Orangutans” , unless a distinction needs to be made
between specific Orangutan models. This document does not apply to the original
robot controllers, nor does it apply to the Orangutan X2 [http://www.pololu.com/catalog/product/738] robot controller.
1. Introduction
Page 3 of 53
301767362.004.png 301767362.005.png
Programming Orangutans and the 3pi Robot from the Arduino Environment
© 2001–2009 Pololu Corporation
2. ATmega168-Arduino Pin Mapping
In our standard Orangutan and 3pi documentation, we use the same convention that Atmel uses in its ATmega168
datasheet, referring to pins by their associated ports. For example, pin PD7 is pin 7 of port D. This convention is used
because each port is controlled by its own AVR registers, and the bits of these registers correspond to individual pins.
The Arduino insulates the user from this level of detail, referring to the I/O pins as digital pins 0 – 13 and analog inputs 0 –
7. Note that this terminology can be a bit misleading since analog inputs 0 – 5 can also be used as general purpose digital
I/O pins (referred to as digital pins 14 – 19).
exactly how the mega168 pins are mapped to Arduino pins. Note that this page shows a 28-pin DIP package chip while the
Orangutans carry smaller 32-pin MLF packages that contain two additional dedicated analog inputs: ADC6 and ADC7. In
the Arduino environment, these pins become arduino analog inputs 6 and 7, respectively. The following diagram comes
from the page linked above:
2.a. Orangutan SV-168 and LV-168 Pin Mappings
2. ATmega168-Arduino Pin Mapping
Page 4 of 53
 
301767362.006.png 301767362.007.png 301767362.008.png
Programming Orangutans and the 3pi Robot from the Arduino Environment
© 2001–2009 Pololu Corporation
Orangutan SV-168 bottom view with dimensions (Arduino pin
mapping).
Orangutan LV-168 bottom view with dimensions (Arduino pin
mapping).
2. ATmega168-Arduino Pin Mapping
Page 5 of 53
 
301767362.009.png 301767362.010.png
Zgłoś jeśli naruszono regulamin