Introduction

As part of the Fab Opportunity AcademyWeek 2 focused on the fundamentals of Embedded Systems and Embedded Programming, exploring how hardware and software work together in modern electronic devices.

During this week, I learned the difference between microcontrollers and microprocessors, studied various microcontroller families, and explored their applications. I also installed and configured Thonny and learned the basics of programming microcontroller boards using both Arduino IDE and Thonny. In addition, I gained an understanding of binary and hexadecimal number systems, which are essential for embedded programming.

Overall, this week provided me with a solid foundation in embedded systems and the basic programming concepts required for developing embedded applications.

What is an Embedded System?

I learned that an embedded system is a small computer built inside a device to perform a specific task. It combines hardware (such as a microcontroller, sensors, and other electronic components) with software (programs) to control the device. Unlike a regular computer, an embedded system is designed to do one particular job efficiently, such as controlling a washing machine, traffic signal, microwave oven, or smart home device. During this week, I understood how embedded systems use a microcontroller to receive inputs, process information, and produce outputs.

What is an Embedded Programming

I learned that embedded programming is the process of writing code for a microcontroller to control how an embedded system works. It helps the microcontroller read inputs from sensors or buttons, process the information, and control outputs such as LEDs, motors, or displays.

During this week, I learned the basics of embedded programming using Arduino IDE and Thonny . I also understood how to write, upload, and test programs on a microcontroller board, making the hardware perform specific tasks. Embedded programming is an important part of developing smart electronic devices.

Microcontroller (MCU)

microcontroller is a tiny computer on a single chip that controls electronic devices. It has a processor (CPU), memory, and input/output connections built into one small piece of silicon

Microprocessor (MPU)

microprocessor is a small electronic chip that acts as the brain of a computer. It contains the CPU (Central Processing Unit), which performs calculations, makes decisions, and runs instructions from software

Microcontroller vs Microprocessor

FeatureMicrocontrollerMicroprocessor
DefinitionA small computer on a single chip used to control specific tasksA CPU chip designed to perform general-purpose computing tasks
Main ComponentsCPU + RAM + ROM/Flash + Input/Output ports on one chipMainly CPU; requires external RAM, storage, and input/output devices
PurposeDesigned for dedicated applicationsDesigned for running multiple applications
Processing PowerLower processing powerHigher processing power
Power ConsumptionUses very little powerUses more power
CostCheaperMore expensive
SizeSmallerLarger system because extra components are needed
MemoryBuilt-in memory availableUsually needs external memory
Operating SystemUsually runs without an OS or with a small real-time OSRuns full operating systems like Windows, Linux, or macOS
SpeedModerate speedHigher speed
ApplicationsWashing machines, robots, toys, smart sensors, remote controlsLaptops, desktops, servers, smartphones
ExamplesArduino (ATmega chips), STM32, PIC, ESP32Intel Core processors, AMD Ryzen, Apple M-series

Microcontroller Families

Microcontroller FamilySimple DescriptionMain FeaturesCommon Uses
AVRA beginner-friendly microcontroller family8-bit, easy programming, low costArduino boards, small robots
PICA flexible and reliable family made by MicrochipMany sizes, low cost, many built-in featuresIndustrial control, appliances, embedded systems
ARMA powerful processor family used in modern devices32-bit/64-bit, high speed, efficientSmartphones, IoT, advanced embedded systems
8051One of the oldest microcontroller familiesSimple 8-bit design, easy to understandEducation, basic control systems
MSP430A low-power microcontroller familyVery low energy use, 16-bitBattery-powered devices, sensors
STM32A popular ARM-based microcontroller family by STMicroelectronics32-bit, fast, many peripheralsIndustrial devices, drones, IoT, robotics
ESP SeriesWi-Fi/Bluetooth-enabled microcontrollers by Espressif SystemsBuilt-in wireless communication, low costSmart home, IoT devices, connected gadgets
RP SeriesMicrocontroller family by Raspberry Pi Foundation (example: RP2040)Dual-core ARM Cortex-M, programmable I/ODIY electronics, education, embedded projects

Group Assignment

