RGB Panel

From GCtronic Wiki
Jump to: navigation, search

1 Overview

The RGB panel is a new module designed to be suitable for the e-puck robot. It is comprised of:

Every LED is independent from each other, so it's possible to turn on the LEDs with different colors in the RGB color space (additive color mixing), as shown in the following figures.

The infrareds are thought as identification sensors, this means that the robots can be recognized by an external device such as a camera observing their combination of infrareds turned on and off; for instance using 8 IRs it's possible to identify 256 different robots.

The communication between the e-puck and the module is via the I2C bus. Color commands are sent from the robot to the RGB panel (nothing is sent in the opposite way); this let us, for example, program the robot with a pre-fixed sequence of commands to send to the panel, resulting in a color animation. Other more elaborate demos could be implemented, reacting for example to the environment and nearby robots.
Another possibility is to develop a demo running on a computer and connecting the computer to the e-puck through Bluetooth (the e-puck and the module are connected through I2C as before); in practice the robot receives commands from the PC and forwards them to the RGB panel. This forwarding is implemented in the e-puck firmware, presented afterwards.

2 Electrical schema

The circuit diagram of the rgb panel e-puck extension is available to the community on the following link electrical schema.

3 Software

3.1 E-puck firmware

In order to play with the RGB extension for the e-puck robot you need to load the official e-puck firmware and set the selector on position 3 (advanced sercom protocol), refer to section E-Puck Standard firmware. Basically the firmware contains a command to setup the color of each led and the state of each infrared sensor; in particular there are two commands (binary mode): 'W' and 'w'; the first one is used to set a single led or infrared sensor, the second is used to set all actuators at once.

3.2 RGB panel firmware

Also the module requires a firmware running on it in order to handle the I2C communication and interpret the commands needed to turn on and off the sensors and color leds. The firmware can be downloaded from the following links (panel-MPLAB, panel-hex).

3.3 Demo - PC side

A basic demo running on a computer was developed to control manually all the LEDs color and IRs state through a bluetooth connection. The application is a Qt project, so the compilation may be handled easily with Qt Creator; alternatively qmake can be used. A snapshot of this demo is shown hereafter:

Download RGB Panel Basic Demo (Multiplatform)

4 Programming

4.1 Registers

The LEDs and IRs are controlled by writing appropriate registers; the value within the registers represents the duty cycle that a LED/IR will reach, that is its brightness. The following table shows the registers used to configure the various LEDs and IRs.

X RedX BlueX GreenX IRX
Parameter registers
0 0x00 0x08 0x10 0xA4
1 0x01 0x09 0x11 0xA5
2 0x02 0x0A 0x12 0xA6
3 0x03 0x0B 0x13 0xA7
4 0x04 0x0C 0x14 0xA8
5 0x05 0x0D 0x15 0xA9
6 0x06 0x0E 0x16 0xAA
7 0x07 0x0F 0x17 0xAB
8 0x92 0x93 0x94 -

4.2 Example

The RGB panel can be controlled through either ASCII or binary commands. The following example illustrates the sequence of commands that must be issued to turn on the LED0 at maximum brightness (all 3 R,G and B at maximum) using a terminal and the e-puck programmed with the standard firmware:

W, 176, 0, 128   [set red led0 max]
W, 176, 8, 128   [set blue led0 max ]
W, 176, 16, 128  [set green led0 max]
W, 176, 145, 1   [set command register (command terminator)]

where in the first line W is the command (I2C write), 176 is the I2C address of the RGB panel (fixed), 0 is the register address and 128 the brightness value. The last line contains a special command that is sent to the module when it's required to update the LEDs and IRs with the new values; this means that even if the first command is sent to the RGB panel, nothing will change until the last command is sent.

The binary version (a bit faster), using the -w command, of the previous sequence is:

... init communication ... 

sprintf(buffer, 5, "%c%c%c%c",-‘w’, 176, 0, 128); 
sprintf(&buffer[5], 5, "%c%c%c%c",-‘w’, 176, 8, 128); 
sprintf(&buffer[10], 5, "%c%c%c%c",-‘w’, 176, 16, 128);
sprintf(&buffer[15], 5, "%c%c%c%c",-‘w’, 176, 145, 1);  

... send buffer ...

5 Videos

The robot changes color basing itself on what his small camera sees, just like a real chameloen. This system is based on the standard e-puck on the bottom, the new 3x3 RGB display on top and a proper demo.
You can download the source code of this demo in the following link epuck-demo-chamaleon.

Artistic pattern formation with multiple robots.