Arexx AAR-04 User manual

- 1 -
AAR
©AREXX - The Netherlands V062012
MANUAL: AAR-04
AREXX ARDUINO ROBOT

- 2 -
NOTICE!
AAR is a trademarks of AREXX, The Netherlands and JAMA, Taiwan.
AREXX and JAMA are registered trademarks
All rights reserved.
Reprinting any of this instruction manual without our permission is prohibited.
The specifications, form, and contents of this product are subject to change without prior
Technical help:
WWW.AREXX.COM
WWW.ROBOTERNETZ.DE
Manufacturer:
AREXX Engineering
JAMA Oriental
European Importer:
AREXX Engineering
ZWOLLE Holland
© AREXX Holland and JAMA Taiwan
© English translation: AREXX - The Netherlands
1. PRODUCT DESCRIPTION AAR
1.1 The ARDUINO Robotics Family 3
1.2 Specifications 3
2. ARDUINO General Description 5
3. AREXX ARDUINO ROBOT 10
3.1. Blockdiagram 10
3.2. AAR hardware 11
3.2. ARDUINO Software 12
4. The AREXX ARDUINO ROBOT (AAR) 13
4.1. Download and installation of the software 13
4.2. The Arduino language 13
4.3. Installation of a USB-driver 13
4.4. AAR Hardware 14
4.4.1. Installing the battery-compartment 14
4.5. ARDUINO Software 15
4.5.1. Programming with Arduino Programs. 15
4.5.2. Selecting an Arduino Program 15
4.5.3. Selecting the correct COM-port 16
4.5.4. Program transfers to the Arduino Robot 17
6. Background-information to the H-Bridge circuits 18
7. Odometry 21
8. Programming a Boot-loader 24
9. APPENDIX 25
9.1 Parts List 26
9.2 Main Board - Top View 28
9.3 Main Board - Bottom View 29
9.4 Schematics AAR 30
Contents

- 3 -
1. PRODUCT DESCRIPTION AAR
1.1. The ARDUINO Robotics Family
Arduino is an open source-Platform for developing of electronic
prototypes, which provides us with a microcontroller including all
peripheral interfaces and the required software.
The Arduino-concept has been designed to learn modern electronics
for robotics, software control and sensors in the simplest possible
way.
As a successor for the ASURO-robot, which has been programmed
in C-language we now designed the AREXX Arduino robot. The new
robot resembles its predecessor ASURO, but in combination with an
„open source“- programming language Arduino programming the
system will be much easier.
1.2. Specications:
Motors 2 DC-motors (3 Volt)
Processor-type ATmega328P
Programming language ARDUINO
Supply voltage 4 x AAA-type batteries
4,8 - 6 Volts
Supply current Min. 10 mA
Max. 600 mA
Communication USB-plug
Extensions ASURO-extensions are compatible
Height 40 mm
Width 120 mm
Depth 180 mm

- 4 -
1.3. Precautions
1. Attention! You must read this manual before supplying power to
any of the terminals! Incorrect connections may damage the
hardware.
2. Attention! Please check the pin function diagram
carefullyBe careful in wiring the circuitry. Incorrect
connections may damage the modules. Respect the correct
power supply’s polarity. A reversed power supply may damage
the hardware.
3. Attention! Don’t use power supply with voltages beyond the
rated voltages! Use stabilized and ltered power supplies to avoid
voltage and spikes.
4. Attention! The board does not provide any waterproof or
wet proof protection. Please use and save the system in
dry environment.
5. Attention! Avoid short circuits at any metallic surface and
do not stress the printed circuit board or the plugs by
excessive forces or weights.
6. Attention! Be careful to avoid ESD (see prevention
measures, precautions and descriptions at
Wikipedia’s Electro-Statical Discharges).
1.4. General Precautions
* When you open the parts the return right will be disposed
* Read before you start assembly the instruction manual
* Be careful with tools
* Keep this product out of reach of children and do not build this kit
when children are in the neighbourhood, the tools and parts are
dangerous for children
* Check the polarity of the batteries
* Keep the batteries dry, when the ASURO gets wet remove the
batteries and let the AAR dry for some time
* Remove the batteries when you are not using the robot for a
longer period