As a group, We Studied the microcontroller datasheet to understand its pin configuration, GPIO functions, memory, communication interfaces, and electrical characteristics.we explored and compared the development workflows of different embedded platforms, including Arduino Uno, ESP32-WROOM, ESP32-C3, Seeed XIAO RP2040 and Raspberry Pi Pico. We evaluated the software environments, programming languages, board setup procedures, code compilation, firmware uploading for each platform.

Comparison between Micro-controllers

ParametersArduino UnoESP32 WROOMSeeed Studio XIAO ESP32-C3Seeed Studio XIAO RP2040Raspberry Pi Pico
MicrocontrollerATmega328PESP32-D0WDESP32-C3RP2040RP2040
Core8-bit AVRDual-core Xtensa LX6Single-core RISC-VDual-core ARM Cortex-M0+Dual-core ARM Cortex-M0+
ArchitectureAVR 8-bit32-bit32-bit RISC-V32-bit ARM32-bit ARM
Clock Speed16 MHz240 MHz160 MHz133 MHz133 MHz
Operating Voltage5V3.3V3.3V3.3V3.3V
GPIO Voltage5V3.3V3.3V3.3V3.3V
Digital GPIO14 pins34 pins11 pins11 pins26 pins
PWM6 pins16 channels6 channels16 channels16 channels
Analog Input6 channels (10-bit ADC)18 channels (12-bit ADC)4 channels (12-bit ADC)4 channels (12-bit ADC)3 ADC channels
CommunicationUART, SPI, I2CUART, SPI, I2C, CANUART, SPI, I2CUART, SPI, I2CUART, SPI, I2C
WiFiNoYesYesNoNo
BluetoothNoYesYes (BLE)NoNo
Programming LanguageC/C++, Arduino IDEC/C++, MicroPython, Arduino IDEC/C++, MicroPython, Arduino IDEC/C++, MicroPythonC/C++, MicroPython
On-board LED PinPin 13GPIO 2GPIO 10GPIO 25GPIO 25
Flash Memory32 KB4 MB4 MB2 MB2 MB
RAM2 KB520 KB400 KB264 KB264 KB
USB InterfaceUSB-BMicro USBUSB-CUSB-CMicro USB

Components and development workflow

ParameterArduino UnoESP32-WROOMSeeed Studio XIAO ESP32-C3Seeed Studio XIAO ESP32 RP2040Raspberry Pi Pico
CompilerAVR-GCCXtensa GCC / ESP-IDF GCCRISC-V GCCARM GCCARM GCC
Uploader Toolavrdudeesptool.pyesptool.pyUF2 bootloader / drag-and-drop USBUF2 bootloader / drag-and-drop USB
Firmware FormatHEX (.hex)Binary (.bin)Binary (.bin)UF2 (.uf2), BINUF2 (.uf2), BIN
Connection TypeUSB-to-Serial (ATmega16U2), UART, SPI, I²CWi-Fi, Bluetooth, UART, SPI, I²C, USB-UARTWi-Fi, Bluetooth LE, USB, UART, SPI, I²CUSB, UART, SPI, I²CUSB, UART, SPI, I²C
Wireless CapabilityNone (requires external module)Wi-Fi + BluetoothWi-Fi + Bluetooth LENone built-inNone built-in
Operating System SupportBare-metal / simple schedulerFreeRTOS, Bare-metalFreeRTOS, Bare-metalBare-metal, MicroPython runtimeBare-metal, MicroPython runtime

Conclusion

Arduino Uno: Best for beginners and basic electronics projects.

ESP32 WROOM: Best for IoT applications requiring WiFi and Bluetooth.

XIAO ESP32-C3: Best for compact IoT and low-power projects.

XIAO RP2040: Best for small embedded systems and wearable applications.

Raspberry Pi Pico: Best for learning embedded programming and advanced microcontroller projects.

Overall, we understood that the best board depends on the needs of the project, such as speed, connectivity, size, and power consumption.

Microcontrollers & their datasheets overview

1.Arduino UNO

