The MCU selection is an important part of any project. Microcontrollers (MCUs), are the brains behind many devices that we are using in our daily lives, such as smartphones, home appliances, IOT devices, automobiles etc. The demand for MCU based products are increasing. So, as an Embedded Engineer we should have clear idea about the selection of MCU’s. However, selecting the right microcontroller for a project can be a challenging task, especially for beginners. With so many options available in the market, it can be difficult task to choose the best one which meets our project requirements.
In this blog post, we will discuss the key factors to consider when selecting a microcontroller for your project. We will guide you through the process of evaluating the processing power, memory requirements, peripherals compatibility, power consumption, development environment, availability, cost, support and documentation, and long-term scalability of the microcontroller. By the end of this post, you should be equipped with the knowledge and tools necessary to make an informed decision when selecting a microcontroller for your project.
Project requirements and constraints
We should understand the specifications and the limitations of the project before moving to the MCU selection. We should have deep understanding of the final product in terms of the things it is going to do and what it is not supposed to do. These requirements and constraints may vary depending on the nature of the project and the intended application of the microcontroller. These requirements will also help us in selecting many other things regarding the microcontrollers.
We should have some short of understanding about the requirement of the power consumption, memory requirement, peripherals etc. If we do not have the clear idea of the requirement, then we may end up selecting a MCU that is too much powerful and costly or may end up with a MCU that will not be able to deliver the right amount of processing power or speed to our product.
For MCU selection, it is very important to consider the RAM and flash memory requirements for the project and select an MCU with sufficient memory capacity. In my professional journey I have seen a full project going to scrap (event after release and more than 700K sale of that product) due to non-availability of RAM/Flash memory for more features. Let us understand them in more details.
RAM is a type of volatile memory that is used to store data and program instructions temporarily while the microcontroller is powered on. It is most essential for executing program instructions and storing variables during program execution. The amount of RAM required for a project depends on the complexity of the program and the amount of data that needs to be stored during program execution.
While selecting an MCU, it is very important to ensure that the amount of RAM in the MCU is sufficient for the project’s requirements. Although there is no formula to find out the required RAM and this skill comes with experience but we should have some kind of understanding about the requirements. E.g. if the program is complex and requires a lot of data to be stored during program execution then the MCU with a higher amount of RAM (many KB to few MB) may be necessary.
Flash memory is a type of non-volatile memory that is used to store program code permanently. When the microcontroller is powered on, the program code is loaded from the flash memory into RAM for the execution. The size of the flash memory required for a project depends on the size of the program code, as well as any additional data that needs to be stored in flash memory.
When selecting an MCU, it is crucial to consider the amount of flash memory needed to store the program code and any additional data. If the program is large and have many modules then, a microcontroller with a higher amount of flash memory may be necessary. It is also important to consider the speed of the flash memory according to the project need. Sometimes we need external flash and so we should select the MCU that support high speed read from the flash.
Inbuilt Data storage (EEPROM/NAND memory)
There are various types of data storage available in microcontrollers, such as EEPROM (Electrically Erasable Programmable Read-Only Memory), NAND Flash, or external SD cards. The choice of data storage depends on the amount of data that needs to be stored, the read and write speeds required, and the durability and reliability of the storage medium. For example, if the project involves storing a small amount of data, EEPROM may be suitable. However, if the project requires large amounts of data to be stored, an external SD card or NAND Flash may be more appropriate. We should also consider the number of read/write cycles of these data storage devices. EEPROM have less number of read/write cycles as compared to NAND memory.
Power Requirements for MCU selection
Power requirements are a crucial consideration when selecting a microcontroller for any project. The power requirements of an MCU depend on various factors, such as the operating voltage (5v, 3,3V etc.), current consumption, and power-saving features.
The operating voltage of an MCU determines the voltage range in which the microcontroller can function correctly. It is essential to ensure that the MCU’s operating voltage is compatible with the power source used in the project. If the operating voltage of the MCU is higher or lower than the power source voltage, additional voltage regulation circuitry may be necessary, adding complexity and cost to the project.
Current consumption is another critical factor to consider during the selection of an MCU. The amount of current consumed by the MCU affects the power supply’s capacity and the battery life if the project is powered by a battery. It is important to ensure that the MCU’s current consumption is within the project’s power budget to prevent excessive power drain, which can lead to premature battery depletion or instability in the power supply. The calculating the power consumption we should consider all the peripherals what will be enabled. The power consumption also depends on the clock frequency of the peripherals.
Many MCUs come with power-saving features such as low-power modes, sleep modes, and standby modes that can reduce power consumption during periods of inactivity. These features can help extend the battery life of a project, especially for battery-powered devices. So, if our product is not always active then we should consider these features to save the power.
Required peripherals and their compatibility
It is very important to consider the required peripherals and their compatibility with the microcontroller for MCU selection. Peripherals are the components that are necessary for the microcontroller to interface with the outside world and perform specific functions. Some common peripherals are
- Communication interfaces (UART, SPI, I2C)
- ADCs (Analog to Digital Converters)
- PWM (Pulse Width Modulation) etc.
The first step in determining the required peripherals is to identify the project’s functional requirements. For example, if the project involves controlling a motor’s speed, then a PWM module and ADC may be required. If the project involves sensing the environment’s temperature or light, an ADC module may be required.
Once the required peripherals are identified, it is essential to verify their compatibility with the microcontroller. Different microcontrollers support different types and numbers of peripherals. It is crucial to ensure that the microcontroller selected has the required peripherals and that they can be interfaced with the microcontroller in the desired configuration.
It is also important that the minimum requirements of peripherals is met in the MCU. e.g. if we need at least 5 ADC’s then our MCU should have that many pins for ADC. Similarly, we should check if the number of pins of the MCU are enough to support the buttons, LED’s etc.
Some microcontrollers have built-in peripherals, while others may require some external peripherals to be connected. So, we should check if the external peripherals are used then the number of pins is enough to support them. It is also essential to evaluate the cost, complexity, and compatibility of external peripherals for the MCU selection.
The clock speed or frequency of an MCU is the rate at which the microcontroller’s internal/external oscillator produces clock cycles. These clock cycles are used to synchronize the internal operations of the microcontroller, including executing instructions, accessing memory, and communicating with peripherals.
The clock speed is measured in Hertz (normally KHz/MHz). It is a critical consideration for MCU selection of a project. The clock speed of an MCU determines its processing power and affects the execution speed of the program instructions. Higher clock speeds means that the MCU can process instructions more quickly and handle more complex tasks.
The MCU clock is fed to the peripherals using pre-scaler/post-scaler operations. So, we should also check what is the requirement of individual peripheral.
The clock speed requirements of an MCU depend on the project’s functional requirements. For example, if the project involves processing large amounts of data or performing complex computations, an MCU with a higher clock speed may be required. On the other hand, if the project involves simple tasks such as controlling LEDs or reading button inputs, an MCU with a lower clock speed may be sufficient.
It is also essential to consider the power consumption of the MCU when evaluating clock speed requirements. Higher clock speeds typically require more power, which can impact the project’s battery life if it is battery-powered.
Development Environment & Tools availability
We must consider the development environment and tools available for the MCU selection. The development environment includes the software tools used to program and debug the microcontroller, such as Integrated Development Environments (IDEs), compilers, debuggers, and programming software.
The availability and quality of the development environment and the tools can have a significant impact on the development process. It can reduce/increase the time and cost required to develop and test the software. It is essential to select an MCU that has a robust and user-friendly development environment and tools that are readily available and compatible with the project’s development platform.
The availability of software libraries and examples can also impact the development process, especially for beginners or developers who are not familiar with the microcontroller’s architecture and programming language. The availability of a broad range of libraries and examples can significantly simplify the development process, enabling developers to focus on the project’s core functionalities. So, the development community support, the manufacturer support plays a vital role in selection of MCU.
It is also essential to consider the cost of the development environment and tools, including any licensing fees or subscription costs. Some microcontrollers have development environments and tools that are free to use, while others may require a significant investment to acquire.
We should not forget the tools or licenses that are already available in our organization during MCU selection. This can reduce the expenses as well as it can save a lot of time & effort while setting them up. It is always better to give some preference to available tools instead of buying new one.
Availability and Cost factor for MCU selection
It is essential to consider the availability and cost of the microcontroller during MCU selection. Availability refers to the ease of obtaining the microcontroller and the availability of support, documentation, and resources for the selected microcontroller.
The availability of the microcontroller depends on factors such as the manufacturer’s production capacity, market demand, and distribution channels. We should also check when the manufacturer is going to halt the production of that MC so that the selected microcontroller is readily available for many years in the desired quantity and that there is sufficient technical support and documentation available to aid in the development process.
The cost of the microcontroller is another critical consideration when selecting an MCU for a project. The cost of the microcontroller can vary widely, depending on factors such as the manufacturer, the model, and the features and capabilities of the microcontroller. It is essential to evaluate the cost of the microcontroller based on the project’s budget and the required features and capabilities of the microcontroller.
In addition to the cost of the microcontroller, it is also essential to consider any additional costs, such as development tools, peripherals, and licensing fees for software tools (which are explained in previous section). These additional costs can significantly impact the project’s overall cost and should be considered when evaluating the total cost of the project.
Demo Boards, FAE’s and Community
It is very important to evaluate the support available from the manufacturer and the community during MCU selection. The support includes access to demo boards, Field Application Engineers (FAEs), example codes, and an active community of developers who can provide guidance and support.
Demo boards are pre-built hardware platforms that can be used to evaluate the microcontroller’s capabilities and test the software. Demo boards can significantly accelerate the development process by providing a platform for rapid prototyping and testing. It is essential to ensure that the selected microcontroller has readily available demo boards that are compatible with the project’s development platform.
Field Application Engineers (FAEs) are technical experts employed by the microcontroller manufacturer who can provide support and guidance during the development process. FAEs can provide assistance with hardware design, software development, and troubleshooting. It is essential to ensure that the selected microcontroller manufacturer has a team of FAEs available to provide technical support and guidance as needed.
The manufacturers provide sample examples for different functionalities of the MCU. We should not underestimate this part as it can speed up the development process and also can help in debugging the issues that can arise due to misconfiguration of registers. I personally have taken references from the examples to speed up the development process and have fixed some bugs by checking the examples.
An active community of developers can also provide valuable support during the development process. An active community can provide access to software libraries, forums for discussing and troubleshooting the issues. It is essential to ensure that the selected microcontroller has an active community of developers who can provide support and guidance during the development process.
The HW architecture of a microcontroller is a critical consideration MCU selection for our project. It refers to the internal structure of the microcontroller, including the number and type of cores, the instruction set architecture, and the peripherals available. Some famous examples are ARM, PIC, MSP430 etc.
The number and type of cores in the microcontroller determine the processing capabilities of the MCU. Some microcontrollers have a single core, while others have multiple cores. Some microcontrollers have a combination of different types of cores, such as a general-purpose core and a specialized core for signal processing or encryption. It is essential to evaluate the processing requirements of the project and select a microcontroller with the appropriate number and type of cores.
The instruction set architecture (ISA) of the microcontroller determines the instruction set and programming language used to develop software for the microcontroller. There are various types of ISAs, including RISC (Reduced Instruction Set Computing), CISC (Complex Instruction Set Computing), and hybrid architectures. It is essential to evaluate the project’s programming requirements and select a microcontroller with an ISA that supports the required programming language and instruction set.
The peripherals available in the microcontroller determine the input/output capabilities of the MCU. Peripherals include interfaces for communication with external devices, such as USB, Ethernet, SPI, and I2C, as well as analog and digital input/output pins. It is essential to evaluate the project’s input/output requirements and select a microcontroller with the appropriate peripherals to support those requirements.
It is very important to consider the software architecture required for the project during the MCU selection. The software architecture will depend on the project’s requirements, including the complexity of the application, the required real-time performance, and the desired level of control over the system.
For MCU Selection, it is essential to consider the software architecture required for the project. If the project requires real-time performance or a high level of control over the system, bare-metal programming may be the best choice. If the project requires a balance between control, performance, and development time, an RTOS may be the best choice. For more complex projects, Linux may be the best choice, but it requires significantly more resources than bare-metal programming or an RTOS. Some MCU’s have support for RTOS and some don’t due to limited resources. So, We should pay keen attention to this point. Here is a blog post that explains the difference between bare-metal & RTOS.
Physical environment (Temperature, Humidity, dust etc.)
The physical environment in which the microcontroller will operate is an important consideration for MCU selection. The temperature, humidity, and other environmental factors can significantly affect the performance and reliability of the microcontroller.
Operating outside of the recommended temperature range can cause the microcontroller to malfunction or even fail. Therefore, it is crucial to select an MCU that can operate within the expected temperature range of the project’s physical environment. Mountains, sea, desert will definitely have different temperature and so we need to pay attention to this part.
Humidity is another factor that can affect the performance and reliability of the microcontroller. High levels of humidity can cause condensation to form on the PCB, potentially leading to short circuits and other issues. Therefore, it is essential to select an MCU that can operate within the expected humidity range of the project’s physical environment.
Other environmental factors to consider when selecting a microcontroller include dust, vibrations, and electromagnetic interference (EMI). Dust and vibrations can cause mechanical stress on the PCB, potentially leading to damage or failure. EMI can cause unwanted signals to interfere with the microcontroller’s operation, leading to unpredictable behavior.
Security consideration for MCU Selection
Security is an increasingly important consideration for MCU Selection for a project. Many modern applications require secure communication and data storage to protect sensitive information from unauthorized access or tampering. When selecting an MCU, it is essential to consider the security features and capabilities it provides.
One critical security feature to consider is encryption. Encryption algorithms can be used to protect data transmission and storage by scrambling the data in such a way that only authorized parties can access it. Some MCUs come with hardware-accelerated encryption capabilities, which can significantly improve performance and reduce power consumption compared to software-based encryption.
Another important security feature to consider is secure boot. Secure boot is a process that verifies the integrity of the software running on the MCU before allowing it to execute. This can prevent attackers from running malicious code on the MCU, such as firmware malware or rootkits.
Secure key storage is also another important security consideration. Many MCUs come with secure key storage features, which can protect sensitive cryptographic keys from unauthorized access or tampering.
Other security features to consider when selecting an MCU include secure communication protocols, secure firmware update mechanisms, and hardware-based security modules, such as trusted execution environments (TEEs) or secure enclaves.
Industry Requirements (Medical/Auto/Space/Military etc.)
For MCU selection of a project in a specific industry, it is crucial to consider the industry’s specific requirements and regulations. Here are some examples of industry-specific requirements and considerations:
Medical Industry: In the medical industry, MCUs are used in a variety of applications, such as monitoring equipment, diagnostic tools, and implantable devices. When selecting an MCU for a medical application, it is essential to consider factors such as reliability, safety, and compliance with regulatory standards, such as ISO 13485 and IEC 60601.
Automotive Industry: MCUs are used extensively in the automotive industry for applications such as engine control, safety systems, and infotainment systems. When selecting an MCU for an automotive application, it is essential to consider factors such as reliability, safety, and compliance with automotive industry standards, such as ISO 26262.
Space Industry: In the space industry, MCUs are used in satellites, spacecraft, and other space-based applications. When selecting an MCU for a space application, it is essential to consider factors such as radiation tolerance, power consumption, and compliance with industry standards, such as MIL-STD-883.
Military Industry: In the military industry, MCUs are used in a variety of applications, such as communication systems, weapon systems, and surveillance equipment. When selecting an MCU for a military application, it is essential to consider factors such as ruggedness, reliability, and compliance with military standards, such as MIL-STD-810.
The package of an MCU is an important consideration when selecting an MCU as it determines how the MCU will be physically mounted to the printed circuit board (PCB). Here are some of the criteria to consider when selecting an MCU package:
- Board Space: The size of the package can impact the amount of board space required for the MCU. Smaller packages, such as VDFN (Very Thin Dual Flat No-Lead) and BGA (Ball Grid Array), can help to reduce the overall size of the PCB, making it suitable for compact and portable devices.
- Power Dissipation: The package can also affect the power dissipation of the MCU. Larger packages with more pins, such as TQFP (Thin Quad Flat Package), can offer better heat dissipation, while smaller packages may require additional thermal management.
- Pin Count: The number of pins required by the MCU can influence the choice of package. Smaller packages typically have fewer pins, while larger packages can accommodate more pins.
- Assembly and Manufacturing: The package can impact the ease of assembly and manufacturing. Through-hole packages require additional steps for assembly, while surface mount packages are easier to assemble and offer higher manufacturing throughput.
- Soldering: The type of package can affect the soldering process. Some packages, such as BGA, require more advanced soldering techniques, while other packages such as QFN (Quad Flat No-Lead) are easier to solder.
I have seen that big product manufacturers have very good network and bargaining power that they use directly with the manufacturer. These giants enjoy special powers, and many times get early access to the development tool and MCU. Sometimes, the manufacturer provides dedicated FAE to ramp up the development process and also to finetune algorithms on the microcontrollers. If your organization enjoy this premium, then it should be kept in top of mind while selecting the MCU for the upcoming project. The Distributors/Suppliers (e.g., DigiKey, Element14 etc.) have tools to select the microcontrollers. So, we should also take help of these tools.