Embedded Systems Tutorials

In the Embedded Systems Tutorials category of my website, you’ll find educational materials in form of “Tutorials”, that start at the very basic concepts to the advanced ones. You’ll be creating some exciting embedded projects using a variety of platforms. Just stick with me!

However, you still be able to skip over this introduction and directly jump to the end of this post to Get Started. But I strongly recommend that you give it a shot as it will definitely answer the most of your probable questions and make everything crystal clear. If it’s your first time here, it’s not recommended to skip over this post.

skip to get started
It’s not recommended to skip this post !

I still remember that day when I got a couple of LEDs flashing because I told them to. Well, I was really hooked! Sooner I realized that this thing is meant to be for me. I love writing software that interacts with hardware. All I can say that it makes you feel so powerful, you can almost control anything you want to. In this way, I can touch the world, do changes and make a difference. I can touch people’s lives, minds, and hearts. The reason for which I love this profession.

[toc]


   What Are Embedded Systems?   

 

There exist so many definitions for what an embedded system really is. But I do believe that

[click_to_tweet tweet=”An Embedded System is a computerized system that has a computer built-in, without being the final product a real computer!” quote=”An Embedded System is a computerized system that has a computer built-in, without being the final product a real computer!” theme=”style2″]

Which means that any device that has any computing machine embedded within is said to be an “Embedded System”. However, an embedded system can be a very simple piece of electronic circuitry that performs a specific function within a larger system. Despite the fact that this kind of systems may not seem very embedded to many people. But in fact, it does!

The definition is so broad to include all of the following devices

Heaters Air Conditioners Microwaves
Smart Phones Digital Alarms Routers
Toys Wearable gadgets Smart Locks
Rockets Avionics Robotics
And much more…

Even the computer peripherals are actually examples of embedded systems applications. Such as mouse, keyboard, monitor, webcam, scanner, joysticks, printer, speaker system, etc. Every single piece is a standalone embedded device that communicates with the main CPU via (Serial/Parallel) Buses.

  • Mouse: has its own computer that interfaces an optical flow sensor to determine the speed and direction of motion. It also streams out the data via a USB cable to the main CPU through the motherboard.
  • Keyboard: it also has its own computer that scans out all the keys and sends out some coded data when a key is pressed.
  • Monitors: also have their own circuitry with built-in computers to display the data streamed to it via the parallel port of the CPU.
  • Printers: typically comes with a USB port to receive that files from your PC and start performing its tasks sequentially.
  • And so on…

Every single piece of your computer has an embedded computer built-in somehow. However, the average user may not recognize them and mistakenly believe that the CPU is the only computer involved in the whole machine!


   Examples For Embedded Systems   

 

In fact, most of the devices which we are using on a daily basis are actually embedded systems applications. There is too way examples to count, but I’ll try categorizing and listing down a handful of them.

  • Home Devices. [Heaters, TVs, TV’s Remote, Digital Alarm, Air Conditioner, DVD Video Player, Cameras, Boilers, Smart Door Lock, etc.]
  • Robotics. [Groung Vehicles, Aerial Robots (Drones), Underwater Vehicles (ROVs), Industrial Robots, Humanoids]
  • Avionics. This term represents all the electronic circuits within an airplane. This includes [Buttons, Interfaces, Controls, Screens, GPS, Autopilot systems, Tracking systems, Landing planning, etc.]
  • Networking Devices. [Routers, Switches, Firewalls, Cellphones, GSM, Radio Stations, etc.]
  • Automobiles. a typical car could possibly have over 20 embedded computers built-in. [Lighting System, Air Bags, Fuel Injection, Windows, Door Locks, Parking Assistant System, Anti-stealing Alarms, Whippers Motion, etc.]

Well, I think it’s really tough to write down an exhaustive list of all the embedded systems applications. However, I’ve done my best and hope you’ve got the point of it.


   A perspective on the embedded industry   

 

A couple of years ago, the embedded systems was an over-hyped industry. Due to the huge advances in the automation and the IOT craze. Yet it slid down to make room for the Ai and deep-learning which is overhyped nowadays.

The embedded industry has been there for quite a long time since the early 60’s for more than 50+ years up till today. And it’s consistently growing at a steady rate over the past few decades. In 2015, the size of the embedded industry was evaluated at 159Billion$ and it’s expected to exceed 225 Billion$ by 2021.

Embedded-Systems-Tutorials
Global Embedded Systems Market Analysis & Forecast. Image From marketresearchstore.com

The first embedded processors were created by Intel in the early 60s, called 4001 Microprocessor. This one was used for the early calculators in that age. However, it has no internal memory and they needed to hook an external memory to accommodate for that. But developing embedded computers with internal memories didn’t come very long after. And the embedded suppliers started to pump their products onto the market at a lower price that is getting lower and lower, with a decent performance that is getting better and better.

The leading industry suppliers nowadays include NXP, Microchip, Atmel Corporation, Qualcomm, Texas Instruments, Freescale Semiconductors, Fujitsu, Samsung Electronics, Renesas Electronics, and many more.