Arduino Uno is a microcontroller board based on the ATmega328P. It is used to control electronic devices such as LEDs, motors, sensors, and buzzers. It can be programmed using the Arduino IDE through a USB cable. Arduino Uno is widely used for learning electronics, robotics, and automation projects because it is simple, low-cost, and easy to use.

Arduino UNO Datasheet

Embedded programming with Arduino UNO

Installation of Arduino IDE

Step 1-First, I google Download Arduino IDE For Windows.Then I Go to the Arduino official website.

Step 2- I Choose computer’s operating system (Windows).Download the Arduino IDE file.

Step 3- Install the setup by clicking Next and Install.

Arduino IDE is downloaded from the Arduino website and installed on the computer to write and upload programs to the Arduino board.

Binary Number System

The binary number system is a base-2 number system that uses only the two digits 0 and 1.It is the language that computers and microcontrollers use to process and store data.

In binary:

  • 0 means OFF or Low.
  • 1 means ON or High.

Example

  • Decimal 0 = Binary 0
  • Decimal 1 = Binary
  • Decimal 3 = Binary 11
  • Decimal 4 = Binary 100
PowerValue
2⁰1
2
4
8
2⁴16
2⁵32
2⁶64
2⁷128
2⁸256
2⁹512
2¹⁰1024
2¹¹2048
2¹²4096

Real-Life Examples

  • Light Switch
    • 0 = Light OFF
    • 1 = Light ON
  • LED
    • 0 = LED OFF
    • 1 = LED ON

1. Decimal to Binary

Method: Divide the decimal number by 2 repeatedly and write the remainders. Read the remainders from bottom to top.

Example: Convert 13 to binary.

DivisionRemainder
13 ÷ 2 = 61
6 ÷ 2 = 30
3 ÷ 2 = 11
1 ÷ 2 = 01

Read the remainders from bottom to top:

13₁₀ = 1101₂

  • 13₁₀ means 13 in the decimal (base-10) number system.
  • 1101₂ means 1101 in the binary (base-2) number system.

2. Binary to Decimal

Method: Multiply each binary digit by its corresponding power of 2 and add the results.

Example: Convert 1101 to decimal.

Binary1101
Power of 22⁰
Value8421

Calculation:

