What are microcontrollers?

the-arduino-uno-next-to-an-assortment-of-other-mic-makezine-210728

We all use computers which can run several tasks at roughly the same time as the operating system manages all the tasks, so what are microcontrollers and how do they differ from the computer?

Microcontrollers

The advantage of computers is that they can do lots of things around the same time, but they don’t do things well. Consider you are trying to save a file to the hard drive and the computer is also doing something else with that hard drive, your program has to wait for the computer to finish that first task.

This is where microcontrollers come into their element, as they only have one program running in a loop:

  1. Read an input
  2. Process that input
  3. Write an output
  4. Repeat

This means they are running in real time.

Types of microcontroller

There are different types of microcontroller in the world, in heavy industry, the use of the PLC (Programmable/Process Logic Controller) is a hardened microcontroller which is designed to work in tough environments like mining and is often a set and forget device.

There are many small devices that have microcontrollers in them from children’s toys that play a tune when a button is pressed or the toy is moved to lighting and central heating systems.

Arduino/Genuino

The Arduino was designed to be an easy to program microcontroller for interactive art displays in Italy back in 2005. This lead to the release of a range of Arduino boards to the general public from 2007, and these are based on the ATmel AVR 8-bit microcontroller.

The Arduino is a practical hobbyist and education platform and it’s easy to use IDE (Integrated Development Environment) enables programs called “sketches” to be created and written to the microcontroller.

When you set up the IDE, you choose the board name and load the libraries to be used for the inputs (sensors) and outputs (drivers) then you assign the pins on the microcontroller so that they interact correctly with these. When you upload your code, the IDE compiles your sketch and if successful, it converts that compiled code into machine code and writes it to the Arduino.

Since Arduino hardware is flexible, there have been various use cases made around these microcontrollers:

  • Classic – These are designed for hobbyists and people in education to plug wires into sockets on the board to a separate breadboard
  • Lilypad for wearable computing – Designers can sew microcontrollers to their garments using conductive thread
  • Nano – These are designed to be connected directly to the breadboard and have wires connect to them that way.

In 2012, Arduino released the Due which used the Arm Cortex 32-bit microcontroller, which is considerably faster than the AVR series and can access more memory and has more pins to connect to devices.

The original founders created two companies: Arduino LLC and Arduino SRL, which means that boards in the USA are marketed as Arduino and the rest of the world as Genuino. There are also shameless clones of Arduino boards out there.

STM32

STMicroelectronics has the STM32 which is a 32-bit microcontroller but is aimed at a different market, often used with audio projects that require precision engineering, they offer the same features as the Arduino in a form that is better to integrate into products.

ESP32

Espressif’s ESP32 has gone down the route of producing a 32-bit microcontroller that is a system on a chip, which means it has built in Wi-Fi, Bluetooth and USB capability, as well as having much more capabilities built into the chip. However, these capabilities share the pins with each other, so to use one feature, you sacrifice another.

There is an ESP32-CAM board that integrates a camera into the chip, and there are models that integrate the display as well as battery charging capabilities.

The ESP32 is available as an oversized chip as well as a development board. The ESP01 (formerly called ESP8266) can also be purchased as a way to add Wi-Fi to an existing project.

Raspberry Pi Pico

The Raspberry Pi foundation made it’s name from the Raspberry Pi, a range of single board computers fashioned with the desire to recreate the 1980s craze of the Acorn model B and Sinclair ZX Spectrum that created a generation of university students interested in computers.

In 2021, The Raspberry Pi foundation released their Pi Pico 2040, which comes as the chip or as a nano board. This means a hardware designer can make a board that takes the chip and use that in their projects rather than just the nano board. A unique feature of the Pico is PIO (Programmable Input/Output) which means the pins are reprogrammable through software while the Pico is running, rather than at the point of compiling.

Share this post with your friends