techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Serial number or individual identification number for pi 4

Thu Jul 04, 2019 5:38 am

If I were to release a project using the pi 4 will there be like a way to indentify each pi sort of like a serial number or some type of code to verify the pi etc

User avatar
rpdom
Posts: 16311
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 5:51 am

You could use the serial number. That is not guaranteed to be unique. The serial number is (unless it has changed in the Pi 4) generated randomly, which was fine when there were only a few million Pis out there, but now a few duplicates have been noted.

Code: Select all

grep Serial /proc/cpuinfo

User avatar
jbeale
Posts: 3581
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 6:08 am

You could use the Ethernet or the Wifi MAC address:

Code: Select all

cat /sys/class/net/eth0/address
cat /sys/class/net/wlan0/address
Each MAC address is only 6 bytes and the first few are fixed vendor bytes. Due to the sheer number of millions of RPi made, I don't think this number is guaranteed unique in the world, but in practice a duplicate is very unlikely. If you combine the serial number and lower bytes of both MAC addresses, a duplicate seems even less likely.

It seems like an interesting question to pose to an official RP engineer whether there is a guaranteed unique ID per board. When they were still selling MPEG2 licenses, I assume they must have based that off some kind of hardware ID.


User avatar
bensimmo
Posts: 4302
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 6:45 am

The serial is the better method, it has two extra usable digits over the MAC address (the Mac for ethernet is based of the serial iirc).

I use it to automatically create a device ID for some projects.

techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 8:02 am

When you say usable you mean I can edit the extra 2 digits

User avatar
bensimmo
Posts: 4302
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 8:33 am

The Mac address uses 6 digits of the serial number, the serial number is 8digits long.
With the make the first 6 are always the same.
But I think this was talk on it all.
https://www.raspberrypi.org/forums/view ... p?t=155386

User avatar
RaTTuS
Posts: 10538
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Serial number or individual identification number for pi 4

Thu Jul 04, 2019 8:42 am

techskies11 wrote:
Thu Jul 04, 2019 8:02 am
When you say usable you mean I can edit the extra 2 digits
no but you can tell see like
ip link show | grep eth ; cat /proc/cpuinfo | grep Ser
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether dc:a6:32:03:8b:7b brd ff:ff:ff:ff:ff:ff
link/ether dc:a6:32:03:8b:7c brd ff:ff:ff:ff:ff:ff
Serial : 100000008f910a75
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

zokora
Posts: 1
Joined: Tue Nov 12, 2019 8:08 pm

Re: Serial number or individual identification number for pi 4

Tue Nov 12, 2019 8:15 pm

Likely or not, on the first row of 100 Raspberry 3B+ in a new project I got two with not only identical MAC but also identical serial number.
That is very annoying, as I wanted to use the serial for our product as well.

trejan
Posts: 1201
Joined: Tue Jul 02, 2019 2:28 pm

Re: Serial number or individual identification number for pi 4

Tue Nov 12, 2019 8:42 pm

zokora wrote:
Tue Nov 12, 2019 8:15 pm
Likely or not, on the first row of 100 Raspberry 3B+ in a new project I got two with not only identical MAC but also identical serial number.
That is very annoying, as I wanted to use the serial for our product as well.
Ouch. That is unlucky. The serial numbers on Pi boards are randomly generated at the factory during production and you've managed to get a collision. The MAC address for the onboard Ethernet on everything except the 4B is created with the Raspberry Pi prefix and the lower 24 bits of the serial number.

They changed how the MAC addresses are assigned in the 4B as they do keep track of what is assigned. I don't know if this also applies to the serial number or if they are still randomly generating them.

If you're okay with preparing each board then you can use the customer OTP bits to add your own serial number for each board. Extra work though.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25368
Joined: Sat Jul 30, 2011 7:41 pm

Re: Serial number or individual identification number for pi 4

Tue Nov 12, 2019 8:51 pm

zokora wrote:
Tue Nov 12, 2019 8:15 pm
Likely or not, on the first row of 100 Raspberry 3B+ in a new project I got two with not only identical MAC but also identical serial number.
That is very annoying, as I wanted to use the serial for our product as well.
That's almost impossibly unlikely. Did you buy all the devices at the same time from the same place?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

Return to “General discussion”