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:
- Native code
- Arduino
- ESP-IDF
- PlatformIO
- Rust on ESP
- Nesper/Nim
- Zig? (Xtensa Support #5467)
- Swift (Only RISC-V boards)
- Zephyr (RTOS)
- FreeRTOS (RTOS)
- Potentially any languages using LLVM
- WebAssembly Virtual Machines
- Other
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.
- Install Arduino
- Add “esp32 by Espressif Systems” under the board manager
- Plug in your ESP32 board
- Click the board selector and choose “Select other board and port…”
- Search for “XIAO_ESP32S3” and select it
- Select the correct port
- Open the
BlinkWithoutDelay
example sketch (File→Examples→02.Digital→BlinkWithoutDelay) - Upload the sketch (the right arrow button)
Wrap-Up
We’ll continue working with Arduino in the next chapter.