How to Design a Microcontroller Circuit

Other Boards Technology
How to Design a Microcontroller Circuit

The circuit design needed for an embedded microcontroller can be a little overwhelming. Just the data sheet and technical references alone can run several hundred pages for advanced microcontrollers.

Before starting on the circuit design it’s a good idea to draw a block diagram showing all the major parts of the project, including all of the peripherals that will interface with the microcontroller.

ARM Cortex-M Microcontroller

This article will focus primarily on the circuit design considerations of incorporating an ARM Cortex-M microcontroller. The ARM Cortex-M microcontroller architecture is offered by several chip makers in various versions.

ARM Cortex-M is a 32-bit architecture that is especially suited for computationally intensive tasks compared to what is available from typical 8 bit microcontrollers. A 32-bit microcontroller is also beneficial if you have an application that requires a larger memory address space or that needs an easy migration path for future expansions.

We’ll be discussing a line of ARM Cortex-M microcontrollers from ST Microelectronics called the STM32, or more specifically we’ll focus on the STM32F4 series.

However, the STM32 series is huge and also includes the ultra-low power STM32L line, as well as higher and lower performance versions compared to the STM32F4. The highest performance version is the STM32F7 which can perform over 1 billion instructions per second. At the other end of the performance spectrum, the STM32L0 executes only 26 million instructions per second.

See the schematic circuit diagram below in Figure 1 showing the STM32F4 circuit we will be referring to throughout this article.

Figure 1. Click to view larger image.

Power Supply Design

Powering your circuit is one of the most important aspects of the hardware design and you should not wait too late in the design process to determine the power and grounding scheme.

The current used by the microcontroller is determined by several factors such as the operating voltage, the clock frequency and the I/O pin loads.

Each power supply VDD pin on the MCU should have 1uF and 100nF ceramic capacitors (for example, see C7 and C8 in Figure 1) placed as close as possible to provide power supply decoupling. An additional 4.7uF ceramic capacitor (C1 in Figure 1) should be placed near the IC on the main circuit trace supplying VDD.

Microcontrollers with an Analog-to-Digital Converter (ADC) also usually have separate power (VDDA) and ground pins (VSSA) just for analog. These pins must be especially clean of any noise.

The VDDA pin should have 1uF and 10nF ceramic capacitors (C10 and C11 in Figure 1) placed as close to the VDDA pin as possible. In most cases, I find it a good idea to also include an inductor (L1 in Figure 1) on the VDDA pin to form a LC low-pass filter giving an even cleaner analog supply voltage.

If your supply voltage is above the maximum input voltage for the microcontroller, then a low-dropout linear voltage regulator is usually required. For example, the TPS795xx from Texas Instruments is especially low-noise and can source up to 500mA.
If your supply voltage is significantly higher than the required microcontroller voltage then a buck switching regulator is a better choice. Linear regulators waste too much power when their input voltage is significantly higher than their regulated output voltage.

However, it’s usually best to still sub-regulate the switching regulator’s output voltage with a linear regulator. This is because a linear regulator produces a much cleaner, lower noise supply voltage.


The STM32F4 can be run from an internal or external system clock. The system clock on powerup is the internal clock (16 MHz) and after system initialization another external clock source can be selected in software.

The clock pins on the STM32F4 can drive an external 4 to 26 MHz crystal (see X1 in Figure 1) or an independent clock source up to 50 MHz can be used.

The layout guidelines in the datasheet should be strictly adhered to when it comes to laying out the crystal. In general, the traces should be short and the load capacitance on the crystal should be the same as what the crystal manufacture recommends.


The General Purpose Input/Output (GPIO) pins on microcontrollers are programmable and can be configured by software as an input or an output.

For example, S1 in Figure 1 is a push button that is connected to a GPIO programmed as an input. The STM32 provides internal pull-up resistors so there is no need for an external pull-up resistor for this button. An example of an GPIO output is shown driving an LED.

Most of the GPIO pins have alternate functions and various on chip peripherals access the external world through these multi function pins.

Not all internal function are available to every GPIO pin and there is specific mapping allowed, so consult the datasheet when choosing what specific pins are being used.

The GPIO pins can be used to drive various loads and most pins can sink or source up to 25mA. However, it is generally a good idea to provide some type of external drive circuit to off load the drive requirements. For example, see MN1 driving an LED in Figure 1.

The STM32 does have maximum allowed current specified for each pin individually as well as limits on the total current for all GPIO pins summed together.

Connecting Peripherals

The STM32 provides serial connectivity through various interfaces including UART, I2C, SPI, and USB.

As an example, in Figure 1 a temperature sensor (U2 – LM75BDP) is connected to the microcontroller via the I2C bus. Two pullup resistors (R2 and R3) are required on the I2C bus since the devices connecting to the bus have open drain drivers.

For low-speed applications, such as with most sensors, I2C is usually my preferred serial protocol because it only uses two lines for communication. Also, unlike SPI which requires a separate chip select line for each peripheral, I2C uses unique addresses. This means that only two lines can be used to connect to multiple peripherals.

The SPI bus in Figure 1 is connected to a MPU-9250 9-axis motion sensor (U3) from Invensense. The MPU-9250 includes a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer.

Programming Connector

The STM32F4 offers two In-System Programming (ISP) interfaces: Serial-Wire-Debug (SWD) and JTAG. Lower cost versions of the STM32 only offer the SWD interface. SWD and JTAG are the two most common programming interfaces used for microcontrollers.


In this article we’ve discussed the circuit design for a microcontroller. Specifically we’ve looked at an STM32F4 circuit design that’s able to read an input button, drive an LED and communicate with an I2C temperature sensor as well as an SPI motion sensor. For more details on creating a new electronic product see my Ultimate Guide on How to Develop a New Electronic Product.

Discuss this article with the rest of the community on our Discord server!
John Teel

John Teel is president of Predictable Designs a company which helps entrepreneurs bring new products to market. John was formerly a senior design engineer for Texas Instruments where he created electronic designs now used in millions of products (including some from Apple). He is also a successful entrepreneur who developed his own product, had it manufactured in Asia, and sold in over 500 retail locations in three countries. Download his free cheat sheet for developing your new electronic hardware product.

View more articles by John Teel


Ready to dive into the realm of hands-on innovation? This collection serves as your passport to an exhilarating journey of cutting-edge tinkering and technological marvels, encompassing 15 indispensable books tailored for budding creators.