Obtaining Terminal ID with Raspberry PI Pico

Raspberry-Pi
2023-01-22 11:26 (1 years ago) ytyng

How to Obtain Terminal ID with Raspberry Pi Pico

import machine
import binascii

device_id = binascii.hexlify(machine.unique_id()).decode()

print(device_id)

Result

d66a64xxxxxxxxxx

You can achieve this by using machine.unique_id().

The result can be obtained as binary data, which might be difficult to use as it is. Therefore, it is a good idea to convert it to a string using either binascii or base64.

binascii comes standard with MicroPython.

Additional Information

>>> machine.unique_id()
b'\xe6axxxxxxxx'

>>> binascii.hexlify(machine.unique_id())
b'e66164xxxxxxxxxx'

>>> binascii.hexlify(machine.unique_id()).decode()
'e66164xxxxxxxxxx'
Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011