Every Bambu Lab filament spool has a small RFID tag in its hub. When you load a spool into the AMS, the printer reads that tag and knows the material, the color, the right nozzle and bed temperatures, and more. I wanted to see that data for myself without putting the spool in the printer, so I built a small stand-alone reader: set a spool on it, and a little OLED screen tells you what it is.

It turned into a nice project that touched firmware, cryptography, PCB design, and 3D printing. It was also a deliberate experiment. I wanted to find out how practical it really is to hand an AI agent a small hardware project, so I had Claude Code do the PCB design, write the firmware, and generate the test code. My job was to set the goals, supply the hardware, review the work, and do the hands-on build and testing. I’ll say up front how it turned out: I was completely satisfied with the result.

The finished reader with a spool on it

The hardware

The parts list is short and cheap:

  • ESP32 DevKit V1. My usual go-to board.
  • RC522 RFID reader module (13.56 MHz, talks SPI). These cost a couple of dollars and read MIFARE Classic tags, which is what Bambu uses.
  • SSD1306 128x64 OLED (I2C) to show the results.
  • A small carrier PCB, designed in KiCad by Claude, to hold everything.
  • A 3D-printed platform that the spool sits on, so the tag lands right over the antenna.

The wiring uses the ESP32’s default buses, so there’s nothing exotic:

RC522 ESP32   OLED ESP32
SDA/SS GPIO 5   SDA GPIO 21
SCK GPIO 18   SCL GPIO 22
MOSI GPIO 23   VCC 3V3
MISO GPIO 19   GND GND
RST GPIO 4      
3.3V / GND 3V3 / GND      

The carrier board

Rather than leave a rat’s nest of jumper wires, I asked Claude to design a simple carrier board. It produced a two-layer KiCad 7 design, 50 x 70 mm: the DevKit plugs into headers with the USB port facing the rear, the RC522 and OLED plug into their own headers, and there are a couple of decoupling capacitors and mounting holes. It also generated the Gerbers ready for the fab, and a 1:1 PDF of the top side. I printed that on paper and set the real modules on it to check the footprints and hole spacing before ordering. That old trick has saved me from more than one bad board.

Bare boards

I used PCBWay for the fabrication and was totally satisfied with their work. Once I uploaded the Gerber file they checked it and passed back one comment which was a good one. The fab process took a little less than 2-weeks end-to-end which was reasonable. The minimum order was 5 boards which is helpful in case I mess up the soldering on a board. This was a great learning experience for my first fabricated board.

The platform

The platform is a simple print that centers the spool hub over the RC522’s antenna. RFID at 13.56 MHz has a very short range, a few centimeters at best, so getting the tag close and centered matters more than anything in the firmware. I also turn the RC522’s receive gain all the way up in software, which helped.

I printed the platform in Bambu Lab Basic PLA which turned out well. Platform

How it works

The tags are MIFARE Classic 1K: 16 sectors of 4 blocks, 16 bytes each. Each sector is protected by a key, and you have to authenticate with the right key before the tag will let you read it.

Bambu doesn’t use one fixed key. Each tag’s keys are derived from the tag’s own unique ID (UID) using HKDF-SHA256, a standard key-derivation function, with a Bambu-specific salt. The community reverse-engineering work on this format, especially the Bambu Research Group’s RFID Tag Guide, documents the scheme and the block layout. My reader stands on their shoulders.

So the flow for each spool is:

  1. Wait for a tag and read its UID.
  2. Make sure it’s a MIFARE Classic 1K. If not, show “Not Bambu”.
  3. Derive the sector keys from the UID with HKDF-SHA256.
  4. Authenticate and read the first five sectors.
  5. Decode the fields and show them on the OLED and the serial monitor.

The reader is strictly read-only. It never writes anything to the tag.

Code highlights

All of the code here was written by Claude. It chose PlatformIO with the Arduino framework and three libraries: MFRC522, Adafruit SSD1306, and Adafruit GFX. I reviewed it the way I’d review a colleague’s pull request, and found it clean, well commented, and easy to follow.

The key derivation was the most interesting part. The ESP32 already ships with mbedTLS, so there was no need for an extra crypto library. HKDF is just two steps built on HMAC-SHA256: “extract” a pseudo-random key from the UID, then “expand” it into as many bytes as you need. Sixteen 6-byte keys is 96 bytes, so the expand loop runs three times:

