The typical jobs of temperature controller are ● Read the temperature value ● Display the temperature value ● Configure a set point for temperature value ● If the temperature is below th
Trang 1How To Start Learning Embedded Systems: A
Complete Roadmap
Trang 2
Are you looking for how to learn embedded systems?
Are you looking for a clear roadmap to start learning embedded systems?
Are you a complete beginner and need no-fuss clear guidance on studying and
experimenting with embedded systems?
We’re going to cover all above questions in this tutorial And we’re going to see a clear roadmap to start learning embedded systems We’re going to see what it takes for anyone
to get started with embedded systems and what is the flow that one can follow if he or she wishes to excel in learning and developing embedded systems.
This tutorial is specially created for complete beginners to give the simplest guide to start learning embedded systems quickly and understand all that is there to learn about it This tutorial will help you map your learning objectives based on where you are at this stage. Even if you’re in the middle of something like you understand little bit of Arduino
programming, this tutorial will help you shape your knowledge and is intended to provide guidelines to excel So lets get started.
Trang 3What is an embedded system?
An embedded system is a dedicated computerized system which can perform one
dedicated task or similar associated tasks Let’s take an example of a temperature
controller This type of temperature controller is very commonly used in wide variety of manufacturing industries The typical jobs of temperature controller are
● Read the temperature value
● Display the temperature value
● Configure a set point for temperature value
● If the temperature is below the set point, make the output device off
● If the temperature is above the set point, make the output device on
● Repeat the cycle
As you can see in above steps, its obvious that we do not expect an embedded system to stop functioning An embedded system is always running unless its power off or turned of
by the user So to create such simple system what are the options we have?
● Analog + Digital Design
● Embedded Design
Trang 4Analog Design
Now such a system like a temperature controller, can it be built using a simple analog
circuit? Yes off course it can be developed By using temperature sensor, analog to digital
converter, the seven-segment display drives and lot of conditioning circuits and digital
timer circuits We definitely can create such a system for temperature controller, but it
requires a lot of design efforts Moreover, if we want to change anything or any element of
this system, it’ll be very difficult to make changes as we’ll need to reconfigure lot of
component values itself Even if you want to add some time delay or some timed
operations, you’ll need to make lot of changes to the system So what is the option here?
The option is instead of creating a simple circuit design, make it using embedded system
principles.
Embedded Design
Trang 5An embedded design if very simple to build All it will consist of is the microcontroller unit which will do the job of sensor reading, display driving and output device (relay) switching. How it does all of this, how it prints value and how it reads the temperature sensor and all
is controlled by a software written inside the controller An embedded controller can not function directly as compared to normal analog or digital circuits Instead an embedded microcontroller needs a program written in its memory which will do the job of controlling the devices The microcontroller is a reconfigurable IC The pins of microcontroller can do the job of input or output or analog input and so on Depending on the software written, the pins of the microcontroller can behave differently In order to get excelled in
microcontrollers coding, we need to understand the microcontroller architecture After studying the microcontroller architecture well, we can start writing the programs for it But because of this big limitation, many people can not dive into embedded systems directly. And here the Arduino board comes into the picture In order to program an Arduino board
we do not need any knowledge of the underlying hardware which is called the
microcontroller Board We’ll discuss about the Arduino board in details soon.
How an embedded system is built?
So, a system which is built using this type of microcontroller as the heart of the system is called as an embedded system An embedded system has all the related input and output devices interfaced directly to the microcontroller or connected to it via some driver circuit Depending upon the application at hand, an embedded system may have few or all of the components shown in the below diagram.
Trang 6Just take a look at the above block diagram It’s a very simple block diagram of an
embedded system Mind well, when I say simple, it really is The block diagram hides
almost everything that is complex and gives a bird eye view of an embedded system The embedded systems block diagram shows mainly 3 components of embedded system. Inputs can be usually coming from switches, or sensors In the example of temperature controller, the inputs will be switches to accept the setpoint and the temperature sensor itself Just like, a plant watering system will have input as moisture level sensor.
Controller is the heart of an embedded system A controller’s job is to process the given inputs and generate outputs For a temperature controller, the job of the controller inside
is to read the temperature value, read the switches Now compare the temperature value with set point, and control output devices Controller cannot do any of these things out of the Box and every controller needs a software sitting inside it to do these things This
creates a demand for software programming in embedded systems.
Trang 7Microcontroller (if used) can only generate small signals as their output +3.3v/0v or +5v/0v
as output voltages These voltages are very small and cannot drive any output device
directly and hence we need something called as output driver for turning things on or off. Outputs of embedded systems are in form of below examples with their respective drivers
● LED On / Off (No Driver)
● Devices turning on / off (transistor + relay driver)
● Motors rotating with varying speed (motor driver)
● Buzzer On off and sound generation (no driver)
● Fan on / off (transistor / relay / thyristor driver)
● Sending SMS (GSM Module)
● Sending data over internet to for remote monitoring (wifi interface)
● Displaying data on a screen (LCD / LED screen interfacing)
● And many more such things
Trang 8Where Arduino fits in embedded Systems?
You’re reading this tutorial means one thing is sure, you’ve heard about Arduino 😊.
In an embedded system, generally, the most emphasis on study is given for understanding the controller The developer of embedded systems has to be very good at understanding the microcontrollers used in the system with all of their instructions and way of writing programs for them Every microcontroller is equipped with some or all of below-mentioned features which are used for properly programming an embedded systems
● Input / output ports
● Timers / counter
● Serial Ports
● Memory (RAM / Flash / EEPROM)
● Analog to Digital Converter
● Digital to analog Converter
● Protocols interfacing (I2C / SPI)
● Interrupts ( To make processing faster and solve programming challenges easily)
● And many such user interfaces are on-chip
Trang 9A single-chip microcontroller has all such features on the chip In order to use any of these
features, the microcontroller developer creates some unique way of configuring the
microcontroller.
● First, there are unique instructions for every microcontroller, which can execute
some job like reading / writing data from memory / Input-output ports / all the
registers inside the controller.
● Secondly, there are many special function registers inside the microcontroller And
each feature may have one or many Special Function registers inside the
microcontroller.
● The study of the Instruction set and all the internal register organization combinedly
is called a study of Architecture of microcontrollers
So every embedded systems developer has to be very good at an understanding of the
microcontroller architecture as well as the knowledge of inputs and outputs to be used.
Every electronics/computer engineering student usually learns this as part of their studies
and anyone else who is interested to excel in microcontroller studies has to study this on
their own One thing is sure that the proper understanding of microcontroller architecture
is a must.
But
What about those hobbyists/artists who don’t know about microcontroller and still want to
make embedded systems?
For exact people like these, who don’t want to study architecture and get started
developing systems faster and smoother, in 2005 Arduino boards were launched in Italy.
There is a long history behind Arduino boards which can be read here The sole purpose of
Arduino is to enable non-techie people to get started with designing hobby projects using
embedded systems.
But over the years, due to the open-source nature of the entire Arduino system, millions of
people started using it including seasoned developers for very simple reasons
● Lots of clean libraries available for almost every single interface out there
● Free and open source
● Quick prototyping is possible
● It’s cheap
As of writing this tutorial, Arduino is undoubtedly the number 1 hardware prototyping
platform And there is no need to take any survey on that Everyone will agree with this.
This is how Arduino slowly got adjusted in the crowded market of microcontrollers.
Trang 10But what is Arduino anyway?
Arduino is a microcontroller-based board that is ready for usage You don’t need to study the microcontroller architecture in order to use Arduino You just should be able to read the board; understand basic English and you can get started with programming Arduino. I’ve written a separate tutorial about it which can be found here
Steps to Learn About Embedded Systems
Trang 11
Now that we’ve gotten a fair idea of how to create an embedded system, lets jump to
understand how to learn embedded systems This will help you get a clear picture of how
to get started with embedded systems and embedded programming.
Understanding of basic electronics
The first thing then is to understand basic electronics Probably one of the most important points Everything we’re discussing here is electronics and hence having an understanding
of electronic components, their workings, and their usages will prove to be very beneficial
to learn embedded systems effectively Electronic components are used in entire
embedded systems development and hence you should know about them as much as you can But to get started, understanding of below-mentioned things is the first step.
Trang 12
Resistors are those tiny little electronics components that oppose the flow of electric
current Whenever we try to build a small circuit, if a resistor is added into that circuit, the job of a resistor is to resist (or oppose) the current flow.The value of resistance offered by a resistor never changes Resistors are passive components means it doesn’t matter in which direction you connect it in a circuit, it will work the same way By using resistors, we can limit the current flowing through a circuit As seen in previous tutorial, resistance offered by
a resistor is measured in Ohms (capital omega symbol Ω)
Trang 13
A capacitor (originally known as a condenser) is a passive electronic component having 2 leads Capacitor is used to store energy in an electric circuit There are different types of capacitors which are used But all them contain at least two electrical conductors plates which are separated by a dielectric i.e., insulator material The conductors can be thin films
of metal like aluminum foil The ‘nonconducting’ dielectric material helps increase the capacitor’s charge storage More about capacitor can be read at a very nice tutorial by adafruit here
Diodes
Trang 14
Diode is a unidirectional switch used in electronics Job of diode is to allow the flow of electricity in only one direction and blocking its flow in the other direction Most primarily, diodes are used in a rectifier circuit Rectifier circuit is used to convert AC voltage to DC voltage Rectifiers are used to create power supplies Apart from rectifier, diode is used in circuit protection and in variety of applications where this conduction in one direction property is needed More about it is here
In embedded systems, transistors are mostly used for switching purposes In analog
circuits like amplifiers and oscillators, transistors server different purpose It’s a simple 3 terminal device that comes as either PNP or NPN transistor Their properties differ on how they conduct electricity and how it can be controlled Transistors theory can be read here
Trang 15Switching devices: relays
Trang 16Understanding of basic C Programming
Trang 17Microcontroller is programmed using instructions This is called assembly language
programming In order to write effective programs faster, C programming is used A
separate software called cross compiler is used which can convert the C program to
microcontroller understandable code This microcontroller understandable code is then created in a special file format called a hex file This hex file is then burned or written in the permanent memory of a microcontroller called flash memory Microcontroller reads a program from flash memory and executes the program accordingly This whole process is called embedded C programming There are various Integrated Development
Environments for writing embedded C programming These IDE combine the cross
compiler of microcontroller and text editor to give a smooth coding experience to the programmer The choice of IDE depends on the microcontroller being used For example, Arduino uses the Arduino IDE Various other microcontroller uses different IDE tools Some
of them are free, some are commercial versions Here’s a shortlist of IDE’s used for various microcontrollers
AVR series microcontrollers by atmel (Now Microchip)
Trang 18● IAR Embedded Workbench
Your first microcontroller: Arduino
Now you got the idea of what all to study in embedded systems It's best to choose with Arduino if you’re a beginner Arduino provides easy access to microcontroller features with the help of ready-made libraries and software tools Using Arduino will be the first step to enter into the embedded systems world In order to study about Arduino, simply grab an Arduino board and start using it You can download your first C program to Arduino very fast, mostly within 5 minutes In order to use Arduino, you first need to install the Arduino IDE on your computer Arduino IDE can be found at arduino.cc Depending upon your
operating system you can download the appropriate and latest version of Arduino IDE.