Arexx RP6 User manual

RP6 ROBOT BASE
RP6-BASE
RP6v2-BASE
©2007 - 2012 AREXX Engineering
www.arexx.com

RP6
Robo Sys em
Manual
- English -
Version RP6-BASE-EN-20120115
for RP6 and RP6v2
IMPORTANT INFORMATION!
Please read carefully!
Before you start operating the RP6, RP6 2 or any of the additional
equipment, you must read this manual and the manuals for add-on
modules completely! The documentation contains information about
how to operate the systems properly and how to a oid dangerous situ-
ations! Furthermore the manuals pro ide important details, which may
be unknown to a erage users.
Paying no attention to this manual will cause a loss of warranty! Addi-
tionally, AREXX Engineering cannot be made responsible for any dam-
ages caused by neglecting the manual's instructions!
Please pay special attention to the chapter “Safety instructions”!
Do not connect the USB Interface to your PC before you
ha e read chapter 3 – “Hardware and Software Setup”
and completed the software installation!

Legal No ice
©2007 - 2012 AREXX Engineering
Nervistraat 16
8013 RS Zwolle
The Netherlands
Tel.: +31 (0) 38 5 2028
Fax.: +31 (0) 38 52 82
"RP6 Robot System" is a trademark of
AREXX Engineering.
All other trademarks used in this document
belong to their owners.
This manual is protected by copyright. No
part of it may be copied, reproduced or dis-
tributed without the prior written permission
of the editor!
Changes in produ t spe ifi ations and s ope
of delivery are reserved. The ontents of
this manual may hange at any time without
prior noti e.
New versions of this manual will be pub-
lished on our website:
http://www.arexx. om/
Although we carefully control contents, we do not assume any liability for the contents of
external websites referred to in this manual. Solely the operators of these pages bear re-
sponsibility for the contents.
Limi a ions in Warran y and Liabili y
The warranty of AREXX Engineering is limited exclusively to the exchange of devices within
legal warranty periods in case of hardware defects, such as mechanical damage, missing or
wrong assembly of electronic components, excluding socketed circuits. To the extent per-
mitted by applicable law, AREXX Engineering assumes no liability for any damage resulting
directly or indirectly from the use of the device.
Irreversible modifications (e.g. soldering additional components, drilling holes, etc.) or
damaging the devices by neglecting the instructions in this manual will void warranty.
No warranties can be given with respect to individual requirements to the included soft-
ware, nor to the error-free and uninterrupted operation of the software.
Additionally, the software may be modified and loaded onto the system by the user. There-
fore the user is responsible for software quality and the overall system performance of the
robot.
AREXX Engineering guarantees the functionality of supplied example software as long as
the specified operating conditions are respected. If the devices are operated beyond these
conditions and the device or the PC-software is malfunctioning or gets defective, the cus-
tomer will be charged for all service costs, repairs and corrections. Please also pay atten-
tion to the corresponding license agreements on the CD-ROM!
Symbols
The following Symbols are used in his manual:
The “A en ion!” Symbol is used o mark impor an de ails.
Neglec ing hese ins ruc ions may damage or des roy he ro-
bo and/or addi ional componen s and you may risk your own
or o hers heal h!
The "Informa ion" Symbol is used o mark useful ips and
ricks or background informa ion. In his case he informa ion
is o be considered as “useful, bu no necessary”.

Con en s
1. Introduction ................................................................................. 6
1.1. Technical support .................................................................... 7
1.2. Scope of delivery – RP6 ........................................................... 7
1.3. Scope of delivery - RP6v2 ........................................................ 8
1. . The RP6v2 and Expansion possibilities ....................................... 8
1.5. Features and technical Data .................................................... 11
1.6. What can the RP6 do? ............................................................ 1
1.7. Application proposals and ideas ............................................... 15
2. The RP6 in detail ......................................................................... 16
2.1. Control System ..................................................................... 17
2.1.1. Bootloader.......................................................................19
2.2. Power Supply ........................................................................ 19
2.3. Sensors ............................................................................... 20
2.3.1. Battery Voltage Sensor......................................................20
2.3.2. Light Sensors (LDRs).........................................................20
2.3.3. Anti Collision System (ACS)................................................21
2.3. . Bumpers..........................................................................22
2.3.5. Motor Current Sensors.......................................................22
2.3.6. Encoders.........................................................................23
2. . Drive System ........................................................................ 2
2.5. Expansion System ................................................................. 25
2.5.1. The I²C Bus.....................................................................26
2.5.2. Expansion Connectors.......................................................27
3. Hardware and Software Setup ....................................................... 29
3.1. Safety Instructions ................................................................ 29
3.1.1. Electrostatic Discharges and Shorts.....................................29
3.1.2. Environment of the Robot..................................................30
3.1.3. Supply Voltage.................................................................30
3.2. Software Setup ..................................................................... 31
3.2.1. The RP6 CD-ROM..............................................................31
3.2.2. WinAVR - for Windows.......................................................32
3.2.3. AVR-GCC, avr-libc and avr-binutils - for Linux ......................32
3.2.3.1. Automatic install script ...............................................3
3.2.3.2. Manual install procedure .............................................35
3.2.3.3. Setting the path ........................................................36
3.2. . Java 6 ............................................................................37
3.2. .1. Windows ..................................................................37
3.2. .2. Linux .......................................................................37
3.2.5. RobotLoader.....................................................................38
3.2.6. RP6 Library, RP6 CONTROL Library and Example programs.....38
3.3. Connecting the USB Interface – Windows ................................. 39
3.3.1. Check if the device is properly connected.............................39
3.3.2. Driver uninstall................................................................. 0
3. . Connecting the USB Interface – Linux ...................................... 0
3.5. Finalizing Software installation ................................................ 0
3.6. Inserting Batteries ................................................................. 1
3.7. Charging the Batteries ........................................................... 3
3.8. The first test ......................................................................... 3
3.8.1. Connecting the USB Interface and start RobotLoader.............
. Programming the RP6 .................................................................. 53
.1. Configuring the source code Editor .......................................... 53
.1.1. Creating menu entries.......................................................53

