Week 4: Embedded Programming

Group Assignment(s) for this week

Getting Started

For our group work, we compared the performance and development workflows for two architectures using the Arduino development environment: The classic Arduino Uno using the Atmega328 processor, and the Seeed Studios Xiao ESP32, using the Espressif ESP32C processor.


Processor Specifications and Performance

By reviewing the datasheets for these processors [link], [link], we learned the following vital statistics:

Processor Speed (Mhz) SRAM (working memory), kB Flash memory (for programs), MB Number of GPIO Pins Operating Voltage (V) Special Features
Arduino Uno (ATmega328P) 20 Mhz 2 kB 0.032 MB 14 5 V Slow, expensive :(
Seeed Xiao ESP32C3 (Espressif ESP32C) 160 Mhz 400 kB 4 MB 34 3.3 V Connect to WiFi, Small, Connect to Bluetooth, inexpensive :)

Installation and Development Workflow for ESP32

We got the Seeed Xiao ESP32 up and running with a basic “blink an LED” code via the following steps:

  1. Plug the Xiao ESP32 into the computer using a USB-C cable.
  2. Download and open a Blink sketch for the ESP32. This was provided by our instructor; the code we used is:
  3. int ledPin = D10;
    // the setup function runs once when you press reset or power the board
    void setup() {
    // initialize digital pin ledPin as an output.
    pinMode(ledPin, OUTPUT);
    }
    // the loop function runs over and over again forever
    void loop() {
    digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
    delay(1000); // wait for a second
    }
  4. Install the ESP32 Board Package to Arduino (this only needs to be done once) In Arduino IDE → Settings, Paste the following URL into Additional Boards Manager URL
  5. Install support for ESP32 boards: From the Tools / Board / Boards Manger… menu, Search for ESP32 and install the package from Espressif Systems.
  6. Screenshot of Pushing
  7. Select the specific board we will use: Tools / Board / esp32 / XIAO_ESP32C3
  8. Select the ESP32’s serial port from Tools → Port → [ESP32 Port]

    The port will differ depending on operating system and USB port, on our Mac it looked like /dev/cu.usbmodem[###]. For some reason it was recognized with a weird board type, but it still worked. Screenshot of selecting the port
  9. Hit the “upload” button (-->) to send the code to the Arduino.
  10. Screenshot of the esp32 programing
  11. Wiring it up: the ESP32 doesn’t have an internal LED that can be blinked, so we must connect one to Pin 10, to match the code. We used a breadboard to create a circuit that matched the Seeed Studios recommendation in their Getting Started Guide
    Image of the circuit
    (Direct link to the URL for this link.)
    Our final circut board looked like this:
    Picture of the final product
  12. Plug the board back into your computer to power it up.
  13. The LED on the Arduino should start to blink once per second.

Installation and Development Workflow for Arduino Uno

We got the Arduino Uno up and running with a basic “blink an LED” code via the following steps, as outlined by our instructor in this document:
Specifically, our steps were:

  1. Plug the Arduino Uno into the USB port.
  2. Download, install, and start the Arduino IDE
  3. From File / Examples / 01. Basics, open the “Blink” sketch.
  4. Picture of the Uno Sketch Code Open
    Picture of the Uno Sketch Code
  5. Select Tools / Board / Arduino AVR Boards / Arduino Uno
  6. Select the Arduino’s serial port from Tools / Port / [Arduino Uno Port] The port will differ depending on operating system and USB port, on our Mac it looked like /dev/cu.usbmodem[###]
  7. Hit the “upload” button (-->) to send the code to the Arduino.
  8. The built-in LED on the Arduino should start to blink once per second.