Kilobots, T-cells and Cancer

Tom Goddard, Thao Do, Megan Riel-Mehan, Graham Johnson, Andrew Ling, Kara Helkme, Michael Broeker, Wendell Lim
January 29, 2015

I programmed 20 kilobot robots to illustrate research from Wendell Lim's lab on engineered T-cells that kill cancer cells. This demonstration was presented as part of the Byer's Lecture at UCSF for a general public audience. The kilobots displayed multicolored blinking lights and moved to illustrate a T-cell recognizing a cancer cell angtigen, activating itself and killing the cancer cell. Guests chose among 3 virtual antibodies and 3 signalling domains to build a custom T-cell and test it on cancer and healthy cells for specificity and strength of response.

Physical Models of Cells and Molecules

Thao Do, Megan Riel-Mehan and Graham Johnson created physical cell models, shapes for antibodies and antigens, printed plastic molecules, explanatory posters, and a lab results chart. The kilobots were part of these physical models used to convey a potential cancer therapy. Cancer and healthy cell forms were made using a hot glue gun, and painted foam board cutouts represented interchangable antibodies, signalling domains and antigens.

Kilobot Swarm Robots

Kilobots are swarm robots the size of a quarter that communicate with each other via infrared, move using two cell phone vibration motors, can indicate their state with a multicolor LED, can sense light and temperature. These robots were designed to study and engineer swarm behaviors such as schooling motion of fish, synchronized flashing of fireflies, shape formation of ants or termites.... Hundreds of robots can interact using the same program to exhibit complex phenomena from simple rules.

Representing an Immune Response

We used 20 kilobots running 11 different programs representing different molecules, the cell nucleus or the entire cancer cell. Our demonstration was an unsual application of kilobots that did not simulate collective behavior. There were 3 antibodies, 3 antigens, 2 signalling domains, a T-cell nucleus and cancer cell cytoplasm bots. The bot LEDs showed unique colors for each component (e.g. green for antibodies, pink for antigens) and different states of blinking and motion to indicate an active T-cell, antigen recognition and cell death.


The exhibit has you choose an antibody and signalling domain and test whether a T-cell with that combination kills cancer and/or healthy cells. The antibody controls specificity with one choice effecting only the cancer cell, another effecting only the healthy cell, and another effects both. The strength of the immune response is determined by the signalling domain and can be weak (no killing, lights twinkle), medium (kills cell), or overly strong (kills cell violently). In clinical applications the overly strong combination can harm the patient because of massive activation of the immune system. Killing is shown with the cell's 5 internal bots vibrating (weakly on violently), flashing and then stopping with lights out. When the T-cell recognizes an antigen on another cell by moving the two together the T-cell nucleus lights up to show it is armed and is activating genes to induce apoptosis in diseased cells.

Technical Programming Details

I programmed the kilobots in C using a Mac computer with programs communicated to the robots using an overhead infrared controller that connects to the computer by USB. This downloads the program to all bots under the controller after which the program is started and they act autonomously with no communication from the computer. The code for all 11 bot behaviors was about 200 lines in one file cart.c.

Hardware: The bots run an event loop on an 8-bit Atmega 328 processor (same as CPU of the Arduino UNO) with 8 Mhz clock, 32 Kbytes of memory, and 3 Kb of non-volatile memory for bootloader, calibration, battery voltage readout.... Specifications. Setting motor speeds and multi-color LED output are single function calls, and the programming complexity is in transmitting and receiving messages. Messages are transmitted only about every 0.5 seconds and contain 9 bytes (plus a 1 byte message type and 2 byte checksum) and the range of communication is only a few inches.

Communications: Initially I had the T-cell signalling domain send a message that was received by the nearby antibody and relayed it to the antigen which relayed it to the cancer cell interior. The message included the signalling domain strength and the antibody added its specificity to the message and the antigen only relayed the message if the antibody matched the antigen. We then decided to add a T-cell nucleus kilobot that would indicate by lighting up when the antigen was recognized. This addition did not fit with the unidirectional communication chain. Relaying messages in both directions down the line of kilobots is trickier because a bot would need to remember messages to be relayed in each direction and they can receive many more messages per second than they can send.

Synchronized state: I switched to a different communication scheme that instead synchronized state among all kilobots in range of each other. The state included signal domain strength, whether an antibody was within range of the signal domain, and whether a compatible antigen was within range of the antibody. Each piece of state information has a time in bot ticks (30 milliseconds) since it was last validated so that when bots are moved away from each other they will reset their state after 2 seconds.

Loading programs: We wanted to program all the bots at once and have each assign itself one of the 11 types. They store a unique id in non-volatile memory which could be used to assign types. When a kilobot battery runs out or the bot fails in some way we replace it and finding one with the correct unique identifier or reassigning a replacement's identifier seemed undesirable. So Andrew Ling programmed a different scheme where all bots are programmed the same, then one is isolated, it receives no messages from the others for a few seconds so it assigns itself type 1. Then it is placed next to the others arranged in a line and they relay a message down the line assigning the next type to the next in line. This worked in testing but we did not have time to incorporate it in the code. Instead I programmed each bot separately requiring about 15 minutes of tedium whenever the code was changed.

Dropped messages: Transmitted messages from nearby kilobots interfere with each other so successful transmission is not guaranteed. This results in some erratic behavior of our exhibit such as cancer cells that come back to life with the T-cell still docked. Because messages are sent only every 0.5 seconds it takes several dropped messages to reach the 2 second reset interval we programmed. As distance between kilobots approaches the signal range (a few inches) messages can also be dropped. We included code that required antibody and antigen to be close (received messages include an estimate of distance from the transmitter). The parameters for "close" depend on the reflective surface under the kilobots since the signal bounces off that surface. Also different kilobots may exhibit different maximum ranges.

Crosstalk: Docking the T-cell to the cancer cell model to kill the cancer cell sometimes also killed the nearby healthy cell if the healthy cell was in kilobot signal range of the cancer cell. The code makes any kilobot in range synchronize state causing this unintended behavior. The translucent shells made from a hot glue gun seemed to increase the range of signal transmission perhaps 1.5 or 2 times.

Safe transport: We tried transporting kilobots with legs poked into 1/4 inch packaging foam in a tissue box matching the robot height, or loose in larger boxes, or in an egg carton, when moving them between offices or office and home (on bicycle). All methods seemed prone to having the bots legs tangled in the circuit boards possibly leading to shorts. About 10% of our bots were not working possibly due to this rough handling. A better packing system is needed.

Debugging: While the bots are easy to program with a very small library of C functions for setting motors, lights, and receiving and transmitting messages, the debugging can be challenging. When the lights and motors do not behave as expected it is hard to deduce what went wrong. We did not use a simulator.

LED colors: We wanted to choose LED colors that were easy to distinguish, for example 3 different greens for the 3 antibodies. The hardware only offers 2-bit red, green, and blue color components for a total of 64-colors. It would have been useful to have an image of those 64 colors but we did not take the time to produce it. It would probably vary from one bot to the next so several images for a sample of bots might help. A color of rgb = (1,1,1) looked pink. The jump of a color component from 0 to 1 was much more visually striking than from 1 to 2 or 3.