This Library gets the Unique Serial ID from the AVR Microcontroller.
Unique Serial ID - Hidden Serial Number
The datasheet of the Atmega328pb chip has a section 'Serial Number' how explain every chip have a unique device ID with 10 bytes.
The datasheet of the Atmega328p chip does not say anything about the serial number, but I tested using the same Z-pointer Address on the datasheet of the Atmega328pb.
Apparently, the chip Atmega328p have a hidden serial number with 9 bytes, and others AVR Microcontroller maybe too, like the table below.
Z-pointer Address | Atmega328pb | Atmega328p |
---|---|---|
0x000E | Byte 0 | Byte 0 |
0x000F | Byte 1 | Byte 1 |
0x0010 | Byte 2 | Byte 2 |
0x0011 | Byte 3 | Byte 3 |
0x0012 | Byte 4 | Byte 4 |
0x0013 | Byte 5 | Byte 5 |
0x0014 | Byte 6 | - |
0x0015 | Byte 7 | Byte 6 |
0x0016 | Byte 8 | Byte 7 |
0x0017 | Byte 9 | Byte 8 |
This library only works on AVR Microcontroller.
- Atmega328pb - 10 bytes
- Atmega328p - 9 bytes
- Atmega2560 - 9 bytes
- Attiny85 - 9 bytes
- Install the library by Using the Library Manager
- OR by Importing the .zip library using either the master or one of the releases ZIP files.
The library comes with examples. After installing the library you need to restart the Arduino IDE before they can be found under File > Examples > ArduinoUniqueID.
#include <ArduinoUniqueID.h>
UniqueID has UniqueIDsize bytes array of the Unique Serial ID.
for(size_t i = 0; i < UniqueIDsize; i++)
Serial.println(UniqueID[i], HEX);
Print the hexadecimal bytes of the Unique Serial ID on the Stream.
void UniqueIDdump(Stream);
UniqueID8 has the last 8 bytes array of the Unique Serial ID.
for(size_t i = 0; i < 8; i++)
Serial.println(UniqueID8[i], HEX);
Do you like this library? Please star this project on GitHub!