Best Microcontrollers to Learn Embedded Programming
A microcontroller is a compact, low-cost, self-contained computer-on-chip used to govern a specific operation in an embedded system. Essentially, it’s a small, low-cost computer on a single chip that contains a processor core (CPU), memory, and programmable input/output peripherals.
Components of a Microcontroller
Although the features and components included in a microcontroller will depend on the type and configuration of it, most microcontrollers will include the following components.
Processor core
The Central Processing Unit (CPU) of the microcontroller, which executes the program stored in the memory. The speed and power of the processor depend on its architecture and clock rate. Common architectures include 8-bit, 16-bit, 32-bit, and 64-bit, with some popular ones being AVR, ARM Cortex-M, and PIC.
Memory
Microcontrollers contain a certain amount of memory to store the program (firmware) and to store temporary data. This memory can be of various types:
RAM (Random Access Memory)
This is volatile memory used for temporary data storage during program execution.
ROM (Read Only Memory)
This is non-volatile memory where the program is stored. For microcontrollers, this is typically Flash memory, which can be electrically erased and reprogrammed.
EEPROM (Electrically Erasable Programmable Read Only Memory)
This non-volatile memory is used to store data that must be preserved when the power is off, but which may need to be updated (like calibration data or system settings).
I/O Peripherals
These are interfaces that allow the microcontroller to interact with other components or devices. These can include:
- GPIO (General Purpose Input/Output) pins
- ADCs (Analog-to-Digital Converters), DACs (Digital-to-Analog Converters)
- PWM (Pulse Width Modulation) interfaces, communication interfaces (like SPI, I2C, UART, CAN, USB)
- Timers, and sometimes more specialized hardware like touch sensing or crypto engines.
Clock System
The clock system generates the clock signal (a steady stream of pulses) that synchronizes all the operations of the MCU.
Other components
Depending on the specific microcontroller, it may include other components like:
- Power-On Reset (POR) circuit
- A brown-out detection circuit
- A watchdog timer,
- LCD drivers, Ethernet MAC, or radio transceivers for wireless communication.
What is An Embedded System and Embedded Programming?
An embedded system is a dedicated computer system designed to perform one or a few dedicated functions within a larger system. It’s embedded as part of a complete device system that includes hardware, such as electrical and mechanical components. Examples of embedded systems range from simple devices like microwaves and washing machines to complex systems like traffic lights control systems or airplane’s avionics systems.
An embedded system is generally composed of:
- Microprocessor or microcontroller: Acts as the ‘brain’ of the system.
- Memory: Stores the program (code) and dynamic data.
- Peripherals: These are devices that allow the interaction of the system with the environment (sensors, actuators, communication modules, etc.)
- Embedded software: This is the code that runs on the microcontroller or microprocessor.
Embedded programming is the practice of writing the code for embedded systems. It is a specialized area of programming that requires knowledge of how to write code that interacts directly with hardware. This can involve reading from and writing to memory-mapped device registers, setting up and using interrupts, managing power modes, and more.
If you want to get started with embedded programming, having a microcontroller is one of the most basic tools you will need. In this post, we will explore the best microcontrollers that you can use to help you get in the world of embedded development.
Arduino Uno (ATmega328P)
The Arduino Uno is one of the most common boards for beginners. It comes with tons of tools, documentation, and community to help you get stated. And, it uses C/C++ programming language for control so you will get a customed to it very quickly.
Features:
- The operating voltage is 5V
- The recommended input voltage will range from 7v to 12V
- The input voltage ranges from 6v to 20V
- Digital input/output pins are 14
- Analog i/p pins are 6
- DC Current for each input/output pin is 40 mA
- DC Current for 3.3V Pin is 50 mA
- Flash Memory is 32 KB
- SRAM is 2 KB
- EEPROM is 1 KB
- CLK Speed is 16 MHz
Raspberry Pi (BCM2711)
While it’s technically a microprocessor board, it’s an excellent tool for learning embedded Linux programming. Python is the most commonly used language with Raspberry Pi, but you can also use C, C++, Java, Scratch, and others.
The BCM2711 Broadcom chip is used in the Raspberry Pi 4 Model B, the Raspberry Pi 400, and the Raspberry Pi Compute Module 4.
Features:
- Quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5 GHz.
- Accesses up to 8GB LPDDR4-2400 SDRAM (depending on model)
- 32kB data + 48kB instruction L1 cache per core.
- 1MB L2 cache.
- Multimedia H.265 (4Kp60 decode); H.264 (1080p60 decode, 1080p30 encode); OpenGL ES, 3.0 graphics
- PCIe bus
- Onboard Ethernet port,
- 2 × DSI ports (only one exposed on Raspberry Pi 4B)
- 2 × CSI ports (only one exposed on Raspberry Pi 4B)
- 6 × I2C, up to 6 × UART (muxed with I2C)
- 6 × SPI (only five exposed on Raspberry Pi 4B)
- Dual HDMI video output, composite video output.
ESP32
This is a low-cost, low-power system on a chip (SoC) with Wi-Fi and Bluetooth capabilities. The ESP32 is a good way to start working with Internet of Things (IoT) applications. You can program it using the Arduino IDE, MicroPython, or the ESP-IDF framework using C/C++.
Features:
- Tensilica Xtensa 32-bit LX6 microprocessor up to 240 MHz and up to 600 DMIPS
- Wi-Fi 802.11 b/g/n/e/i (802.11n @ 2.4 GHz up to 150 Mbit/s)
- v4.2 BR/EDR and Bluetooth Low Energy (BLE)
- 448 KiB ROM
- SRAM: 520 KiB
- RTC fast SRAM: 8 KiB
- RTC slow SRAM: 8 KiB
- eFuse: 1 Kibit
- Embedded flash:Flash connected internally via IO16, IO17, SD_CMD, SD_CLK, SD_DATA_0 and SD_DATA_1 on ESP32-D2WD and ESP32-PICO-D4.
- 0 MiB (ESP32-D0WDQ6, ESP32-D0WD, and ESP32-S0WD chips)
- 2 MiB (ESP32-D2WD chip)
- 4 MiB (ESP32-PICO-D4 SiP module)
- DMA that includes capacitive touch
- ADCs (analog-to-digital converter)
- DACs (digital-to-analog converter)
- I²C (Inter-Integrated Circuit)
- UART (universal asynchronous receiver/transmitter)
- CAN 2.0 (Controller Area Network), SPI (Serial Peripheral Interface)
- I²S (Integrated Inter-IC Sound)
- RMII (Reduced Media-Independent Interface)
- PWM (pulse width modulation), and more.
STM32 series (ARM Cortex-M)
Next, we have the STM32 series. These are a series of microcontrollers with lots of features that can power small to heavy operations.
They are a bit more advanced but have a wide range of options for different needs and applications. STM32 MCUs can be programmed with the STM32Cube IDE, Keil uVision, or other toolchains that support the ARM Cortex-M architecture. The language used is typically C/C++
It is good to keep in mind that there a variety of the Arm Cortex-M series. The one we will cover in this post is the Arm Cortex-M7 core.
Key features:
- Armv7E-M architecture
- Bus interfaces: 64-bit AMBA4 AXI, 32-bit AHB peripheral port, 32-bit AMBA AHB slave port for external master (such as DMA controller) to access TCMs, AMBA APB interface for CoreSight debug components
- Instruction cache: 0 to 64 Kbytes, 2-way associative with optional ECC
- Data cache: 0 to 64 Kbytes, 4-way associative with optional ECC
- Instruction TCM: 0 to 16 Mbytes with optional ECC interface
- Data TCM: 0 to 16 Mbytes with optional ECC interface
- Thumb/Thumb-2 subset instruction support
- 6-stage superscalar + branch prediction
- DSP extensions: Single cycle 16/32-bit MAC, Single cycle dual 16-bit MAC, 8/16-bit SIMD arithmetic, Hardware Divide
- Optional single and double precision floating point unit (choices of none, single precision only, and single and double precision) compliant with IEEE 754 standard
- Optional 8- or 16-region MPU with sub-regions and background region
- Integrated Bit-Field Processing Instructions
- Non-maskable interrupt and 1 to 240 physical interrupts
- Optional wake-up interrupt controller
- Integrated WFI and WFE Instructions and Sleep-On-Exit capability, Sleep & Deep Sleep Signals, Optional Retention Mode with Arm Power Management Kit
- Optional JTAG and Serial Wire Debug ports. Up to 8 breakpoints and 4 watchpoints
- Optional Instruction Trace (ETM), Data Trace (DWT), and Instrumentation Trace (ITM). Optional full data trace with ET
- Support for Dual Core Lock-Step Support (DCLS)
Teensy (ARM Cortex-M4.1)
Teensy boards are high-performance MCUs that are compatible with several professional-level software libraries. You can program them using C/C++ with Arduino, Visual Micro, PlatformIO, CircuitPython, etc.
Features:
- ARM Cortex-M7 at 600 MHz
- Float point math unit, 64 & 32 bits
- 7936K Flash, 1024K RAM (512K tightly coupled), 4K EEPROM (emulated)
- QSPI memory expansion, locations for 2 extra RAM or Flash chips
- USB device 480 Mbit/sec & USB host 480 Mbit/sec
- 55 digital input/output pins, 35 PWM output pins
- 18 analog input pins
- 8 serial, 3 SPI, 3 I2C ports
- 2 I2S/TDM and 1 S/PDIF digital audio port
- 3 CAN Bus (1 with CAN FD)
- 1 SDIO (4 bit) native SD Card port
- Ethernet 10/100 Mbit with DP83825 PHY
- 32 general purpose DMA channels
- Cryptographic Acceleration & Random Number Generator
- RTC for date/time
- Programmable FlexIO
- Pixel Processing Pipeline
- Peripheral cross triggering
- Power On/Off management
PIC microcontrollers (PIC16, PIC18 series)
Manufactured by Microchip Technology, PIC microcontrollers are popular in both industrial and hobbyist markets. They come with very cool features with a wide range of peripherials such as USB, CAN, I2C, etc.
Features:
- 40-pin Low Power Microcontroller
- Flash Program Memory: 32 kbytes
- EEPROM Data Memory: 256 bytes
- SRAM Data Memory: 1536 bytes
- I/O Pins: 33
- Timers: One 8-bit / Three 16-bit
- A/D Converter: 10-bit Eight Channel
- PWM: 10-bit with up to 4 Outputs
- MSSP: SPI and I²C Master/Slave Support
- USART: Addressable Full Duplex Operation
- CAN: CAN 2.0B Spec with Transmit and Receive Buffers
- External Oscillator: up to 40MHz
The features outlined above are based on the PIC18F458-I/P - PIC18F458 40-pin 40MHz 32kb Microcontroller with CAN. The features may vary depending on your model.
ATtiny85
This is a low-power Microchip 8-bit AVR® RISC-based microcontroller that is very suitable for small projects.
Features:
- 8 KB ISP Flash memory
- 512B EEPROM, 512B SRAM
- 6 general purpose I/O lines
- 32 general purpose working registers
- One 8-bit timer/counter with compare modes
- One 8-bit high-speed timer/counter
- USI
- Internal and external Interrupts
- 4-channel 10-bit A/D converter
- Programmable watchdog timer with internal oscillator
- 3 software selectable power saving modes
- DebugWIRE for on-chip debugging.