Skip to content

Arduino Library to get the Chip Unique Serial ID

License

Notifications You must be signed in to change notification settings

mrskylab/ArduinoUniqueID

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArduinoUniqueID

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

Dependencies

This library only works on AVR Microcontroller.

Tested Microcontroller

  • Atmega328pb - 10 bytes
  • Atmega328p - 9 bytes
  • Atmega2560 - 9 bytes
  • Attiny85 - 9 bytes

Installation

Examples

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.


Reference

Include Library

#include <ArduinoUniqueID.h>

Variable: UniqueID & UniqueIDsize

UniqueID has UniqueIDsize bytes array of the Unique Serial ID.

for(size_t i = 0; i < UniqueIDsize; i++)
  Serial.println(UniqueID[i], HEX);

Method: UniqueIDdump

Print the hexadecimal bytes of the Unique Serial ID on the Stream.

void UniqueIDdump(Stream);

Variable: UniqueID8

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!

About

Arduino Library to get the Chip Unique Serial ID

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%