EMBEDDED PRODUCT DESIGN - eConverge

stagetofuΤεχνίτη Νοημοσύνη και Ρομποτική

29 Οκτ 2013 (πριν από 3 χρόνια και 7 μήνες)

105 εμφανίσεις



































Engineering
Section

Embedded Design



Part 1: Building Blocks

L.S.Karandikar

May 2012

FEFA
*

Series

*

Free Education For All


An initiative by eConverge

FEFA/E00
3

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

PREFACE

Skip to CONTENTS


Design of intelligent electronic devices

(
IEDs
) is known as embedded design.


Designing a product around a microprocessor / microcontroller / DSP
makes it intelligent in so far as its precision, adaptability, use of memory,
user interaction, its ability to handle a variety of inputs from man /
machine and repeatable performance is c
oncerned. There is nothing truly
intelligent about it in the sense of human intelligence.


Intelligence permits
convergence of technologies
.

If you compare a cell pho
ne of 90s with a cell phone of today
, you will
notice the difference brought about by th
e enhanced intelligence embedded
in the device. The cell phone of the 90s was also an embedded device, but it
was just a phone with a capacity to store phone numbers and receive SMS
etc. Whereas the cell phone of 21st century, in addition to being a phone,

is
a camera, an Internet connection, a calculator, a notebook, voice recorder, a
watch, a music system, all rolled into one. Since the individual technologies
are built into embedded systems themselves, no wonder they could be
integrated.


The small ever
yday inexpensive optical mouse contains a digital camera
and a high
-
speed digital signal processor (DSP); the picture created on
camera chip changes as the mouse moves. The DSP measures the
movement of the picture and its direction, and communicates the ch
ange to
the computer on universal serial bus (USB). There are no moving parts in
this mouse; just the right intelligence embedded into it.


What is the logic behind deciding to develop such a device, especially when a
digital camera and a DSP are themselve
s expensive parts
?

When the idea was proposed, to an uninitiated mind it would have
appeared non
-
viable due to the use of costly parts. But technologist in the
field must have seen a gold mine in the form of this product. The cost of
silicon devices falls
at an amazing rate as volumes go up. A DSP device that
sells for Rs.1000 is available for Rs.50 when you buy 10,000 pieces! The
reason is simple: setting up production line is very expensive and material
cost is negligible in its comparison. Thus once the
line is set up for a device,
it can churn out a million pieces. The cost of setup is distributed over so
many pieces; that is the reason cost drops drastically when quantities are
ordered in tens of thousand. This is something like developing a steel die
Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

f
or a plastic box; the die may cost Rs.100000 but one can mould 100,000
boxes from it; the cost of die loaded on every box is Rs.1 and cost of plastic
material could be Rs.4, then the box is not very expensive. But if you want
to make only 1,000 boxes, the
cost of die loaded on each box is Rs.100!
Something more dramatic happens with silicon real estate.


When you integrate technologies you can sell more and the cost crashes.
Thus as long as numbers are high, cost of individual part is not important.
This gi
ves tremendous freedom to the designer, and the kind of features
that can be integrated into a product is only restricted by designer's
imagination and knowledge base and his ability to make right trade
-
offs.


Convergence of technology is not the only reason for embedding
intelligence into a product. In the industrial product scenario, there are
situations where
desired characteristics

can only be achieved by
embedding intelligence. For example when a controller

must respond in
accordance with a complex mathematical expression in a few milliseconds,
accurately, a DSP or a 16
-
bit microprocessor is about the only solution.
Here the volumes are not large, but
intelligence

is a necessity.


Sometimes
user convenience

is important in certain products, like in a
washing machine or a microwave oven. The volumes are not as large as in
IT products or communication products, but not as small as in industrial
products. A neat choice of intelligent parts addresses the issue.


User comfort

can be another issue that may be addressed by intelligence as
in automobile industry. The microcontroller in the car gives you the
comfort of power window, central locking, temperature and humidity
control, intelligent suspension, etc.


Safety

is another area in which IEDs are required. The alarms in the car, the
tire pressure alarm, temperature alarm, lube oil alarm, engine temperature
alarm are all controlled by several microcontrollers connected together on
CAN bus.


Security

is another area

which is flooded with IEDs
-

key less entry, finger
print recognition based entry, electronic identity cards using RF
interrogation, etc, and are just a few examples.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

The examples shown above were representative of certain well known
fields of application

of IEDs. There is no area that can escape the influx of
intelligent devices.


It requires a clear understanding of the technologies involved to be able to
design an IED


As noted in the preceding section, there is no end to the application areas of
IEDs.
Thus one must be fully conversant with the technology involved in
that field of application and must be aware of all kinds of intelligent and
peripheral parts available; one must fully understand technical issues
related to different parts available in the

same genre.


For example one wishes to make a handheld vehicle speed meter,
something used by cops. The technique used is, say Doppler Effect in
ultrasound. A handheld instrument is battery powered. You will have to
select a processor (CPU), display, tran
sducer etc which consume least
power. These components should at the same time be fast enough for your
purpose. You will perhaps need a battery charger also. The CPU will not
operate directly on the battery; you need to change the voltage using a DC
-
DC con
verter. An apparently simple thing like a battery charger is also a
complex device in such applications.

After selecting the components you must identify the correct algorithms
that satisfy the measurement speed requirement and you will have to
define the
data structure which suits that algorithm and make several
iterations.

You can see the kind of knowledge base you need to design this product.


A design engineer gets paid for the kind of trade offs he can make.


Every element in the ultrasound example m
entioned above, can be
designed in a variety of ways. If you look at the signal processing aspect,
there is a possibility that you can do some processing outside of the CPU
and some in firmware (inside the CPU). If you decide to perform
considerable signal

processing inside, you will require a very fast CPU. You
will have to perform some simulation study or use your previous
experience to determine the speed of CPU required for the task. A fast CPU
consuming low power can be pretty expensive. If you choose
to perform
considerable signal processing outside of the CPU then you will need
several components, this has its own design issues, space constraints,
Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

reliability questions etc.

You need to know a wide variety of CPUs and must be able to fully
understand
the implication of their parameters so that you can make the
most appropriate trade off and optimize the solution.

This is true with every other building block of the product.

The basic issue here is your ability to define the most appropriate
architecture

for your product.


Ability to verify conceptual design goes a long way into building a successful
product.


Conceptual design must be thoroughly verified by reviews before you
embark upon implementing the design. The distinction between an
architect and a

civil engineer is that architect makes a conceptual design,
which is verified by structural analysis methods and then a civil engineer
implements the design, be it a plaza, a road, a flyover, a railway bridge.

This applies to IED design also. There are se
ven important aspects to it:

One:


Electronic design

Two:


Firmware design

Three:


Interconnect design

Four:

Mechanical design

Five:


Board layout

Six:


Enclosure design

Seven:

Human
-
Machine interface design.

Each one of these seven aspects needs to

be reviewed and verified for
functional and performance acceptability even before ‘bending the metal’.
This means that each aspect must be rigorously examined before a board is
designed or a program is written or an enclosure is designed.


The Electronic
Design Automation (EDA) facility


How can you test an algorithm before writing the firmware into the
product?

How can you study the behavior of a circuit before the circuit is assembled?

How can you ensure that the components on different physical location
s of
the products don’t clash?

