The vast majority of electronic products require a microcontroller or microprocessor to serve as the brains. For advanced products needing high-speed processing capabilities (i.e. a smartphone or tablet) then a microprocessor is necessary, otherwise a microcontroller is usually the best solution. As examples, an Arduino is based on a microcontroller and a Raspberry Pi is based on a microprocessor.
Most likely your electronics design is going to need a microcontroller. Generally a microcontroller can be thought of as a computer built onto a single integrated circuit that contains a processor, memory and various peripherals. There are a lot of choices for microcontrollers, perhaps an overwhelming number of choices.
Although a search on Google could steer you in the right direction, I recommend searching for microcontrollers on the major electronic component distributors such as Digikey, Arrow, and Mouser. This will allow you to narrow down your search to only microcontrollers that are actively available. It also allows you to quickly compare prices.
At the beginning of a project it’s a good idea to draw a block diagram of the system that you envision. What sort of things are you going to connect to the microcontroller?
A system block diagram is invaluable for this early planning and can tell you how many input and output (I/O) pins and serial communication ports are needed for the project.
Microcontrollers can include a wide variety of peripherals. The following list are some of the features that can be found on modern microcontrollers.
Memory: Most microcontrollers available today include built-in FLASH and RAM memory. FLASH is non-volatile memory used for program storage, and RAM is volatile memory used for temporary storage. Some microcontrollers also include EEPROM memory for permanently storing data.
Digital General Purpose Input and Output (GPIO): These are logic level pins used for input and output. Generally they can sink or source up to a few tens of millamps and can be configured as open drain or push pull.
Analog input: Most microcontrollers have the ability to precisely read an analog voltage. Analog signals are sampled by the microcontroller via an Analog to Digital Converter (ADC).
Analog output: Analog signals can be generated by the microcontroller via a Digital to Analog Converter (DAC) or a Pulse Width Modulation (PWM) generator. Not all microcontrollers include a DAC but they do offer PWM capabilities.
In Circuit Programming (ISP): ISP allows you to program a microcontroller while it is installed in the application circuit, instead of having to remove it for programming. The two most common ISP protocols are JTAG and SWD.
Wireless: If your product needs wireless capabilities then there are specialized microcontrollers available that offer Bluetooth, WiFi, ZigBee, and other wireless standards.
All microcontrollers provide some type of serial communication. The various serial communication protocols commonly offered with microcontrollers are described below:
Universal Asynchronous Receiver Transmitter (UART) is a serial port that transmits digital words, typically of length 7 to 8 bits, between a start bit and an optional parity bit and one or two stop bits. A UART is commonly used along with other standards such as RS-232 or RS-485.
UART is the oldest type of serial communication. UART is an asynchronous protocol which means there is no clock signal. Many microcontrollers also include a synchronous version of a UART called a USART.
Serial Peripheral Interface (SPI): SPI is used for short distance serial communication between microcontroller and peripherals. SPI is a synchronous protocol which means it includes a clock signal for timing. SPI is a 4 wire standard that includes data in, data out, clock, and chip select signals.
Inter Integrated circuit (I2C): I2C also written as I2C is a 2-wire serial bus used for communications between the microcontroller and other chips on the board. Like SPI, I2C is also a synchronous protocol. However, unlike SPI, I2C uses a single line for both data in and data out. Also instead of a chip select signal, I2C uses a unique address for each peripheral. I2C has the advantage of only using 2 wires, but it’s slower than SPI.
Universal Serial Bus (USB) is a standard that is familiar to most people. USB is one of the fastest serial communication protocols. It is generally used for connecting up peripherals that require large amounts of data transfer.
Controller Area Network (CAN) is a serial communication standard developed specifically for use in automotive applications.
Notable Microcontroller Cores
There are a several microcontroller cores that have some notoriety and are worth describing. Below are four of the most common ones:
The 32-bit ARM Cortex M series is one of the most commonly used microcontroller cores used today. ARM doesn’t actually make and sell microcontrollers, instead they license their architecture to other chip makers.
Many companies offer Cortex-M microcontrollers including ST Microelectronics, Freescale Semiconductor, Silicon Labs, Texas Instruments, and Atmel.
Cortex M series microcontrollers are my favorite choice for products that will be brought to market. They are low cost, powerful, and widely used.
The 8-bit 8051 microcontroller was developed by Intel way back in 1980. It’s the oldest microcontroller core commonly still used today. The 8051 is currently available in enhanced modern versions sold by at least 8 different semiconductor manufactures. For example, the popular Bluetooth Low-Energy chip from CSR (CSR101x) uses an 8051 core.
The PIC is a family of microcontrollers from Microchip. They are very popular and come in a wide array of options. The number of pins, package style, and selection of on chip peripherals are offered in an almost endless array of combinations.
The microcontroller line known as AVR from Atmel is best known for being the brains in most versions of the Arduino. So for many makers it’s an easy transition from an Arduino to an Atmel AVR microcontroller. However, I’ve found that you can usually get one of the other cores with similar, or better, performance for several dollars cheaper.
Once you’ve selected the microcontroller the next step is designing the microcontroller circuit and connecting up all of the peripherals. I’ll be discussing that topic for my next article in this series.
Want to learn more about designing an electronic product? Then check out my detailed two part guide How to Develop and Prototype a New Electronic Product.
Join Make: Community Today