Embedded Systems

We’ll now take a deeper look at embedded systems. Previously, we were using the Toit language to program our microcontroller in a “safer” managed virtual machine. Now, we’ll be working with the native C code that runs on the microcontroller.

What you will learn

  • How to program an embedded system in C
  • The differences between managed environment and native environments

Terminology

Arduino
An open-source electronics platform
embedded system
A computer system directly connecting hardware and software
native
Code that runs directly on the hardware (i.e., binary machine code)
runtime
The supporting environment in which a program runs
virtual machine
A software system that emulates a physical system

Lecture

Links

Introducing embedded systems

Exploring our hardware

Comparing different methods for programming our microcontrollers

Writing programs with Arduino

Other alternatives

Here are a few frameworks that you can use to program microcontrollers:

Here are some of the features I value in a managed virtual machine or runtime:

  • Over-the-air updates
  • Remote debugging
  • Package management
  • Familiarity for computer science students
  • Fast enough processing speed for robot tasks
  • A native C interface
  • Support for TinyML/EmbeddedML (e.g., Edge Impulse)

Exercise

The objective for this exercise is to get up and running with the Arduino IDE.

You will submit your responses on gradescope. Only one partner should submit. The submitter will add the other partner through the gradescope interface.

Additional details for using gradescope can be found here:

You should open the gradescope assignment now so that you know what to work complete.

Grading

I will grade all exercises using a scale of “Nailed It” / “Not Yet”. See the course grading policy for more information, and check gradescope for deadlines.

Overview

The goal for today is to run the BlinkWithoutDelay example on your ESP32 board.

  1. Install Arduino
  2. Add “esp32 by Espressif Systems” under the board manager
  3. Plug in your ESP32 board
  4. Click the board selector and choose “Select other board and port…”
  5. Search for “XIAO_ESP32S3” and select it
  6. Select the correct port
  7. Open the BlinkWithoutDelay example sketch (File→Examples→02.Digital→BlinkWithoutDelay)
  8. Upload the sketch (the right arrow button)

Wrap-Up

We’ll continue working with Arduino in the next chapter.

Resources