Getting Started: How to work with kilobots

From Kilobots
Jump to: navigation, search

The following instructions to operate with the kilobots require the firmware 2.0 installed on both the Overhead Controller (see OHC Firmware) and on the kilobots (see Kilobot Firmware).


To operate with the kilobots, we recommend the use of the KiloGUI software.
The KiloGUI can be downloaded from GitHub here:
A complete documentation about its functioning can be found on the kilobotics website:
On Linux, run kilogui with sudo privileges.

Upload your first control software on a kilobot

Try to upload a test control software on kilobots following these steps:

  • download the file: blank.hex
  • run kiloGui
  • select as Program file the file you just downloaded
  • turn on the kilobot by adding the power jumper (see Figure), and place it under the IR communication cone of the OHC (see Figure).
  • click on Bootload button (and the kilobot must switch on the blue LED immediately)
  • when the blue LED is on, click on Upload and wait some seconds (the kilobot's LED should blink at high frequency)
  • when the kilobot stops blinking, try to run the program on kilobot, by clicking the button Run
  • the expected behaviour is the robot keeping blinking in alternate colours red and green. Have fun! :-)
Do not upload on kilobots files downloaded from this page:
They are not compatible with the current firmware 2.0 and will corrupt the kilobot firmware. In case you have done it, the only solution to resurrect the corrupted kilobot is by wire uploading the firmware. If you need to do this, follow the instructions on the page Kilobot Firmware.

Write your own control software

The API documentation of the firmware 2.0 functions is available here:
A good tutorial to learn how to program kilobots can be found here:

Compile your own control software

To compile the control software for the kilobot, use the kilolib that you can download from GitHub here:
Needed dependencies are avr-libc, gcc-avr, avrdude:

on Ubuntu:
sudo apt-get install avr-libc gcc-avr avrdude
on Mac OSX:
  brew tap larsimmisch/avr 
  brew install avr-libc
  brew install avrdude --with-usb
in case the tap larsimmisch/avr does not work, you can try with this:
  brew tap osx-cross/avr
  brew install avr-libc

Begin with a test by compiling the blank.c file, executing the command:

cd <path-to-the-kilolib-dir>
make blank

You will find the compiled control software as a hex file in the directory build/
Then, edit the Makefile to compile your own code.

Alternatively, you can download and compile another example using the template code available here (Template code).
For Mac users with processor M1, you can use this code (Template code for Mac M1) which uses Rosetta and a specific version of avr-gcc@12, avr-binutils, and avrdude; in order to make it work with your installation, please edit the file `MakefileTemplate` and use the correct path to your executables.
Download the code and execute:

cd <path-to-the-template-code-dir>
./ test

You will find the compiled control software as a hex file in the directory build/
Then, run the script the ./ with your filename to compile your own code.