Let's Make Robots!

How I can identify a robot using an unique ID?

For the Swarm Robot Project I need a unique ID to identify each single robot and also let the robot only execute program parts which are assigned to it's ID.

Why I wanna do that?

As we are planning to reprogram all the robots at once via IR we need a way to "place" an unique ID into the robot. This should happen without much additional stuff like an external DIP switch. To write that ID into the program code would not work since all the robots are receiving the same code. So we need a kind of internal identifier which µC the robot has and create/use this as an ID.

Here some suggestions from the SB:

FrankNeon: something like "I've been on the longest, I am 1." I'me next on, I'm 2...
FrankNeon: what about writing a startup void that has each bot find its place in line.


This would be a good idea but it also has a flaw. What happens when the robot is switched off for a reason...after switching it on again it will get another ID -> so the robot can not execute the code he is supposed to run.

Chris the Carpenter: Well, that one is easy --just do your own mac address for each bot and stick it in the eeprom of the chip during programming

That seems to be doable.

What's your suggestion? And no, we don't want to put more hardware on the robot just for this!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Do the bots have wheel encoders? Turn not on and turn the wheel 1 notch, its now not one. Next bot turn 2 notches, its now not 2 etc.

Also not a good idea, sorry. If we update the programm by flashing them via IR then we would have to turn them all off and set the ID again.

All those external options are not very practical, thus we are looking for a solution how to get this done inside the chip/eeprom


I found this cool library on github:


Thanks, this looks good. Will see if we can use something for our robot.

a resistor on an analog pin? I'm not sure how many discrete values you could manage, though.

We thought about this too but then you have to prepare each robot with a different resistor array. Hard to "mass produce" when you want to build a swarm and you are limited to a certain number I guess.

Another idea was a DIP switch to set the ID manually...but this involves more hardware what we want to avoid.

Ok Frank, but what happens when more than one robot has been switched off?


Both robots poll and try to fill the smallest value in the line, like musical chairs. First to find the smallest value earns its place.

But what is when this robot, lets say the smalles value is now 6, had another ID, lets say 7, before?

In this case he will not be able to run the code which is dedicated for him...

Just imagine, different robots could have different attachments (gripper, torch, chainsawm, lift fork) and needs the code for that.

Can I have one? ;)

Do they all have the same toolset? Or each has one of a variety...


Thus far, I had been under the assumption that each was identical, and could fill the place of another once its spot was attained.