0

Say I have a hundred(possibility thousands) of connected raspberry pi and these pi will emit a message though tcpip to a mongo data base when they get online. This message will be a unique id that will register the device inside of mongodb.

Question: is there a unique number that is secure that I can just emit to a database as a unique id or will there have to be some kind of back and forth?

hardillb
  • 54,545
  • 11
  • 67
  • 105
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
  • 1
    you want exact identical id to specify machine or just a uuid? have a look at https://docs.python.org/2/library/uuid.html. – Jason Hu Mar 06 '15 at 16:34
  • Not a uuid because none of the machines will know of another. Unless I make a handshake between the db and machines. Therefore I want a identical Id to specify a machine that won't conflict with other machines; moreover each machine will only know of itself – Armeen Moon Mar 06 '15 at 16:45
  • have a look at http://stackoverflow.com/questions/2461141/get-a-unique-computer-id-in-python-on-windows-and-linux. it seems you just need MAC address. it seems this one is even easier: http://stackoverflow.com/questions/159137/getting-mac-address. – Jason Hu Mar 06 '15 at 16:46

1 Answers1

1

To identify the PI(s), I'd use/send the serial number(s) (cat /proc/cpuinfo). It's used to make money, so the manufacturer won't tolerate duplicates.

See "Getting Your Raspberry Pi Serial Number Using Python" for Python and further background.

The MAC address identifies a component that could change (e.g. WiFi dongle).

Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96