A microcontroller is essentially a small computer on a chip, like any computer, it has memory and usually programmed in embedded systems to receive inputs, perform calculations and generate output. Unlike a processor, it incorporates the memory, the CPU, I/O and other peripherals on a single chip like shown in the layout below.
Choosing the right microcontroller for a project is always a complex decision to make because it is the heart of the project and success or failure of the system depends on it.
There are a thousand different type of microcontrollers, each of them with a unique feature or competitive advantage from form factor, to package size, to the capacity of the RAM and ROM that makes them fit for certain applications and unfit for certain applications. Thus often times, to avoid the headache that comes with selecting the right one, designers opt for microcontrollers that they are familiar which at times, even they do not really satisfy the requirements of the project. Today’s article will take a look at some of the important factors to look at when selecting a microcontroller including the Architecture, the memory, Interfaces and I/O real estate among others.
Important factors to consider when selecting a MCU
The following are some of the important factors to look at when selecting a microcontroller including the Architecture, the memory, Interfaces and I/O real estate among others.
The first thing to do before selecting a microcontroller for any project is to develop a deep understanding of the task for which the microcontroller based solution is to be deployed. A technical specification sheet is always developed during this process and it will help to determine the specific features that the microcontroller which will be used for the project. A good example of how the application/use of the device determines the microcontroller to be used is exhibited when a microcontroller with a floating point unit is adopted for the design of a device that will be used to perform operations involving a lot of decimal numbers.
2. Select Microcontroller Architecture
The Architecture of a microcontroller refers to how the microcontroller is structured internally. There are two major architectures used for the design of microcontrollers;
- Von Neumann Architecture
- Harvard Architecture
The von Neumann architecture features the use of the same bus to transmit data and fetch instruction sets from the memory. Therefore data transfer and instruction fetch cannot be performed at the same time and are usually scheduled. The Harvard architecture on the other hand features the use of separate buses for the transmission of data and fetching of instructions.
Each of these architectures comes with its own advantage and disadvantage. The Harvard architecture for instance are RISC (Reduced instruction Set) computers and are thus able to perform more instructions with lower cycles than the CISC (Complex instruction Set) computers which are based on the von Neumann architecture. One important advantage of the Harvard (RISC) based microcontrollers is the fact that the existence of different buses for data and instruction set enables the separation of the memory access and the operations of the Arithmetic and logic unit (ALU). This reduce the amount of computational power required by the microcontroller and it leads to reduced cost, low power consumption and heat dissipation which makes them ideal for the design of battery operated devices. Many ARM, AVR and PIC Microcontrollers are based on the Harvard architecture. Example of microcontrollers that use the Von Neumann architecture include 8051, zilog Z80 among others.
3. Bit Size
A microcontroller can either be 8bits, 16bits, 32bits and 64bits which is the current maximum bit size possessed by a microcontroller. The bit size of a microcontroller represents the size of a “word” used in the instruction set of the microcontroller. This means in a 8-bit microcontroller, the representation of every instruction, address, variable or register takes 8-bit. One of the key implications of the bit size is the memory capacity of the microcontroller. In an 8-bit microcontroller for example, there are 255 unique memory locations as dictated by the bit size while in a 32-bit microcontroller, there are 4,294,967,295 unique memory locations, which means the higher the bit size, the higher the number of unique memory locations available for use on the microcontroller. Manufacturers these days however, are developing ways to provide access to more memory location to smaller bit size microcontrollers via paging and addressing, so that 8bits microcontroller become 16bits addressable but this tends to complicate programming for the embedded software developer.
The effect of bit size is probably more significantly experienced when developing the firmware for the microcontroller especially for arithmetic operations. The various data types have different memory size for different microcontroller bit size. For example, using a variable declared as an unsigned integer which due to the data type will require 16bits of memory, in codes to be executed on an 8bit microcontroller will lead to the loss of the most significant byte in the data which at times may be very important to the achievement of the task for which the device on which the microcontroller is to be used, was designed.
It is thus important to select a microcontroller with a bit size that matches that of the data to be processed.
It is probably important to note that most application these days are between 32bits and 16 bits microcontrollers due to the technological advancements incorporated on these chips.
4. Interfaces for Communication
Communication between the microcontroller and some of the sensors and actuators that will be used for the project might require the use of an interface between the microcontroller and the sensor or actuator to facilitate the communications. Take for instance to connect an analog sensor to a microcontroller will require that the microcontroller has enough ADC (analog to digital converters) or as I mentioned earlier, varying the speed of a DC motor may require the use of PWM interface on the microcontroller. So it will be important to confirm that the microcontroller to be selected has enough of the interfaces required including UART, SPI, I2C among others.
5. Operating Voltage
The Operating voltage is the voltage level at which a system is designed to operate. It is also the voltage level to which certain characteristics of the system are related. In hardware design the operating voltage at times determine the logic level at which the microcontroller communicates with other components that makes up the system.
The 5V and 3.3V voltage level are the most popular operating voltage used for microcontrollers and a decision should be made on which of these voltage level will be used during the process of developing the technical specification of the device. Using a microcontroller with a 3.3V operating voltage in the design of a device where most of the external components, sensors and actuators will be operating on a 5V voltage level will not be a very smart decision as there will be a need to implement logic level shifters or converters to enable the exchange of data between the microcontroller and the other components and this will increase the cost of manufacturing and the overall cost of the device unnecessarily.
6. Number of I/O Pins
The number of general or special purpose input/output ports and (or) pins possessed by a microcontroller is one of the most important factors that influences the choice of microcontroller.
If a microcontroller were to have all of the other features mentioned in this article but doesn’t have enough IO pins as required by the project, it cannot be used. It is important that the microcontroller has enough PWM pins for instance, to control the number of DC motors whose speed will be varied by the device. While the number of I/O ports on a microcontroller can be expanded by the use of shift registers, it cannot be used for all kind of applications and increases the cost of the devices in which it is used. Therefore, it is better to ensure the microcontroller to be selected for the design has the required number of general and special purpose I/O ports for the project.
One other key thing to keep in mind when determining the amount of general or special purpose I/O pins required for a project, is the future improvement that may be done to the device and how those improvements may affect the number of I/O pins required.
7. Memory Requirements
There are several types of memory associated with a microcontroller that are designer should look out for when making a selection. The most important ones are the RAM, ROM and EEPROM. The amount of each of these memories needed might be difficult to estimate until its being used but judging on the amount of work required of the microcontroller, predictions can be made. These memory devices mentioned above form the data and program memory of the microcontroller.
The program memory of the microcontroller stores the firmware for the microcontroller so when power is disconnected from the microcontroller, the firmware is not lost. The amount of program memory needed depends on the amount of data like libraries, tables, binary files for images etc that are needed for the firmware to work correctly.
The data memory on the other hand is used during run time. All variables and data generated as a result of processing among other activities during run-time is stored in this memory. Thus, the complexity of computations that will occur during run-time can be used to estimate the amount of data memory needed for the microcontroller.
8. Package Size
The package size refers to the form factor of the microcontroller. Microcontrollers generally come in packages ranging from QFP, TSSOP, SOIC to SSOP and the regular DIP package which makes mounting on breadboard for prototyping easy. It’s important to plan ahead of the manufacturing and envisage which package will be best.
9. Power Consumption
This is one of the most important factors to consider when selecting a microcontroller especially when it is to be deployed in a battery powered application like IoT devices where it is desired that the microcontroller be as low power as possible. The datasheet of most microcontrollers contain information on several hardware and (or) software based techniques that can be used to minimize the amount of power consumed by the microcontroller in different modes. Ensure the microcontroller you are selecting satisfies the power requirement s for your project.
10. Support for Microcontroller
It’s important the microcontroller you choose to work with has enough support including; code samples, reference designs and if possible a large community online. Working with a microcontroller for the first time might come with different challenges and having access to these resources will help you overcome them quickly. While using latest microcontrollers because of those cool new features it came with is a good thing, it is advisable to ensure that the microcontroller has been around for at least 3-4 months to ensure most of the early problems that may be associated with the microcontroller would have been resolved since various customers would have done plenty of testing of the microcontroller with different applications.
It is also important to select a microcontroller with a good evaluation kit, so you can quickly start building prototype and test out features easily. The evaluation kits are a good way to acquire experience, get familiar with the tool chain used for development, and save time during the development of the device.
Selecting the right microcontroller for a project, will continue to be a problem, every hardware designer will have to solve and while there are few more factors that may influence the choice of microcontroller, these factors mentioned above are the most important.
Some additional facts.
Engineer is needed to check for local or remote support for the Microcontroller.,Cost as well as lead times.
As well as compiler cost.
This article excellent !
This article excellent ! Thanks
I want to know difference between aurdino and renesas microcontrollers. Why we prefer renesas over aurdino.