# elisa-3 — GCtronic wiki

> Documentation for the Elisa-3 robot. Elisa-3 is the successor of the older Elisa robot: do not apply Elisa information to Elisa-3.
>
> Generated 2026-10-08 13:11 UTC from https://www.gctronic.com/doc/index.php. Pages in this file: 2.
>
> When answering questions from this file, use only its content, cite the page and section you rely on together with its direct link (the "Link:" line under each section heading), and say explicitly when the answer is not here.

## Contents

- Elisa-3 (https://www.gctronic.com/doc/index.php?title=Elisa-3)
- Elisa-3 Aseba (https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba)

---

# Elisa-3

Source: https://www.gctronic.com/doc/index.php?title=Elisa-3
Last edited: 2026-07-22T13:32:24Z

# Overview

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Overview

![Elisa3_and_charger.JPG](https://www.gctronic.com/doc/images/b/b4/Elisa3_and_charger.JPG)
Elisa-3 is an evolution of the [Elisa](https://www.gctronic.com/doc/index.php/Elisa) robot based on a different microcontroller and including a comprehensive set of sensors:

- [Atmel 2560](https://projects.gctronic.com/elisa3/atmega640-1280-1281-2560-2561_datasheet.pdf) microcontroller (Arduino compatible)
- central RGB led
- 8 green leds around the robot
- IRs emitters
- 8 IR proximity sensors ([Vishay Semiconductors Reflective Optical Sensor](https://projects.gctronic.com/elisa3/tcrt1000.pdf))
- 4 ground sensors ([Fairchild Semiconductor Minature Reflective Object Sensor](https://projects.gctronic.com/elisa3/QRE1113-D.PDF))
- 3-axis accelerometer ([Freescale MMA7455L](https://projects.gctronic.com/elisa3/MMA7455L.pdf))
- RF radio for communication ([Nordic Semiconductor nRF24L01+](https://www.nordicsemi.com/kor/Products/2.4GHz-RF/nRF24L01P))
- 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 previous figure. The following figure illustrates the position of the various sensors:
![Elisa3-mainComp-digital-white.png](https://www.gctronic.com/doc/images/9/99/Elisa3-mainComp-digital-white.png)

## Useful information

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Useful_information

- the top light diffuser and robot are designed to lock together, but the diffuser isn't fixed and can thus be removed as desired; the top light diffuser, as the name suggests, helps the light coming from the RGB led to be smoothly spread out, moreover the strip attached around the diffuser let the robot be better detected from others robots. Once the top light diffuser is removed, pay attention not to look at the RGB led directly. In order to remove the top light diffuser simply pull up it, then to place it back on top of the robot remember to align the 3 holes in the diffuser with the 3 IRs emitters and push down carefully untill the diffuser is stable; pay attention to not apply too much force on the IRs emitters otherwise they can bend and stop working.

![Diffuser-pull-up.jpg](https://www.gctronic.com/doc/images/c/cb/Diffuser-pull-up.jpg) ![Diffuser-push-down.jpg](https://www.gctronic.com/doc/images/0/0e/Diffuser-push-down.jpg)

- when the top light diffuser is fit on top of the robot, then in order to change the selector position you can use the tweezers; the selector is located near the front-left IR emitter, as shown in the following figure:

![selector-tweezers.jpg](https://www.gctronic.com/doc/images/d/d4/selector-tweezers.jpg)

- if you encounter problems with the radio communication (e.g. lot of packet loss) then you can try moving the antenna that is a wire near the robot label. Place the antenna as high as possible, near the plastic top light diffuser; try placing it in the borders in order to avoid seeing a black line on the top light diffuser when the RGB led is turned on.

![Antenna-position.jpg](https://www.gctronic.com/doc/images/c/c5/Antenna-position.jpg) ![Antenna-diffuser.jpg](https://www.gctronic.com/doc/images/9/94/Antenna-diffuser.jpg)

## Robot charging

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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:

![Elisa3-charger-out.jpg](https://www.gctronic.com/doc/images/e/e8/Elisa3-charger-out.jpg) ![Elisa3-charger-in.jpg](https://www.gctronic.com/doc/images/9/99/Elisa3-charger-in.jpg)

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](https://www.gctronic.com/doc/index.php/Elisa-3#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:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

## Top light diffuser

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Top_light_diffuser

From February 2013 onwards the Elisa-3 is equipped with a new top light diffuser designed to fit perfectly in the 3 IRs emitters of the robot. The diffuser is made of plastic (3d printed), it is more robust and it simplifies the removal and insertion. Here is an image:
![elisa3-new-case.jpg](https://www.gctronic.com/doc/images/e/e5/elisa3-new-case.jpg)

# Hardware

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Hardware

The following figures show the main components offered by the Elisa-3 robot and where they are physically placed:
![Elisa3.1-hw-schema-top.jpg](https://www.gctronic.com/doc/images/7/70/Elisa3.1-hw-schema-top.jpg)
![Elisa3-hw-schema-bottom3.jpg](https://www.gctronic.com/doc/images/1/1f/Elisa3-hw-schema-bottom3.jpg)

## Power autonomy

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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).
![Power-autonomy.jpg](https://www.gctronic.com/doc/images/9/9b/Power-autonomy.jpg)

## Detailed specifications

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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](https://winavr.sourceforge.net/) for Windows). Free compiler and IDE (AVR Studio / Arduino) |

# Communication

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Communication

## Wireless

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Wireless

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+](https://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01P)) 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.
![Elisa-communication.jpg](https://www.gctronic.com/doc/images/7/73/Elisa-communication.jpg)

### Packet format - PC to radio to robot

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Packet_format_-_PC_to_radio_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) | Flags2 (1) | Reserved (1) | Remaining 4 bytes are unused |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |

- Command: 0x27 = change robot state; 0x28 = goto base-station bootloader (this byte is not sent to the robot)
- 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/disabling IR remote control (0=>disabled, 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) and reset odometry
  - sixth bit 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
- Right, Left motors: speed expressed in 1/5 of mm/s (i.e. a value of 10 means 50 mm/s); MSBit indicate direction: 1=forward, 0=backward; values from 0 to 127
- Small green leds: each bit define whether the corresponding led is turned on (1) or off (0); e.g. if bit0=1 then led0=on
- Flags2:
  - bit0 is used for odometry calibration
  - remaining bits unused
- Remaining bytes free to be used

#### Optimized protocol

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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 separate 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 procedure let us have a throughput 4 times faster.

### Packet format - robot to radio to PC

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Packet_format_-_robot_to_radio_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) |
|  |  |  |  |  |  |  |  |  |
| ID=7 (1) | LeftSteps (4) | RightSteps (4) | theta (2) | xpos (2) | ypos (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

Packet ID 3:

- Prox* contain values from 0 to 1023, the greater the values the nearer the objects to the sensor
- 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

Packet ID 4:

- Prox4 contains values from 0 to 1023, the greater the values the nearer the objects to the sensor
- Ground* contain values from 512 to 1023, the smaller the value the darker the surface
- AccX and AccY contain raw values of the accelerometer; the range is between -128 and 128, sensitivity is +-2g
- TV remote contains the last interpreted command received through IR

Packet ID 5:

- ProxAmbient* contain values from 0 to 1023, the smaller the values the brighter the ambient light
- Selector contains the value of the current selector position

Packet ID 6:

- ProxAmbient4 contains values from 0 to 1023, the smaller the values the brighter the ambient light
- GroundAmbient* contain values from 0 to 1023, the smaller the values the brighter the ambient light
- AccZ contains raw values of the accelerometer; the range is between -128 and 128, sensitivity is +-2g
- Battery contains the sampled value of the battery, the values range is between 780 (battery discharged) and 930 (battery charged)

Packet ID 7:

- LeftSteps and RightSteps contain the sum of the sampled speed for left and right motors respectively (only available when the speed controller isn't used; refer to xpos, ypos and theta when the speed controller is used)
- theta contains the orientation of the robot expressed in 1/10 of degree (3600 degrees for a full turn); available only when the speed controller is enabled
- xpos and ypos contain the position of the robot expressed in millimeters; available only when the speed controller is enabled

## USB cable

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#USB_cable

You can directly connect the robot to the computer to make a basic functional test. You can find the source code in the following link [Elisa3-global-test.zip](https://projects.gctronic.com/elisa3/Elisa3-global-test.zip) (Windows).
To start the test follow these steps:

1. put the selector in position 6
2. connect the robot to the computer with the USB cable and turn it on
3. run the program, insert the correct COM port and choose option 1

With the same program you can also change the ID of the robot by choosing option 2 in the last step (not recommended).

Via USB cable you can also program the robot with [Aseba](https://www.gctronic.com/doc/index.php?title=Elisa-3#Aseba).

# Software

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Software

## Robot

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Robot

### Requirements

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Requirements

In order to communicate with the robot through the micro USB the FTDI driver need to be installed. If a serial port is automatically created when connecting the robot to the computer you're done otherwise you need to download the drivers for your system and architecture:

- [Windows Vista/XP](https://www.ftdichip.com/Drivers/CDM/CDM%20v2.10.00%20WHQL%20Certified.exe), [Windows 7/8/10 (run as administrator)](https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.10%20WHQL%20Certified.exe)
- Ubuntu: when the robot is connected the port will be created in `/dev/ttyUSB0` (no need to install a driver)
- [Mac OS X 10.3 to 10.8 (32 bit)](https://www.ftdichip.com/drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg), [Mac OS X 10.3 to 10.8 (64 bit)](https://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg), [Mac OS X 10.9 and above](https://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_3.dmg); after installing the driver the port will be created in `/dev/tty.usbserial-...`; you can find a guide on how to install the driver in the following link [AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf](https://www.ftdichip.com/Support/Documents/AppNotes/AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf)

All the drivers can be found in the official page from the following link [FTDI drivers](https://www.ftdichip.com/Drivers/VCP.htm).
Starting from robot ID 3823 the USB to serial chip can be one of the following: FTDI, [Cypress CY7C65213](https://projects.gctronic.com/elisa3/CypressDriverInstaller_1.exe) or Silicon Labs CP2102 ([Windows 10 or later](https://projects.gctronic.com/elisa3/CP210x_Universal_Windows_Driver.zip), [Windows 7](https://projects.gctronic.com/elisa3/CP210x_Windows_Drivers.zip)); this is due to chips availability.

### AVR Studio 4 project

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#AVR_Studio_4_project

The projects are built with [AVR Studio 4](https://projects.gctronic.com/elisa3/AvrStudio4Setup.exe) released by Atmel.
The projects should be compatible also with newer versions of Atmel Studio (last version known as Microchip Studio), the last version is available from <https://www.microchip.com/mplab/avr-support/avr-and-sam-downloads-archive>.

#### Basic demo

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Basic_demo

This project is thought to be a starting point for Elisa-3 newbie users and basically contains a small and clean main with some basic demos selected through the hardware selector that show how to interact with robot sensors and actuators.
The project source can be downloaded from the repository <https://github.com/gctronic/elisa3_firmware_basic>; the hex file can be directly downloaded from [Elisa-3 basic firmware hex](https://projects.gctronic.com/elisa3/elisa3-firmware-basic_ffb3947_21.03.18.hex). To program the robot refer to section [Programming](https://www.gctronic.com/doc/index.php/Elisa-3#Programming).
Selector position and related demo:

- 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

#### Advanced demo

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Advanced_demo

This is an extension of the *basic demo project*, basically it contains some additional advanced demos.
The project source can be downloaded from the repository <https://github.com/gctronic/elisa3_firmware_advanced.git>; the hex file can be directly downloaded from [Elisa-3 advanced firmware hex](https://projects.gctronic.com/elisa3/elisa3-firmware-advanced_96c355a_13.03.18.hex). To program the robot refer to section [Programming](https://www.gctronic.com/doc/index.php/Elisa-3#Programming).
Selector position and related demo:

- 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
- 6: robot testing and address writing through serial connection (used in production)
- 7: automatic charging demo (refer to section [Videos](https://www.gctronic.com/doc/index.php/Elisa-3#Videos)), that is composed of 4 states:
  - random walk with obstacle avoidance
  - search black line
  - follow black line that lead to the charging station
  - charge for a while
- 8: autonomous odometry calibration (refer to section [Autonomous calibration](https://www.gctronic.com/doc/index.php/Elisa-3#Autonomous_calibration))
- 9: write default odometry calibration values in EEPROM (hard-coded values); wait 2 seconds before start writing the calibration values
- 10: robot moving forward (with pause) and obstacle avoidance enabled; random RGB colors and green led effect
- 11: local communication: robot alignment
- 12: local communication: 2 or more robots exchange data sequentially
- 13: local communication: listen and transmit continuously; when data received change RGB color
- 14: local communication: RGB color propagation
- 15: clock calibration (communicate with the PC through the USB cable to change the OSCCAL register); this position could also be used to remote contol the robot through the radio (only speed control is enabled)

#### Atmel Studio 7 / Microchip Studio

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Atmel_Studio_7_/_Microchip_Studio

If you are working with Atmel Studio 7 / Microchip Studio, you can simply use the provided AVR Studio 4 projects by importing them directly in Atmel Studio 7 / Microchip Studio: `File => Import => AVR Studio 4 Project`, then select `Elisa3-avr-studio.aps` and click on `Convert`.

If you are asked to update some components (see following figure), then agree:
![atmel-studio-convert.png](https://www.gctronic.com/doc/images/8/86/atmel-studio-convert.png)

Then click on `Build => Clean solution` and then `Build => Build solution`.

If you experience problems during the building, make sure you have the correct toolchain installed: you can download WinAVR toolchain from [WinAVR-20100110-install.exe](https://projects.gctronic.com/elisa3/WinAVR-20100110-install.exe).
Close and open again Atmel/Microchip Studio and verify that the new toolchain is recognized and that the path is correct: `Tools => Options` and on the left panel select `Toolchain => Package Configuration`. Select on top `Atmel AVR 8-bit (C language)`, then `WinAVR` flavour and verify the path corresponds to the WinAVR installation path. The following figure shows the toolchain configuration:
![elisa3-atmelstudio1.png](https://www.gctronic.com/doc/images/5/55/elisa3-atmelstudio1.png)

Finally verify the project is using the WinAVR toolchain: `right click on the project name => Properties`, on the left panel select `Advanced` and verify that `Toolchain Flavour` is set to WinAVR. Press `CTRL+S` to save your project configuration changes. The following figures show the project configuration:
![elisa3-atmelstudio2.png](https://www.gctronic.com/doc/images/2/27/elisa3-atmelstudio2.png) ![elisa3-atmelstudio3.png](https://www.gctronic.com/doc/images/a/a9/elisa3-atmelstudio3.png)

### Arduino IDE project

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Arduino_IDE_project

The project is built with the Arduino IDE 1.x freely available from the [official Arduino website](https://arduino.cc/). In order to build the Elisa-3 firmware with the Arduino IDE 1.x the following steps has to be performed:

- 1. download the [Arduino IDE 1.x](https://arduino.cc/hu/Main/Software) (the last known working version is 1.8.9, refer to [Arduino Software](https://www.arduino.cc/en/Main/OldSoftwareReleases#previous)) and extract it, let say in a folder named `arduino-1.x`
- 2. download the [Elisa-3 Arduino library](https://projects.gctronic.com/elisa3/elisa3_arduino_library_03.02.25_65964ed.zip) and extract it within the libraries folder of the Arduino IDE, in this case `arduino-1.x\libraries` (see [Find-sketches-libraries-board-cores-and-other-files-on-your-computer](https://support.arduino.cc/hc/en-us/articles/4415103213714-Find-sketches-libraries-board-cores-and-other-files-on-your-computer) for more information on Arduino useful paths); 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...` (or `Sketch=>Include Lirary` in later IDE versions).
   In later versions of Arduino IDE you can also install the library via menu: `Sketch=>Include Library=>Add .ZIP library`, for more info have a look at [importing-a-zip-library](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries#importing-a-zip-library).
- 3. the file `boards.txt` in the Arduino IDE folder `arduino-1.x\hardware\arduino` (or `arduino-1.x\hardware\arduino\avr` or `Users\{username}\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6` in later IDE versions) need to be changed to contain the definitions for the Elisa-3 robot, add the following definitions at the end of the file:

```
##############################################################

elisa3.name=Elisa 3 robot

elisa3.upload.tool=avrdude
elisa3.upload.tool.serial=avrdude
elisa3.upload.protocol=stk500v2
elisa3.upload.maximum_size=258048
elisa3.upload.speed=57600

elisa3.bootloader.low_fuses=0xE2
elisa3.bootloader.high_fuses=0xD0
elisa3.bootloader.extended_fuses=0xFF
elisa3.bootloader.path=stk500v2-elisa3
elisa3.bootloader.file=stk500v2-elisa3.hex
elisa3.bootloader.unlock_bits=0x3F
elisa3.bootloader.lock_bits=0x0F

elisa3.build.mcu=atmega2560
elisa3.build.f_cpu=8000000L
elisa3.build.board=AVR_ELISA3
elisa3.build.core=arduino
elisa3.build.variant=mega

##############################################################
```

- 4. this step need to be performed only with later IDE versions, when you receive a warning like this `Bootloader file specified but missing...` during compilation.
   In this case place the bootloader hex file (`stk500v2.hex`) you can find in the [Bootloader section](https://www.gctronic.com/doc/index.php/Elisa-3#Bootloader) in the directory `arduino-1.x\Arduino\hardware\arduino\avr\bootloaders\` and name it `stk500v2-elisa3.hex`
- 5. download the [Elisa-3 project file](https://projects.gctronic.com/elisa3/elisa3_arduino_project_02.03.21_d2c017e.zip) and open it with the Arduino IDE (you should open the file "*elisa3.ino*")
- 6. select `Elisa-3 robot` from the `Tools=>Board` menu; click on the `Verify` button to build the project
- 7. turn on the robot, attach the micro USB and wait the blinks terminate.
- 8. to upload the resulting hex file, from the Arduino IDE set the port from the `Tools=>Serial Port` menu consequently; click on the `Upload` button

:   Only for Windows users: before clicking on `Upload`, open the serial monitor from the Arduino IDE (`Tools => Serial Monitor` or `Ctrl+Shift+M`), the robot should then blink again; keep the serial monitor opened.

You can download the Arduino IDE 1.0.5 for Linux (32 bits) containing an updated avr toolchain (4.5.3) and the Elisa3 library from the following link [arduino-1.0.5-linux32.zip](https://projects.gctronic.com/elisa3/arduino-1.0.5-linux32.zip).
If the `Tools->Serial Port` menu is grayed out then you need to start the Arduino IDE in a terminal typing `sudo path/to/arduino`.

If you want to have access to the compiler options you can download the following project [Elisa3-arduino-makefile.zip](https://projects.gctronic.com/elisa3/Elisa3-arduino-makefile.zip) that contains an Arduino IDE project with a Makefile, follow the instructions in the "readme.txt" file in order to build and upload to the robot.

**If you encounter some problem during programming (e.g. timeout problems) you can try following this sequence: turn on the robot, unplug the robot from the computer, plug the robot into the computer, it will make some blinks; when the blinks terminate execute the programming commands again.**
**Beware that every time you need to re-program the robot you need to unplug and plug again the cable to the computer.**

### Aseba

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Aseba

Refer to the page [Elisa-3 Aseba](http://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba).

### Matlab

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Matlab

![elisa3-matlab.jpg](https://www.gctronic.com/doc/images/f/fc/elisa3-matlab.jpg)
The [ePic2](https://www.e-puck.org/index.php?option=com_content&view=article&id=29&Itemid=27) Matlab interface was adapted to work with the Elisa-3 robot. The communication is handled with the radio module. Both Matlab 32 bits and 64 bits are supported (tested on Matlab R2010a). Follow these steps to start playing with the interface:

1. program the robot with the [advanced demo](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo)
2. place the selector in position 15 (to pilot the robot through the interface with no obstacle and no cliff avoidance)
3. connect the radio base-station to the computer
4. download the ePic2 for Elisa-3 from the repository <https://github.com/gctronic/elisa3_epic.git>: either from github site clicking on `Code`=>`Download ZIP` or by issueing the command `git clone https://github.com/gctronic/elisa3_epic.git`
5. open (double click) the file *main.m*; once Matlab is ready type *main+ENTER* and the GUI should start
6. click on the *+* sign (top left) and insert the robot address (e.g 3307), then click on *Connect*

### Webots simulator

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Webots_simulator

![Elisa-3-webots.png](https://www.gctronic.com/doc/images/5/5f/Elisa-3-webots.png)
The following features have been included in the Elisa-3 model for the [Webots simulator](https://www.cyberbotics.com/):

- proximity sensors
- ground sensors
- accelerometer
- motors
- green leds around the robot
- RGB led
- radio communication

You can donwload the Webots project containig the Elisa-3 model (proto) and a demonstration world in the following link [Elisa-3-webots.zip](https://projects.gctronic.com/elisa3/Elisa-3-webots.zip).

You can download a Webots project containing a demonstration world illustrating the usage of the radio communication between 10 Elisa-3 robots and a supervisor in the following link [Elisa-3-webots-radio.zip](https://projects.gctronic.com/elisa3/Elisa-3-webots-radio.zip). Here is a video of this demo:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

### Onboard behaviors

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

### Programming

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Programming

The robot is pre-programmed with a serial 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:
![Elisa3.1-programming.jpg](https://www.gctronic.com/doc/images/b/b4/Elisa3.1-programming.jpg)

If you are working with the Arduino IDE you don't need to follow this procedure, refer instead to section [Arduino IDE project](https://www.gctronic.com/doc/index.php/Elisa-3#Arduino_IDE_project).

**If you encounter some problem during programming (e.g. timeout problems) you can try following this sequence: turn on the robot, unplug the robot from the computer, plug the robot into the computer, it will make some blinks; when the blinks terminate execute the programming commands again.**
**Beware that every time you need to re-program the robot you need to unplug and plug again the cable to the computer.**

#### Windows 7

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Windows_7

1. Download the [Windows 7 package](https://projects.gctronic.com/elisa3/programming/AVR-Burn-O-Mat-Windows7.zip) and extract it. The package contains also the FTDI driver. Beware that starting from robot id 4000 the USB driver might be different, refer to section [Requirements](https://www.gctronic.com/doc/index.php?title=Elisa-3#Requirements), so you need to install it manually in case it isn't an FTDI chip.
2. Execute the script `config.bat` and follow the installation; beware that this need to be done only once. The script will ask you to modify the registry, this is fine (used to save application preferences).
3. Connect the robot to the computer; the COM port will be created.
4. Run the application `AVR Burn-O-Mat.exe`; you need to configure the port to communicate with the robot:
   1. click on `Settings => AVRDUDE`
   2. in the `AVRDUDE Options`, on `Port` enter the name of the port just created when the robot was connected to the computer (e.g. COM10); then click `Ok`
5. In the `Flash` section search the hex file you want to upload on the robot.
6. Turn on the robot, connect the USB cable to the computer and wait the blinks terminate. Then open a terminal and issue the command `c:\windows\system32\mode.com com10: dtr=on` (change the port number accordingly to your robot). The robot should blink again, if this is not the case then try again the command.
7. From the `AVR Burn-O-Mat` interface, click on `Write` in the `Flash` section.
    If you get an `Access is denied` error, then run `AVR Burn-O-Mat.exe` as administrator.
8. During the programming the robot will blink; at the end you'll receive a message saying `Flash succesfully written.`

#### Mac OS X

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Mac_OS_X

The following procedure is tested in Max OS X 10.10, but should work from Mac OS X 10.9 onwards; in these versions there is built-in support for the FTDI devices.

1. Download the [Mac OS X package](https://projects.gctronic.com/elisa3/programming/AVR8-Burn-O-Mat-MacOsX.zip) and extract it.
2. Execute the script `config.sh` in the terminal, it will ask you to install the Java Runtime Environment; in case there is a problem executing the script try with `chmod +x config.sh` and try again. Beware that this need to be done only once.
3. Connect the robot to the computer; the serial device will be created (something like `/dev/tty.usbserial-AJ03296J`).
4. Run the application `AVR Burn-O-Mat`; you need to configure the port to communicate with the robot:
   1. click on `Settings => AVRDUDE`
   2. in the `AVRDUDE Options`, on `Port` enter the name of the port just created when the robot was connected to the computer; then click `Ok`
5. In the `Flash` section search the hex file you want to upload on the robot.
6. Turn on the robot, wait the blinks terminate and then click on `Write` in the `Flash` section.
7. During the programming the robot will blink; at the end you'll receive a message saying `Flash succesfully written.`

#### Linux

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Linux

The following procedure was tested in Ubunut 12.04, but a similar procedure can be followed in newer systems and other Linux versions.
You can find a nice GUI for `avrdude` in the following link <https://burn-o-mat.net/avr8_burn_o_mat_avrdude_gui_en.php>; you can download directly the application for Ubuntu from the following link [avr8-burn-o-mat-2.1.2-all.deb](https://projects.gctronic.com/elisa3/programming/avr8-burn-o-mat-2.1.2-all.deb).
Double click the package and install it; the executable will be `avr8-burn-o-mat`.
Beware that the application requires the Java SE Runtime Environment (JRE) that you can download from the official page <https://www.oracle.com/technetwork/java/javase/downloads/index.html>, alternatively you can issue the command `sudo apt-get install openjdk-8-jre` in the terminal.

The application need a bit of configuration, follow these steps:

:   1. connect the robot to the computer, the serial device will be created (something like /dev/USB0)
:   2. to use the USB port the permissions need to be set to read and write issueing the command `sudo chmod a+rw /dev/ttyUSB0`
:   3. start the application and click on `Settings => AVRDUDE`
:   4. set the location of `avrdude` and the related configuration file (refer to the previous section when `avrdude` was installed to know the exact location); the configuration file is in `/etc/avrdude.conf`
:   3. click `OK`, close the application and open it again (this is needed to load the configuration file information); click on `Settings => AVRDUDE`
:   4. select `stk500v2` as the `Programmer`
:   5. set the serial port connected to the robot (`/dev/ttyUSB0`)
:   6. in `additional options` insert `-b 57600`, you will end up with a window like the following one:

![avrdude-gui.png](https://www.gctronic.com/doc/images/9/92/avrdude-gui.png)

:   7. click `OK`; select `ATmega2560` in the `AVR type`
:   8. in the `Flash` section search the hex file you want to upload on the robot; select `Intel Hex` on the right
:   9. connect the robot to the computer, turn on the robot, wait the blinks terminate and then click on `Write` in the `Flash` section
:   10. during the programming the robot will blink; at the end you'll receive a message saying `Flash succesfully written.`

#### Command line

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Command_line

The [avrdude](https://www.ladyada.net/learn/avr/setup-win.html) utility is used to do the upload, you can download it directly from the following links depending on your system:

- [Windows (tested on Windows 7 and 10)](https://projects.gctronic.com/elisa3/programming/WinAVR-20100110-install.exe); `avrdude` will be installed in the path `C:\WinAVR-20100110\bin\avrdude`; avrdude version 5.10
- [Mac OS X](https://projects.gctronic.com/elisa3/programming/CrossPack-AVR-20131216.dmg); `avrdude` will be installed in the path `/usr/local/CrossPack-AVR/bin/avrdude`; to check the path issue the commmand `which avrdude` in the terminal; avrdude version 6.0.1
- Ubuntu (12.04 32-bit): issue the command `sudo apt-get install avrdude` in the terminal; `avrdude` will be installed in the path `/usr/bin/avrdude`; to check the path issue the commmand `which avrdude` in the terminal; avrdude version 5.11.1

Open a terminal and issue the following commands:

1. only for windows users: `c:\windows\system32\mode.com com10: dtr=on`. You should see the robot blink (blue), if this is not the case try again the command.
2. `avrdude -p m2560 -P COM10 -b 57600 -c stk500v2 -D -Uflash:w:Elisa3-avr-studio.hex:i -v`

where `COM10` must be replaced with your com port and `Elisa3-avr-studio.hex` must be replaced with your application name; in Mac OS X the port will be something like `/dev/tty.usbserial-...`, in Ubuntu will be `/dev/ttyUSB0`.
The [Basic demo](https://www.gctronic.com/doc/index.php/Elisa-3#Basic_demo) and [Advanced demo](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo) have this command contained in the file `program.bat` in the `default` directory within the project, this can be useful for Windows users.

### Internal EEPROM

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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).
Moreover the address 4093 is used to save the clock calibration value that is found during production/testing of the robots; this value hasn't to be modified otherwise some functionalities such as tv remote control could not work anymore. For more information on clock calibration refers to the applicaiton note [AVR053: Calibration of the internal RC oscillator](https://projects.gctronic.com/elisa3/AVR053-Calibration-RC-oscillator.pdf).
The Elisa-3 robot supports an autonomous calibration process and the result of this calibration is saved in EEPROM starting at address 3946 to 4092.
**The size of usable EEPROM is thus 3946 bytes (0-3945) and the remaining memory must not be modified/erased.**

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](https://www.ladyada.net/learn/avr/setup-win.html) 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](https://projects.gctronic.com/elisa3/Elisa3-eeprom.hex)); a possible tool to read and write Intel Hex format is [Galep32 from Conitec Datensysteme](https://projects.gctronic.com/elisa3/G32setup_12004-intel-hex-editor.exe).
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 is available in the repository <https://github.com/gctronic/elisa3_eeprom.git>; it is simply needed to modify the address, rebuild and upload to the robot.
Another option is to use the following Python script [write_radio_address.py](https://projects.gctronic.com/elisa3/write_radio_address.py) (tested in Ubuntu 22.04), the procedure would be:

1. program the robot with the factory firmware
2. put selector in position 6
3. connect the robot to the computer via USB cable
4. set the correct serial port and address in the script
5. run the script

After a power-cycle the new address can be used.

### Bootloader

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Bootloader

In case the bootloader of the Elisa-3 is erased by mistake, then you can restore it by using an AVR programmer. You can download the bootloader from here [stk500v2.hex](https://projects.gctronic.com/elisa3/stk500v2_20.03.18_13b46ce.hex); the source code is available from the repository <https://github.com/gctronic/elisa3_bootloader.git>.
`Avrdude` can be used to actually write the bootloader to the robot with a command similar to the following one:
`avrdude -p m2560 -c stk500v2 -P COM348 -v -U lfuse:w:0xE2:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -V -U flash:w:stk500v2.hex:i -v -B 2`
Here we used a programmer recognized as a serial device (port COM348) that utilizes the `stk500v2` protocol.

## Base-station

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Base-station

This chapter explains informations that aren't needed for most of the users since the radio module is ready to be used and don't need to be reprogrammed. Only if you are interested in the firmware running in the radio module and on how to reprogram it then refer to section <https://www.gctronic.com/doc/index.php/Elisa#Base-station> (chapter 4.2) of the Elisa robot wiki.

## PC side

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#PC_side

This section gives informations related to the radio module connected to the computer; if you don't have a radio module you can skip this section.

### Requirements

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Requirements_2

Refer to the section <https://www.gctronic.com/doc/index.php/Elisa#1._Install_the_radio_base-station_driver>.

### Elisa-3 library

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Elisa-3_library

This library simplify the implementation of applications on the pc side (where the radio base-station is connected) that will take control of the robots and receive data from them. Some basic examples will be provided in the following sections to show how to use this library.
The source code of the library is available in the repository <https://github.com/gctronic/elisa3_remote_library>; follow the instructions in the repository to build the library.

### Multiplatform monitor

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Multiplatform_monitor

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.
![Cmd-line-monitor.jpg](https://www.gctronic.com/doc/images/f/fe/Cmd-line-monitor.jpg) ![Pc-side-commands2.jpg](https://www.gctronic.com/doc/images/3/31/Pc-side-commands2.jpg)

The source can be downloaded from the repository <https://github.com/gctronic/elisa3_remote_monitor>.

#### Windows

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Windows

Execution:

- install the driver contained in the [nRFgo Studio tool](https://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-Studio) 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\Release` dir) should run without problems; the program will prompt you the address of the robot you want to control

Compilation:
the Code::Blocks project should already be setup to reference the Elisa-3 library headers and lib files, anyway you need to put this project within the same directory of the Elisa-3 library, e.g. you should have a tree similar to the following one:

- Elisa-3 demo (parent dir)
  - `elisa3_remote_library` (Elisa-3 library project)
  - `elisa3_remote_monitor` (current project)

#### Linux / Mac OS X

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Linux_/_Mac_OS_X

The project was tested to work also in Ubuntu and Mac OS X (no driver required).
Compilation:

- you need to put this project within the same directory of the Elisa-3 library
- build command: go under "linux" dir and type `make clean && make`

Execution:

- `sudo ./main`

### Communicate with 4 robots simultaneously

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Communicate_with_4_robots_simultaneously

This example shows how to interact with 4 robots simlutaneously, basically it shows the sensors information (proximity and ground) coming from 4 robots and let control one robot at a time through the keyboard (you can change the robot you want to control). The source can be downloaded from the repository <https://github.com/gctronic/elisa3_remote_multiple>. For building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).

### Obstacle avoidance

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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 LED is updated with a random color at fixed intervals.
The source can be downloaded from the repository <https://github.com/gctronic/elisa3_remote_oa>. For building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).
The following video shows the result:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

It is available also the same example but with 4 robots controlled simultaneously; the source can be downloaded from the branch `4robots` of the repository <https://github.com/gctronic/elisa3_remote_oa>
It is easy to extend the previous example in order to control many robots, the code that controls 8 robots simultaneously can be downloaded from the branch `8robots` of the repository <https://github.com/gctronic/elisa3_remote_oa>.

### Cliff avoidance

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#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 LED is updated with a random color at fixed intervals.
The source can be downloaded from the repository <https://github.com/gctronic/elisa3_remote_cliff>. For building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).
The following video shows the result:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

### Communication between robots via PC

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Communication_between_robots_via_PC

This examples shows how to emulate direct communication between robots: basically a common state is shared between the robots and this state is changed based on the current state of each robot; it emulates the facts that each robot propagates its state to all other robots. Actually all the robots communicate only with the computer (only one computer with only one radio module) and the computer forward the information to all the others robots; the radio is fast enough so that the computer in the middle will not slow down the communication. A big advantage passing from the computer is that you can log the communication messages on the computer and see what is happening.
In particular in this demo a total of 4 robots are handled and when a robot crosses a black line, then it inform all others robots to change their color. The source can be downloaded from the repository <https://github.com/gctronic/elisa3_communication_between_robots_via_pc>. For building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).
The following video shows the result:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

### Set robots state from file

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Set_robots_state_from_file

This project show how to send data to robots for which we will know the address only at runtime, in particular the content of the packets to be transmitted is parsed from a csv file and the interpreted commands are sent to the robots one time. The source can be downloaded from the repository <https://github.com/gctronic/elisa3_remote_file>. For building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).

### Elisa-3 Python library

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Elisa-3_Python_library

This library simplify the implementation of applications on the pc side (where the radio base-station is connected) that will take control of the robots and receive data from them.
The source code of the library and some usage examples are available in the repository <https://github.com/gctronic/elisa3_remote_library_python>.

# Odometry

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Odometry

The odometry of Elisa-3 is quite good even if the speed is only measured by back-emf. On vertical surfaces the absolute angle is given by the accelerometer measuring g... quite a fix reference without drifting ;-)
A fine calibration of the right and left wheel speed parameters might give better results.
However the current odometry is a good estimate of the absolute position from a starting point.
The experiments are performed on a square labyrinth and the robot advances doing obstacle avoidance. The on-board calculated (x,y,theta) position is sent to a PC via radio and logged for further display.
![odometry-vertical.jpg](https://www.gctronic.com/doc/images/0/09/odometry-vertical.jpg)
Details about the code can be found in the [advanced-demo](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo) project, in particular the *motors.c* source file. The PC application used for logging data is the [monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor_.28pc_side.29).

## Autonomous calibration

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Autonomous_calibration

Since the motors can be slightly different a calibration can improve the behavior of the robot in terms of maneuverability and odometry accuracy.
An autonomous calibration process is implemented onboard: basically a calibration is performed for both the right and left wheels in two modes that are forward and backward with speed control enabled. In order to let the robot calibrate istelf a white sheet in which a black line is drawed is needed; the robot will measure the time between detection of the line at various speeds. The calibration sheet can be downloaded from the following link [calibration-sheet.pdf](https://projects.gctronic.com/elisa3/calibration-sheet.pdf).
In order to accomplish the calibration the robot need to be programmed with the [advanced firmare](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo) and a specific command has to be sent to the robot through the radio module or the TV remote; if you are using the radio module you can use the [monitor application](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor_.28pc_side.29) in which the letter *l (el)* is reserved to launch the calibration, otherwise if you have a TV remote control you can press the button *5*.
The sequence is the following:
1. put the selector in position 8
2. place the robot near the black line as shown below; the left motor is the first to be calibrated. Pay attention to place the right wheel as precise as possible with the black line
![elisa3-calibration-1.jpg](https://www.gctronic.com/doc/images/b/bc/elisa3-calibration-1.jpg) ![elisa3-calibration-2.jpg](https://www.gctronic.com/doc/images/2/26/elisa3-calibration-2.jpg)
3. once the robot is placed you can type the *l (el)* command (or press the button *5*); wait a couple of minutes during which the robot will do various turns at various speed in the forward direction and then in the backward direction
4. when the robot terminated (robot is stopped after going backward at high speed) you need to place it in the opposite direction in order to calibrate the right motor, as shown below.
![elisa3-calibration-3.jpg](https://www.gctronic.com/doc/images/2/20/elisa3-calibration-3.jpg)
5. once the robot is placed you can type again the *l (el)* command (or press the button *5*)
6. when the robot finish, the calibration process is also terminated.

The previous figures show a robot without the top diffuser, anyway you don't need to remove it!

# Tracking

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Tracking

## Assembly documentation

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Assembly_documentation

You can download the documentation from here [tracking-doc.pdf](https://projects.gctronic.com/elisa3/tracking-doc.pdf).
Have a look also at the video:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

## SwisTrack

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#SwisTrack

Some experiments are done with the [SwisTrack software](https://en.wikibooks.org/wiki/SwisTrack) in order to be able to track the Elisa-3 robots through the back IR emitter, here is a resulting image with 2 robots:
![elisa-3-tracking-2robots.jpg](https://www.gctronic.com/doc/images/1/1c/elisa-3-tracking-2robots.jpg)
The pre-compiled SwisTrack software (Windows) can be downloaded from the following link [SwisTrack-compiled](https://projects.gctronic.com/elisa3/SwisTrackEnvironment-10.04.13.zip).

The following video shows the tracking of 5 robots:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

The SwisTrack software lets you easily log also the resulting data that you can then elaborate, here is an example taken from the experiment using 5 robots:
![swistrack-output.jpg](https://www.gctronic.com/doc/images/e/e4/swistrack-output.jpg)

The following video shows the test done with 20, 30 and 38 Elisa-3 robots, the tracking is still good; it's important to notice that we stopped to 38 Elisa-3 robots because are the ones we have in our lab.

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

## Position control

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Position_control

We developed a simple position control example that interacts with Swistrack through a TCP connection and control 4 robots simultaneously; the orientation of the robots is estimated only with the Swistrack information (delta position), future improvements will integrate odometry information. The following video shows the control of 4 robots that are driven in a *8-shape*.

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

![tracking-8shape.jpg](https://www.gctronic.com/doc/images/d/d8/tracking-8shape.jpg)
All the following projects require the [Elisa-3 library](https://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library), for building refer to the section [Multiplatform monitor](https://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor).

- Horizontal position control (4 robots): the source code can be downloaded from [position-control-pattern-horizontal-4-robots.zip](https://projects.gctronic.com/elisa3/position-control-pattern-horizontal-4-robots-rev245-15.01.21.zip) (Code::Blocks project).

One of the characteristics of the Elisa-3 robot is that it can move in vertical thanks to its magnetic wheels, thus we developed also a vertical position control that use accelerometer data coming from the robot to get the orientation of the robot (more precise) instead of estimating it with the Swistrack information, you can download the source code from the following link:

- Vertical position control (4 robots): [position-control-pattern-vertical-4-robots.zip](https://projects.gctronic.com/elisa3/position-control-pattern-vertical-4-robots-rev245-15.01.21.zip) (Code::Blocks project).

We developed also an example of position control that control a single robot (code adapted from previous example) that can be useful during the initial environment installation/testing; you can download the source code from the following link:

- Horizontal position control (1 robot): [position-control-pattern-horizontal-1-robot.zip](https://projects.gctronic.com/elisa3/position-control-pattern-horizontal-1-robot-rev245-15.01.21.zip) (Code::Blocks project).

Another good example to start playing with the tracking is an application that lets you specify interactively the target point that the robot should reach; you can download the source code of this application from the following link:

- Go to target point: [position-control-goto-pos-horizontal-1-robot.zip](https://projects.gctronic.com/elisa3/position-control-goto-pos-horizontal-1-robot-rev245-15.01.21.zip) (Code::Blocks project).

## Utilities

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Utilities

In order to adjust the IR camera position it is useful to have an application that turn on the back IR of the robots. The following application [back-IR-on-4-robots-rev245-15.01.21.zip](https://projects.gctronic.com/elisa3/back-IR-on-4-robots-rev245-15.01.21.zip) is an example that turn on the back IR of 4 robots, their addresses are asked to the user at the execution.

# Local communication

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Local_communication

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

The [advanced firmware](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo) is needed in order to use the local communication. You can find some examples on how to use this module in the main, refers to demos in selector position from 11 to 14.
Here are some details about the current implementation of the communication module:

- use the infrared sensors to exchange data, thus during reception/transmission the proximity sensors cannot be used to avoid obstacles; in the worst case (continuous receive and transmit) the sensor update frequency is about 3 Hz
- bidirectional communication
- id and angle of the proximity sensor that received the data are available
- the throughput is about 1 bytes/sec
- maximum communication distance is about 5 cm
- no reception/transmission queue (only one byte at a time)
- the data are sent using all the sensors, cannot select a single sensor from which to send the data. The data isn't sent contemporaneously from all the sensors, but the sensors used are divided in two groups of 4 alternating sensors (to reduce consumption)

## Clustering example

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Clustering_example

In this demo there are **37** elisa-3 robots programmed with a special firmware that you can download here [elisa3_cluster_firmware.hex](https://projects.gctronic.com/elisa3/elisa3_cluster_firmware.hex); the source code is available in the repo <https://github.com/gctronic/elisa3_cluster_firmware>.
The robots will try to form some clusters by exchanging data through the local communication and at the same time exchange data with a central computer: they send their status (in cluster or not) and receive a new color when in cluster.
The application running on the computer side is available in the repo <https://github.com/gctronic/elisa3_cluster_pc>.
Here is a video of the demo:

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

# ROS

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#ROS

This chapter explains how to use ROS with the elisa-3 robots; the radio module is needed here. Basically all the sensors are exposed to ROS and you can also send commands back to the robot through ROS. The ROS node is implemented in cpp. Here is a general schema:
![elisa-ros-schema.png](https://www.gctronic.com/doc/images/0/01/elisa-ros-schema.png)
*Click to enlarge*

First of all you need to install and configure ROS, refer to <https://wiki.ros.org/Distributions> for more informations. Alternatively you can download directly a virtual machine pre-installed with everything you need, refer to section [virtual machine](https://www.gctronic.com/doc/index.php/Elisa-3#Virtual_machine); this is the preferred way.

:   - This tutorial is based on ROS Hydro. The same instructions are working with ROS Noetic, beware to use `noetic` instead of `hydro` when installing the packages.
    - If you downloaded the pre-installed VM you can go directly to section [Running the ROS node](https://www.gctronic.com/doc/index.php/Elisa-3#Running_the_ROS_node).

The ROS elisa-3 node based on roscpp can be found in the following repository <https://github.com/gctronic/elisa3_node_cpp>.

## Initial configuration

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Initial_configuration

The following steps need to be done only once after installing ROS:

:   1. If not already done, create a catkin workspace, refer to <https://wiki.ros.org/catkin/Tutorials/create_a_workspace>. Basically you need to issue the following commands:

```
  mkdir -p ~/catkin_ws/src
  cd ~/catkin_ws/src
  catkin_init_workspace
  cd ~/catkin_ws/
  catkin_make
  source devel/setup.bash
```

:   2. You will need to add the line `source ~/catkin_ws/devel/setup.bash` to your .bashrc in order to automatically have access to the ROS commands when the system is started
:   3. Clone the elisa-3 ROS node repo from <https://github.com/gctronic/elisa3_node_cpp> inside the catkin workspace source folder (~/catkin_ws/src): `git clone https://github.com/gctronic/elisa3_node_cpp.git`
:   4. Install the dependencies:
:   ROS:

    :   - `sudo apt-get install ros-hydro-slam-gmapping`
        - `sudo apt-get install ros-hydro-imu-tools`
    :   If you are using a newer version of ROS, replace `hydro` with your distribution name.
:   cpp:

    :   - install OpenCV: `sudo apt-get install libopencv-dev`
    :   If you are working with OpenCV 4, then you need to change the header include from `#include <opencv/cv.h>` to `#include <opencv2/opencv.hpp>`
:   5. Rebuild the `elisa-3 library`: go to `~/catkin_ws/src/elisa3_node_cpp/src/pc-side-elisa3-library/linux`, then issue `make clean` and `make`
:   6. Open a terminal and go to the catkin workspace directory (~/catkin_ws) and issue the command `catkin_make`, there shouldn't be errors
:   7. The USB radio module by default requires root priviliges to be accessed; to let the current user have access to the radio we use udev rules:

    - in the udev rules file you can find in /etc/udev/rules.d/name.rules add the following string changing the GROUP field with your current user group:

    :   SUBSYSTEMS=="usb", ATTRS{product}=="nRF24LU1P-F32 BOOT LDR", GROUP="viki"
    :   To know which groups your user belongs to issue the command id

    - disconnect and reconnect the radio module
:   8. Program the elisa-3 robot with the last [advanced firmware](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo) (>= rev.221) and put the selector in position 15

## Running the ROS node

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Running_the_ROS_node

First of all get the last version of the elisa-3 ROS node from github:

- clone the repo <https://github.com/gctronic/elisa3_node_cpp> and copy the elisa3_node_cpp directory inside the catkin workspace source folder (e.g. ~/catkin_ws/src)
- build the driver by opening a terminal and issueing the command `catkin_make` from within the catkin workspace directory (e.g. ~/catkin_ws).

Now you can start the ROS node, for this purposes there is a launch script (based on [roslaunch](https://wiki.ros.org/roslaunch)), as explained in the following section. Before starting the ROS node you need to start roscore, open another terminal tab and issue the command roscore.

### Single robot

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Single_robot

Open a terminal and issue the following command: `roslaunch elisa3_node_cpp elisa3_single.launch elisa3_address:='1234'` where 1234 is the robot id (number on the bottom).

If all is going well [rviz](https://wiki.ros.org/rviz/UserGuide) will be opened showing the informations gathered from the topics published by the elisa ROS node as shown in the following figure:
![elisa-ros-single-robot.png](https://www.gctronic.com/doc/images/c/c0/elisa-ros-single-robot.png)
*Click to enlarge*

The launch script is configured also to run the [gmapping (SLAM)](https://wiki.ros.org/gmapping) node that let the robot construct a map of the environment; the map is visualized in real-time directly in the rviz window. Here is a video:

EmbedVideo is missing a required parameter.

## Move the robot

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Move_the_robot

You have two options to move the robot.

The first one is to use the `rviz` interface: in the bottom left side of the interface there is a `Teleop` panel containing an *interactive square* meant to be used with differential drive robots. By clicking in this square you'll move the robot, for instance by clicking on the top-right section, then the robot will move forward-right.
![elisa-teleop.png](https://www.gctronic.com/doc/images/a/a3/elisa-teleop.png)
*Click to enlarge*

The second method is by directly publishing on the `/mobile_base/cmd_vel` topic, for instance by issueing the following command `rostopic pub -1 /mobile_base/cmd_vel geometry_msgs/Twist -- '[0.0, 0.0, 0.0]' '[0.0, 0.0, 1.0]'` the robot will rotate on the spot, instead by issueing the following command `rostopic pub -1 /mobile_base/cmd_vel geometry_msgs/Twist -- '[4.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]'` the robot will move straight forward.
Beware that there shouldn't be any other node publishing on the `/mobile_base/cmd_vel` topic (e.g. Rviz), otherwise your commands will be overwritten.

## Troubleshooting

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Troubleshooting

### Robot state publisher

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Robot_state_publisher

If you get an error similar to the following when you start a node with roslaunch:

```
ERROR: cannot launch node of type [robot_state_publisher/state_publisher]: Cannot locate node of type [state_publisher] in package [robot_state_publisher]. Make sure file exists in package path and permission is set to executable (chmod +x)
```

Then you need to change the launch file from:

```
<node name="elisa3_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
```

To:

```
<node name="elisa3_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
```

This is due to the fact that `state_publisher` was a deprecated alias for the node named `robot_state_publisher` (see <https://github.com/ros/robot_state_publisher/pull/87>).

## Virtual machine

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Virtual_machine

To avoid the tedious work of installing and configuring all the system we provide a virtual machine which includes all the system requirements you need to start playing with ROS and elisa. You can download the image as *open virtualization format* from the following link ROS-Hydro-12.04.ova (contact us to have access to this VM), based on the VM from <https://nootrix.com/2014/04/virtualized-ros-hydro/>; you can then use [VirtualBox](https://www.virtualbox.org/) to import the file and automatically create the virtual machine. Some details about the system:

- user: gctronic, pw: gctronic
- Ubuntu 12.04.4 LTS (32 bits)
- ROS Hydro installed
- [Webots](https://www.cyberbotics.com/) 8.0.5 is installed (last version available for 32 bits linux)
- [git-cola](https://git-cola.github.io/) (git interface) is installed
- the catkin workspace is placed in the desktop

# Videos

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Videos

## Autonomous charge

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Autonomous_charge

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. The movement and charging is indipendent of the gravity. It works also vertically and up-side-down.

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

## Remote control

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3#Remote_control

The following video shows 38 Elisa-3 robots moving around with onboard obstacle avoidance enabled; 15 of them are running autonmously, the remaining 23 are controlled from one computer with the radio module.

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

---

# Elisa-3 Aseba

Source: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba
Last edited: 2026-04-22T09:48:12Z

# Introduction

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Introduction

Aseba is a set of tools which allow novices to program robots easily and efficiently, refer to <https://www.thymio.org/en:start> for more information.

## Prerequisites

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Prerequisites

The following steps neeed to be done only once:

1. The communication between Aseba and Elisa-3 is done through the USB (serial communication is used) cable so you need to install the driver, refer to section [Elisa-3 requirements](https://www.gctronic.com/doc/index.php/Elisa-3#Requirements); in the future we will maybe add RF support too
2. Download ([Windows](https://projects.gctronic.com/elisa3/aseba-1.6.1.exe), [Linux](https://projects.gctronic.com/elisa3/aseba_1.6.1_amd64.deb), [Mac](https://projects.gctronic.com/elisa3/Aseba-1.6.1.dmg)) and install Aseba version **1.6.1**
3. Download the Elisa-3 target for Aseba [elisa3-aseba.hex](https://projects.gctronic.com/elisa3/elisa3-aseba.hex) and upload it to the robot (refer to section [Elisa-3 Programming](https://www.gctronic.com/doc/index.php/Elisa-3#Programming))

## Connection with AsebaStudio

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Connection_with_AsebaStudio

The following steps explain how to start playing with the Aseba Studio:
1. Connect the robot to the computer if not already done and turn it on
2. Download the following script based on your platform and modify its content specifying the AsebaStudio installation folder and the robot port:

- Windows: [asebaswitch_elisa3.zip](https://projects.gctronic.com/elisa3/asebaswitch_elisa3.zip); decompress it and spcifiy the installation folder (e.g. `C:\Program Files (x86)\AsebaStudio`) and the port number (e.g. `10` for `COM10`)
- Linux / Mac OS: [asebaswitch_elisa3.sh](https://projects.gctronic.com/elisa3/asebaswitch_elisa3.sh); specifiy the installation folder (e.g. `/usr/bin` in Linux or `/Applications/Aseba/bin` in Mac OS) and the port (e.g. `/dev/ttyUSB0` in Linux or `/dev/cu.usbserial-XXXXX` in Mac OS)

3. Start the script:

- Windows: double click on the bat file
- Linux / Mac OS: set the script to be executable with the command `chmod +x asebaswitch_elisa3.sh` and then execute it `./asebaswitch_elisa.sh`

4. Start *AsebaStudio* and select `Network(TCP)`, insert `localhost` as `Host` and specify `33333` as `Port` to open the connection with the robot. The final target string must be `tcp:host=localhost;port=33333`
5. If the connection is correctly established you should see the Elisa-3 variables on the left side of *AsebaStudio* as shown in the following figure:
![aseba-screenshot2.jpg](https://www.gctronic.com/doc/images/4/44/aseba-screenshot2.jpg)

Have a look also at the following video (you must use the script instead of manually issueing the command as in the video):

[Video](https://www.youtube.com/howyoutubeworks/user-settings/privacy/)

## Simple test

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Simple_test

Once the connection is opened click on the checkbox *auto* to start updating the sensors data automatically; we can now interact with the robot, for instance on the left side we can see all the sensors values (proximity, ground, accelerometer, ...) and we can change the motor speed and turn on/off all the leds.

# Software

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Software

First of all hava a look at some of the examples proposed in the following section [AsebaStudio examples](https://www.gctronic.com/doc/index.php/Elisa-3_Aseba#AsebaStudio_examples).
Then when you're ready you can start programming the robot on your own, refer to section [Programming interface](https://www.gctronic.com/doc/index.php/Elisa-3_Aseba#Programming_interface); moreover you can have a look at <https://www.thymio.org/en:start> for more information.
Pay attention that you have 100 bytes availables for your script due to memory constraints.
If you want to have a look behind the scene refer to section [Contribute to the Elisa-3 Aseba target](https://www.gctronic.com/doc/index.php/Elisa-3_Aseba#Contribute_to_the_Elisa-3_Aseba_target).

## AsebaStudio examples

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#AsebaStudio_examples

You can download all the following examples from [aseba-elisa3-examples.zip](https://projects.gctronic.com/elisa3/aseba-elisa3-examples.zip); in order to launch an example follow these steps:

1. place the robot selector in position 5. When the robot is turned on, the position of the selector (from 0 to 9) define the node name in *AsebaStudio*, in our case the node name will be `elisa3-5` (where *5* is the selector position)
2. extract the zip, the directory contains some file with *aesl* extension, this is the *AsebaStudio* code extension
3. connect the robot with *AsebaStudio* as explained previously
4. click on menu `File => Open...` and select one of the examples extracted from the zip
5. click on button `Load` and then on `Run`; now the code is running on the robot but it isn't stored in EEPROM, thus when you turn off the robot it returns to its initial state

If you want to save the program in memory you need to click on `Tools => Write the program(s)... => inside the elisa3` and wait for the programming termination (the green leds around the robot will be turned on while the memory is written); pay attention to uncheck the *auto* update of the robot variables in *AsebaStudio* before starting the writing (with the *auto* update enabled the writing could block).

### Simple obstacle avoidance

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Simple_obstacle_avoidance

```
var i = 1
while (i==1) do
	if ((prox[0] > 50) or (prox[1] > 50) or (prox[7] > 50)) then
		mot.left.target = -20
		mot.right.target = 20
	else
		mot.left.target = 20
		mot.right.target = 20
	end
end
```

To fully see the results of this example you need to write the code into the robot. Then let it move with some objects around.

### RGB control

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#RGB_control

```
onevent ir.sensors
	if (prox[0] > 20) then	# avoid noise
		led.rgb[0] = prox[0]
	else
		led.rgb[0] = 0
	end

	if (prox[1] > 20) then	# avoid noise
		led.rgb[1] = prox[1]
	else
		led.rgb[1] = 0
	end

	if (prox[7] > 20) then	# avoid noise
		led.rgb[2] = prox[7]
	else
		led.rgb[2] = 0
	end
```

Once the code is loaded on the robot you can "control" the intensity of the red, green and blue with the *prox[0]*, *prox[1]* and *prox[7]* respectively. Try to get the primary and secondary colors (<https://en.wikipedia.org/wiki/Primary_color>)...*hint: you need two fingers*.

### Working with events

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Working_with_events

```
var color = 0

onevent ir.sensors
	led.green[0] = 1 - led.green[0]
	led.green[2] = 1 - led.green[2]
	led.green[4] = 1 - led.green[4]
	led.green[6] = 1 - led.green[6]

onevent acc
	led.green[1] = 1 - led.green[1]
	led.green[3] = 1 - led.green[3]
	led.green[5] = 1 - led.green[5]
	led.green[7] = 1 - led.green[7]

onevent timer
	led.rgb[color] = 255 - led.rgb[color]

onevent button
	if (color == 2) then
		color = 0
	else
		color++
	end
	led.rgb[0] = 0
	led.rgb[1] = 0
	led.rgb[2] = 0
```

The green leds shows the update frequency of the proximity and accelerometer sensors (you can measure it with an oscilloscope if you have one). You can change the value of the variable `timer.period` to change the frequency of the RGB LED, the resolution is 1 ms (e.g. by putting 1000 you'll get the RGB LED blinking at 1 Hz). Moreover you can try pressing the button and see what happen (probably you will deduce from the code...).

### Remote control

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Remote_control

```
onevent rc5
	if rc5 == 2 then	# forward
		mot.left.target = 20
		mot.right.target = 20
	elseif rc5 == 5 then	# stop
		mot.left.target = 0
		mot.right.target = 0
	elseif rc5 == 8 then	# backward
		mot.left.target = -20
		mot.right.target = -20
	elseif rc5 == 4 then	# left
		mot.left.target = 0
		mot.right.target = 20
	elseif rc5 == 6 then	# right
		mot.left.target = 20
		mot.right.target = 0
	else	# error
		led.rgb[0] = 255
	end
```

To fully see the results of this example you need to write the code into the robot. Maybe you should adapt the values used for the various motions and then you can for sure extend the functionalities using others codes (e.g. change RGB LED color).

### Simple local communication

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Simple_local_communication

In this example we need to connect two robots at the same time to *AsebaStudio*, to accomplish this *asebaswitch* need to be called with a different command that is:
`asebaswitch -d -v "ser:port=104;baud=57600;stop=1;parity=none;fc=none;bits=8" "ser:port=69;baud=57600;stop=1;parity=none;fc=none;bits=8"`
Basically there are two targets instead of one; you need to specify the correct `port` number for both the robots. Moreover you need to place the robot receiver selector in position 5 and the robot transmitter selector to another position (from 0 to 9). Both the robots will blink if the connection is correctly opened.
Load the following code to the receiver robot:

```
call prox.comm.enable(1)
onevent prox.comm
	led.green[0] = 0
	led.green[1] = 0
	led.green[2] = 0
	led.green[3] = 0
	led.green[4] = 0
	led.green[5] = 0
	led.green[6] = 0
	led.green[7] = 0
	led.green[prox.comm.rx.id] = 1
	if (prox.comm.rx == 1) then
		led.rgb[0] = 255
		led.rgb[1] = 0
		led.rgb[2] = 0
	elseif (prox.comm.rx == 2) then
		led.rgb[0] = 0
		led.rgb[1] = 255
		led.rgb[2] = 0
	elseif (prox.comm.rx == 3) then
		led.rgb[0] = 0
		led.rgb[1] = 0
		led.rgb[2] = 255
	end
```

Load the following line code to the transmitter robot:

```
call prox.comm.enable(1)
```

Now you can change the `prox.comm.tx` values (from 1 to 3) on the transmitter tab and see the effect on the receiver robot; also `prox.comm.rx` and `prox.comm.rx.id` on the receiver tab will change accordingly. You can easily transform the id to an angle by knowing that each sensor is placed at 45 degrees from each other. Remember to place the robots near each other (< 5 cm).

### Square path

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Square_path

In this example we exploit the onboard odometry to let the robot move in a square path. You have two possibilities: either running on a vertical wall or running on an horizontal plane, both cases are handled automatically. When the Elisa-3 is turned on, it calibrates the sensors (when is placed vertically it rotates around itself for a while with the green led turned on); when the calibration process is finished you can start the square by "touching" the back side proximity. Pay attention that the robot must be placed with the front pointing right when placed vertically.

```
var DISTANCE = 100	# given in mm
var start = 0
var state = 0
var isVertical
```

```
sub updateState
	if start == 1 then
		if (state == 0) then
			mot.left.target = 20
			mot.right.target = 20
			led.rgb[0] = 255
			led.rgb[1] = 0
			led.rgb[2] = 0
			if (odom.x >= DISTANCE) then
				state = 1
			end
		elseif (state == 1) then
			mot.left.target = 0
			mot.right.target = 15
			led.rgb[0] = 0
			led.rgb[1] = 255
			led.rgb[2] = 0
			if (odom.theta >= 90) then
				state = 2
			end
		elseif (state == 2) then
			mot.left.target = 20
			mot.right.target = 20
			led.rgb[0] = 0
			led.rgb[1] = 0
			led.rgb[2] = 255
			if (odom.y >= DISTANCE) then
				state = 3
			end
		elseif (state == 3) then
			mot.left.target = 0
			mot.right.target = 20
			led.rgb[0] = 255
			led.rgb[1] = 255
			led.rgb[2] = 0
			call robot.isVertical(isVertical)
			if (isVertical == 1) then
				if (odom.theta < 0) then
					state = 4
				end
			else
				if (odom.theta >= 180) then
					state = 4
				end
			end
		elseif (state == 4) then
			mot.left.target = 20
			mot.right.target = 20
			led.rgb[0] = 255
			led.rgb[1] = 0
			led.rgb[2] = 255
			if (odom.x <= 0) then
				state = 5
			end
		elseif (state == 5) then
			mot.left.target = 0
			mot.right.target = 20
			led.rgb[0] = 0
			led.rgb[1] = 255
			led.rgb[2] = 255
			call robot.isVertical(isVertical)
			if (isVertical == 1) then
				if ((odom.theta >= -90) and (odom.theta < 0) ) then
					state = 6
				end
			else
				if (odom.theta >= 270) then
					state = 6
				end
			end
		elseif (state == 6) then
			mot.left.target = 20
			mot.right.target = 20
			led.rgb[0] = 0
			led.rgb[1] = 0
			led.rgb[2] = 0
			if (odom.y <= 0) then
				state = 7
			end
		elseif (state == 7) then
			mot.left.target = 0
			mot.right.target = 20
			led.rgb[0] = 0
			led.rgb[1] = 0
			led.rgb[2] = 0
			call robot.isVertical(isVertical)
			if (isVertical == 1) then
				if (odom.theta >= 0) then
					state = 8
				end
			else
				if (odom.theta >= 360) then
					state = 8
				end
			end
		elseif (state == 8) then
			mot.left.target = 0
			mot.right.target = 0
			start = 0
		end
	end

onevent ir.sensors
	if (start == 0) then
		if (prox[4] > 200) then
			call reset.odometry()
			state = 0
			start = 1
		end
	end
	callsub updateState
```

## Contribute to the Elisa-3 Aseba target

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Contribute_to_the_Elisa-3_Aseba_target

You can get the source code of the Elisa-3 Aseba target from [github](https://github.com/aseba-community/aseba-targets-arduino.git).
The repo contains all Arduino targets, the Elisa-3 target is placed in the directory *elisa3*. To build the project follow these steps:

1. clone the repo by issueing the command: `git clone --recursive https://github.com/gctronic/aseba-targets-arduino.git`
2. download [Atmel Studio 7](https://www.atmel.com/Microsite/atmel-studio/) since this IDE was used to create the project; the installation of *Atmel Studio* includes also the toolchain so you should be able to build the project without any modification
3. to open the project double click `elisa3-aseba.atsln`

### Dependencies

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Dependencies

The project depends on some files of [Aseba](https://github.com/aseba-community/aseba) that is included as submodule in the [aseba-targets-arduino repo](https://github.com/aseba-community/aseba-targets-arduino.git) to simplify the building. The files referenced from the project are:

- `aseba\trunk\vm\natives.c`
- `aseba\trunk\vm\natives.h`
- `aseba\trunk\vm\vm.c`
- `aseba\trunk\vm\vm.h`
- `aseba\trunk\transport\buffer\vm-buffer.c`
- `aseba\trunk\transport\buffer\vm-buffer.h`

The project depends also on the Elisa-3 library contained in the [*Elisa-3 advanced firmware revision 221*](https://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo).

# Programming interface

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Programming_interface

This page describes the programming capabilities of Elisa-3. It lists the different variables, events and functions and indicates to which elements of the robot they refer (see section [Hardware](https://www.gctronic.com/doc/index.php/Elisa-3#Hardware) to know where is the actual position on the robot of the sensors and actuators). Each variable is marked with either *[R]* or *[W]* to indicate whether the variable is used to read a value from the robot or write a value to the robot respectively. This page refers to firmware revision 0 and later.
You can find a document that summarizes the programming interface in the following link [elisa3-aseba-cheatsheet.png](https://projects.gctronic.com/elisa3/elisa3-aseba-cheatsheet.png).

## Standard library

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Standard_library

The Elisa-3 comes with the Aseba [standard library of native functions, documented on its own page](https://www.thymio.org/en:asebastdnative).

## Motors

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Motors

You can change the wheel speeds by writing in these variables:

- `motor.left.target` *[W]*: requested speed for left wheel
- `motor.right.target` *[W]*: requested speed for right wheel

You can read the real wheel speeds from these variables:

- `motor.left.speed` *[R]*: real speed of left wheel
- `motor.right.speed` *[R]*: real speed of right wheel

The values range from -127 to 127, one unit = 5 mm/s. A value of 127 approximately corresponds to a linear speed of 60 cm/s.

## Green LEDs

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Green_LEDs

8 green LEDs make up a circle on the bottom of the robot.
`led.green[0..7]` *[W]*: index 0 sets the intensity of the LED at the front of the robot, the others are numbered clockwise.

## RGB LED

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#RGB_LED

There is one RGB LED in the center of the robot, its light is smoothly spread out through the top diffuser.
`led.rgb[0..2]` *[W]*: the indexes 0, 1 and 2 set respectively the intensity of the red, green and blue.
The values range from 0 (off) to 255 (max intensity).

## IR transmitters

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#IR_transmitters

There are 3 IR transmitters pointing upwards, two placed in the front side of the robot and one placed in the back side. You can control their state by writing these variables:

- `ir.tx.front` *[W]*: 0 means that both front IRs are turned off, 1 means that both front IRs are turned on
- `ir.tx.back` *[W]*: 0 means that the back IR is turned off, 1 means that the back IR is turned off

## Button

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Button

There is a small button in the back side of the Elisa-3. The variable `button` *[R]* holds the state of this button (1 = released, 0 = pressed).
Elisa-3 generates the `button` event when it is pressed or released.

## Proximity sensors

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Proximity_sensors

Elisa-3 has 8 proximity sensors around its periphery (placed at 45 degrees from each other). Two arrays of 8 variables hold the values of these sensors, the first is `prox` *[R]* and represents the proximity to an object, the second is `prox.ambient` *[R]* and represents the ambient light intensity:

- `prox[0]`, `prox.ambient[0]` : front
- `prox[1]`, `prox.ambient[1]` : front right
- `prox[2]`, `prox.ambient[2]` : right
- `prox[3]`, `prox.ambient[3]` : back right
- `prox[4]`, `prox.ambient[4]` : back
- `prox[5]`, `prox.ambient[5]` : back left
- `prox[6]`, `prox.ambient[6]` : left
- `prox[7]`, `prox.ambient[7]` : front left

The values in the `prox` array vary from 0 (the robot does not see anything) to 255 (the robot is very close to an obstacle); the values of the `prox.ambient` array start from 1023 when completely dark and decrease with light increase. Elisa-3 updates these arrays at a frequency of about 80 Hz (when local communication is disabled), and generates the `ir.sensors` event after every update.

## Ground sensors

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Ground_sensors

Elisa-3 holds 4 ground proximity sensors. These sensors are located at the front of the robot. As black grounds appear like no ground at all (black absorbs the infrared light), these sensors can be used to follow a line on the ground and also to avoid falling from the table. Two arrays of 4 variables hold the values of these sensors, the first is `ground` *[R]* and represents the proximity to the ground or the presence of a black line, the second is `ground.ambient` *[R]* and represents the ambient light intensity at the ground:

- `ground[0]`, `ground.ambient[0]` : left
- `ground[1]`, `ground.ambient[1]` : front left
- `ground[2]`, `ground.ambient[2]` : front right
- `ground[3]`, `ground.ambient[3]` : right

The values in the `ground` array normally vary from about 600 (white surface) to about 300 (black surface or no ground); the values of the `prox.ambient` array start from 1023 when completely dark and decrease with light increase. Elisa-3 updates these arrays at a frequency of about 80 Hz (when local communication is disabled), and generates the same `ir.sensors` event after every update.

## Accelerometer

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Accelerometer

Elisa-3 contains a 3-axes accelerometer. An array of 3 variables, `acc` *[R]*, holds the values of the acceleration along these 3 axes:

- `acc[0]` : x-axis (from back to front, positive forward)
- `acc[1]` : y-axis (from left to right, positive towards right)
- `acc[2]` : z-axis (from bottom to top, positive upward)

The values in this array vary from -128 to 128, with 1 g ([the acceleration of the earth's gravity](https://en.wikipedia.org/wiki/Earth%27s_gravity)) corresponding to the value 64. Elisa-3 generates the `acc` event after every update.
The z-axis is used also to know the current orientation of the robot, that is if it is moving vertically or horizontally; the current orientation can be accessed using the function `robot.isVertical(dest)`, where `dest` will be 1 if it is vertical or 0 if it is horizontal.

## Selector

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Selector

The variable `selector` *[R]* shows the current position of the selector (from 0 to 15). Elisa-3 generates the `sel` event everytime its position is changed.

## Remote control

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Remote_control_2

Elisa-3 contains a receiver for infrared remote controls compatible with the RC5 protocol. When Elisa-3 receives an RC5 code, it generates the `rc5` event. In this case, the variables `rc5` *[R]* is updated.

## Battery

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Battery

The variable `bat.percent` *[R]* give you an estimate of the current battery charge given in percentage (100% means you have still a lot of playful time, 0% means you need to wait a little and put the robot in charge). The sampled value can be accessed with the variable `_bat.adc` *[R]* (this is an hidden variable); the values range from 0 to 1023.

## Local communication

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Local_communication

Elisa-3 can use its infrared proximity sensors to communicate with other robots within a range of about 5 cm. For more detailed information refer to section [Local communication](https://www.gctronic.com/doc/index.php/Elisa-3#Local_communication).
To use the communication, call the `prox.comm.enable(state)` function, with 1 in state to enable communication or 0 to turn it off. If the communication is enabled, the value in the `prox.comm.tx` *[W]* variable is transmitted to others robots from all the sensors. When Elisa-3 receives a value, the event `prox.comm` is fired and the value is in the `prox.comm.rx` *[R]* variable; moreover the `prox.comm.rx.id` *[R]* variable contains the id of the sensors (from 0 to 7, where 0 is the front sensor, sensors id increases clockwise) that received the data.

## Odometry

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Odometry

Elisa-3 is capable of estimating how much distance has traveled each wheel resulting in a robot position given in cartesian coordinates (x, y); when moving horizontally the orientation is estimated through the distance traveled by each wheel, instead when moving vertically (what?? vertically?? yes Elisa-3 can move vertically thanks to its magnetic wheels) the orientation is given directly by the accelerometer and it's very precise.
The variable `odom.theta` *[R]* contains the current orientation of the robot given in degrees: when moving horizontally the orientation continuously decreases when moving clockwise and continuously increases when moving counter-clockwise; when moving vertically the orientation is from -180 to 180 degrees. The variables `odom.x` *[R]* and `odom.y` *[R]* contain the current position of the robot given in millimeters.
By calling the function `reset.odometry` all the data are reset to zero.

## Timer

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Timer

Elisa-3 provides a user-defined timer. The variable `timer.period` *[W]* allows to specify the period of the timer in milliseconds. The timer starts the countdown when it is initialized (value > 0). When the period expires, the timer generates a `timer` event. This events is managed in the same way as all the others and cannot interrupt an already executing event handler. The maximum value is 32767 ms (about 32 seconds).

## Onboard behaviors

Link: https://www.gctronic.com/doc/index.php?title=Elisa-3_Aseba#Onboard_behaviors

Elisa-3 include two onboard behaviors that can be activated or deactivated at will that are obstacle avoidance and cliff detection. To use obstacle avoidance, call the `behavior.oa.enable(state)` function, with 1 in state to enable obstacle avoidance or 0 to disable it; when activated the motors speed will be adapted in order to avoid obstacles. To use cliff detection, call the `behavior.cliff.enable(state)` function, with 1 in state to enable cliff detection or 0 to disable it; when activated the Elisa-3 will stop as soon as it detect a cliff (pay attention that the robot can detect the void only when going forward).
