LED Badge LS32: The USB-HID Programming Tool
LED Badge LS32: The Revolutionary USB-HID Programming Tool
Tired of proprietary software that chains your LED badge to Windows-only drivers? The FOSSASIA community just cracked open the USB-HID protocol for LS32 LED badges, and developers worldwide are celebrating. This isn't another half-documented hack—it's a full-featured, cross-platform command-line powerhouse that transforms cheap LED name tags into programmable canvases.
In this deep dive, you'll discover how to liberate your hardware from vendor lock-in, upload stunning animations, and integrate LED displays into your next maker project. We'll walk through real installation commands, dissect working code examples, and reveal advanced techniques for creating pixel-perfect graphics. Whether you're prepping for DEF CON, building a classroom teaching tool, or just want your name tag to show a beating heart, this guide delivers the technical firepower you need.
What Is LED Badge LS32?
LED Badge LS32 is an open-source Python utility developed by the FOSSASIA community that programs LED name badges through a native USB-HID (Human Interface Device) interface. Unlike traditional LED controllers that rely on clunky USB-Serial bridges, this tool speaks directly to the badge's LS32 microcontroller using raw HID packets—no drivers required on most operating systems.
The project targets affordable LED badges manufactured by Lesun LED, commonly found on Alibaba and Amazon. These devices feature either 44×11 or 48×12 LED matrices and identify themselves with the USB fingerprint idVendor=0416, idProduct=5020. When plugged in, they appear as "LSicroelectronics LS32 Custm HID"—a dead giveaway that you're dealing with HID protocol, not serial.
FOSSASIA, a champion of open hardware and software in Asia, maintains this repository as part of their broader mission to democratize technology. The project has gained serious traction in the hacker community because it eliminates the need for vendor-supplied .EXE files and works flawlessly on Linux, macOS, and Windows. Recent commits show expanded support for accentuated French characters, making it a truly international solution for makers and educators.
What makes this tool trending right now? The convergence of three forces: the rise of hardware hacking at security conferences, the maker movement's hunger for programmable wearables, and the frustration with IoT devices that refuse to play nice with modern operating systems. This repository solves all three problems with elegant, documented Python code.
Key Features That Make It Essential
Native USB-HID Communication
The tool bypasses the entire USB-Serial stack. It uses pyusb and hidapi to craft raw HID reports, delivering faster upload speeds and rock-solid reliability. No COM port enumeration nightmares. No baud rate mismatches. Just pure, direct communication with the LS32 chip.
Cross-Platform Mastery Whether you're running Arch Linux, Ubuntu, Fedora, macOS, or even Windows 7/10, the tool adapts. It provides distribution-specific installation commands and handles platform quirks like udev rules on Linux and driver signing on Windows.
Multi-Message Architecture Upload up to 8 distinct messages simultaneously. Each message can have its own scroll mode, speed, and content type. Switch between them using the badge's physical button, creating interactive display sequences that cycle through graphics, text, and animations.
Rich Content Support
Beyond plain text, the tool loads PNG images directly onto the LED matrix. It automatically dithers full-color images to monochrome, handles transparency, and scales graphics to fit the 44×11 or 48×12 display. Built-in icons like :heart2: and :bicycle: provide instant visual flair.
Advanced Animation Modes Eight scroll modes transform static content into dynamic displays. Mode 0 scrolls left-to-right. Mode 5 drops images vertically with a satisfying animation. Mode 6 creates smooth horizontal transitions. Combine modes with speed settings (1-8) for cinematic effects on a $5 badge.
French Character Excellence Recent updates add full support for accentuated characters (à, é, ù, etc.). The tool automatically maps these to the badge's limited character set, making it perfect for European users and international conferences. No more broken Unicode boxes.
FFmpeg Integration
Generate complex animations using FFmpeg's cellauto filter. The README includes a one-liner that creates cellular automaton sequences, exports them as PNG strips, and uploads them as looping animations. This bridges professional video tools with hardware hacking.
Hardware Auto-Detection The script automatically finds badges with the correct USB VID/PID. On Linux, a simple udev rule grants user-level access—no sudo required after setup. This makes it safe for classroom environments and continuous integration pipelines.
Real-World Use Cases That Shine
Conference Badge Hacking at Scale Imagine arriving at DEF CON with 50 custom LED badges for your team. Instead of manually programming each one through a Windows GUI, you run a bash script that uploads unique identifiers, handles, and QR codes to every badge in parallel. The USB-HID protocol ensures sub-second uploads, and the built-in image support lets you render the conference logo perfectly. Press the badge button to cycle between your handle, a "Do Not Disturb" graphic, and a scannable QR code linking to your PGP key.
Interactive Classroom Teaching Tools
Physics teachers use the badge to display real-time sensor data. A Raspberry Pi reads temperature from a DHT22, converts the value to a scrolling graph using PIL, and uploads it to the badge every 5 seconds. Students see live data visualization on their desks. The -m 5 mode freezes the graph for study, while -s 1 provides slow, readable scrolling. The French character support makes it viable for bilingual science programs.
Retail Dynamic Pricing Displays
Small boutique owners attach these badges to product shelves. A central server runs cron jobs that update prices during sales. The -B brightness flag dims displays at night. Because the tool works over SSH, managers can reprogram displays remotely. The 44×11 resolution is perfect for showing "SALE: 30% OFF" with a flashing :star: icon.
Wearable Art Installations
Digital artists create generative animations using Processing, export frames as PNG sequences, and upload them to 20 badges worn by performers. The -m 0,1 mode cycles two message slots, creating seamless loops. Each badge runs a different phase of the animation, producing a wave effect across the stage. The FFmpeg integration means they can source animations from video files, cellular automata, or even live webcam feeds.
Corporate Team Building HR departments use the badges for icebreaker games. Each employee gets a badge showing three messages: their name, a fun fact, and a trivia question. The physical button becomes a conversation starter—"Press my badge, ask me about message #2!" The command-line interface integrates with Slack bots, so team members can update their fun facts through chat commands.
Step-by-Step Installation & Setup Guide
Linux: The Power User's Paradise
Step 1: Install udev Rules for User Access On Linux, USB devices default to root-only access. This command installs a rule that grants everyone read/write permissions:
sudo cp 99-led-badge-44x11.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger
The rule file matches the badge's USB ID 0416:5020 and sets MODE to 0666. Never run the script with sudo again—this is safer and respects security principles.
Step 2: Install Distribution-Specific Packages
For Arch Linux (bleeding edge):
sudo pacman -Syu python-pyusb python-hidapi
For Debian/Ubuntu (recommended method):
sudo apt install python3-usb python3-pil
For Fedora (Red Hat ecosystem):
sudo dnf install hidapi python3-hidapi python3-pillow python3-pyusb
Step 3: Fix Library Paths (If Needed)
Some distributions install libhidapi-hidraw.so.0 in /usr/lib, but pyhidapi expects it in /usr/local/lib. Create a symlink:
ln -s /usr/lib/libhidapi-hidraw.so.0 /usr/local/lib/
Step 4: Virtual Environment Setup (Optional but Recommended) Avoid system package conflicts with a venv:
sudo apt install python3-venv # or equivalent
python -m venv ledtag
source ledtag/bin/activate
pip install pyhidapi pyusb pillow
Reactivate later with source ledtag/bin/activate.
macOS: The Homebrew Approach
Step 1: Install Xcode Command Line Tools
xcode-select --install
Step 2: Install Homebrew and Dependencies
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install hidapi
sudo easy_install pip
pip install pyhidapi pillow
On systems with both Python 2 and 3, use pip3 explicitly.
Windows: The Driver Dance
Step 1: Install libusb-win32 Driver
Download version 1.2.6.0 from SourceForge. Extract and run inf-wizard.exe as Administrator:
- Select
0x0416 0x5020 LS32 Custm HID - Click through to install
- Alternative: Use Zadig (modern, recommended) to install the WinUSB driver for the same device.
Step 2: Install Python Download from python.org. During installation:
- ✅ Install Launcher for all Users
- ✅ Add Python to PATH
- Optionally click 'Disable path length limit'
Step 3: Install Python Packages Open cmd.exe as Administrator:
pip install pyusb pillow
REAL Code Examples from the Repository
Example 1: Basic Text Upload
This is the simplest possible usage—upload "Hello World!" as a single scrolling message.
python ./led-badge-11x44.py "Hello World!"
What happens under the hood:
- The script scans USB devices for VID
0416and PID5020 - Opens the HID interface using
hidapi - Converts the string "Hello World!" to the badge's native character encoding
- Packages it into a HID report with default parameters: mode 0 (scroll left), speed 4 (medium)
- Sends the report and triggers a display refresh
- The badge shows the message once, then returns to charging screen
Pro tip: After upload, unplug the badge or press the small button next to the USB connector to activate the message loop.
Example 2: Multiple Messages with Custom Mode and Speed
Upload two messages with dramatic drop animation and maximum speed.
python ./led-badge-11x44.py -m 6 -s 8 "Hello" "World!"
Parameter breakdown:
-m 6: Mode 6 drops words vertically into the display with a smooth animation-s 8: Speed 8 is the fastest setting, creating a fluid, modern feel"Hello" "World!": Two separate messages (quotes are critical)
Technical insight: The badge stores each message in separate memory slots. The LS32 chip has 8 message buffers, each with its own scroll mode and speed configuration. The -m and -s flags apply globally to all messages in the command.
User interaction: Press the badge button until you see "M1-8"—now it cycles through all uploaded messages. This transforms the badge from a static display into an interactive storytelling device.
Example 3: Full-Screen Image Upload
Load a PNG image that fills the entire LED matrix.
python ./led-badge-11x44.py -m 5 :gfx/fablabnbg_logo_44x11.png:
Syntax explained:
-m 5: Mode 5 displays a static image (no scrolling):gfx/fablabnbg_logo_44x11.png:: The colon syntax tells the parser this is a filename, not text. Critical: No spaces between colons and filename.
Image preparation magic: The script uses Pillow (PIL) to:
- Open the PNG file
- Convert to monochrome (
1-bitmode) - Dither if necessary using Floyd-Steinberg
- Resize to exactly 44×11 pixels
- Pack the bitmap into the HID payload
Troubleshooting: If you see ImportError: cannot import name '_imaging', your Pillow installation is broken. Fix it with:
pip install -U pillow
Example 4: Complex Mixed Content with Icon References
Combine built-in icons, custom graphics, and text in a single message.
python ./led-badge-11x44.py "I:HEART2:my:gfx/fablab_logo_16x11.png:fablab:1:"
Deep dive into the syntax:
I: Plain text:HEART2:: Built-in heart icon (uppercase uses a different variant)my: More text:gfx/fablab_logo_16x11.png:: Load custom 16×11 pixel logofablab: Text after the image:1:: Reference the first loaded image again—this is powerful! It avoids reloading the same graphic, saving precious badge memory.
Memory optimization: The LS32 chip has limited RAM. By referencing :1:, you reuse the already-uploaded logo twice in the same message. This technique is essential for creating rich animations without hitting the memory ceiling.
Built-in icon library: The tool includes :heart2:, :bicycle:, :bicycle_r: (reversed), and more. Check the source code for the full list—the icons are stored as byte arrays in led-badge-11x44.py.
Example 5: Bidirectional Animation Loop
Create a bicycle that rides back and forth across the display.
python ./led-badge-11x44.py -s7 -m0,1 :bicycle: :bicycle_r:
Animation strategy:
-s7: High speed for smooth motion-m0,1: Message 1 uses mode 0 (left-to-right), message 2 uses mode 1 (right-to-left):bicycle:: Built-in bicycle icon riding left-to-right:bicycle_r:: Reversed bicycle icon for the return trip
Creating seamless loops: When you press the badge button to enable "M1-8" mode, it cycles through messages 1 and 2 continuously. The bicycle appears to ride across the screen, disappear, and ride back. Add text to make it look like the bike is pulling a banner:
python ./led-badge-11x44.py -s7 -m0,1 "Hi:bicycle:" "Bye:bicycle_r:"
FFmpeg integration for advanced animations: Generate cellular automaton sequences:
ffmpeg -f lavfi -i 'cellauto=size=48x11:rate=10,setpts=10*PTS,format=monow,trim=end=123,tile=123x1' gfx/cellauto_123.png
This creates 123 frames of a 48×11 cellular automaton, tiles them horizontally into a single PNG, which the badge tool then uploads as an animated sequence.
Advanced Usage & Best Practices
Brightness Control for Different Environments
Use the -B flag to adjust brightness from 0-100. For dark conference halls, -B 30 prevents retina burn. For bright outdoor events, -B 90 ensures visibility.
python ./led-badge-11x44.py -B 50 -m 0 -s 8 "Bonjour à toutes et à tous"
Batch Programming with Bash Program 10 badges sequentially by serial number (if you modify the script to expose serial):
for i in {1..10}; do
python led-badge-11x44.py -m 5 "Badge #$i" "Team Alpha"
done
Memory Management
The LS32 chip has 8 message slots and limited bitmap storage. Each loaded image consumes memory even if referenced multiple times. Use :1:, :2: references aggressively. Delete unused images by uploading an empty message to that slot.
Error Handling in Scripts Wrap the tool in a retry loop for unreliable USB connections:
for attempt in {1..3}; do
if python led-badge-11x44.py "Critical Message"; then
break
fi
sleep 1
done
Creating Pixel-Perfect Graphics Design in GIMP at 44×11 or 48×12 resolution with 1-bit color mode. Export as PNG. For animations, create sprite sheets where each frame is the display width. The tool automatically segments the image into frames.
Security Consideration The badge's USB-HID interface has no authentication. Anyone with physical access can reprogram it. For sensitive applications, add a tamper-evident seal and audit the udev rules to restrict access to trusted users.
Comparison: Why LED Badge LS32 Crushes Alternatives
| Feature | LED Badge LS32 | USB-Serial Badges | Arduino LED Shields |
|---|---|---|---|
| Protocol | Native USB-HID | USB-Serial (CH340) | I2C/SPI |
| Driver Setup | None (on Linux/macOS) | Requires COM drivers | Requires Arduino IDE |
| Speed | <1s upload | 2-5s upload | 3-10s compile + upload |
| Cross-Platform | ✅ Yes | ⚠️ Partial | ✅ Yes |
| Image Support | ✅ Native PNG | ❌ Text only | ⚠️ Requires coding |
| Animation Modes | 8 built-in modes | 2-3 basic scrolls | Manual frame coding |
| Command Line | ✅ Full CLI | ⚠️ Limited | ❌ GUI only |
| Price | $5-10 per badge | $8-15 per badge | $20-50 (shield + Arduino) |
| Open Source | ✅ FOSSASIA | ❌ Proprietary | ✅ Arduino |
Why LS32 Wins:
- No driver hell: USB-HID is plug-and-play on every modern OS
- Speed: Direct HID reports are 5× faster than serial bit-banging
- Rich content: Built-in image dithering and icon library
- Hackability: Pure Python means instant modification
When to Choose Alternatives:
- USB-Serial badges: If you need bi-directional communication (LS32 is upload-only)
- Arduino shields: For custom hardware (sensors, buttons) integrated with the display
FAQ: Your Burning Questions Answered
Q: Will this work with my random LED badge from Amazon?
A: Only if it has USB VID 0416 and PID 5020. Check with lsusb on Linux or USB Device Viewer on Windows. Many badges use CH340 serial chips—this tool won't work with those.
Q: Why do I get "Permission denied" errors on Linux even after installing udev rules?
A: Your user isn't in the plugdev group. Run sudo usermod -a -G plugdev $USER, then log out and back in. Also verify the rule file has correct permissions: chmod 644 /etc/udev/rules.d/99-led-badge-44x11.rules.
Q: Can I upload animated GIFs directly?
A: No. Convert GIFs to a PNG sprite sheet first: convert animation.gif -coalesce tile.png. Each frame must be exactly 44×11 or 48×12 pixels. The tool treats the tiled PNG as an animation sequence.
Q: What's the maximum image size I can load?
A: The LS32 chip has ~2KB of RAM for graphics. A full-screen 44×11 image uses 484 bits (60 bytes). You can load roughly 30 unique full-screen images across 8 message slots. Use references (:1:) to reuse images without consuming extra memory.
Q: How do I create custom icons like :heart2:?
A: Edit the builtin_gfx dictionary in led-badge-11x44.py. Each icon is a byte array where each bit represents an LED. Use the existing icons as templates. For a 16×11 icon, you'll have 22 bytes (16×11 bits, padded).
Q: The badge shows "M1-8" but won't cycle messages. What's wrong? A: You need to upload at least 2 messages. "M1-8" mode loops through all populated slots. If you only uploaded one message, it stays static. Upload a second message—even a blank one—to enable cycling.
Q: Can I read data from the badge (e.g., button presses)? A: No. The USB-HID interface is write-only in this implementation. The badge's microcontroller doesn't expose button state or battery level via HID reports. For interactive projects, pair the badge with a separate input device.
Conclusion: Your LED Badge Liberation Starts Now
The LED Badge LS32 tool isn't just a utility—it's a declaration of independence from proprietary hardware. By leveraging USB-HID, FOSSASIA has created a solution that's faster, more reliable, and infinitely more hackable than anything the manufacturers provide. Whether you're a teacher building interactive lessons, a conference organizer branding your event, or a maker creating wearable art, this tool delivers professional results with command-line elegance.
The real power lies in its composability. Chain it with FFmpeg for generative animations. Wrap it in shell scripts for mass programming. Integrate it into Flask apps for remote updates. The open-source nature means you're not limited by vendor imagination—you're limited only by your creativity.
Ready to transform that cheap LED badge into a programmable masterpiece? Head to the official repository, clone the code, and join the community of hackers who've already liberated their hardware. The future of wearable displays is open, and it starts with a single command: python led-badge-11x44.py "Hello Open World!"
🚀 Star the repository on GitHub and start building your LED revolution today!
Comments (0)
No comments yet. Be the first to share your thoughts!