Microcontrollers are the brains of your project. They are the ones that control everything. They can read sensors, control motors and communicate with other devices. This is the place where you program you project. Microcontrollers come in many shapes and sizes. Here we will discuss the most common ones and which consinderations you should make when choosing one.
Types of microcontrollers
There exist many different types of microcontrollers, but for the purpose of the course we will focus on 3 of the most common “hobby” microcontrollers. These are the Arduino
, ESP8266/ESP32
and Raspberry Pi
. They all have their own strengths and weaknesses and should be used in different situations.
Factors to consider
When choosing a microcontroller there are a few factors you should consinder. These are:
- Processing power: How many calculation do you need to do? Tracking and imaging tasks take more then simple
if this then that
logic. - Hardware Connectivity: How many things do you want to control and sense? This will decide how many
General Purpose Input Output
(GPIO) pins you need. You might also need to consider if you require USB interface or have options to make the controller behave as a keyboard. - Wireless Connectivity: Does you’re project need a wireless connection? Some boards have WiFi build in, whilst others require extra hardware.
- Power Consumption: How long do you want your project to run on a battery? Some microcontrollers are more power efficient then others.
- Programming Language: What programming language do you want to use? Some microcontrollers only support C++, whilst others support Python or even JavaScript.
We can ofcourse allways go for the most powerfull microcontroller, but this will most cases not be sustainable. For a simple light switch you do not need a quad core processor.
Arduino
Arduino is a brand collection of microcontrollers. They have build a large community around their products and have a large collection of libraries and examples. The most common Arduino board is the Arduino Uno
, this is basses around the ATmega328P
microcontroller. This is a great board for simple projects, but can be a bit limited in processing power and memory. These boards also do not have WiFi build in, but you can add this with an extra shield. For the course will we recommand to use other boards, but we will recomand using the Arduino IDE for programming.
ESP8266 and ESP32
This collection of microcontrollers is build by Espressif Systems
. They are known for their WiFi capabilities. The ESP8266
is a great board for simple projects. The ESP32
is the newer and more powerfull version of the ESP8266
. It has more GPIO pins, more processing power and more memory. Both boards can be programmed with the Arduino IDE. The ESP32 also has bluetooth build in. These boards are great for most projects. They are cheap and have a large community.
Both controllers can also be programmed using MicroPython. This is makes programming a lot easier for beginners, however libraries are limited and space is limited.
For most projects you can use the ESP8266, if you need a little more power you can use the ESP32.
Note
The Wemos D1 mini from the starting assignment is a ESP8266 board.
Raspberry Pi
Raspberry Pi is a foundation that creates Single board computers (SBC), and Microcontrollers. Their SBC are the most known. The most common Raspberry Pi board is the Raspberry Pi 5
. This more then a microcontroller, it is a “full” computer which runs linux. So you will only be using this when you need a lot of processing power and more advanced features suchs as image processing.
The Raspberry Pi has a lot of GPIO pins, but they are not as easy to use as the Arduino or ESP boards, because programming is further away from the hardware. The Raspberry Pi also has WiFi and bluetooth build in. The Raspberry Pi can be programmed in Python, but also in other languages as it is just a “normal” computer.
Raspberry Pi Pico
The Raspberry Pi foundation recently also released a microcontroller board. The Raspberry Pi Pico
. It is a great board for simple projects. It is build around the RP2040
microcontroller. This board is great for simple projects. At the lab we have the Raspberry Pi Pico W
varient which also has WiFi build in. This board can be programmed with the Arduino IDE, but we recomand using Thonny for MicroPython.
Picking the correct microcontroller
When picking a microcontroller you should consinder the factors mentioned above. For most projects the ESP8266
is fine, need bluetooth or more pins the the ESP32
will be the best choice. Both are cheap, have WiFi build in and have a large community.
If you want to use MicroPython we recommand using the Raspberry Pi Pico
.
If you need alot more processing power you can use the Raspberry Pi 3/4/5
. They are a lot more expensive, and possible in low supply.
Do you need a controller that can emulate a keystrokes or mouse? Then you can use the Arduino Leonardo
or Arduino Teensy
.
If you need many microcontrollers that all do a simple tasks for example in a stacking project you can use the ATtiny85
. This is a very small microcontroller with only 8 pins, it is very cheap and can be programmed with the Arduino IDE. But does require a bit more knowledge.