Elisa 3
From GCtronic Wiki
Contents |
Overview
Elisa 3 is an evolution of the Elisa robot based on a different microcontroller and including a comprehensive set of sensors:
- Atmel 2560 microcontroller (Arduino compatible)
- central RGB led
- 8 green leds around the robot
- IRs emitters
- 8 IR proximity sensors (Vishay Semiconductors Reflective Optical Sensor)
- 4 ground sensors (Fairchild Semiconductor Minature Reflective Object Sensor)
- 3-axis accelerometer (Freescale MMA7455L)
- RF radio for communication (Nordic Semiconductor nRF24L01+)
- micro USB connector for programming, debugging and charging
- IR receiver
- 2 DC motors
- top light diffuser
- selector
The robot is able to self charge using the charger station, as shown in the right side figure. The following figure illustrates the position of the various sensors:
Robot charging
The Elisa 3 can be piloted in the charger station in order to be automatically self charged; there is no need to unplug the battery for charing. The following figures shows the robot approaching the charger station; a led indicates that the robot is in charge:
The microcontroller is informed when the robot is in charge and this information is also transferred to the PC in the flags byte; this let the user be able to pilote the robot to the charger station and be informed when it is actually in charge. More information about the radio protocol can be found in the section Communication.
Moreover the robot is also charged when the micro USB cable is connected to a computer; pay attention that if the USB cable is connected to a hub, this one need to be power supplied.
The following video shows the Elisa 3 piloted through the radio to the charging station using the monitor application:
Hardware
The following figures show the main components offered by the Elisa 3 robot and where they are physically placed:
Power autonomy
The robot is equipped with two batteries for a duration of about 3 hours at normal usage (motors run continuously, IRs and RGB leds turned on).
Detailed specifications
| Feature | Technical information |
| Size, weight | 50 mm diameter, 30 mm height, 39 g |
| Battery, autonomy | LiIPo rechargeable battery (2 x 130 mAh, 3.7 V). About 3 hours autonomy. Recharging time about 1h e 30. |
| Processor | Atmel ATmega2560 @ 8MHz (~ 8 MIPS); 8 bit microcontroller |
| Memory | RAM: 8 KB; Flash: 256 KB; EEPROM: 4 KB |
| Motors | 2 DC motors with a 25:1 reduction gear; speed controlled with backEMF |
| Magnetic wheels | Adesion force of about 1 N (100 g) depending on surface material and painting Wheels diamater = 9 mm Distance between wheels = 40.8 mm |
| Speed | Max: 60 cm/s |
| Mechanical structure | PCB, motors holder, top white plastic to diffuse light |
| IR sensors | 8 infra-red sensors measuring ambient light and proximity of objects up to 6 cm; each sensor is 45° away from each other 4 ground sensors detecting the end of the viable surface (placed on the front-side of the robot) |
| IR emitters | 3 IR emitters (2 on front-side, 1 on back-side of the robot) |
| Accelerometer | 3D accelerometer along the X, Y and Z axis |
| LEDs | 1 RGB LED in the center of the robot; 8 green LEDs around the robot |
| Switch / selector | 16 position rotating switch |
| Communication | Standard Serial Port (up to 38kbps) Wireless: RF 2.4 GHz; the throughput depends on number of robot: eg. 250Hz for 4 robots, 10Hz for 100 robots; up to 10 m |
| Remote Control | Infra-red receiver for standard remote control commands |
| Expansion bus | Optional connectors: 2 x UART, I2C, 2 x PWM, battery, ground, analog and digital voltage |
| Programming | C/C++ programming with the AVR-GCC compiler (WinAVR for Windows). Free compiler and IDE (AVR Studio / Arduino) |
Communication
The radio base-station is connected to the PC through USB and transfers data to and from the robot wirelessly. In the same way the radio chip (nRF24L01+) mounted on the robot communicates through SPI with the microcontroller and transfers data to and from the PC wirelessly.
The robot is identified by an address that is stored in the last two bytes of the microcontroller internal EEPROM; the robot firmware setup the radio module reading the address from the EEPROM. This address corresponds to the robot id written on the label placed under the robot and should not be changed.
Packet format - PC to robot
The 13 bytes payload packet format is shown below (the number in the parenthesis expresses the bytes):
| Command (1) | Red led (1) | Blue led (1) | Green led (1) | IR + Flags (1) | Right motor (1) | Left motor (1) | Small green leds (1) | Remaining 6 bytes are unused |
- Command: 0x27 = change robot state; 0x28 = goto base-station bootloader
- Red, Blue, Green leds: values from 0 (OFF) to 100 (ON max power)
- IR + flags:
- first two bits are dedicated to the IRs:
- 0x00 => all IRs off
- 0x01 => back IR on
- 0x02 => front IRs on
- 0x03 => all IRs on
- third bit is reserved for enabling/disablng IR remote control (0=>diabled, 1=>enabled)
- fourth bit is used for sleep (1 => go to sleep for 1 minute)
- fifth bit is used to calibrate all sensors (proximity, ground, accelerometer)
- sixth bits is reserved (used by radio station)
- seventh bit is used for enabling/disabling onboard obstacle avoidance
- eight bit is used for enabling/disabling onboard cliff avoidance
- first two bits are dedicated to the IRs:
- Right, Left motors: speed (in percentage); MSBit indicate direction: 1=forward, 0=backward; values from 0 to 100
- Samll green leds: each bit define whether the corresponding led is turned on (1) or off (0); e.g. if bit0=1 then led0=on
- Remaining bytes free to be used
Optimized protocol
The communication between the pc and the base-station is controlled by the master (computer) that continuously polls the slave (base-station); the polling is done once every millisecond and this is a restriction on the maximum communication throughput. To overcome this limitation we implemented an optimized protocol in which the packet sent to the base-station contains commands for four robots simultaneously; the base-station then seperate the data and send them to the correct robot address. The same is applied in reception, that is the base-station is responsible of receiving the ack payloads of 4 robots (64 bytes in total) and send them to the computer. This procedue let us have a throughput 4 times faster.
Packet format - robot to PC
The robot send back to the base-station information about all its sensors every time it receive a command; this is accomplished by using the "ack payload" feature of the radio module. Each "ack payload" is 16 bytes length and is marked with an ID that is used to know which information the robot is currently transferring. The sequence is the following (the number in the parenthesis expresses the bytes):
| ID=3 (1) | Prox0 (2) | Prox1 (2) | Prox2 (2) | Prox3 (2) | Prox5 (2) | Prox6 (2) | Prox7 (2) | Flags (1) |
| ID=4 (1) | Prox4 (2) | Ground0 (2) | Ground1 (2) | Ground2 (2) | Ground3 (2) | AccX (2) | AccY (2) | TV remote (1) |
| ID=5 (1) | ProxAmbient0 (2) | ProxAmbient1 (2) | ProxAmbient2 (2) | ProxAmbient3 (2) | ProxAmbient5 (2) | ProxAmbient6 (2) | ProxAmbient7 (2) | Selector(1) |
| ID=6 (1) | ProxAmbient4(2) | GroundAmbient0 (2) | GroundAmbient1 (2) | GroundAmbient2 (2) | GroundAmbient3 (2) | AccZ(2) | Battery(2) | Free(1) |
Pay attention that the base-station could return "error" codes in the first byte if the communication has problems:
- 0 => transmission succeed (no ack received though)
- 1 => ack received (should not be returned because if the ack is received, then the payload is read)
- 2 => transfer failed
The Flags byte contains these information:
- bit0: 0 = robot not in charge; 1 = robot in charge
- bit1: 0 = button pressed; 1 = button not pressed
- bit2: 0 = robot not charged completely; 1 = robot charged completely
- the remainig bits are not used at the moment
Software
Robot
AVR Studio 4 project
The project is built with AVR Studio 4 released by Atmel.
The project source can be downloaded from Elisa 3 firmware source; the hex file can be directly downloaded from Elisa 3 firmware hex.
Selector position:
- 0: no speed controller activated => free running (all others positions have the speed controller activated)
- 1: obstacle avoidance enabled
- 2: cliff avoidance enabled (currently it will simply stop before falling and stay there waiting for commands)
- 3: both obstacle and cliff avoidance enabled
- 4: random RGB colors and small green leds on
- 5: robot moving forward with obstacle avoidance enabled and random RGB colors
Arduino IDE project
The project is built with the Arduino IDE 1.0 freely available from the official Arduino website. In order to build the Elisa 3 firmware with the Arduino IDE 1.0 the following steps has to be performed:
- download the Arduino IDE 1.0 and extract it, let say in a folder named "arduino-1.0"
- download the Elisa 3 library and extract it within the libraries folder of the Arduino IDE, in this case "arduino-1.0\libraries"; you should end up with a "Elisa3" folder within the libraries. If you start the Arduino IDE now you can see that the Elisa 3 library is available in the menu "Sketch=>Import Library..."
- download the boards.txt file containing the definitions for the Elisa 3 robot and place it in the Arduino IDE in the folder "arduino-1.0\hardware\arduino" replacing the existing one
- download the Elisa 3 project file and open it with the Arduino IDE (you should open the file "elisa3.ino")
- select "Elisa 3 robot" from the "Tools=>Board" menu; click on the "Verify" button to build the project
- to upload the resulting hex file, attach the micro usb and set the port from the "Tools=>Serial Port" menu consequently; turn on the robot and click on the "Upload" button
Aseba
Aseba is a set of tools which allow novices to program robots easily and efficiently, refere to https://aseba.wikidot.com/ for more information.
Onboard behaviors
The released firmware contains two basic onboard behaviors: obstacle and cliff avoidance. Both can be enabled and disabled from the computer through the radio (seventh bit of flags byte for obstacle avoidance, eight bit of flags byte for cliff avoidance). The following videos show three robots that have their obstacle avoidance enabled:
Progamming
The robot is pre-programmed with a seial bootloader. In order to upload a new program to the robot a micro USB cable is required. The connection with the robot is shown below:
The avrdude utility is used to do the upload, the command to use is:
avrdude -p m2560 -P COM10 -b 57600 -c stk500v2 -D -Uflash:w:ElisaII-avr-studio.hex:i -v
where COM10 must be replaced with your com port and ElisaII-avr-studio.hex must be replaced with your application name.
Internal EEPROM
The internal 4 KB EEPROM that resides in the microcontroller is pre-programmed with the robot ID in the last two bytes (e.g. if ID=3200 (0x0C80), then address 4094=0x80 and address 4095=0x0C). The ID represents also the RF address that the robot uses to communicate with the computer and is automatically read at startup (have a look a the firmware for more details).
In order to program the eeprom an AVR programmer is required, we utilize the Pocket AVR Programmer from Sparkfun (recognized as USBtiny device); then with the avrdude utility the following command has to be issued:
avrdude -p m2560 -c usbtiny -v -U eeprom:w:Elisa3-eeprom.hex:i -v -B 1
where Elisa3-eeprom.hex is the EEPROM memory saved as Intel Hex format (eeprom example); a possible tool to read and write Intel Hex format is Galep32 from Conitec Datensysteme.
Alternatively a program designed to writing to these EEPROM locations can be uploaded to the robot, in case an AVR programmer isn't available. The project source can be downloaded from Elisa3-eeprom-write.zip; it is simply needed to modify the address, rebuild and upload to the robot.
Base-station
Refer to section http://www.gctronic.com/doc/index.php/Elisa#Base-station of the Elisa robot wiki.
Multiplatform monitor (pc side)
The demo is a command line monitor that shows all the sensors information (e.g. proximity, ground, acceleromter, battery, ...) and let the user move the robot and change its colors and behavior with the keyboard. The data are sent using the protocol described in the previous section.
The following figures show the monitor on the left and the available commands on the right.
Windows
The project is built with Code::Blocks (mingw) and requires libusb-1.0 since it is used to communicate with the radio base-station: http://libusb-winusb-wip.googlecode.com/files/libusb_2011.07.06.7z.
The source can be downloaded from pc-side-demo.
Execution:
- install the driver contained in the nRFgo Studio tool if not already done; this let the base-station be recognized as a WinUSB device (bootloader), independently of whether the libusb library is installed or not
- once the driver is installed, the pre-compiled "exe" (under \bin\Debug dir) should run without problems; anyway the program need the robot address (robot id written on its label) to be passed as argument
Compilation:
- within the libusb-1.0 package you'll find the header "libusb.h" (under /include/libusb-1.0/) and the library "libusb-1.0.a" (in this case under /MinGW32/static/ since we use MinGW) that should be copied or referenced in the compiler headers/libraries
- add the linker flag "-lusb-1.0" in the project in order to build successfully (the Code::Blocks project has already set it)
Linux
The project was tested to work also in Ubuntu (no driver required); the source can be downloaded from pc-side-demo.
Compilation:
- required libraries: libusb-1.0, libusb-1.0-dev, libncurses5, libncurses5-dev
- build command: gcc -o main_linux main.c -lusb-1.0 -lncurses
Execution:
- sudo ./main_linux robot_address (e.g. sudo ./main_linux 3200)
Mac OS X
The project was tested to work also in Mac OS X (no driver required); the source can be downloaded from pc-side-demo.
Compilation:
- required libraries: libusb-1.0, libusb-1.0-dev, libncurses5, libncurses5-dev
- build command: gcc main.c -o main_mac -I/opt/local/include/libusb-1.0 -L/opt/local/lib -lusb-1.0 -lncurses
Execution:
- ./main_mac robot_address (e.g. ./main_mac 3200)
Demos
Obstacle avoidance
This demo implements the obstacle avoidance behavior controlling the robot from the pc through the radio; this means that the robot reacts only to the commands received using the basic communication protocol and has no intelligence onboard. The demo uses the information gathered from the 3 front proximity sensors and set the motors speed accordingly; moreover the rgb leds are updated with a random color at fixed intervals.
The source can be downloaded from pc-side-obstacle-avoidance (Code::Blocks project); the following video shows the result:
Cliff avoidance
This demo implements the cliff avoidance behavior controlling the robot from the pc through the radio; as with the obstacle avoidance demo, the robot reacts only to the commands received from the radio. The demo uses the information gathered from the 4 ground sensors to stop the robot when a cliff is detected (threshold tuned to run in a white surface); moreover the rgb leds are updated with a random color at fixed intervals.
The source can be downloaded from pc-side-cliff-avoidance (Code::Blocks project); the following video shows the result:
Videos
The following videos show 3 Elisa-3 robots moving around in the environment avoiding obstacles thanks to their proximity sensors and then going to the charging station autonomously; some black tape is placed in the charging positions to help the robots place themselves thanks to their ground sensors.




