Embedded Systems
Introduction to Embedded Systems Programming
In this course series we provide an introduction to embedded systems programming, associated simple electronic circuit building containing sensors, analysis of sensor data (e.g. sensor calibration, Kalman filters, sensor fusion), and basic AI on embedded systems. We will demonstrate how to display data on your computer collected from the embedded system in real time by cable, and how to read data and control the embedded system wirelessly using Bluetooth Low Energy (Bluetooth LE, BLE). Knowing how to work with embedded systems is the first step for you to build and program your own drone from scratch, for instance.
This introductory course series consists of courses with online course materials, lectures and exercises, followed by a student-selected capstone project, which applies the newly learned embedded systems programming and circuit building skills to a real world situation.
Course 1: Introduction to Embedded Systems
Our first course of the series, Introduction to Embedded Systems, is conducted entirely online in self-study and introduces you to embedded systems, the Arduino Language (a variant of C++), and basic electronic circuit building. Simply work through this course, if you can, and you have received a good introduction.
However, if you are a novice without any prior exposure to programming and electronic circuit building, you may wish to consult additional sources to broaden you understanding. This is especially the case, if for one reason or another, you have difficulties following the course.
Luckily there is a plethora of great introductory material available online, which you can tap into conveniently to learn these basics. Below we list the skills you will be developing, and we provide additional sources, if you seek additional information or a more detailed introduction in a different format.
List of skills to develop:
- Basic programming in C++ (including using multiple files in a program and object-oriented programming with classes)
- Programming in Arduino language (which is a subset of C++ with some extensions specific to embedded systems and Arduino microcontrollers in particular)
- Basic electronic circuit building
- Programming and Data Visualization in Python, using the Jupyter environment
Below we show you, where you can acquire these skills.
Skill 1: Introduction to C++
You do not need to have any prior programming to take our Course 1, Introduction to Embedded Systems. However, we dive right into programming in C++ and use it without much explanation. If you see some new code structure, which you have not seen before, it is up to you to either understand it from the example use in the course or from looking it up (often we provide a specific link, where you can do so).
If you wish to have a more formal, pedagogical introduction to the basics of programming in C++, you can consult, for instance, W3Schools or GeeksforGeeks (or upon completion of its development, our own Introduction to C++ course, but this one is far from being finished). Gaining a formal understanding is important for your development as a programmer and to learn how to write clean code (e.g. using object-oriented programming with classes), but it is not the very first skill you need to learn. In fact, we suggest you try start with Skills 2 and 3 below, and revisit formal C++ lessons afterwards to clean up your programming skills. The Arduino language you learn in Skill 2 is basically C++ with some modifications, and the programming tasks there are so simple that you can get the hang of it on the fly to get started. In our course, we have also included a few lessons teaching you good programing habits.
Skills 2 and 3: Introduction to Arduino Language and Basic Circuit Building
Course 1, Introduction to Embedded Systems, of our embedded systems course series covers this well and there is no need to consult additional sources. One of the features of our course is that you do not need to purchase any hardware, as you will do all exercises online in simulations, which will give you access to more items than an introductory kit would contain, and will prevent you from damaging the electronics due to incorrect wiring.
In our course, we use the online simulator on Wokwi, which simulates both an Arduino Uno and any associated simple circuitry we will need to build.
Unfortunately, Wokwi is at present not able to simulate the Arduino Nano 33 BLE Sense Rev2 used in our Course 2 below, so for Course 2 a hardware purchase will be recommended later.
However, if our course is too fast for you or you wish to have a more playful and fun approach, particularly suitable for kids (but also beneficial for adults), we suggest you watch the instruction videos of the 30 Days Lost in Space Adventure Kit by InventrKits (inventr.io) and do the code the exercises therein:
- Original 30 Days Lost in Space Adventure Kit Instruction Videos
- 2023 Update of 30 Days Lost in Space Adventure Kit Instruction Videos (find in channel timeline)
Their videos are split into 30 lessons (called 30 “days” in the kit). Two versions of the videos exist: an original version and a 2023 update. The coding presented in the videos goes against any clean software writing (e.g. excessive use of global variables, all code in one file, no use of classes), but as a quick and dirty beginning, it will do. Note that the enigmatic “Hero” microcontroller board used in the 30 Days Lost in Space Adventure Kit is simply a third-party Arduino Uno clone.
Skill 4: Programming and Data Visualization in Python/Jupyter
In order to get familiar with programming in Python and the Jupyter environment, it is beneficial for Course 2 of our embedded systems course series, if you take a peek at some of the free parts of our online course Python for Pilots and Flight Test Engineers. In our embedded systems courses, we will use Python to read in and display data on a computer via a serial connection (USB cable) to the Arduino in real time. We will also use Python (with Bleak) to read in data and control the Arduino with Bluetooth LE with a BLE-capable laptop (most laptops manufactured in 2012 or later are BLE capable, if they have Bluetooth). You will be taught how to do this later, but having basic familiarity with Python beforehand will be helpful.
You can install Python and the Jupyter environment conveniently with Anaconda. If you struggle with this, please ask us for assistance; we will be glad to help.
Course 2: Sensor Data, Analysis, and Wireless Connectivity
For our second course, you will need to purchase some inexpensive hardware costing less than $100 in total. While you could continue to work in simulation, the point of this course is to give you exposure to real data which you collected yourself in the physical world and for you to establish connections by cable and by Bluetooth Low Energy (BLE) with an actual microcontroller.
We suggest you buy the Arduino Nano 33 BLE Sense Rev2 (with headers) microcontroller board (for less than $40), which contains a significant number of onboard sensors and has BLE wireless connectivity. We highly recommend you get the above version with pre-soldered headers, unless you have reason to do otherwise, so you can stick the Arduino into a breadboard for development work (the other version does not work reliably without prior soldering).
In order to practice connecting external sensors, we also suggest you purchase a RCWL-1601 ultrasonic distance measurement sensor (though this is optional and you can simply skip the lessons containing this item). To connect the sensor, you will need a small breadboard and some wiring (as is illustrated in the image below).
Make sure any embedded systems hardware you buy for the Arduino Nano 33 BLE Sense Rev2 (such as the above ultrasonic sensor) is 3.3 V compatible, because this Arduino board (unlike the Arduino Uno in one of the suggested prerequisite courses) is not 5 V tolerant and its pins operate only at 3.3 V.
In this course, you will learn how:
- to read 9-axis IMU data (3-axis accelerometer, 3-axis gyroscope, 3-axis magnetometer),
- to read air pressure, temperature, and humidity data with the onboard sensors of the Arduino,
- to make distance measurements with an ultrasonic sonar sensor (externally connected via circuitry),
- to perform sensor data analysis (sensor calibration, Kalman filters, sensor fusion),
- embedded system components can interfere unexpectedly with each other,
- to read data from the Arduino into a computer via USB cable and wirelessly via Bluetooth LE (BLE),
- to control the Arduino wirelessly via BLE from a computer (note that a BLE-capable laptop or mobile device will be required for this).
Before purchasing any hardware, please contact us to register for this embedded systems course and to discuss specifics, so you get the correct items for you. Also make sure you have completed the prerequisites, before the course starts. It may be possible for you to do some of the course using the Wokwi website again (the Arduino Nano simulator), rather than purchasing hardware, but you would not be able to collect your own sensor data or use Bluetooth LE. These aspects and working with actual hardware are an important part of the course.
The course start date is currently scheduled for Spring 2024 (depending on enrollment and on when the prerequisite course finishes, which we teach for CAP cadets in the winter). The course will consist of a weekly online lecture/workshop session and homework assignments.
Course 3: Machine Learning/AI on Embedded Systems
The Arduino Nano 33 BLE Sense Rev2 is AI enabled. In this course, you will learn how to perform machine learning/AI on the Arduino, using TensorFlow Lite (TinyML). Development of this embedded systems course is planned for late 2024 or 2025.
Course 4: Capstone Project
In Course 4, each student will select a suitable applied embedded systems project, where the above techniques will be used. The nature of this project will depend on the student’s interest and imagination. We will guide the student throughout its execution and final report writing.