The embedded industry has been and still continue growing every single year! It’s not overpopulated or replaceable by any means. At least for the seeable upcoming future decades. If you really love this profession, you can surely pursue a career in such a promising field. Or you may be doing it for fun if it seems appealing to you.


   Jobs in the embedded systems industry   

 

For embedded systems, the role is same as most system engineers, you are 20% architect, 60% troubleshooter, and 20% subject matter expert. In embedded stuff, this tends to be more about the overall perceptual view of the whole system and determining when and where changes have to be made.

[click_to_tweet tweet=”In Embedded Systems, it’s all about the overall perceptual view of the whole system and determining when and where changes have to be made” quote=”In Embedded Systems, it’s all about the overall perceptual view of the whole system and determining when and where changes have to be made” theme=”style2″]

Typically the job of an embedded engineer depends on the field of application. In embedded systems, we handle both software/hardware stuff. Embedded Engineers work on a vast number of verticals ranging from low range commercial electronics to high-value industrial electronics. Typically their work focuses on using Electronics knowledge to implement circuits and write code in most cases. The end goal is to achieve desired outputs using required/available inputs and by maintaining optimum resource utilization.

But, we can categorize the jobs in the embedded industry into two major categories.

  1. Embedded Hardware
  2. Embedded Software

Firstly, the embedded hardware-related jobs are not so common. These positions require specific hardware analysis/design skills and in my experience, there are a few of them. However, you can go for this surely if it suits you well.

Secondly, the embedded software jobs are the most common ones. Firmware engineers are in a high demand these days and there is an increasing demand for these positions indeed. It’s my specialty and I hope this doesn’t cause any sort of bias. Therefore the most of these tutorials are software-oriented focusing on teaching you how to efficiently write software that drives the hardware pieces between your hands.


   What is Embedded Programming?   

 

Embedded programming is the field of knowledge and practice that involves creating the software which runs the embedded devices. Which is not limited to microcontrollers programming. Hence we can say that the microcontroller’s programming is embedded programming and the opposite is not true. As for this series of tutorials, we’ll be learning the theoretical fundamentals and the best practices that will make you better at the embedded programmer specifically with Microcontrollers.

It’s amazing how many embedded computers are being shipped every single year compared to the traditional PCs. The embedded shipping volume exceeds by a factor that is greater than 30 times more sales! Which is an obvious evidence that we need more programmers to write the code for these chips. If you stop reading right now and start thinking about every electronic device you’re using daily, you’ll then realize that we’re surrounded by a tremendous number of embedded computers almost in everything.

Embedded computers do exist in homes, buildings, and streets. They’re everywhere on the entire planet, and also orbiting the earth 24/7. While some of them are exploring the moon, mars and the outer space to provide us with information about the whole universe.

Writing the code for these devices is our job as embedded software engineers (Firmware Engineers). On the other hand, it’s really amazing to write code that makes stuff happens and move around following your own commands. Many software enthusiasts, including me, enjoy this kind of programming so much. I particularly find embedded programming a fascinating and addicting branch of practical knowledge compared to desktop or android programming.

Next, we’ll identify the typical tasks that an Embedded Software (Firmware) Engineer does and the most common required skills among various companies that you need to acquire.


 Needed Skills For Embedded Software Engineers 

 

Obviously, you needn’t have all of these skills combined right at the beginning. But it’s getting to be a more competitive field every single year, hence the requirements are in a consistent increase. Here are few common tasks from the job description for major companies:

  • High-level coding skills in C/C++
  • Coding in python, Linux Bash Shell scripts
  • Matlab/Simulink for model-based control systems
  • Developing Device Drivers
  • Software Apps programming
  • RTOS customization and porting
  • Cross-development and deploying packages
  • Module level and integration testing
  • Software projects documentation
  • Reading out datasheets of electronic stuff which is intended to be used in the project

   Firmware VS Software   

 

There are some major differences between both of software and firmware. This topic particularly needs an entire article itself. So we’ll discuss a few points which differ firmware from software in hope to make both concepts crystal clear for all of you.

1. Nature of the code

I- General purpose computers (e.g. desktops, laptops, etc.) usually run general purpose software applications such as: browsers, readers, games, media players, photoshop, etc. A typical user may run one or more of these software applications whenever he wants. Nobody can predict what a user may do when his PC is turned on! He may start a game or search google on chrome or play movie or whatever.

Embedded-Systems-Tutorials
General Purpose Computer Software Applications. Image from iimtstudies.edu.in

II- Specific purpose computers (e.g. microcontrollers) usually run firmware applications such as: mobile robots, drones, heaters, voltmeters, digital alarms, etc. When a line-follower is powered-up it will do nothing other than following that black line. The developer who wrote the code knows exactly what the machine will be doing after pressing the Power-ON button! Hence the term firm, which points to this deterministic nature of firmware applications that will always perform the exact same tasks when Powered-Up! Maybe forever or until the firmware is updated or completely changed.

Embedded-Systems-Tutorials
 Microcontroller-Based Line-Follower Robot. Image from 123paintcolor.com

 

2. Failure in Sofware VS Firmware

 Software Failure 

