Table of Contents

Advertisement

Quick Links

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

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RP6 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Arexx RP6

  • Page 1 RP6 ROBOT BASE RP6-BASE RP6v2-BASE ©2007 - 2012 AREXX Engineering www.arexx.com...
  • Page 2 RP6 and RP6v2 IMPORTANT INFORMATION! Please read carefully! Before you start operating the RP6, RP6v2 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 avoid dangerous situ- ations! Furthermore the manuals provide important details, which may be unknown to average users.
  • Page 3 Limitations in Warranty and Liability 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.
  • Page 4: Table Of Contents

    3.2.4. Java 6 ................37 3.2.4.1. Windows ..............37 3.2.4.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..............40 3.4.
  • Page 5 4.1.2. Configure Syntax Highlighting..........56 4.1.3. Opening and compiling sample projects.......58 4.2. Program upload to the RP6 ............. 60 4.3. Why C? And what's “GCC”? ............ 61 4.4. C – Crash Course for beginners ..........62 4.4.1. Literature.................62 4.4.2. First program..............63 4.4.3.
  • Page 6: Introduction

    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-...
  • Page 7: Technical Support

    1.2. Scope of delivery – RP6 You should find the following items in your RP6 box (RP6v2 s. next page): Completely assembled Robot RP6 Experiment board ● ● RP6 USB Interface 4 pcs 25mm M3 distance bolts ●...
  • Page 8: Scope Of Delivery - Rp6V2

    Quickstart manual ● 1.4. The RP6v2 and Expansion possibilities 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.
  • Page 9 (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.
  • Page 10 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).
  • Page 11: Features And Technical Data

    Most of these keywords will be explained in later chapters. Features, components and technical data of the RP6 and RP6v2: ● Powerful Atmel ATMEGA32 8-Bit Microcontroller ◊ Speed 8 MIPS (=8 Million Instructions per Second) at 8MHz clock frequency ◊...
  • Page 12 RP6 ROBOT SYSTEM - 1. Introduction ● Powerful caterpillar drive unit in combination with a new gearing system for minimising noise (compared to the predecessor 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! ◊...
  • Page 13 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!
  • Page 14: What Can The 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-...
  • Page 15: Application Proposals And Ideas

    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!) ●...
  • Page 16: The Rp6 In Detail

    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 -...
  • Page 17: Control System

    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.
  • Page 18 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.
  • Page 19: Bootloader

    (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.
  • Page 20: Sensors

    RP6 ROBOT SYSTEM - 2. The RP6 in detail 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”.
  • Page 21: Anti Collision System (Acs)

    RP6 ROBOT SYSTEM - 2. The RP6 in detail brightest spot in the room! For example if you illuminate the floor with a very bright halogen-torch, the robot will follow the bright light spot on the floor. Of course you may try the opposite: the robot could be programmed to hide from bright light sources.
  • Page 22: Bumpers

    A/D-conversion can take place. This is performed by a so- called operational amplifier (opamp). The RP6 uses an opamp for each individual cur- rent sensor. The measureable current range is about 1.8A. This current results in a voltage drop of 0.18V at the power resistor and an opamp output voltage of approx-...
  • Page 23: Encoders

    RP6 ROBOT SYSTEM - 2. The RP6 in detail 2.3.6. Encoders The encoders work completely different compared to the previously discussed sensors. They consist of reflective in- terrupters and code wheels which are attached to one of the gearwheels in each gearing system. This setup is used to determine the rotational velocity of the Motors.
  • Page 24: Drive System

    2.4. Drive System The RP6 drive system consists of two DC motors with attached gearing systems for powering the caterpillar wheels (see preceding figure). The motors can consume a fairly high amount of power and a microcontroller can not directly serve such high cur- rents.
  • Page 25: Expansion System

    10mph! So by using a moderate speed, the RP6 will not run into trouble that easy and at a slower movement the sensors will have ample of time to react on obstacles. Addi-...
  • Page 26: The I²C Bus

    Apart from sensor circuits, additional controllers could be useful to perform additional tasks, e.g. the RP6 CONTROL M32 providing an extra MEGA32 microcontroller. Of course the expansion system has to be capable of connecting several expansion modules (see figure), while using a minimum number of signal lines and providing sufficient communication speed.
  • Page 27: Expansion Connectors

    MEGA32 do contain more information to this topic. The example programs demonstrate how to use the bus hardware. The RP6 library already provides functions for controlling the I²C Bus. You will not have to go into de- tails of the protocol, but it is useful to understand how bus the communication is ba- sically working.
  • Page 28 As a general rule you may mount a maximal number of 8 modules to the RP6: 4 at the front side and 4 at the backside. The figure shows the connection diagram for both expan- sion connectors.
  • Page 29: Hardware And Software Setup

    Please read this chapter extra carefully! 3.1. Safety Instructions Due to the open frame architecture of the RP6, there are several sharp edges. Thus the Robot may not be used as a toy for children aged less than 8 years! Please super-...
  • Page 30: Environment Of The Robot

    RP6 ROBOT SYSTEM - 3. Hardware and Software Setup All electric lines from and to the system must be connected before connecting and ap- plying the supply voltage. Unexpected connecting or disconnecting plugs, cables or modules in an operating ro- bot may damage or destroy parts of the system and additional components.
  • Page 31: Software Setup

    RP6! We cannot provide an introduction course in computer usage in this manual, as this topic is out of scope! This manual will describe the RP6, programming the RP6 and the dedicated system software.
  • Page 32: Winavr - For Windows

    "Programmers Notepad 2", which will also be used for software development for RP6. WinAVR is a privately or- ganized project and the package is freely available on Internet for everyone. New re- leases and further information may be found on the official project website: http://winavr.sourceforge.net/...
  • Page 33 RP6 ROBOT SYSTEM - 3. Hardware and Software Setup First of all you will have to deinstall any preceding – and as already stated probably obsolete - versions of the avr-gcc, avr-binutils and avr-libc. To start deinstall you may use your distributions package manager tool, search for “avr” and then deinstall the packages from your system, if the tool finds corresponding objects starting with “avr-”.
  • Page 34: Automatic Install Script

    RP6 ROBOT SYSTEM - 3. Hardware and Software Setup All relevant installation files for avr-gcc, avr-libc and binutils can be found in the fol- lowing directory: <CD-ROM-Drive>:\Software\avr-gcc\Linux Start by copying all install files to a directory on your hard disk – this is valid for both installation methods! In this case we will be using the Home directory (a standard shortcut for the Home directory is the swung dash or tilde-character: “~”).
  • Page 35: Manual Install Procedure

    Binutils for AVR We proceed by unpacking the source code for Binutils and applying a few patches. Let us assume you have copied all files to the home directory ~/RP6: > cd ~/RP6 > bunzip2 -c binutils-2.17.tar.bz2 | tar xf - >...
  • Page 36: Setting The Path

    RP6 ROBOT SYSTEM - 3. Hardware and Software Setup Depending on your PC's performance this will take a few minutes – this is also true for the next two steps – especially for the GCC! GCC for AVR Using similar procedure as for Binutils, the GCC has to be patched, compiled and in- stalled: >...
  • Page 37: Java 6

    Java environment and may be used in Windows and Linux (in theory, other operating systems such as OS X should work as well, but unfortunately AREXX Engineering does not support this so far). In order to run RobotLoader, you have to install a recent Java Runtime Environment (JRE).
  • Page 38: Robotloader

    3.2.5. RobotLoader We created the RobotLoader to simplify the uploading process for new programs to the RP6 and all expansion modules (as long as these modules provide a microcontrol- ler with a compatible bootloader). Additionally we implemented a few useful functions, e.g.
  • Page 39: Connecting The Usb Interface - Windows

    RP6 ROBOT SYSTEM - 3. Hardware and Software Setup 3.3. Connecting the USB Interface – Windows Linux users can skip this section! There are several ways to install the USB Interface Drivers. The simplest way is in- stalling the drivers BEFORE connecting the device for the first time. The CD provides different install programs for the driver.
  • Page 40: Driver Uninstall

    Just for your informatin: the Windows version of the RobotLoader uses the D2XX drivers and will display the complete USB names in the port list (e.g. “USB0 | RP6 USB Interface | serialNumber”). In contrast, the Linux version of the program will dis- play the virtual comport names /dev/ttyUSB0, /dev/ttyUSB1 or similar.
  • Page 41: Inserting Batteries

    RP6 ROBOT SYSTEM - 3. Hardware and Software Setup 3.6. Inserting Batteries It's about time to get to the Robot itself. First of all the robot needs 6 batteries! We recommend to use high-quality NiMH Mignon batteries (manufacturers e.g. Sanyo, Panasonic, and others –...
  • Page 42 RP6 ROBOT SYSTEM - 3. Hardware and Software Setup Please take out the black battery holder afterwards (see figure). Make sure that main power switch is in the position “OFF”! The switch lever must point to the direction of the text “OFF”...
  • Page 43: Charging The Batteries

    “OFF” for charging! Battery charging only works if the Robot is turned off. The main switch connects the batteries either to the RP6's electronics or to the charger connect- Check the polarity of the charger compared to the charging supply plug (labelled “Charger”) located next to the robot's main power switch!
  • Page 44: Connecting The Usb Interface And Start Robotloader

    Even in standby mode the robot uses a small amount of energy (up to 5mA) – and please remember to turn off the RP6 completely if you do not want to use the system for a longer time! With a program in memory the robot will not automatically switch to standby mode.
  • Page 45 Bootloader. If everything works OK, the black “Status” field will show “Connected to: RP6 Robot Base ...”, accompanied the meas- ured battery voltage. If this fails, please wait a second,and retry it! If the retry fails, a more serious error occurred! In this case immediately switch off the robot and pro- ceed by reading the chapter “Troubleshooting”...
  • Page 46 ATTENTION! Please pick up and hold the RP6 in your hands while test number 8 is running (“Motors and Encoders Test”) or alternat- ively place the RP6 on top of a suitable object – in order to prevent the caterpillar tracks from touching the ground surface! During test...
  • Page 47 RP6 ROBOT SYSTEM - 3. Hardware and Software Setup This warning message will be displayed directly before test number 8 and must be ac- knowledged before the test will start. Please enter the lowercase letter 'x' in the terminal window and hit Enter (you will have to repeat this procedure whenever a similar message is displayed or a test has to be aborted...).
  • Page 48 RP6 ROBOT SYSTEM - 3. Hardware and Software Setup Battery sensor test is next. In fact, the sensor already has been tested as the botLoader has shown the battery voltage before. The battery check is now repeated to complete the list:...
  • Page 49 ACS is set to Medium power/range! You can also send RC5 Codes with a TV Remote Control to the RP6 - it will display the Toggle Bit, Device Adress and Keycode of the RC5 Transmission! Make sure your remote control transmits in RC5 and not SIRCS or RECS80 etc.! There are several other formats that will NOT work!
  • Page 50 RP6 with your hands – the caterpillars must not touch the floor or any other objects! Otherwise the test will most likely fail! If you put the RP6 on top of an object like described above, please make sure the RP6 cannot accidently fall off the table.
  • Page 51 The caterpillar tracks should __NOT__ touch the ground! (hold it in your hands for example...) THE RP6 WILL START MOVING FAST! YOU CAN DAMAGE IT IF YOU DO NOT MAKE SURE THAT IT CAN __NOT__ MOVE! Make sure both crawler tracks are FREE RUNNING! DO NOT BLOCK THEM! -->...
  • Page 52 RP6 ROBOT SYSTEM - 3. Hardware and Software Setup T: 100 |VL: 102 |VR: 101 |PL: 111 |PR: 082 |IL: 058 |IR: 041 |UB: 07.21V T: 100 |VL: 102 |VR: 101 |PL: 109 |PR: 081 |IL: 056 |IR: 039 |UB: 07.20V T: 100 |VL: 093 |VR: 100 |PL: 113 |PR: 081 |IL: 063 |IR: 038 |UB: 07.20V...
  • Page 53: Programming The Rp6

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4. Programming the RP6 At last, we have reached the programming section. 4.1. Configuring the source code Editor We will start by setting up a small development environment. The so-called “source code” of our C programs needs to be entered and edited somehow! Of course we will not use text processing systems like OpenOffice or Word! This may not be obvious for everyone and therefore we explicitly emphasize this.
  • Page 54 RP6 ROBOT SYSTEM - 4. Programming the RP6 You are now entering the options dialog, which allows change several settings. However we will only add new entries to the tools menu. To proceed, select “C/C++” in the dropdown list to the “Scheme:”- menu! Click on “Add”!
  • Page 55 RP6 ROBOT SYSTEM - 4. Programming the RP6 As an alternative method to “%d/make_all.bat” you may also simply enter “make” into the field “Command” and “all” into the “Parameters” field. In fact, the batch file simply executes exactly these commands, but the batch file sim- plifies starting the compiler from Windows Explorer.
  • Page 56: Configure Syntax Highlighting

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.1.2. Configure Syntax Highlighting Another setting you may change is the Syntax Highlighting. You can add a few “Keywords” to the standard C/C++ Scheme. You may directly Copy & Paste ([STRG]+ [C] = copy, [STRG]+[V] = paste/insert) them into the dialog-field: int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t Then click “Sort”...
  • Page 57 RP6 ROBOT SYSTEM - 4. Programming the RP6 After customizing and opening a sample project according to the next section PN2 should look like in the following screenshot: On the left side you see all sample projects in a treeview, the the source editor (fea- turing the previously discussed syntax highlighting) is on the right and and the tool output (in this case the compiler output) is on the bottom.
  • Page 58: Opening And Compiling Sample Projects

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.1.3. Opening and compiling sample projects Let's try if everything works fine and open all the sample projects: Select “Open Project(s)” in the “File” menu. In the standard file select dialog, you have to search for the subdirectory “RP6Base_Examples”...
  • Page 59 RP6 ROBOT SYSTEM - 4. Programming the RP6 The compiler will generate a great number of temporary files (using file extensions like “.o, .lss, .map, .sym, .elf, .dep”). You do not have to look at any of these files and you may use the newly created tool “make clean”...
  • Page 60: Program Upload To The Rp6

    RP6 ROBOT SYSTEM - 4. Programming the RP6 Also very helpful is an overview labelled “AVR Memory Usage” at the end: Size after: AVR Memory Usage ---------------- Device: atmega32 Program: 6858 bytes (20.9% Full) (.text + .data + .bootloader) Data: 148 bytes (7.2% Full)
  • Page 61: Why C? And What's "Gcc

    But it's worth the effort, as basic C knowledge will simplify learning other program- ming languages as the concepts are often very similar. Just like for our other robots, the RP6 requires a special version of the C compiler from the GNU Compiler Collection (abbreviation: GCC). The GCC is a universal compil- ing system, supporting a great variety of languages such as C, C++, Java, Ada and FORTRAN.
  • Page 62: C - Crash Course For Beginners

    All relevant information can be found on the mentioned websites. The sample pro- grams available on the RP6 CD are also quite extensive and show a lot of things. The tutorial in this manual is also good enough for the first experiments.
  • Page 63: First Program

    Of course we will have to discuss a few basics before, but in order to give you an idea of what we are talking about, let's just start with a simple C program for the RP6: * A small and simple "Hello World" C Program for the RP6! #include "RP6RobotBaseLib.h"...
  • Page 64 RP6 ROBOT SYSTEM - 4. Programming the RP6 Anyone feeling bored by the tiny sample program may find a more attractive "Hello World" program in the RP6 example directory, including a running light with the LEDs and some more text outputs!
  • Page 65: C Basics

    RP6 ROBOT SYSTEM - 4. Programming the RP6 functions, but is not needed in a microcontroller system. We only need to add this re- turn value to meet the standard C-conventions (and as we will see later, programs for microcontrollers will usually never terminate).
  • Page 66: Variables

    8, 16 or 32 Bits integer data types, which may be used either signed or unsigned. The deserved value range determines the required number of bits for defining a stor- age location for a variable. For the RP6 we will use the following data types: Type Alternative...
  • Page 67 AVR microcontroller. Floating point numbers are very computation time and memory intensive and usually we are able to work perfectly well with integers. Most RP6 programs will not require floating num- bers.
  • Page 68: Conditional Statements

    RP6 ROBOT SYSTEM - 4. Programming the RP6 z++; // abbreviation for z = z + 1; which implies z is now 9 z++; // z = 10 // z++ is called “incrementing z” z++; // z = 11 ...
  • Page 69 RP6 ROBOT SYSTEM - 4. Programming the RP6 One more example: uint16_t myFavoriteVariable = 16447; if( myFavoriteVariable < 16000) // If myFavoriteVariable < 16000 // then: writeString("myFavoriteVariable is less than 16000!\n"); else // else: writeString("myFavoriteVariable is greater than or equal to 16000!\n");...
  • Page 70: Switch-Case

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.4.6. Switch-Case Often we will have to compare a variable to a great number of different values and decide to execute further program code according to the result of these comparisons. Of course, we could use a great number of if-then-else conditional statements, but the language provides a more elegant method by using a switch-case-construct.
  • Page 71: Loops

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.4.7. Loops We need loops if operations need to be repeated a number of times. Let's demonstrate the basic principle in an example: uint8_t i = 0; while(i < 10) // as long as i is less than 10...
  • Page 72: Functions

    RP6 ROBOT SYSTEM - 4. Programming the RP6 You may simply build endless loops with while- or for-loops: while(true) { } for(;;) { } In both cases the command block will be executed “for ever” (respectively until the microcontroller receives an external reset signal or the program terminates the loop by executing the “break”-instruction).
  • Page 73 1]\n"); void someOtherFunction(void) writeString("[Function 2 – something different]\n"); main(void) // Always start an RP6-program by calling this function! initRobotBase(); // A few function calls: someLittleFunction(); someOtherFunction(); someLittleFunction(); someOtherFunction(); someOtherFunction(); return The program would display the following text at the output device: [Function 1] [Function 2 –...
  • Page 74 [CALC] [The following value was passed to this function: 40] The RP6 Library provides a great number of functions. A quick look at the code of a few modules and example programs will clarify the basic principles of developing pro- grams with functions.
  • Page 75: Arrays, Strings, Pointers

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.4.9. Arrays, Strings, Pointers... A great number of further interesting C-features are waiting to be discussed, but for details we will have to refer to available literature! Most of the program examples can be understood without further study. In the re- maining sections of this crash course we describe only a few examples and concepts in a short overview, which of course is not very detailed.
  • Page 76: Program Flow And Interrupts

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.4.10. Program flow and interrupts As discussed before, a program will be executed basically instruction after instruction from the top to the bottom. Apart from this standard behaviour, there is flow control with conditional jumps, loops and functions.
  • Page 77: The C-Preprocessor

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.4.11. The C-Preprocessor In this chapter we will briefly discuss the C-preprocessor, which has been used in the preceding programming samples already in the line: #include "RP6RobotBaseLib.h" The preprocessor evaluates this command before starting the GCC-compiling process.
  • Page 78: Makefiles

    This useful feature will prevent a considerable amount of typing effort in makefiles... Usually you will not have to modify anything else in the RP6 makefiles. If you are looking for additional information on this topic you may look at the detailed manual: http://www.gnu.org/software/make/manual/...
  • Page 79: The Rp6 Function Library (Rp6Library)

    300 pages long datasheet of the ATMEGA32 Mi- crocontroller in order to be able to write programs for the RP6. However, by reading some important parts of the data sheet you may gain insight of how the RP6Library works in detail.
  • Page 80: Uart Functions (Serial Interface)

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.6.2. UART Functions (serial interface) A few of the RP6Library's functions have been used in the previous C crash course already, such as the UART functions. These functions allow us to transfer text mes- sages through the robot's serial interface to and from the PC (or to another microcon- troller).
  • Page 81 RP6 ROBOT SYSTEM - 4. Programming the RP6 void writeStringLength(char *data, uint8_t length, uint8_t offset); Whenever you need to output text with a predefined length and/or offset, you can use this function. An example: writeStringLength("ABCDEFG", 3, 1); Output: “BCD” writeStringLength("ABCDEFG", 2, 4);...
  • Page 82: Receiving Data

    RP6 ROBOT SYSTEM - 4. Programming the RP6 void writeIntegerLength(uint16_t number, uint8_t base, uint8_t length); This function is a variant for writeInteger, enabling you to specify the number of digits (length) to be displayed. If the number's length is below the specified limit, the func- tion will add leading zeros.
  • Page 83: Delay And Timer Functions

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.6.3. Delay and timer functions Microcontroller programs often have to be delayed completely for some time, or need to wait a period of time before a specific action is performed. The RP6Library also provides functions for these purposes. It uses one of the MEGA32's timers to achieve relatively accurate delay control, which is independent from other program flow or interrupts which could disturb delay routines.
  • Page 84 The RP6 provides eight 16bit Stopwatches (Stopwatch1 to Stopwatch8), which may be started, stopped, set and read. As for the mSleep function we have chosen a resolu- tion of one millisecond, which implies each of these timers will increment its counter in intervals of 1ms.
  • Page 85 RP6 ROBOT SYSTEM - 4. Programming the RP6 We are using Stopwatch1 and Stopwatch2 here, which get started at lines 9 and 10 respectively. Afterwards the Stopwatch counters are running. The infinite loop (at lines 16 up to 37) constantly checks, whether the Stopwatches exceed a predefined level.
  • Page 86: Status Leds And Bumpers

    RP6 ROBOT SYSTEM - 4. Programming the RP6 setStopwatchX(uint16_t preset) This macro sets the counter of stopwatch X to a given value. Examples: setStopwatch1(2324); setStopwatch2(0); setStopwatch3(2); setStopwatch4(43456); getStopwatchX() This returns the counter level of stopwatch X. Examples: if(getStopwatch2() > 1000) { ... } if(getStopwatch6() >...
  • Page 87 LEDs are no longer illuminated after turning on the RP6...) ! There are a lot of things on the RP6 that have to be evaluated constantly in order to make them work correctly. For instance, the ACS needs to transmit IR pulses in spe- cific intervals and check for reception.
  • Page 88 RP6 ROBOT SYSTEM - 4. Programming the RP6 Now, as we are performing background tasks anyway, we can run some other (smal- ler) tasks as well along with the bigger things – such as bumper evaluation. This is a simple and fast task which you would usually perform in the main loop anyway.
  • Page 89 RP6 ROBOT SYSTEM - 4. Programming the RP6 C allows us to define pointers to functions and call these functions without pre-defin- ing the function in the library. Usually a function needs to be defined in our Library at the time of compilation in order to be callable.
  • Page 90 RP6 ROBOT SYSTEM - 4. Programming the RP6 The program will react on alterations of the bumper status once-only by outputting the current status of both bumpers. For example, if you press down the right bumper, the output would be: Bumper Status has changed: - Left bumper has not been activated.
  • Page 91: Read Adc Values (Battery, Motorcurrent And Light Sensors)

    Basically the 5V supply is used as reference voltage, but the function could be modi- fied such that the internal ATMEGA32's 2.56V reference voltage is used instead (see the MEGA32 data sheet). The standard RP6 sensors do not require this usually. It makes sense to perform several ADC measurements subsequently, to store the res- ults in an array and to calculate the average and/or Minimum/Maximum value before processing the ADC output any further.
  • Page 92 RP6 ROBOT SYSTEM - 4. Programming the RP6 In analogy to the bumper sensors, we may automatically perform ADC measurements and simplify the main program by using a comfortable function: void task_ADC(void) which will shorten the time required to evaluate all ADC channels in a program. Call- ing this function will subsequentially read all ADC channels in “background mode”...
  • Page 93: Acs - Anti Collision System

    4.6.6. ACS – Anti Collision System In contrast to the CCRP5, which used a small co-processor, the Anti Collision System of the RP6 has been directly implemented on the MEGA32. This architecture needs some more programming effort, but also allows custom modifications and adapta- tions.
  • Page 94 RP6 ROBOT SYSTEM - 4. Programming the RP6 #include "RP6RobotBaseLib.h" void acsStateChanged(void) writeString_P("The ACS-status has changed! "); if(obstacle_left) // Obstacle on the left writeChar('o'); else writeChar(' writeString_P(" | R: "); if(obstacle_right) // Obstacle on the right writeChar('o'); else writeChar(' if(obstacle_left && obstacle_right) // Obstacle in the middle? writeString_P("...
  • Page 95: Ircomm And Rc5 Functions

    If a remote control does not use RC5, the ACS could get malfunctional. A suitable software would allow the RP6 to be controlled by an IR remote control. And the IRCOMM may be used to transmit IR Signals as well. Both transmitting diodes at the robot's front panel are pointing upwards to the ceiling.
  • Page 96 RP6 ROBOT SYSTEM - 4. Programming the RP6 and robot's expansion boards mounted on the top). You will be able to extend the communication range by adding some more IR LEDs (for example controlled by anoth- er MOSFET with a large capacitor and a small series resistor).
  • Page 97: Power Saving Functions

    In previous chapters we have been using powerON(), but we did not describe its func- tionality. The RP6 has can save a bit power by deactivating the ACS, the encoder sys- tem, the motor current sensors and the PowerON LED. It saves roughly 10mA to de- activate these sensors.
  • Page 98 If the speed is too high, the voltage must be reduced. This method will quickly adjust the RP6's speed to a relatively constant PWM value (in which minor de- viations are quite normal). Speed control allows stabilizing speed independently of battery voltage, load (weight, surface conditions, slope, etc.) and manufacturing toler-...
  • Page 99 // has to be called for Motor current sensors! return ... and now RP6 will start moving directly! Of course the robot will not react on any obstacles and is moving forwards only! The system will only try to regulate the speed level and automatically adjust motor power –...
  • Page 100 RP6 ROBOT SYSTEM - 4. Programming the RP6 counted encoder-segments per second (corresponding to ca. 8 up to 70⋅5=350 8.7 cm/s – depending on the real encoder resolution). The minimal controllable rota- tional speed is around 10⋅5=50 and the maximal rotational speed is approximately 200⋅5=1000...
  • Page 101 RP6 ROBOT SYSTEM - 4. Programming the RP6 In this example program, the RP6 will first drive forwards – which is the default set- ting for movements after a reset. We are using one of the stopwatches to wait 4 seconds and then the direction is reversed.
  • Page 102 RP6 ROBOT SYSTEM - 4. Programming the RP6 The function: uint8_t isMovementComplete(void) can be used to check if movement-commands are completed. If there are unfinished movement-commands, the return value will be “false”. Whenever a move-command has to be aborted, e.g. at detection of an obstacle, you...
  • Page 103: Task_Rp6System()

    RP6 ROBOT SYSTEM - 4. Programming the RP6 In order to perform such sequential processes, we always have to set the blocking- parameter to true! You may even perform rudimentary reaction on obstacles with the blocking-parameters set to true – by using event handlers. These event handlers will be called anyway, no matter if the blocking parameter is set true! However this meth- od may fail in more complex situations.
  • Page 104: I²C Bus Functions

    RP6 ROBOT SYSTEM - 4. Programming the RP6 4.6.11. I²C Bus Functions At the end of this chapter we will focus on the I²C-Bus functions, which can be used for communication with other Microcontrollers and expansion modules. There are two versions of I²C-Bus functions – one for slave and another one for mas- ter mode.
  • Page 105 RP6 ROBOT SYSTEM - 4. Programming the RP6 The arrays and the variable for general calls are called: I2CTWI_readRegisters, I2CTWI_writeRegisters and I2CTWI_genCallCMD The readable registers are named I2CTWI_readRegisters and the writeable registers I2CTWI_writeRegisters. The I2CTWI_genCallCMD variable stores the most recently re- ceived General Call command.
  • Page 106 RP6 ROBOT SYSTEM - 4. Programming the RP6 This example shows how a very simple slave program could look like: #include "RP6RobotBaseLib.h" #include "RP6I2CslaveTWI.h" // Include the I2C Library file (!!!) // ATTENTION: do not forget to add this to the Makefile (!!!)
  • Page 107: I²C Master

    If you really need that fast communication, you can either try to set the 400kBit/s mode and see if it works properly with your specific slave devices or use the RP6 CONTROL M32 expansion module which is clocked at 16MHz. Usually it should also work with 8MHz as this is only a small timing issue.
  • Page 108 RP6 ROBOT SYSTEM - 4. Programming the RP6 void I2CTWI_transmitBytes(uint8_t targetAdr, uint8_t *msg, uint8_t numberOfBytes) Basically this function will transfer up to 20 Bytes to the specified address. For trans- ferring greater data blocks, you may increase the I2CTWI_BUFFER_SIZE constant in the Header file.
  • Page 109 RP6 ROBOT SYSTEM - 4. Programming the RP6 For example if you would like to read register 22 from a slave device with address 10: I2CTWI_transmitByte(10, 22); uint8_t result = I2CTWI_readByte(10); The following function allows you to read several bytes: void I2CTWI_readBytes(uint8_t targetAdr, uint8_t * messageBuffer, uint8_t numberOfBytes);...
  • Page 110 RP6 ROBOT SYSTEM - 4. Programming the RP6 Apart from the requestedDataReady Handler there is an Event Handler for error-pro- cessing. Whenever an error occurs in data transfers, e.g. by a non-responding slave, a special Event Handler will be called. It has to be registered with this function:...
  • Page 111: Example Programs

    With one of the example programs, the RP6 behaves like a moth and searches for bright light sources and avoids obstacles. However ex- plaining details about this would lead us far beyond the scope of this manual and for all advanced applications we have to refer to the relevant literature.
  • Page 112 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 1: “Hello World”-Program featuring a running LED-light Directory: <RP6Examples>\RP6BaseExamples\Example_01_LEDs\ File: RP6Base_LEDs.c The program will output messages on the serial interface, thus you should con- nect the robot to your PC and watch the output in the RobotLoader Terminal! The robot does not move in this example program! You may simply put the robot on a table next to your PC.
  • Page 113 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 3: Question-and-Answer Program Directory: <RP6Examples>\RP6BaseExamples\Example_02_UART_02\ File: RP6Base_SerialInterface_02.c This program will output messages on the serial interface The robot does not move in this example program! This more complex example is a little question-and-answer dialog, in which the robot will ask four simple questions and you may reply by entering any answer in the ter- minal.
  • Page 114 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 6: The Robot is driving in a circle Directory: <RP6Examples>\RP6BaseExamples\Example_05_Move_01\ File: RP6Base_Move_01.c ATTENTION: The robot will move in this example program! Please remove the cable between the PC and the robot after program upload and put the robot in a big free area! You must provide a free area of at least 1m x 1m or even 2m x 2m.
  • Page 115 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 9: Excursion – Finite state machines Directory: <RP6Examples>\RP6BaseExamples\Example_05_Move_04_FSM\ File: RP6Base_Move_04_FSM.c This program will output messages on the serial interface The robot does not move in this example program! For more complex programs, the simple methods we discussed so far may not be suf- ficient.
  • Page 116 RP6 ROBOT SYSTEM - 4. Programming the RP6 To show you the basic principle, this example has been reduced to its essentials. A state machine consists of different states and transitions between them. In our ex- ample we have four states: STATE_START and STATE_1 up to 3. We may also visual- ize the state machine above with the following graph: “S”...
  • Page 117 Status LED 5 is blinking. With this, the Robot wants to tell us: “Would somebody push the left Bumper, please?”. When you do this, RP6 moves backwards for about 15cm and Status LED 2 starts blinking. Obviously, you are now supposed to push the right Bumper, which lets the Robot move 15cm forwards again and the cycle starts from the beginning.
  • Page 118 RP6 ROBOT SYSTEM - 4. Programming the RP6 viour's outputs and forces the system to feed the motor-control with its own com- mands. Obviously “Escape” has higher priority than “Cruise”. With these two very basic behaviours, the robot will already start to cruise around and explore its' environment.
  • Page 119 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 13: LDRs – Light sensors Directory: <RP6Examples>\RP6BaseExamples\Example_06_LightDetection\ File: RP6Base_LightDetection.c This program will output messages on the serial interface The robot does not move in this example program! This sample program demonstrates how to use the two light sensors. In order to in- dicate which sensor is most intensely illuminated (or whether both sensors are illu- minated equally) we use the StatusLEDs.
  • Page 120 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 15: Remote control by using a universal RC5 IR RC Directory: <RP6Examples>\RP6BaseExamples\Example_08_TV_REMOTE\ File: RP6Base_TV_REMOTE.c ATTENTION: The robot will move in this example program! This example program enables you to control the robot just like a Remote Controlled Car by using a standard RC5 IR remote control.
  • Page 121 RP6 ROBOT SYSTEM - 4. Programming the RP6 Example 17: I²C Bus Interface – Master Mode Directory: <RP6Examples>\RP6BaseExamples\Example_I2C_MASTER_02\ File: RP6Base_I2C_MASTER_02.c This program demonstrates how to use the Master Mode of the I²C Bus. Of course you will have to connect a suitable slave device to the I²C Bus before running this program.
  • Page 122 Further example programs for robot control will soon be published along with expan- sion modules. A few of these programs and the RP6 CONTROL M32 examples are available on the CD-ROM already. - 122 -...
  • Page 123: Experiment Board

    You may easily assemble some flat cables to connect the module to your expansion boards. There are also the RP6-CC128 and M256 expansion modules, which are equally suit- able and can serve very complex designs. Of course, the robot's main board also provides 6 extension areas, which may be at- tractive for sensors that need to be as low over the floor as possible (e.g.
  • Page 124: Closing Words

    Of course we plan to develop some more expansion modules for the RP6. We already released the experiment module and the RP6 CONTROL M32 providing another MEGA- 32 Controller (including a microphone sensor, piezo sounder, a hughe external 32KB EEPROM memory, keys, LEDs and a LCD Port).
  • Page 125: Appendix

    MEGA32 in reset mode, which does not allow the controller to turn on any of the LEDs. Always start by connecting the USB Interface to the PC before connecting it to the RP6! The same problem may occur if the PC has been switched off.
  • Page 126 RP6 ROBOT SYSTEM - APPENDIX 3. While moving, the robot repeatedly generates resets and halts the pro- gram! The batteries do not provide the system with enough power! ● The batteries are malfunctioning (poor quality or too old) and causing ●...
  • Page 127 RP6 ROBOT SYSTEM - APPENDIX 6. The robot generates strange noises when moving! Strange noises may have several reasons. You will have to open the robot to ● check the gears and motors. The power cables may have moved into the...
  • Page 128 (=variable resisters) to adjust the sensors (use a fine 1.8mm slot screwdriver or a suitable cross slot screwdriver! BUT BE VERY CAREFUL (for RP6, RP6v2 is quite robust and easy to adjust). The self-test program will show if the encoders work properly. We provided the program with a special mode (c - Duty Cycle Test) to check the duty cycle for the square wave signal.
  • Page 129 ● ordered through Conrad Webshop. In case of a defect under warranty period you may directly get replacement parts from AREXX. This is also true for parts that Conrad does offer. On the picture on this page you ●...
  • Page 130 RP6 ROBOT SYSTEM - APPENDIX 9. My battery charger does not charge the batteries inside the robot! Did you correctly connect the battery charger? Check polarities of cables, ● and plugs. Did you correctly insert the batteries? Check for defective or loose contacts.
  • Page 131 RP6 ROBOT SYSTEM - APPENDIX 12. The robot fails to exactly turn a specific angle. This is normal behaviour and the manual already explained the reasons for ● these deviations! Caterpillar drive units will always cause deviations by slip- ping and sliding. Also the Encoders have to be calibrated in order to work as intended.
  • Page 132 ● but sometimes it does not... Did you already download the latest software versions and the recent manu- ● al version from http://www.arexx.com/ or from the RP6 homepage http://www.arexx.com/rp6 ? Did you use the search function of our forum? ●...
  • Page 133: B - Encoder Calibration

    RP6 ROBOT SYSTEM - APPENDIX B – Encoder calibration The effective encoder's resolution depends on the real wheel and rubber track diamet- er. The caterpillar's rubber tracks get pressed into the surface or get impressed them- self. Additionally, manufacturing tolerances cause variations in diameter sizes. To compensate for these deviations we will have to perform some measurements and calibrate the encoder resolution.
  • Page 134 20 (or page 24, respectively in the PDF-version) or in: http://www.eecs.umich.edu/~johannb/paper53.pdf We might design a similar construction for the RP6 (though it will not be easy) – al- ternatively you may consider to start some experiments by fixing an optical computer mouse on the robot's rear or front.
  • Page 135: C - Connector Pinouts

    RP6 ROBOT SYSTEM - APPENDIX C – Connector pinouts This overviews provides you with the most important connector pinouts on the main- board. Additionally we extended the list by a number of details for usage. For the sake of completeness we start by defining the con- nector pin assignments for the expansion connector once again (s.
  • Page 136 5V supply voltage. On the new RP6v2 there is already a 220µF electrolytic capacitor in the power supply line. On the old RP6 it might be wise to solder a big electrolytic capacitor to the mainboard – values from 220 up to a 470µF (do not exceed this value! The capacitor's operating voltage should be bigger...
  • Page 137 RP6 ROBOT SYSTEM - APPENDIX New Connectors on the RP6v2 The RP6v2 has several additional connectors. Close to the voltage regulator IC1 there are two 4 pin +5V power connectors, which are ideal to supply large loads (Servos, LED spots or similar). There is also a 3 pin connector for +UB (unregulated battery voltage).
  • Page 138: D - Recycling And Safety Instructions

    D – Recycling and Safety instructions Recycling Disposal of the RP6 in domestic waste is not allowed! For disposal, the robot must be delivered to the local recycling centre or any other recycling centre for electronics! Please ask you local sales contact for details.

This manual is also suitable for:

Rp6-baseRp6v2-base

Table of Contents