How to Select the Microcontroller for Your New Product

How to Select the Microcontroller for Your New Product

How do you select the right microcontroller for your specific hardware product? This article will show you all the different factors you need to juggle when selecting the very best microcontroller.

A circuit board Description automatically generated

When selecting the right microcontroller for a project you must consider cost, performance, power consumption and overall size. The availability of the proper software and hardware tools is also a prime consideration.

Support for the chosen platform is also very important – not just from the vendor, but from the community at large. It also helps if the chosen microcontroller has a readily available development board.

Finally, development time can be significantly reduced if the selected microcontroller has extensive, fully debugged, software libraries with well documented Application Programming Interfaces, or API’s.

NOTE: This is a long, very detailed article so here's a free PDF version of it for easy reading and future reference.

In this article, only microcontrollers that generally meet the above criteria will be presented.

All modern microcontrollers share some basic features. On top of a processing unit, they have a certain amount of flash that is used to store the application code, some SRAM, and, in most cases, some EEPROM.

They need a clock source, and this is normally provided by either an internal resistor-capacitor (RC) oscillator, or by using an external crystal for more timing critical applications. They have some digital IO ports, and at least one timer/counter.

Also, other than very low-end microcontrollers, most have at least one UART for serial communications. Beyond that, microcontrollers are distinguished by the amount of memory they have, the number and type of other peripherals integrated on the chip, and the speed at which they run user applications.

This is not just dependent on the raw clock speed; it also depends on the data width of the processor and any hardware acceleration features included.

Microcontrollers for embedded systems mainly fall into three categories based on the width of their data buses: 8-bit, 16-bit and 32-bit. There are others, but these are the most popular ones.

In general, 8-bit microcontrollers are geared toward lower end applications, and 32-bit ones are for the higher ends, with 16-bit for mid-end applications.

By far, most of the products I work on tend to incorporate 32-bit microcontrollers, but 8 or 16-bit microcontrollers can be a good choice for low-end, low-cost products.

8-Bit Microcontrollers

If an application does not have very high demands on processing power, and is of relatively small size, then it can make sense to consider an 8-bit microcontroller.

For reference, most Arduinos are based on 8-bit microcontrollers. So if you have built your early prototype using an Arduino then you may be able to use an 8-bit microcontroller in your final product.

Don’t let price alone though guide your decision and in many cases 32-bit microcontrollers can be cheaper than 8-bit chips.

For example, the Atmega328p is the 8-bit microcontroller used the Arduino Uno. It costs a little over $1 in volumes of around 10k pieces. It runs at 20 MHz and includes 32 KB of Flash and 2KB of RAM.

On the other hand, you can purchase a 32-bit microcontrollers running at 48 MHz with similar memory for only 60 cents. This is likely due to the popularly of 32-bit microcontrollers driving down their cost.

That being said, there are even cheaper 8-bit microcontrollers available that cost less than 25 cents at similar volumes.

8-bit microcontrollers should typically be considered for applications that are dedicated to just doing one job, with a limited user interface and little data processing.

8-bit microcontrollers come in all sizes from small 6-pin devices to chips with 64 pins. They have flash sizes ranging from 512 bytes to 256KB, SRAM sizes from 32 to 8KB, or more, and EEPROM from 0 to 4K, or more. A minimal system can be as simple as a single chip, with a bypass capacitor on the power supply rail.

The three most popular lines of 8-bit microcontrollers are the 8051 series, the PIC series from Microchip, and the AVR series from Atmel, now part of Microchip.

The 8051 Series

Originally from Intel, and now made by others, this microcontroller is still in common use today, embedded in lots of appliances.

While they are available as standalone devices, the 8051 is now mostly used as IP (Intellectual Property) cores that are embedded in the silicon of dedicated application-specific chips such as some wireless radio transceivers.

Very rarely would the 8051 be the correct choice to serve as the main microcontroller for your product.

The PIC Series

PIC microcontrollers are quite popular, and have wide support by both Microchip, and third parties.

Microchip provides its MPLAB® X Integrated Development Environment (IDE), which includes a C-compiler for free. Also available for free as an IDE plug-in is the MPLAB Code Configurator that generates C-code for the on-board peripherals.

This can then be integrated in the application code. There are PIC models with combinations of USART’s, SPI, I2C, ADC, USB, LIN, CAN and other interfaces. Microchip also offers development tools such as the MPLAB PICkit 4.

Higher quality commercial compliers that have better code optimization are also available. Here is a quick PDF reference guide to PIC microcontrollers.

Get your FREE Ultimate Guide - How to Develop and Prototype a New Electronic Hardware Product in 2024

The AVR series

