Skip to content

Week 5 - Embedded Programming

For this week, we were tasked with programming 4 different microcontrollers: the XIAO RP2040, XIAO ESP32-C3, ATtiny 412, and Arduino Uno.

Simulating

Although I could have made the code myself because it was pretty simple, I decided to use ChatGPT to just generate some simple push button code that I could easily modify for different kind of microcontrollers. Here is the Chat log.

Arduino

The arduino is a very beginner friendly microcontroller because of its simple, straightforward layout that anyone can pick up with minimal learning time. However, the problem is that for most projects, this type of microcontroller is a bit overkill and ends up wasting more money and takes up more space than is actually needed. To simulate my the arduino, I went to Wokwi and set up a simple breadboard and arduino uno layout. I set up the LED, push button, and resistor in the breadboard for a button controlled LED circuit. The link to the Wokwi project is here.

Here is what it looks like with the code next to it. arduino simulation

ESP32-C3

The ESP32-C3 is a pretty versatile and cheap microcontroller for its functions. It is usually about 2-4 dollars and does not require a large amount of power to function. It also has USB support.

To simulate a push button LED circuit with this microcontroller, I re-used my previous code for a pull-down resistor and just modified the values of the ledPin and buttonPin to the ones that were on the ESP32-C3 since it does not go to pin 13. I simply just changed the ledPin to 3, assembled an almost exact circuit to the one for Arduino, except it didn't have a breadboard, and then ran it. The Wokwi project is here.

Here is what the code and setup looks like.

c3 simulation

RP2040

The RP2040 a very open design microcontroller and is very versatile for a cornucopia of projects. With a similar set up to the ESP32-C3, it is also cheap and definitely gives you a bang for your buck.

To simulate the push button on the RP2040, I simply reused the code from the arduino, used ChatGPT to make connecting the cables easier, and waited for the Wokwi servers to work. The link to the Wokwi simulation is here.

Here is what the set up and code looks like. rp2040 simulation

ATtiny