identifying a board from within a sketch [solved]

Hi, i have to deploy the same kind of board (an arduino clone based on 328p + several sensors) that is running the same sketch on about 20 locations. I collect data over (xbee) radio and serial lines.

Since i have to receive and classify data from quite a few sources, I'd like to be able to distinguish between particular physical boards in some (preferably hardwired by hardware) way.

Currently i have about two ideas:

  1. Use a script that pre-generates some ID, modifies and recompiles the sketch on upload. use the ID in communicaton

pros: simple, easy to do
cons: way too easy to mismanage, laborious to detect error

  1. use the radio module HW address
    pros: seems to work well with xbee
    cons: won't work in transparent mode, for serial connections, for alternative radio (e.g. BT).

As far as I can see, the atmega chip doesn't have a unique ID one can use.

Has anyone hit similar problem? How did you manage to solve it?

TIA

There are spi / i2c "id" chips availlable. If you have a realtime clock onboard you use its memory to store an ID
If you have unused pins you could use them as inputs with pullup /down resistors to make an identifier.

Thanks, I'll look into this. Do you know any specific chip that does that for reference?

Actually, I found a bunch. Thanks again for the hint.

Why not simply store the ID in the ATmegas internal EEPROM?

/Henning

Thanks.

I'll have to see if writing to the eeprom survive a new sketch upload. If it does, it may be the easier/cheaper option.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251705878

Apparently it will.