The AVR is another series of very popular 8-bit microcontrollers. While they are in the same space as the PIC’s described above, and have comparable performances, they do have one big claim to fame: Arduino.

A circuit board Description automatically generatedFigure 1- Most Arduino boards are based on 8-bit AVR microcontrollers

 

The original Arduinos, such as the Uno, Leonardo and Mega, all use AVR microcontrollers. Due to the very wide range of available libraries for Arduinos, the AVRs merit serious consideration for 8-bit applications, even if only for proof of concept prototypes.

Since Arduino libraries are written in C++, they can be easily incorporated in any application written in C/C++.

Software development tools include AVR studio, or, if using Arduino, the Arduino IDE and Platform IO are both commonly used. The complier used in these IDE’s is AVR GCC a free, very well supported and maintained C/C++ compiler.

Hardware development tools include the Atmel ICE and the PICkit 4. In addition, mature tools such as the STK600 and AVR Dragon are still widely available. Here is a link to a quick PDF reference guide for AVR microcontrollers.

16-Bit microcontrollers

16-bit microcontrollers are the next step up from 8-bit, while still sharing many of the same attributes. They are faster, support even more peripherals, and generally offer more memory, both flash and SRAM.

In addition to more IO pins, most of them also have hardware multipliers that are significantly faster, and use less program memory, compared to pure software implementations.

It is easy to find devices that have both ADC’s and DAC’s, or devices with capacitive touch sensors, segmented LCD drivers and Ethernet.

Internally, these devices also have hardware blocks typically not found in lower end devices. These include encryption engines, Operational or Programmable Gain Amplifiers, and DMA controllers.

Although 16-bit microcontrollers can be found from various manufacturers such as Microchip (their dsPIC33 microcontroller is a popular choice), NXP, Infineon, or Cypress, the TI MSP430 series will be presented here as a typical example of this microcontroller segment.

TI MSP430 Series

The MSP430 is a series of very low power 16-bit microcontrollers that are available in many flavors. They range from general purpose to very specialized models.

One interesting thing about the specialized variants of these microcontrollers is that it actually branches out into two extremes: very dedicated, very low-cost models, and high end models with analog sensor interfaces and Digital Signal Processing (DSP).

An example of a high end application is this ultrasonic flow sensor. At the low end, TI also makes MSP430-based chips that solve many very specific hardware functions. For more details see this e-paper.

For example, want a SPI to UART interface, an I/O expander, or a UART-to-UART bridge? It’s all in there, and all for less than $0.30 for this chip.

Finally, of course, the MSP430 is supported by a number of low-cost tools and development kits.

Table 1 below shows the additional features available on some of the mainstream versions.

MSP430FR2x MSP430FR4x MSP430FR5x MSP430FR6x
Program Memory Up to 32KB Up to 16KB Up to 256KB Up to 128KB
Number of pins 16 to 64 in a variety of packages 48 to 64 in a variety of packages 24 to 100 in a variety of packages 56 to 100 in a variety of packages
Peripherals not typically available in 8-bit controllers DAC’s, PGA’s, Transimpedance & operational amps IR modulation logic DMA, AES DMA, AES
LCD segment drivers Up 256 Up to 320

Table 1 – Mainstream MSP430 summary of features

 

32-Bit Microcontrollers

32-bit microcontrollers are powerful devices with microprocessor-like features. Some of the advanced features include instruction pipelining, branch prediction, Nested Vectored Interrupts (NVI), Floating Point Units (FPU), memory protection, and on-board debuggers.

Instruction pipelining means that the processor core pre-fetches subsequent instructions ahead of time, and branch prediction pre-fetches the next instructions of both outcomes of an if-else condition, thus speeding up code execution.

NVI provides for interrupt priorities, where one interrupt can preempt a lower priority one.

FPU’s can do floating point calculations much faster than SW-implemented methods.

Memory protection ensures that application code cannot inadvertently over-write critical sections dedicated to the operating system, for example.

Finally, on-board debugging allows peeking into registers and other areas of the system to facilitate application code debugging. All of these together allow these microcontrollers to run large, fast, and robust applications.

In addition, their raw processing power means they can easily support Real Time Operating Systems (RTOS) that, in turn, provide multitasking capabilities.

Even though there are many 32-bit microcontrollers on the market, the focus in this note will be on the ARM Cortex M-based devices, with a special mention of the ESP32 from Espressif.

ARM Holdings actually only designs processor core IP’s, which they then license to various semiconductor vendors that incorporate them, along with some peripherals, into their own silicon chips. Numerous chip makers offer microcontrollers based on the Cortex-M architecture.

Two prominent vendors of ARM-based chips are Atmel with their SAM device line, and STMicroelectronics with their STM32 line of products.