.1.2. Configure Syntax Highlighting.............................................56
.1.3. Opening and compiling sample projects...............................58
.2. Program upload to the RP6 ..................................................... 60
.3. Why C? And what's “GCC”? .................................................... 61
. . C – Crash Course for beginners ............................................... 62
. .1. Literature.........................................................................62
. .2. First program...................................................................63
. .3. C basics...........................................................................65
. . . Variables.........................................................................66
. .5. Conditional statements......................................................68
. .6. Switch-Case.....................................................................70
. .7. Loops..............................................................................71
. .8. Functions.........................................................................72
. .9. Arrays, Strings, Pointers....................................................75
. .10. Program flow and interrupts.............................................76
. .11. The C-Preprocessor.........................................................77
.5. Makefiles .............................................................................. 78
.6. The RP6 function library (RP6Library) ....................................... 79
.6.1. Initializing the microcontroller.............................................79
.6.2. UART Functions (serial interface)........................................80
.6.2.1. Transmitting data ......................................................80
.6.2.2. Receiving data ..........................................................82
.6.3. Delay and timer functions..................................................83
.6. . Status LEDs and Bumpers..................................................86
.6.5. Read ADC values (Battery, Motorcurrent and Light sensors)....91
.6.6. ACS – Anti Collision System...............................................93
.6.7. IRCOMM and RC5 Functions...............................................95
.6.8. Power saving functions......................................................97
.6.9. Drive system functions......................................................97
.6.10. task_RP6System().........................................................103
.6.11. I²C Bus Functions..........................................................10
.6.11.1. I²C Slave ..............................................................10
.6.11.2. I²C Master ............................................................107
.7. Example Programs ............................................................... 111
5. Experiment Board ...................................................................... 123
6. Closing words ............................................................................ 12
APPENDIX .................................................................................... 125
A - Troubleshooting......................................................................125
B – Encoder calibration.................................................................133
C – Connector pinouts..................................................................135
D – Recycling and Safety instructions.............................................138

RP6 ROBOT SYSTEM - 1. In roduc ion
1. In roduc ion
The RP6 is a low cost autonomous mobile robot system, designed for beginners as
well as experienced electronics and software developers as an introduction to the
fascinating world of robotics.
The robot is delivered completely assembled. Thus it is very well suited for all users
who are unexperienced with soldering and tinkering and want to concentrate on soft-
ware development. However, implementing your own circuits and adding additional
things to the robot is easily possible, too! In fact, the RP6 offers a lot of expansion
possibilities and may be used as a platform for a variety of interesting electronic ex-
periments!
It is the successor of the very popular "C-Control Robby RP5", which had been re-
leased in 2003 by Conrad Electronic SE. The shortcut “RP5” is to be interpreted as
"Robot Project 5". The new robot and the predecessor system do not have too much
in common except for the mechanics. The C-Control 1 Microcontroller of Conrad Elec-
tronic has been replaced and thus the new robot cannot be programmed in Basic any-
more. Instead, the far more powerful ATMEGA32 from Atmel, which is programmable
in C is used. Additionally there is an expansion module for adapting the newer C-Con-
trol PRO modules (e.g. CC-PRO MEGA128) to the robot. This module allows the sys-
tem to be programmed in the more simple Basic language and provides a great num-
ber of additional interfaces and lots of additional memory.
The new design includes an USB interface, a new expansion system with improved
assembly options, high resolution odometry sensors (resolution is 150x higher com-
pared to the predecessor system), a precise voltage regulator (this was only provided
as an expansion module for the old system), a bumper composed of two mi-
croswitches with long levers and many other things.
Basically the mechanical design has been adopted from the RP5 system. However, we
did optimize the design for lower noise operation and now it provides some additional
drilling holes for mechanical expansions.
The RP6 robot has been designed to be compatible with our other robots, ASURO and
YETI, both using the smaller ATMEGA8 and identical development tools (WinAVR, avr-
gcc). In contrast, ASURO and YETI are delivered as do-it-yourself construction kits
and have to be assembled by the user. The RP6 has been designed for the more de-
manding users, looking for good expansion options, bigger microcontrollers and more
sensors.
Beginning of 2012 the original RP6 (which was released in 2007) got a small refresh
and is now called RP6v2. The System itself did not require many changes, so the in-
tention was not to develop a completely new Robot, but only to improve some details.
For more information take a look at chapter 1. !
Several expansion modules are already available and can be used for expanding the
robot's capabilities. For example, there is the previously mentioned C-Control expan-
sion, an expansion module providing an extra ATMEGA32 and of course the experi-
ment expansion board for individual electronic circuitry. Soon there will be a Wireless
LAN Expansion module with the very large ATMEGA2560.
We wish you a lo of fun and success wi h your RP6 Robo Sys em!
- 6 -