- 5 -
2. ARDUINO General Description
2.1. Who or what is ARDUINO?
Arduino is an open source- single board microcontroller, which pro-
vides an easy access to programming, microcontrollers and project-
platforms for interactive objects for artists, designer, hobbyists and
others.
The Arduino-platform has been based on an Atmel’s ATmega168 or
ATmega328 microcontroller. The system provides users with digital
I/O-ports and analog input channels, which allow the Arduino-sy-
stem to receive and respond to signals from the environment.
The market supplies us with several Arduino-boards such as Arduino
Uno, Arduino LilyPad and Arduino Mega 2560. Each Arduino-board
has been designed for specied purposes and users obviously may
choose an ideal Arduino-assembly for almost any project.
For example input signals may be delivered by switches, light sen-
sors, speed and acceleration sensors, proximity sensors and tem-
perature sensors. Additionally commands will be allowed from any
web-sources. Output-signals will be used to control motors, pumps
and screen displays.
The system has been equipped with a compiler for a standardized
programming language and a boot-loader. The programming lan-
guage has been based on Wiring- language, which corresponds to
C++.
Originally the Arduino project started 2005 in Ivrea, Italy. The con-
cept aimed to support students in projects, in which the prototyping
should be cheaper and more efcient as in most standard methods.
The developer group under Massimo Banzi and David Cuartielles
decided to name the project after a historical character named
‘Arduin of Ivrea’. “Arduino” is the Italian version of the name,
meaning “strong friend”.
The English version of the name is “Hardwin”.

- 6 -
2.2 Microcontrollers!
2.2.1. Applications
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small
computer on a single integrated circuit containing a processor core,
memory, and programmable input/output peripherals. Program
memory and a small amount of data memory (RAM) is also often
included on chip.
Microcontrollers are used in automatically controlled products and
devices, such as automobile engine control systems, implanta-
ble medical devices, remote controls, ofce machines, appliances,
power tools, and toys. By reducing the size and cost compared to a
design that uses a separate microprocessor, memory, and input/out-
put devices, microcontrollers make it economical to digitally control
even more devices and processes.
A typical home in a developed country is likely to have four general-
purpose microprocessors and three dozen microcontrollers. A typical
mid-range automobile has as many as 30 or more microcontrollers.
They can also be found in many electrical device such as washing
machines, microwave ovens, and telephones.

- 7 -
2.3. Power Consumption and Speed
Some microcontrollers may operate at clock rate frequencies as
low as 4 kHz, for low power consumption (milliwatts or micro-
watts). They will generally have the ability to retain functionality
while waiting for an event such as a button press or other interrupt;
power consumption while sleeping (CPU clock and most peripherals
off) may be just nanowatts, making many of them well suited for
long lasting battery applications. Other microcontrollers may serve
performance-critical roles, where they may need to act more like a
digital signal processor (DSP), with higher clock speeds and power
consumption.
The Arduino system applies a powerful Atmel ATmega328P single-
chip, providing an 8-bit microcontroller at 16 MHz with 32K bytes
In-system programmable ash. The power supply voltage has been
designed quite versatile in the range DC7-12V, providing stabilized
and protected operating conditions for the chip and isolated power
lines up to 2A for motor circuitry.
2.4 Microcontroller Programs
Microcontroller programs must t in the available on-chip program
memory, since it would be costly to provide a system with exter-
nal, expandable, memory. Compilers and assemblers are used to
convert high-level language and assembler language codes into a
compact machine code for storage in the microcontroller’s memory.
Depending on the device, the program memory may be permanent,
read-only memory that can only be programmed at the factory, or
program memory may be eld-alterable ash or erasable read-only
memory.

- 8 -
Microcontrollers were originally programmed only in assembly
language, but various high-level programming languages are now
also in common use to target microcontrollers. These languages
are either designed specially for the purpose, or versions of general
purpose languages such as the C programming language. Microcon-
troller vendors often make tools freely available to make it easier to
adopt their hardware.
The Arduino system provides us with approximately 32K bytes of
ash-memory for sketches programs, which may be programmed in
C programming language.
2.5. Interface Architecture
Microcontrollers usually contain from several to dozens of general
purpose input/output pins (GPIO). GPIO pins are software con-
gurable to either an input or an output state. When GPIO pins are
congured to an input state, they are often used to read sensors or
external signals. Congured to the output state, GPIO pins can drive
external devices such as LEDs or motors.
Many embedded systems need to read sensors that produce analog
signals. This is the purpose of the analog-to-digital converter (ADC).
Since processors are built to interpret and process digital data, i.e.
1s and 0s, they are not able to do anything with the analog signals
that may be sent to it by a device. So the analog to digital converter
is used to convert the incoming data into a form that the proces-
sor can recognize. A less common feature on some microcontrollers
is a digital-to-analog converter (DAC) that allows the processor to
output analog signals or voltage levels.

