0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« on: December 16, 2009, 05:29:18 am » |
Hi all,
Is there a way to retrieve the ID ( serial number on the sticker on the back of the Arduino, e.g. "CD1234") of an Arduino via code?
I remember Phidgets offered that feature and i need it for my current feature. Suggestion for any means of identification of an individual Arduino are welcome. It should however best be independent of the code loaded on the Arduino and the data stored on the EEPROM.
Cheers
|
|
|
|
« Last Edit: December 16, 2009, 05:29:29 am by HCF »
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 3
Posts: 985
Arduino rocks
|
 |
« Reply #1 on: December 16, 2009, 05:41:30 am » |
The FTDI chip (USB/serial interface) on the Arduino board has a unique serial number. You can query this number through the USB driver on the host (PC) side.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #2 on: December 16, 2009, 06:19:06 am » |
Thanks a lot, but i wonder, can the Arduino send this ID via serial?
|
|
|
|
« Last Edit: December 16, 2009, 06:19:46 am by HCF »
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #3 on: December 16, 2009, 06:31:06 am » |
No. The Arduino can't read from the FTDI chip.
What difference does it make if it's a pull operation from the PC or a push operation from the Arduino? In other words, what are you trying to accomplish?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #4 on: December 16, 2009, 07:04:43 am » |
I am making a flexible network of arduino-embedded interactive components.
The Arduino's should be able to communicate their ID to each other, so they can figure out how they are connected and what the overall geometry of the component assembly is.
From your replies i figure the only way to do this is to once write the Arduino serial number to the EEPROM and then read it back whenever needed. Unless... there are other ways to do it?
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2339
Do it !
|
 |
« Reply #5 on: December 16, 2009, 07:40:19 am » |
Another approach is to give each Arduino a unique address, either in the softwarre or by attaching a 4 (or 5/6/7/8) position dip switch to some digital pins.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #6 on: December 16, 2009, 08:23:46 am » |
so they can figure out how they are connected That's OK and what the overall geometry of the component assembly is. That is very tricky. Have you though how this would happen. Each arduino will have it's own unique map because it is a unique position in the topology. It will also be impossible to do this with a simple broadcast message system, you will need at least a pair of input / output communication links per arduino.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #7 on: December 17, 2009, 04:24:19 am » |
Here's the code which works for me. It is important to minimize how often the EEPROM is read from and written to, because it has a life estimate of only 100.000 read/write cycles. // WRITES ARDUINO SERIAL TO EEPROM // // do this only once on an Arduino, // write the Serial of the Arduino in the // first 6 bytes of the EEPROM
#include <EEPROM.h> char sID[7] = "CD6484";
void setup() { Serial.begin(9600); for (int i=0; i<6; i++) { EEPROM.write(i,sID[i]); } }
void loop() { Serial.println(sID); } // READS ARDUINO SERIAL FROM EEPROM // // reads the Serial of the Arduino from the // first 6 bytes of the EEPROM
#include <EEPROM.h> char sID[7];
void setup() { Serial.begin(9600); for (int i=0; i<6; i++) { sID[i] = EEPROM.read(i); } }
void loop() { Serial.println(sID); }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #8 on: December 17, 2009, 04:28:03 am » |
Another approach is to give each Arduino a unique address, either in the software or by attaching a 4 (or 5/6/7/8) position dip switch to some digital pins.
that sounds interesting! for my application it would be not ideal though, i'd never want to change the switches and i'd loose a few pins
|
|
|
|
« Last Edit: December 17, 2009, 06:17:27 am by HCF »
|
Logged
|
|
|
|
|
UK
Offline
Faraday Member
Karma: 15
Posts: 2852
Gorm deficient
|
 |
« Reply #9 on: December 17, 2009, 04:29:38 am » |
It is important to minimize how often the EEPROM is read from and written to, because it has a life estimate of only 100.000 read/write cycles. That's incorrect - you can read as often as you like, the limitation is on erase/write cycles.
|
|
|
|
|
Logged
|
Per Arduino ad Astra
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #10 on: December 17, 2009, 04:39:28 am » |
That is very tricky. Have you though how this would happen. Each arduino will have it's own unique map because it is a unique position in the topology. It will also be impossible to do this with a simple broadcast message system, you will need at least a pair of input / output communication links per arduino. We have Arduinos linked up via '4052' multiplexers. Each Arduino listens to four other Arduinos in turn, and sends to 'their' multiplexers as well. Listening in works well, we still have to see whether it works bi-directionally. I'll try to have the Arduino network broadcast information on individual connections over time (like 'i'm no. 1337 and i'm next to you!', 'i'm no. 42 and i'm connected to no. 1337!').This way, they could have at least a map of their immediate neighbourhood. A custom-made modeler app will collect this information and adapt the representation of the assembly: [media]http://www.youtube.com/watch?v=U9EO8azX8zo[/media]
|
|
|
|
« Last Edit: December 17, 2009, 06:23:35 am by HCF »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #11 on: December 17, 2009, 04:41:18 am » |
That's incorrect - you can read as often as you like, the limitation is on erase/write cycles. indeed, i failed at RTFM : 
|
|
|
|
« Last Edit: December 17, 2009, 04:41:40 am by HCF »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 72
Arduino rocks
|
 |
« Reply #12 on: December 28, 2009, 07:16:19 pm » |
Thanks HCF, that was the exact code I was looking for.
|
|
|
|
|
Logged
|
|
|
|
|
Odense
Offline
Jr. Member
Karma: 1
Posts: 60
Arduino rocks
|
 |
« Reply #13 on: December 29, 2009, 05:33:39 am » |
How about using a DS2401 its has a unik ID and uses one wire.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #14 on: November 01, 2010, 08:15:43 pm » |
You can also assign or code generated by the software ID eg 485fcba0-e61a-11df-9492-0800200c9a66, and left as a global variable. (This number may be repeated once every 100 years) So no need to remove the FTDI or an EEPROM. Or the second option is with the Dallas DS2401, separates a unique pin (Wire one), this number is unique. http://www.arduino.cc/en/Reference/EEPROMhttp://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1260959358/11http://www.famkruithof.net/uuid/uuidgenhttp://pdfserv.maxim-ic.com/en/ds/DS2401.pdfCode: / / WRITES TO SERIAL EEPROM Arduino / / / / Do this only eleven on an Arduino, / / Write the Serial of the Arduino in the / / First 6 bytes of the EEPROM # Include <EEPROM.h> sID char [7] = "CD6484"; void setup () { Serial.begin (9600); for (int i = 0; i <6; i + +) { EEPROM.write (i, sID ); } }
void loop () { Serial.println (sID); }
Code: / / Arduino READS FROM SERIAL EEPROM / / / / Reads the Serial of the Arduino from the / / First 6 bytes of the EEPROM
# Include <EEPROM.h> sID char [7]
void setup () { Serial.begin (9600); for (int i = 0; i <6; i + +) { sID = EEPROM.read (i) } }
void loop () { Serial.println (sID); }
|
|
|
|
|
Logged
|
|
|
|
|
|