Skip to content

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

Image Interface of thw working environment

  • ๐Ÿ”Ž Explored project templates to understand pin configurations

Image

  • ๐Ÿ’ก Made an LED blink as a basic first project
  • ๐ŸŽฎ Configured an accelerometer to change Neopixel colors based on orientation

Image Circuit diagram

  • ๐Ÿคฆโ€โ™‚๏ธ Debugging ensued, but no outputโ€”will revisit in Electronics Week

Image Code error

Image Failed to find library


Xiao ESP32 C3: Getting in the Groove ๐ŸŒˆ

Image

  • ๐ŸŽ›๏ธ Played with the default LED sequence

Image

  • ๐Ÿ“ Modified the text output

Image

  • ๐Ÿ”€ Changed the LED order to better understand the board

Image

  • ๐Ÿ“œ Tested Neilโ€™s push-button code in Wokwi (didnโ€™t work ๐Ÿ˜)
  • ๐Ÿ”ง Added an external push button to get a text output on press

Image

Image

  • ๐Ÿ’ก 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

Image

  • ๐ŸŽฏ Locked onto the โ€œthreatโ€ when detected

Image

  • ๐Ÿšจ Triggered a buzzer to sound an alarm

Image

  • ๐Ÿ”ฅ 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. ๐Ÿ˜‰