🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

These super cheap (around $0.10 in bulk) RISC-V MCUs from WCH have been pretty popular recently. I recently had a need for a small, low power MCU and my usual choice of an Espressif module would have just been too power hungry - and also too large.

I’m using the smallest version of the CH32V003 - the CH32V003J4M6 - this is an 8 pin IC. It’s definitely a massive step down from what we normally have to play with. It’s got 16K of flash and only 2K of RAM. The CPU is pretty reasonable though - it’s RISC-V running at 48MHz - so not too shabby.

CH32V003J4M6 Specifications

There are a lot of online guides to programming this chip - so I’m not going to do a deep technical dive. Here’s a good starting point as is this seies.

You don’t need very much to bring this chip up. It’s got its own built in voltage regulator - so you can feed it anything from 2.7~5.5V and it just needs a 100nF decoupling capacitor.

For our project, I took inspiration from this project - which is a coin cell powered mini game console. This was a good starting point as it included a buzzer. Here’s my schematic:

Schematic

And the final PCB layout:

PCB Layout

Despite me adding pin headers, we still ended up with a very small board: 16.3mm X 11.7mm.

I got the boards made up by PCBWay. I skipped ordering a stencil as there are very few components on the board, so not too hard to solder up by hand.

Soldered Up

But I had forgotten how painful soldering under the microscope was.

Soldering

Then I remembered - I have a PCB printing machine that also dispenses solder paste!

Solder paste dispensing

I was pretty amazed at how well this came out, especially considering the solder paste I used is almost three years past its best-before date!

Each board consists of:

  • One CH32V003 MCU
  • A small piezo buzzer driven by a transistor

My plan is/was to power these boards from a CR2032 coin cell battery. In standby mode the power consumption is very good - around 7-8µA.

Standby Mode Current Draw

I did find a bit of a problem with standby mode - with the device in standby, I couldn’t program it anymore - which is a bit of a pain when you are trying to develop. And even worse if your wakeup is not working. For a while, I thought I’d bricked it completely.

Fortunately there is a way to get back to a good known state. The wlink utility can be used to erase the flash even in standby mode.

$ ./wlink erase --method power-off --chip CH32V003

When playing music, the power consumption is a different story. When the MCU is in active mode, it’s a very reasonable 3.3mA. But as soon as we start playing audio, we spike up to 130mA.

Current spike during playback

I am using a very low mark-space ratio on my audio output (the buzzer is only on for a small fraction of the time), so we do only average 13-14mA, but the 130mA peaks are too much for a coin cell - as soon as we play audio, the device browns out.

My backup plan was to use one of these tiny Lithium cells. I did have to modify one of my charger boards for this cell - I don’t think pumping 1A into an 80mAh cell would end well…

Tiny 80mAh lithium cell

With the LiPo, we get more than enough juice to power the board and play the music without issues.

But I really wanted to get this working with a coin cell. I modified one of the boards to use a much higher base resistor on the transistor - bumping this up to 10K.

Tiny 80mAh lithium cell

With this, we got some much more reasonable results.

  • Peak current: 56 milliamps (down from 130mA!)
  • Average current: Just over 7 milliamps (down from 13-14mA)

Much lower current requirements

This version works beautifully with the coin cell, plays all the way through, and is still plenty loud enough for my purposes.

My actual code for playing back the audio is very simple and naive. I’m just bit-banging the GPIO pin with the note frequency.

It doesn’t sound too bad for one of these tiny buzzers - it’s actually pretty impressive!

To actually get the audio data I put together a simple tool (well, my AI chum put it together…). This lets you export a track from a midi file in a simple format that the MCU can use.

MIDI file conversion diagram

This also contains a very simple 1-bit Sound FX generator which is quite fun.

All the code for the project is on GitHub.

And you can listen to the results here:

Related Posts

