RGB Swarm Robot Quickstart Guide
(→Programming the XBee Radio)
Revision as of 13:48, 9 September 2009
This guide was written as a quickstart guide for the RGB Swarm Robot Project, but contains general information about programming e-pucks and using the vision system.
- Physical Set up
- Computer Programs needed
- Download this
- Set up that
- RGB_Swarm_Puck_Code_working_version.zip This is the RGB Swarm code for the e-puck; install via directions below
Preparing the code
- if you have the HEX file, skip down
- getting HEX file
Connecting the e-puck
- Go to start menu >> control panel >> Bluetooth Devices
- Click the 'Add...' button in the lower left of the dialog window
- Turn on the e-puck that you wish to configure/connect to the computer
- Check the box next to 'My device is set up and ready to be found.'
- Continue with the Next button, and the computer will search for your e-puck
- Once the computer finds your e-puck, select the appropriate e-puck (should be ID'd by the 4 digit ID number), and assign the 4 digit ID number as the 'passkey' for that e-puck
- This process reserves a pair of COM(serial) port for that specific e-puck, one as Incoming and the other as Outgoing; each e-puck will have a different pair of ports
- Return to the Bluetooth Devices Dialog screen, and click on the COM Ports tab
- Check which COM ports are assigned to your e-puck, specifically the Outgoing COM port; this COM port will be used when programming this e-puck with the TinyBootloader program
- Note: if using a USB Bluetooth dongle, when the dongle is unplugged and replugged it into a different USB port, or a different dongle altogether is used, it may be necessary to repeat these steps for each e-puck that you wish to use
- Note: these instructions are for using Windows XP Professional Edition. The exact command paths and dialog boxes may differ from OS to OS
Programming the e-puck
Programming the e-puck requires a specific program, called a bootloader, in order to (re)program the microcontroller. The bootloader makes use of the bluetooth/serial port connection, allowing for wireless programming, as opposed to connecting a specific serial port connector directly to the microcontroller. This expedites the reprogramming process. The bootloader is comprised of two parts, one which operates on the e-puck, writing code to the e-puck microcontroller, and the other, which operates on the computer as user interface. On the e-puck side, the bootloader quickly checks to see if something is trying to re-program the PIC. If so, the bootloader will simply write the new software over the old, and then run the new software. If not, the bootloader simply allows the PIC to run the program currently loaded. The computer side allows a user to select which COM port to program over (allowing one to select which e-puck to program), and selecting what HEX file to program to the e-puck.
To program the e-puck with a bootloader, follow these instructions:
- Note: you will have to compile and build the C code from the Microchip C compiler, as the .hex file is needed to install onto the e-puck
- Start the Tiny Bootloader program on your computer
- Click the Browse button and select the .hex file that corresponds to the e-puck code that you want to program
- Set 115200 under the Comm dropdown menu, and select the COM port that corresponds with the OUTGOING COM port of the e-puck
- Click the Write Flash button
- Immediately click the blue reset button on the e-puck
- Note: The reset button must be clicked before the blue status bar on the Tiny Bootloader dialog screen reaches zero, representing the program timing out.
- Once the bootloader starts writing software, the blue status bar will grow, representing code being uploaded and programmed
- Note: In addition to the blue status bar, a orange LED on the e-puck will light up, signaling that a connection has been made
- If Tiny Bootloader cannot connect to the COM port, make sure your e-puck is on, and that you've selected the correct COM port assigned to the e-puck (the ID of the e-puck is on a sticker on top of the bluetooth chip on the e-puck's PCB.
- If Tiny Bootloader can connect to the e-puck but cannot find the PIC, it may be that someone has overwritten the bootloader with another program. If this is the case, you will need to reload the bootloader.
- MPLAB and the ICD2 programmer are needed to reload the Tiny Bootloader software via the flash port of the e-puck
- Go to http://www.e-puck.org, goto Download >> Software >> Library, download the zip file, and extract the archive
- Navigate to e-puck-lib\tool\bootloader\epuck_side, look for tinybld_ds6014A_7.37Mhz_115200uart1_8xPLL_with_LEDs.hex hex file.
- Open MPLAB
- Go to Programmer >> Select Programmer >> MPLAB ICD 2
- Go to File >> Import
- Select the tinybld_ds6014A_7.37Mhz_115200uart1_8xPLL_with_LEDs.hex file
- Go to Programmer >> Connect, and when connected, go to Programmer >> Program
- Note: flash programming the e-puck takes significantly more time that programming via the bluetooth port, so please be patient
Programming the XBee Radio
Please refer to this page for reprogramming the Xbee Radio: Configuration for e-puck XBee radios
Machine Vision Localization System
- Machine Vision Localization System Code