It might surprise you to find out all the ways that microcontrollers have embedded themselves in our lives. You can find them in almost all the electronic appliances in your home. In the past, microcontrollers were only used in computers, but now they’ve made their way into a whole range of day-to-day applications. But what are microcontrollers really? And what is it about them that makes them so versatile?

Microcontrollers, as the name suggests, are miniaturized controllers. In other words, a microcontroller is an integrated circuit that’s used to run specific operations. So, for example, how does your washing machine translate your input into an efficient wash cycle? It’s all possible because of a microcontroller.

In this article, we’ll be looking at what a microcontroller is and why you should know about it. We’ll go over some types and how to program one, and towards the end, we’ll look at some real-world applications. So, let’s start our micro ride.

Featured image of Arduino
All About
Arduino

Back to Contents

What Is a Microcontroller?

Not So Micro

Arduino is one of the most popular microcontroller development boards that is used worldwide in various projects
Arduino develops a hugely popular range of microcontroller development boards (Source: Arduino)

A microcontroller is a single integrated circuit that comprises various elements, including a microprocessor, timers, counters, input/output (I/O) ports, random access memory (RAM), read-only memory (ROM), and some other components. These parts work together to execute a pre-programmed set of specific tasks. Thus, a microcontroller is like a little computer that processes and even executes control in an electronic device.

Many people incorrectly label development boards such as those developed by Arduino as microcontrollers. However, Arduino is more accurately described as a development platform that centers around easily programmable boards with microcontrollers at their core. The “Arduino” itself is just an elaborate board that houses all the components of the microcontroller, along with some extra ports and other features. This enables you to program and re-program the microcontroller for various tasks.

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

How They Work

Nowadays, automobiles are not only limited to mechanical innovations but, intelligent and electronic innovations too.
Modern cars demonstrate electronic (and "smart"), as well as mechanical, innovations (Source: Infineon4Engineers via YouTube)

To understand why microcontrollers form an important part of our modern electronics world, just look at any electronic device accessible to you. Microcontrollers are at the heart of any embedded system today. So, let’s start with your car.

Suppose your car has the functionality for automatic windshield wipers. These wipers are to turn on when there are rain showers and turn off automatically once the rains end. But how does it execute a function that’s so specific and repetitive?

In such a system, a microcontroller is responsible, pre-programmed for exactly this scenario. Input from the sensors that are connected to your windshield is provided to and processed by the CPU, which then matches the signals with the program already inscribed into the memory of the microcontroller.

If the logic of the microcontroller deduces that, yes, it’s raining, it gives the command to the corresponding output (in this case the windshield wiper motor). This way the microcontroller not only processes the input but also controls the output in the system. And all these elements are built into a single chip that’s sometimes smaller than your thumbnail.

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

Micro Elements

Microcontrollers bring together multiple components onto a single chip
Building your own microcontroller takes up a lot more space than a single chip! (Source: Technoblogy)

As mentioned previously, microcontrollers are kind of like a tiny computer on a chip. And, like with full-size computers, various elements form important parts of a microcontroller and aid in its functioning. Let’s briefly go over each of these elements.

Central Processing Unit (CPU)

The CPU is the core of the microcontroller, often referred to as the brains. It takes in inputs, interprets them, and executes operations, all according to the program in memory. It works in tandem with RAM and ROM to produce the desired output quickly and with great efficiency.

Random Access Memory (RAM)

We can refer to RAM as data memory. This is the memory in which temporary data is held while the CPU executes operations. You can think of it like the workbench upon which everything is laid out while you work on individual elements one at a time.

Read-Only Memory (ROM)

ROM is the program memory in a microcontroller, storing all the program instructions. The CPU fetches its instructions from the ROM and executes them one at a time. Unlike RAM, ROM necessarily stores data even after the device’s power has been switched off. Using the previous analogy, this is your workshop’s closet, where things are permanently stored, including your blueprints!

Input/Output Ports (I/O)

The I/O ports on a microcontroller communicate with other devices
The I/O ports on a microcontroller communicate with other devices (Source: Kompulsa)

We can describe I/O ports as the sensory inputs and the limbs of the microcontroller body. It uses these ports for communication and interfacing with external devices. Additions like switches, thermistors, accelerometers, and so on are inputs, while speakers, lights, or signals sent to a motor are examples of outputs.

Timers & Counters

Timers and counters are the elements that find the most varied applications in the microcontroller. They can perform tasks like controlling LEDs and modulating the speed of motors, and the CPU executes the operation in tandem with the microcontroller clock (a continual, periodic, alternating signal). This enables functions such as pulse width modulation (PWM), clock control, frequency measuring, and counting external pulses.

Analog to Digital Converter (ADC)

