The mysterious sounding "microcontroller", often shortened to MCU, is something we mention a lot here at Bytebarista. But what is it really, and what is it used for?

A microcontroller is a tiny, simple and slow computer. Often it doesn't even run an operating system, instead you write programs that run directly on the hardware.

When we talk about a microcontroller, we mean the chip itself. However, it doesn't actually do much on its own. It needs power to run, and something to communicate with, whether that be a screen, some buttons, or another microcontroller.

For hobbyists, it's often convenient to use something called a devboard. A devboard will often contain everything you need to program it and to get started. This can include the microcontroller itself, a USB port, buttons and lights.

How do you pick a MCU?

When picking a MCU for use in a project (there are many many to choose from!), we often start by looking at peripherals.

Peripherals are what makes it possible for an MCU to communicate with the outside world. Examples would be turning a light on and off, sensing a button press, or displaying some cats on a screen.

There are a lot of different MCU manufacturers. Each one of these often make their own peripherals. This means that (unless you use high-level libraries) the code you write for one microcontroller will most likely not work on others.

Why use a MCU instead of something like a Raspberry PI?

Well, there are a variety of reasons why someone might want to do so:

  • Size - A microcontroller is available in sizes down to a grain of rice or smaller. This is especially useful in applications like inside your credit card, or in your earbuds.
  • Startup time - Could you imagine if your calculator used minutes to boot? Yeah, we wouldn't want that either.
  • Reliability - Slightly related to the above, what if your calculator bluescreened? A microcontroller can have much fewer "moving parts", so there is less that can go wrong.
  • Power usage - A specialized microcontroller could run for months on a single coin cell battery.
  • Price - Since they have less memory and are slower, they also cost much less. There are quite capable microcontrollers available for a few cents a piece.