A Beginner's Guide to Embedded Systems: Understanding the Basics
Tags: raspberrypi, arduino, linux
Published: 2023-02-05 17:06:28

Have you ever wondered how a vending machine tells real coins and bills from fake ones? Or even how your refrigerator can be so smart as to notify you when you are low on your favourite snacks? But even more importantly, have you ever thought of really automating the tasks we do day in day out? With embedded systems nonetheless!!

## So, What really is an embedded system?
Basically, embedded systems are computer systems that have a dedicated function. The one in a vending machine for instance, would be there just to weigh a coin and compare the value with that of a real coin. 

In more precise terms, an embedded system is a microprocessor-based hardware computer system with integrated software (commonly termed as firmware) invented to perform a specific function as an independent or extensive system.

Well, "embedded" because they more often than not exist within a larger mechanical or electrical system and hence cannot be seen. And "system" as it encompasses multiple components interfaced together for a common purpose. And the beauty of it all? Embedded systems are designed in such a way as to hide the complex part of it, whilst giving the user a user-friendly interface for user input and feedback; as the temperature knobs on a fridge lets you set the maximum, or minimum temperature while it handles the bulk of the task under the hood.

In embedded systems, microcontrollers and microprocessors are commonly used to drive the systems. The difference?
A microcontroller is usually bare metal; encompassing the Central Processing Unit (CPU) and the peripherals on the same chip, is often good at managing input and output, and is relatively easier to setup and use. Common examples include the [Arduino](https://www.arduino.cc/), [the STM32](https://www.st.com/en/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus.html) and the esp32.

A microprocessor, on the other hand, houses a more powerful CPU on a single chip that connects to external peripherals, and hence possesses a heavier processing power for complex logic operations and may even have an Operating System (OS). Common examples of such may include the [Intel Core Series](https://www.intel.com/content/www/us/en/products/details/processors/core.html), the [ARM microprocessor](https://www.st.com/content/st_com/en/arm-32-bit-microcontrollers.html#:~:text=The%20Arm%C2%AE%20Cortex%C2%AE,%2Dcore%20microprocessors%20(MPUs)). It is also worth noting that some microprocessors even encompass microcontrollers for further processing. Fascinating, don't you think?

## What does an embedded system entail?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whyqpv6eztpxj3z2qpgu.png)
As we have already established, an embedded system comprises multiple components interfaced together for a common purpose;

- **An embedded computer:** This is basically a processor such as the ARM/x86/[A System On Module(SOM)](https://www.xilinx.com/products/som/what-is-a-som.html)/[A System On Chip(SOC)](https://www.qt.io/embedded-development-talk/how-to-select-the-right-cpu-or-soc-for-your-embedded-project#:~:text=What%20is%20an%20SoC%20in,to%20do%20their%20computing%20work.) or even a computer for the processing of information e.g the Raspberry Pi, Arduino, ESP32 etc

- **A user interface:** this is necessary for the display of information to the end user for feedback and interaction as well as getting user information as input via touch e.g an Organic Light Emitting Diode (OLED), Liquid Crystal Display (LCD)

- **A link to other systems:** just as no man is an island, an embedded system also spots communication channels to other devices through communication protocols such as the Inter-Integrated Circuit (I2C), the Universal Asynchronous Receiver-Transmitter (UART), the Universal Synchronous/Asynchronous Receiver-Transmitter (USART), [Controller Area Network (CAN) Bus](https://copperhilltech.com/blog/controller-area-network-can-bus-serial-network-technology-for-embedded-systems/#:~:text=The%20CAN%20bus%20is%20primarily,more%20expensive%20and%20complex%20technologies.), [The Serial Peripheral Interface (SPI)](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface), etc.

## The Operating System

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dz4ebmgxzhegar35drlo.png)

The OS processes input data using defined commands to give a definite output data through actuators such as motors, LEDs etc

## Where are embedded systems used?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gbt41qs7ju77tqxyajtr.jpeg)

- **Automotive industry:** Nowadays, most of the vehicles in production have embedded systems; be it a music system, navigation system or even an auto-braking system. These systems serve to improve the device's functionality and enhancing the driving experience

- **Medicine Industry:** Biomedical applications can help allow doctors remotely monitor patient's health and even offer prescription through telemedicine

- **Manufacturing equipment:** Due to the active implementation of robots, artificial intelligence and Internet Of Things (IoT) into production processes, factories can control all types of automation systems, from online monitoring and remote control of equipment to replacing employees on assembly and production lines

_[and so much more...](https://scand.com/company/blog/all-you-need-to-know-about-embedded-systems-development/)_


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt50eb9j5vm9zg4j2xr8.png)

## Typical applications example?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wf2ichwyqy146ns42kfo.png)

This is a simple home automation system built using the arduino microcontroller, some relays, sensors and wires. Pretty simple yet so fascinatingly useful don't you think?

## So, what is Arduino?
[Arduino](https://www.arduino.cc/) is an open-source hardware and software company, project and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices.

## What can the Arduino do?

**1. Analog to Digital Conversion (ADC):** By connecting sensors to an arduino microcontroller, you can easily convert analog data to digital and push the output to other boards for further processing

**2. Automation:** Adding sensors on the microcontroller's General Purpose Input/Output (GPIO) ports, actuators, ADCs etc to enable the collection of external parameters (data) and processing them then performing the required tasks. 

In our simple smart home above for instance, we would have a simple temperature sensor on an arduino which constantly monitors the temperature of our room. Should the temperature go slightly higher than the standard room temperature, the Arduino sends a command to power on the fan and off when it drops.

## What of the Raspberry Pi?
_Computing for everybody_

[The Raspberry Pi](https://www.raspberrypi.org/) are small, single-board computers developed in the UK by the Raspberry Pi foundation in association with [Broadcom](https://www.broadcom.com/)

## Raspberry Pi 4 Model B

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0z4bywsjeeweu6xhxhcl.png)

_The Raspberry Pi 4 model B gives you the power of a full-blown desktop in a small form factor:_

- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
- 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
- Gigabit Ethernet
- 2 USB 3.0 ports; 2 USB 2.0 ports.
- Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
- 2 × micro-HDMI ports (up to 4kp60 supported)
- 2-lane MIPI DSI display port
- 2-lane MIPI CSI camera port
- 4-pole stereo audio and composite video port
- H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode)
- OpenGL ES 3.1, Vulkan 1.0
- Micro-SD card slot for loading operating system and data storage
- 5V DC via USB-C connector (minimum 3A*)
- 5V DC via GPIO header (minimum 3A*)
- Power over Ethernet (PoE) enabled (requires separate PoE HAT)
- Operating temperature: 0 – 50 degrees C ambient

## What can one do with such power?
_Basically, the limit is what you set it to be_

**1. Software projects:** Use your favourite programming language to handle various programming tasks e.g fetching camera feed, AI/ML projects

**2. Automation:** Adding sensors on GPIO ports, actuators and ADCs enables the collection of external parameters which can be worked on and then performing the required tasks

**3. Servers/Media servers:** By creating a cluster of Raspberry Pis, you can be able to host/server content on the web. It can also be used to serve media over network. Furthermore, you can make home servers for hosting own websites, media, cloud storage etc.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zc8sydcums55bvytsjk.png)

**4. Use it as a desktop machine:** _Yes, you can really do that!_ Instead of your ordinary system unit, you can plug your Raspberry Pi onto your monitor and use it to type documents, watch movies, play games, browse, and maybe write even more code.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4c22ditdxwxshtusbu6s.png)

**5. Robotics:** You can build complex robotic systems to automate tasks e.g with a lighting arms
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mv1k1jme00n9qgzya1yk.png)

## Skills you will need?

1. Software skills
2. Hardware skills
3. Design skills - Computer Aided Design (CAD), Printed Circuit Board (PCB) design, [kiCAd](https://www.kicad.org/)


Evidently, embedded systems play a crucial role to our daily lives and are developing quickly across many sectors, including the automobile, telecommunications, and healthcare industries. The field of embedded systems will undoubtedly experience even more exciting advancements in the near future as technology continues to advance.

Remember, _the limit is what you set it to be_


_Brought to you by the [IEEE Dedan Kimathi University Student Branch](https://www.linkedin.com/company/ieee-dedan-kimahi-university-of-technology/)_