I Built a 27V Circuit to Fix This $3 Gadget - I revived a cheap scribble pad by swapping its fried board for a tiny PCB that boosts a coin cell to 27 V—enough to cleanly reset the bistable LCD. It’s a Joule Thief with Zener regulation and twin 220 µH inductors (mounted in opposite orientations), pulling ~17 mA during charge and ~7 mA while regulating. It’s coin-cell friendly, works great, and just needs a bit of case surgery for a perfect fit.
High voltage coin cell - I blew up the original PCB on a bistable cholesteric display, so I built a coin-cell Joule thief to crank out 27V and bring it back to life. A simple two-inductor setup with a 27V Zener does the trick—about 10 mA while the button’s held. Then I got fancy with a regulated version (just one extra transistor) that tops the cap to 27V and basically idles—average draw lands around 1.53 mA. It’s neat, tiny, and perfect for this low-current reset job. Full build and measurements are in the video.
I made a 10 Cent MCU Talk - I taught a 10¢ CH32V003 RISC‑V MCU to talk. By bit-banging PWM as a DAC and using a tiny 2‑bit ADPCM decoder, I squeezed ~6–7 seconds of recognizable audio into 16 KB of flash. Then I went full retro with LPC speech synthesis (Think: Speak & Spell) using the Talkie library and a small web tool I built to generate LPC data—so this little 8‑pin chip can now play samples and ‘speak’ lots of words with only a few kilobytes.
Minimalist Microcontroller: Building a Bare-Bones Dev Board - In a thrilling DIY endeavour, I attempted to build the most minimalist ESP32 dev board possible. Diving deep into the schematic of the ESP32 S3 WROOM module, I chopped out the non-essentials and whittled our needs down to bare bones. The experiment saw me juggling USB data lines and voltage regulators, waving goodbye to an array of capacitors and connectors and boldly embracing the simplicity of direct connections. Despite a few hitches, the miniature Frankenboard came alive, proving that sometimes less is more...at least in the world of microcontrollers.
I got this feeling bezos is watching - Discovered my Hue switch battery performance is correlated with room temperature after a nifty web scrape of Amazon's device usage history. While it's a given that batteries are temperature-sensitive, actual data from my own living room provided a neat confirmation, graphing a daily pattern. Wanted to go green with a rechargeable lithium coin cell, but the voltage risk to the ATmega256RFR2 on the PCB is a no-go. For now, it's back to the humdrum world of regular coin cells and unexciting battery charts. Dive into the video for a deeper geek-out on this!

Related Videos

10¢ MCU Music Hack - CH32V003 - I spun some tiny WCH boards at PCBWay around an 8‑pin MCU (48 MHz, 16k flash, 2k RAM) to beep tunes off a coin cell. I tried hand-soldering, then used my paste-dispensing PCB printer—expired paste still worked great. Standby sips under 8 µA, but it locks out programming; a WLink flash wipe rescued me. Wake draws ~3.3 mA, and audio peaks hit ~130 mA (~13–14 mA average), which browned out the coin cell. A tiny 80 mAh LiPo with a TP4056 (modded to ~100 mA) proved the design, then swapping the buzzer’s base resistor from 1k to 10k tamed it to ~56 mA peak and just over 7 mA average—coin cell friendly and still loud. I’m bit-banging audio for now (PWM/timers later). I also made a quick MIDI-to-note tool and a one-bit SFX generator. These boards are heading into my next project—stay tuned.
How Is This 10¢ Chip Talking? - I got a 10‑cent MCU literally talking. With just 16K of flash and 2K of RAM, I used PWM and a tiny transistor amp to play 6+ seconds of audio at 8 kHz by compressing it with super‑simple 2‑bit ADPCM—4:1 compression and a decoder in under 2 KB. I built a handy WAV‑to‑2‑bit‑ADPCM tool to make it easy. For longer phrases, I switched to the Talkie library (TI LPC speech synthesis from the TMS5220/TMS5100 era—think Speak & Spell and classic arcades), and I even made a web tool and player for generating and previewing LPC data. It’s wild what you can squeeze out of a 10‑cent MCU. Also, PCBWay did the boards—link below.
10¢ MCU Brain Surgery - CH32V003 - I crack open a punchy little toy, show how the original just squishes two contacts to light the eye LEDs off a pair of LR41s, then perform some brain surgery to cram in a tiny lithium cell and my own board that triggers lights—and an incredibly annoying tune—on each punch. It sips about 7 µA in deep sleep and wakes via a yellow trigger wire, but the soldering was fiddly and full of swearing. Tape it up, cram it back in the head, and yes, it works a treat… maybe too well, because the beeping is driving me mad.
ESP32 Touch Spectrum - Battery and Expansion port test. - It's time for a bit more testing of the boards from PCB Way, and I must say, these boards have come out amazingly well. Check out PCB Way – there's a link in the description! Today, we're focusing on testing the battery charging and the expansion port. The battery charging circuit seems successful, and even when playing music, everything is running efficiently. I've looked into some optimizations for the speaker side, such as adding more decoupling capacitors. We also tested the expansion port, successfully running an emulator on the Pico that drives the display via the expansion port. Excitingly, I wired up an HDMI breakout board and now we have a big screen! This is still experimental, but it's looking promising. Next steps include more focus on EMI and EMC as we prepare for production. Stay tuned for more updates!
A Vibe Coded One-Button Mechanical Keyboard - ESP32-S3 USB+BTLE - Hey folks! So, I've been tinkering with a compact PCB featuring an ESP32 S3 Mini, and it's been a blast! This little guy has a USB-C and battery connection, with nifty chips like a charge controller and voltage regulator. I'm diving into mechanical keyboards with some cherry switches, and guess what? I made this cool 'Vibe button' for a single key keyboard! I even used AI to vibe code it, so it sends command-enter when pressed. PCB Way did a stellar job on the assembly, and now I'm setting up the RGB LED for charging status. Let's make coding more vibey!
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


Published

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts