4. Embedded Programming

This week we learned about embedded systems which are specialized computing systems designed to perform specific functions within larger mechanical or electrical systems. In other words, they are designed for a particular task or set of tasks, and have a limited processing power, memory, and storage.

To run this task we need a microcontroller which is a compact integrated circuit that includes a CPU, memory (both RAM and ROM), and peripherals (like timers, I/O ports, and communication interfaces) all in one chip.

Data sheet comparative

Understanding and comparing the microcontroller datasheets is important because it will help us to select one that adjusts to our project requirements (like GPIO Pins, Operating Voltage, and compatibility). For this exercise I compared the ESP32 and the Raspberry Pi Pico (RP2040) both good microcontrollers for my project

ESP32 series

The ESP32 is a chip that combines Wi-Fi and Bluetooth in one device. It uses low-power technology to work efficiently and reliably. The ESP32 is part of the ESP family of microcontrollers, making it suitable for many different applications.

FeatureESP32RP2040
CPU3.3V power supply3.3V power supply
Power3.3V power supply3.3V power supply
SRAM3.3V power supply3.3V power supply
Flash MemoryEnable pin to power on/off the ESP32No EN pin
Clock speed3.3V power supply3.3V power supply
GPIO Pins5V input voltage5V input voltage
Analog InputsGPIO0 - GPIO39GPIO0 - GPIO29
CommunicationADC1_0 - ADC1_7, ADC2_0 - ADC2_9ADC0 - ADC1_3
LanguagesGPIO for PWMAll GPIOs support PWM
WirelessDAC1, DAC2No DAC pins

First exercise (button and led)

Before doing an exercisie related to my project (pill dispenser), I wanted to do a small warm up on wokwi using an ESP32 to turn on a led with a button and screen printing if the led is on or off. I also compared the same exercise but with different languages (MicroPython and C++)

Wokwi Project Link


Both softwares are pretty good options and choosing one depends on your design. Onshape is a cloud-based and accessible alternative, that is efficient for modeling and collaboration. However, rendering options are limited (can change color but not add textures). While Inventor allows rendering directly inside the software, with ambience lights, materials. But can take a while to rendireze depending of your computer and the quality of the image.

Pill dispenser exercise

Media compression is important while documenting our process. Some media files (images, video, audio) are often large and by compressing it we are not only reducing its size but speeding up the page load times.

For Images I use Xconvert on my phone and, because it allows me to control the compressing parameters and file format, if the images are on my computer I either use the Photos app or share them via phone link to compress them in Xconvert and share them back to my computer.

For videos I use FFMPEG, that works on our computer terminal and has different parameters that we can edit if we write them. Its interface can be confusing but its really practical.

Compressing images with XnConvert


For large batches I prefer XnConvert, even if I need to share them back and forward between my computer (Phone Link is pretty fast and XnConvert has more resize parameters). However for single files on my computer that I need fast, I use the Photos app.

Files

ESP32 Data Sheet Illustrator Onshape Inventor

Copyright 2026 <María José Ballesteros Andraka> - Creative Commons Attribution Non Commercial

Source code hosted at gitlab.fabcloud.org