Introduction
This week, I learned more about embedded programming by working with different microcontrollers. I completed both group and individual assignments that helped me understand how embedded systems are designed and programmed. In the group activity, I explored different development tools and workflows used for embedded systems. For my individual assignment, I studied a microcontroller datasheet, wrote an embedded program, and tested it with input and output devices. These activities improved my practical skills and gave me a better understanding of how embedded systems work.

Embedded Programming
Embedded programming is the process of writing code for a microcontroller or embedded system to perform a specific task. It allows the hardware to interact with components such as sensors, LEDs, motors, and displays. Embedded programming is used in many everyday devices, including home appliances, cars, medical equipment, and IoT devices, to make them work efficiently and automatically.
Embedded Systems


Embedded systems are widely used in everyday life and across many industries. Common applications include home appliances (such as washing machines, microwave ovens, and refrigerators), automotive systems (such as engine control units, airbag systems, and anti-lock braking systems), medical devices (such as patient monitors and infusion pumps), industrial automation, consumer electronics, telecommunication equipment, and Internet of Things (IoT) devices. These systems improve automation, accuracy, safety, and overall efficiency.
In simple terms, an embedded system is a small, dedicated computer integrated into a larger device to control its operation and perform a specific task accurately, efficiently, and reliably.
Individual assignment
Task
Browse through the data sheet for a microcontroller.
write and test a program for an embedded system using a microcontroller to interact (with input &/or output devices)
Group assignment
Task
Comparison of Toolchains and Development Workflows for Embedded Systems
Camparison of Microcontroller boards
| Comparison Point | Arduino Uno | XIAO ESP32-C3 | XIAO RP2040 | Raspberry Pi Pico (2020) | ESP32 Development Board |
|---|---|---|---|---|---|
| 1. Manufacturer | Arduino | Seeed Studio | Seeed Studio | Raspberry Pi Foundation | Espressif Systems |
| 2. Microcontroller | ATmega328P | ESP32-C3 | RP2040 | RP2040 | ESP32 |
| 3. Processor Type | 8-bit AVR | 32-bit RISC-V | Dual-core ARM Cortex-M0+ | Dual-core ARM Cortex-M0+ | Dual-core Xtensa LX6 |
| 4. Clock Speed | 16 MHz | 160 MHz | 133 MHz | 133 MHz | 240 MHz |
| 5. Number of Cores | 1 | 1 | 2 | 2 | 2 |
| 6. Flash Memory | 32 KB | 4 MB | 2 MB | 2 MB | 4 MB |
| 7. SRAM | 2 KB | 400 KB | 264 KB | 264 KB | 520 KB |
| 8. GPIO Pins | 14 Digital | 11 GPIO | 11 GPIO | 26 GPIO | Up to 34 GPIO |
| 9. Analog Inputs | 6 | 4 | 4 | 3 | Up to 18 |
| 10. Wi-Fi | No | Yes | No | No | Yes |
| 11. Bluetooth | No | BLE | No | No | Bluetooth + BLE |
| 12. Operating Voltage | 5 V | 3.3 V | 3.3 V | 3.3 V | 3.3 V |
| 13. Board Size | Large | Very Small | Very Small | Medium | Medium |
| 14. Power Consumption | Moderate | Very Low | Low | Low | Moderate |
| 15. Best Applications | Learning, basic projects | IoT, wearable devices | Robotics, automation | Education, prototyping | IoT, smart home, industrial projects |
| 16. Main Advantage | Easy to use | Wireless and compact | Fast dual-core processor | Affordable with many GPIO pins | High performance with wireless connectivity |
Development Workflow Comparison
| Feature | Arduino Uno | XIAO ESP32-C3 | XIAO RP2040 | Raspberry Pi Pico (2020) | ESP32 Development Board |
|---|---|---|---|---|---|
| 1. Architecture | 8-bit AVR | 32-bit RISC-V | 32-bit ARM Cortex-M0+ | 32-bit ARM Cortex-M0+ | 32-bit Xtensa LX6 |
| 2. Programming Language | C/C++ | C/C++, MicroPython | C/C++, MicroPython | C/C++, MicroPython | C/C++, MicroPython |
| 3. Main IDE | Arduino IDE | Arduino IDE | Arduino IDE | Arduino IDE | Arduino IDE |
| 4. Compiler | AVR-GCC | RISC-V GCC | ARM GCC | ARM GCC | Xtensa GCC |
| 5. Upload Tool | Arduino Bootloader | esptool.py | UF2 Bootloader | UF2 Bootloader | esptool.py |
| 6. Firmware Format | HEX | BIN | UF2 / BIN | UF2 | BIN |
| 7. Connection Type | USB Type-B | USB Type-C | USB Type-C | Micro-USB | Micro-USB or USB Type-C (depends on board) |
| 8. Flash Method | USB Bootloader | USB Serial Flash | Drag-and-Drop (UF2) | Drag-and-Drop (UF2) | USB Serial Fl |
Development Workflow
Arduino IDE Workflow
- Write the program in Arduino IDE.
- Select the target board and COM port.
- Compile (verify) the program.
- Upload the program to the microcontroller via USB.
- The microcontroller executes the uploaded program.
MicroPython Workflow
- Install the MicroPython firmware on the supported board.
- Open Thonny IDE and connect the board.
- Write the Python program.
- Save/upload the program to the microcontroller.
- The program runs immediately, and the output can be viewed in the Thonny Shell.
Comparison Summary
Development Workflow
- Arduino Uno is programmed using the AVR-GCC compiler and mainly uses the C/C++ programming language.
- ESP32 and Seeed Studio XIAO ESP32-C3 support programming in both C/C++ and MicroPython, giving developers more flexibility.
- The Arduino IDE is widely used for writing code, compiling programs, and uploading firmware to the development boards.
- Thonny IDE is a simple and lightweight environment commonly used for MicroPython development.
- MicroPython is easy to understand, making it a good choice for beginners and rapid prototyping.
- C/C++ offers higher performance, faster execution, and direct access to hardware resources, making it suitable for advanced embedded applications.
Conclusion
Based on the comparison, the Arduino Uno is the best choice for beginners because of its simple architecture, ease of programming, and strong community support. The ESP32 Development Board and XIAO ESP32-C3 are more suitable for IoT and wireless applications, as they offer built-in Wi-Fi, Bluetooth, and higher processing performance. The XIAO ESP32-C3, with its modern RISC-V architecture, delivers efficient performance while maintaining low power consumption. The XIAO RP2040 and Raspberry Pi Pico provide fast dual-core processing, making them well suited for robotics, automation, and real-time embedded applications. In terms of software development, MicroPython is easier to learn and enables rapid prototyping, whereas C/C++ offers better execution speed, efficient memory usage, and greater control over hardware, making it ideal for high-performance embedded systems.
What is microcontroller
A microcontroller (MCU) is a small computer built on a single integrated circuit (IC). It combines a Central Processing Unit (CPU), memory (Flash and RAM), and input/output (I/O) peripherals on one chip. A microcontroller is designed to perform specific tasks in embedded systems, such as reading sensor data, controlling LEDs, motors, displays, and communicating with other electronic devices.
Examples: ATmega328P (Arduino Uno), ESP32, RP2040.
What is microprocessor
A microprocessor (MPU) is the Central Processing Unit (CPU) of a computer. Unlike a microcontroller, it does not include built-in memory or I/O peripherals. It requires external components such as RAM, ROM/Flash, storage, and input/output devices to function. Microprocessors are designed for high-performance computing and are capable of running operating systems such as Windows, Linux, and Android.
Examples: Intel Core i5/i7, AMD Ryzen, ARM Cortex-A processors.
Difference between microcontroller and microprocessor
| Feature | Microcontroller (MCU) | Microprocessor (MPU) |
|---|---|---|
| Definition | A complete computer on a single chip. | A CPU that requires external memory and peripherals. |
| Components | CPU, Flash memory, RAM, and I/O peripherals are integrated on one chip. | Contains only the CPU; external RAM, storage, and I/O devices are required. |
| Purpose | Designed for specific embedded applications. | Designed for general-purpose computing. |
| Memory | Built-in Flash and RAM. | Uses external RAM and storage. |
| Power Consumption | Low power consumption. | Higher power consumption. |
| Performance | Suitable for dedicated control tasks. | High performance for complex applications. |
| Operating System | Usually runs without a full operating system or uses a lightweight RTOS. | Runs full operating systems such as Windows, Linux, or Android. |
| Applications | Home appliances, IoT devices, robots, automotive systems, and medical equipment. | Computers, laptops, servers, smartphones, and tablets. |
| Cost | Lower cost. | Higher cost. |
| Examples | ATmega328P, ESP32, RP2040 | Intel Core, AMD Ryzen, ARM Cortex- |
Microcontrollers and their Datasheets overview
1.Arduino UNO

