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

FULL CAD BOM FIRMWARE DOCS

AIOpen-hardware

difficulty
●●○○○
time
an evening
license
MIT
repo
repo ACTIVE39 stars

Partner

Run your scrapers in the cloudThis build needs data collection that runs 24/7. Apify's free plan includes $5 in credits every month — no card needed.Try Apify free
1

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 — roughly five thousand times smaller than a typical local diffusion model. 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. VGA output needs a breakout board or a handful of resistors; USB streaming works without any extra hardware. 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.

NOT IN THE REPO

  • 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.

Can I build this?

Printnothing required
BuyRaspberry Pi Pico 2 (RP2350), VGA breakout board or resistors for VGA output (optional if using USB streaming)
Toolscomputer to flash the firmware
Skillscan copy a file to a USB drive; no soldering required if using a breakout board
Timefifteen minutes to flash and connect
Cost$10-15 total
SafetyNone beyond ordinary electronics care.

Build at your own risk. Projects involve tools, electronics and sometimes mains voltage — follow the creator’s safety notes.

Videos

What is VGA and How to Use it With a Raspberry Pi Pico - YouTube

More builds like this

All projects

Gallery

https://opengraph.githubassets.com/ccda08a376a49780ebf033b9b682eaea83f258e5fe750847aadf1eb109b41423/cpldcpu/pico-faces
https://cdn.mos.cms.futurecdn.net/xHZmbJnAiWGvCxAtrkU5JU.jpg
https://img.youtube.com/vi/KSYjGul84aU/maxresdefault.jpg

Start here

Navigation into the creator’s own docs — we don’t rewrite the guide, we route you to the source.

  1. 1.Download the latest uf2 firmware file from the releases page (Choose the model variant — 2.9M or 1.7M parameters.)
  2. 2.Hold BOOTSEL on the Pico 2, connect it to your computer, then release BOOTSEL(The Pico will mount as a USB drive.)
  3. 3.Copy the uf2 file onto the drive(The Pico will reboot automatically and start generating.)
  4. 4.Connect VGA breakout or view output over USB serial (VGA wiring diagram is in the README.)

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 requires a breakout board or soldering resistors to a VGA cable.
  • 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?

Yes, the training code is published and the README documents the process. You will need a GPU and a dataset of images.

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?

CompareeTEAM3h ago

Practical notes from our verification: the repository includes both the ready-to-flash uf2 firmware and the full training and inference source code, so you can either use it immediately or modify 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 is rare at this model size. VGA output needs a breakout board or soldering five resistors to a cable; USB streaming works without extra hardware but you will need a serial terminal to view the output. The one thing that surprised us: the author explicitly states that getting coherent output from a model this small is the entire achievement, and many toy diffusion projects at this scale fail completely.

cpldcpu

cpldcpu built Pico-Faces to explore how small a functional diffusion model could be while still producing coherent images. The project demonstrates that latent flow diffusion transformers can run on microcontrollers, opening the door to edge AI applications that were previously infeasible.

GitHub

Star the project on GitHub

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.