The SAM devices deserve mention here due to their use in some Arduino-compatible boards. However, in general, the STM32 devices offer more choices, and should be given top consideration when designing in an embedded 32-bit microcontroller.

STM32 microcontrollers

ARM Cortex M cores come in many versions. The most popular ones are the M0/M0+, M1, M3, M4 and M7, each offering progressively higher performance. STM32 microcontrollers incorporate M0/M0+, M3, M4 or M7 cores.

Figure 1 shows the STM32 family of ARM Cortex M-based microcontrollers, and their intended application segments.


Figure 2 – STM32 family of microcontrollers

Within each of the categories shown in figure 1, there are many families that can be selected to more closely match a given application.

For example, figure 2 shows the main variants available in the “mainstream” category, and their relative performance curve. Note that within each family itself, there are many variants with different combinations of peripherals and amounts of memory.

In fact, at this time, there are over three hundred STM32 microcontrollers available in this category.


Figure 3 – Family of microcontrollers in the STM32 Mainstream category

STM32 hardware support: The STM32 family is supported by a wide variety of hardware tools provided both by ST Microelectronics, and third parties.

An inexpensive in-circuit debugger/programmer is the STLink V2. It is made by ST, and is available from places such as Digi-Key; however, very inexpensive clones are also available.

ST Microelectronics also has a large selection of development boards under their Nucleo and Discovery families.

Both contain a STLink debugging interface. All that is needed is a computer with USB, running the appropriate software tool to evaluate the chosen microcontroller.

Discovery boards include additional external peripherals such as MEMs sensors, and capacitive touch plates. However, Nucleos have headers that are compatible with Arduino shields.

A circuit board Description automatically generatedFigure 4 – ST Discovery development board for an STM32F407 microcontroller

Before leaving this section, it is worth mentioning yet another very inexpensive development board. Commonly known as Blue Pill, this board sports a STM32F103 Cortex M3-based chip, and costs less than $2.00 from some sources.

An appealing feature of this board is that it can be made compatible with Arduino so that the Arduino IDE, or Platform IO, can be used to write and download code for quick proof of concept designs.

While the process of making it Arduino compatible is a bit involved, there are several places that sell Arduino-ready boards. Just do a search for ‘STM32duino’.

NOTE: This is a long, very detailed article so here's a free PDF version of it for easy reading and future reference.

To learn how to design a custom STM32 based microcontroller board be sure to watch this tutorial and check out this in-depth paid course.

STM32 software support: STMicroelectronics provides a version of ARM’s Mbed development suite for all its STM32 product line. This includes an IDE, compiler and an extensive set of libraries.

For developers that prefer to use other compilers, ST provides its STMCube. This is code generator software that produces initialization codes for the STM32 peripherals.

With that, there is no need to fully go through the bit settings of multiple registers to set up the peripherals such as IO ports or timers, for example.

ESP32

The ESP32 is a microcontroller from Espressif Systems. As shown in figure 3, it has all the features on a typical 32-bit microcontroller.

A circuit board Description automatically generatedFigure 5 – Espressif ESP32 module

However, what distinguishes this particular microcontroller from others is the inclusion of WiFi and Bluetooth hardware on the chip.

That includes not just the protocol stacks, but the actual radio transceivers as well. The ESP32 is also available as a small pre-certified module with integrated antenna.

For applications that require WiFi or Bluetooth connectivity, the ESP32 deserves serious consideration. The price of the ESP32 (both discrete chip and module) are very affordably priced, especially considering the number of features and performance packed into this chip.

Figure 6 – ESP32 functional block diagram

Conclusion

The microcontroller is arguably the most important component you must select for your product. Changing to a new microcontroller mid-project can be a nightmare, so be sure you get this choice right upfront.

Other components in a design can commonly be changed without requiring massive, system-wide changes. That is not the case with the microcontroller which serves as the core of your product.

When picking a microcontroller you want to generally pick one that gives your product some room to grow. For example, if you determine that you require 16 GPIO pins then you don’t want to pick a microcontroller with only 16 GPIO pins.

What happens if you decide to add a new button in the future so you need another GPIO pin? If your microcontroller doesn’t give you room to grow, then you may find that seemly simple design upgrades in the future will require a massive redesign because a new microcontroller is necessary.

On the other hand, you don’t want to select more performance or features than you ever anticipate needing.

For instance, if your product simply monitors temperature and humidity then you won’t ever need an advanced 32-bit microcontroller running at hundreds of MHz. That would be overkill which will add unnecessary costs and design complexities to your product.

Instead, you need to find the sweet spot between having room to grow if needed, but yet not paying for performance or features you will never really need.

Other content you may like:

3.8 10 votes
Article Rating
Subscribe
Notify of
guest

18 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Shakil

I believe you have mentioned some very interesting details 

Arhan
Arhan

Hi friends , i need help to select the micron roller for my product development . can some suggest the cheap and best controller.  
flash – 521 kb to 1 Mb , UART , SPI , I2C and  8 to 10 GPIO .  

Please suggest the for the same

shakil

It’s hard to come by experienced people about this subject, however, you sound like you know what you’re talking about! Thanks

Caroline
Caroline

Hi I’m actually working on a project in which I need to use four different sensors along with IOT technology for a wearable device. I’m planning to use cortex m0 microcontroller. Is it a good choice?

Prodip

Thank you for your Instructive post.

Babu
Babu

Wonderful article at the exact time..thanks a lot,John!!!

Hemant Kamat

While it is prudent to choose a microprocessor based on its technical capabilities, most of our customers (We are a design house) go by the cost. So, even if a MCU is an overkill for a particular application, we go by that MCU for “cost effective” end product. Secondly, just as C programming language replaced most Assembly Language Programming, ARM and ARM Cortex architectures are an option to custom architectures. ARM architectures provide scalability as MCU and MPU are available from minimal features(few KB Flash, few KB RAM and other peripherals) to rich features for moderately complex applications. The software ecosystem has also streamlined with Eclipse based IDE and GNU tools integrated into the development system.

Doug
Doug

John,
We had college student come to our company and present their senior projects. The teams had build some interesting things, a running shoe sensor, autonomous RC car, and other fun things.
Here is something that struck me. None of them thought in terms of the “micro”. To them the processor was “Beagle Bone” or “Raspberry Pi”. As in, “we should have upgraded to a Beagle Bone from the arduino.” The idea of putting a micro on a board is a level below where they were comfortable.

John Teel
Reply to  Doug

Yes, it will be difficult to ever reach production manufacturing with that way of thinking:) Thanks for the comment Doug.

Hemant Kamat
Reply to  Doug

I agree with you, John. Many are not aware that Arduino, Raspberry Pi, Beagle Bone and many others are hardware platforms or “boards” based on various microcontrollers. While these ready to use, off the shelf boards are good for prototyping or proof of concept development, they may not fit production level projects which least require custom shape and size for boards and many other components to comply with industrial requirements. I use either TI Launchpads, STM Nucleus or NXP FRDM boards for prototyping and PoC. That makes it easy to custom design and develop production boards later based on the same MCU. Also, the software ecosystem available with these DK or Eval boards is common from proto to production.

Eugene
Eugene

I tried STM ones and they are really great and low priced but I found that the FW and PCB development would take a lot of extra work. So I ended up using the Atmel ARM-based SAMD21 MC which is used in Arduino Zero. In this way I could reuse/modify the Eagle open source PCB ready-to-go designs and just put my extra board components, and the FW development in Arduino IDE is really easy compared to STM FW tools. Also, Arduino Zero platform uses the same MC chip for the core MC and the USB interface, you don’t need a separate USB interface chip like in Arduino Uno. The bottom line is: using Arduino platform is a real design effort saver, and you can easily migrate your prototype Arduino PCB and FW design into production designs. The SAMD21 does not have an EEPROM for NVM data storage so I ended up using an external EEPROM (not a big deal)

John Teel
Reply to  Eugene

Thanks for the comment Eugene and sharing your experiences.

Deniz Gezmis
Deniz Gezmis

In my experience, ESP8266 is quite good, however, there are a few drawbacks.

1) WiFi transmit range is less than average (with built-in antenna).
2) There are not much I/O pins available for developers when used (all) onboard/modules.

Thanks, John.

John Teel
Reply to  Deniz Gezmis

Totally agree Deniz, although I prefer the ESP32 over the ESP8266. Thanks for the comment.

Raleigh Jones
Raleigh Jones

John, I like to use the Cypress PSoC devices, at least at first.
They are a mixed signal array with CPU.
In other words, a microcontroller in which your desired complement of peripherals can be selected from a menu and placed in the device.
Once you have your design working and know what peripherals you need, it’s not that difficult to port the design to a more cost effective microcontroller if you prefer, if you can find one with the needed peripherals.

Craig Ross
Craig Ross

Hi John, Have you any experience with the NXP Kinetis microcontroller family? I was made aware of this family by a professor at a local university where I give occasional guest lectures. The Kinetis based FRDM board(s) is used in a microcontroller lab course.

Enjoyed the article, and learned of the “Pill” boards through it.

Copyright 2024 Predictable Designs LLC.  Privacy policy | Terms
  10645 N Oracle Blvd, Ste 121-117, Tucson, Arizona 85737 USA