The Arduino UNO is one of the most popular open-source microcontroller development boards. It is based on the ATmega328P microcontroller and is widely used for learning electronics, embedded systems, robotics, and IoT projects.
- Microcontroller: ATmega328P
- Operating Voltage: 5 V
- Clock Frequency: 16 MHz crystal oscillator
- Digital I/O Pins: 14 (6 support PWM output)
- Analog Input Pins: 6 (A0–A5) with 10-bit ADC resolution
- Memory: 32 KB Flash, 2 KB SRAM, and 1 KB EEPROM
- USB Connectivity: Used for programming the board and providing power
- Built-in LED: Connected to digital pin 13 for testing and debugging
- Power Supply Options: USB cable or external DC supply (recommended 7–12 V)
- Applications: Suitable for robotics, embedded systems, home automation, IoT, and educational projects
Embedded programming with Arduino


First , I searched Download and Install Arduino IDE. Then I install the Arduino IDE version.

Once the Arduino IDE was installed, I opened it and selected the Arduino Uno board along with the correct communication port. Then, I wrote the program, verified it, and uploaded it to the Arduino Uno board.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
The program code is shown .
Binary number system
A binary number system is a number system that uses only two digits, 0 and 1, to represent all numbers. It is called binary because it is based on 2 and is widely used in computers and digital devices.
binary address
A binary address is a memory address written in the binary number system using only the digits 0 and 1. It is used by computers to identify the exact location of data or instructions stored in memory. Each memory location has a unique binary address, allowing the processor to quickly find, read, or write information. Since computers operate internally using binary signals, memory addresses are naturally represented in binary form for efficient processing.