RP6 ROBOT SYSTEM - 1. In roduc ion
1.1. Technical suppor
You may contact our support team via internet as follows (please read
his manual comple ely before con ac ing he suppor ! Reading
the manual carefully will answer most of your possible questions
already! Please also read appendix A – Troubleshooting):
- through our forum: http://www.arexx.com/forum/
- by E-Mail: [email protected]
You will find our postal address in the legal notice at the beginning of
this manual.
All software updates, new ersions of this manual
and further informations will be published on our
homepage:
http://www.arexx.com/
and on he robo 's homepage:
http://www.arexx.com/rp6
1.2. Scope of delivery – RP6
You should find the following items in your RP6 box (RP6v2 s. nex page):
●Comple ely assembled Robo
●RP6 USB Interface
●USB A->B cable
●10pin flat cable
●RP6 CD-ROM
●Quickstart manual
●RP6 Experimen board
● pcs 25mm M3 distance bolts
● pcs M3 screws
● pcs M3 nuts
● pcs 1 pin connectors
●2 pcs 1 pin flat cable
- 7 -

RP6 ROBOT SYSTEM - 1. In roduc ion
1.3. Scope of delivery - RP6v2
You should find the following items in your RP6v2 box:
●Comple ely assembled Robo
●RP6 USB Interface
●USB A->B cable
●10pin flat cable
●RP6 CD-ROM
●Quickstart manual
Experimen board
NOT included!
1.4. The RP6v2 and Expansion possibili ies
The RP6v2 is a slightly improved Version of the orignial RP6. There are new Encoders
and more expansion connectors and some other small improvements.
The main change are the new
Encoders. On the original RP6
the Encoders had to be adjus-
ted to deliver a correct signal.
This was done in the factory,
but after shipping it could easily
happen that these had to be re-
adjusted by the user. With the
new Encoder electronics, this is
no longer required (in rare
cases a readjustment may be
neccessary, but this is quite
simple now due to larger and
easier to access Potentiomet-
ers). The stickers with the en-
coder pattern are now made of
a more robust material and
have higher contrast, which in-
creases the signal quality and
increases adjustment tolerence.
The motor and encoder cables
were directly soldered onto the
mainboard on the RP6. Now
these have connectors and can
be easily disconnected, which allows usage of the Chassis and Mainboard seperate
from each other (the RP6 already had these connectors since 2010). This makes it
easier to solder your own circuits to the Mainboard as it is more convenient to handle
without the whole chassis connected to it. In case of any defects, a replacement does
not require soldering anymore and repairing is easier.
There are now 9 additional connectors / pinheaders on the mainboard that offer vari-
ous additional expansions options (s. appendix). Four of these have been there on the
RP6 as well, but were unpopulated and had to be soldered by the User.
- 8 -

RP6 ROBOT SYSTEM - 1. In roduc ion
The main fuse has been changed from 2.5A to 3.15A, as there are now some addition-
al power supply connectors and the power distribution has been improved. This allows
usage of slightly higher power expansions. The Motor Drivers have been improved
with new more powerful and more reliable MOSFETs. These have even lower resist-
ance than the ones used before.
All these modifications increase the cost significantly. Over the last few years there
were also lots of increases in production cost, thus we can not include a Experiment
Expansion Board for free any longer, this has to be purchased seperately. The rest of
the Robot has not changed much, in order to keep the Software 100% compatible. If
you need more processing power or additional I/Os, you can choose frome three ex-
pansion boards: the RP6-M32, the RP6-CC128 and the new
RP6v2-M256-WIFI. These provide a lot of additional processing power and lots of in-
terfaces for sensors and actors.
The RP6-M32 is the lowest cost option and adds another ATMEGA32, which runs at
twice the clock speed as the one on the Robot Base and has several free I/O ports. It
is also very well suited as an addtion to the two bigger expansion modules if the pro-
cessing power of one of these alone is not sufficient for certain sensors or one needs
more I/O.
The RP6-CC128 module allows you to use a C-Control PRO MEGA128 Unit from Conrad
Electronic together with 6 KB external SRAM. It comes with a quite comfortable IDE
and allows to use CompactC or BASIC as programming language.
The most powerful expansion module is the new RP6v2-M256-WIFI which will be re-
leased in 2012. Beneath the large ATMEGA2560 (16MHz, 256KB Flash, 8K SRAM) it
also contains a 2. GHz 802.11g WLAN radio module. This allows you to monitor, con-
trol and remotely program the RP6 via a wireless computer network. The module fea-
tures 60 free I/O Ports with lots of special purpose interfaces like several ADC, PWM,
SPI and UART channels. With all these I/Os you can virtually use any sensor and
actor combination on the RP6. The microSD Card slot allows to add large data
storage of > 2GByte (e.g. for maps, data logging, websites, etc.).
On the two images on this page you can see the RP6 with two expansion
modules (Experiment PCB and RP6-M32 with LCD) and the new RP6v2 with RP6v2-
M256-WIFI (of course it can also be used on the old RP6!), Antenna and LCD. The new
connectors are shown in more detail in the appendix.
- 9 -

