This folder contains a Flipper Zero application for reading and decoding Bambu Lab filament RFID tags, with JSON export capabilities for integration with external systems.
| Main Menu | Reading Tag | Success |
|---|---|---|
![]() |
![]() |
![]() |
| Filament Info | Export Options | HTTP Settings |
|---|---|---|
![]() |
![]() |
![]() |
A full-featured application with UI for reading, displaying, and exporting filament data.
A lightweight plugin that integrates with Flipper's built-in NFC app to enable reading Bambu Lab tags directly.
Python scripts for receiving data from Flipper and forwarding to your API.
- Python 3.10+ - Required for uFBT
- Git - For cloning firmware SDK
- uFBT (micro Flipper Build Tool) - Main build tool
pip install --upgrade ufbtcd bambu_filament
ufbtThe compiled .fap file will be in dist/.
cd bambu_kdf_plugin
ufbtThe compiled .fal file will be in dist/.
The easiest way to install is through the official Flipper Application Catalog:
- Open qFlipper on your computer or the Flipper Mobile App
- Go to Apps > NFC
- Search for "Bambu Filament"
- Click Install
The app will be automatically installed and updated.
If you prefer to install manually or want to use a custom build:
- Download
bambu_filament.fapfrom the Releases page (or build from source) - Connect your Flipper Zero via USB
- Open qFlipper and go to the File Manager tab
- Navigate to
SD Card/apps/NFC/ - Drag and drop
bambu_filament.fapinto this folder
Alternatively, copy the file directly to your SD card:
/ext/apps/NFC/bambu_filament.fap
- Download
bambulab_kdf.falfrom Releases - Copy to your Flipper's SD card at:
/ext/apps_data/nfc/plugins/bambulab_kdf.fal
Note: Create the
pluginsdirectory if it doesn't exist.
- Navigate to Apps > NFC > Bambu Filament
- Select Read Tag
- Place a Bambu Lab filament spool's RFID tag on the back of your Flipper
- View the decoded filament information
- Press Export button to export data
- Open the built-in NFC app
- Select Read
- Place a Bambu Lab filament tag on the Flipper
- The plugin will automatically derive keys and read the tag
After reading a tag, press the Export button to access export options:
Saves JSON file to: /ext/apps_data/bambu_filament/{UID}_{timestamp}.json
Streams JSON over USB to a companion script on your computer.
The bridge script listens for JSON data from Flipper over USB and forwards it to your API.
cd bridge
pip install -r requirements.txt-
Start your API server (or use the example):
python example_server.py
-
Connect Flipper Zero via USB
-
Run the bridge script:
# Auto-detect Flipper port python bambu_bridge.py --api http://localhost:8080/api/filament # Or specify port manually python bambu_bridge.py --port COM3 --api http://localhost:8080/api/filament python bambu_bridge.py --port /dev/ttyACM0 --api http://192.168.1.100:8080/api/filament
-
On Flipper: Read a tag, then select Export > Send via USB
--port, -p Serial port (auto-detect if not specified)
--baudrate, -b Baud rate (default: 115200)
--api, -a API endpoint URL (required)
--list, -l List available serial ports
--debug, -d Enable debug logging
⚠️ Note: The HTTP/WiFi export feature requires additional work and is currently in active development. Functionality may be incomplete or unstable.
Export filament data directly over WiFi without needing a USB connection. Requires a WiFi devboard running FlipperHTTP firmware.
- WiFi devboard (ESP32-based) with FlipperHTTP firmware
- WiFi network connection configured on the devboard
- HTTP endpoint to receive the data
- Navigate to Apps > NFC > Bambu Filament
- Select HTTP Settings from the main menu
- Configure:
- URL: Your API endpoint (e.g.,
http://192.168.1.100:8080/filament) - API Key: Optional authentication key (sent as
X-API-Keyheader) - Enabled: Toggle WiFi export on/off
- URL: Your API endpoint (e.g.,
Settings are saved to /ext/apps_data/bambu_filament/http.conf.
- Read a filament tag
- Select Export > Send via WiFi
- The app will POST JSON data to your configured endpoint
POST /your/endpoint HTTP/1.1
Content-Type: application/json
X-API-Key: your-api-key-here
{JSON payload - same format as file export}
Use the included test server to verify your setup:
cd bridge
python example_server.pyThe server displays your local IP address - use this in the Flipper's HTTP settings.
Export filament data by emulating a USB keyboard. The Flipper types the JSON directly into any focused text field - no drivers or software required on the host computer.
- Read a filament tag
- Select Export > Type via HID
- Click into a text field on your computer (notepad, web form, terminal, etc.)
- The Flipper switches to HID keyboard mode and types the JSON
The HID export types a single-line compact JSON string (no whitespace or line breaks):
{"tag_uid":"AABBCCDD","filament_type":"PLA Basic","detailed_type":"PLA Matte","material_id":"GFA50","variant_id":"A50-K0","color":{"hex":"#00AE42","r":0,"g":174,"b":66,"a":255},"color2":null,"spool":{"weight_g":1000,"length_m":330,"width_mm":66.25,"diameter_mm":1.75},"temperatures":{"nozzle_min_c":190,"nozzle_max_c":230,"bed_c":55,"drying_c":55,"drying_hours":8},"production":{"date":"2024_03_15_14_30"},"export_timestamp":1234567890}
- Web forms - Paste directly into inventory management systems
- No-install environments - Works on locked-down computers without admin access
- Quick testing - Paste into any text editor to inspect data
- Automation - Type into scripts or terminal commands
- Typing takes a few seconds depending on JSON length
- The Flipper will wait ~1 second before typing to give you time to focus a text field
- USB mode switches temporarily; returns to normal after export
- Works with any OS that supports USB HID keyboards
{
"tag_uid": "AABBCCDD",
"filament_type": "PLA Basic",
"detailed_type": "PLA Matte",
"material_id": "GFA50",
"variant_id": "A50-K0",
"color": {
"hex": "#00AE42",
"r": 0, "g": 174, "b": 66, "a": 255
},
"color2": null,
"spool": {
"weight_g": 1000,
"length_m": 330,
"width_mm": 66.25,
"diameter_mm": 1.75
},
"temperatures": {
"nozzle_min_c": 190,
"nozzle_max_c": 230,
"bed_c": 55,
"drying_c": 55,
"drying_hours": 8
},
"production": {
"date": "2024_03_15_14_30",
"tray_uid": "..."
},
"export_timestamp": 1234567890
}- Read filament tag with Flipper Zero
- Export via USB to bridge script
- Bridge forwards JSON to your local API
- API stores data in your database
- Server confirms receipt to bridge
- Bridge logs successful transfer
- The app tracks exported UIDs in a local log
- Your API should handle duplicates (update vs. reject)
- The example server updates existing entries with same UID
The app requires a 10x10 pixel icon at bambu_filament/icons/bambu_10px.png.
Create a simple 10x10 1-bit PNG icon (black and white) representing a filament spool.
- Read Tag: Read Bambu Lab filament RFID tags
- Display Info: Show filament type, color, weight, temperatures, etc.
- Export to SD: Save JSON to Flipper's SD card
- Export via USB Serial: Stream JSON to computer for API forwarding
- Export via HID: Type JSON as keyboard input into any text field
- Export via WiFi: Send JSON directly to HTTP endpoint (requires WiFi devboard)
- HTTP Settings: Configure WiFi export URL and API key
- About: Information about the app
- Load Saved: Load previously saved
.nfcfiles - Write: Clone tags to blank MIFARE Classic cards
- Tag Type: MIFARE Classic 1K (13.56 MHz)
- Encryption: Per-UID derived keys using HKDF-SHA256
- Key Derivation: Uses Bambu Lab's master key to derive 16 sector keys from tag UID
- Tags are RSA-signed by Bambu Lab
- Modified or cloned tags will not work with Bambu Lab printers
- Cloning requires magic cards with matching UID (Gen1a/Gen2)
FZBambuFilamentReader/
├── README.md
├── bambu_filament/ # Main Flipper app
│ ├── application.fam
│ ├── bambu_filament.c/h # Main app entry point
│ ├── bambu_keys.c/h # Key derivation
│ ├── bambu_parser.c/h # Data parsing
│ ├── bambu_export.c/h # JSON export
│ ├── bambu_http.c/h # WiFi/HTTP export
│ ├── flipper_http.c/h # FlipperHTTP library
│ ├── crypto/
│ │ ├── sha256.c/h
│ │ └── hkdf.c/h
│ ├── scenes/
│ │ ├── scene_main_menu.c
│ │ ├── scene_read_tag.c
│ │ ├── scene_display_info.c
│ │ ├── scene_export.c
│ │ ├── scene_http_settings.c
│ │ └── scene_about.c
│ ├── icons/
│ └── dist/ # Compiled .fap file
├── bambu_kdf_plugin/ # NFC app plugin
│ ├── application.fam
│ ├── bambulab_plugin.c
│ └── dist/ # Compiled .fal file
└── bridge/ # Python bridge scripts
├── requirements.txt
├── bambu_bridge.py # USB-to-API bridge
└── example_server.py # Example API server
-
Install uFBT (micro Flipper Build Tool):
pip install --upgrade ufbt
-
Clone this repository:
git clone https://github.com/little-did-I-know/FZBambuFilamentReader.git cd FZBambuFilamentReader -
Build the app:
cd bambu_filament ufbt -
Deploy to Flipper (connected via USB):
ufbt launch
The app follows Flipper Zero's standard scene-based architecture:
| File | Purpose |
|---|---|
bambu_filament.c/h |
Main app entry, initialization, and cleanup |
bambu_keys.c/h |
HKDF key derivation from tag UID |
bambu_parser.c/h |
Parse raw tag data into structured filament info |
bambu_export.c/h |
JSON generation, SD/Serial/HID export |
bambu_http.c/h |
WiFi HTTP export via FlipperHTTP |
flipper_http.c/h |
FlipperHTTP library for WiFi devboard communication |
Scene Flow:
Main Menu
├── Read Tag → Display Info → Export Options
├── HTTP Settings
└── About
-
Add your export function to
bambu_export.c:BambuExportStatus bambu_export_to_xxx(const BambuFilamentData* data) { // Generate JSON char* json = malloc(BAMBU_JSON_MAX_SIZE); bambu_export_to_json(data, json, BAMBU_JSON_MAX_SIZE); // Your export logic here free(json); return BambuExportOk; }
-
Add the function declaration to
bambu_export.h -
Add a menu option in
scenes/scene_export.c
- Add the field to
BambuFilamentDatastruct inbambu_parser.h - Parse the field in
bambu_parser.c(check the tag data format) - Add the field to JSON output in
bambu_export.c - Display it in
scenes/scene_display_info.c
- Create
scenes/scene_your_scene.c - Add the scene enum to the scene list in
bambu_filament.h - Register callbacks in
bambu_filament.c - Add navigation from other scenes
Enable debug logging:
ufbt cli
logLogs are prefixed with BambuFilament, BambuExport, BambuKeys, etc.
- Ensure proper positioning: Center the tag on the back of the Flipper, near the NFC antenna
- Check tag type: Only MIFARE Classic 1K tags are supported
- Try multiple angles: Slowly rotate the tag while keeping it close
- Verify it's a Bambu tag: Third-party or refilled spools may use different tag formats
- Focus a text field first: Click into Notepad, a browser text box, or terminal before exporting
- Wait for connection: The Flipper needs ~1 second to establish HID connection
- Check USB cable: Some cables are charge-only; use a data cable
- Try a different USB port: Some USB hubs don't support HID properly
- Check devboard connection: Ensure WiFi devboard is properly seated
- Verify WiFi connection: The devboard must be connected to your WiFi network
- Test endpoint: Use
curlto verify your server is reachable:curl -X POST http://your-server:8080/endpoint -d '{"test":true}' - Check URL format: Must include
http://orhttps://prefix - Firewall: Ensure your server allows incoming connections
- Correct serial port: Use
--listflag to find the right port - Baud rate: Default is 115200, ensure your listener matches
- USB mode: Flipper must be in CLI/serial mode, not mass storage
- Update uFBT:
pip install --upgrade ufbt - Clean build:
ufbt clean && ufbt - Check SDK version: Run
ufbt updateto get latest SDK
Contributions are welcome! Here's how to help:
- Check existing issues first
- Include your Flipper firmware version
- Describe steps to reproduce the problem
- Include relevant log output if possible
- Fork the repository
- Create a branch for your feature:
git checkout -b feature/your-feature-name
- Make your changes following the existing code style
- Test thoroughly on actual hardware
- Commit with clear messages:
git commit -m "Add: brief description of change" - Push and create a Pull Request
- Use 4-space indentation
- Follow existing naming conventions (
bambu_prefix for functions) - Add comments for non-obvious logic
- Keep functions focused and reasonably sized
- Test on real hardware before submitting
- Load saved
.nfcfiles - Tag writing/cloning support
- Additional filament type mappings
- Localization/translations
- UI improvements
Based on research from the Bambu Research Group RFID Tag Guide.
This project is licensed under the MIT License - see the LICENSE file for details.