const byte ledPin = 0b00000010; // Binary for decimal 2 (D2)
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, 0b1); // ON
delay(1000);
digitalWrite(ledPin, 0b0); // OFF
delay(1000);
}
The program code written in binary number is shown .
Hexadecimal number system
A hexadecimal number system is a number system with base 16. It uses 16 symbols to represent numbers: 0–9 and A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. Hexadecimal is widely used in computers because it provides a shorter and easier way to represent binary numbers. One hexadecimal digit is equivalent to 4 binary bits, making it convenient for programming, memory addresses, and digital systems.
Hexadecimal address
A hexadecimal address is a memory location represented using the base-16 number system, which uses the digits 0–9 and the letters A–F. It is commonly used in computers because it is shorter and easier to read than binary numbers. Programmers use hexadecimal addresses to identify memory locations, debug programs, and work with computer hardware.


Here is the hexadecimal address code Here is the hexadecimal address code is shown below.
const byte ledPin = 0x02; // Hexadecimal for D2
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, 0x1); // HIGH (ON)
delay(1000);
digitalWrite(ledPin, 0x0); // LOW (OFF)
delay(1000);
}
The program code written in hexadecimal is shown .
2.XIAO RP2040

The Seeed Studio XIAO RP2040 is a small and powerful microcontroller development board based on the Raspberry Pi RP2040 chip. It has a dual-core ARM Cortex-M0+ processor that runs at up to 133 MHz, along with 264 KB of SRAM and 2 MB of flash memory. The board supports communication protocols such as UART, SPI, and I²C, making it easy to connect sensors and other electronic devices. It also features a USB Type-C port for programming and power. The XIAO RP2040 can be programmed using the Arduino IDE, MicroPython, or C/C++. Due to its compact size, good performance, and low power consumption, it is widely used in IoT projects, robotics, automation, and embedded system applications.
- Based on the RP2040 microcontroller developed by the Raspberry Pi Foundation.
- Operates at an operating voltage of 3.3 V.
- Powered by a dual-core ARM Cortex-M0+ processor with a clock speed of up to 133 MHz.
- Includes 264 KB SRAM for fast data processing and efficient performance.
- Provides 2 MB of onboard flash memory to store programs and user data.
- Equipped with a USB Type-C connector for programming and power supply.
- Features 11 GPIO (General Purpose Input/Output) pins for connecting external devices.
- Supports ADC, PWM, UART, SPI, and I²C communication interfaces.
- Includes Reset and Boot buttons for programming and troubleshooting.
- Suitable for applications such as IoT, robotics, automation, embedded systems.
Onboard Led Blinking using XIAO RP 2040.