RP6 ROBOT SYSTEM - 1. In roduc ion
It is possible to combine the RP6v2-M256-WIFI, RP6-M32 and several of the experi-
ment PCBs – in total you would then have a Robot with 3 AVR Processors and around
80 I/O Ports for your applications. These can be connected to the Experiment PCBs via
flat cables, where you can add your own sensor electronics or ready to use sensor
modules (e.g. Ultrasonic or Infrared Rangers, Temperature, etc.). In such a setup the
strongest processor takes control of the Robot as I2C Bus master and the other two
are used as I2C Bus slaves.
For the sake of completeness it shall be mentioned that the C-Control Unit is currently
not able to be used as a I2C Bus Slave. This means the combination of several pro-
cessor modules requires the CC128 to be the I2C Busmaster. Combining the M256
and CC128 Boards is not really supported. It is theoretically possible if you use the
normal serial port (or one of the secondary ports) to command the CC128 Unit from
the M256 and put the I2C Bus into slave mode on the M256 - or not use the I2C Bus
on the C-Control Unit at all and deactivate that port.
For more information on the expansion modules, check the RP6 Website. There you
can find all related documentation and software.
Here we would like to repeat the note about the RP6 Website (this note in section 1.1
has often been overlooked in the past):
The CD-ROM can only be updated very rarely (if at all).
Sof ware and Documen a ion Upda es can only be found on our
Homepage:
http://www.arexx.com/
and on he robo 's homepage:
http://www.arexx.com/rp6
Before you ins all any Sof ware from he CD, you should check
for new Versions on he In erne !
And remember he no e from he beginning of his manual:
FIRST ins all he USB Driver,
THEN a ach he USB In erface!
- 10 -

RP6 ROBOT SYSTEM - 1. In roduc ion
1.5. Fea ures and echnical Da a
This section provides an overview of the robot's features and an introduction of some
basic keywords, to make you familiar with the terminology used in this manual. Most
of these keywords will be explained in later chapters.
Features, components and technical data of the RP6 and RP6 2:
●Powerful A mel ATMEGA32 8-Bi Microcon roller
◊Speed 8 MIPS (=8 Million Instructions per Second) at 8MHz clock frequency
◊Memory: 32KB Flash ROM, 2KB SRAM, 1KB EEPROM
◊Freely programmable in C (using WinAVR / avr-gcc)!
◊... and many more features! Further details will be given in chapter 2.
●Flexible expansion sys em, based on he I²C-Bus
◊Only two signals required (TWI -> "Two Wire Interface")
◊Transfer speed up to 00kBit/s
◊Master->Slave architecture
◊Up to 127 Slaves may be connected to the bus simultaneously
◊Very popular bus system. The market provides a lot of standard ICs, sensors and
other components, which may often be connected directly.
●Symme rical moun ing possibili ies for expansion modules a fron and rear
◊Theoretically you may stack any number of expansion modules, but the supply
capability and the overall weight allows a maximum of about 6 to 8 modules
(3 to modules each at front and rear).
◊The mainboard provides 22 free 3.2mm mounting holes and the chassis provides
another 16, summing up to 38 mounting holes in total – additionally the chassis
provides ample space for individual drills.
●USB PC In erface for program uploads from PC to microcontroller
◊Wired connection for maximum transfer speed. Program upload will usually run at
500kBaud, filling the total free memory space (30KB, 2KB are reserved for the
Bootloader) within seconds.
◊The interface may be used for programming all available expansion modules for
the RP6 with AVR Microcontrollers.
◊It may be used for communication between the robot and expansion modules. For
example you can use this for debugging purposes by transferring measurement
data, text messages and other data to the PC.
◊The interface driver provides a virtual comport (VCP) for all popular operating sys-
tems including Windows 2K/XP/Vista and Linux. The VCP can be used in standard
terminal programs and customized software.
◊The Robo Loader Software (previous name was RP6Loader) for Windows and
Linux allows comfortable program uploads. It also contains a small terminal for
communicating with the robot through text messages.
- 11 -