- 9 -
In addition to the converters, many embedded microprocessors in-
clude a variety of timers as well. One of the most common types of
timers is the Programmable Interval Timer (PIT). A PIT just counts
down from some value to zero. Once it reaches zero, it sends an in-
terrupt to the processor indicating that it has nished counting. This
is useful for devices such as thermostats, which periodically test the
temperature around them to see if they need to turn the air condi-
tioner on, the heater on, etc.
Universal Asynchronous Receiver/Transmitter (UART) block makes
it possible to receive and transmit data over a serial line with very
little load on the CPU. Dedicated on-chip hardware also often inclu-
des capabilities to communicate with other devices (chips) in digital
formats such as I2C and Serial Peripheral Interface (SPI).
The Arduino system provides us with 14 digital I/O-lines, 7 analog
I/O-lines.

- 10 -
3. AREXX ARDUINO ROBOT
3.1 ARDUINO ROBOT Block diagram
1. Connector plug for the battery compartment. (Be careful to check for the correct
polarity!)
2. On/Off-Switch for the Robot.
3. Status-LED: signaling that the robot is being supplied from the power supply.
4. In case you are using rechargeable batteries you may interconnect this dual plug,
which will supply the robot with the correct supply voltage
5. USB-connector to program the robot with the help of the Arduino-Software.
6. Reset-button: to be used to manually reset the robot.
7. ISP-connector, which may allow you to install another bootloader program.
8. LED 14: this LED provides free access for all programming and will blink if the
bootloader is (re-)started.
9. Line-follower: This module provides free access for programming and allows the
robot to follow lines.
10. Wheel-sensor left: this module generates pulses proportionally to the rotation of
the left wheel.
11. Wheel-sensor right: this module generates pulses proportionally to the rotation
of the right wheel.
12. Status LEDs for the left-sided motor: These LEDs indicate the motor’s forward,
respectively backward rotation.
13. Status LEDs for the right-sided motor: These LEDs indicate the motor’s forward,
respectively backward rotation.
14. Connector for the extension board, in which for example an APC220 wireless module
or a Snake Vision-module may be installed and connected to the Arduino-System.
15. Status LEDs for the RS232 communication interface.
16. Status LED 2: freely accessible LED for programming.
17. Status LEDs for USB data-communication.
18. Motor-controller
Fig. :AAR PCB

- 11 -
3.2 Background-information for the AAR
The front-side provides a USB-interface equipped with an FT232 IC.
This chip transforms the USB-signal into a RS232 UART-signal, which
may be processed by the ATMEGA328P Processor (located at right
side of the front position).
At the opposite side we positioned the ON/OFF-switch including a
JP3-connector for the supply-connection and the motor-controller
IC2. The back-side of the printed circuit board (PCB) has been chosen
to locate both engines and the wheel-sensors.
The wheel-sensors are using photo-eyes. The cogwheels have been
equipped with four holes in a 90°-position pattern. As soon as the
light passes a hole and hits a sensor the wheel sensor will send a
trigger-pulse for this corresponding wheel to the processor. Addition-
ally the electronic circuits switch on LED16 respectively LED17. The
trigger pulses allow us to have an accurate overview of the wheel-
speed for each of the rear wheels.
At the front-side we located the connectors for extension boards and
at the bottom-side of the PCB we will nd the sensors for the line-
follower circuit.
The line-follower uses an LED to send a beam of light to the bottom
area. Alongside of the LED two infrared sensors have been positioned
to monitor the reected light from the bottom. Additionally the PCB
provides us with the other components (LEDs, resistors and capaci-
tors) to complete the line-follower to a working module.
The robot uses an Arduino-board, which may be compared to the
Arduino Duemilanove board. The ATMEGA328P micro-controller is the
system’s core, which provides us with 14 digital I/O-ports, in which
six ports are congurable as Pulse-Width-Modulated (PWM-) output
channels. Additionally the robot has been congured with 6 analog
input channels, a 16MHz crystal oscillator and a USB- connector for
programming and control. The list may be completed with an ISP-
connector, enabling experienced hobbyists to program their own
boot-loader program.
The robot has been designed for a 5V-supply voltage and may also
be satised with the supply current from the USB-plug. This option is
quite comfortable for testing and programming.
Rather comfortable in this robotic concept are the connector plugs,
which allow you to insert your own extension modules or the AREXX-
extension modules from the ASURO-series.