Code:
#include <Adafruit_NeoPixel.h>
#define LED_POWER 11 // Enable power to the RGB LED
#define LED_PIN 12 // Data pin for the WS2812 RGB LED
#define NUMPIXELS 1
Adafruit_NeoPixel rgb(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(LED_POWER, OUTPUT);
digitalWrite(LED_POWER, HIGH); // Turn ON power to RGB LED
rgb.begin();
rgb.clear();
rgb.show();
Serial.begin(115200);
while (!Serial);
Serial.println("===== XIAO RP2040 RGB Control =====");
Serial.println("Commands:");
Serial.println("red");
Serial.println("green");
Serial.println("blue");
Serial.println("yellow");
Serial.println("cyan");
Serial.println("purple");
Serial.println("white");
Serial.println("off");
}
void loop() {
if (Serial.available()) {
String cmd = Serial.readStringUntil('\n');
cmd.trim();
if (cmd == "red")
rgb.setPixelColor(0, rgb.Color(255, 0, 0));
else if (cmd == "green")
rgb.setPixelColor(0, rgb.Color(0, 255, 0));
else if (cmd == "blue")
rgb.setPixelColor(0, rgb.Color(0, 0, 255));
else if (cmd == "yellow")
rgb.setPixelColor(0, rgb.Color(255, 255, 0));
else if (cmd == "cyan")
rgb.setPixelColor(0, rgb.Color(0, 255, 255));
else if (cmd == "purple")
rgb.setPixelColor(0, rgb.Color(255, 0, 255));
else if (cmd == "white")
rgb.setPixelColor(0, rgb.Color(255, 255, 255));
else if (cmd == "off")
rgb.setPixelColor(0, rgb.Color(0, 0, 0));
rgb.show();
}
}
This project controls the onboard RGB LED of the Seeed Studio XIAO RP2040 using the Arduino IDE and the Serial Monitor. After uploading the code, the board waits for a command . When I type a colour name such as red, green, blue, yellow, cyan, purple, or white in the Serial Monitor and press Enter, the LED changes to that colour. If I type off, the LED turns off. This project helps us learn how to use serial communication and control an RGB LED with Arduino.
3.Micropython on ESP32

The ESP32-WROOM-32 is a powerful Wi-Fi and Bluetooth-enabled microcontroller module developed by Espressif Systems. It is based on a dual-core Tensilica Xtensa LX6 processor that can run at up to 240 MHz. The module includes built-in Wi-Fi and Bluetooth (Classic and BLE), making it ideal for Internet of Things (IoT) applications. It supports multiple communication interfaces such as GPIO, ADC, DAC, PWM, UART, SPI, and I²C, allowing it to connect with various sensors and peripherals. The ESP32-WROOM-32 is widely used in smart home systems, robotics, wireless communication, automation, and embedded system projects due to its high performance, low power consumption, and versatile features.
- Based on the ESP32 microcontroller developed by Espressif Systems.
- Operates at an operating voltage of 3.3 V.
- Features built-in Wi-Fi and Bluetooth connectivity for wireless communication.
- Powered by a dual-core processor with a clock speed of up to 240 MHz.
- Includes a USB Type-C connector for programming and power supply.
- Provides multiple GPIO pins for digital input and output operations.
- Supports communication interfaces such as ADC, DAC, PWM, UART, SPI, and I²C.
- Suitable for IoT, robotics, home automation, and embedded system applications.
Installation of Thonny:-