RP6 ROBOT SYSTEM - 1. In roduc ion
●Powerful ca erpillar drive uni in combination with a new gearing system for
minimising noise ( ompared to the prede essor CCRP5...)
◊Two powerful 7.2V DC-Motors
◊Maximum speed ca. 25 cm/s – depending on charge state and quality of batteries,
total weight and other conditions!
◊Self-lubing, sintered bearings at all four mm wheel-axles
◊Two rubber tracks
◊Capable of traversing small obstacles (up to ca. 2 cm height) like carpet edges,
thresholds or ramps of up to 30% steepness (with mounted bumper switches).
Removing the bumpers and restricting the number of modules to a maximum of 2
modules allows the robot to drive over ramps with up to 0% steepness.
●Two powerful MOSFET Mo ordrivers (H-Bridges)
◊Rotational velocity and direction can be controlled by the Microcontroller system.
◊Two curren sensors providing a measurement range up to ca. 1.8A for each
motor. This allows to quickly sense blocked or heavily loaded motors.
◊MOSFET Drivers have been slightly improved on RP6v2 (lower loss, more robust)
●Two high resolu ion encoders for speed- and motion-control
◊Resolution 625 CPR ("Counts Per Revolution") which implies the system counts
625 segments of the codewheel per revolution of a wheel! (150x higher resolution
compared to the predecessor system CCRP5 with only ca. CPR).
◊Exact and fast speed measurement and control!
◊High resolution of ca. 0.25mm per counted segment!
◊RP6v2 fea ures Encoders wi h improved elec ronics and new codewheels!
●An i-collision-sys em (ACS) which can detect obstacles with an integrated IR
receiver and two IR diodes aligned to left and right
◊Detects obstacles in the middle, left or right of the robot's front.
◊Sensitivity and transmitter power are adjustable, allowing reliable detection of
badly reflecting objects.
●Infrared Communica ion-sys em (IRCOMM)
◊Receives signals of standard universal infrared Remote Controls of TVs or Video
recoders. You may control your robot with a standard (RC5-) remote control! The
protocol may be changed in software, but we provide only an implementation of
the standard RC5-protocoll by default.
◊May be used for communication with several robots (using direct line of sight or
reflections from the ceiling and walls) or for transmitting telemetry data.
●Two ligh sensors – e.g. for light intensity measurement and light source tracking
●Two bumper sensors for collision detection
●6 S a us LED's – for sensor and program status displays
◊ of the LED Ports can also be used for other functions if necessary!
- 12 -

RP6 ROBOT SYSTEM - 1. In roduc ion
●Two free Analog o Digi al Conver er (ADC) Channels for external sensor
systems (Alternatively useable as standard I/O Pins).
●Accura e 5V vol age regula ion
◊Maximum current supply: 1.5A
◊Large copper-area for heat dissipation to the PCB
◊Constant current should not get higher than 1A. More than this requires extra
cooling! We recommend a maximum constant current value below 800mA.
●Replaceable 2.5A fuse on RP6 and 3.15 A fuse on RP6v2
●Low s andby curren of less than 5mA (1mA typ. and ca. 17 up to 0mA in use,
of course this depends on system load and activity (LEDs, Sensors etc.). These
values only include electronic circuits and do not take motors and expansion
modules into account!).
●Power supply wi h 6 NiMH Mignon accumula or ba eries (not included!)
◊E.g. Panasonic or Sanyo (NiMH, 1.2V, 2500mAh, HR-3U , Size AA HR6) or Ener-
gizer (NiMH, 1.2V, 2500mAh, NH15-AA)
◊Size AA, e.g. Sanyo (NiMH, 1.2V, 2500mAh, HR-3U), Sanyo Eneloop (High Capa-
city XX, 2500mAh, HR-3UWX) or Panasonic Infinium or Energizer (NiMH, 1.2V,
2500mAh, NH15-AA) or similar, minimum 2000mAh.
◊Operating time ca. 3 up to 6 hours depending on usage and quality/capacity of
the batteries (if the engines are not being activated too much, the robot may be
operated a lot longer. These operating time specifications are only for the robot
system itself, without expansion modules).
●Connec or for ex ernal ba ery chargers – the robot's main power switch
toggles between “Charge/Off” and “Operate/On”.
◊This may be adapted by using a few solder pads on the PCB, allowing you to
connect the robot with external power supplies or additional batteries.
◊Any external chargers that are suitable of charging 6 NiMH Cells in series may be
used. External chargers drastically vary in performance and additional options,
providing charging times between 3 and 1 h. You need a charger with round
5.5mm plug.
●The Mainboard provides 6 small expansion areas (and additionally 2 very tiny
areas on the small sensor PCB on the front) for your own sensor circuits, e.g. for
implementing additional IR sensors to improve obstacle detection. Expansion areas
may also be used for mounting purposes, e.g. for fixing mechanical objects.
●Lo s of expansion possibili ies!
Furthermore we supply quite a few C example programs and an extensive function lib-
rary, for comfortable software development.
The robot's Website will soon provide additional programs and software updates for
the robot system and its expansion modules. Of course we invite you to share your
own programs with other RP6 users via internet. The RP6Library and the example pro-
gram files are released under the Open Source Licence GPL!
- 13 -

