A GENERATIVE IMAGE MODEL RUNNING ON A ONE-DOLLAR MICROCONTROLLER
A real diffusion model that generates human faces on a Raspberry Pi Pico 2, in five to twenty seconds, using a chip that costs about a dollar.
by cpldcpu
AIOpen-hardware
Built withRaspberry Pi Pico / RP2040
- difficulty
- ●●○○○
- time
- an evening
- license
- MIT
- repo
- repo ACTIVE83 stars
●●○○○ · an evening · MIT · 83 stars · repo ACTIVE
WHAT YOU’LL NEED
Jump to section
COMPAREE VERDICT
This is a proper diffusion model running on hardware that costs less than a coffee. The model is a latent flow diffusion transformer, the same general architecture behind models like Flux, scaled down to 2.9 or 1.7 million parameters — about five thousand times smaller than even a typical local diffusion model, according to the author. It generates 128 by 128 RGB human faces in five to twenty seconds and supports conditional generation across five classes: gender crossed with smile, plus neutral. The author points out that a model this small producing coherent images at all is remarkable: many MNIST-scale toy diffusion projects use far more parameters and barely manage anything recognisable, and small diffusion models usually collapse to an initial guess instead of genuinely refining it. A step-by-step grid in the repository shows facial features actually emerging as the number of steps increases. The build itself is trivial if you already have a Pico 2: hold BOOTSEL, reset the board, copy the uf2 file across, then drive it from the included Python viewer over USB. A Pimoroni VGA Demo Base adds output to a VGA monitor. The one thing most likely to disappoint is expecting text-to-image or arbitrary prompts — this is a demonstration of how small a working diffusion model can be, not a replacement for Stable Diffusion.
IN THE REPO
GOOD TO KNOW
- —Ready-to-flash uf2 firmware file is published alongside source and trained weights.
- —Hardware is a Raspberry Pi Pico 2 (RP2350) plus a VGA breakout or USB connection.
- —Repository includes training code, inference code, and a step-by-step generation grid showing the denoising process.
- —Two model variants: 2.9 million parameters and 1.7 million parameters, both published.
- —Documentation explains the architecture, training process, and conditional generation across five classes.
- —Licensed under MIT — commercial use allowed.
Parts to buy
2 itemsFrom our check of the build. Exact quantities and part numbers are in the creator’s BOM.
Can I build this?
Build at your own risk. Projects involve tools, electronics and sometimes mains voltage — follow the creator’s safety notes.
More builds like this
All projectsGallery
Start here
Navigation into the creator’s own docs — we don’t rewrite the guide, we route you to the source.
- 1.Download a uf2 file from the repository's uf2/ folder (Two variants: the high-quality model (m3_decD_deep_full) and the faster one (m3_long_cfg).)
- 2.Hold BOOTSEL on the Pico 2, connect it to your computer, then release BOOTSEL(The Pico will mount as a USB drive.)
- 3.Copy the uf2 file onto the drive(The Pico reboots automatically; then use the viewer script on your PC to send it a seed, step count and class and receive the image.)
- 4.Connect VGA breakout or view output over USB serial (For VGA, plug the Pico 2 into a Pimoroni VGA Demo Base; for USB, run viewer/view_serial.py on your PC (pip install pyserial matplotlib numpy pillow).)
Resources
Documentation, files and community threads for this build — we link straight to the original sources and never rehost the creator’s files.
KNOWN ISSUES
- This is a demonstration of a tiny diffusion model, not a general-purpose image generator — it only generates human faces in five classes, not arbitrary prompts.
- Generation takes five to twenty seconds per image; it is not interactive.
- VGA output is documented for the Pimoroni VGA Demo Base (a resistor DAC plus a VGA connector); if you wire your own, you are off the documented path.
- The faces are 128 by 128 pixels — a small resolution even by retro standards.
- The model is trained on a specific dataset and will only generate faces in the learned distribution.
Can I train it on my own dataset?
The full training pipeline is published (a CUDA GPU and about a day for a full retrain, per the README), set up for the FFHQ face dataset with gender and smile labels. Swapping in your own dataset means adapting the data and label scripts yourself.
Does it work on the original Pico or Pico W?
No, it requires the RP2350 chip in the Pico 2 for the performance and memory headroom.
Can I generate text-to-image or use prompts?
No, it supports conditional generation across five fixed classes only: gender crossed with smile, plus neutral.
What is the practical use case?
This is a research demonstration showing how small a working diffusion model can be. The practical use is understanding the architecture and training small models, not replacing Stable Diffusion.
Community builds
No community builds yet — be the first, we feature the best ones.
Discussion1
FROM THE COMPAREE TEAM
The model has 2.9 million parameters and generates a coherent 128x128 face in five to twenty seconds — roughly five thousand times smaller than a typical local diffusion model. What would you try running on a Pico 2 next?
cpldcpu
cpldcpu built Pico-Faces to see how small a working diffusion model could be while still producing coherent images, and got a latent flow diffusion transformer running on the RP2350 microcontroller in the Raspberry Pi Pico 2.
DISCLAIMER
- Comparee is not the author of the projects featured here. All rights to each project belong to its creator — every page links to the original source, and we never host creators’ files.
- Information is provided without warranty and may become outdated as projects evolve. Prices are indicative bands only — always check the creator’s parts list for current costs.
- Building and operating any project is at your own responsibility. Protective equipment, safe workshop practice and compliance with local regulations are the builder’s responsibility.
CompareeTEAM1mo agoedited
Practical notes from our verification: the repository includes both ready-to-flash uf2 firmware images and the full training, quantisation and inference source code, so you can either use it immediately or retrain the model. The step-by-step generation grid in the repo is worth looking at before you build — it shows the diffusion process genuinely refining an image rather than collapsing to a first guess, which the author notes is a common failure of small diffusion models. VGA output works on a Pimoroni VGA Demo Base; without it you stream images over USB and view them with the included Python viewer script. The one thing that stood out: the author writes that it is astonishing a model this small generates complex images at all, since many toy diffusion projects with far more parameters barely produce anything coherent. Correction (4 October 2026): we re-checked this page line by line against the project's own repository, documentation and videos, and fixed errors in earlier versions.