Unique processor identifier?

Hi,

Is there any form of unique Identifier on an arduino mega processor (something that can be accessed programatically) ? I want to build a dozen identical arduino units, each running the same software, but each with a different ID. At the moment I change a single line in my code each time I upload, but this relies on me remembering to make the change, and loading the right ID into the correct arduino. I guess what I'm looking for is something like this....
if serial_number = 1234 then
ID = A
if serial_number = 5678 then
ID = B
etc etc.....

Any suggestions?

Regards

EEPROM

Is there any form of unique Identifier on an arduino mega processor

No, you have to make one like suggested above.

Well AVR chips do have 'signature bytes' that are unique to the chip type and AVRDUDE can read them, but I have no idea if one can read those bytes at run time to determine what chip type the code is running on.

Lefty

Unique to chip type, but are they unique to chip?

AWOL:
Unique to chip type, but are they unique to chip?

No of course not, so not a solution to the OP's requirement. But as he was already told EEPROM allows a pretty straight forward solution.

However my question still stands, can a sketch program be made to read the chip's signature bytes?

Lefty

No you can only read them in programming mode, page 298 of the data sheet.

Grumpy_Mike:
No you can only read them in programming mode, page 298 of the data sheet.

OK, thanks for that.

Lefty

Lefty,
I see you have gone back to your old picture, that clip from the end of Dr. Strangelove. :slight_smile:

A solution might be to add a one-wire device, these all have a 64 bit unique ID, - Mixed-signal and digital signal processing ICs | Analog Devices -

Grumpy_Mike:
Lefty,
I see you have gone back to your old picture, that clip from the end of Dr. Strangelove. :slight_smile:

Yes, last night they crowned a new Baseball World Series Champion for 2011, so time to revert back. =(

'World Series'?
Who got invited to that?

'World Series'?
Who got invited to that?

Why the whole world got invited, but only one country showed up.

'World Series', after all these years I still get a laugh out of that.

Re the unique ID, if you can handle the (very slight) possibility of having duplicates you can generate a random number (I think we should start a thread about generating random numbers :)) on power up and burn that into EEPROM at run time.

If they absolutely have to be unique then you'll have to run a counter on your PC and burn it from there.


Rob

AWOL:
'World Series'?
Who got invited to that?

Canada and half the players these days are from Latin America. :wink:

(I think we should start a thread about generating random numbers ) on power up and burn that into EEPROM at run time.

I think we did a thread from hell several months ago looking for a good/great random power up value to seed the random function. No 'perfect' solution was found as I recall, but I would defer to Coding Badly on that.

Lefty

There was a lengthy thread about it not that long ago.

I'm not sure this is it:

robtillaart:
A solution might be to add a one-wire device, these all have a 64 bit unique ID, - Mixed-signal and digital signal processing ICs | Analog Devices -

These are super-handy. DS-2401, $0.80 in qty 25, TO-92 package.

For this same task, I do use the EEPROM, and generate an .eep file and then burn that, so "make eeprom-id PORT=/dev/ttyUSB0 ID=10" drops '10' in the right spot.

Thanks guys - looks like the one wire solution will best meet my needs in the long term. In the short term, since my devices include an SD card I think I'll add a file to each card that contains a unique ID - although that still relies on me slotting the correct card into the correct arduino!

World Series? isn't that named after the bloke who established it, rather than being a reference to who it's open to?

Cheers

World Series? isn't that named after the bloke who established it,

Would that be Oliver World or Fourier Series?