RP6 ROBOT SYSTEM - 1. In roduc ion
1.6. Wha can he RP6 do?
Well, directly taken out of the box – not much!
It is the Software which enables the RP6 to actually do something – what this is ex-
actly, is up to you and your creativity to teach the robot how to perform. The attrac-
tion of robotics bases on the fascinating process of implementing new ideas or optim-
izing and improving excisting things! Of course you may start by simply executing and
modifying the prepared sample programs to have a look at the standard features, but
it is not limited to that!
The following list mentiones only a few examples and it is up to you to expand the
RP6. There are hundreds of possibilities (s. next page for example).
Basically the RP6 can …:
●... cruise around autonomously (this means independently, without remote control)
●... avoid obstacles
●... follow light sources and measure light intensity
●... detect collisions, blocked engines, low battery level and react properly on that
●... measure and control the rotational speed of the motors – virtually independently
of the power level of batteries, weight, etc. (this is performed with the high resolu-
tion encoders)
●... move for a given distance, rotate for specific angles and measure the driven dis-
tance (see chapter 2 for deviations)
●... move geometric figures, e.g. circles, polygons and others
●... exchange data with other robots or devices. Commands may be received from
standard TV/Video/HiFi remote controls and you will be able to control your robot
just like a remote controlled car.
●... transfer sensor data and other data to a PC with the USB Interface
●... be expanded easily by using the flexible bus-system!
●... modified according to your ideas. Just have a look at the schematics on the CD
and the PCB! But please restrict modifications to those you fully understand! It is
usually a better idea to start off by using an expansion board – particularly if you
are unexperienced in soldering circuits and electronics in general.
- 1 -

RP6 ROBOT SYSTEM - 1. In roduc ion
1.7. Applica ion proposals and ideas
The RP6 has been designed with good expansion possibilities. If you equip your RP6
with some additional sensor circuits, you can “teach” your Robot some of the following
things (some of the following tasks will turn out to be quite complex and the list is
roughly sorted in order of complexity):
●Expand the robot with additional controllers providing more CPU power, add addi-
tional memory or simply some I/O-ports and ADCs as it will be discussed in the ex-
ample programs with simple I²C port expanders and ADCs.
●Output sensor data and text on a LC-Display
●React on noise and generate acoustic signals
●Measuring the distance to obstacles with additional ultrasonic sensors, infrared-
sensors or similar in order to achieve better collision avoidance
●Track black lines on the floor
●Track and trace other robots or objects
●Control the robot from your PC by using infrared signals (this needs extra hardware.
Unfortunately it does not work with standard IRDA interfaces). Alternatively you
might start straight away by using wireless RF modules.
●Control the RP6 by using a PDA or Smartphone (in this case we suggest to mount
these devices to the robot instead of using them as remote control. But that is pos-
sible, too!)
●Collect objects (e.g. tea lights, marbles, tiny metal objects …)
●Attach a tiny robot arm to grasp objects
●Navigate with the help of an electronic compass and/or infrared beacons (made up
of small towers equipped with a number of IR-LEDs and positioned at a well known
location), in order to determine the robot's position and head for a given location.
●Providing a number of robots equipped with a ball kick and handling mechanism and
some extra sensors you might be able to raise a team of robots playing soccer!
●… anything else, which might come to your thoughts!
However, first of all you have to read this manual and become familiar with robotics
and programming. The previous list of ideas is just meant as a little motivation.
And if programming does not succeed at first glance, please do not give up immeadi-
ately and throw everything out of the window: all beginnings are difficult!
- 15 -

RP6 ROBOT SYSTEM - 2. The RP6 in de ail
2. The RP6 in de ail
This chapter describes the most important hardware components of the RP6 ROBOT
SYSTEM. We will discuss the electronics, the microcontroller and the interaction of
software and hardware. If you are already familiar with microcontroller technology
and electronics, you will probably just glance through this chapter. Beginners in robot-
ics however should study this chapter to gain insight to the RP6 basics.
If you do not want to wait and rather like to test the robot, then please proceed to
chapter 3, but return to this chapter later on as it certainly contains a number of use-
ful explanations of the robot's programming details. And you do want to know what is
controlled with the software and how this works, don't you?
We will not go deeply into details, but still a few topics in this chapter might be hard
to understand – the author tried to explain things as simple as possible.
If you wish to study special topics in detail you may also look for additional informa-
tion at http://www.wikipedia.org/, which definitely is a good starting point for most
topics.
Images often tell more than words and that is why we start with an overview diagram
of the RP6. The diagram shows a drastically simplified schematic of the robot's elec-
tronic components and how they are connected together:
- 16 -

