Week 4: Microcontroller Adventures ๐
Assignment Objectives ๐
This weekโs assignment was all about getting up close and personal with microcontrollers. The tasks included:
- ๐ Browsing the datasheet for a microcontroller
- ๐ป Writing and simulating a program that:
- ๐๏ธ Interacts with local input/output devices
- ๐ก Communicates via wired or wireless connections
- โก Extra credit: Testing it on a development board
- ๐พ Extra extra credit: Experimenting with different languages and development environments
My Microcontroller Journey ๐ ๏ธ
I've spent years working with Arduino Uno, crafting conceptual projects like:
- ๐ถ A device that taps into brain waves to generate music
- ๐ค Depth-sensing robots using IR sensors
- ๐ Line-following bots powered by ultrasonic sensors
But this week, I stepped out of my comfort zone and explored new boards and environments. My mission? Write some code, simulate output, and see where things break (and hopefully get fixed). Hereโs how it went:
RP2040: Blinky Beginnings โจ
- ๐ Started with the RP2040 board
Interface of thw working environment
- ๐ Explored project templates to understand pin configurations
- ๐ก Made an LED blink as a basic first project
- ๐ฎ Configured an accelerometer to change Neopixel colors based on orientation
Circuit diagram
- ๐คฆโโ๏ธ Debugging ensued, but no outputโwill revisit in Electronics Week
Code error
Failed to find library
Xiao ESP32 C3: Getting in the Groove ๐
- ๐๏ธ Played with the default LED sequence
- ๐ Modified the text output
- ๐ Changed the LED order to better understand the board
- ๐ Tested Neilโs push-button code in Wokwi (didnโt work ๐)
- ๐ง Added an external push button to get a text output on press
- ๐ก Attempted to use the button to light an LED, but Wokwi had traffic overload
Enter Tinkercad: Desk Defense System ๐ก๏ธ
Since Wokwi refused to cooperate, I switched to Tinkercad and built something far more important: a Desk Defense System.
- ๐ Used an ultrasonic sensor to detect intruders
- ๐ Mounted the sensor on a servo motor to scan the area
- ๐ฏ Locked onto the โthreatโ when detected
- ๐จ Triggered a buzzer to sound an alarm
- ๐ฅ Future upgrade: Replace buzzer with a piezo sparker to shoot balls of flash paper (because why not?)
Group Assignment: Exploring Different Boards ๐
As part of the group assignment, we explored different microcontroller workflows. Hereโs a quick overview of the boards we worked with:
Arduino Uno ๐๏ธ
- Processor: ATmega328P (8-bit)
- Ease of Use: Beginner-friendly, massive community support
- Programming Environment: Arduino IDE
- Strengths: Simple, reliable, tons of libraries
- Weaknesses: Limited processing power, lacks built-in Wi-Fi/Bluetooth
Xiao ESP32 C3 ๐ก
- Processor: ESP32-C3 RISC-V (32-bit)
- Ease of Use: Moderate, some learning curve with ESP-IDF
- Programming Environment: Arduino IDE, ESP-IDF, MicroPython
- Strengths: Wi-Fi and Bluetooth built-in, small form factor
- Weaknesses: Fewer I/O pins compared to full-size ESP32
RP2040 โก
- Processor: Dual-core ARM Cortex-M0+
- Ease of Use: Moderate, requires understanding of PIO (Programmable I/O)
- Programming Environment: Arduino IDE, MicroPython, C/C++
- Strengths: Fast, flexible, powerful GPIO handling
- Weaknesses: No built-in Wi-Fi/Bluetooth, more complex setup
Comparing Development Workflows โ๏ธ
Feature | Arduino Uno ๐๏ธ | Xiao ESP32 C3 ๐ก | RP2040 โก |
---|---|---|---|
Processor | ATmega328P (8-bit) | ESP32-C3 RISC-V (32-bit) | Dual-core Cortex-M0+ |
Wi-Fi/Bluetooth | โ No | โ Yes | โ No |
GPIO Pins | 14 Digital, 6 Analog | 11 Digital, 4 Analog | 30 GPIO |
Programming Environments | Arduino IDE | Arduino IDE, ESP-IDF, MicroPython | Arduino IDE, MicroPython, C/C++ |
Best For | Simple projects, prototyping | IoT applications, wireless projects | High-performance embedded projects |
Final Thoughts ๐ญ
- ๐ข This week was full of new boards, new bugs, and new frustrations
- ๐ Learned a lot and had fun experimenting
- ๐ Next goal: Get the accelerometer project working in Electronics Week
P.S. If you ever see a small robotic turret guarding a desk, just walk away. Trust me. ๐