e-puck2 and Others Extensions: Difference between pages

From GCtronic wiki
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
=Hardware=
=Range and bearing=
==Overview==
<span class="plainlinks">[http://www.gctronic.com/doc/images/randb-1-small.jpg <img height=150 src="http://www.gctronic.com/doc/images/randb-1.jpg">][http://www.gctronic.com/doc/images/randb-2-small.jpg <img height=150 src="http://www.gctronic.com/doc/images/randb-2.jpg">]</span><br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/e-puck2-overview.png <img width=500 src="http://www.gctronic.com/doc/images/e-puck2-overview_small.png">]</span>
The board allows situated agents to communicate locally, obtaining at the same time both the range and the bearing of the emitter without the need of any centralized control or any external reference. Therefore, the board allows the robots to have an embodied, decentralized and scalable communication system. The system relies on infrared communications with frequency modulation and is composed of two interconnected modules for data and power measurement.<br/>
<span class="plainlinks">[https://projects.gctronic.com/epuck2/wiki_images/e-puck2-features.png <img width=600 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2-features_small.png">]</span><br/>


The following figures show the main components offered by the e-puck2 robot and where they are physically placed:<br/>
The documentation and hardware files are available in the following links:
<span class="plainlinks">[https://projects.gctronic.com/epuck2/wiki_images/epuck2-components-position.png <img width=800 src="https://projects.gctronic.com/epuck2/wiki_images/epuck2-components-position_small.png">]</span><br/>
* [https://projects.gctronic.com/randb/eRandB_Ed.D_Schematics.pdf Schematics (pdf)]
* [https://projects.gctronic.com/randb/eRandB_Ed.D_Assembling.pdf Assembling (pdf)]
* [https://projects.gctronic.com/randb/eRandB_Ed.D_BillOfMaterials.xls Bill of Materials (xls)]
* [https://projects.gctronic.com/randb/eRandB_Ed.D_PCB.pdf PCB (pdf)]
* [https://projects.gctronic.com/randb/eRandB_Ed.D_HardwareSourceFiles.zip Hardware source files(zip)]
* [https://projects.gctronic.com/randb/eRandB_Ed.D_Fabrication.zip Fabrication: Gerber, pick and place, ... (zip)]
* [https://projects.gctronic.com/randb/eRandB_manual.pdf e-RandB manual (pdf)]
* [https://projects.gctronic.com/randb/eRandB_firmware.zip e-RandB firmware (zip)]
* [https://projects.gctronic.com/randb/eRandB_software.tgz e-puck software and examples (tgz)]


==Specifications==
You can find more information about this board in the following links: [http://www.e-puck.org/index.php?option=com_content&view=article&id=35&Itemid=23 http://www.e-puck.org/index.php?option=com_content&view=article&id=35&Itemid=23].
The e-puck2 robot maintains full compatibility with its predecessor e-puck (e-puck HWRev 1.3 is considered in the following table):
 
{| border="1"
The following table lists the I2C the registers map:
|'''Feature'''
<blockquote>
|'''e-puck1.3'''
{| border="1" cellpadding="10" cellspacing="0"
|'''e-puck2'''
!Address !!Read !!Write
|'''Compatibility'''
|'''Additional'''
|-
|Size, weight
|70 mm diameter, 55 mm height, 150 g
|Same form factor: 70 mm diameter, 45 mm, 130 g
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|No e-jumper required
|-
|Battery, autonomy
|LiIPo rechargeable battery (external charger), 1800 mAh. <br/>About 3 hours autonomy. Recharging time about 2-3h.
|Same battery; USB charging, recharging time about 2.5h.
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|USB charging
|-
|Processor
|16-bit dsPIC30F6014A @ 60MHz (15 MIPS), DSP core for signal processing
|32-bit STM32F407 @ 168 MHz (210 DMIPS), DSP and FPU, DMA
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|~10 times faster
|-
|-
|Memory
|0 || 1 if data available, 0 otherwise || -
|RAM: 8 KB; Flash: 144 KB
|RAM: 192 KB; Flash: 1024 KB
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|RAM: 24x more capable<br/>Flash:~7x more capable
|-
|-
|Motors
|1 || data MSB || -
|2 stepper motors with a 50:1 reduction gear; 20 steps per revolution; about 0.13 mm resolution
|Same motors
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Wheels
|2 || data LSB || -
|Wheels diamater = 41 mm <br/>Distance between wheels = 53 mm
|Same wheels
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Speed
|3 || bearing MSB || -
|Max: 1000 steps/s (about 12.9 cm/s)
|Max: 1200 steps/s (about 15.4 cm/s)
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|20% faster
|-
|-
|Mechanical structure
|4 || bearing LSB: <code>double((MSB<<8)+LSB)*0.0001</code> to get angle in degrees|| -
|Transparent plastic body supporting PCBs, battery and motors
|Same mechanics
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Distance sensor
|5 || range MSB || -
|8 infra-red sensors measuring ambient light and proximity of objects up to 6 cm
|Same infra-red sensors <br/>Front real distance sensor, Time of fight (ToF), up to 2 meter.
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|ToF sensor
|-
|-
|IMU
|6 || range LSB || -
|3D accelerometer and 3D gyro
|3D accelerometer, 3D gyro, 3D magnetometer
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|3D magnetometer
|-
|-
|Camera
|7 || max peak (adc reading) MSB || -
|VGA color camera; typical use: 52x39 or 480x1
|Same camera; typical use: 160x120
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|Bigger images handling
|-
|-
|Audio
|8 || max peak (adc reading) LSB || -
|3 omni-directional microphones for sound localization<br/>speaker capable of playing WAV or tone sounds
|4 omni-directional microhpones (digital) for sound localization<br/>speaker capable of playing WAV or tone sounds
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
| +1 front microphone
|-
|-
|LEDs
|9 || sensor that received the data (between 0..11) || -
|8 red LEDs around the robot, green body light, 1 strong red LED in front
|4 red LEDs and 4 RGB LEDs around the robot, green light, 1 strong red LED in front
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|4x RGB LEDs
|-
|-
|Communication
|12 || - || Set transmission power (communication range): between 0 (max range) and 255 (min range)
|RS232 and Bluetooth 2.0 for connection and programming
|USB Full-speed, Bluetooth 2.0, BLE, WiFi
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|WiFi, BLE
|-
|-
|Storage
|13 || - || data LSB (prepare)
|Not available
|Micro SD slot
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|Micro SD
|-
|-
|Remote Control
|14 || - || data MSB (send <code>(MSB<<8)+LSB</code>)
|Infra-red receiver for standard remote control commands
|Same receiver
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Switch / selector
|16 || - || 0 store light conditions (calibration)
|16 position rotating switch
|Same selector
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Extensions
|17 || - || 1=onboard calculation, 0=host calculation
|Ground sensors, range and bearing, RGB panel, Gumstix extension, omnivision, your own
|All extension supported
|style="text-align:center;" | <img width=40 src="http://www.gctronic.com/doc/images/ok.png">
|
|-
|-
|Programming
|Free C compiler and IDE, Webots simulator, external debugger
|Free C compiler and IDE, Webots simulator, onboard debugger (GDB)
|style="text-align:center;" | <img width=30 src="http://www.gctronic.com/doc/images/plus.png">
|Onboard debugger
|}
|}
</blockquote>


This is the overall communication schema:<br/>
==Firmware source code==
<span class="plainlinks">[http://www.gctronic.com/doc/images/comm-overall-e-puck2E.jpg <img width=700 src="http://www.gctronic.com/doc/images/comm-overall-e-puck2E.jpg">]</span><br/>
 
==Documentation==
* '''Main microcontroller''': STM32F407, [https://projects.gctronic.com/epuck2/doc/STM32F407xx_datasheet.pdf datasheet], [https://projects.gctronic.com/epuck2/doc/STM32F407_reference-manual.pdf reference-manual]
* '''Programmer/debugger''': STM32F413, [https://projects.gctronic.com/epuck2/doc/STM32F413x_datasheet.pdf datasheet], [https://projects.gctronic.com/epuck2/doc/STM32F413_reference-manual.pdf reference-manual]
* '''Radio module''': Espressif ESP32, [https://projects.gctronic.com/epuck2/doc/esp32_datasheet_en.pdf datasheet], [https://projects.gctronic.com/epuck2/doc/esp32_technical_reference_manual_en.pdf reference-manual]
* '''Camera''': PixelPlus PO8030D CMOS image sensor, [https://projects.gctronic.com/E-Puck/docs/Camera/PO8030D.pdf datasheet], no IR cut filter
: From about July 2019, the camera mounted on the e-puck2 robot is the Omnivision OV7670 CMOS image sensor, [https://projects.gctronic.com/epuck2/doc/OV7670.pdf datasheet]
* '''Microphones''': STM-MP45DT02, [https://projects.gctronic.com/epuck2/doc/mp45dt02.pdf datasheet]
* '''Optical sensors''': Vishay Semiconductors Reflective Optical Sensor, [https://projects.gctronic.com/epuck2/doc/tcrt1000.pdf datasheet]
* '''ToF distance sensor''': STM-VL53L0X, [https://projects.gctronic.com/epuck2/doc/VL53L0X-Datasheet.pdf datasheet], [https://projects.gctronic.com/epuck2/doc/VL53L0X-UserManual-API.pdf user-manual]
* '''IMU''': InvenSense MPU-9250, [https://projects.gctronic.com/epuck2/doc/MPU-9250-product-specification.pdf product-specification], [https://projects.gctronic.com/epuck2/doc/MPU-9250-Register-Map.pdf register-map]
* '''Motors''': [http://www.e-puck.org/index.php?option=com_content&view=article&id=7&Itemid=9 details]
* '''Speaker''': Diameter 13mm, power 500mW, 8 Ohm, DS-1389 or PSR12N08AK or similar
* '''IR receiver''': TSOP36230
 
==Migrating from e-puck1.x to e-puck2==
The e-puck2 robot maintains full compatibility with its predecessor e-puck, but there are some improvements that you should be aware of.<br/>
 
First of all the e-jumper, that is the small board that is attached on top of the e-puck1.x, isn't anymore needed in the e-puck2. The components available on the e-jumper are integrated directly in the robot board. On top of the e-puck2 you'll see a quite big free connector, this is used to attach the extensions board designed for the e-puck1.x that are fully compatible with the e-puck2; you must not connect the e-jumper in this connector.<br/>
Secondly you don't need anymore to unplug and plugin the battery for charging, but instead you can charge the battery (up to 1 ampere) directly by connecting the USB cable. If you want you can still charge the battery with the e-puck1.x external charger, in case you have more than one battery.<br/>
 
Moreover you don't need anymore a special serial cable (with probably an RS232 to USB adapter) to be able to communicate with the robot, but you can use the USB cable. Once connected to the computer a serial port will be available that you can use to easily exchange data with the robot.
 
==Extensions==
All the extensions (ground sensors, range and bearing, RGB panel, gumstix and omnvision) are supported by the e-puck2 robot, this means that if you have some extensions for the e-puck1.x you can still use them also with e-puck2.<br/>
For more information about using the gumstix extension with e-puck2 robot refer to [http://www.gctronic.com/doc/index.php?title=Overo_Extension#e-puck2 http://www.gctronic.com/doc/index.php?title=Overo_Extension#e-puck2].
 
=Getting Started=
The e-puck2 robot features 3 chips onboard:
* the main microcontroller, that is responsible for handling the sensors and actuators and which runs also the demos/algorithms
* the programmer, that provides programming/debugging capabilties and moreover it configures the USB hub and is responsible for the power management (on/off of the robot and battery measure)
* radio module, that is responsible for handling the wireless communication (WiFi, BLE, BT), the RGB LEDs and the user button (the RGB LEDs and button are connected to the radio module due to the pin number limitation on the main microcontroller)
 
The robot is shipped with the last firmware version programmed on all 3 chips, so you can immediately start using the robot.<br/>
The following sections explain the basic usage of the robot, <b>all the users should read this chapter completely in order to have a minimal working system ready to play with the e-puck2 robot</b>. Some sections will have more detailed information that can be read by following the links provided.
 
When required, dedicated informations are given for all platforms (Windows, Linux, Mac). The commands given for Linux are related to the Ubuntu distribution, similar commands are available in other distributions.
 
==Turn on/off the robot==
To turn on the robot you need to press the power button (blue button) placed on the bottom side of the board, near the speaker, as shown in the following figures:
::<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/e-puck2-btn-on-off2.jpg <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2-btn-on-off2-small.jpg">][https://projects.gctronic.com/epuck2/wiki_images/e-puck2-btn-on-off.jpg <img width=300 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2-btn-on-off-small.jpg">]</span><br/>
To turn off the robot you need to press the power button for 1 second.
 
==Meaning of the LEDs==
The e-puck2 has three groups of LEDs that are not controllable by the user.
 
::<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/e-puck2_top_leds.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2_top_leds.png">]</span><br/>
::''Top view of the e-puck2''
 
*Charger: RED if charging, GREEN if charge complete and RED and GREEN if an error occurs
*USB: Turned ON if the e-puck2 detects a USB connection with a computer
*STATUS: Turned ON if the robot is ON and OFF if the robot is OFF. When ON, gives an indication of the level of the battery. Also blinks GREEN if the program is running during a debug session.
 
Battery level indications (STATUS RGB LED):
*GREEN if the system's tension is greater than 3.5V
*ORANGE if the system's tension is between 3.5V and 3.4V
*RED if the system's tension is between 3.4V and 3.3V
*RED blinking if the system's tension is below 3.3V
 
The robot is automatically turned OFF if the system's tension gets below 3.2V during 10 seconds.
 
==Connecting the USB cable==
A micro USB cable (included with the robot in the package) is needed to connect the robot to the computer. There are two connectors, one placed on top of the robot facing upwards and the other placed on the side of the robot, as shown in the following figures. Both can be used to charge the robot (up to 1 ampere) or to communicate with it, but do not connect two cables at the same time. Connect the USB cable where is more comfortable to you.
::<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/e-puck2-usb-conn.jpg <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2-usb-conn-small.jpg">][https://projects.gctronic.com/epuck2/wiki_images/e-puck2-usb-conn2.jpg <img width=300 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2-usb-conn2-small.jpg">]</span><br/>
 
==Installing the USB drivers==
The USB drivers must be installed only for the users of a Windows version older than Windows 10:
 
#Download and open [https://projects.gctronic.com/epuck2/zadig-2.3.exe zadig-2.3.exe]
#Connect the e-puck2 with the USB cable and turn it on. Three unknown devices appear in the device list of the program, namely '''e-puck2 STM32F407''', '''e-puck2 GDB Server (Interface 0)''' and '''e-puck2 Serial Monitor (Interface 2)'''.
#For each of the three devices mentioned above, select the <code>USB Serial (CDC)</code> driver and click on the <code>Install Driver</code> button to install it. Accept the different prompts which may appear during the process. At the end you can simply quit the program and the drivers are installed. These steps are illustrated on Figure 3 below.
::Note : The drivers installed are located in <code>C:\Users\"your_user_name"\usb_driver</code>
 
:<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/Zadig_e-puck2_STM32F407.png <img width=500 src="https://projects.gctronic.com/epuck2/wiki_images/Zadig_e-puck2_STM32F407.png">]</span><br/>
::''Example of driver installation for e-puck2 STM32F407''
 
The drivers are automatically installed with Windows 10, Linux and Mac OS.
 
Anyway in Linux in order to access the serial ports, a little configuration is needed. Type the following command in a terminal session: <code>sudo adduser $USER dialout</code>. Once done, you need to log off to let the change take effect.
 
==Finding the USB serial ports used==
Two ports are created by the e-puck2's programmer when the USB cable is connected to the robot (even if the robot is turned off):
* '''e-puck2 GDB Server'''. The port used to program and debug the e-puck2.
* '''e-puck2 Serial Monitor'''. Serial communication between the PC and the radio module (used also to program the radio module).
 
A third port could be available depending on the code inside the e-puck2's microcontroller. With the factory firmware a port named '''e-puck2 STM32F407''' is created.
===Windows===
#Open the Device Manager
#Under '''Ports (COM & LPT)''' you can see the virtual ports connected to your computer.
#Do a '''Right-click -> properties''' on the COM port you want to identify.
#Go under the '''details''' tab and select '''Bus reported device description''' in the properties list.
#The name of the port should be written in the text box below.
#Once you found the desired device, you can simply look at its port number '''(COMX)'''.
 
===Linux===
:1. Open a terminal window (<code>ctrl+alt+t</code>) and enter the following command: <code>ls /dev/ttyACM*</code>
:2. Look for '''ttyACM0''' and '''ttyACM1''' in the generated list, which are respectively '''e-puck2 GDB Server''' and '''e-puck2 Serial Monitor'''. '''ttyACM2''' will be also available with the factory firmware, that is related to '''e-puck2 STM32F407''' port
Note : Virtual serial port numbering on Linux depends on the connections order, thus it can be different if another device using virtual serial ports is already connected to your computer before connecting the robot, but the sequence remains the same.
 
===Mac===
:1. Open a terminal window and enter the following command: <code>ls /dev/cu.usbmodem*</code>
:2. Look for two '''cu.usbmodemXXXX''', where XXXX is the number attributed by your computer. You should find two names, with a numbering near to each other, which are respectively '''e-puck2 GDB Server''' (lower number) and '''e-puck2 Serial Monitor''' (higher number). A third device '''cu.usbmodemXXXX''' will be available with the factory firmware, that is related to '''e-puck2 STM32F407''' port
 
Note : Virtual serial port numbering on Mac depends on the physical USB port used and the device. If you want to keep the same names, you must connect to the same USB port each time.
 
==PC interface==
<span class="plainlinks">[https://projects.gctronic.com/epuck2/wiki_images/monitor.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/monitor_small.png">]<br/>
A PC application was developed to start playing with the robot attached to the computer via USB cable: you can have information about all the sensors, receive camera images and control the leds and motors.<br/>
Beware that it's not mandatory to download this application in order to work with the robot, but it is a nice demo that gives you an overview of all the sensors and actuators available on the robot, this is a first step to gain confidence with the robot.<br/>
 
With the factory firmwares programmed in the robot, place the selector in position 8, attach the USB cable and turn on the robot. Enter the correct port (the one related to <code>e-puck2 STM32F407</code>) in the interface and click <code>connect</code>.
 
The source code is available from the repository [https://github.com/e-puck2/monitor https://github.com/e-puck2/monitor].<br/>
 
===Available executables===
* [https://projects.gctronic.com/epuck2/monitor_win.zip Windows executable]: tested on Windows 7 and Windows 10
* [https://projects.gctronic.com/epuck2/monitor_mac.zip Max OS X executable]
* [https://projects.gctronic.com/epuck2/monitor_linux64bit.tar.gz Ubuntu 14.04 (or later) - 64 bit]
On Linux remember to apply the configuration explained in the chapter [http://www.gctronic.com/doc/index.php?title=e-puck2#Installing_the_USB_drivers Installing the USB drivers] in order to access the serial port.
 
==Installing the dependencies for firmwares updates==
You can update the firmware for all 3 chips: the main microcontroller, the radio module and the programmer. For doing that, you need some tools to be installed on the system.
 
===Windows===
To upload a new firmware in the microcontroller or in the radio module, you don't need to install anything, the packages provided include all the dependencies.
 
To upload a new firmware in the programmer you need to install an application called <code>DfuSe</code> released by STMicroelectronics. You can download it from [https://projects.gctronic.com/epuck2/en.stsw-stm32080_DfuSe_Demo_V3.0.5.zip DfuSe_V3.0.5.zip].
 
===Linux===
To upload a new firmware in the microcontroller or in the radio module, you need:
* Python (>= 3.4): <code>sudo apt-get install python3</code>
* Python pip: <code>sudo apt-get install -y python3-pip</code>
* pySerial (>= 2.5): <code>sudo pip3 install pyserial</code>
 
To upload a new firmware in the programmer you need:
* dfu-util: <code>sudo apt-get install dfu-util</code>
 
===Mac===
Install the [https://brew.sh Homewbrew] package manager by opening a terminal and issueing:<br/>
<code>/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</code><br/>
and then:<br/>
<code>brew upgrade</code><br/>
 
To upload a new firmware in the microcontroller or in the radio module, you need:
* Python (>= 3.4): <code>brew install python</code> (it will install also <code>pip</code>)
* pySerial (>= 2.5): <code>pip3 install pyserial</code>
 
To upload a new firmware in the programmer you need:
* dfu-util: <code>brew install dfu-util</code>
 
==PC side development==
This section is dedicated to the users that develop algorithms on the PC side and interact with the robot remotely through a predefined communication protocol. These users don't modify the firmware of the robot, but instead they use the factory firmware released with the robot. They update the robot firmware only when there is an official update. <br/>
The remote control of the robot, by receiving sensors values and setting the actuators, is done through the following channels: Bluetooth, Bluetooth Low Energy, WiFi, USB cable.<br/>
Examples of tools/environment used by these users:
# Aseba
# Simulator (e.g. Webots)
# ROS
# iOS, Android apps
# Custom PC application
# IoT (e.g. IFTTT)
If you fall into this category, then follow this section for more information: [http://www.gctronic.com/doc/index.php?title=e-puck2_PC_side_development PC side development].<br/>
 
=Main microcontroller=
The e-puck2 robot main microcontroller is a 32-bit STM32F407 that runs at 168 MHz (210 DMIPS) and include DSP, FPU and DMA capabilities. The version chosen for the e-puck2 has 192 KB of total RAM and 1024 KB of flash, so there is a lot of memory to work with.<br/>
This chip is responsible for handling the sensors and actuators and runs also the demos and algorithms.
 
==Factory firmware==
The main microcontroller of the robot is initially programmed with a firmware that includes many demos that could be started based on the selector position, here is a list of the demos with related position and a small description:
* Selector position 0: Aseba
* Selector position 1: Shell
* Selector position 2: Read proximity sensors and when an object is near a proximity, turn on the corresponding LED
* Selector position 3: Asercom protocol v2 (BT)
* Selector positoin 4: Range and bearing extension (receiver)
* Selector position 5: Range and bearing extension - clustering demo (simultaneous transmitter and receiver).
* Selector position 6: Move the robot back and forth exploiting the gyro, with LEDs animation
* Selector position 7: Play a wav (mono, 16 KHz) named "example.wav" from the micro sd when pressing the button
* Selector position 8: Asercom protocol v2 (USB)
* Selector position 9: Local communication: transceiver
* Selector position 10: this position is used to work with the Linux extensions. To work with gumstix refer to [http://www.gctronic.com/doc/index.php?title=Overo_Extension#e-puck2 Overo Extension: e-puck2] , to work with Pi-puck refer to [http://www.gctronic.com/doc/index.php?title=Pi-puck#Requirements Pi-puck: Requirements ].
* Selector position 11: Simple obstacle avoidance + some animation
* Selector position 12: Hardware test
* Selector position 13: LEDs reflect orientation of the robot
* Selector position 14: Compass
* Selector position 15: WiFi mode
The pre-built firmware is available here [https://projects.gctronic.com/epuck2/e-puck2_main-processor_10.12.21_52ffc6b.elf main microcontroller factory firmware (10.12.21)].
 
==Firmware update==
Now and then there could be an official firmware update for the robot and it's important to keep the robot updated with the last firmware to get possibile new features, improvements and for bug fixes.<br/>
The onboard programmer run a GDB server, so we use GDB commands to upload a new firmware, for this reason a toolchain is needed to upload a new firmware to the robot.<br/>
The following steps explain how to update the main microcontroller firmware:<br/>
1. Download the package containing the required toolchain and script to program the robot: [https://projects.gctronic.com/epuck2/e-puck2-prog-main-micro-windows.zip Windows], Linux [https://projects.gctronic.com/epuck2/e-puck2-prog-main-linux32.tar.gz 32 bits]/[https://projects.gctronic.com/epuck2/e-puck2-prog-main-linux64.tar.gz 64 bits], [https://projects.gctronic.com/epuck2/e-puck2-prog-main-micro-macos.zip Mac OS]<br/>
2. Download the last version of the [https://projects.gctronic.com/epuck2/e-puck2_main-processor_10.12.21_52ffc6b.elf main microcontroller factory firmware (10.12.21)], or use your custom firmware<br/>
3. Extract the package and put the firmware file (with <code>elf</code> extension) inside the package directory; beware that only one <code>elf</code> file must be present inside this directory<br/>
4. Attach the USB cable and turn on the robot<br/>
5. Run the script from the package directory:<br/>
:Windows: double click <code>program.bat</code><br/>
:Linux/Mac: issue the following command in a terminal <code>./program.sh</code>. If you get permission errors, then issue <code>sudo chmod +x program.sh</code> to let the script be executable.<br/>
 
When the upload is complete you'll see an output like in the following figure:<br/>
<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/f407-flashing.png <img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/f407-flashing.png">]</span><br/>
The final lines should contain the entry <code>".data",</code>, this means that the upload was successfull. You can then close the terminal window if it is still open.


If you encounter some problem, try to unplug and plug again the USB cable and power cycle the robot, then retry.


==Robot side development==
==e-puck 1==
If you are an embedded developer and are brave enough, then you have complete access to the source code running on the robot, so you can discover what happen inside the main microcontroller and modify it to accomodate your needs. Normally the users that fall into this category develop algorithms optimized to run directly on the microcontroller, such as:
A simple [https://projects.gctronic.com/randb/test-eRandB.zip MPLAB project] was created to let start using these modules. With the selector it's possible to choose whether the robot is an emitter (selector in position 0) or a receiver (selector in position 1). The receiver will send the information (data, bearing, distance, sensor) through Bluetooth.
# onboard image processing
# swarm algorithms
# fully autonomous behaviors
# ...
For more information about programming the robot itself, refer to section [http://www.gctronic.com/doc/index.php?title=e-puck2_robot_side_development Robot side development]


=Radio module=
==e-puck 2==
The radio module chosen for the e-puck is the new ESP32 chip from [https://www.espressif.com/ Espressif], integrating a dual core that run up to 240 MHz, 4 MB of flash and 520 KB of RAM. It supports WiFi standards 802.11 b/g/n (access point mode supported), Bluetooth and Bluetooth LE 4.2. It is the successor of the ESP8266 chip. The following figure shows the various peripherals available on the ESP32:<br/>
The e-puck2 standard firmware contains a demo example to use the range and bearing extension. When the selector is in position 4 then the robot is the receiver, when in position 5 then the robot is the transmitter. The receiver will print (you need to connect the USB cable and open the USB serial port) the data received, the bearing, the distance and the sensor id; while the transmitter will send continously <code>0xAAFF</code>.<br/>
<span class="plain links"><img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/esp32-peripherals.png"></span>
You can download the pre-built firmware from [https://projects.gctronic.com/epuck2/e-puck2_main-processor_randb.elf e-puck2_main-processor_randb.elf]; the source code is available form the repo [https://github.com/e-puck2/e-puck2_main-processor https://github.com/e-puck2/e-puck2_main-processor].<br/>
Beware that the only communication channel available between the robot and the range and bearing extension is the I2C bus, the UART channel is not available with e-puck 2.


This chip first of all is responsible for handling the wireless communication, moreover it handles also the RGB LEDs (with PWM) and the user button. The RGB LEDs and button are connected to the radio module due to the pin number limitation on the main microcontroller.
=Ground sensors=
<span class="plainlinks">[http://www.gctronic.com/doc/images/E-puck-groundsensors.jpg <img width=200 src="http://www.gctronic.com/doc/images/E-puck-groundsensors.jpg">]</span>


==Factory firmware==
The factory firmware of both the e-puck1 and e-puck2 supports the ground sensors extension: for e-puck1 refer to the section [https://www.gctronic.com/doc/index.php?title=E-Puck#Standard_firmware Standard firmware], for e-puck2 refer to section [https://www.gctronic.com/doc/index.php?title=e-puck2#Factory_firmware Factory firmware].
The radio module of the robot is initially programmed with a firmware that supports Bluetooth communication.<br/>
The pre-built firmware is available here [https://projects.gctronic.com/epuck2/esp32-firmware_11.12.18.zip radio module factory firmware (11.12.18)].


==WiFi firmware==
Once the robot is programmed with its factory firmware, you can get the values from the ground sensors through Bluetooth by putting the selector in position 3 and issueing the command <code>m</code> that will return 5 values, the first 3 values are related to the ground sensors (left, center, right), the last 2 values are related to the cliff extension (if available).<br/>
At the moment the factory firmware supports only Bluetooth, if you want to work with WiFi you need to program the radio with a dedicated firmware, refer to section [http://www.gctronic.com/doc/index.php?title=e-puck2_PC_side_development#WiFi PC side development: WiFi].
For more information about the Bluetooth connection refer to section [https://www.gctronic.com/doc/index.php?title=E-Puck#Getting_started Getting started] (e-puck1) or [https://www.gctronic.com/doc/index.php?title=e-puck2_PC_side_development#Connecting_to_the_Bluetooth Connecting to the Bluetooth] (e-puck2).<br/>
For more information about the Bluetooth protocol refer to section [https://www.gctronic.com/doc/index.php?title=Advanced_sercom_protocol Advanced sercom protocol].


==BLE firmware==
If you couple the e-puck extension for Gumstix Overo with the ground sensor refer to the section [http://www.gctronic.com/doc/index.php/Overo_Extension#Ground_sensor http://www.gctronic.com/doc/index.php/Overo_Extension#Ground_sensor] to have an example on how to read the sensor values.
At the moment the factory firmware supports only calssic Bluetooth, if you want to work with Bluetooth Low Energy you need to program the radio with a dedicated firmware, refer to section [http://www.gctronic.com/doc/index.php?title=e-puck2_mobile_phone_development Mobile phone development].


==Firmware update==
You can find more information about the ground sensors extension module in the following link [http://www.e-puck.org/index.php?option=com_content&view=article&id=17&Itemid=18 http://www.e-puck.org/index.php?option=com_content&view=article&id=17&Itemid=18].<br/>
In order to update the firmware of the ESP32 WiFi module you need to use a python script called <code>esptool</code> provided by [https://www.espressif.com/ Espressif] (manufacturer of the chip). This script was modified to work with the e-puck2 robot and is included in the provided package. The following steps explain how to update the radio module firmware:<br/>
1. Download the package containing the required tools and script to program the robot: [https://projects.gctronic.com/epuck2/e-puck2-prog-radio-windows.zip Windows], [https://projects.gctronic.com/epuck2/e-puck2-prog-radio-macos.zip Linux / Mac]<br/>
2. Download the last version of the [https://projects.gctronic.com/epuck2/esp32-firmware_11.12.18.zip radio module factory firmware (11.12.18)], or use another firmware (e.g. WiFi, BLE, your own). The firmware is composed by 3 files named <code>bootloader.bin</code>, <code>ESP32_E-Puck_2.bin</code> and <code>partitions_singleapp.bin</code><br/>
3. Extract the package and put the firmware files inside the package directory; beware that the name of the <code>.bin</code> files must be the same as indicated in step 2<br/>
4. Attach the USB cable and turn on the robot<br/>
5. Run the script from the package directory:<br/>
:Windows: double click <code>program.bat</code><br/>
:Linux/Mac: issue the following command in a terminal <code>./program.sh</code>. If you get permission errors, then issue <code>sudo chmod +x program.sh</code> to let the script be executable.<br/>


The upload should last about 10-15 seconds and you'll see the progress as shown in the following figure:<br/>
==Assembly for e-puck2==
<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing1.png <img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing1.png">]</span><br/>
<span class="plainlinks"><table><tr><td align="center">[1]</td><td align="center">[2]</td><td align="center">[3.1]</td><td align="center">[3.2]</td><td align="center">[3.3]</td><td align="center">[3.4]</td></tr><tr><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-1.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-1_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-2.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-2_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.1.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.1_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.2.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.2.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.3.jpeg <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.3_small.jpeg">][https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.4.jpeg <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.4_small.jpeg">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.5.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-3.5.png">]</td></tr><tr><td align="center">[4]</td><td align="center">[5.1]</td><td align="center">[5.2]</td><td align="center">[5.3]</td><td align="center">[5.4]</td><td align="center">[6]</td></tr><tr><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-4.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-4_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.1.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.1_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.2.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.2_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.3.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.3_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.4.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-5.4_small.png">]</td><td align="center">[https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-6.png <img height=200 src="https://projects.gctronic.com/epuck2/wiki_images/ground-assembly-6_small.png">]</td></tr></table></span>
When the upload is complete you'll see that all 3 bin files are uploaded correctly as shown in the following figure:<br/>
# Unscrew the 3 spacers and remove the battery.
<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing2.png <img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing2.png">]</span><br/>
# Remove the top side from the case body gently.
# Detach the plastic camera adapter from the camera with the help of pliers; be careful to not stress the camera flex cable. Then you need to cut off the two protruding pieces (see 3.2) on the back of the plastic adapter; for this operation you can use nippers (see 3.3). Take the adapter (now is flat on the back as shown in 3.4) and insert it as before.
# Plug the ground module into its connector on the e-puck2; make the cable pass through the battery contact.
# First push the ground module within its slot in the body case, then slide in also the top side of the robot paying attention to the motors wires position: the back battery contact must remain between the body and motors wires and make sure the wires aren't stuck in the springs. Both the ground cable and camera flex cable must bend forming an "S" shape.
# Push the top all way down, then remount the spacers and plug in the battery. You're done.


Sometime you could encounter a timeout error as shown in the following figures; in these cases you need to unplug and plug again the USB cable and power cycle the robot, then you can retry.<br/>
=Cliff sensor=
<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing3.png <img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing3.png">]</span>
The cliff module extends the capability of the groundsensor with two additional sensors placed in front of the wheels. One possible application is that the e-puck can now detect the end of a table and react accordingly. Moreover this module can be coupled with the automatic charger for the e-puck, that could let the robot autonomously charge itself when needed. The two spring contacts adapt only to the cliff module.
<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing4.png <img width=400 src="https://projects.gctronic.com/epuck2/wiki_images/esp32-flashing4.png">]</span><br/>


==Development==
==Assembly==
Probably, you'll never need to touch the firmware running in the radio module, but in case you need to modify the code or you're simply curious about what is happening at the low level, then refer to the section [http://www.gctronic.com/doc/index.php?title=e-puck2_radio_module_development Radio module development].
<span class="plainlinks"><table><tr><td align="center">[1]</td><td align="center">[2]</td><td align="center">[3]</td><td align="center">[4.1]</td><td align="center">[4.2]</td></tr><tr><td>[http://www.gctronic.com/doc/images/cliff-mounting-1.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-1-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-2.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-2-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-3.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-3-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-4-1.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-4-1-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-4-2.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-4-2-small.jpg">]</td></tr><tr><td align="center">[5.1]</td><td align="center">[5.2]</td><td align="center">[6]</td><td align="center">[7]</td><td align="center">[8]</td></tr><tr><td>[http://www.gctronic.com/doc/images/cliff-mounting-5-1.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-5-1-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-5-2.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-5-2-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-6.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-6-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-7.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-7-small.jpg">]</td><td>[http://www.gctronic.com/doc/images/cliff-mounting-8.jpg <img height=200 src="http://www.gctronic.com/doc/images/cliff-mounting-8-small.jpg">]</td></tr></table></span>
# Unscrew the 3 screws, unmount the e-jumper (top piece where there is the speaker) and unscrew the 3 spacers
# Remove the pcb from the case body gently
# Detach the two parts, cliff and ground pcb
# Plug the ground module into its connector on the e-puck
# Attach the cliff module to the ground module being careful to leave the battery contact in the middle
# Push the ground module within its slot in the body case, the cliff module will remain external
# Once both the modules are aligned, push them down
# The modules will remain really close to the case bottom; once the modules are fitted remount the spacers, the e-jumper and the screws


=Programmer=
==Electrical schema==
The e-puck2 robot is equipped with an onboard programmer and debugger that let you update the firmware of the robot and debug your code easily using a standard USB interface. There is a dedicated STM32F413 microcontroller that acts as the programmer with built in GDB server, so you can control exactly what happens using the [https://www.gnu.org/software/gdb/ GNU Project Debugger] in your host machine.<br/>
The circuit diagram of the e-puck cliff extension is available to the community on the following link [https://projects.gctronic.com/cliff-sensor/CliffSensorV1.0.pdf electrical schema].  
The programmer microcontroller is also in charge of handling various low level features such as the configuration of the USB hub and the power button.


==Factory firmware==
==Software==
The programmer is initially programmed with a firmware based on a '''''modified version''''' of [https://github.com/blacksphere/blackmagic/wiki Black Magic Probe programmer/debugger].<br/>
===e-puck firmware===
The pre-built firmware is available here [https://projects.gctronic.com/epuck2/e-puck2_programmer_28.05.20_3b600ec.bin programmer-firmware.bin (28.05.20)]; it is also available in dfu format here [https://projects.gctronic.com/epuck2/e-puck2_programmer_28.05.20_3b600ec.dfu programmer-firmware.dfu (28.05.20)].
Refers to the section [http://www.gctronic.com/doc/index.php/E-Puck#Standard_firmware E-Puck Standard firmware] for the firmware that need to be uploaded to the robot.
Essentially the standard ''asercom'' demo (selector 3) released with the e-puck robot is extended in order to request and visualize 5 sensors values instead of 3 when issueing the ''m'' command; the sequence is: ground left, ground center, ground right, cliff right, cliff left. In order to enable the cliff sensors you need to ''define CLIFF_SENSORS'' in the ''asercom.c'' file in order to build the code parts related to this module.


==Firmware update==
===e-puck demos===
The programmer's microcontroller features a factory bootloader that can be entered by acting on some special pins, the bootloader mode is called DFU (device firmware upgrade). You can enter DFU mode by contacting two pinholes together while inserting the USB cable (no need to turn on the robot). The two pin holes are located near the USB connector of the e-puck2, see the photo below.
To demonstrate the capabilities of the cliff sensors module here is an MPLAB project [https://projects.gctronic.com/cliff-sensor/Demo-cliff-autocharge.zip Demo-cliff-autocharge.zip] that contains two demos:
* selector 0: in this demo the robot is eventually piloted to the charger station autonomously after moving around for some time aovoiding obstacles; the demo is shown in the [http://www.gctronic.com/doc/index.php/Others_Extensions#Videos video section].<br/>
* selector 1: this is a cliff avoidance demo in which the robot is moved forward until it detects the end of the table and tries to avoid it moving back and rotating; the demo is shown in the [http://www.gctronic.com/doc/index.php/Others_Extensions#Videos video section].


::<span class="plain links">[https://projects.gctronic.com/epuck2/wiki_images/e-puck2_top_leds_DFU_413.png <img width=200 src="https://projects.gctronic.com/epuck2/wiki_images/e-puck2_top_leds_DFU_413.png">]</span><br/>
===Extension firmware===
::''Location of the pin holes to put the programmer into DFU''
The ground sensor fimrware developed at EPFL (can be downloaded at the [http://www.e-puck.org http://www.e-puck.org] site from [http://www.e-puck.org/index.php?option=com_phocadownload&view=category&id=9:ground-sensors&Itemid=38 this page]) was extended to interact with the additional two sensors. The source code can be downloaded from [https://projects.gctronic.com/cliff-sensor/pic18_floor_sensor_c18-cliff.zip cliff-firmware]; it is an MPLAB project and the MPLAB C Compiler for PIC18 MCUs is needed to build the project.<br/>
The communication between the e-puck and the module is handled through I2C (address 0xC0) and the following registers are defined:
* 0x00: reflected light, left IR sensor - high byte
* 0x01: reflected light, left IR sensor - low byte
* 0x02: reflected light, center IR sensor - high byte
* 0x03: reflected light, center IR sensor - low byte
* 0x04: reflected light, right IR sensor - high byte
* 0x05: reflected light, right IR sensor - low byte
* 0x06: ambient light, left IR sensor - high byte
* 0x07: ambient light, left IR sensor - low byte
* 0x08: ambient light, center IR sensor - high byte
* 0x09: ambient light, center IR sensor - low byte
* 0x0A: ambient light, right IR sensor - high byte
* 0x0B: ambient light, right IR sensor - low byte
* 0x0C: software revision number
* 0x0D: reflected light, right cliff sensor - high byte
* 0x0E: reflected light, right cliff sensor - low byte
* 0x0F: reflected light, left cliff sensor - high byte
* 0x10: reflected light, left cliff sensor - low byte
* 0x11: ambient light, right cliff sensor - high byte
* 0x12: ambient light, right cliff sensor - low byte
* 0x13: ambient light, left cliff sensor - high byte
* 0x14: ambient light, left cliff sensor - low byte


The programmer will be recognized as <code>STM Device in DFU Mode</code> device.
===e-puck2 demos===
The same demo developed for the e-puck1 that let the robot autonomously reach the charging station and charge itself is available also for the e-puck2. You can find the source code in the following repository [https://github.com/e-puck2/e-puck2_cliff_autocharge https://github.com/e-puck2/e-puck2_cliff_autocharge].


'''Note for Windows users''': the device should be recognized automatically (in all Windows versions), but in case it won't be detected then you need to install a <code>libusbK</code> driver for the DFU device.<br>
==Images==
Follow the same procedure as explained in section [http://www.gctronic.com/doc/index.php?title=e-puck2#Installing_the_USB_drivers Installing the USB drivers] using <code>libusbK</code> driver instead of <code>USB Serial (CDC)</code>.
Robot equipped with the cliff sensor: <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Cliff+charger.jpg <img width=300 src="http://www.gctronic.com/doc/images/Cliff+charger.jpg">]</span> <br/>


===Linux/Mac===
The robot can be easily moved to the charging station as shown in the following figure: <br/>
In order to update the programmer firmware you need an utility called <code>dfu-util</code>, it should be already installed from section [http://www.gctronic.com/doc/index.php?title=e-puck2#Installing_the_dependencies_for_firmwares_updates Installing the dependencies for firmwares updates].<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Cliff-charging.jpg <img width=300 src="http://www.gctronic.com/doc/images/Cliff-charging.jpg">]</span> <br/>
To uplaod the firmware, issue the following command: <code>sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000 -D programmer-firmware.bin</code>


===Windows===
The following figure shows the two additional sensors (near the wheels) mounted on the cliff module and the three frontal sensors of the ground module: <br/>
Start the <code>DfuSe</code> application (previously installed from section [http://www.gctronic.com/doc/index.php?title=e-puck2#Installing_the_dependencies_for_firmwares_updates Installing the dependencies for firmwares updates]). The programmer in DFU mode will be automatically detected as shown in figure 1. Then you need to open the compiled firmware by clicking on <code>choose</code> and then locating the file with <code>dfu</code> extension,  as shown in figure 2. Now click on the <code>upgrade</code> button, a warning message will be shown, confirm the action by clicking on <code>yes</code> as shown in figure 3. If all is ok you'll be prompted with a message saying that the upgrade was successfull as shown in figure 4.<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Cliff-zoom.jpg <img width=300 src="http://www.gctronic.com/doc/images/Cliff-zoom.jpg">]</span> <br/>
<span class="plainlinks">
<table>
<tr>
<td align="center">[1]</td>
<td align="center">[2]</td>
<td align="center">[3]</td>
<td align="center">[4]</td>
</tr>
<tr>
<td>[https://projects.gctronic.com/epuck2/wiki_images/dfu1.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/dfu1.png">]</td>
<td>[https://projects.gctronic.com/epuck2/wiki_images/dfu2.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/dfu2.png">]</td>
<td>[https://projects.gctronic.com/epuck2/wiki_images/dfu3.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/dfu3.png">]</td>
<td>[https://projects.gctronic.com/epuck2/wiki_images/dfu4.png <img width=250 src="https://projects.gctronic.com/epuck2/wiki_images/dfu4.png">]</td>
</tr>
</table>
</span><br/>


==Development==
==Videos==
The programmer code shouldn't be modified, but if you know what you're doing then refer to section [http://www.gctronic.com/doc/index.php?title=e-puck2_programmer_development Programmer development].
{{#ev:youtube|7iFmLBng3qg}}
{{#ev:youtube|NYOcb1QoUTM}}

Revision as of 09:00, 17 December 2021

Range and bearing


The board allows situated agents to communicate locally, obtaining at the same time both the range and the bearing of the emitter without the need of any centralized control or any external reference. Therefore, the board allows the robots to have an embodied, decentralized and scalable communication system. The system relies on infrared communications with frequency modulation and is composed of two interconnected modules for data and power measurement.

The documentation and hardware files are available in the following links:

You can find more information about this board in the following links: http://www.e-puck.org/index.php?option=com_content&view=article&id=35&Itemid=23.

The following table lists the I2C the registers map:

Address Read Write
0 1 if data available, 0 otherwise -
1 data MSB -
2 data LSB -
3 bearing MSB -
4 bearing LSB: double((MSB<<8)+LSB)*0.0001 to get angle in degrees -
5 range MSB -
6 range LSB -
7 max peak (adc reading) MSB -
8 max peak (adc reading) LSB -
9 sensor that received the data (between 0..11) -
12 - Set transmission power (communication range): between 0 (max range) and 255 (min range)
13 - data LSB (prepare)
14 - data MSB (send (MSB<<8)+LSB)
16 - 0 store light conditions (calibration)
17 - 1=onboard calculation, 0=host calculation

Firmware source code

e-puck 1

A simple MPLAB project was created to let start using these modules. With the selector it's possible to choose whether the robot is an emitter (selector in position 0) or a receiver (selector in position 1). The receiver will send the information (data, bearing, distance, sensor) through Bluetooth.

e-puck 2

The e-puck2 standard firmware contains a demo example to use the range and bearing extension. When the selector is in position 4 then the robot is the receiver, when in position 5 then the robot is the transmitter. The receiver will print (you need to connect the USB cable and open the USB serial port) the data received, the bearing, the distance and the sensor id; while the transmitter will send continously 0xAAFF.
You can download the pre-built firmware from e-puck2_main-processor_randb.elf; the source code is available form the repo https://github.com/e-puck2/e-puck2_main-processor.
Beware that the only communication channel available between the robot and the range and bearing extension is the I2C bus, the UART channel is not available with e-puck 2.

Ground sensors

The factory firmware of both the e-puck1 and e-puck2 supports the ground sensors extension: for e-puck1 refer to the section Standard firmware, for e-puck2 refer to section Factory firmware.

Once the robot is programmed with its factory firmware, you can get the values from the ground sensors through Bluetooth by putting the selector in position 3 and issueing the command m that will return 5 values, the first 3 values are related to the ground sensors (left, center, right), the last 2 values are related to the cliff extension (if available).
For more information about the Bluetooth connection refer to section Getting started (e-puck1) or Connecting to the Bluetooth (e-puck2).
For more information about the Bluetooth protocol refer to section Advanced sercom protocol.

If you couple the e-puck extension for Gumstix Overo with the ground sensor refer to the section http://www.gctronic.com/doc/index.php/Overo_Extension#Ground_sensor to have an example on how to read the sensor values.

You can find more information about the ground sensors extension module in the following link http://www.e-puck.org/index.php?option=com_content&view=article&id=17&Itemid=18.

Assembly for e-puck2

[1][2][3.1][3.2][3.3][3.4]
[4][5.1][5.2][5.3][5.4][6]
  1. Unscrew the 3 spacers and remove the battery.
  2. Remove the top side from the case body gently.
  3. Detach the plastic camera adapter from the camera with the help of pliers; be careful to not stress the camera flex cable. Then you need to cut off the two protruding pieces (see 3.2) on the back of the plastic adapter; for this operation you can use nippers (see 3.3). Take the adapter (now is flat on the back as shown in 3.4) and insert it as before.
  4. Plug the ground module into its connector on the e-puck2; make the cable pass through the battery contact.
  5. First push the ground module within its slot in the body case, then slide in also the top side of the robot paying attention to the motors wires position: the back battery contact must remain between the body and motors wires and make sure the wires aren't stuck in the springs. Both the ground cable and camera flex cable must bend forming an "S" shape.
  6. Push the top all way down, then remount the spacers and plug in the battery. You're done.

Cliff sensor

The cliff module extends the capability of the groundsensor with two additional sensors placed in front of the wheels. One possible application is that the e-puck can now detect the end of a table and react accordingly. Moreover this module can be coupled with the automatic charger for the e-puck, that could let the robot autonomously charge itself when needed. The two spring contacts adapt only to the cliff module.

Assembly

[1][2][3][4.1][4.2]
[5.1][5.2][6][7][8]
  1. Unscrew the 3 screws, unmount the e-jumper (top piece where there is the speaker) and unscrew the 3 spacers
  2. Remove the pcb from the case body gently
  3. Detach the two parts, cliff and ground pcb
  4. Plug the ground module into its connector on the e-puck
  5. Attach the cliff module to the ground module being careful to leave the battery contact in the middle
  6. Push the ground module within its slot in the body case, the cliff module will remain external
  7. Once both the modules are aligned, push them down
  8. The modules will remain really close to the case bottom; once the modules are fitted remount the spacers, the e-jumper and the screws

Electrical schema

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

Software

e-puck firmware

Refers to the section E-Puck Standard firmware for the firmware that need to be uploaded to the robot. Essentially the standard asercom demo (selector 3) released with the e-puck robot is extended in order to request and visualize 5 sensors values instead of 3 when issueing the m command; the sequence is: ground left, ground center, ground right, cliff right, cliff left. In order to enable the cliff sensors you need to define CLIFF_SENSORS in the asercom.c file in order to build the code parts related to this module.

e-puck demos

To demonstrate the capabilities of the cliff sensors module here is an MPLAB project Demo-cliff-autocharge.zip that contains two demos:

  • selector 0: in this demo the robot is eventually piloted to the charger station autonomously after moving around for some time aovoiding obstacles; the demo is shown in the video section.
  • selector 1: this is a cliff avoidance demo in which the robot is moved forward until it detects the end of the table and tries to avoid it moving back and rotating; the demo is shown in the video section.

Extension firmware

The ground sensor fimrware developed at EPFL (can be downloaded at the http://www.e-puck.org site from this page) was extended to interact with the additional two sensors. The source code can be downloaded from cliff-firmware; it is an MPLAB project and the MPLAB C Compiler for PIC18 MCUs is needed to build the project.
The communication between the e-puck and the module is handled through I2C (address 0xC0) and the following registers are defined:

  • 0x00: reflected light, left IR sensor - high byte
  • 0x01: reflected light, left IR sensor - low byte
  • 0x02: reflected light, center IR sensor - high byte
  • 0x03: reflected light, center IR sensor - low byte
  • 0x04: reflected light, right IR sensor - high byte
  • 0x05: reflected light, right IR sensor - low byte
  • 0x06: ambient light, left IR sensor - high byte
  • 0x07: ambient light, left IR sensor - low byte
  • 0x08: ambient light, center IR sensor - high byte
  • 0x09: ambient light, center IR sensor - low byte
  • 0x0A: ambient light, right IR sensor - high byte
  • 0x0B: ambient light, right IR sensor - low byte
  • 0x0C: software revision number
  • 0x0D: reflected light, right cliff sensor - high byte
  • 0x0E: reflected light, right cliff sensor - low byte
  • 0x0F: reflected light, left cliff sensor - high byte
  • 0x10: reflected light, left cliff sensor - low byte
  • 0x11: ambient light, right cliff sensor - high byte
  • 0x12: ambient light, right cliff sensor - low byte
  • 0x13: ambient light, left cliff sensor - high byte
  • 0x14: ambient light, left cliff sensor - low byte

e-puck2 demos

The same demo developed for the e-puck1 that let the robot autonomously reach the charging station and charge itself is available also for the e-puck2. You can find the source code in the following repository https://github.com/e-puck2/e-puck2_cliff_autocharge.

Images

Robot equipped with the cliff sensor:

The robot can be easily moved to the charging station as shown in the following figure:

The following figure shows the two additional sensors (near the wheels) mounted on the cliff module and the three frontal sensors of the ground module:

Videos