- 12 -
3.3 BACKGROUND-INFORMATION FOR THE
ARDUINO SOFTWARE
Arduino Software belongs to the Open Source-category and is uni-
versally available to all, including the source codes for the program-
ming platform.
The Arduino programming platform has been equipped with a text-
editor, a message window and a text-console. The programming
platform may directly contact the AAR for communication and allows
us to easily transfer programs into the processor.
Programs, which have been written in Arduino-language, are named
„sketches”. A normal text-editor is used for developing and editing
these programs. The “sketch”-les will be stored at your PC’s hard
disc. Sketches are identiable by their le-extension „.ino“.
Saving-actions the sketch-les are reported in the message-window,
which also includes detected errors in the source-code. The right-
sided bottom of the window displays the currently active Arduino-
Board and the serial interface .
The basic Arduino-concept supplies us with libraries lled with extra
functionaility. A library denes a number of predened functions,
which for recurrent programming sections may be reused at no ex-
tra cost for development.
Basically an Arduino-program may be structured in three sections:
• structure,
• denitions (for variables respectively constants) and
• functions.
An Arduino-structure consists of a setup and a loop-function. The
setup is used to initialize variables, pin-denitions („Pin-Modes“) and
libraries-denitions.
The „Loop“-function will be repeated in an endless loop, which al-
lows the program to react permanently ad lib, until the system is
switched off.
The program uses „variable“-denitions to store and handle a pro-
gram’s modiable data whereas constants are used to dene xed
values such as pin-denitions for input- or output-functionality and
to dene xed voltage levels at pin-connections.

- 13 -
4. Getting Started
4.1. Download and installation of Arduino’s Software
Install the Arduino software (version 1) from the CD we are sure
this will work. Later you also can go to the ARDUINO website and
download the latest version from this site.
IMPORTANT:
using different versions of the ARDUINO Software and different
version of the application software may give some problems.
Somtimes with a new ARDUINO softtware update you have to
modify your application software otherwise it wil not work!
4.2. Arduino’s language
The grammar of Arduino’s language has been documented in the
ofcial Arduino website. Learn to understand the specic language’s
characteristics to the level you need.
4.3 Installation of an USB-driver
When you connect the board, Windows should initiate the driver in-
stallation process (if you haven’t used the computer with an Arduino
board before). On Windows Vista or higher, the driver should be
automatically downloaded and installed.
Select the serial device of the Arduino board from the Tools > Serial
Port menu. This is likely to be COM3 or higher (COM1 and COM2 are
usually reserved for hardware serial ports).
To nd out, you can disconnect your Arduino board and re-open the
menu; the entry that disappears should be the Arduino board.
Reconnect the board and select that serial port.

- 14 -
4.4. AAR hardware
4.4.1. Installing the batteries
The robot has been designed for a power supply lled with four 1,5V
AAA-cells. If you prefer to use rechargeable batteries the jumper JP4
should be installed as a bridge to prepare the system for a lower
voltage of the rechargeable batteries (see g. 1, number 4).
ATTENTION!
Installing the connecting jumper JP4 will disable the polarity
check using the rectier diode. Errors in power connections
with installed jumper JP4 might seriously damage the robot.
Connect the battery compartment as shown in the gure (g. 2)
Fig. 2:
Battery
connection
Now you may switch on the robot by activating the ON/OFF-switch.
Located directly besides the switch the power LED (LED5) will be
illuminated.

- 15 -
4.5 ARDUINO software
4.5.1 Programming the Robot with Arduino Programs.
Connect the robot by USB-cable to your PC.
As soon as the robot has been connected to an USB-port the Ar-
duino-system does not really need an extra battery or other power
supply. Instead the USB-connection to the PC will provide the re-
quired power supply.
ATTENTION:
The robot will always be activated as soon as the sy-
stem has been connected to the PC. The ON/OFF power
switch and LED5 will only be active in the case of bat-
tery powered operation.
Now you may open the Arduino Software (see g. 3a).
Fig. 3a Arduino software Fig. 3b Opening Blink program
4.5.2 Selecting an Arduino Program
We will start by loading a simple sample program named
„blink“ into the robot. The program will command the robot to
repeatedly ash LED1.
Load the program by searching and clicking the program in Ar-
duino’s software at the menu-entry
File>Examples>1. Basics>Blink (see g. 3b), which will display the
following messages at the platform’s window (g. 4a).

