Embedded System BCA
Embedded System BCA
RAM is also known as the ‘data memory’ and is volatile, which means that it stores
information only temporarily and is wiped clean when the power supply is turned
off. On the other hand, ROM is also known as the ‘code memory’ and is responsible
for storing the program code. It is non-volatile, storing system information even
when the power supply is turned off.
Timer and counter
Timers are used in applications requiring the creation of a delay before the
execution of a specific function by the embedded system. On the other hand,
counters are used in applications where the number of times a specific event takes
place needs to be tracked. Up counters count upward from the starting value to
0xFF, while down counters count downward to 0x00. Counters are integrated into
the system using register-type circuits.
Input/output
Input components allow other components within the larger interconnected
infrastructure to interact with the embedded system. For instance, a sensor helps
provide inputs for the system to process. Once processing is complete (for instance,
counting), the results are communicated to the required destination via the output
component.
Communication interface
Communication interfaces enable embedded systems to establish communications
with each other and other components within the larger system. Different interfaces
include USB, I2C, UART, RS-485, and SPI. For simple applications, communication
ports within the microcontroller are utilized, and ports can be externally installed in
case of advanced applications.
Electrical circuit
Depending on the application, embedded systems can contain customized electrical
circuits. Some of the basic components used in electrical circuits of embedded
systems are:
Printed circuit board (PCB)
The PCB is a crucial component within the electrical circuit of embedded systems. It
is a mechanical circuit board that uses conductive copper traces to link other
components electronically. Electronic circuits made using a PCB are more cost-
effective and operationally efficient than wire wrap or point-to-point configurations.
Resistor
The resistor is an electrical component primarily responsible for producing
resistance in the current flow. It reduces current flow in a calculated manner to
adjust signal levels. Motor controls and power distribution systems use high-power
resistors to dissipate more heat.
The resistor’s electrical function depends on its resistance; the greater the
resistance, the more resistance is created in the current flow. Resistors are
subdivided into fixed and variable, with fixed resistors changing their resistance
with temperature and variable resistors leveraged as sensing devices for light,
humidity, heat, and force.
Capacitor
A capacitor is an electrical circuit component with two terminals. It is mainly used
for energy storage and release as the circuit requires. While capacitors come in
various forms, most feature two electrical conductors separated using a dielectric
material. Capacitors are used for various applications, including smoothing,
bypassing, and filtering electrical signals.
Diode
A diode allows the current to flow in only a single direction. This component is
generally made of semiconductor materials such as silicon or germanium. It is
useful for applications such as switches, signal mixers, logic gates, voltage
regulators, limiters, clippers, gain control circuits, and clampers.
Transistor
In the electrical circuit, transistors are responsible for switching and amplification.
They come in two main types: metal-oxide-semiconductor field-effect transistor
(MOSFET), which is a voltage-controlled component with terminals such as source,
gate, and drain; and bipolar junction transistor, which is a current-controlled
component with terminals such as base, emitter, and collector.
Tank Circuit − The tank circuit consists of an inductance L connected in parallel with
capacitor C. The values of these two components determine the frequency of the
oscillator circuit and hence this is called as Frequency determining circuit.
Transistor Amplifier − The output of the tank circuit is connected to the amplifier
circuit so that the oscillations produced by the tank circuit are amplified here.
Hence the output of these oscillations are increased by the amplifier.
Feedback Circuit − The function of feedback circuit is to transfer a part of the
output energy to LC circuit in proper phase. This feedback is positive in oscillators
while negative in amplifiers.
The reset circuit in an embedded system is a circuit responsible for resetting the
microcontroller to its initial state. The reset circuit usually includes a reset button or
a reset pin on the microcontroller, which when triggered will cause the
microcontroller to restart its operation.
Reset Pin: There is usually a dedicated reset pin on the microcontroller for receiving
external reset signals. When this pin receives a reset signal, the microcontroller is
forced to restart and zero out or set its internal state to a predefined initial state.
RESET CIRCUIT: The reset circuit usually consists of a resistor, capacitor and/or
voltage regulator used to generate an appropriate reset pulse signal. This signal is
passed to the reset pin of the microcontroller to trigger a reset operation.
Reset Vector: During a reset, the microcontroller jumps to a specific reset vector
address from where it starts executing the initialization routine. This vector address
is usually fixed and determined by the manufacturer of the microcontroller.
A microcontroller reset circuit is a very important part of a microcontroller system,
its main function is to change the power supply voltage to the microcontroller from
high to low so that the microcontroller can start working again. A microcontroller
reset circuit usually consists of a resistor and a switch. When the switch is pressed,
the resistor is energized to change the supply voltage to the microcontroller from
high to low, thus enabling the reset operation.
A motor is a device that converts electrical energy to mechanical energy. There are
different types of motors based on their applications and outputs. The main
principle behind the working of any motor is the magnetic effect of an electric
current.
In this article, you will learn the working principle and applications of Ac, DC and
Special motors.
Types of Motor
1. AC motors
2. DC motors
3. Special motors
AC Motors
AC motors run on alternating current supply. It has a much wider use and
applications in the industry than DC motors. The basic parts of AC motors are a
stator and a rotor. A stator is the stationary unit of an AC motor that produces the
magnetic field required to drive the rotor while the rotor is responsible for the
delivery of rotational motion.
AC motors are majorly divided into the following categories:
1. Synchronous motors
2. Induction motors
o Synchronous Motors
In this type of motor, at a steady state, the stator moves at equal frequency with
the electric current supply and its rotational period is equal to the AC cycles. Their
rotation accuracy level is high and are generally used in automobiles, robotics and
electronics industries.
o Induction Motors
Induction motors are also known as asynchronous AC motors. The electric current in
the rotor that produces torque is obtained by electromagnetic induction from the
magnetic field of the rotor. There are two types of induction motors – single-phase
induction and three-phase induction
Speaking of the working principle of induction motors, a double excitation is
required to make the DC motor rotate. According to Faraday’s law of
electromagnetic induction, the rotor winding is arranged in such a way that a short
circuit is produced via brush arrangement. The stator is of such type that it reduces
the loss of eddy current or any hysteresis losses. The rotor flux lags with respect to
the stator flux and torque will be required to make the magnetic field rotate in the
direction of the electric field and this is the working principle of both single and
three-phase induction motors.
Any motor that converts direct current and converts into electrical energy is known
as a DC motor. Most DC motors already have an internal mechanism. The main
working principle of a DC motor is Fleming’s left-hand rule. It states that if a current
carrying conductor is placed in a magnetic field, it will experience torque and
eventually move, which is also known as the motoring action. The direction of
rotation depends on the direction of the current. Therefore, if the direction of
current reverses so does the rotation of the motor.
1. DC shunt motor
2. Separately excited motor
3. DC series motor
4. PMDC motor
5. DC compound motor
6. Brushed motor
Let’s summarize the types of DC motors
Special motors refer to the term where any motor other than the general purpose
motor has its special operating capacity by customisation or manual design. There a
various types of special motors , which are as follows :
1. Stepper motor
2. Brushless DC motors
3. Universal motor
1. Stepper motor – It offers angle step revolution than that of a stable revolution
and its revolution angle is 180 degrees. But in the total revolution cycle, the
stepper motor goes through stepwise motion, every eighteen times per 10
degrees. It is a brushless synchronous type of electric motor , the working
principle of a stepper motor is closely related to that of a switched reversed
motor, here the rotation is purely controlled by the number of pulses received
2. Brushless DC motor – In this type of motor, the coils are not placed on the
rotor. Instead, the rotor itself is a permanent magnet. The rotation is
achieved by changing the direction of the magnetic field by stationary coils.
To control the rotation, only the magnitude of and direction of the current
moving in these coils needs to be controlled.
3. Universal motor – Its working principle is identical to the DC series motor.
They are known as universal motors because they have the capacity to
operate in both AC and DCsupplies.
Application of Motors
Following are the applications of motors.
These applications mentioned above are a few of the many uses of motors. Overall,
they show a wide range of different power and lengths, depending on the type of
motor and the requirement.
An H-bridge is built of four switches that control the flow of current to a load. In the
image above, the load is the M connecting the two sets of switches. Using one
current source, you can drive current in two directions by closing two switches.
If Switch 1 and 4 are closed, then the current will flow from the left to right on this
image:
The H-bridge configured to have switch 1 and switch 4 closed.
If you close switch 1 and switch 4, the current will flow from the source, through
switch 1, and then through the load, then through switch 4, and then back to the
load.
In the image above, the circuit has Switch 2 and switch 3 closed. This will cause the
current to flow from the source, through switch 3, and then through the load, then
through switch 2, then back to the load.
One thing you have to be very cautious about when working with H-bridges is to not
create a short circuit. If you create a short circuit, that’s a sure way to burn out your
H-bridge. I may have burned out my very first H-bridge at Digilent. Good thing I
learned that lesson for all of you!
If you drive current and close two switches in series, for example, switch 3 and 4 in
the image below, you will cause a short and burn out the H-bridge. As they say,
don’t burn bridges!
So an H-bridge is just a way to control current direction with switches, but why is
this useful?
What is Arduino?
With the increasing demand for programming, there was a need for a device that
could program electrical devices therefore, Arduino was introduced. Arduino is a
board made up of several interconnected components like microcontrollers, digital
pins, analog pins, power supplies, and crystal oscillators which give Arduino the
ability to program electronic instruments. You must be familiar with the idea that
an Arduino board can be programmed to illuminate an LED. The Arduino has its
hardware and software using which it can program devices. Let us take a look at
the Arduino board.
Arduino Board
Brackets
There are two types of brackets utilized in Arduino coding, as given below:
Parentheses: When writing a function in IDE, the parentheses brackets are used
to include the argument parameters, such as methods, functions, or code
statements. In addition to this, the bracket is also used for defining the
precedence order while dealing with mathematical equations. These brackets
are represented by '( )'.
Curly Brackets: Curly brackets are used to open and close all the statements in
the functions or out of the functions. Note that a closed curly bracket always
follows the open curly bracket in the code for proper layout. These brackets are
denoted by '{ }'.
o Open curly bracket- ' { '
o Closed curly bracket - ' } '
Line Comment
There are two types of line comments, let us study them individually:
Single-line comment: As the name suggests, the single lines that follow two
forward slashes are known as single-line comments. These statements are
known as comments because the compiler ignores all the characters that come
after two forward slashes in a single line. Comments are hidden when the
output is presented. Comments are added for the sole purpose of
comprehension of the code and for writing necessary information for user
reference.
// This is a comment
Multi-line comment: The single line comment extends to one line and the Multi-
line comment is used for adding comments in multiple lines. The syntax is a
forward slash followed by an asterisk symbol (/*), ending with a */. It is mostly
used for commenting larger text blocks that are not interpreted by the compiler
and solely for reference purposes of users.
/ * This is a multiline comment*/
Coding Screen
If you open the coding screen of your IDE, you will realize that it is divided into two
sections namely, setup() and loop(). The setup segment is the first block and is
implemented first for preparing the necessary environment needed for running
other commands. This coding screen is shown below:
Co
ding Screen Image Credit-Arduino IDE:https://www.arduino.cc/en/software
It is important to note that the setup and loop blocks must have statements that
are enclosed within curly brackets. Depending on the type of project you are
working on, you can initialize the setup in setup() and define other necessary
statements in the loop() block. Let us study each section individually
For example
void setup ( ) {
Coding statement 1;
Coding statement 2;
Coding statement n;
}
void loop ( ) {
Coding statement 1;
Coding statement 2;
Coding statement n;
}
Setup
Setup contains the very beginning section of the code that must be executed first.
The pin modes, libraries, variables, etc., are included in the setup section so that
no problem occurs when the remaining code runs. It is executed only once during
the uploading of the program and after resetting or powering up the Arduino
board.
Zero setup () resides at the top of each sketch. When the program runs after
completion, it heads towards the setup section to initialize the setup and include
all the necessary libraries all at once.
Loop
The loop contains statements that are executed repeatedly. Unlike, the setup
section there is no restriction on running this code once, it can run multiple times
according to the value of variables.
Time
The basic unit of measuring time in Arduino programming is a millisecond.
1 sec = 1000 milliseconds
Timing adjustments can be made in milliseconds. A better explanation for this can
be that a 2-second delay corresponds to 2000 milliseconds.
Example
A simple example of blinking the LED using Arduino is considered.
The steps are:
1. Go to the menu bar. Click on the File button in the bar.
2. Click on the Examples in the menu bar.
3. Click on the Basics option.
4. You will see Blink, click it.
Note: The pinMode will be the main function in the void setup() and digitalWrite( )
and delay ( ) will be the main function in the void setup()
PinMode ( )
The pinMode() function assigns a specific PIN as either INPUT or OUTPUT.
The Syntax is:
pinMode (pin, mode)
Pin: It is used to specify the PIN which depends on the project requirements.
Mode: Depending on whether the pin is taking INPUT or OUTPUT, it specifies the
pin's function.
Let's consider a situation to understand the pinMode. We want to take input from
the PIN 13 and then,
Code:
pinMode (13, INPUT);
PinMode in OUTPUT mode
Setting pinMode to OUTPUT is important for some pins. This mode allows the
specified PIN to supply sufficient current to another circuit to activate the sensor
or light the LED. When set to OUTPUT, this pin goes into a very low impedance
state, making the current useful. It is important to note that excessive current or
short circuits between pins can damage the Atmel chip. This explains the need for
setting the mode to OUTPUT.
PinMode in INPUT mode
When digitalWrite() is used, selecting the INPUT mode for any pin turns off the low
state and sets the high state as the ultimate state. The INPUT mode can be
employed alongside an external pull-down resistor. For this purpose, pinMode
should be set to INPUT_PULLUP. This configuration reverses the behavior of the
INPUT mode. In INPUT_PULLUP mode, a sufficient current is provided to light an
LED connected to the pin dimly. If the LED emits a dim light, it signifies that this
condition is operational.
Given these considerations, it's advisable to set the pin to OUTPUT mode to ensure
proper functionality.
digitalWrite( )
The digitalWrite( ) function is used to decide the value of the pin. It can be set as
either of the two values, HIGH or LOW.
HIGH: For a board that is supplied with a maximum of 1V, it results in a 5V value
whereas on a board with other values like 6V, it updates the value to 6V.
LOW: It sets the pin to the ground by setting a reference of 0V.
If no pin is set with pinMode as OUTPUT, the LED may light dim.
The syntax is:
digitalWrite( pin, value HIGH/LOW)
Pin: We can specify the PIN or the declared variable.
Let's understand with an example.
Example:
digitalWrite (6, HIGH);
digitalWrite (6, LOW);
The HIGH will be used for setting the pin at number 6 high and it will ultimately
turn on the LED if connected to this pin while, the LOW will be used for setting the
pin at number 6 low and it will ultimately turn off the LED if connected to this pin.
delay ( )
The delay() function serves as a tool to halt program execution for a specified
duration, measured in milliseconds. We have seen how delay(5000) signifies a
stop of 5 seconds.
This can be understood by the fact that 1 second equals 1000 milliseconds.
Code:
digitalWrite (12, HIGH);
delay (5000);
digitalWrite (12, LOW);
delay (2000);
The program here is that the LED is connected to the pin having PIN 12 and it will
remain lit for 5 seconds before turning and then will go off. The LED will then be
turned off for 2 seconds as specified by delay(). This cycle will continue in a loop
depending on the defined variables within the void loop() function.
Solved Example
Let us try to code the control of the LED on PIN 12, by designing it to
remain ON for 3 seconds and remain OFF for 2.5 seconds. Here is the
code
Pseudocode:
Firstly, we will need to set a particular pin as the output pin therefore, we will set
the pin number 12 as the input in setup() block.
Then we need to set the pin number 12 high using the digitalWrite() function.
Then we use the delay() function to keep the LED on for 3 seconds.
Then we need to set the pin number 12 low using the digitalWrite() function.
Then we use the delay() function to keep the LED off for 2.5 seconds.
Code:
void setup () {
pinMode ( 12, OUTPUT); // to set the OUTPUT mode of pin number 13.
}
void loop () {
digitalWrite (12, HIGH);
delay (3000); // 3 seconds = 3 x 1000 milliseconds
digitalWrite (12, LOW);
delay (2500); // 2.5 seconds = 2.5 x 1000
milliseconds
}
Application of Arduino
Arduino finds its applications in various fields due to their ability to perform
different things. Let us see some of its applications:
Arduinos are used in 3D printing where they perform the task of selecting how
the printing will be performed.
Arduinos are used for creating basic designs by makers, designers, hackers,
and creators across the globe to create some great projects. Some of the
projects are Laser Turret Midi Controller, Retro Gaming With an OLED Display,
and Traffic Light Controller.
Arduinos are used in the field of robotics for programming robots and adding
basic features like sensing and responding to environmental conditions.
Arduino is used in IoT(Internet of Things) since it can collect information using
sensors. The collected data is then processed and transmitted for developing
various smart devices.