---
slug: "get-device-unique-id-in-raspberry-pi"
title: "Obtaining Terminal ID with Raspberry PI Pico"
description: "Workaround for `copy: input/output error` writing files to a Raspberry Pi Pico (RP2040) from macOS Sonoma."
url: "https://www.ytyng.com/en/blog/get-device-unique-id-in-raspberry-pi"
publish_date: "2023-01-22T02:26:40Z"
created: "2023-01-22T02:26:40Z"
updated: "2026-05-11T13:21:49.592Z"
categories: ["Raspberry-Pi"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250711/466c2519db6649ff8a6bc959150adf15.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Obtaining Terminal ID with Raspberry PI Pico

How to Obtain Terminal ID with Raspberry Pi Pico

```python
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

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

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

>>> binascii.hexlify(machine.unique_id()).decode()
'e66164xxxxxxxxxx'
```
