Normally, all data of a Raspberry Pi is stored on the inserted SD card. This has the advantage that you can simply insert an operational SD card into another Raspberry Pi. If your Raspberry Pi is damaged, for example, it is sufficient to insert the SD card into a running hardware and you can continue.
But what if you want to clearly identify the hardware used – i.e. the mainboard or the hardware of the Raspberry Pi? A serial number would be very helpful.
Unfortunately, there is no specific serial number for the Raspberry Pi hardware. But what can be read is the serial number of the CPU. And since this is soldered to the rest of the hardware and can only be exchanged with great difficulty or not at all for most people, it can be used as a serial number to identify the Raspberry Pi board.
How you can read the serial number of your Raspberry Pi or its CPU is described in the following article.
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Before you start this article, you should have prepared a Raspberry Pi so that it can be reached via the network and controlled via SSH.
The following articles describe what needs to be done to prepare the Raspberry Pi.
- RaspberryPi – Setup for nerdiys!
- RaspberryPi – The first configuration!
- RaspberryPi – Control the RaspberryPi via SSH
In the following lists you will find all the parts you need to implement this article.
|1x||Raspberry Pi Bei Amazon kaufen|
|1x||Raspberry Pi Netzteil Bei Amazon kaufen|
|1x||Raspberry Pi Gehäuse Bei Amazon kaufen|
|1x||Micro SD Karte 64GB Bei Amazon kaufen|
Log in via SSH on the RaspberryPi
To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article
Read out the ID or serial number of the CPU of the Raspberry Pi
The CPU serial number is included in the information about the CPU. These can be read out very easily with the following command.
So just enter the command:
into the console of the Raspberry Pi.
You will then see the following information about the CPU of the Raspberry Pi.
With this command you get all the information about the CPU including the serial number. But what if you just want to see the serial number?
You can combine a few commands to only get the serial number.
For example, enter the following command.
cat /proc/cpuinfo | grep Serial | cut -d ":" -f2
This retrieves the CPU information, filters out the serial number and outputs it.
Read out the ID or serial number of the Raspberry Pi with Node Red
With Node Red you can automate the retrieval of the serial number and then process it directly.
For example, you could use the serial number to uniquely identify each Raspberry Pi using Node Red.
You can find the Node Red code in the Nerdiy Git repository under the following link:
How you can import this into your Nod eRed environment is described in the article NodeRed – importing and exporting node code.
More articles on the topic
In the following categories you will find further links on the subject of Rasperry PI and Node Red.
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