- 16 -
Fig. 4a Program Blink Fig. 4b Select Board
At this stage we will have to select the correct Arduino-board at the
menu-entryTools>Board> Arduino Duemilanove or Nano w/Atme-
ga328 (see g. 4b)
4.5.3 Select Compoort
The next step denes the correct COM-port for the Arduino-interface.
The correct COM-interface (or COM-port) for the robot is COM 12.
In order to select the COM-interface please open the menu-entry:
Tools>Serial Port>COM 12.
(see g. 5)
Fig. 5 Selecting the correct
Com-Port

- 17 -
4.5.4.Program transfers from the PC to the Arduino Robot
Please click the button, which has been marked with a red arrow (or
alternatively follow the menu-entry „File>Uploading to I/O board“)
to transfer the selected program to the connected Arduino-robot
(see fig. 6a).
The status window reports the compilation process of the program
and as soon as the program successfully has completed the compi-
lation the system will start the upload to the robot.
At the end of the upload the status window reports: „Done upload-
ing“ (See fig. 6b).
Fig. 6a Uploading softwaren Fig. 6b Ready with the upload
At this stage you might remove the USB-cable to disconnect
the robot from the PC, connect the battery-compartment or
power supply and start the robot.
For further information and downloads we invite you to visit one of
the forums at the websites:
www.arexx.com --> Forum
www.roboternetz.de --> Forum

- 18 -
5. Background-information to the H-Bridge
circuits
A H-bridge is an electronic circuit which allows us to reverse the
polarity of a device (such as a DC-motor) by controlling four switches.
These H-bridges will often be found in robotics to control a motor
rotation in two opposite directions.
Modern systems use integrated circuits for motor control, but to learn
the basic fundamentals and the dimensioning problems of power
supplies it might be important to study an archaic circuit for motor
controls.
5.1 A H-Bridge for 3 Volt Power supplies
The driver circuit for the Hyper-Peppy robots contains two PNP-Tran-
sistors TR7 and TR8, respectively NPN-Transistors TR9 and TR10. In
this design we always allow only two transistors to simultaneously
conduct currents into motor M:
via TR7 and TR10 or alternatively
via TR8 and TR9.
The (freely available test-version of the) Microcap simulator allows us
to comfortably calculate the DC-simulation for the circuit and read the
values from the schematic window:
I
Afb. 8: simulation for the
H-bridge in the Hyper Peppy
robot

- 19 -
In the driver stage we may identify the DC-motor M. The
preamplier of the driver circuit is being simulated by resistor
R14. This resistor will pull the base-ports of transistors TR6
and TR5 to 0V, which results in a condition in which only the
right-sided branch is conducting a signicant current.
Transistors TR8, TR5 and TR9 are conducting and the other
transistors are blocked. As soon as we switch R14 to a positive
voltage the right-sided branch will be blocked and the motor
current will be reversed.
The Microcap Simulator allows us to calculate the currents
for all components and read the values from the schematic
window. The total supply current at 3V battery voltage will be
circa 300mA.
The remarkable low supply voltage for this circuit depends on
the combination of silicon PNP- and NPN- transistors, which
both work with 0.7V knee voltages. The motor however has
been designed between two collector ports, which in a satu-
ration mode merely conduct at 0.3V. For the motor M these
switches supply the motor with a respectable 1.5V. As calcula-
ted by Microcap the values may be read from g. 9.
.
Fig. 9: DC-settings for the H-Bridge
in the Hyper Peppy Robot

- 20 -
The 3V-power supply is an ideal condition for a robot with a battery-
pack of only 2 cells. The PNP-transistors however cannot easily be
integrated in an IC such as the L293D. An IC however has other
advantages such as reliability, protection against bad circuitry and
reduced PCB-area and low weight. For this reason we decided to
use a L293D-chip with a dual H-bridge circuitry to simultaneously
control two DC-motors.
5.2 A H-Bridge for 4,5 Volt
The L293D-chip (see g. 10) allows us to control output-currents up
to 600mA pro channel (maximal: 1.2A peak currents). The power
supply voltage of the drivers (VCC2) may vary between 4.5V and
36V, which promotes this L293D-Chip to a favorite circuit for DC-
motor control.
The minimal power supply voltage (VCC2) however has been speci-
ed as 4.5V, which forces us to choose a minimum of 4 rechargeable
batteries as a power supply. This investment increases the robot’s
total weight. It is the price we pay for modern electronic circuitry.
Fig. 10 H-Bridge circuitry with
a L293D-Chip
Table of contents
Other Arexx Robotics manuals