The infrared (IR) transmitter and receiver on Kilobots are the most important communication channels between Kilobots. The received IR signal strengths also indicate their relative distances. The original design required an external distance calibration board but it wouldn’t work and it would be very time consuming to calibrate each Kilobot individually. A common practice at multiple labs is to hard-code such IR to distance calibration table in the EEPROM of the Kilobots.
This page explains the procedure to obtain a meaningful distance calibration look-up table based on the received IR signal strengths. By eliminating the calibration board, Kilobots no longer have to be calibrated one at a time. Instead, a common distance look-up table is shared, which is obtained by averaging multiple measurements between multiple Kilobot pairs.
Step 1: Pick a few Kilobots randomly, and label them for identification purpose later on. For example, suppose three Kilobots are picked and labeled as A, B, C. More Kilobots would be even better.
Step 2: Keep Kilobot A to be connected to OHC through the serial cable, and the OHC is connected to the computer through the USB cable so that its received IR signal intensity can be read off the serial monitor.
Step 3: Use a ruler with its 0-value at Kilobot A (the 0-value is at its boundary facing the Kilobot B, but not at the center of Kilobot A), and put Kilobot B to be from 0 mm (touching Kilobot A) to 70 mm away from Kilobot A, with a step size of 5 mm. Record the readings at each distance value.
Step 4: Even at the same distance between two Kilobots, the resultant readings will differ due to various factors, so there are two values that need to be recorded: Low (the lowest reading) and High (the highest reading). The table below is not complete but only showing the first several columns.
Step 5: Repeat the above steps for all the combinations between the Kilobots you have picked, and fill a spreadsheet. If the receiving unit does not receive values at some of the longer distances, leave those cells blank.
Step 6: Average all of the distance values and round to whole numbers. The final values make up the look-up table. The two columns at the right hand side are the results we eventually want to obtain.
Step 7: Place these values in the look-up table into Distance_Calibration.c, Cal_Low and Cal_High, to be exact.
Step 8: Compile and generate/download the Distance_Calibration.hex file to upload to all the Kilobots. Now all the units are ready for use.
Note that the IR reading could be affected by the ambient environment, and such distance calibration should be carried out in your lab. Do not reuse the values obtained at another lab.