Embedded Programming

Week of Sep 18 2024

Compare toolchains and development workflows of alternative embedded architectures, browse the data sheet for a chosen microcontroller, write and simulate a program for a microcontroller to interact and communicate

Sep 22, 2024

I narrowed my choices down to the most lightweight and low-power chips, in anticipation of designing a wearable to be brought onboard a space mission, where weight and self-sufficiency are paramount. The ATTiny series thus seemed like an obvious choice for my use case. To start, lets browse the ~600 page data sheets for these sub-1 USD components!

I wanted to create a microcontroller that can function as a motion detector, to sense the proximity and speed of objects coming towards a sensor, which then triggers an action such as a motor moving. This can then be applied to my working idea of a wearable airbag vest that can expand from a contracted state when turbulence / proximity to hard surfaces is detected.

I selected the ATtiny412 over the ATtiny85 because of its more updated development environment and debugging capabilities, and chose to simulate in Wokwi rather than Falstad, since the former is more suited for digital signals and the latter for analog signals. Wokwi only had the older ATtiny85 component, so I used an Arduino Nano breadboard to simulate the pins on an ATtiny412. Here's a comparison of their pin outs.

Sep 24, 2024

After an incredibly helpful session at TA Anthony's office hours (and asynchronous code troubleshooting from TA Niklas), I managed to get my Wokwi simulation going.

Wokwi simulation 1: Motion Sensor with ultrasonic HC-SR04 sensor and an Arduino Nano breadboard.

However, the use of ATtiny412 chips would make the project more difficult to debug as a beginner, since the ATtiny412 does not allow for easy transfer of data back to a computer. The pin constraints may also restrict flexibility down the road. While the ATtiny412 might work well for an experienced programmer who has already optimized the code and hardware structure, I was advised to work with an alternative like an RP2040 which is more "beginner-friendly", since it would allow one to talk back and forth between the microcontroller and coding on a computer, making it easier to debug. I did not need wifi/ bluetooth capabilities for my project, which is more tactile, so I did not consider the ESP32C series.

Another possible modification was to use a light-based sensor instead of a sound-based sensor, for better precision and to avoid muddling / overlapping of signals (as would be typical of echoes/ sound-based signals). I thus tried out another simulation with a different microcontroller architecture system (RP2040, with the intent on mounting it on a XIAO board to take advantage of built-in USB and regulators), and with a PIR motion sensor instead.

Wokwi simulation 2: Motion Sensor with infrared light-based PIR motion sensor and a RP2040 chip.

For the group assignment, the Architecture section eagerly gathered after the 9/18 lecture to brainstorm. At this point, none of us could differentiate between a microcontroller and a chip.

With the help of fellow HTMAA student Kat and TA Quentin, and after a few days collaborating asynchronously on shared documents, we eventually figured it out! Here is our group's compilation of various embedded architectures for different use cases: 9/18 Comparison of Embedded Architectures (HTMAA 2024 Architecture Section group assignment)

© He Yutian 2024