I searched for the Thonny download for Windows.

I opened the official Thonny IDE website and This website provides installers for Windows, Mac, and Linux. Click on window .

Then, I run the installer and follow the steps to install Thonny on my system.

Once the installation was complete, I opened Thonny IDE and started writing and uploading MicroPython programs to the microcontroller board.
Here is how I use esp32 and try onboard LED blinking and external LED blinking using micropython
Onboard LED Blinking
Code:
from machine import Pin
from time import sleep
led = Pin(2, Pin.OUT)
while True:
led.on() # Turn ON the onboard LED
sleep(1)
led.off() # Turn OFF the onboard LED
sleep(1)

I used the simple LED blinking program shown in the picture above. After writing the code in Thonny IDE, I clicked the Run button to upload and execute the program on the ESP32 board. Once the program started running, the onboard LED began blinking successfully, confirming that the code was working correctly.

Successful Onboard LED Blinking on the ESP32.
External LED Blinking
Code :
from machine import Pin
from time import sleep
led = Pin(23, Pin.OUT)
while True:
led.on() # LED ON
sleep(1)
led.off() # LED OFF
sleep(1)

I used the simple external LED blinking program shown in the picture above. After writing the code in Thonny IDE, I clicked the Run button to upload and execute the program on the ESP32 board. Once the program started running, the external LED connected to GPIO 23 began blinking successfully, confirming that the circuit connections and the MicroPython code were working correctly.
4.XIAO ESP32C3

The Seeed Studio XIAO ESP32-C3 is a compact and low-power development board based on the ESP32-C3 microcontroller. It features built-in Wi-Fi and Bluetooth 5 (BLE) connectivity, making it suitable for IoT and embedded system applications. The board supports MicroPython, Arduino allowing to easily develop and upload programs for a variety of projects.
- Microcontroller: ESP32-C3
- Clock Speed: Up to 160 MHz
- Flash Memory: 4 MB
- SRAM: 400 KB
- Wireless Connectivity: 2.4 GHz Wi-Fi and Bluetooth 5.0 (BLE)
- Operating Voltage: 3.3 V
- USB Interface: USB Type-C
- GPIO Pins: 11 Digital Input/Output Pins
- Analog Inputs: Up to 6 ADC Channels
- PWM Support: Available on GPIO Pins
- Programming Support: Arduino IDE, MicroPython
- Applications: IoT devices, embedded systems, wireless sensor networks, and smart automation projects.
LED blinking with XIAO esp32c3
Code :
const int LED_PIN = 1; // GPIO1
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}

I used a simple LED blinking program. After writing the code in the Arduino IDE, I clicked the Upload button to upload and execute the program on the Seeed Studio XIAO ESP32-C3 board. Once the program started running, the external LED connected to GPIO1 blinked successfully, confirming that the code was working correctly.
5. Raspberry Pi Pico

The Raspberry Pi Pico is a compact and low-cost microcontroller board developed by the Raspberry Pi Foundation. It is based on the RP2040 microcontroller and supports programming in MicroPython and C/C++. The board is widely used for embedded systems, IoT, and electronics projects due to its ease of use and versatile GPIO features.
Datasheet for Raspberry Pi Pico
- Board Name: Raspberry Pi Pico
- GPIO Pins: 26 Multi-function GPIO Pins
- USB Interface: Micro-USB
- Microcontroller: RP2040
- Processor: Dual-core Arm Cortex-M0+ (up to 133 MHz)
- Flash Memory: 2 MB
- SRAM: 264 KB
- Operating Voltage: 3.3 V
- Programming Support: MicroPython, C/C++
- Applications: Embedded systems, IoT, robotics, automation, and sensor interfacing.
LED blinking with Raspberry Pi Pico

I write a simple LED blinking program in the Arduino IDE and uploaded it to the Raspberry Pi Pico (RP2040). After the program was uploaded, the LED started blinking continuously, showing that the code was running successfully and the board was working correctly.
Code :
const int LED_PIN = 15; // Change this to your GPIO pin
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH); // LED ON
delay(1000); // Wait 1 second
digitalWrite(LED_PIN, LOW); // LED OFF
delay(1000); // Wait 1 second
}