Hardware
We will cover different types of hardware in this course:
- Microprocessors
- Microcontrollers
- Circuits
Microprocessors
A microprocessor is a small device that can run a full OS and interface with multiple peripheral devices… The main benefit to this is that you are working with, essentially, a full computer on a very small device. The main challenges with using a microprocessor are power consumption, and speed (both runtime and boot time).
One of the original motivation behind microprocessors at the early stages of their more widespread adoption was to deliver more affordable access to computing power. However, With the precipitous drop in price of smartphones this is less of a concern. That being said, while a smartphone can deliver the computational power for many projects, their hardware interface is severely limited.
Raspberry Pi
The Raspberry Pi (occasionally, RaspPi) is the canonical microprocessor that in large part facilitated the wide reach of the maker movement. The Raspberry Pi is essentially a very small laptop without any peripherals (e.g. screen, keyboard, mouse), but with many open hardware ports. This allows the device to easily connect to many unique or custom devices to act as sensors or actuators.
The Raspberry Pi also includes a set of GPIO (general-purpose input/output) pins, which allow you to connect to some hardware crcuits, such as buttons (inputs0 and LEDs (outputs). These GPIO pins are strictly digital, which can be limiting for certain applications. We will see more on this as we explore the role of microcontrollers in embedded systems.
The operating system, and all data, lives on an SD card in Raspberry Pi. When working with multiple projects that need differently configured systems, this can be leveraged to keep a separate SD card for each project.
For more detailed information on your Raspberry Pi, see the documentation available in the official (Raspeberry Pi Beginner’s Guide)[].
In addition to making the Raspberry Pi devices, the Raspberry Pi Foundation, the group also produces two useful text resources. A magazine, MagPi, on the latest developments in the Raspberry Pi community. Additionally, the Foundation annually produces the Official Project Books, which document a number of interesting projects that have used a Raspberry Pi.
Smartphones (Honorable mention)
Although limited in their ability to interface with peripheral devices, a smartphone is still able to communicate with networked devices. A phone can be used as interface (e.g. light sensors, cameras, gyroscope, microphone) or as a portable computing device. In the case of the use of the phone as a portable computing device, computation may happen locally, or the phone can simply be used as a conduit for server-side computation. The difficulty with a phone as local computing device is the code is general specialized to the platform. We may see this change with the introduction of Purism’s Librem 5 Linux phone.
Microcontrollers
Microcontrollers have no OS installed (generally), which means any code you want to run on a microcontroller must be written with the specific device in mind. When designing a embedded system, you will need to consider if you application is more appropriate for a microprocessor (with GPIO pins, like the Raspberry Pi), or a microcontroller, or some combination of both. Some factors to consider are power draw (significantly higher for microprocessors), processing speed (significantly higher for microprocessors), and circuitry availability (generally, microcontrollers will expose more interfaces than microprocessors).
In terms of circuitry, two of the most important pieces you will find available on most microcontrollers are an ADC (Analog to Digital Converter) and a DAC (Digital to Analog Converter). You will often encounter these devices in the audio domain (where we need to converter digital music signals into audio we can here - or to capture audio waves in the air into a digital signal we can record), but also in any other continuous domain. Some examples of this include light sensors and (some) motor actuators.
Arduino
Arduino is the most widely recognized type of microcontroller. The Arduino, like the Raspberry Pi, was at the forefront of the maker movement. The Arduino Genuino, the classic Arduino model, includes both analog and digital input pins. One of the major benefits introduced by the Arduino is the Arduino programming language and the Arduino IDE. Previously, the toolchain to flash code onto a microcontroller was fairly involved. The Arduino IDE simplified this process.
There are two main drawbacks to the Arduino IDE - performance and space. The libraries for the Arduino are not too large, but program space can be fairly limited on microcontrollers. Accordingly, loading these libraries at boot-time also introduces a delay. Depending on your application, you may find these drawbacks to be unacceptable. In the creative embedded systems domain, this will rarely be the case.
It is slightly more likely that you will find the performance of the program itself to be too slow. This will most often happen in the domain of interface design, where realtime interaction is key. Depending on the application, the human psychology can find delays of > 20 ms to be unnatural. Generally, the Arduino code will not be the bottleneck for this delay. For creative embedded systems, it is generally good practice to initially prototype with the Arduino IDE, and only switch to a lower level language if needed. More discussion on this topic is contained in the appendix.
Since its introduction, there have been a number of similar microcontrollers that mimic the Arduino and can also interface with the Arduino IDE.
ESP32/ESP8266
This class of microcontrollers are essentially Arduino’s with WiFi shields baked in (and so much more). These devices can also be programmed from within the Arduino IDE. They are likely the most popular microcontroller for creative embedded projects at the moment.
This course will focus on development with ESP32s.
MSP430 (Honorable mention)
The MSP430 is an energy harvesting device that is able to run off of the energy from ambient radio waves or any other harvestable power source. This is particularly of interest in the domain of creative embedded systems as it lets us permanently untether from power. While an intriguing concept, for most creative applications, a battery is enough to untether from power.
While the MSP430 has an fork of Arduino IDE that can be used to program the MSP430, the overhead is generally too high for the performance sensitive device.
FPGA (Honorable mention)
Field programmable gate arrays (FPGAs) are an exciting way to merge the speed of circuits with the ease of development of software. Although we will not cover FPGAs in depth, it is good to be aware of the sorts of problems that can be addressed with this tool. Short of designing a hardware circuit by hand from components (transistors, etc) and getting it printed onto a PCB (printed circuit board), FPGAs are the fastest tool you can get. This can be useful for applications where realtime interaction (especially reaction) is important. One example would be a computer vision module that moves a trash can to catch a ball of paper no matter where you throw it in the room.
Circuits
At times, we will need to build custom interfaces to the physical world. This will require us to work with copper wire, resistors, sensors, and the like. Working with circuits affords a huge amount of expressive freedom in terms of form factor and function, but prototyping can be a bit slow. There are a number of online tools for circuit simulation that will allow you to build a simulated circuit with software, and verify that you are getting the behavior you expect. An alternative development approach, and more in the spirit of the exploratory ethos of the creative embedded systems community, is to move fast and break things. For the majority of components available in your average maker space, the total cost a circuit is not more than a few cents. These days, it is okay if you burn a few LEDs while learning how resistors work. Just be sure to know when you are dealing with more expensive components, such as motor actuators or more exotic sensors.
PCB (Honorable mention)
A Printed Circuit Board (PBC) is just a more stable version of a breadboard. Printing a PCB is a nice way to add polish to your system, but is more of a late-stage prototyping step. PCBs are first designed in software, then physically printed - usually by sending the design to a PCB manufacturer. Some maker spaces will have PCB mills allowing you to more quickly prototype with PCB.
One difficulty to watch out for is the difference between “through hole” and SMT (surface mount technology components). To start, you will want to stick with “through hole” components as they are easier to purchase and easier to use.
You may be tempted to design a PCB with the raw processor that is used on your dev board. While this can shrink the form factor, you should be sure that the smaller form factor is necessary, use the processor instead of the dev board introduced a high engineering overhead.