RP6 ROBOT SYSTEM - 2. The RP6 in de ail
We can divide the Robot in five main functional units:
●Control System
●Power Supply
●Sensors, IR Communication and Displays (Sensors) – everything communicating
with the outside world and measureing physical values.
●Drive System
●Expansion System
2.1. Con rol Sys em
As you can see in the diagram, the robot's central unit is an
ATMEL ATMEGA32 8-Bit Microcontroller (see fig.).
A microcontroller is a complete computer in a single chip. This
microcontroller differs from bigger computers (e.g. your PC) by
providing less peripherals than the big ones. Of course, the tiny
processor does not have a normal hard disk drive and Gigabytes
of RAM. A microcontroller does not need that much memory.
The MEGA32 provides “only” 32KB (32768 Bytes) Flash
ROM – which might be compared to a normal “hard disk drive” - or nowadays a flash-
drive. This Flash ROM is used to store all program data. The Random Access Memory
(RAM) size is limited to 2KB (20 8 Bytes) and is already more than sufficient for our
needs. Imagine for comparison the controller of the old CCRP5 Robot with only 2 0
Bytes RAM, which was almost completely reserved for the Basic Interpreter.
But what on earth enables a microcontroller to work with this tiny memory capacity?
That's simple: The processor neither handles huge amounts of data nor does it need
to provide an operating system such as Linux or even Windows and it does not need
to show a complex graphical interface or serve similar tasks. There will be just one
program running and that's our own one!
These limitations are by no way a disadvantage, but one of the main advantages of
microcontroller systems compared to large computers (additionally we may include
power consumption, size and cost)! The processor is designed to handle jobs in known
time slots (also called “realtime”). Usually we do not have to share the processor's
power with a great number of processes as in a standard PC and programmers are
able to carefully determine the time slot for any special function module.
The RP6 controller runs at 8MHz, which enables a processing speed of 8 Million in-
structions per second. The processor would even allow up to 16MHz clock, but we use
the slower clocking option which allows some power savings. The machine is still fast
enough for all of our standard jobs! Again we are comparing to the controller of the
old predecessor CCRP5 with a MHz clock, allowing only approximately 1000 (inter-
preted) Basic instructions per second. For this reason the ACS control had to be man-
aged by another slave controller on that old Robot – we do not need this slave pro-
cessor anymore! And whoever needs more processor power may add one or more
controllers to the expansion interface. The additionally available RP6 Control M32 Ex-
pansion module provides an additional MEGA32, which is clocked with the maximum
16MHz clock frequency.
- 17 -