Simulation is the answer to all these questions.

You can simulate your algorithm on PC and see for yourself whether it
meets your specifications. You do not need the hardware of your product at
all; there is no question of pr
ogramming it.

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

You can use tools to simulate a circuit on the PC with actual parameters of
all components. Just prepare a circuit diagram, assign appropriate values to
different components, for all components you can ask the simulation
program to look up a
file, tell it what kind of inputs will be given and ask it
to drive this circuit. You will get the exact performance. It would have taken
you weeks to build and test the circuit, but with the simulation tool you can
completely test a circuit even before yo
u have any parts in your hand.

You can prepare a three
-
dimensional drawing on the PC using a mechanical
simulation tool, like ‘ProEngineer®’. You can move different parts relative
to each other in 3D and ensure that no part clashes with other parts on
boa
rd.

These simulation programs are known as ‘EDA Tools’.

In addition to simulation, EDA also covers emulation tools. These tools offer
a means of writing a program in some high level language, generally ‘C,
building a hex file, transferring the hex file to

the target board (target board
is the PCB of your IED) and testing target hardware. The program can be
modified if there are any bugs, like any other program in ‘C, re
-
compiled
and transferred to the target board again and the process repeats.

An emulato
r is made up of several functional parts:

[1] A software component, an
Editor
, to develop a program in a modular
form

[2] A
cross compiler

for the specific CPU

[3] Some hardware, an
emulator
, for PC to communicate with the CPU, and

[4] Another software component,
emulation software,
which accesses the
CPU to generate on
-
line report of the state of different functional blocks of
the CPU [this s/w is specific to a CPU].

This combination of s/w and hardware is known as ‘
Integrated
Deve
lopment Environment

(IDE)

.

Tools are available (for example, OrCad Capture®) for drawing a circuit
diagram (schematic) as discussed in simulation tools. A schematic is
converted into a board layout by a layout tool, invariably supplied by the
same vendor
(e.g. OrCad Layout®). When a PCB is laid out, it is possible to
analyze electromagnetic compatibility (EMC) of the circuit even before the
PCB is fabricated. Such software is available with most of the PCB design
packages. These packages also suggest appro
priate corrective action.

All these programs (and hardware) are referred to as EDA Tools.

One can not master all the tools, but one must have a good understanding
of the scope as well as limitations of every category of EDA tools.



Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Test Methodology of an
IED


A product is first conceived as a requirement, for example one may say ‘I
want a product that will automatically start a generator when power fails
and switch off the generator when power is restored’.

This requirement is translated into technical
specifications. Design phase of
a product starts only after it has been unambiguously specified in terms of
functionality, performance and statutory requirements.

These specifications are translated into a working product.


Once the product is simulated a
nd hardware is ready, we generally start
with emulation, which is really coding and de
-
bugging the IED.

When we test the product with the emulator in place, it is called W
hite box
testing
. Here the programmer performs the test in association with a test
e
ngineer, and makes corrections as errors are noticed.

This is followed by
Black Box testing
, in which emulator is removed; the
product is tested with the code running at full speed under simulated
conditions. The functional and performance tests are carrie
d out and a
report is generated.

If there are any deviations from specifications, emulator is connected again,
and errors are removed.

This cycle is repeated until the IED conforms to specifications.

This process is known as
verification
.


Verification is

always followed by
validation
.

Verification is a test that examines whether the product meets the given
specifications.

It is possible that the engineer misconstrued the requirement and hence
the specifications were wrong.

Validation is a test that exami
nes whether the product meets the original
requirement.

Passing a validation ends the design process.


International Standards for Testing of Products


There are several Standards Organizations which specify standard tests, for
example The Bureau of Indian Standards (BIS), The International Electro
-
technical Commission (IEC), The German Standards Organization (DIN) etc.
If a product complies with any of t
hese standards, we can expect a
reasonable performance from these products. There are customers who
Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

demand compliance to various tests as laid down by one of these
organizations before they buy a product.

A designer must know the standards to which his pr
oduct should comply so
that it will give desired performance in the target environment.
The
designer must take proper measures in design to ensure compliance.



There also exist standards for serial communication. The most common
among them are the Modbus,

Fieldbus, Profibus, IEC 60870, IEC 61850 and
DNP3.

Some standards exist for communication among IEDs, such as I
2
C and CAN
bus. A designer is required to be thoroughly conversant with one or more
of these standards and be able to implement such communicat
ion in the
IED.


A journey through the remaining of the courseware will lead you to acquire
the elements of what has been mentioned in the preceding paragraphs, if
you are inclined to and devote your attention and time with a practical
follow up.







Free

Education For All” is Our Social Initiative at
eConverge”


















Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in









CONTENTS


EMBEDDED PRODUCT DESIGN


Part 1: Building blocks of embedded design


[The building blocks are the circuits, software and firmware that go into making a
complete IED. At this point a variety of circuits, algorithms and sta
ndards are examined at
length.

This prepares a good foundation for the next part.]



Chapter1

Introduction

Chapter2

Power Supply

Chapter3

Signal Conditioning

Chapter4

Analog Filters

Chapter5

Digital Filters

& Digital Processing

Chapter6

Analog
-
to
-
digital Converters

Chapter7

Digita
l
-
to
-
analog Converters

Chapter8

Device Links

Chapter9

Serial Communication


Go to Preface










Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

CHAPTER 1

BACK TO CONTENTS

1.1

Introduction


An
I
ntelligent
E
lectronic
D
evice [IED] consists of a CPU, interfaces for
inputs and outputs which allow the CPU to acquire and deliver information
and some form of communication with other IEDs or data network. All
devices inside an IED require appropriate voltages at sui
table current
levels; these voltages are obtained from a specific power source with the
help of ‘power supply’ unit. Available voltage sources range from a single
pen light cell to a 230v AC mains power supply.


The CPU

A CPU could be a microprocessor,
microcontroller, Digital Signal Processor
or a set of these devices.


























Input Devices

Input devices can be very simple or quite complex.

Simple input devices are a keypad and a microphone in cellular phone, a
VCD drive in a VCD player, a joystick in a game station, a load cell in a Point
Fig
1.1

Conceptual System Block Diagram

Communication
D
evices

Personal
Computer






CPU

Power
Suppl
y

Serial Input
Interface

Serial Output
Interface

Parallel Input
Interface

Parallel
Output
Interface







Input


Devices






Output


Devices


Communication


Interface


IED


Device


Link

Memory

Emulation / Debug
Port

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

of

Sale (POS) terminal, a smoke detector in a fire alarm, a digital camera in
an optical mouse.

The variety is almost endless.

These devices may generate analog signals (microphone, load cell, smoke
detector, etc) or digital signals (keypad, joystick,
digicam etc) or a
combination of the two (VCD drive in above examples).


Input Filters

The analog signals are fed to signal conditioning circuits; these are
amplifiers, filters, phase locked loops etc. These circuits themselves may be
digitally controlled
or may contain digital blocks. Analog signals in some
cases may be converted directly to digital form (A/D Converter) and
processed digitally using digital filters. In such cases the CPU performs
digital filtering. However in most of the cases analog signa
l must pass
through some amplification stage. Even in the case it is fed to an A/D
converter, it must pass through an anti
-
aliasing filter and also through
some form of noise filter.


A/D Converter

In any case the signal must be eventually converted into d
igital form before
being handled by the CPU.

