Embedded Programming
Embedded Programming is the process of writing software to control hardware-based systems. These systems—like microcontrollers—are embedded into devices to perform specific tasks. Unlike general-purpose computers, embedded systems are resource-constrained and highly optimized for real-time control, data collection, and automation.
Toolchain and Workflow Comparison
I explored, programmed, and compared multiple microcontroller families using distinct toolchains. The microcontrollers I worked with are:
- Arduino Uno
- Arduino Nano
- ESP8266 NodeMCU
- Seeed Studio XIAO RP2040
- Seeed Studio XIAO ESP32-S3
Feature | Arduino Uno/Nano | ESP8266 NodeMCU | XIAO RP2040 | XIAO ESP32-C3 |
---|---|---|---|---|
IDE Used | Arduino IDE | Arduino IDE | Arduino IDE | PlatformIO |
Compiler Toolchain | AVR-GCC | Xtensa GCC | GCC ARM | RISC-V GCC |
Interface | USB Type-B | Micro-USB | USB-C | USB-C |
Communication | UART, I2C, SPI | UART, Wi-Fi | UART, I2C | UART, Wi-Fi |
Development Speed | Easy | Faster | Fast | Very Fast |
Peripheral Support | Basic | Wi-Fi Libraries | Rich I/O | Extensive |
Simulation | Wokwi | Wokwi | Wokwi | Wokwi |
For this assignment, I explored the ESP32-S3 microcontroller using the Wokwi simulator. The goal was to simulate real-world embedded programming tasks, interact with input/output devices, and document the process. Here's a detailed breakdown of the journey:
XIAO ESP32-C3
The Seeed Studio XIAO ESP32-S3 is a powerful, compact microcontroller board based on Espressif’s ESP32-S3 chip. It supports Wi-Fi and Bluetooth LE (5.0), making it ideal for IoT projects.
This site helped alot getting started with esp32 : SeeedStudio
Key Features:
- CPU: 32-bit RISC-V single-core, 160 MHz
- Wireless: Wi-Fi + BLE 5.0
- Flash: 4MB
- GPIOs: 11 usable pins (supports ADC, PWM, I2C, SPI, UART)
- USB-C for programming & power
- Super compact: 21mm x 17.5mm
Getting Started with Wokwi
Objective: Explore the Wokwi platform and familiarize myself with the ESP32-S3 microcontroller.
- I began by signing into Wokwi and creating a new project. Selected the ESP32-S3 board and Arduino template for the simulation environment.
Blinking LED with Serial Monitor
- Chose a template of blinking Led.
- played with the vaules and tried changing words .
Experiments
1 Servo with 1 Joystick
To begin, I wanted to test the basics — controlling a single servo motor using just the X-axis of a joystick. I used the Seeed XIAO ESP32-S3 board and simulated everything on Wokwi.
In Wokwi, I used the following components:
-
Seeed XIAO ESP32-S3
-
Joystick module (x-axis and y-axis)
-
Servo motor (SG90 or similar)
-
Wires
CIRCUIT CONNECTIONS
Joystick Module
A joystick has 5 pins usually:
-
VCC → Connect to 3.3V on the XIAO
-
GND → Connect to GND
-
VRx (X-axis) → Connect to A0 (GPIO1) on XIAO ESP32-S3
-
VRy (Y-axis) → Connect to A1 (GPIO2) (optional for now)
-
SW (button press) → You can leave it unconnected for this project
Servo Motor
-
Signal → Connect to D6 (GPIO6) on XIAO
-
VCC → Connect to 5V (or 3.3V, if using low-power servo in simulation)
-
GND → Connect to GND
CODE
Realization About the Servo Library
At first, I tried using the regular Servo.h library, but I got a compiler error saying it doesn't support ESP32-S3. So I switched to the ESP32Servo library, which works perfectly with the XIAO board.
2 servo 1 Joystick
I wanted to control two servo motors using a single joystick module, with each axis of the joystick controlling one servo. I used the Seeed XIAO ESP32-S3 because it’s compact and supports analog input and PWM output, and I simulated everything using Wokwi.
Components I Used -
-
Seeed XIAO ESP32-S3
-
Joystick module (with X and Y outputs)
-
2x Servo motors (SG90)
-
Jumper wires
Circuit Connections
Joystick Wiring:
-
VCC → 3.3V on XIAO
-
GND → GND
-
VRx (X-axis) → GPIO1 (A0)
-
VRy (Y-axis) → GPIO2 (A1)
-
SW (button) → (Not used for this project)
Servo Wiring:
-
Servo 1 signal → GPIO6
-
Servo 2 signal → GPIO7
-
Both servo VCCs → 5V (simulation), or external 5V in real life
-
Both servo grounds → GND
CODE