An embedded system can be described as an electronic system that controls some other system; in most cases they are hidden from the user.
It is embedded within the larger system which it controls. If you have encountered anything that is described as ‘automated’, from automated manufacturing, to an automated hand sanitizing machine, it is most likely that an embedded system is behind the ‘smartness’.
There are different types of embedded systems, including FPGAs (Field Programmable Gate Arrays), PLCs (Programmable Logic Controllers, mostly used in industries), ASICs (Application Specific Integrated Circuits), CPLDs (Complex Programable Logic Devices), DSPs (Digital Signal Processors), microprocessors and microcontrollers, among others.
Almost every living organism has some kind of sensory function it possesses, for instance a plants bending towards light, or white blood cells attacking a pathogen. It is due to these sensory mechanisms that the organism is able to interact with the environment.
However, interaction in this context is simply abstract, because there is a lot going on during the interaction. It involves both sensing and acting upon the sense. Central to this is the brain (in case of animals. Whether plants have a brain, to be sincere, I do not know).
Just as the brain controls every action of an animal’s body, a microcontroller (or any other type of an embedded system) can control the actions of an artificial system, be it mechanical, electric, biological, chemical or any other. One can give instructions to a microcontroller or microprocessor so that the system functions the way it is designed to be.
The advantages of using embedded systems are; reduction of costs, reduction of complexity in the design of the system to be controlled, enhancements in the ability of the designed system by introducing some degree of ‘intelligence’ to it and also enabling it to communicate to other devices and systems.
Due to this, embedded systems are ubiquitous and essential. In automobiles, aircraft, home appliances, communication devices, among other things, embedded systems are almost everywhere.
Well, how can you have an electronic system controlling a probably much larger system?
It is important to understand how computers work from a fundamental point of view. You might know that computers can only understand binary, octal or hexadecimal code, (also known as machine language), but it is almost impossible for a human being to write a bunch of hex digits (a large amount of these for that matter), to enable a computer do something meaningful.
So, to program these machines requires a computer language close to what humans use to communicate. These are now known as high level languages, and they include the numerous familiar languages that you know, such as C, C++, Java, Python among so many others.
However, there is a slight downside to this, especially with respect to embedded system development. Programming using most high-level languages utilizes a lot of resources , such as time, memory and power, especially when designing embedded systems which are fairly complex and require a lot of code. Of course, modern computers have powerful enough capability to handle complex code, but they are pretty much expensive.
It is for this reason that engineers came up with assembly language, which is mid-level language. It is between machine language and high-level language, in terms of readability and execution. Programs written in assembly language, execute faster using less resources than a high-level language. But in case you are wondering why it is not popular yet, assembly language is still incredibly difficult, hence it is a laborious task to come up with assembly code.
Fortunately, almost every language used nowadays at least conforms to the syntax and general principles of the C language. In spite of it being slightly difficult to learn and less capable than most trendy programming languages, it is the most efficient high-level language when it comes to resource utilization, plus it runs faster. This is the reason why Arduino (the most popular and widely available microcontroller), uses it.
Microprocessors such as the Intel family of microprocessors and Raspberry Pi are more powerful, hence they can run other high-level languages. Raspberry Pi, a microprocessor designed specifically for embedded systems, is programmed in Python. FPGAs are programmed in VHDL and Verilog, while PLCs are commonly programmed in a language known as Ladder Logic, that looks like flowchart diagrams rather than normal lines of text.
Frankly, programming is just one aspect of embedded system development. One also has to design the interconnection of sensors and actuators that the embedded system will interact with.
The sensors and actuators might be connected externally, but they are extremely important to embedded systems, in a sense that they are considered a part of the system altogether. Sensors convey messages to the system while actuators perform specific actions based on those messages.
Communication is in form of signals, where different signal levels are interpreted by the system so that it relays instructions to the actuator, in the form of another signal.
Most sensors’ operations are based on the laws of physics. To illustrate this concept better, consider an obstacle avoiding robot. Its sensor can be an ultrasound transceiver, which transmits waves beyond the human hearing range and measures the time between which the transmitted wave and receival of the reflected wave.
This time is now used by the microcontroller to calculate the distance between the robot and a potential obstacle. The actuators are the motors attached to the wheels of the robot, and based on the information it had calculated previously, the microcontroller is able to change the speed and direction of the motors so that it can avoid the obstacle.
While this might seem like a complicated process, it is repeated over and over and at a very fast rate, so that the robot seems to move intelligently and avoid any barriers, without any human intervention. The same principle is applied in self driving automobiles (although these incorporate more sensors and communication protocols, such as LiDAR sensors and satellite GPS communication).
Then there is the aspect of signals, power and communication. It is common knowledge that electronic components are fragile, too much power and you fry them, too little and they don’t work.
When you have an interconnection of electronic devices, from integrated circuits to sensors to actuators, you have to supply each and every one of them with the right amount of power.
This is where interfacing comes in, since not all of them use the same power. Interfacing can be done using specially designed IC amplifier buffers and TTL (Transistor to Transistor Logic) ICs. In the case of microcontrollers, such as the famous Arduino, there are special designed boards, known as shields, that you can attach to the microcontroller and activate external components, such as motors, sensors and display units.
I had mentioned previously that computers communicate in ones and zeroes. Well, these binary digits are actually in the form of digital signals, where a one is represented by a specific voltage, say 5V.
A zero is represented by the absence of this voltage. The ones and zeros are relayed intermittently and fast, a timing source is fundamental to this setup.
Oscillators are normally used to provide the signals, through special circuits have been designed for this purpose such as clocks, flip-flops and timers. Thankfully, the signal conditioning setup is already embedded within most microcontrollers and microprocessors, so that you do not have to bother setting up your own oscillators, timers and such. (though some embedded system applications will require you to set up external signal conditioners.)
It must also be considered that signals from most sensors, and indeed the world, does not follow the conventional digital system (they are analogue in nature). Due to this, digital to analogue converters and analogue to digital converters are vital for proper operation.
If an embedded system cannot communicate with components in the outside world, it is pretty much functionless.
So far, I have only talked about communication with sensors and actuators. However, most embedded systems need to communicate with other ‘smart’ devices, such as other embedded systems, smartphones and computers. There are different communication protocols that can be implemented within the embedded system such as I2C, SPI, USB, UART, Bluetooth, even Wi-Fi among many. UART, SPI, and I2C communication protocols mostly have their circuitry connected within the processor itself, as with the signal circuitry.
In fact, I2C and SPI rely on the clocks to provide the timing signals hence known as synchronous communication. To have your system connect over the internet, shields designed for this purpose can be used such as the Arduino Ethernet shield. Some skills in computer networking could come in handy in configuring these devices to communicate over the internet.
As you can see, there is a lot that goes into embedded systems design. A lot of things are taken into account, improvements continue to be made, so as to enhance their advantages and improve their usability and availability, especially in this era of automation and increasing dependability of man on the computer.