(1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 13

1101₂ = 13₁₀

  • 1101₂ is the number 1101 in the binary (base-2) number system.
  • 13₁₀ is the number 13 in the decimal (base-10) number system

Short Summary

  • Decimal → Binary: Divide by 2, write the remainders, and read them from bottom to top.
  • Binary → Decimal: Multiply each binary digit by its power of 2 and add the values.

Hexadecimal Number System

Hexadecimal is commonly used in computers, programming, and digital electronics because it provides a shorter way to represent binary numbers.The hexadecimal number system is a base-16 number system. It uses 16 symbols to represent numbers:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Here:

  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15

Example

1.Hexadecimal to Decimal

Convert 2F₁₆ to decimal:

Hex digits: 2 and F
(F = 15)

= (2 *16^1) + (15 *16^0)
= (2*16) + (15*1)
= 32 + 15 = 47

Answer: 2F₁₆ = 47₁₀


2.Decimal to Hexadecimal

Convert 255₁₀ to hex:

Divide by 16:
=255 \div 16 = 15 remainder 15

15 in hex is F.

Answer: 255₁₀ = FF₁₆

PowerValue
16⁰1
16¹16
16²256
16³4,096
16⁴65,536
16⁵1,048,576
PrefixNumber SystemBaseExample
0bBinary20b1010 = 10 (decimal)
0xHexadecimal160xA = 10 (decimal)

Binary & Hexadecimal coding in Arduino UNO

2.ESP32-Wroom

ESP32-WROOM is a powerful microcontroller module developed by Espressif Systems. It has built-in Wi-Fi and Bluetooth connectivity, making it ideal for Internet of Things (IoT) and wireless communication projects. The module is based on a 32-bit dual-core processor, offers low power consumption, and includes multiple GPIO pins for connecting sensors, motors, LEDs, and other electronic devices. It can be programmed using the Arduino IDE, ESP-IDF, or MicroPython. ESP32-WROOM is widely used in smart home automation, robotics, weather monitoring, industrial automation, and other embedded system applications because of its high performance, reliability, and ease of use.

Pinout of ESP32-Wroom

Installation of Thonny

Step 1-First,I opened a web browser and searched for Thonny download for windows

Step 2-I opened the official Thonny website.Then I clicked the Download for Windows button.

Step 3- Thonny is install successfully,Then I set the interpreter and port Finally, the installation was completed, and Thonny IDE was ready to use for programming the microcontroller board using MicroPython.

Embedded programming in ESP32-Wroom

Interpreter settings in Thonny configured for an ESP32 board. The interpreter is set to MicroPython (ESP32), and the board is connected to the port COM14. The selected variant is Espressif – ESP32/WROOM.This configuration allows Thonny to communicate with the ESP32.

The installation process is in progress, with the firmware being written to the ESP32 board. Once the installation is complete, the ESP32 is ready to run MicroPython programs through Thonny IDE.

MicroPython Code to Blink the Onboard LED

from machine import Pinfrom time import sleepled = Pin(2, Pin.OUT)   # Onboard LED (GPIO 2)while True:    led.on()            # Turn LED ON    sleep(1)            # Wait for 1 second    led.off()           # Turn LED OFF    sleep(1)            # Wait for 1 second

3.XIAO ESP32 C3

XIAO ESP32-C3 is a compact and low-power microcontroller board developed by Seeed Studio. It is based on the ESP32-C3 chip, which features a 32-bit single-core RISC-V processor with built-in Wi-Fi and Bluetooth Low Energy (BLE). Despite its small size, it provides multiple GPIO pins, ADC, PWM, UART, I²C, and SPI interfaces for connecting sensors and other electronic devices. It can be programmed using the Arduino IDEESP-IDF, or MicroPython. The XIAO ESP32-C3 is widely used in IoT, smart home automation, wireless sensor networks, wearable devices, and embedded system projects because of its compact design, low power consumption, and reliable wireless connectivity.

Pinout of XIAO ESP32 C3

4.XIAO RP2040

XIAO RP2040 is a compact and powerful microcontroller board developed by Seeed Studio. It is based on the RP2040 microcontroller from the Raspberry Pi Foundation, featuring a dual-core ARM Cortex-M0+ processor. Despite its small size, it provides multiple GPIO pins, analog inputs, PWM, I²C, SPI, and UART communication interfaces. It can be programmed using the Arduino IDEMicroPython, or C/C++. The XIAO RP2040 is widely used in IoT devices, wearable electronics, robotics, embedded systems, and DIY projects because of its compact design, low power consumption, and high performance.

Pinout of XIAO RP2040

Embedded programming with XIAO RP2040 (Blinking RGB Led)

1.First i open Arduino IDE

2.Then go to file tool choose preferances paste the link

Board Manager URL for the Arduino IDE

3.Then i open Tools → Board → Boards Manager. Searched RP2040. Install Raspberry Pi Pico/RP2040 (Earle Philhower)Seeed XIAO RP2040.Then i select correct COM port

4.Then i Go to Sketch → Include Library → Manage Libraries.

5.Searched Adafruit NeoPixel.Click Install.This library is used to control the onboard NeoPixel RGB LED.

6.Very & Compile the code to the XIAO RP2040.Then I Open Serial Monitor
The program waits for a color name from the Serial Monitor and changes the onboard NeoPixel to that color

7.Type a supported color and press Enter.

Code

#include <Adafruit_NeoPixel.h>#define NEOPIXEL_POWER 11#define NEOPIXEL_PIN   12#define NUMPIXELS      1Adafruit_NeoPixel pixel(NUMPIXELS, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);void setup() {  Serial.begin(115200);  // Enable power to the onboard NeoPixel  pinMode(NEOPIXEL_POWER, OUTPUT);  digitalWrite(NEOPIXEL_POWER, HIGH);  pixel.begin();  pixel.clear();  pixel.show();  Serial.println("=====================================");  Serial.println(" XIAO RP2040 NeoPixel Color Control ");  Serial.println("=====================================");  Serial.println("Type one of these colors:");  Serial.println("red");  Serial.println("green");  Serial.println("blue");  Serial.println("orange");  Serial.println("gold");  Serial.println("lime");  Serial.println("purple");  Serial.println("violet");  Serial.println("pink");  Serial.println("brown");  Serial.println("white");  Serial.println("off");  Serial.println("-------------------------------------");}void loop() {  if (Serial.available()) {    String color = Serial.readStringUntil('\n');    color.trim();    color.toLowerCase();    if (color == "red") {      pixel.setPixelColor(0, pixel.Color(255, 0, 0));    }    else if (color == "green") {      pixel.setPixelColor(0, pixel.Color(0, 255, 0));    }    else if (color == "blue") {      pixel.setPixelColor(0, pixel.Color(0, 0, 255));    }    else if (color == "orange") {      pixel.setPixelColor(0, pixel.Color(255, 165, 0));    }    else if (color == "gold") {      pixel.setPixelColor(0, pixel.Color(255, 215, 0));    }    else if (color == "lime") {      pixel.setPixelColor(0, pixel.Color(50, 205, 50));    }    else if (color == "purple") {      pixel.setPixelColor(0, pixel.Color(128, 0, 128));    }    else if (color == "violet") {      pixel.setPixelColor(0, pixel.Color(148, 0, 211));    }    else if (color == "pink") {      pixel.setPixelColor(0, pixel.Color(255, 105, 180));    }    else if (color == "brown") {      pixel.setPixelColor(0, pixel.Color(165, 42, 42));    }    else if (color == "white") {      pixel.setPixelColor(0, pixel.Color(255, 255, 255));    }    else if (color == "off") {      pixel.clear();    }    else {      Serial.println("Unknown color!");      Serial.println("Available colors:");      Serial.println("red, green, blue, orange, gold, lime, purple, violet, pink, brown, white, off");      return;    }    pixel.show();    Serial.print("LED Color: ");    Serial.println(color);  }}

5.Raspberry Pi pico

Raspberry Pi Pico is a low-cost and high-performance microcontroller board developed by the Raspberry Pi Foundation. It is based on the RP2040 microcontroller, which features a dual-core ARM Cortex-M0+ processor. The board has multiple GPIO pins that allow it to connect to sensors, LEDs, motors, and other electronic components. It can be programmed using MicroPythonC/C++, or the Arduino IDE. Raspberry Pi Pico is widely used in embedded systems, robotics, home automation, IoT projects, and educational applications because it is affordable, easy to program, and offers excellent performance with low power consumption.

Pinout of Raspberry Pi Pico

Embedded programming with Raspberry Pi Pico

Blinking one external LED using a Raspberry Pi Pico

First, I soldered the header pins onto the Raspberry Pi Pico so that it could be connected securely to a breadboard and other electronic components. Next, I connected the Raspberry Pi Pico to my computer using a USB cable.

1.Placed the Raspberry Pi Pico on a breadboard.

2.Connected the anode (positive terminal) of the LED to GPIO 15 through a 220 Ω resistor.

3.Connected the cathode (negative terminal) of the LED to the GND pin of the Raspberry Pi Pico.

4.Connected the Raspberry Pi Pico to the computer using a USB cable.

5.Opened the Arduino IDE.

6.Selected Raspberry Pi Pico as the board from the Tools → Board menu.

7.Selected the correct COM port from the Tools → Port menu.

8.Wrote the LED blink program in the Arduino IDE.

9.Clicked the Upload button to compile and upload the program to the Raspberry Pi Pico.

10.Observed that the LED connected to GPIO 15 blinked continuously with a one-second delay.

// LED Blink Program (LED connected to Pin 15)const int ledPin = 15;void setup() {  pinMode(ledPin, OUTPUT);   // Set pin 15 as output}void loop() {  digitalWrite(ledPin, HIGH); // Turn LED ON  delay(100);                // Wait for 1 second  digitalWrite(ledPin, LOW);  // Turn LED OFF  delay(100);                // Wait for 1 second}