A microcontroller is like a microcomputer that is available on a single intermixed circuit. Microcontrollers are designed particularly to achieve certain operations in an embedded system, and it comprises a processor, a memory, and input/output peripherals. This post aims to demystify the process of selecting a microcontroller, equipping you with all you need to make an informed decision.
Each and every microcontroller will be different from the other. Nevertheless, the microcontroller is like the brain of any project, and the boom or collapse of your project will depend on it. Also, one microcontroller cannot be used for every project as every application will have different demands. So, selecting the microcontroller chip for your project can become a complicated decision.
So, let’s look at some essential features that one should look for while selecting a Microcontroller.
Key Factors To Look For While Selecting a Microcontroller:
Below are given some important factors that one should look out for while choosing a microcontroller.
1) Understand the Application
The first thing that one should do before choosing any microcontroller for a project on an embedded system is to acquire a deep knowledge of the application for which the microcontroller-based solution is required. Regarding this, a technical specification sheet is always developed as it will help in understanding the particular features that a microcontroller will be used for in a project.
Based on the application of the system in which the microcontroller chip is to be used is made apparent when a microcontroller chip with a single-precision unit is supported for the device that will be utilized to perform tasks involving many decimal numbers.
If you will be able to understand how a microcontroller will be utilized in your project then you can certainly make the right decision.
2) Make a list of required hardware interfaces
Using the general hardware block diagram, make a list of all the external interfaces that the microcontroller will need to support. There are two general types of interfaces that need to be listed. The first are communication interfaces. These are peripherals such as USB, I2C, SPI, UART, and so on. Make a special note if the application requires USB or some form of Ethernet. These interfaces greatly affect how much program space the microcontroller will need to support. The second type of interface is digital inputs and outputs, analog to digital inputs, PWM’s, etc. These two interface types will dictate the number of pins that will be required by the microcontroller. Figure 1 shows a generic example of a block diagram with the i/o requirements listed.
3) Memory Needs
There are various kinds of memory associated with the microcontroller that a designer will look out for when making a decision. Here, the most essential ones are RAM, ROM, and EEPROM. The requirements of these memories might be difficult to estimate until you use them.
The memory of the microcontroller holds the firmware for the microcontroller thus even when power is disconnected from the microcontroller, the memory will not be used. But, this is the case with the program memory. The data memory is utilized during the run time. And all variables and data generated because of processing among other activities during the run-time are stored in the data memory.
Thus, on the basis of the complexity of computation that occurs during run-time can be used to determine the total amount of memory needed for the microcontroller.
4) Clock Speed
The clock speed, measured in MHz, is a key factor in selecting a microcontroller. It denotes the number of instructions the microcontroller can execute per second. More speed means quicker processing, but remember, it also means higher power consumption.
5) Understanding Core and Architecture
The essence of a microcontroller lies in its core or architecture. This component dictates the processing capabilities, speed, and overall efficiency. Popular architectures include the 8-bit AVR (found in Arduino boards), 16/32-bit PIC microcontrollers, and the robust 32-bit ARM Cortex cores. While selecting a microcontroller, match the power of the core to your project needs.
6) Number of Input/Output Pins
The number of general or special I/O pins present in a microcontroller is the most important factor that will surely influence your choice of microcontrollers.
If a microcontroller possesses all the features that we have mentioned but doesn’t have the required I/O ports then it cannot be used.
One more thing to keep in mind here is while determining the amount of Input/Output pins for a project is the future improvement that can be done to the device and how this modification will affect the number of Input/output ports.
7) Bit Size
The microcontrollers come in different bit sizes, they can be either 8bits, 16 bits, 32 bits, or 64bits. At present, 64 bits is the maximum bit size possessed by any microcontroller. For all non-technical readers, the bit size in a microcontroller means the size of a “word” utilized in the set of a microcontroller.
Thus, an 8-bit microcontroller denotes every instruction, address, or variable in 8-bit. One of the main indications of the bit size is the memory capacity of the microcontrollers. In addition to this, the larger the bit size, the larger will be the number of unique memory locations available on the microcontroller chip for use.
For example, the 8-bit microcontroller will have 255 unique memory locations while the 32-bit microcontroller will consist of 4,294,967,295 unique memory locations. And it is very essential to choose a microcontroller with a bit size that meets the data to be processed.
Plus, it is also important to note that the majority of the applications these days are around 32-bits and 16-bit microcontrollers because of the technological improvements done on these chips.
Peripherals are additional hardware features incorporated within the microcontroller to interact with the outside world or perform specific tasks. ADCs and DACs are used for handling analog signals. PWM channels can generate signals for motor control or adjust LED brightness. Communication interfaces allow the microcontroller to communicate with other devices. When selecting a microcontroller, you should make sure it has the necessary peripherals for your project.
For example- to connect an analog sensor to a microcontroller a microcontroller should have enough ADC. Also changing the speed of a DC motor might need a PWM interface on the microcontroller.
9) Operating Voltage
The operating voltage means the voltage level at which a system is built to operate. It is also seen as a voltage level to which certain features of the system are related. In hardware, the operating voltage at times decides the logic level at which the microcontroller will communicate to make up the entire system.
Currently, the 5V and 3.3V voltage levels are the most admired operating voltage for microcontrollers and your decision should be based on these voltage levels.
10) Package Size
Here, the package size means the form factor of the microcontrollers. Generally, microcontrollers come in packages that vary from QFP, TSSOP, SOIC to SSOP, and the regular DIP package makes the arrangement on the breadboard easy. Therefore, it is crucial to plan way ahead of time about which package will be best.
11) Power Consumption
This can be the most crucial factor for some when selecting a microcontroller especially when it is delivered in a battery-powered application like IoT devices. Make sure that the microcontroller you are using is satisfying the power requirements for your project.
12) Price Considerations
The cost of a microcontroller can be influenced by various factors such as its processing capabilities, amount of memory, the number of peripherals, and even supply and demand. For hobbyists and small production runs, the cost difference may not be significant, but for large-scale manufacturing, even a small cost difference can add up.
13) Availability and Community Support
The microcontroller you will choose to work with should have enough support like code samples, reference designs, and if possible a huge online community. If you are working with the microcontroller for the first time then you can face different challenges and using these resources can help you overcome them easily.
Plus, make sure that your microcontroller comes with a good evaluation kit so that you can quickly gain expertise and get familiar with the toolchain for development. It will save lots of your time and will quicken the development process of the device.
Choosing the best microcontroller for your project will continue to be an issue that a hardware designer will have to face and there are still a few factors that can influence your choice of microcontrollers. Moreover, the factors mentioned above are the most important ones.
Examples for Selecting a Microcontroller:
Let’s explore a couple of examples to clarify the process of selecting a microcontroller:
1) Weather Station Project:
For a project like this, you would need a microcontroller that can handle multiple sensors (temperature, humidity, barometric pressure, etc.), possibly an LCD display for local readouts, and maybe even connectivity features to send data to a remote server.
A suitable microcontroller could be the ATmega2560. It has a 16 MHz clock speed and 54 digital I/O pins, allowing for numerous sensors and peripherals. It also has 16 analog inputs for analog sensors, 4 UARTs for serial communication (useful for connecting a wireless module for data transmission), 256KB of Flash memory, and 8KB of SRAM, sufficient for handling the sensor data and the control program.
2) Autonomous Robot Project:
An autonomous robot may require several different types of sensors (distance sensors, IMUs, encoders, etc.), motor control outputs, and possibly communication interfaces for remote control or data transmission.
A good fit could be the STM32F746ZG. It’s based on a powerful 32-bit ARM Cortex-M7 core running at up to 216 MHz. It has a large amount of Flash memory (1 MB) and SRAM (320 KB) for complex programming needs. This microcontroller also offers a wide variety of peripherals, including numerous GPIOs, communication interfaces (SPI, I2C, UART, USB, etc.), and ADCs/DACs. This microcontroller also includes a hardware motor control timer, making it a great choice for robotics applications.
3) Smart Home System:
A smart home system might involve controlling lights, thermostats, and other appliances, collecting data from various sensors, and communicating wirelessly with a central hub or the internet.
The ESP32 would be a strong candidate for this type of project. It’s a low-cost, low-power system on a chip (SoC) series with Wi-Fi & dual-mode Bluetooth capabilities. The ESP32 series is based on the Tensilica Xtensa LX6 microprocessor, which comes in two variants, either with two cores or with one. It also has a good amount of Flash memory and SRAM, which is necessary to handle the Wi-Fi and Bluetooth stacks. With built-in wireless capabilities, it can easily connect to the home’s Wi-Fi network for remote monitoring and control.
Remember, these are just examples, and the best microcontroller for a project will depend on the specific requirements of that project.
Vivek is a Senior Embedded Engineer at Robert Bosch. He has been working on Embedded Systems for the past 10 years. He loves to share his knowledge and train those who are interested. Nerdyelectronics.com was started out of this interest.