Tutorial: How to Design Your Own Custom Microcontroller Board — Part 1

Tutorial on how to design your own custom microcontroller board.

John Teel
6 years ago

This is the first of a two-part tutorial where you’ll learn how to design your own custom microcontroller board.

Initially, we’re going to focus on just the microcontroller itself so you can more easily understand the design process without getting overwhelmed with circuit complexity.

You’re going to learn how to design the system and the schematic circuit in this first tutorial. Then, in part two you’ll learn how to lay out the printed circuit board (PCB) and order prototypes.

This is a short introduction to a free tutorial from PredictableDesigns.com. See the complete and most up-to-date version of this tutorial here [includes tutorial video].

I’ll break down the design process into three fundamental steps:

STEP 1 — System Design

STEP 2 — Schematic Circuit Design

STEP 3 — PCB Layout Design

System / Preliminary Design

When developing a new circuit design the first step is the high-level system design (which I also call a preliminary design). Before getting into the details of the full schematic circuit design it’s always best to first focus on the big picture of the full system.

Designing the system consists mainly of two steps: creating a block diagram and selecting all of the critical components (microchips, sensors, displays, etc.). A system design treats each function as a black box.

In engineering, a black box is an object which can be viewed in terms of its inputs and outputs but without any knowledge of its internal workings. With a system-level design the focus is on the higher level interconnectivity and functionality.

Block Diagram

Below is the block diagram that we’ll be working from in this tutorial series. As I mentioned, for this first tutorial we’ll focus just on the microcontroller itself. In future tutorials we’ll expand the design to include all of the functionality shown in this block diagram.

A block diagram should include a block for each core function, the interconnections between the various blocks, specified communication protocols, and any known voltage levels (input supply voltage, battery voltage, etc.).

Later, once all of the components have been selected and the required supply voltages are known I like to add the supply voltages to the block diagram. Including the supply voltage for each functional block it allows you to easily identify all of the supply voltages you’ll need as well as any level shifters.

In most cases when two electronic components communicate they need to use the same supply voltage. If they are supplied from different voltages then you’ll usually need to add in a level shifter.

Now that we have a block diagram we can better understand the necessary requirements for the microcontroller. Until you’ve mapped out everything that will connect to the microcontroller it’s impossible to select the appropriate microcontroller.

Select Microcontroller

When selecting a microcontroller (or just about any electronic component) I like to use an electronics distributor’s website like Newark.com. Doing so enables you to easily compare various options based on a variety of specifications, pricing, and availability. It’s also an easy way to quickly access the component’s datasheet.

If you regularly read this blog you’ll know that I’m a big fan of Arm Cortex-M microcontrollers. Arm Cortex-M microcontrollers are easily the most popular line of microcontrollers used in commercial electronic products. They have been used in tens of billions of devices.

Microcontrollers from Microchip (including Atmel) may dominate the maker market but Arm dominates the commercial product market.

Arm doesn’t actually manufacture the chips directly themselves. They instead design processor architectures that are then licensed and manufactured by other chip makers including ST, NXP, Microchip, Texas Instruments, Silicon Labs, Cypress, and Nordic.

The Arm Cortex-M is a 32-bit architecture that is fantastic choice for more computationally intensive tasks compared to what is available from older 8 bit microcontrollers such as the 8051, PIC, and AVR cores.

Arm microcontrollers come in various performance levels including the Cortex-M0, M0+, M1, M3, M4, and M7. Some versions are available with a Floating Point Unit (FPU) and are designated with an F in the model number such as the Cortex-M4F.

One of the biggest advantages of Arm Cortex-M processors is their low price for the level of performance you get. In fact, even if an 8-bit microcontroller is sufficient for your application you should still consider a 32-bit Cortex-M microcontroller.

There are Cortex-M microcontrollers available with very comparable pricing to some of the older 8-bit chips. Basing your design on a 32-bit microcontroller gives you more room to grow should you want to add additional features in the future.

Although numerous chip makers offer Cortex-M microcontrollers, my favorite by far is the STM32 series from ST Microelectronics. The STM32 line of microcontrollers is quite expansive with just about any feature and level of performance you would ever need.

The STM32F subseries is their standard line of microcontrollers (versus the STM32L subseries which is specifically focused on lower power consumption). The STM32F0 has the lowest price but also the lowest performance. One step up in performance is the F1 subseries, followed by the F3, F2, F4, F7, and finally the H7.

For this tutorial I have selected the STM32F042K6T7 which comes in a 32-pin LQFP leaded package. I selected a leaded package primarily because it simplifies the debugging process because you have easy access to the microcontroller pins. Whereas with a leadless package, like a QFN, the pins are hidden away underneath the package making access impossible without test points.

A leaded package also allows you to more easily swap out the microcontroller if it were to become damaged. Finally, leadless packages cost more to solder on to the PCB so they increase both the prototyping and manufacturing costs.

I selected the STM32F042 because it offers moderate performance, a good number of GPIO pins, and various serial protocols including UART, I2C, SPI and USB. This is a fairly entry-level STM32 microcontroller with only 32 pins, but with a wide variety of features. More advanced versions come with as many as 216 pins which would be quite overwhelming for an introductory tutorial.

Read the rest of this article here.

P.S. Download your free cheat sheet 15 Steps to Develop Your New Electronic Hardware Product.

John Teel
I'm an electronics design engineer, entrepreneur, and founder of Predictable Designs.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles