Documente Academic
Documente Profesional
Documente Cultură
POWER SUPPLY
INTRODUCTION
be converted to constant DC, in order to operate the electronic device. All devices will have a
certain power supply limit and the electronic circuits inside these devices must be able to supply
a constant DC voltage within this limit. That is, all the active and passive electronic devices will
have a certain DC operating point (Q-point or Quiescent point), and this point must be achieved
by the source of DC power. The DC power supply is practically converted to each and every
stage in an electronic system. Thus a common requirement for all this phases will be the DC
power supply. All low power system can be run with a battery. But, for long time operating
devices, batteries could prove to be costly and complicated. The best method used is in the form
As shown in the figure above, a small step down transformer is used to reduce
the voltage level to the devices needs. In India, a 1 supply is available at 230 volts. The output
of the transformer is a pulsating sinusoidal AC voltage, which is converted to pulsating DC with
the help of a rectifier. This output is given to a filter circuit which reduces the AC ripples, and
passes the DC components. But here are certain disadvantages in using an unregulated power
supply.
1. Poor Regulation When the load varies, the output does not appear constant. The output
voltage changes by a great value due to the huge change in current drawn from the supply. This
is mainly due to the high internal resistance of the power supply (>30 Ohms).
2. AC Supply Main Variations The maximum variations in AC supply mains is give or take
6% of its rated value . But this value may go higher in some countries (180-280 volts). When the
3. Temperature Variation The use of semiconductor devices in electronic devices may cause
variation in temperature.
These variations in dc output voltage may cause inaccurate or erratic operation or even
malfunctioning of many electronic circuits. For instance, in oscillators the frequency will shift, in
transmitters output will get distorted, and in amplifiers the operating point will shift causing bias
instability.
All the above listed problems are overcome with the help of a voltage regulator which is
employed in conjunction with an unregulated power supply. Thus, the ripple voltage is largely
The internal circuitry of a regulated power supply also contains certain current limiting circuits
which helps the supply circuit from getting fried from inadvertent circuits. Nowadays, all the
power supplies use ICs to reduce ripples, enhance voltage regulation and for widened control
options. Programmable power supplies are also available to allow remote operation that is useful
in many settings.
As shown in the figure, the two main parts of a regulated power supply are a simple power
supply and a voltage regulating device. The power supply output is given as input to the voltage
regulating device that provides the final output. The voltage output of the power supply remains
constant irrespective of large variations in the input AC voltage or output load current.
Given below is a circuit diagram of a regulated power supply circuit using a transistor series
regulator as a regulating device. The input AC voltage (230 Voltas Vrms), is supplied to a
transformer. The output will be a stepped down ac output appropriate for the desired dc output.
This ac voltage is then given to a bridge rectifier to produce a full-wave rectified output. This is
then given to a pi-filter circuit to produce a dc voltage. The filter output may have some ac
voltage variations and ripples. This is further filtered using a regulating circuit whose output will
be a constant dc voltage. This regulated dc voltage is then given to a voltage divider, which
supplies the different dc voltages that may be needed for different electronic circuits.
The potential divider is a single tapped resistor connected across the output terminals of the
supply. The tapped resistor may consist of two or three resistors connected in series across the
characteristics like load voltage, load current, voltage regulation, source regulation, output
impedance, ripple rejection, and so on. Some of the characteristics are briefly explained below:
1. Load Regulation The load regulation or load effect is the change in regulated output voltage
From the above equation we can understand that when Vno-load occurs the load resistance is
infinite, that is, the out terminals are open circuited. Vfull-load occurs when the load resistance is
2. Minimum Load Resistance The load resistance at which a power supply delivers its full-
The value of Ifull-load, full load current should never increase than that mentioned in the data
3. Source/Line Regulation In the block diagram, the input line voltage has a nominal value of
230 Volts but in practice, there are considerable variations in ac supply mains voltage. Since this
ac supply mains voltage is the input to the ordinary power supply, the filtered output of the
line voltage.
4. Output Impedance A regulated power supply is a very stiff dc voltage source. This means
that the output resistance is very small. Even though the external load resistance is varied, almost
no change is seen in the load voltage. An ideal voltage source has an output impedance of zero.
5. Ripple Rejection Voltage regulators stabilize the output voltage against variations in input
voltage. Ripple is equivalent to a periodic variation in the input voltage. Thus, a voltage regulator
attenuates the ripple that comes in with the unregulated input voltage. Since a voltage regulator
uses negative feedback, the distortion is reduced by the same factor as the gain.
Regulated power supply is an electronic circuit that is designed to provide a constant dc voltage
variations.
Voltage
regulator lo
Ac input Power ad
supply
A regulated power supply essentially consists of an ordinary power supply and a voltage
regulating device, as illustrated in the figure. The output from an ordinary power supply is fed to
the voltage regulating device that provides the final output. The output voltage remains constant
irrespective of variations in the ac input voltage or variations in output (or load) current.
Figure given below shows the complete circuit of a regulated power supply with a transistor
series regulator as a regulating device. The ac voltage, typically 230 V rms is connected to a
transformer which transforms that ac voltage to the level for the desired dc output. A bridge
rectifier then provides a full-wave rectified voltage that is initially filtered by a (or C-L-C)
filter to produce a dc voltage. The resulting dc voltage usually has some ripple or ac voltage
variation. A regulating circuit use this dc input to provide a dc voltage that not only has much
less ripple voltage but also remains constant even if the input dc voltage varies somewhat or the
load connected to the output dc voltage changes. The regulated dc supply is available across a
voltage divider.
Often more than one dc voltage is required for the operation of electronic circuits. A single
power supply can provide as many as voltages as are required by using a voltage (or potential)
divider, as illustrated in the figure. As illustrated in the figure, a potential divider is a single
tapped resistor connected across the output terminals of the supply. The tapped resistor may
consist of two or three resistors connected in series across the supply. In fact, bleeder resistor
There are various factors that determine the quality of the power supply like the load voltage,
load current, voltage regulation, source regulation, output impedance, ripple rejection, and so on.
From the above equation we can understand that when Vno-load occurs the load resistance is
infinite, that is, the out terminals are open circuited. Vfull-load occurs when the load resistance is
2. Minimum Load Resistance The load resistance at which a power supply delivers its full-
The value of Ifull-load, full load current should never increase than that mentioned in the data
3. Source/Line Regulation In the block diagram, the input line voltage has a nominal value of
230 Volts but in practice, here are considerable variations in ac supply mains voltage. Since this
ac supply mains voltage is the input to the ordinary power supply, the filtered output of the
The source regulation is defined as the change in regulated output voltage for a specified rage of
lie voltage.
4. Output Impedance A regulated power supply is a very stiff dc voltage source. This means
that the output resistance is very small. Even though the external load resistance is varied, almost
no change is seen in the load voltage. An ideal voltage source has an output impedance of zero.
5. Ripple Rejection Voltage regulators stabilize the output voltage against variations in input
voltage. Ripple is equivalent to a periodic variation in the input voltage. Thus, a voltage regulator
attenuates the ripple that comes in with the unregulated input voltage. Since a voltage regulator
uses negative feedback, the distortion is reduced by the same factor as the gain.
2. MICROCONTROLLER:
A timer module to allow the microcontroller to perform tasks for certain time periods.
A serial i/o port to allow data to flow between the controller and other devices such as
a PIC or another microcontroller.
An ADC to allow the microcontroller to accept analogue input data for processing.
Microcontrollers are :
Smaller in size
Consumes less power
Inexpensive
Micro controller is a standalone unit ,which can perform functions on its own
without any requirement for additional hardware like i/o ports and external memory.
The heart of the microcontroller is the CPU core. In the past, this has traditionally been based on
a 8-bit microprocessor unit. For example Motorola uses a basic 6800 microprocessor core in
their 6805/6808 microcontroller devices.
The microcontroller that has been used for this project is from PIC series.
PIC microcontroller is the first RISC based microcontroller fabricated in CMOS
(complementary metal oxide semiconductor) that uses separate bus for instruction and data
allowing simultaneous access of program and data memory.
The PIC start plus programmer gives the product developer ability to
program user software in to any of the supported microcontrollers. The PIC start
plus software running under mplab provides for full interactive control over the
programmer.
CORE FEATURES:
PERIPHERAL FEATURES:
Timer2: 8-bit timer/counter with 8-bit period register, presale and postscaler
Synchronous Serial Port (SSP) with SPI. (Master Mode) and I2C. (Master/Slave)
Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with
The complete architecture of PIC 16F877 is shown in the fig 2.1. Table
2.1 gives details about the specifications of PIC 16F877. Fig 2.2 shows the complete
pin diagram of the IC PIC 16F877.
TABLE 2.2 PIN OUT DESCRIPTION
Legend: I = input O = output I/O = input/output P = power
Note
3. This buffer is a Schmitt Trigger input when configured as general purpose I/O and
a TTL
input when used in the Parallel Slave Port mode (for interfacing to a
microprocessor bus).
4. This buffer is a Schmitt Trigger input when configured in RC oscillator mode and a
2. This buffer is a Schmitt Trigger input when used in serial programming mode.
3. This buffer is a Schmitt Trigger input when configured as general purpose I/O and
a TTL
input when used in the Parallel Slave Port mode (for interfacing to a
microprocessor bus).
4. This buffer is a Schmitt Trigger input when configured in RC oscillator mode and a
Some pins for these I/O ports are multiplexed with an alternate
function for the peripheral features on the device. In general, when a peripheral is
enabled, that pin may not be used as a general purpose I/O pin.
pins whereas writing to it will write to the port latch. All write operations are read-
modify-write operations. Therefore a write to a port implies that the port pins are
read; this value is modified, and then written to the port data latch. Pin RA4 is
multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The
RA4/T0CKI pin is a Schmitt Trigger input and an open drain output. All other RA port
pins have TTL input levels and full CMOS output drivers. Other PORTA pins are
multiplexed with analog inputs and analog VREF input. The operation of each pin is
selected by clearing/setting the control bits in the ADCON1 register (A/D Control
Register1).
The TRISA register controls the direction of the RA pins, even when they are
being used as analog inputs. The user must ensure the bits in the TRISA register are
maintained set when using them as analog inputs.
a) Any read or write of PORTB. This will end the mismatch condition.
b) Clear flag bit RBIF. A mismatch condition will continue to set flag bit
RBIF. Reading PORTB will end the mismatch condition, and allow flag bit RBIF to be
cleared. The interrupt on change feature is recommended for wake-up on key
depression operation and operations where PORTB is only used for the interrupt on
change feature. Polling of PORTB is not recommended while using the interrupt on
change feature. This interrupt on mismatch feature, together with software
configurable pull-ups on these four pins, allow easy interface to a keypad and make
it possible for wake-up on key depression
When the I2C module is enabled, the PORTC (3:4) pins can be
configured with normal I2C levels or with SMBUS levels by using the CKE bit
(SSPSTAT <6>). When enabling peripheral functions, care should be taken in
defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to
make a pin an output, while other peripherals override the TRIS bit to make a pin an
input. Since the TRIS bit override is in effect while the peripheral is enabled, read-
modify write instructions (BSF, BCF, XORWF) with TRISC as destination should be
avoided. The user should refer to the corresponding peripheral section for the
correct TRIS bit settings.
The PORTE pins become control inputs for the microprocessor port
when bit PSPMODE (TRISE<4>) is set. In this mode, the user must make sure that
the TRISE<2:0> bits are set (pins are configured as digital inputs). Ensure ADCON1
is configured for digital I/O. In this mode the input buffers are TTL.
There are three memory blocks in each of the PIC16F877 MUCs. The
program memory and Data Memory have separate buses so that concurrent access
can occur.
PROGRAM MEMORY ORGANISATION:
The data memory is partitioned into multiple banks which contain the
General Purpose Registers and the special functions Registers. Bits RP1 (STATUS<6)
and RP0 (STATUS<5>) are the bank selected bits.
RP1:RP0 Banks
00 0
01 1
10 2
11 3
Each bank extends up to 7Fh (1238 bytes). The lower locations of each
bank are reserved for the Special Function Registers. Above the Special Function
Registers are General Purpose Registers, implemented as static RAM. All
implemented banks contain special function registers. Some frequently used
special function registers from one bank may be mirrored in another bank for code
reduction and quicker access.
GENERAL PURPOSE REGISTER FILE :
The instruction set is highly orthogonal and is grouped into three basic
categories:
Byte-oriented operations
Bit-oriented operations
All instructions are executed within one single instruction cycle, unless
a conditional test is true or the program counter is changed as a result of an
instruction. In this case, the execution takes two instruction cycles with the second
cycle executed as a NOP. One instruction cycle consists of four oscillator periods.
Thus, for an oscillator frequency of 4 MHz, the normal instruction execution time is 1
ms. If a conditional test is true or the program counter is changed as a result of an
instruction, then the instruction execution time is 2 ms.
GENERAL FORMAT FOR INSTRUCTIONS :
3. LCD
There are many display devices used by the hobbyists. LCD displays are one of
the most sophisticated display devices used by them. Once you learn how to interface it, it will
be the easiest and very reliable output device used by you! More, for micro controller based
project, not every time any debugger can be used. So LCD displays can be used to test the
outputs. Obviously, for last possibility, you need to know how to use this stuff pretty well.
Note 1: We have sub divided this article for easy navigation as shown below:-
1. Pin Configuration
2. Block Diagram
4. LCD Interfacing
5. LCD Initialization
Hitachi has set up a mile stone by its LCD controller IC. All the LCD displays use the
same, or any one of the IC s based upon the architecture introduced by Hitachi.
Ok, one minute, all Im talking about is the character LCD display and not Graphical LCD
Display.
Most of the LCD Displays available in the market are 16X2 (That means, the LCD displays are
capable of displaying 2 lines each having 16 Characters a), 20X4 LCD Displays (4 lines, 20
characters). It has 14 pins. It uses 8lines for parallel data plus 3 control signals, 2 connections to
power, one more for contrast adjustment and two connections for LED back light. Let us have a
look to typical pin configurations:
Data/Signals/Execution of LCD
Now that was all about the signals and the hardware. Let us come to data, signals and execution.
LCD accepts two types of signals, one is data, and another is control. These signals are
recognized by the LCD module from status of the RS pin. Now data can be read also from the
LCD display, by pulling the R/W pin high. As soon as the E pin is pulsed, LCD display reads
data at the falling edge of the pulse and executes it, same for the case of transmission.
LCD displays have two RAMs, naming DDRAM and CGRAM. DDRAM registers in
which position which character in the ASCII chart would be displayed. Each byte of DDRAM
represents each unique position on the LCD display. The LCD controller reads the information
from the DDRAM and displays it on the LCD screen. CGRAM allows user to define their
custom characters. For that purpose, address space for first 16 ASCII characters are reserved for
users. After CGRAM has been setup to display characters, user can easily display their custom
characters on the LCD screen.
AC -Address Counter
Outline
4) Others
The selection of RAM is set by the previous address set instruction. If the address set instruction
of RAM is not performed before this instruction, the data that is read first is invalid, because the
direction of AC is not determined. If the RAM data is read several times without RAM address
set instruction before read operation, the correct RAM data from the second, but the first data
would be incorrect, as there is no time to transfer RAM data. In case of DDRAM read operation,
cursor shift instruction plays the same role as DDRAM address set instruction; it also transfers
RAM data to the output data registers.
After read operation, the data address counter is automatically increased or decreased by 1
according to the entry mode. After CGRAM read operation, display shift may not be executed
properly.
*In case of RAM write operation, AC is increased or decreased by 1 like that of the read
operation. In this time AC indicates the next address position, but the previous data can only by
the read instruction.
Write binary 8bit data to DDRAM/CGRAM. The selection of CGRAM or DRAM is set by the
previous address set instruction; DDRAM address set, CGRAM address set. RAM set instruction
can also determine the AC direction to RAM.
After write operation, the address is automatically increased or decreased by 1 according to the
entry mode.
By making this read out operation, it can be determined if the LCD is performing some internal
operation or not. If Busy Flag (BF) is high, some internal operation is going inside the LCD at
that particular moment. To perform further operation the data source (e.g. micro controller) must
wait for the BF to go low. Here, the address counter value can also be read.
4) Set DDRAM Address
Set DDRAM address to AC, this instruction makes DDRAM data available from MPU. In 1-line
display mode, DDRAM address rangers from 00H to 4FH. In 2-line display mode, DDRAM
address in the first line ranges from 00H to 27H, and DDRAM address in the 2 nd line is from
40H to 67H.
Set CGRAM address to AC. This instruction makes CGRAM data available from MPU.
6) Function Set
When 4 bit mode is activated, the data needs to be transferred in two parts, first higher 4bits, and
then lower 4 bits.
Without writing or reading the display data, shifting right/left cursor position or display.
This instruction is made to correct or search or display data. During 2-line display mode, cursor
moves to the 2nd line after the 40th digit of the 1st line.
When display shift is performed, the contents of the address counter are not changed.
D=0 means entire display is turned off. But Display data remains in DDRAM.
C=0 turns off the cursor. But I/D register retains the data
B=0 stops the cursor to blink and cursor looks steady if the Cursor is turned on.
When I/D= 1 cursor moves to the right and DDRAM address is increased by 1.
When I/D= 0 cursor moves to the left and DDRAM address is decreased by 1.
This instruction sets the address counter to 00H, and returns the cursor to the first column of
first line. And if display is shifted previously, this instruction shifts this too. The DDRAM
contents dont change in this instruction.
Clear all the display data by writing 20H (ASCII code of space character) to all DDRAM
address, AND set value DDRAM address counter (AC) to 00H. It returns the cursor to the first
column of first line and sets the entry mode to increment mode (I/D=1).
Now the question is how to display data in the LCD or give command to it. There is two modes
of data transfer are supported by LCD displays. One is 4bit mode, another is 8 bit mode. To
transfer data In 8 bit mode, first put your data in the 8bit bus, then put command in the command
bus and then pulse the enable signal.
To send data in 4bit mode; first put upper 4bit in the 4 bit data bus connected to 4MSB
pins of LCD display, then put control signals in the control bus, then pulse the E pin once. Next
put the lower 4 bit in the data bus and pulse the E pin again. Here is a flowchart simply
describing it.
LCD Initialisation
We are pretty familiar how to send data. But before displaying characters on the LCD display, it
must be configured first. To configure an LCD display, four command words must be sent to
LCD in either 4 bit mode, or in 8 bit mode. The commands are:
1. Function set
4. Display Clear
All these character display modules got the feature to create 8 user defined characters (ASCII
Codes 07) in addition to the ROM fixed codes.
1.) The command CG RAM Address Set defines the ASCII code (Bit 3, 4, 5) and the dot line
(Bit 0, 1, 2) of the new character. Example demonstrates creating ASCII code 00H.
2.) Doing 8 times the write command Data Write defines line by line the new character. 8th
byte stands for the cursor line.
3.) The new defined character can be used as a normal ASCII code (07); use with DD
RAM Address Set and Data Write.
Now let us look up the character set that can be displayed using the LCD Displayed
0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 to 0xd0 0xE00xF0
0x00CG1 0 @ P ` p
0x01CG2 ! 1 A Q a q
0x02CG3 2 B R b r
0x03CG4 # 3 C S c s
0x04CG5 $ 4 D T d t
0x05CG6 % 5 E U e u
0x06CG7 & 6 F V f v CUSTOM
0x07CG8 7 G W g w REGIONAL G
0x08CG1 ( 8 H X h x CHARACHTER
0x09CG2 ) 9 I Y i y S y
0x0ACG3 * : J Z j z J
0x0BCG4 + ; K [ k {
0x0CCG5 , < L l |
0x0DCG6 = M ] m }
0x0ECG7 . > N ^ n
0x0FCG8 / ? O _ o
Custom Regional characters vary from manufacturer to manufacturer. The Greek letters may or
may not appear. It too depends upon the design.
5. GSM
This is a plug and play GSM Modem with a simple to interface serial interface. Use it to
send SMS, make and receive calls, and do other GSM operations by controlling it through simple
AT commands from micro controllers and computers. It uses the highly popular SIM300 module
for all its operations. It comes with a standard RS232 interface which can be used to easily
interface the modem to micro controllers and computers.
The modem consists of all the required external circuitry required to start experimenting
with the SIM300 module like the power regulation, external antenna, SIM Holder, etc.
Features
Provides serial TTL interface for easy and direct interface to microcontrollers
Can be used for GSM based Voice communications, Data/Fax, SMS,GPRS and TCP/IP
stack
Modules operation mode can be controlled through the PWR Switch connected to the
PWR pin (refer the SIM300 datasheet for more information)
Comes with an onboard wire antenna for better reception. Board provides an option for
adding an external antenna through an SMA connector
The SIM300 allows an adjustable serial baud rate from 1200 to 115200 bps (9600
default)
Modem a low power consumption of 0.25 A during normal operations and around 1 A
during transmission
Note: The modem consumes current of nearly 1A during transmission; please make sure that
your power supply can handle such currents.
6. INFRARED
Principles of Operation:
Since the sensor works by looking for reflected light, it is possible to have a sensor that can
return the value of the reflected light. This type of sensor can then be used to measure how
"bright" the object is. This is useful for tasks like line tracking.
Depiction of the operationof an