Microcontroller development boards have become a staple among the maker community. These programmable devices are specifically designed to process input and output signals as a way to control various modules and components like sensors, motors, LEDs, and human input devices (HIDs).

But before that, you'll need to learn a scripting language that the microcontroller can interpret to program these devices. Today's most popular microcontroller languages include MicroPython, CircuitPython, Arduino (simplified C++), and C. Each of these languages has its own pros and cons.

MicroPython

MicroPython logo with snake sitting on a microchip

MicroPython is a lightweight implementation of the Python 3 programming language designed especially for microcontrollers. It was released in 2013 by Dr. Damien George for faster prototyping and to allow people already familiar with Python to program microcontrollers with a similar language.

Features

MicroPython is an excellent scripting language for beginners wanting to program microcontrollers. Newbies with no coding experience will find it easy to read and understand because it uses human-readable commands in simple structures. Furthermore, it uses a read-evaluate-print-loop (REPL) runtime environment, allowing an interactive coding experience.

Performance

To program a microcontroller using MicroPython, firmware containing the interpreter, libraries, and various other dependencies is flashed into the microcontroller. This allows MicroPython code to be interpreted and executed locally by the microcontroller, enabling rapid prototyping as live feedback can be provided while coding.

However, due to how processors execute code, interpreted languages like MicroPython will be significantly slower when compared to compiled languages like C++. So, by default, although prototyping can be much faster, code execution itself is slower.

Compatibility

Since MicroPython uses local resources to interpret and execute programs, a microcontroller must have a minimum of 256kB of flash memory and 16kB of RAM. Unfortunately, some popular development boards like the Arduino Uno do not meet the specs required. However, there are still plenty of boards that are compatible with MicroPython.

Currently, MicroPython officially supports the Pyboard, ESP32, ESP8266, Raspberry Pi Pico, BBC micro:bit, STM32 development boards, and a few Arduino boards such as the Nano 33 BLE, Nano RP2040, Giga R1, and Portenta H7.

Community and Support

Since its launch in 2013, MicroPython has since garnered a sizable following. Beginners should have an easy time learning MicroPython with its well-written documentation. If you need more help, MicroPython also has a community forum where users share tutorials, ideas, and answer all kinds of problems you may have regarding MicroPython.

Arduino

Arduino logo

Arduino is a popular open-source platform primarily aimed at electronics and DIY enthusiasts. The Arduino programming language is based on the C and C++ programming languages. The Arduino language was released in 2005 by a group of engineers, artists, and designers from Italy.

Features

The Arduino programming language uses a stripped-down version of both C and C++, making it easy to learn and develop with. Code execution using Arduino is significantly faster than its interpreted language counterparts due to its compiled nature. Furthermore, Arduino only requires a small amount of system resources to work, making it compatible with many development boards and microcontrollers.

Performance

Unlike MicroPython and CircuitPython, Arduino is a compiled programming language. This means code is first compiled on a compiler (already included in the Arduino IDE) and then executed as a whole program by the microcontroller.

This significantly improves code execution as the microcontroller doesn't have to use resources to interpret each code line. In addition, compiling the program also translates it into machine code which the microcontroller can natively execute without installing dependencies.

This significantly improves code execution speed because the microcontroller can directly execute the program without allocating time and hardware resources to translating the code.

Supported Boards

Since the compiling stage is done through the IDE, microcontrollers can have as little as 32kB of flash memory and 2kB of RAM to work. So aside from Arduino boards, there are many Arduino board alternatives you can use to program with Arduino. Many of these boards would be using microcontrollers like ATmega328P, ATmega2560, SAMx8E, ESP8266, ESP32, and STM32.

Community and Support

Being an open-source platform since 2005, Arduino has some of the best documentation available. The Arduino Foundation is actively providing updates, support, and new exciting products each year. The worldwide community is also one of the most active in sharing guides and ideas and answering any troubleshooting problems you may encounter. With Arduino, you are guaranteed a good level of support.

CircuitPython

CircuitPython logo comprising a coiled snake

CircuitPython is Adafruit's implementation of Python 3, building on top of MicroPython. Although forked from MicroPython, CircuitPython offers several improvements to make learning microcontrollers easy and fun.

Features

CircuitPython was created to help beginners learn how to program microcontrollers. To achieve this, CircuitPython provides several features, including an interactive coding environment, built-in libraries, simple syntax (simpler than MicroPython), and excellent documentation and guides.

Performance

Since CircuitPython is based on MicroPython, it has many of the same strengths and weaknesses. Program run time will be slightly slower than MicroPython since CircuitPython provides more features and extra libraries. However, the difference is likely unnoticeable since CircuitPython requires more capable microcontrollers to work.

Supported Boards

With integrated libraries and even simpler syntax, microcontroller development boards need more resources to use CircuitPython. At a minimum, a microcontroller needs to have an 8-bit processor, 256kB of flash memory (512kB recommended), and 32kB of RAM (64kB recommended). Currently, CircuitPython supports over 390 development boards, listed on the official website.

Community and Support

Adafruit is known to make products that are beginner-friendly. As such, you can find easy-to-understand documentation and books on CircuitPython. Although the language was only introduced in 2017, it still has a bigger following than MicroPython, which you can reach through Discord and the official forum. Like the Arduino Foundation, Adafruit is actively providing updates, support, and new products, which means support should be easy to find.

C

C programming language

C is a general-purpose programming language developed in the 1970s by Dennis Ritchie at Bell Labs. It is a compiled programming language that engineers and other professionals often used to program microcontrollers with high levels of efficiency.

Features

Although a harder language to learn, the main advantage of C over MicroPython, CircuitPython, and Arduino is the level of speed, efficiency, control, and portability it provides. This makes C the best language to program both microcontrollers to be used in finished products.

Performance

Aside from its great portability, C is known for its performance. It can run programs faster than Arduino, MicroPython, and CircuitPython, even with a lower-resource microcontroller. This is because C is a more efficient language, requiring the least dependencies. Although a compiled Arduino program can, like a C one, be run on bare-metal hardware, its machine code comes pre-baked with libraries and tools that reduce performance.

Supported Boards

The C language is so portable that it can be used to program just about any Arm-based microcontroller. In addition, it can be used on boards based on the Atmel AVR, STM32, PIC, and MSP microcontrollers.

Community and Support

Due to its robust programming application and the fact that it's already several decades old, the C programming language has a massive online community. You can easily find help through various online forums, chat rooms, and blogs dedicated to discussing and sharing ideas about the C language.

What Language Should You Program With?

So, what's the best language to program microcontrollers? It really depends on the person. The C language would be the best for professionals designing electronics for production.

Those with no coding experience may well want to start with CircuitPython since it has features and documentation that make learning easy and fun. Those familiar with Python will find it easy to program microcontrollers with MicroPython.

And for the majority of the DIY/maker community, Arduino would still be the best language to program microcontrollers, as it offers an outstanding balance of performance, portability, features, and community.