A Better STM32F0 Prototyping Experience

This project started when I was particularly annoyed by existing development board options and cheap Chinese PCB prototyping services were starting to emerge. Thus, the path forward was clear, but let’s start with the problems I was trying to solve.

When I’m talking about ‘development boards’, I mean boards like the Teensy models, Feather variants or blue pill: a PCB based laid out around a microcontroller containing very little extra circuitry; a ‘least common denominator’ of typical projects using that MCU, if you will. Evaluation boards with more interesting circuitry are great to get used to a microcontroller and its peripherals but lie beyond the scope of this post.

Development boards like these generally break out all useful MCU pins onto 0.1-inch headers and try to be as small as possible. This works out great for breadboarding or when you have ready-to-go modules for all your parts anyway. Getting the job done is as easy as it gets when you’re selecting your components based on the available modules and the available software libraries anyway.

Extra PCB space for prototyping is only sold as an add-on module, even though it would be, in my opinion, an extremely useful addition in general and not just for some fringe cases. Otherwise, as soon as you need even one external driver transistor, you’d have to decide whether to connect it with loose wire or to tack on some perfboard. Even if every component involved comes with its own little PCB, the whole assembly likely ends up as large, frail mess of wires, unless you want to limit yourself to your particular development board’s ecosystem.

Ergo, this project was started to help me keep small prototypes all in one place and sensibly resilient without the extra effort, while allowing maximum flexibility.

Design objectives

Before getting to the actual PCB layout, there need to be some concrete, tangible goals for the design. After the short rant above, here we are:

Goals

Non-goals

Design choices

That was a lot of talk about the general ideas and the honourable aim of the project. Now it’s time to narrow the design space down and try to fulfil our constraints.

The microcontroller

As the first (and most important) part, the central microcontroller was chosen to be a STM32F030F4P6, a 48 MHz ARM Cortex-M0 with 16 KiB flash and, amongst others, 2 KiB SRAM, one USART, one I2C, one SPI, nine ADC channels and four timers. With a small and manageable microcontroller like that, the board can become a cheap and easy solution for small prototypes, simple automation tasks, data logging, etc.

It’s deliberately a rather small device because I found it to be sufficient for a lot of stuff I do. Personally, I don’t really like to approach of directly going for a vastly overpowered microcontroller for every side project just because it’s a one-off thing and the slight additional cost doesn’t matter; instead I consider optimising the firmware and making it fit into a small device part of the fun. On top of that, with a small microcontroller, the board can be small and still won’t hold you back from doing everything with the controller you can possibly do. For instance, the decision which pins to break out is unnecessary because there’s simply enough space for all of them.

Form factor

Extremely small breakout boards for various microcontrollers are already plentiful enough and I didn’t want to compete with these. With a prototyping area as the key distinction, I had to strike a balance between a tiny PCB with insufficient space for other components and a large board which would be too unwieldy for most actual prototypes.

As mentioned in the very beginning, a key factor at the start of the project were special PCB prototyping offers. For this reason and the one outlined previously, I arrived at a quadratic 50 by 50 mm PCB pretty quickly. This proved to leave ample space for a prototyping area while still being small enough to be installed in actual prototypes.

Initial design

Here’s what I’ve come up with (all board renders in this post are generated with tracespace viewer, by the way):

The schematic is rather lightweight. Not too much on this PCB after all.

I chose the name leshy, for less expensive STM32-hosting prototypes. Even though an evil forest spirit isn’t the best namesake for a friendly development board, that was the best (pronounceable) acronym I could come up with.

Notable design decisions

Second revision

When I started running out of PCBs, I took the opportunity to optimise the design a bit. Not too much was changed, though:

The schematic, pretty unchanged.

Apart from that, the PCB stayed the same:

Revision 3: a redesign

The last two revisions had a few annoyances:

Since the last revision, I had also moved away from KiCad to Horizon EDA. While still in a beta stage, it is already more comfortable than other EDA tools in my opinion. I decided to redo the complete design in Horizon, which allowed me to pull some tricks which would have been inconvenient to implement in KiCad.

As the first problem was the most important one, I started the redesign with this one. I had come across the ALio prototyping platform, which looked like a solution (and a strict improvement on the current prototyping area). The staggered holes allowed for bigger hole diameters in the ‘base grid’ while clearances could be increased at the same time. The non-plated smaller ‘vias’ lower the risk of solder seeping through for SMD parts. On top of that, the horizontal and vertical connections via solder bridges should be a very nice addition.

I created a parametrisable design inspired by the ALio boards. I didn’t exactly follow the original’s geometry. Most importantly, the clearances between pads aren’t uniform. Instead, I increased them outside the designated ‘solder jumper’ areas.

Apart from the supply current measurement jumper (J3, ‘IDD’ in the previous revisions), the new layout is mechanically and pin-compatible. Still, a lot of improvements were possible:

The schematic of the new revision is split into functional blocks and adds a few more notes (click for the PDF).

Revision 3.1

Revision 3.1 is mostly identical to 3.0. The only change was to move some more vias out of the way of the extensive silkscreen to make it more readable. Here’s what it looks like:

Software

The STM32F030 is a pretty small controller and naturally I prefer its code to be rather close to the hardware. Its peripherals don’t include anything complicated, so it’s well usable without a hardware abstraction layer or other support libraries.

Nevertheless, it’s nice to have a starting point and some code to reuse. Thus, whenever I come across a piece of code which might be of general use, I add a little example to the repository’s demo directory.

In use

I want to conclude this short write-up with some examples to highlight leshy’s capabilities for fast and easy prototyping. Most of these can be found in the aforementioned demo directory.

Minimal circuitry in a small case

Not much is necessary to drive WS2812B or SK6812 LEDs: a single pullup for a five volt tolerant pin is enough. I reused a resistor footprint originally present for one of the on-board LEDs. That way, the prototyping area can be snapped off and the leshy fits into a pretty small case. With three potentiometers, a controller to set H, S, and V is done very quickly:

Simple state machines

A lot of automation tasks just need a few components for signal conditioning and driving external devices. This paste dispenser timer just needed two MOSFETs for driving solenoid coils and a few protection diodes:

A lot can fit

I needed a simple controller for a Hakko 907 soldering iron and a straight-forward solution was to add a seven segment display, a rotary encoder and a driving MOSFET to a microcontroller board. Everything apart from the rotary encoder and the circular connector fits directly onto the prototyping area. Code and schematic can be found on GitHub.

Wrap-up

Having used these boards in lots of different projects, I’d consider the project a success. While there probably are still some little details to be fixed, they are already a lot more convenient than other existing solutions. For my, a leshy nicely fits into a niche between proof-of-concepts where I can stay within one ecosystem and use off-the-shelf modules, and less impromptu projects where I’d design and etch/order a PCB.

I might expand on this idea and lay out development boards in the same form factor but with different microcontrollers. Promising candidates could be the ESP8266 for WiFi prototypes, the ATSAMD11 series, which would allow USB connectivity, or STM8 microcontrollers for testing very low cost designs.

Let’s finish with a final shot of the fully populated revision 3.1 PCB.

Schematics, layout and firmware examples can be found in the project’s GitHub repository. Some prose of mine on the project’s previous revisions can be found on leshy’s Hackaday.io page.


  1. Well, almost all. I had to skip the EVENTOUT pins but they aren’t all that useful anyway. ↩︎