RP6 ROBOT SYSTEM - 2. The RP6 in de ail
The controller is communicating to the world outside via 32 I/O Pins ("Input/Output
Pins"), organized in "Ports", each composed of 8 I/O Pins. This way the MEGA32
provides "Ports": PORTA to PORTD. The controller is able to read the logical status
of these ports and process the information in software. Of course, the processor will
equally use the ports to output logical signals in order to control small loads up to 20
mA currents (e.g. LEDs).
Additionally the controller provides a number of integrated hardware modules for spe-
cial tasks. Implementing these tasks in software would normally be either very diffi-
cult or even impossible. One of these special tasks is timing. Three Timers for count-
ing clock periods are available. The timer modules are completely independent from
program flow. In fact, the microcontroller may even process other jobs while waiting
for a programmed counter level.
RP6 is using one of the timers to generate PWM signals (PWM="Pulse Width Modula-
tion") for speed-control of the motors and as soon as the timer has received appropri-
ate input parameters it will manage this task in background. We will discuss more de-
tails of the PWM signal generation in the chapter “Drive System”.
For example some other modules of the MEGA32 are:
●A serial interface (UART) for PC-communication with the RP6 USB Interface. Using
this interface you might also connect another microcontroller with an UART, as long
as the USB Interface is not connected.
●The "TWI"-module (="Two Wire Interface") providing the I²C Bus for expansion
modules.
●An Analog-to-Digital Converter (ADC) providing 8 input-channels for measuring
voltages with 10bit resolution. RP6 is using the ADC for monitoring the battery
voltage level, motor current-sensors and light intensity with two light-dependant
resistors.
●Three external interrupt inputs for generating interrupt signals, which will interrupt
the program flow in the controller and force the program to jump to a special "Inter-
rupt Service Routine". The microcontroller will then process this routine immeadi-
ately and return back to the normal program. We will be using this programming
feature for the odometry sensors. We will discuss this sensor in detail later on.
The integrated hardware modules do not have their own individual pins, but may be
used alternatively instead of standard I/O Pins. Normally you may freely choose these
special function mapping for the I/O Pins, but the RP6 almost completely provides a
standard configuration (as it is hard-wired to all components) for pins and modifying
the standard configuration will hardly be useful.
The MEGA32 provides a lot of other things, which cannot be de-
scribed in detail in this manual. You get more information on this in
the datasheet of the manufacturer (which can be found on the RP6
CD-ROM and on our Website).
- 18 -

RP6 ROBOT SYSTEM - 2. The RP6 in de ail
2.1.1. Boo loader
There is a so called Bootloader located in a special memory area of the
microcontroller. This tiny program is responsible for loading new user programs into
the microcontroller's memory via the serial interface. The Bootloader communicates
with the the RobotLoader software (original name was RP6Loader) on the host PC.
Like this, no additional programming hardware is required. The USB Interface can be
used for communication with the controller through text messages and additionally to
program the controller. However there is one drawback in using a Bootloader: it needs
2KB of the flash memory, which will leave 30KB free memory for your own programs.
This does not bother us too much as there is plenty of room even for very complex
programs (compared to the 7KB free memory of the tiny ASURO robot)!
2.2. Power Supply
Of course the robot needs energy. The RP6 is carrying this energy in form of 6 accu-
mulator batteries. Operating time will heavily depend on battery capacity and al-
though the electronic systems will consume relatively small amounts of energy the
bulk load of energy will end up in the motors, depending on their load.
In order to provide long operating times you might favour batteries with ample capa-
cities of up to 2500mAh. Capacities of 2000mAh however will be useable as well. High
quality batteries will provide between 3 to 6 operating hours, depending on motor
load and battery quality. You will need 6 batteries, summing up to a voltage of 6x
1.2V = 7.2Volts. The block schematic diagram labels this battery voltage "UB" (= "U-
Battery", U is the standard letter for voltage in electrical engineering formulas). "UB"
is defined as a nominal voltage only, as the voltage may vary over time. Completely
charged NiMH batteries can deliver up to 8.5V! The voltage drops while the Battery is
discharged and may change drastically, depending on load and quality as well. The
critical value for this is the internal resistance.
Of course, an altering supply voltage is not useable for sensor measurements. More
important however is the limited operating voltage range of semiconductor compon-
ents. The microcontroller for instance might be destroyed by applying voltages too
high over 5V. Therefore we have to reduce and stabilize the voltage level to a well
defined level.
This is performed by an integrated voltage regulator capable of
supplying a current up to 1.5A (see figure). At 1.5A this device
would dissipate a lot of heat and therefore it is attached to a
large copper plane on the PCB. Even with this heat sink we sug-
gest to limit currents over 1A to a few seconds only. Otherwise
you will have to attach an additional heat sink.
Continuous current load should be limited to about 800mA. Such
a heavy load would quickly discharge batteries anyway.
Under normal load conditions and without expansion modules
the robot will not draw more than 0mA, unless the IRCOMM
transmitter is active. This current level will not cause any problems for the regulator
and it can supply enough power for lots of expansion board. Usually the expansions
will need something in the range of 50mA, if no motor loads, power LEDs, etc. are
used on them.
- 19 -

RP6 ROBOT SYSTEM - 2. The RP6 in de ail
2.3. Sensors
Most sensors have been mentioned in preceding chapters, but now we will have a
closer look at them.
In the overview diagram you will find sensors outside of the blue-coloured area
“Sensors”. Actually these sensors belong to other modules. However, the odometry
encoders, the motor current sensors and the battery voltage sensor are sensors and
will be discussed in this chapter, too!
2.3.1. Ba ery Vol age Sensor
Basically this sensor is a simple voltage divider consisting of two resistors in series.
We can assume to have a set of batteries with a maximum voltage of 10V. 6 NiMH
batteries will certainly never exceed this level. The ADC reference voltage, which is
compared to the monitored voltage, is set to 5V. The maximum 5V operating voltage
of the Microcontroller must not be exceeded at any time. For this reason the mon-
itored voltage will have to be divided by 2. To achieve this we use the voltage divider
with two resistors, matching the monitored voltage to the ADC's voltage range.
The ADC measures the voltage at a resolution of 10 Bits (which implies a value range
between 0 and 1023 units), resulting in a voltage resolution of
10V
1024 =9.765625mV
.
A measurement value of 512 units corresponds to 5V and 1023 to approximately 10V!
These limits are usually not reached with 6 normal NiMH batteries!
The measurement is not too accurate, as we are not using precision resistors. A few
percent tolerance has to be taken into account. The reference voltage is not accurate
as well and may be fluctuating in heavy load conditions. We do not care about these
tolerances, as we only need an indicator for checking the discharging limit of the bat-
teries. If you need to determine the exact voltages, you will need to use a Multimeter
to check the exact voltage values and then add correction values in software.
If you can accept tolerances you may even directly estimate the voltage from the ADC
value: 720 units are corresponding roughly to 7.2V, 700 to 7.0V and 650 to 6.5V. A
value of constantly 560 can be considered as empty batteries.
2.3.2. Ligh Sensors (LDRs)
At the front side of a small sensor-PCB you may spot two so-
called LDRs (="Light Dependant Resistors"), which are aligned to
the left and to the right respectively. There is a black partition
wall between the two sensors in order to prevent light entering
the “wrong” side of the light sensor system. Just like the Voltage
sensor, both light sensors form a voltage divider together with a
resistor, but here to determine the light intensity. In this case, the 5V rail is divided as
well, but now we have a variable resistor. The division relation will change according
to the surrounding light intensity and provide a light dependant voltage level to one of
the ADC channels!
The voltage difference between both sensors may be used to determine at which side
of the robot the brightest source of light is located: left, right or in the middle. A suit-
able program can trace a bright torch in a darkened room or guide the robot to the
- 20 -
This manual suits for next models
2
Table of contents
Other Arexx Robotics manuals