static void deriveKeys(const uint8_t *uid, size_t uidLen, uint8_t keys[16][6]) {
  uint8_t prk[32];
  hmacSha256(BAMBU_MASTER, sizeof(BAMBU_MASTER), uid, uidLen, prk);  // extract
  uint8_t okm[96];
  uint8_t t[32];
  uint8_t msg[32 + sizeof(BAMBU_INFO) + 1];
  size_t tLen = 0, done = 0;
  for (uint8_t i = 1; done < sizeof(okm); i++) {                     // expand
    size_t n = 0;
    memcpy(msg, t, tLen); n += tLen;
    memcpy(msg + n, BAMBU_INFO, sizeof(BAMBU_INFO)); n += sizeof(BAMBU_INFO);
    msg[n++] = i;
    hmacSha256(prk, sizeof(prk), msg, n, t);
    tLen = 32;
    size_t take = min((size_t)32, sizeof(okm) - done);
    memcpy(okm + done, t, take);
    done += take;
  }
  memcpy(keys, okm, sizeof(okm));
}

Once the blocks are read, decoding is just picking bytes out of known offsets. Strings are null-padded ASCII, and numbers are little-endian:

s.type         = str(2, 0, 16);   // e.g. "PLA"
s.detailedType = str(4, 0, 16);   // e.g. "PLA Basic"
s.r = blocks[5][0]; s.g = blocks[5][1]; s.b = blocks[5][2];
s.weightG      = u16(5, 4);       // spool weight in grams
s.diameterMm   = f32(5, 8);       // 1.75
s.hotendMinC   = u16(6, 10);
s.hotendMaxC   = u16(6, 8);
s.produced     = str(12, 0, 16);  // production date
s.lengthM      = u16(14, 4);      // filament length in meters

One small touch I like: the tag stores the color only as an RGBA value, not a name. So the firmware keeps a palette of about twenty common color names and picks the nearest one using a weighted RGB distance (green counts more than red or blue, roughly matching how our eyes see it). It isn’t Bambu’s official color name, but “Sky Blue #4A90DC” is a lot more useful at a glance than just the hex value.

What it shows

The OLED fits seven lines:

PLA Basic
Black #000000
1000g  1.75mm  330m
Nozzle 190-230C
Bed 55C  Dry 55C/8h
2024_06_03
GFA00

Screen with reading

The serial monitor gets the same information plus a raw hex dump of every block it read, which was invaluable while Claude was working out the tag layout.

What I learned

  • Check soldering multiple times. After soldering, I did not check continuity nearly enough. Quick tests are not sufficient. I should have done continuity checks on multiple points. I asked Claude to create a post-soldering check document with a series of steps specific to this board that I will use from now on.
  • RFID range is not far. Most of my “read failed” moments were the tag being slightly off-center or too far away, not bugs. The platform fixed more problems than any code change did.
  • Use what the chip already has. Claude reached for the mbedTLS that’s already on the ESP32, which made HKDF a few dozen lines instead of another dependency. That’s the choice I would have made too.
  • Community reverse engineering is remarkable. Without the people who documented the Bambu tag format, I doubt I could have worked it out on my own at all. Thanks to them, it took an afternoon of reading.
  • Paper prototypes still work. Printing the PCB at 1:1 and setting the real parts on it caught footprint issues before I paid for boards.
  • Claude capabilities. Claude, using Fable and Opus performed extremely well. It demonstrated hardware and software design, trouble-shooting, and a very conversational walkthrough for someone new to working in hardware.

Evaluating Claude as the engineer

This was the part of the project I cared about most. After 45 years of designing, building and supporting software systems, I’ve seen plenty of tools promise to change how we work. I wanted a real, end-to-end test of whether an AI agent could take a small embedded project from idea to working hardware, not just autocomplete some code.

So I deliberately stayed in the role of customer and reviewer. Claude Code did:

  • The board design. Schematic, KiCad layout, Gerbers, and the 1:1 print for checking footprints.
  • The firmware. Tag detection, the HKDF key derivation, sector reads, decoding, the nearest-color lookup, and the OLED and serial output.
  • The test code. Claude wrote test code for trouble-shooting to detect where I had made a couple of bad solder joints. This narrowed down exactly what I needed to do when I first powered up the board and had a dark OLED and non-responding RFID reader.

I did the soldering, printing, flashing, and putting real spools on the reader, and I fed back what I saw.

The verdict: I was totally satisfied. The board worked, the firmware read my spools, and the code was something I’d be comfortable maintaining. If I were to have done this entirely on my own, it would have required learning much more about hardware design and layout, how to use the OLED and RFID reader components, and how to test when something was not working. This would have taken weeks of effort at least and I would probably have given up eventually.

What impressed me most was going from a plain-English description to a fab-ready board. Where my own experience still mattered was familiarity with software and some basic soldering skill.

For a hobbyist, this changes what’s worth attempting. A custom PCB used to be the step where a weekend project stalled. Now it’s just another part of the conversation.

What’s next

Next will likely be a much more involved project for Halloween animatronics. In the past, I’ve cobbled together a few breadboards and parts for this. Now I will be more confident in having my own custom boards that are dedicated to animatronics.

The firmware is a single main.cpp of about 250 lines. It is an excellent working example that I can learn from.