The signal in digital form can be in parallel format or it can be in serial
format; in some cases it is in the form of a series of parallel data.


Output Devices

Simplest output devices are alpha
-
numeric read ou
t on a liquid crystal
display (LCD) as in a cellular phone, personal digital assistant (PDA), a
speaker as in a digital music system or a cellular phone, an alarm as in a
washing machine, a door latch as in a ATM booth etc. Some of the outputs
are analog o
thers are digital.


D/A Converters and Output Filters

The CPU needs interface to drive the output devices. The interface involves
converting digital signals into analog signals (D/A Converter) and bringing
those analog signals in the appropriate form suita
ble for analog output
devices. A D/A converter may be an analog filter as in the case of a PWM
output decoder, a high speed digital circuit and analog filter as in the case
of digital music system.

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Output Drivers

Some output devices need digital data in pa
rallel format (LCD) and some
others in serial format (recorders). The interface may pick up data from
CPU in serial format or in parallel format and deliver it to the output device
in its desired format. Sometimes the power required to drive the output
dev
ice is beyond the capacity of a CPU, in such cases a power driver is
required as in the vibrator of a cellular phone or motor of a washing
machine.


Device Links

Some devices in the IED communicate with CPU on a serial bus (I
2
C bus).
Sometimes an IED has s
everal CPUs; these CPUs communicate with each
other on serial bus (Control Area Network [CAN] bus). In such cases the
CPU generally has built in interfaces for such device links.


Communication Interface

Most of the IEDs are required to communicate on stan
dard data
communication buses or links, e.g., RS485, RS 232,
and CAN