As the name indicates, the ADC converts the analog input signals from the external sensors to digital signals. This is necessary because the CPU needs digital input to perform operations. In this way, the ADC forms a bridge between analog input (e.g. a temperature-derived voltage) and the CPU.

Digital to Analog Converter (DAC)

This is the inverse of the ADC; the DAC converts the digital signals to pure analog outputs. This is then further used to control external devices. For example, a DC motor needs an analog input, so the digital output from the CPU is first converted to an analog output and then passed on to the motor.

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

Types of Control

There are almost 50,000 transistors present in the Intel 8051 microcontroller
There are almost 50,000 transistors present in the Intel 8051 microcontroller (Source: Jay Carlson)

There are various types of microcontrollers classified in different ways. We can classify them based on the number of bits, memory devices, instruction sets, and architecture. However, all these categories originate from the three main types of microcontrollers.

8051

The 8051 microcontroller from Intel is among the most universally used microcontrollers, even today. Invented in the 1980s, this microcontroller paved the way for the future of micro-computing. It featured an 8-bit CPU, with 64 KB of ROM and a RAM address space of 128 bytes.

As it’s based on the Harvard architecture, the program memory and data memory remain separate. This provides fast computing speeds and avoids any overlaps. 8051 microcontrollers are found in many applications because of their ability to be integrated into smaller projects easily.

AVR

AVR microcontrollers are chips that you’ll have come across at least once if you’re into electronics. These microcontrollers are used in many development boards, including the famous Arduinos. The architecture is the same as that of the 8051 but with notable improvements. The AVRs are based on the RISC instruction set, which allows them to compute at much higher speeds while still consuming less power than the 8051.

PIC

PIC stands for peripheral interface controller, a type of microcontroller that was first developed in 1975 and is mainly used for industrial applications. It’s also based on the Harvard architecture and the RISC-type instruction set, slightly improving upon the AVR type of microcontroller. PICs also have a smaller instruction set than AVRs, thus making them easier to learn. Among some very famous PIC microcontrollers are PIC18fXX8, PIC16f88X, and PIC32MXX.

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

Micro Programming

Programs for microcontrollers can be provided by the manufacturer, like Arduino's IDE
Programs for microcontrollers can be provided by the manufacturer, like Arduino's IDE (Source: Arduino Blog)

Well-built hardware is just one side of the story. Microcontrollers would be of no use if they couldn’t be programmed. Programming a microcontroller means feeding in the logic and sets of instructions that the microcontroller will require while executing the task. Overall, the programming aspect of the microcontroller is a three-step procedure.

Programming

Here, we write the actual code for the microcontroller, usually in higher-level languages such as C, C++, or Java. Typically, a software platform called an Integrated Development Environment (IDE) is used to write the program, and in many cases, this is provided by the manufacturer of the microcontroller itself. An IDE comprises all the tools that you might need to successfully program your microcontroller. So, for example, the Arduino IDE is used for programming Arduino boards with AVR-based microcontrollers.

Compiling

In the compiling step, the written code is translated in such a way that the microcontroller can interpret it. A compiler assembles the code in such a way that the microcontroller understands which operations to perform to match the input code. Once this output code is successfully compiled, it’s then ready for uploading.

Uploading

This is where you write the program to the microcontroller’s memory. Most microcontroller boards allow for a USB interface, so you can directly upload the code from your computer. If all goes well, your microcontroller is now ready for the programmed task.

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

Micro Projects

This simple temperature sensor doesn't need much more than a microcontroller
This simple temperature sensor doesn't need much more than a microcontroller (Source: miliohm via YouTube)

Now that we understand what a microcontroller is, we can look at some microcontroller-based applications and projects. You might not even realize how widely used microcontrollers are today. Some very common applications of microcontrollers are automated teller machines (ATMs), calculators, robots, measuring instruments, microwaves, cars, fire systems, and even implantable medical devices.

The list goes on and on. Everywhere you look, anything that you think is controlled electronically, chances are you’re looking at one of the microcontrollers that we’ve looked at today.

Featured image of 45 Cool Arduino Projects
See What's Possible
45 Cool Arduino Projects

Back to Contents

Advertisement
Advertisement
What Is a Microcontroller?

Final Thoughts

Microcontrollers are great for a variety of projects and are relatively easy to program
Microcontrollers are great for a variety of projects and are relatively easy to program (Source: Altium Designer via Arduino Project Hub)

Microcontrollers are one of the revolutionary inventions of the 20th century. Most of the devices that we use today may not have been possible if not for microcontrollers. They’re great for learning to build embedded systems and IoT based devices.

The low cost coupled with the impressive processing power and huge support community means that microcontrollers aren’t going away any time soon. And if you’re just starting out, we’ve got heaps of ideas for your first microcontroller project!

Back to Contents

Advertisement
Advertisement
Advertisement