A typical failure in software can be a crashing message that pops-up at your face while using photoshop or whatever software you’re using. A software failure may cause your pc to freeze for a short time period. Holding Ctrl+Alt+Delete will terminate any failed software at once. However, in the worst case, your PC may not respond to open the task manager at all. In this case, a machine hardware-restart will fix everything up!

You may have noticed that a failure in software is a pretty feasible issue that can be easily resolved. Despite the fact that it feels annoying and kind of frustrating at some points. But all in all, a failed software is an issue that causes no damage almost in all scenarios.

Computer Software Crash
Computer Software Crash. Image from slashgear.com

 Firmware Failure 

A typical failure in firmware can lead to an out of control drone, ROV or any robot. Maybe an accident for a passengers plane that reports a crazy behavior for the embedded avionics built-in. A firmware failure can possibly lead a self-driving car to a confirmed accident. Well, the short video down below is a recording for the Ariane5 launched back in the 90’s.

After only 36 seconds of the launching, everything was gone with the wind. More than 7Billion$ was spent for the development of this project that took up to a complete decade of dedicated development efforts. It was a catastrophic failure indeed. And the reason was?

Well, they used some of the firmware written for the Ariane4 which was a completely different machine (physically). so at some point, the LOC (Line of code) responsible for the horizontal velocity of the rocket with respect to the platform variable conversion from a floating-point 64-bit to a 16-bit signed-integer caused the catastrophic results. The failed variable conversion has led to an overflow that consequently forced the vehicle to deviate from its original trajectory. To finally run the self-destructing code that prevents any further disasters.

[click_to_tweet tweet=”A single defect in firmware code is more than enough to endanger people’s lives or money.” quote=”A single defect in firmware code is more than enough to endanger people’s lives or money.” theme=”style2″]


   Embedded Systems Terminologies   

 

 Reliability 

This is a measure of the survival probability of the system when the function is critical during the mission time. The less failure probability of a system is, the more reliable it is.

 Fault-Tolerance 

This is the ability of a computer system to survive in the presence of faults. All environments are assumed to be noisy and our systems must tolerate all the external inconsistencies.

 Real-Time 

Our systems must meet various timing and other constraints that are imposed on it by the real-time natural behavior of the external world that is being interfaced. There is no Ctrl+Alt+Delete option for a passengers plane that lost control! A system that is tracking incoming missile attacks in an aerial defense agency must precisely calculate and plan for the counter-attack due to a Hard-Time deadline. Otherwise, it’ll get destroyed and so do us! If a system is lagging when a real-time response is critical, then it’s a pure crap.

 Flexibility 

It’s building systems with built-in debugging opportunities that allow for a remote maintenance and so. Just imagine that we’re building a spacecraft that will land on another planet to collect different types of data and sends them back to us. If this ROV has gone insane for whatever reason and lost control, we should be able to make some diagnostics. And in the worst case, we may have to upload an entirely new firmware that will travel thousands of miles away in the space to land on the ROV’s memory to bring it back to life. This is what really happened with the Mars Pathfinder back in the 90’s!

 Portability 

This is a measure of the ease of using the same software in different environments. Portability requires generalized abstractions between the application program logic itself and the low-level system interfaces. When software with the same functionality is being upgraded or reproduced for several computing platforms, then portability is fundamentally the key factor for development cost reduction.


   What you’ll be learning here?!   

 

After choosing the platform which you prefer the most. You’ll be guided through consecutive tutorials that have many practical examples within and some additional tasks for practice. All of which aim to give you a deeper understanding of the main concepts, modules, and mechanics in embedded systems. Which definitely include:

  • Overview for the microcontrollers architectures.
  • Getting familiar with the embedded development ecosystem.
  • Coding in the standard ANSI-C usually called ” C-programming language “. It’s also well known in the embedded community as ” Embedded-C “. 
  • Guided flipping through various datasheets for components, modules, and MCUs.
  • Developing basic input/output projects to control a variety of actuators.
  • Interfacing a wide range of sensors and modules.
  • Dealing with signals analog/digital.
  • Complete understanding of all serial port communication protocols (USART, SPI, I2C, and USB) and creating practical applications in which we’ll link multiple MCUs together or Hook any of them to a PC for receiving/sending commands.
  • Debugging (Chasing down) dodgy projects effectively. With various tips and tricks in order to avoid tremendous bugs in the first place.
  • Creating your own embedded projects!

   Let’s Get Started!   

 

As a beginner, I highly recommend you start with the Microchip PIC MCUs Tutorials as a starting point for your journey. In case you feel frustrated, you can always email me or leave a comment wherever it looks relevant.

Microchip PIC TutorialsEmbedded-Systems-Tutorials

Good Luck Dudes!

 

Author Khaled Magdy Signature

Share This Page With Your Network!
Join Our +25,000 Newsletter Subscribers!

Stay Updated With All New Content Releases. You Also Get Occasional FREE Coupon Codes For Courses & Other Stuff!

Photo of author
Author
Khaled Magdy
Embedded systems engineer with several years of experience in embedded software and hardware design. I work as an embedded SW engineer in the Automotive & e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI/ML, and other fields I'm passionate about.
I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?

Leave a Comment