How to read unique identifier for each Raspberry Pi IMX477 camera (B0270)?

Hi, I need to read the unique identifier (serial number) for each of my cameras. Is there a way to do that? I’ve got a batch of Raspberry Pi IMX477 cameras, the B0270 model specifically, and I need to tell them apart programmatically. How can we do that?

Hey, happy to help. A couple of quick questions so I point you in the right direction:

  1. Roughly how many cameras are in the batch?
  2. Are you running these on Raspberry Pi (libcamera / v4l2) or on a host via USB/UVC?
  3. Do you just need to read an existing unique ID, or do you also want to assign/modify one per camera?

If you can also share the output of v4l2-ctl --list-devices and dmesg | grep -i imx477, that’d help a lot.

We have a number of them, not just one. All Raspberry Pi IMX477 (B0270), running on Raspberry Pi boards, so libcamera/v4l2 on the CSI connector, not USB/UVC.

Ideally I want to read a serial number off each one. If reading isn’t possible I’d also consider writing my own so I can track them. Here’s what I get:

$ v4l2-ctl --list-devices
unicam (platform:fe801000.csi):
/dev/video0
/dev/video1
/dev/v4l-subdev2

And a chip id:

$ i2cget -y 10 0x1a 0x0000 w
0x0477

That 0x0477 is the same on every camera I try, so it’s not unique per unit.

Right, that 0x0477 is just the sensor ID for the IMX477 itself, not a per-unit serial. There isn’t a factory-programmed unique serial in the sensor registers on the IMX477 modules, so every camera returns the same value.

Can you dump the device tree and see if anything looks unit-specific?

$ dtc -I fs /proc/device-tree | grep -i -E ‘serial|eeprom|camera’
$ cat /proc/device-tree/model

Also, are you on a camera (like the Raspberry Pi Camera Module) or a custom board? Some Arducam boards carry a small EEPROM, but the B0270 typically doesn’t have one.

Here’s what I get:

$ cat /proc/device-tree/model
Raspberry Pi 4 Model B Rev 1.4

$ dtc -I fs /proc/device-tree | grep -i -E ‘serial|eeprom|camera’
(nothing relevant)

No EEPROM on the module as far as I can tell. So to confirm — is there really no unique serial stored anywhere on the B0270? If not, I’d like to write my own serial number to each camera so I can distinguish them. Is there a tool to modify the serial number on this camera?

Short answer up front: for the B0270 (Raspberry Pi IMX477) we don’t have a tool that can modify the serial number. The tool that lets you read/write the serial number only exists for our UVC cameras. The B0270 is a raw MIPI sensor module on the CSI bus, so it doesn’t expose a serial-number field you can overwrite.

The UVC cameras have a small onboard controller with a configurable serial string (that’s why they show up with distinct serials and why the tool works on them). The B0270 has no such controller — the IMX477 is connected directly to the Pi’s CSI, so there’s nothing to store a per-unit serial in.

That’s why all of your boards return the same 0x0477. I don’t want to send you down a path that won’t work, so I’d rather tell you now that there’s no write tool for this model.

Understood, but let me make sure I’m not missing something. Just to be thorough I tried a few things:

  • media-ctl -p -d /dev/media0 — shows the sensor entity but no serial field
  • v4l2-ctl -d /dev/v4l-subdev2 --all — only the usual sensor controls
  • Read a bunch of registers over i2c, all identical across units

All the same on every camera. So there’s genuinely no per-unit ID I can pull, and no way for me to write one. Is that the final answer?

Yes, that matches what we see. Summarizing where this lands:

  • The B0270 (Raspberry Pi IMX477) has no factory unique serial number. The only identifier is the shared sensor ID 0x0477, which is identical on every unit.
  • There is no serial-number field exposed over v4l2/i2c on this module, so nothing to read per camera.
  • The tool to modify/assign a serial number exists only for our UVC cameras, not for the B0270. So there’s no supported way for us to write a unique serial onto the B0270 either.
  • Nothing in the device tree or sensor registers lets you distinguish individual B0270 boards.

So unfortunately there’s no tool or method available on our side to read or modify a serial number for the B0270. If your setup needs per-camera identification, you’d have to track it externally (e.g. label each board and map it to a physical port or host), since the camera itself can’t report a unique ID. If you later move to one of our UVC models, the serial read/write tool would work there. Sorry I can’t give you a cleaner answer on this one.