etc. The RS232
permits communication on commonly available public networks like PSTN,
ISDN, and GSM etc. with the help of appropriate modems. The RS485 bus
permits the connection of IED o
n the (Supervisory Control and Data
Acquisition System (SCADA) commonly used in power system
environment, CAN is excellent in device
-
to
-
device communication in
extremely inclement environment, like the one under the hood of an
automobile.


Power Supply

Dif
ferent components, which make up an IED, need different voltages. The
CPU may operate at 3.3Vdc/10mA, a LCD module may operate at
5Vdc/20mA, and electromechanical relays may need 24Vdc/20mA. The
available power source may be the domestic outlet of 230Vac o
r a 9V
battery. All the voltages required inside the IED must be developed at the
right current levels using some form of switch mode power supply (SMPS).
SMPS offers a very high efficiency as compared to a linear power supply
and is also much smaller in s
ize and weight compared to the linear supply.
High efficiency increases battery life if the source is a battery, reduces
amount of heat dissipated, thus keeping the inside of the IED cool, and low
weight is always an advantage from the point of view of car
rying, packaging
or transporting it.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

1.2

The Requirement Statement


Design of an IED is a response to a requirement statement. The user does
not necessarily give or is competent to provide technical specifications. The
user simply gives a requirement statement.


Let us see what requirement statement means and how it is di
fferent from
specifications.


“I need a gadget which can switch on or off a room heater, an air
-
conditioner
and a geyser when I so command from my mobile phone”.


If you decide to design such a gadget you will have to develop preliminary
specifications. Ba
sed on such specifications you will explain the detailed
functions and method of use to the user. The user may suggest some
change in functionality or give you some more data to incorporate. Based
on your interactions with user [
user feedback
] you may be r
equired to alter
the specifications.


Having frozen the specifications, you design the product: implement it in
hardware and software [prototyping]. Then test the product to see if it fully
meets the specifications. If it does, then you give the prototype
to the user.
The user, who has nothing to do with technical specifications, merely uses
the product and tells whether it fulfils the requirements set out originally
and elaborated subsequently via user feedback.


The functional and performance tests you ca
rried out at your end are
known as “Verification” and the trial by the end user is called “validation”
in terms of ISO9001:2000 quality standard. If validation is successful then
design is through.


Then you prepare a “User Manual”, a catalog or “Operation

Manual” for the
product and transfer the technology for manufacture.


The process described above is not a complete description of a standard
quality process but it does give a first glimpse of the “business process”.


In ISO parlance any activity that receives input [s], processes it and
produces an output [s] is a
business process
.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

1.3

Breaking down the Requirement Statement


You must see the user requirement more closely before you can develop
specifications. The fir
st step is, visualize the whole operation.

1.

The user makes a call

2.

It is received by the gadget

3.

The gadget responds by picking up the phone

4.

Then it waits to receive a function code

5.

Based on the function code, the gadget turns on or turns off one of the
three

things: a room heater, an air
-
conditioner or a geyser

6.

It tells the user that it has accomplished the task [or reports failure]


Let us prepare a block diagram in order to visualize the building blocks of
the gadget.














The gadget itself requires a block diagram description.











Air
-
Conditioner

Phone


Line

Gadget


Geyser


Room Heater

Mains

Supply

Fig 1.2 Block Diagram of the gadget

S1

S2

S3

Modem

CPU

Relay

Driver

Power

Supply


Mains


Supply

Phone


Line

Relays

Fig 1.3 Functional description of the gadget

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

The first four requirements cited above are implemented in the modem.
CPU interfaces with modem to receive data from the user and then

based
on that data CPU initiates action in the form of switching a device on or off.

Since CPU can not drive a relay directly, a relay interface is required.


The mains supply in India is 230 VAC and it fluctuates between 170VAC
and 270 VAC. It also carr
ies considerable harmonics and noise. The power
supply block in figure 1.3 must take into account this information. This
information is not supplied by the customer / user.


In addition to quality of power supply there is also the issue of erratic
availabi
lity of supply; breakdown in mains supply system are frequent.


Let us examine the following situation:


Mains supply is available and the user sends command to switch off a room
heater. Before the command can be processed, power fails and returns
after 1
5 minutes. User does not know that the command has not been
implemented. He does not send the instruction again. When power returns,
heater becomes active and remains so since there is no further command to
switch it off.

If your design does not handle th
is situation effectively, then you are not
truly meeting the expectations of the user.


What will you do to incorporate the ‘expectations’ in ‘spirit’?


One option is you design your power supply in such a way that DC power to
electronic modules stays well

after mains failure. Your system should be
able to detect mains failure. Your gadget should send an SMS to the user
about power failure during the short period the DC power is available to it.


There is another variant of the above approach: instead of [o
r in addition
to] sending an SMS to the user, your gadget should write the command in
EEPROM if it detects an impending power failure. As and when power is
restored, it reads the EEPROM and executes the stored command.


Thus you see that unsaid words have
an effect on the architecture of your
product.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

The movement from user requirement to deciding the specifications
is an arduous journey and requires a good understanding of the
application as well as that of application environment.


Embedded product
design goes far beyond design implementation; it involves
seeing the spirit of the application, developing strategy to meet stated and
implied behavior and building the architecture consistent with needs.


1.4

Defining the detailed behavior of product


The gadget in our example has two inputs: A telephone line and a power
supply line. It has three outputs in the form of electromechanical relays.


It receives power to work from power line and receives commands from
telephone network. It is capable of dete
cting power failure and has the
hardware that provides it necessary power for a short period during which
it writes unexecuted commands [if any] into non
-
volatile memory
[EEPROM]. On power up it looks for pending command within EEPROM.
That command is exec
uted and deleted from memory.


A modem, also powered by the gadget, is interposed between telephone
line and gadget. Modem responds to incoming calls by going off
-
hook etc. It
also sends received data to the gadget.


Data is organized thus: {[Appliance ID]

[Action]}


Appliance ID can take any one value as given below:

Appliance


Appliance ID

Room heater


H

Air Conditioner


A

Geyser



G


Action can be either ‘1’ [for on] and ‘0’ [for off].


The product does not talk back to the user on phone in any form.


Ex
ample
: If the string received is ‘A1’ then A/C is switched on.


The gadget works on AC voltage in the range of 170 VAC and 270 VAC. It is
not affected by harmonics in the supply or noise.

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in


It complies with IEC standards for EMI/EMC and safety standards
c
ompliant with EU norms.


1.5

Customer feedback on the detailed behavior of product


The product behavior described above must be discussed with the
customer and his comments must be recorded. If customer needs any
changes then one may work out the
possibility of implementing the
changes at this stage [and not beyond this stage].


Suppose the customer wants the following changes:

1. Gadget should give him feedback through SMS regarding

a.

On demand current status of the three devices [H /A / G] and pow
er

b.

As in ‘a’ but after executing the command

2. A battery back up for 8 hours for the gadget and modem is also required.

3. Rechargeable battery should be used for above purpose.


You do not need extra hardware to talk, so the first requirement is
accept
able right away.


The second requirement implies extra space and a different kind of power
supply than you imagined. But there is no difficulty in accepting it; however
you need to tell the customer that it would be a more expensive design than
without thi
s feature.


When customer talks about a re
-
chargeable battery, he will also expect a
battery charger as an integral part of the product or as an accessory. You
must find out whether he wants charger as an integral part of the product
or as a separate unit.

[You must have noticed that a rechargeable flash light
has an inbuilt charger]. This decision shall affect the design in terms of
architecture, size and cost.


It is finally decided comply with the three customer requirements and that
the battery charger
is not a part of the product and not in the scope of
present design.


So you return to your document as in §1.4 above. In this document you
include the communication functions and a re
-
chargeable battery thus:


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

1.

The gadget in our example has two inputs:
A telephone line and a power
supply line. It has three outputs in the form of electromechanical relays.


It receives power to work from power line and receives commands from
telephone network. It is capable of detecting power failure and has the
hardware t
hat provides it necessary power for a short period during which
it writes unexecuted commands [if any] into RAM. On power up it looks for
pending command within RAM. That command is executed and deleted
from memory.


A modem, also powered by the gadget, is

interposed between telephone
line and gadget. Modem responds to incoming calls by going off
-
hook etc. It
also sends received data to the gadget and sends the data received from the
gadget to the user’s mobile phone.


Data is exchanged in standard PDU [Pro
tocol Data Unit] format.


Data is organized thus: [Function] {[Appliance ID] [Action]}


Function: can take any one value as given below:

Report Status

R

Control


C


If Function = R then string shall not contain Appliance ID or Action.


Appliance ID can
take any one value as given below:

Appliance


Appliance ID

Room heater

H

Air Conditioner

A

Geyser


G


Action can be either ‘1’ [for on] and ‘0’ [for off].


The product sends an SMS to the user on phone as follows:


[H][Status][A][Status][G][Status][P][Stat
us]

Where H, A, G have the same meaning as defined above.

P stands for ‘Power’.

Status can be either ‘1’ or ‘0’ for ‘ON’ and ‘OFF’ respectively.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Example: User to gadget: If the string received is ‘CA1’ then A/C is switched
on.

Example: Gadget to user: I
f the string sent is ‘H1A0G0P1’ it would mean that
the heater and power are ON whereas A/C and geyser are OFF.


2.
The gadget works on AC voltage in the range of 170 VAC and 270 VAC. It
is not affected by harmonics in the supply or noise.


3.
The gadget
has a battery back up and no EEPROM.


4.
Battery is re
-
chargeable Ni
-
MH 8.4V 1300 mA
-
h.


5.
It complies with IEC standards for EMI/EMC and safety standards
compliant with EU norms.


The above information is communicated to the customer for approval.

This d
ocument then becomes the basis for developing technical
specifications.




1.6

Generating product specifications


You already have a block diagram in fig.1.3. It is reproduced below with
major changes. The relay driver and relay blocks have been merged int
o
one block named ‘Optocoupled Relays’. This results from the fact that now
our product is battery powered and we must minimize current
consumption. Optocoupled relays need a very small current for their
operation, typically

3
mA. These devices are driven d
irectly by the CPU.
There is no electrical [
Ohmic
] connection between CPU and relay.


Let us take a look at the block marked CPU. This will contain CPU, voltage
supervisor, crystal, RS232 driver.


The basic requirements of the CPU are:

1.

One USART

2.

Three
I/O pins for relay control

3.

One I/O pin for sensing mains status

4.

Low power consumption [as low as one can get].


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

It is not going to require large program memory since functions are simple
and few. RAM requirement will depend on the PDU size. The actual data

to
be sent is very small. There is no requirement of execution speed.


Almost any CPU will do for the first three requirements.


The fourth requirement is important. We need to locate a CPU that
consumes least power.


At a latter stage we shall see in
detail how to select a CPU. For the present
we have several choices:


MSP430F122 [Texas Instruments]


89LP2051 [Atmel]

These devices draw less than 5 mA and meet all other specifications.












Total current consumption will be 25mA:

CPU:




4mA

Optocoupled relays:

9mA

RS232 Interface:



10mA

Others:




2mA

CPU
operates at 3.6V if we choose MSP430F122.

Battery will lose 200 mAh [=25 mA x 8 hours] in 8 hours.


Mains supply will be used for charging the battery. Hence changeover
switch is not required. The power supply unit will consist of a battery
charger, a batt
ery as specified and a voltage regulator to provide 3.6VDC to
CPU and 8.4 VDC from battery to modem through an electronic switch.




Modem

CPU

Optoc
oupled


Relays

Phone


Line

Fig 1.4

Updating Specifications


Mains

Supply

Power

Supply

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in










Filter

is necessary to remove electromagnetic noise that is always present
on power lines and is a potential source of malfunction in any clocked
device. This issue will be taken up at an appropriate place.


The
charger

provides charging current to the battery. CPU block receives
power from battery through a
regulator
. Thus CPU does not depend on
mains supply for operation. Battery loses charge as it powers up the
gadget; mains supply simply replenishes the lost charge.


Modem

generally comes with its power supply adapter that operates from
mains. Alternatively the battery of the gadget can energize the modem. We
must know the amount of current drawn by the modem while
communicating as well as in idle state to ensure that

the battery lasts the
committed 8 hours requirement. We must choose a modem appropriately.


Optocoupled switches

come in different varieties. Before going after such
switch we must take a look at schemes of controlling appliances. Let us
consider two choi
ces:

1.

Switch directly drives the appliance.

2.

Switch drives an electromechanical relay that drives the appliance.


If the switch is required to drive the appliance directly then it must meet
the voltage as well as current requirements of load.


In the second

case, the Optocoupled switch needs to energize only the coil
of an electromechanical relay. The coil shall be driven by the mains supply
and turned on / off by Optocoupled switch. The burden on the switch is
very small and electromechanical relays are rel
atively inexpensive.




Battery


Mains

Supply

Filter

Charger

Regulator

CPU Block

Fig

1.5 Power Supply Structure

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in






















1.7

A closer look at one of the components


The objective of this section is to show that one must know the components
in adequate detail before one

can design an embedded system.



Switches:

The switches may be electromechanical relays or solid
-
state
switches. The solid
-
state switches may be either optically coupled or
transformer coupled devices. In any case the first thing you must know is
the oper
ating voltage and operating current that switches must handle.


What is the meaning of
current that a switch must handle
? A 2 kW room
heater will draw about 8A @250 VAC.


When switch S1 is on, it will carry 8A and when it is off its contacts are
subjecte
d to a voltage of 250 VAC. Can the contacts carry 8A continuously?
Can the open contacts sustain 250 VAC?




Fig

1.6. Two sample options

From
CPU

Opto
-
coupling


Electromechanical


Relay


Line


Neutral


Light duty

Opto
-
coupled


Switch

Load

From
CPU

Opto
-
coupling



LOAD


Line


Neutral

Heavy Duty

Opto
-
coupled

Switch

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in












In reality the situation is worse. An electrical load always has some
inductance and the wiring also has inductance. When we break a circuit by
opening a switch, the current path is broken. The current falls to zero
within a very short time. When we recall

the relationship
[e =
-

L di / dt]
,
we can see that a sudden drop in current can produce a very large voltage
depending on how fast the current falls and also on the inductance of the
path.

Assuming an inductance of 1mH and that the current falls from 8 A

to 0 A in
1 µs, the amount of induced voltage is 8000 volts [L=1 x 10
-
3
, ΔI = 8


0, Δt =
1 x 10
-
6
]! This voltage is enough to cause sparking across the switch
contacts. Even if the switch is electronic say, a thyristor, the situation
remains unaltered. The semiconductor device will be subjected to the same
induced voltage and unless properly rated it
will fail [be damaged].


We see that in an apparently simple device like a switch also there is a need
to have a proper understanding of the application to which a device is
subjected.


In this case we must know the current breaking capacity of the switch
. In
addition to that we must also see that sparking shall slowly degrade the
contact performance of the switch [assuming that the switch is properly
chosen]. We must have some means to minimize sparking.


Refer to fig

1.
7
. The two components connected ac
ross S1 quench the
spark. The R
-
C combination is called
snubber
. How does it work? When S1
is closed there is no voltage [hence no charge] across the capacitor. As soon
as S1 opens, C will start receiving charge through R. It is the same current
which is b
roken by S1 that will charge C. Thus the current in the circuit is
not brought to zero suddenly. In fact it is first diverted through C and then
L

O

A

D

S1


~

250VAC


~

ARCING

Fig 1.7 Snubber Circuit for quenching arc

R

C

Snubber Circuit

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

it is reduced to a value determined by the impedance of R
-
C network and
load. Product of R
-
C [time constant] de
cides how slowly this transfer takes
place; slower the transfer, lower the induced voltage. In the process R will
carry a large current surge. Its function is to dissipate energy that was
otherwise stored in the inductance of load and wiring. Choice of R d
epends
on the amount of energy to be dissipated.


How do you know the amount of energy stored magnetically in the load?
Power factor of load gives you an indication of load inductance. If a load
draws 8A at 230 VAC and has a power factor of 0.9, then we pr
oceed thus:


Z = V / I = 230 / 8 = 28.75 Ohms

Since cosØ = 0.9, sinØ = 0.43

Since X / Z = sinØ, X = 28.75 x 0.43 = 12.53 Ohms

From X = 2π f L we get L = 12.53 / 314 = 0.04 H or 40 mH

This assumes line frequency f =50 Hz.

Energy stored in inductor = [1/2] L

I
2

= 0.04 x 8
2

/ 2 = 1.28 Joules


This analysis gives a rough estimate of energy to be handled by R of
snubber element. Since a user may connect a load that has different power
factor and power consumption, above calculation will be wasteful. It is not
en
tirely so. It still helps to contain sparking and prolong the life of relay.



1.8

Exercise


Try to complete hardware design for the product discussed above.


Several implementations are possible with a given set of specifications.
Before you arrive at a
solution, you must weigh different possibilities and
then choose the most optimum. Before choosing the optimum, remember
to define what is optimal for you.


You should subsequently redefine the ‘optimum’ and arrive at a new
solution. The more you repeat th
is loop, better the insight you get.


You might be tempted to go through the book rather than doing this
exercise. Please overcome such temptation and you will understand the
next chapter better.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Follow this practice throughout your reading of this book.



1.9

References


1. Embedded System Design
-

A Unified Hardware/Software Introduction

Author: Frank Vahid and Tony Givargis

ISBN 9971
-
51
-
405
-
2

Publisher: John Wiley & Sons, Inc.


2. Embedded Microcontrollers

Author: Tedd D. Morton

ISBN 81
-
297
-
0226
-
6

Publisher
: Pearson Education, Inc.


3. Embedded Systems Design [Second edition]

Author; Steve Heath

ISBN 81
-
8147
-
970
-
X [Original ISBN 0
-
7506
-
5546
-
1

Publisher: Elsevier



1.10

Links


CommsDesign

|
DeepChip.com

|
Design & Reuse

|
Embedded.com

|
Embedded Edge Magazine

|
Embedded Computing Solutions

|
Planet
Analog

|
eeProductCenter

|
Electronics Supply & Manufacturing

|
Inside
[DSP]

|
Automotive DesignLin
e

|
Power Management DesignLine

|
Wireless
Net DesignLine

|
Video/Imaging DesignLine

|
Green SupplyLine

|
Industrial
Control DesignLine

|
Network Systems DesignLine

|
Digital TV DesignLine

|
Programmable Logic DesignLine

|
Audio DesignLine

|
Mobile Handset
DesignLine

|
TechOnLine


My web site:
www.econverge.in


An implem
entation shall be available
for download
on the web site.







Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

CHAPTER 2

BACK TO CONTENTS

The Power Supply


2.1

The Power Supply in Perspective


Power supply is a very critical component in embedded design [ED].

In portable equipment
its significance stems from the need to increase
battery life. Higher efficiency implies longer battery life and in the case of
rechargeable batteries, it means longer usage between charging. In either
case it is related to economics as well as user comfor
t.

The other aspect of power supply design relates to the amount of heat that
needs to be dissipated or removed from the enclosure of the product. Poor
efficiency of a power supply directly translates into wastage of energy in
the form of heat. Heat is rem
oved by convection for which openings or
perforations are provided on the product case. For removing larger
amounts of heat a cooling fan is provided inside the enclosure. Such
methods increase the weight or the cost or the size or all the three of the
pro
duct. Means of improving efficiency of power supply therefore need a
focused approach.

A great deal of effort has gone into improving designs of power supply ICs
to improve efficiency of power supply as well as to restrict its size. For
example a
Switch Mo
de Power Supply
[SMPS] operating at 100kHz occupies
a much smaller space than one which operates at 20kHz, [for identical I/O
specifications] mainly due to reduction in transformer size.

Other important issues in power supply design are [a] line regulation
, [b]
load regulation, [c] ripple, [d] isolation between input and output, [e]
isolation between various outputs, [f] electromagnetic noise produced by
power supply, [g] size, [h] weight and [j] cost.


2.2

The initial inputs to a designer


The initial inputs that come to a designer regarding power supply
requirement are

[A] The available voltage and the range of its variation in the case of
a
mains operated product

or

[B] The maximum allowed capacity of battery, its weight, and its size in

the
case of
battery operated product

or

[C] Station battery voltage in case of a product meant for
industrial /
utility application
.

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Solar powered products

come with more complex set of inputs since they
must also combine with a back
-
up source.


There ar
e
self
-
powered products

also. For example an electronic
voltmeter; it is powered by the voltage it measures or an over
-
current
protection device, it is powered by the current it is supposed to measure
and then break.


The focus at this point is to realize
that an embedded designer needs
to generate his own specifications for the power supply. The
specifications are derived from the information about the source of
power, the target application of the product as well as the size, weight
and the cost constrain
ts.


You will find several books on power supply design. In fact every power
supply chip manufacturer provides excellent support for designing a power
supply using his IC. But nobody can generate power supply specifications
for you. You must do it yourself
.


2.3

A Case Study


You are required to design a product that starts a diesel engine driven
generator when mains supply fails. If the generator fails to start, it gives an
alarm. If generator starts and develops correct voltage and frequency, then
it shifts t
he load from mains to generator.


You will notice that a battery is required to crank the engine and that the
same battery may be used for powering your product. Your product must
have at least SIX electromechanical relays for following activities:

[a] Sw
itch on fuel

[b] Switch on cranking motor

[c] Pull de
-
compression lever for stopping the engine

[d]
Turn on an alarm in case there is a fault

[e] Switch on/off mains switch [called ‘circuit breaker’]

[f] Switch on/off generator switch to lead generated pow
er to load.


A further look at the application reveals something that would interest an
embedded product designer.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

The cranking motor is obviously a DC motor. These motors draw a very
heavy current at starting. Therefore battery voltage dips whenever motor
is started.


U = E


I x R

Where U is the terminal voltage of battery, E is its EMF, I is the starting
curre
nt and R is the internal resistance of battery.


R increases as battery ages. It also increases due to poor maintenance.


In practical circumstances, where battery is properly maintained, a 12volt
battery may dip to 7 volts when cranking starts. However
,

in the hands of a
careless user battery voltage may dip to as low as 1volt. The voltage dip
lasts while motor picks up speed. It could be a quarter of a second in case of
a well
-
kept battery and properly chosen motor. In cases not so fortunate,
the dip may

last for about a second.


Murphy’s Law

dictates that we design for a ‘not so fortunate’ situation.

So we assume that the dip will last for 1 second and that the voltage during
dip would be 1 volt for a 12volt battery. A customer may use a 24v battery
if
his cranking motor is a 24v part.


The problem with voltage dip is extremely serious: The relay that started
the motor can not hold [and hence releases the starter] when voltage dips
so low and the CPU also resets! When relay opens, voltage becomes normal,

CPU resumes action, operates the relay again. This
causes

a voltage dip,
relay releases starter and CPU resets. This cycle goes on until the battery is
discharged completely; the generator never starts!


If you see the gravity of this problem, you will no
t only think of designing
the power supply carefully, you will also decide to take a harder look at
needs of IED architecture.


An uninitiated or a constrained [a polite word for unimaginative] designer
will see this as a design specification for his power

supply. When seen in
such light, the solution is straightforward.


Take a closer look at Figure 2.1.

When CPU closes the switch to start the
motor, a voltage dip occurs.

Voltage falls to 1V and stays at that level for 1
second. [That is our assumption].

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in













During that one second it is the capacitor ‘C’

that delivers power to the IED.
There is a regulator in the IED; this regulator supplies appropriate voltages
to various parts of IED. It is easy to see that the diode prevents capacitor
from discharging in to the motor when switch closes. Capacitor shoul
d have
enough capacity to supply voltage to the regulator when battery dips to
unacceptable level.


Let us see the size of capacitor required in such an application.


Assume that the relays are supplied directly by the capacitor. Assume that
two relays
will be active at the time of starting
-

the cranking relay and the
fuel relay. Relays have a twelve volts coil and typically the coil resistance is
240ohms. The electronics of IED takes about 50mA at 5volts. The regulator
will convert 12volts to 5volts. Th
e regulator works effectively as long its
input voltage is above 6volts. This assumes a low drop out [LDO]device.
Relay also holds as long as coil voltage is above 6volts.


What is the total current drawn from the capacitor during voltage dip?


Relays dra
w a current which decreases from 100mA [=(2 x 12 / 240)] to
50mA as capacitor voltage falls from 12v to 6v.

The electronics draws a little over 50mA from the battery assuming a linear
regulator. Let this current be 55mA.

Thus we can assume for simplicity a
n average current of 130mA [=55 +
(100+50)/2].

Thus the total charge lost in a second will be 130mCoulomb [=130mA x 1
second].


Contact of

EM Relay


D


C


Starter
Motor

CPU Block

+ Voltage
regulator

Fig

2.1

Battery voltage dip at starting

Battery

IED

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

By Coulomb’s law Q=C x U, drop in voltage will be



U =

Q / C.

But

U = 6v.

Hence

C = 130 x 10
-
3
/ 6




= 21.666 x 10
-
3




= 21666 x 10
-
6




= 22000 x 10
-
6
[appx
.
]


Thus we need a 22000microfarad capacitor. These capacitors are
reasonably priced when tolerance is

10%. If actual value is 10% less then
it will be less than 21666mfd. So we must go for a higher capacity
device or
add a 2200mfd capacitor across 22000mfd part.


The capacitor issue has a further aspect. A user generally wants the same
IED whether the battery is a 12v or a 24v battery. You will be required to
use a 35v capaci
tor. It is a very big capacitor [o
r very expensive
]
. The cost
of a component, as we shall see later has a direct bearing on inventory cost.


A better designer will see a need

1. To choose such components for IED that total current consumption of
IED becomes as small as possible.

2.

To select

relays in such a way that RC time constant due to relay
resistance is as large as one gets. If you know that a relay for similar
duty, with a higher coil voltage has a higher coil resistance then you will
like to use a relay with perhaps 24V coil rather t
han the obvious choice
of 12V for this application. This relay will hold down to about 10V. Time
it takes for a capacitor to discharge from 24V to 10V should be more
than 1 second. For a given capacitor a 24V relay will hold longer than a
12V relay.

3.

To sel
ect a CPU
that

draws as little current as possible. This is a major
decision and must e handled with care.

4.

To select a display which draws as little current as possible; one may
choose Liquid Crystal display rather than LED display.


The whole idea is to r
educe the capacitor size so that it cam be
accommodated within a small enclosure.


We can actually change the scheme completely using a SMPS in boost mode
to develop 24v for the whole operation
-

with battery voltage as low as 0v to
Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

as high as 35V. The char
ge on 24v side would supply power when battery
dips out for a second.


This approach has two effects:


Reduction in load current:

A very low power CPU like Texas Instruments MSP430Fxxx would only
draw 4mA as against a 5v device like Philips 80C552 that dra
ws 40mA. We
can restrict the total current drawn by IED to about 15mA and that drawn
by the relays to 40mA. Thus the total current is 60mA as against 130mA in
above design.


Reduction in tolerable

U:

Since we shall use 24v relay, the

U will be 14v
[=24
-
10].

The capacitor value will be



C =

Q /

U = 55 x 10
-
3

/ 14



C = 3928mfd

A good choice would be 4700mfd / 35v capacitor or 5 capacitors of
1000mfd connected in parallel for a better ripple rejection due to reduced
Equivalent Series Resistance [ES
R].


You may ask whether it is worth the trouble, replacing a passive device
[capacitor] by a lot of active devices and passive devices? Yes, you needed
an SMPS anyway!


2.4

Generating Specifications


You must have noticed in the above example that the data
supplied by the
user is not sufficient, one has to know the application to extract several
constraints. The power supply specification needs lot more information
than we deduced above. You also noticed that power supply architecture
could not be decided in

isolation; you must look at the product in its
totality. Different parts are interrelated and changes in one area might
affect the design in another area.


You can arrive at specifications of power supply only after you have
decided the following:


1. No
of outputs

2. Voltage and current rating of each output

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

3. Regulation
-
Load and Input

4. Critical output: The output that has the tightest tolerances

5. The outputs which need to be galvanically isolated

6. Permissible ripple factor

7. Nominal input

8. Vari
ation in input


In the example of previous section input is defined and if you actually
choose MSP430F147, then you need a 3.6V output for CPU and related
circuits and a 24V output for relays and a 5V output for liquid crystal
display and for some LEDs. Si
nce the product has to measure voltages, a
very stable reference is required which can be derived from 3.6V output.
Thus the most critical output is 3.6V and 5V output tolerances come next
and finally the 24V output that can tolerate any voltage from 22V t
o 26V.
Burden on 24V is determined by the maximum number of relays which can
be simultaneously be energized. Unless you actually workout the circuit
details, you will not know the exact requirement.


Sometimes industrial products such as
the
one discussed
above come with
serial communication on RS485 bus or a RS232 link. The serial outputs are
required to be galvanically
isolated

from rest of the circuit. The power
transformer must then carry a winding that provides this voltage, generally
5VDC.


2.5

The electr
omagnetic noise menace


If I have to mention one single factor that may bring about complete failure
of a product, I would name ‘Electric fast Transient’ [EFT]. An otherwise
impressive product will be doomed if you do not handle EFT issues
effectively.


Po
wer supply is a gateway to EFT and to the doom of a product and to its
designer.


When a current is interrupted, it gives rise to high frequency disturbance
with voltages of the order of a few kV depending on the amount of current
interrupted and the distr
ibuted inductance and capacitance of the circuit.


Remember e =
-

L dI / dt?


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

A simple switch that is turned off gives rise to such a disturbance, where
dI
is the change in current, from some value to zero and
dt
is the time during
which the change takes

place.

L
is the inductance of the path through which
current is flowing.


Such a voltage can be quite high and it can also cause ringing in the
network due to the presence of distributed capacitance and inductance.


This is the noise that travels along t
he power lines and finds its way in to
the power supply. It tries to find a path through ground. If such a path is not
designed in to the product, the disturbance will find a path itself and in the
process travels through the circuit and disturbs logic lev
els in the circuit.
Such a disturbance can be very treacherous when it gets linked with system
clock. CPU tends to hang under such circumstances or at least malfunctions
while disturbance lasts. This can cause havoc because CPU may perform
unintended funct
ions. This form of noise is called common mode noise.


Other form of noise, also called differential noise, enters through one
terminal of input and tries to find a path to the other terminal. If we do not
design such a path, noise will find a path and it
may create serious
disturbance of logic levels just as in the above case.


Power supply design therefore involves common mode and differential
mode filters the first building block of power supply. This circuit must
provide very short paths for noise so th
at noise is not tempted to take a
stroll through your logic circuit.


The noise issues shall be taken up at an appropriate point where we shall
also see what tests are required to assure immunity to such noise. Such
tests are defined in IEC60255 standard.


2.6

Exercise


Build a block diagram for the product discussed above and then attempt to
build each block with real suitab
le components.

Work out specifications for the power supply a
fter completing
the above

assignment
. Finally implement a power supply design on pSpice.




Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

CHAPTER 3

BACK TO CONTENTS

Signal Conditioning


3.1

Introduction


Information is signal. In order that a piece of information can be processed
by a digital system, it must be
transformed such that digital system is
optimally utilized without crossing safety limits under worst conditions.


Suppose you face the task of reading voltage off an 11kV electrical power
distribution network. Then this voltage is a signal. No A/D convert
er can
handle 11kV. There are standard devices called Potential Transformers
[PT] that convert such high voltage to something like 110V. Even this
voltage is beyond the capability of any A/D converter. You must attenuate
it further to a few volts. You do n
ot get PTs that transform to a l
ow voltage
that would suit you.


On the other hand a signal emanating from a microphone has such small
voltage that input voltage range of an A/D converter is starved.


So the first step in such cases is to bring the voltage to a reasonable level.


Sometimes a small differential signal carries a large common mode voltage.
In such cases it becomes necessary to eliminate the common mode voltage
before amplifying the differ
ential signal. Many A/D converters do not
support differential measurement. Such situations require that we convert
a differential signal to a single ended signal.


We therefore need a means of translating signal level so that A/D converter
range is fully
utilized within maximum and minimum excursions of the
signal.



3.2

Level Translation


Let us take the example of AC voltage measurement required in several
applications like protective devices, power monitoring devices, power
factor controllers etc.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

It is ne
cessary to measure AC voltage in the range of 5 volts to 285 volts.


One simple method is to use a transformer that brings down 285 volts to 2
volts.

Such transformers are bulky. Their size is governed by voltage rather
than by the power rating; this is so because such a transformer is required
to provide barely a few milliwatts.


Another solution is to use a resistance network to attenuate the
voltage to
desired level. It is not only an inexpensive solution it also fits in to a small
size.


The two solutions have one major difference: transformer provides
isolation between the source of AC voltage and the electronic circuit. If an
application re
quires such isolation then you can not choose the second
option.


Another solution exists that has the advantage of isolation of the first
solution and size close to the second solution.

It uses a low voltage two winding

1:1 current

transformer
. The voltag
e to
be measured is converted in to current by first passing it through a high
resistance. The secondary current is converted to voltage by an I
-
to
-
V
converter using an opamp. Considering the fact that lower limit of voltage
is only 2 volts, accuracy at lo
wer end is likely to be affected unless a rather
expensive core is used.


In any of the above solutions you do not need to perform rectification. Once
the signal is converted to digital form further processing is performed
digitally.


In several cases rec
tification is not a requirement.

Rectification can also be
implemented in a digital filter.


Table 3.1 Comparison of the three circuits of Fig.3.1

Property

Fig.3.1A

Fig.3.1B

Fig.3.1C

Weight

Maximum

Minimum

Intermediate

Board Space

Intermediate

Minimum

Maximum

Linearity over span

Better

Best

Good

Active / Passive

Passive

Active

Active

Ohmic Isolation

Excellent

Good

Excellent

Number of components

Minimum

Intermediate

Maximum

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in


























Some features of the three implementations are given in table
3.1.


You may have noticed several resistors connected in series instead of just
one resistor.
A voltage withstand rating is associated with every resistor.
While selecting a resistor

you must

pay attention to its voltage withstand
rating also.


Please
also note that in the case of transformer the cost is mainly the raw
material cost whereas in the case of active components, the cost is mainly
the process cost. Raw material costs always tend to increase whereas
process costs are distributed over the volu
me of production and hence they
show a downward trend per piece produced. In our example the solution A
and C will become more expensive with time whereas the solution at B will
tend to be cheaper.



230 V


AC


2V


AC


230 V


AC


2V


AC

-


+


PT


Fig 3.1 A: Using PT for voltage translation


Fig 3.1 B: Using resistive attenuator for voltage translation


Fig 3.1 C: Using CT for voltage translation


230 V


AC


2V


AC

-


+


CT

R1 R1 R1


R1 R1 R1


R1 R1


R1 R1


R2

R2

R3

R2

R3

R2

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

Level Shifting


If an A/D converter accepts only unipolar

signals [positive voltage only]
then the AC signal must be shifted such that the resulting signal is always
positive. For example if the signal of interest has a negative peak value of
2.0V, then we must add a DC bias of at least 2.0V to ensure that resul
t never
goes negative. Use of the word ‘interest’ as above means that we shall be
interested in the signal as long as it does not become less than
-
2.0V. When
signal becomes more negative than
-
2.0V, we just ignore it
, or to be on the
safer side we limit i
t using voltage limiter elements.

















3.3

Passive filters


Passive filters are attractive due to their simplicity and permissible voltage
and current ratings. Such filters find place in embedded products in
sections like noise filters [EMI/EMC] on power supply inputs, output filter
on a rectified voltage,
de
-
glitc
her across supply pins of micro
-
controllers
and all such situations that do not require sharp cut off in frequency
response.



Every embedded product needs to address electromagnetic interference
[EMI] issues in two ways: [a] it must be immune to EMI that
is caused by
external influences like high frequency disturbances on power supply lines
or those caused when output devices switch inductive loads and [b] it must
not act as a source of EMI to other devices around it.

0, 0

0, 0


DC OFFSET


DC OFFSET


Fig.3.2 A: Proposed DC OFFSET


Fig.3.2 B: DC OFFSET added

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

There are elaborate standards establis
hed by such institutions as IEEE and
IEC for
evaluation of

the above effects
;

compliance to these standards
ensures that the above effects stay within safe limits
.


The EMI issues shall be discussed separately since such issues are related
to stability of
product in the face of EMI and also acceptability of products
in the international market; these issues do not directly affect the
functional or non
-
EMI performance of the product.


Stability of filter characteristics depends entirely on stability of
characteristics of the passive elements. The characteristics change with
temperature, humidity, acceleration and aging etc.


A good understanding of component characteristics is essentia
l for
achieving desired stability within size/weight/cost constraints.



3.3.1

Time and frequency domain behavior of low pass filters

[LPF]










Cutoff frequency of such a filter
[

C
]

is
1/RC radians/second

and its rise
time

expressed in seconds

[

r
]
is 2.3RC.
Bandwidth [BW] of the circuit
expressed in Hertz is

C
/
2


which

1/ [2

RC
]
.

Here R and C are
in
ohms and
farads

r
e
spectively
.

Thus we see:





We use Cathode Ray Oscilloscope [CRO] to study time domain behavior of
networks. Vertical amplifier of a CRO has a certain bandwidth. A CRO acts
like a low pass filter and hence the slope of rising / falling square waves as
we see on CRO does not give the
true picture.



~


U
IN




~


~


U
OUT



~

R

C

Fig.3.3 b: Passive High Pass Filter


~


U
IN




~


~


U
OUT



~

R

C

Fig.3.3
a: Passive Low Pass Filter

BW x

r
= 2.3/2


= 0.37

Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

An ideal square wave, if there were such a wave
,

would have d
isplayed a
rise time given by 0.
3
7
/BW, where BW refers to bandwidth of CRO. If
BW=100MHz, then

r
=
[
0.37
/100
]


s = 3
.7

ns.

Your choice of CRO
should

be governed by the kind of rise/fall times you anticipate.


A LPF is also seen as an integrator. For example a square wave turns in to a
triangular wave when passed thru a LPF. A sine wave turns in to a cosine
wave when passed thru a PF.


A high pass fil
ter [HPF] on the other hand acts as a differentiator.


Such time domain behavior of LPF and HPF is close to ideal only over a
band of frequencies. [See Exercises]


A
LPF

also acts as a delay element in which amount of delay is a function of
frequency of th
e signal it handles.


The output waveform is delayed with respect to the input waveform by

an
angle


given by

tan
-
1
[


/

C
].
Delay in time domain is


/


seconds.


Thus if a signal contains several frequency components, then different
frequency components ill be delayed by different amounts of time. Hence
signal as output from the filter will be quite different from the original
signal. In practice a signal does
inde
ed
contain several frequency
components.

Hence the signal output by such a filter is not a replica of the
input signal.

Fidelity is a measure of the extent to which an output is an
exact replica of the input. We therefore say that a LPF adversely affects
fidelity.


Further, it will be observed that different frequency components are
attenuated by different factors. This
de
grades fidelity further.


The gain of a LPF s given by


A[

] =

C
/ [

C

+ j

]


The low frequency components, i.e. components having frequencies very
small as compared with

C
[


<<

C
] produce a gain of approximately unity.
When we consider components of
frequency which are very high compared
Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

with

C

[


>>

C
], the gain falls very close to zero. The components having
a frequency equal to

C

produce a gain of 0.707 [=1/

2 = 1/ (1+j1)].


The picture is not grim as it would appear at first. In fact the picture is
bright. Note that we are not trying to build an audio amplifier; we are
trying to get rid of some unwanted signals. And we have achieved it with
the help of above characteristics.


The signals far below the critical frequency pass virtually unaffected
whereas those far above the critical frequency are heavily attenuated.
Choose the frequency wisely and you
have filtered the unwanted signals.


3.3.2

LPF,
HPF

and
n
oise


If we look at LPF as a filter that passes all frequencies below

C
, then we
shall see a HPF as the one that passes all frequencies above

C
. This
observation is interesting when we see that frequencies above

C

have no
upper limit. So in the presence of noise, say white noise, you get all the
noise there is.

On the other hand a low pass filter has an upper limit for
frequencies it will pass. Thus noise performance of a LPF is bound to be
much better than that of

a HPF.


We can therefore see a HPF to be prone to noise when compared with a
LPF that has a fair noise performance.


If we recall that the LPF is an integrator and that the HPF is a differentiator,
we need to see and remember, whether in passive, active o
r digital domain,
that implementing a differentiator needs great care due to its being noise
prone.


The simple filter used at the output of a rectifier stage in a power supply
circuit is a low pass filter. Suppose the frequency of incoming supply is
50Hz
and that we are using a full wave bridge. The output without a filter
will contain DC component as well as 100Hz and its multiples in varying
degrees.


We are used to seeing the analysis in time domain. We can just as well see it
in frequency domain.


Embedded Design

Part 1 Building Blocks

L.S.Karandikar


May 7, 2012 www.econverge.in

The
frequency component in the full wave rectifier output can be obtained
using Fourier series.


U
out

= [2/

] U
PEAK



[ 4/(3

)] U
PEAK
cos (2

t)


[ 4/(15

)] U
PEAK
cos (4

t)
-
..
.


We are ideally looking for [2/

] U
PEAK
, which is the DC component of the
output.
The second and fourth harmonic components are attenuated by