ES Module1
ES Module1
in
The memory of the system is responsible for holding the code. There are two types: Fixed
memory (ROM) is used for storing code or program. The user cannot do any modifications
in this type of memory. Common types used are OTP, PROM, EPROM, EEPROM & Flash
memory. Temporary memory (RAM) is used for performing arithmetic operations or control
algorithm executions. Common types used are SRAM, DRAM and NVRAM.
Memory for implementing the code may be present on the processor or may be
implemented as a separate chip interfacing the processor. In a controller based embedded
system, the controller may contain internal memory for storing code and such controllers
are called Micro-controllers with on-chip ROM, eg. Atmel AT89C51.
Core of the Embedded System
The core of the embedded system falls into any one of the following categories:
1. General Purpose and Domain Specific Processors:
o Microprocessors
o Microcontrollers
o Digital Signal Processors
2. Programmable Logic Devices (PLDs)
3. Application Specific Integrated Circuits (ASICs)
4. Commercial off-the-shelf Components (COTS)
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 6
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] [email protected]
DP G F E D C B A
Common Anode LED Display Cathode
Stepper Motor
Stepper motor is an electro mechanical device which generates discrete displacement
(motion) in response to dc electrical signals. It differs from the normal dc motor in its
operation. The dc motor produces continuous rotation on applying dc voltage whereas a
stepper motor produces discrete rotation in response to the dc voltage applied to it. Stepper
motors are widely used in industrial embedded applications, consumer electronic products
and robotics control systems. Eg: Paper feed mechanism of printer/fax makes use of
stepper motor for its functioning.
Based on the coil winding arrangements, a two phase stepper motor is classified into:
Unipolar: A unipolar stepper motor the terminals to which the coils are
contains two windings per phase. The connected. Figure shows a two phase
direction of rotation (clockwise or unipolar stepper motor.
anticlockwise) of a stepper motor is
controlled by changing the direction of
current flow. Current in one direction
flows through one coil and in the
opposite direction flows through the
other coil. It is easy to shift the
direction of rotation by just switching
Bipolar: A bipolar stepper motor contains single winding per phase. For reversing the
motor rotation the current flow through the windings is reversed dynamically. It requires
complex circuitry for current flow reversal.
The stepping of stepper motor can be implemented in different ways by changing the
sequence of activation of the stator windings. The different stepping modes supported by
stepper motor are explained below:
Full Step: In the full step mode both the phases are energized simultaneously. The coils
A, B, C and D are energized in the order, as shown in the Table.
Wave Step: In the wave step mode, only one phase is energized at a time and each coils
of the phase is energized alternatively. The A, B, C and D are energized in the order, as
shown in the Table.
Half Step: It uses the combination of wave and full step. It has the highest torque and
stability. The coil energizing sequence for half step is given in the Table below.
Coil Coil Coil Coil Coil Coil Coil Coil Coil Coil Coil Coil
Step Step
A B C D A B C D A B C D
1 H L L L
1 H H L L H L L L
2 H H L L
3 L H L L
2 L H H L L H L L
4 L H H L
5 L L H L
3 L L H H L L H L
6 L L H H
7 L L L H
4 H L L H L L L H
8 H L L H
Two-phase unipolar stepper motors are the popular choice for embedded
applications. The current requirement for stepper motor is little high and hence the port
pins of a microcontroller/ processor may not be able to drive the motor directly. Special
driving circuits are required to interface the stepper motor with microcontrollers. ULN2803
is an octal peripheral driver array available for driving a 5V stepper motor.
The following circuit diagram illustrates the interfacing of a stepper motor through a
driver circuit connected to the port pins of a microcontroller/ processor.
Port Pins A
M
Driver IC C
Microcontroller
ULN2803 B D
Vcc
GND Vcc
Optocoupler
Optocoupler is a solid state device to Optocouplers can be used in either input
isolate two parts of a circuit. Optocoupler circuits or in output circuits.
combines an LED and a photo-transistor
in a single housing (package). Figure
shows of an optocoupler device.
In electronic circuits, an optocoupler
is used for suppressing interference in
data communication, circuit isolation,
high voltage separation, simultaneous
separation and signal intensification, etc.
Figure illustrates the usage of optocoupler in input circuit and output circuit of an
embedded system with a microcontroller as the system core.
Vcc
Relay Coil
Relay Coil
Relay Coil
Single Pole Single Single Pole Single Single Pole Double
Throw Normally Throw Normally Throw
Open Closed
The Single Pole Single Throw configuration has only one path for information flow.
The path is either open or closed in normal condition.
For normally open Single Pole Single Throw relay, the circuit is normally open and it
becomes closed when the relay is energized.
For normally closed Single Pole Single Throw configuration, the circuit is normally
closed and it becomes open when the relay is energized.
For Single Pole Double Throw Relay, there are two paths for information flow and
they are selected by energizing or de-energizing the relay. The Relay is normally controlled
using a relay driver circuit connected to the port pin of the processor/ controller. A
transistor is used for building the relay driver circuit. The following Figure illustrates the
same.
Vcc
Freewheeling Diode
Relay Coil
Load
Port Pin
Relay Unit
Piezo Buzzer
It is a piezoelectric device for generating audio indications in embedded applications. A
Piezo buzzer contains a piezoelectric diaphragm which produces audible sound in response
to the voltage applied to it.
Piezoelectric buzzers are available in two types: ‘Self-driving’ and ‘External driving’
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 16
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] [email protected]
Vcc
4.7K
4.7K
4.7K
4.7K
Row 0
To Microcontroller/processor Port
Row 1
Row 2
Row 3
Column 1
Column 0
Column 3
Column 2
To Microcontroller/processor Port
Communication Interface
Communication interface is essential for communicating with various subsystems of the
embedded system and with the external world. The communication interface can be viewed
in two different perspectives; namely;
Device/board level communication interface (Onboard Communication Interface):
The communication channel which interconnects the various components within an
embedded product is referred as Device/board level communication interface.
Eg: Serial interfaces like I2C, SPI, UART, 1-Wire etc. and Parallel bus interface
Product level communication interface (External Communication Interface): The
Product level communication interface is responsible for data transfer between the
embedded system and other devices or modules. The external communication interface
can be either wired media or wireless media and it can be a serial or parallel interface.
Eg: Infrared (IR), Bluetooth (BT), Wireless LAN (Wi-Fi), Radio Frequency waves (RF),
GPRS etc. (wireless) and RS-232, USB, Parallel port etc. (wired).
Onboard Communication Interfaces:
1. Inter Integrated Circuit (I2C) Bus
Inter Integrated Circuit Bus (I2C) is a synchronous bidirectional half duplex (one-
directional communication at a given point of time) two wire serial interface bus. The I2C
bus comprise of two bus lines:
Serial Clock (SCL line): Responsible for generating synchronization clock pulses.
Serial Data (SDA Line): Responsible for transmitting the serial data across devices.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 18
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] [email protected]
I2C bus is a shared bus system to which many number of I2C devices can be
connected. Devices connected to I2C bus can act as either 'Master' device or 'Slave' device.
'Master' device is responsible for controlling the communication by initiating/ terminating
data transfer, sending data and generating necessary synchronization clock pulses. Slave'
devices wait for the commands from the master and respond upon receiving the commands.
Synchronization clock signal is generated by the ‘Master’ device only.
Figure below shows bus interface diagram, which illustrates the connection of master
and slave devices on the I2C bus.
The sequence of operations for communicating with an I2C slave device is listed below:
1. The master device pulls the clock line (SCL) of the bus to 'HIGH '
2. The master device pulls the data line (SDA) 'LOW', when the SCL line is at logic 'HIGH'
(This is the 'Start' condition for data transfer).
3. The master device sends the address of the 'slave' device to which it wants to
communicate, over the SDA line. Clock pulses are generated at the SCL line for
synchronizing the bit reception by the slave device.
4. The master device sends the Read or Write bit according to the requirement.
5. The master device waits for the acknowledgement bit from the slave device whose
address is sent on the bus along with the Read/ Write operation command.
6. The slave device with the address requested by the master device responds by sending
an acknowledge bit over the SDA line
7. Upon receiving the acknowledge bit, the master device sends the 8-bit data to the slave
device over SDA line, if the requested operation is 'Write to device'. If the requested
operation is 'Read from device', the slave device sends data to the master over the SDA line.
8. The master device waits for the acknowledgement bit from the device upon byte transfer
complete for a write operation and sends an acknowledge bit to the Slave device for a read
operation.
9. The master device terminates the transfer by pulling the SDA line ‘HIGH' when the clock
line SCL is at logic 'HIGH' (Indicating the 'STOP' condition).
2. Serial Peripheral Interface (SPI) Bus
SPI is asynchronous bi-directional full duplex four-wire serial interface bus. It is a single
master multi-slave system. SPI requires four signal lines for communication. They are:
Master Out Slave In (MOSI): Signal line carrying the data from master to slave device.
It is also known as Slave Input/Slave Data In (SI/SDI).
Master In Slave Out (MISO): Signal line carrying the data from slave to master device.
It is also known as Slave Output / Slave Data Out (SO/ SDO).
Serial Clock (SCL): Signal line carrying the clock signals.
Slave Select (SS): Signal line for slave device select. It is an active low signal.
The bus interface diagram is shown in below figure, illustrates the connection of master
and slave devices on the SPI bus.
MISO
SCL
MOSI MOSI Slave 1
SCL SPI Device
Master
MISO (Eg: Serial
(Microprocessor/
SS\ EEPROM)
Controller)
SS1\
SS2\
MOSI
Slave 2
SCL
SPI Device
MISO
(Eg: LCD)
SS\
SPI Bus
The master device is responsible for generating the clock signal. It selects the
required slave device by asserting the corresponding slave device's slave select signal 'LOW'.
SPI works on the principle of 'Shift Register'. The master and slave devices contain a
special shift register for the data to transmit or receive. During transmission from the
master to slave, the data in the master's shift register is shifted out to the MOSI pin and it
enters the shift register of the slave device through the MOSI pin of the slave device. At the
same time, the shifted out data bit from the slave device's shift register enters the shift
register of the master device through MISO pin.
3. Universal Asynchronous Receiver Transmitter (UART)
UART based data transmission is an asynchronous form of serial data transmission. It
doesn't require a clock signal to synchronize the transmitting end and receiving end for
transmission. Instead it relies upon the pre-defined agreement between the transmitting
device and receiving device. Serial communication settings for both transmitter & receiver
should be set as identical. Start & stop of communication is indicated through inserting
special bits in data stream
The 'start' bit informs the receiver that a data byte is about to arrive. The receiver device
starts polling it’s 'receive line'. The UART of the receiving device calculates the parity of the
bits received and compares it with the received parity bit for error checking. The UART of
the receiving device discards the 'Start', 'Stop' and 'Parity' bit from the received bit stream
and converts the received serial bit data to a word.
For proper communication, the Transmit line (TX) of the sending device should be
connected to the Receive line (RX) of the receiving device as shown below.
4. 1-Wire Interface
1-wire interface is an asynchronous half-duplex communication protocol. It makes use of only
a single signal line (wire) called DQ for communication and follows the master-slave
communication model.
One of the key feature of 1-wire bus is that it allows power to be sent along the signal
wire as well. The 1-wire slave devices incorporate internal capacitor to power the device
from the signal line. The 1-wire interface supports a single master and one or more slave
devices on the bus. The bus interface diagram is shown below.
Vcc
4.7K
DQ Slave 1
Port Pin
1-Wire Device
(Eg: DS2760 Battery
GND
monitor IC )
Master
(Microprocessor/
Controller) DQ Slave 2
1-Wire Device
(Eg: DS2431 1024
GND GND
Bit EEPROM )
Every 1-wire device contains a globally unique 64-bit identification number stored
within it. The identifier has three parts: an 8-bit family code, a 48-bit serial number and an
8-bit CRC computed from the first 56-bits.
The sequence of operation for communicating with a 1-wire slave device are:
1. The master device sends a 'Reset' pulse on the 1-wire bus.
2. The slave device(s) present on the bus respond with a 'Presence' pulse.
3. The master device sends a ROM command. This addresses the slave device(s) to which it
wants to initiate a communication.
4. The master device sends a read/ write function command to read/ write the internal
memory or register of the slave device.
5. The master initiates a Read data/ Write data from the device or to the device.
All communication over the 1-wire bus is master initiated.
5. Parallel Interface
The host processor/controller of the embedded system contains a parallel bus and the
device which supports parallel bus can directly connect to this bus system. The
communication through the parallel bus is controlled by the control signal interface
between the device and the host. The control signals are read or write signals and device
select signals. The device becomes active by selecting host processor.
Direction of data transfer is controlled through control signal lines for ‘read’ and ‘write’.
An address decoder circuit is used for generating chip select signal for the device. When the
address selected is in the range, chip select line is activated by decoder circuit. If device
wants to start communication, it can inform the same to processor through interrupts. The
width of the parallel interface is determined by the data bus width of the host processor
(4bit, 8bit, 16bit, 32bit or 64bit).Parallel data communication offers highest speed for data
transfer. Figure below illustrates the interfacing of devices through parallel interface.
1 13
1 5
6 9 14 25
DB-25
DB-9
Bulk transfer is used for sending a block of data to a device. Bulk transfer supports
error checking and correction. Transferring data to a printer is an example.
Isochronous data transfer is used for real time data communication. In Isochronous
transfer, data is transmitted as streams in real time. All streaming devices like audio,
video make use of isochronous transfer.
Interrupt transfer is used for transferring small amount of data. Interrupt transfer
mechanism makes use of polling technique to see whether the USB device has any data
to send. Devices like Mouse, Keyboard make use of interrupt transfer.
USB supports four data transfers: Low Speed (USB 1.0: 1.5 Mbps), Full Speed (USB
1.1: 12 Mbps), High Speed (USB 2.0: 480 Mbps) & Super Speed (USB 3.0: 4.8 Gbps).
3. IEEE 1394 (Firewire)
IEEE 1394 is a wired, isochronous high speed serial communication bus. It is also known
as High Performance Serial Bus (HPSB). IEEE 1394 supports peer-to-peer connection and
point-to-multipoint communication allowing 63 devices to be connected on the bus in a tree
topology. It is a wired serial interface and can support a cable length of up to 15 feet for
interconnection. The 1394 standard supports a data rate of 400 to 3200 Mbits/second.
The IEEE 1394 uses differential data transfer which increases the noise immunity.
The interface cable supports 3 types of connectors, namely; 4-pin connector, 6-pin
connector (alpha connector) and 9 pin connector (beta connector). IEEE 1394 is a popular
communication interface for connecting embedded devices like Digital Camera, Camcorder,
Scanners to desktop computers for data transfer and storage.
4. Infrared (IrDA)
IrDA serial, half duplex, line of sight based wireless technology for data communication
between devices. Infrared communication technique makes use of Infrared waves of the
electromagnetic spectrum for transmitting the data. IrDA supports point-point and point-
to-multipoint communication, provided all devices involved in the communication are
within the line of sight. The typical communication range for IrDA lies in the range 10cm to
1 m.IR supports data rates ranging from 9600bits/second to 16MbpsSIR supports
transmission rates ranging from 9600bps to 115.2kbps.
IrDA communication involves a transmitter unit for transmitting the data over IR and
a receiver for receiving the data. Infrared Light Emitting Diode (LED) is used as the IR
source for transmitter and at the receiving end a photodiode is used as the receiver.
5. Bluetooth
BT is a low cost, low power, short range wireless technology for data & voice
communication. Bluetooth operates at 2.4GHz of the Radio Frequency spectrum and uses
the Frequency Hopping Spread Spectrum (FHSS) technique for communication. Bluetooth
supports a data rate of up to 1Mbps to 24Mbps and a range of approximately 30 to 100 feet
for data communication. Bluetooth communication has two essential parts; a physical link
part and a protocol part. The physical link is responsible for the physical transmission of
data between devices supporting Bluetooth communication and protocol part is responsible
for defining the rules of communication.
Bluetooth enabled devices contain a Bluetooth wireless radio for the transmission
and reception of data. Each Bluetooth device will have a 48 bit unique identification
number. Bluetooth communication follows packet based data transfer. Bluetooth supports
point-to-point (device to device) and point-to-multipoint (device to multiple device
broadcasting) wireless communication. A Bluetooth device can function as either master or
slave. A network formed with one Bluetooth device as master and more than one device as
slaves is known as Piconet.
Bluetooth technology is very popular among cell phone users as they are the easiest
communication channel for transferring ringtones, music files, pictures, media files, etc.
6. Wireless Fidelity (Wi-Fi)
Wi-Fi is a wireless communication the intended devices on the network. Wi-Fi
technique for networked communication of enabled devices contain a wireless adaptor
devices. Wi-Fi follows the IEEE 802.11 for transmitting and receiving data in the
standard. Wi-Fi is intended for network form of radio signals through an antenna.
communication and it supports Internet Wi-Fi operates at 2.4GHZ or 5GHZ of radio
Protocol (IP) based communication. Wi-Fi spectrum.
based communications require an
intermediate agent called Wi-Fi router
/Wireless Access point to manage the
communications. The Wi-Fi router is
responsible for restricting the access to a
network, assigning IP address to devices
on the network, routing data packets to
For communicating, the device when its Wi-Fi radio is turned ON, searches the
available Wi-Fi network in its vicinity and lists out the Service Set Identifier (SSID) of the
available networks. If the network is security enabled, a password may be required to
connect to a particular SSID. Wi-Fi supports data rates ranging from 1Mbps to 150Mbps
depending on the standards (802.11a/b/g/n). Depending on the type of antenna and usage
location (indoor/outdoor), Wi-Fi offers a range of 100 to 300 feet.
7. ZigBee
ZigBee is a low power, low cost, wireless network communication protocol based on the
IEEE 802.15.4-2006 standard. ZigBee is targeted for low power, low data rate and secure
applications for Wireless Personal Area Networking (WPAN). The ZigBee specifications
support a robust mesh network containing multiple nodes. ZigBee operates worldwide at
the unlicensed bands of Radio spectrum, mainly at 2.400 to 2.484 GHz and supports an
operating distance of up to 100 meters and a data rate of 20 to 250Kbps.
In the ZigBee terminology, each ZigBee device falls under any one of the following
ZigBee device category:
ZigBee Coordinator (ZC) / Network ZED ZED
Coordinator: It acts as the root of the
ZigBee network. The ZC is responsible for ZED
initiating the ZigBee network and it has
ZR
the capability to store information about ZR ZC
the network
ZED
ZigBee Router (ZR) / Full function ZED
Some microprocessors /controllers contain built-in internal reset circuitry and they
don't require external reset circuitry. Figure illustrates a resistor capacitor based passive
reset circuit for active high and low configurations. The reset pulse width can be adjusted
by changing the resistance value R and capacitance value C.
2. Brown-out Protection Circuit
Brown-out protection circuit prevents the processor/ controller from unexpected program
execution behavior when the supply voltage to the processor/ controller falls below a
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 29
[INTRODUCTION TO EMBEDDED SYSTEMS-BETCK205J] [email protected]
specified voltage. It is essential for battery powered devices since there are greater chances
for the battery voltage to drop below the required threshold. A brown-out protection circuit
holds the processor/ controller in reset state, when operating voltage falls below the
threshold, until it rises above the threshold voltage.
Figure illustrates a brown-out for Vcc. The values of Rl, R2, and R3 can
circuit implementation using Zener diode be selected based on the electrical
and transistor for processor/ controller characteristics of the transistor in use.
with active low Reset logic. The Zener
Vcc
diode, Dz, and transistor, Q, forms the
R1
heart of this circuit. The transistor
conducts always when the supply voltage V BE
R2
Vcc is greater than that of the sum of VBE Q
and Vz (Zener voltage). The transistor Reset Pulse
stops conducting when the supply voltage DZ Active Low
Vz
falls below the sum of VBE and Vz. R3
Microcontroller Microprocessor
C : Capacitor
Y : Resonator
Crystal Oscillator
Oscillator
Unit
Quartz Crystal Clock Input Pin
Resonator C C
Y Oscillator
Unit
Microoprocessor/
Controller
Watchdog
Free Running
Reset Pin
Counter
Watchdog Reset
System Clock