58726827 put coin and draw power

Upload: kattyperrysherry

Post on 04-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 58726827 Put Coin and Draw Power

    1/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 1

  • 8/13/2019 58726827 Put Coin and Draw Power

    2/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 2

    UNIT = 1INTRODUCTION

    The Microcontroller based put coin and draw power is

    latest technology for distibution of electric power for paying guest house, lodges andtrains. It can be effectively used to operate to the equipments. Built on the lines ofpayphones, here is an automatic coin collection devise for pay loads like lamps and air-conditioners to be used on a private electrical line.

    This type of systems are not available in the market, Their ICS maynot be easily available. Moreover, for simply functions.

    The system makes use of a sensor for detecting the coin and amicrocontroller that counts the coins and shows the count on a 7-segment display; when

    you close the load switch provided in the circuit, the energise to connect the load and thecoin count on display starts decrementing. When the count decrements to zero, the relayde-energise to disconnect the load.

  • 8/13/2019 58726827 Put Coin and Draw Power

    3/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 3

  • 8/13/2019 58726827 Put Coin and Draw Power

    4/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 4

    UNIT = 2COMPONENT LIST

    RESISTORS: LED:

    R1 = 220 LED1-LED5 = 5 mm (red)R2= 33 KR3 = 220K LDR:R4, R7, R9 ,R25 = 330 R5,R8 = 1K LDR1=10mmR6=10K R10-R16=270

    R17-R24=4.7K VR1=2.2MG preset

    CAPACITORS:

    SWITCH:

    C1,C7 = 10 F, 16 V electrolytic S1=Push to ONC2,C3 = 0.01F ceramic disk S2=ON/OFFC4=100 F, 16 V electrolyticC5,C6=33pF ceramic diskC8=1000 F,35V electrolyticC9,C10=0.1 F ceramic disk

  • 8/13/2019 58726827 Put Coin and Draw Power

    5/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 5

    DIODE: TRANSISTOR:

    D1-D5=1N4007rectifierdiode T1,T2=npn transister

    IC: DISPLAY:

    IC1 = NE556dual timer DIS1=LTS543

    IC2=AT89C2051microcontroller common-cathode,

    7-segmentdisplayIC3=CD5411 7-segment

    decoder/driverIC4= 7805 5V regulatorIC5= 7806 6V regulator

    TRANSFORMER: RELAY:

    X1=9V,500mA 6v,1C/O relay

  • 8/13/2019 58726827 Put Coin and Draw Power

    6/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 6

  • 8/13/2019 58726827 Put Coin and Draw Power

    7/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 7

    UNIT = 3CIRCUIT DIAGRAM

  • 8/13/2019 58726827 Put Coin and Draw Power

    8/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 8

  • 8/13/2019 58726827 Put Coin and Draw Power

    9/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page 9

    UNIT = 4PCB LAYOUT

  • 8/13/2019 58726827 Put Coin and Draw Power

    10/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    10

  • 8/13/2019 58726827 Put Coin and Draw Power

    11/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    11

    UNIT = 5

    CIRCUIT DESCRIPTION

    Fig-1 shows the put-coin-draw-power circuit. It comprises micro-controller AT89C2051(IC2), dual timer NE556 (IC1), 7-segment decoder CD4511 (IC3), regulators 7805 and7806 (IC4 and IC5), and few discrete components.

    LED1 is used as the light source for light-dependent resistor LDR1, which is madeof cadmium sulphide and acts as the coin detector. Resistors R1 limits the currentthrough LED1. The light from LED1 falls continuously on LDR1, whose resistance

    decreases with increase in the incident light intensity.

    The NE556 dual monolithic timing circuit is a highly stable controller capable ofproducing accurate time delays. It is basically a dual NE555. In the time delay mode ofoperation, the time is precisely controlled by an external resistor and capacitor. The twotimers operate independently of each other, sharing only Vcc and ground. The circuitsmay be triggered and reset on falling waveforms. One timer of NE556 is used for coindetection.

    LDR1, connected at trigger pin 6 of IC1, offers low resistance when light id falling

    on it and its trigger input goes low to set the flip-flop and make output pin 5 of IC1 high.

    When a coin is inserted, it interrupts the light falling on LDR1, and trigger pin 6 ofIC1 goes high to make output pin 5 low. This high-to-low pulse is used by themicrocontroller to display the coin count.

    Microcontroller AT89C2051 is the heart of the circuit. It is a low-voltage, high-performance, 8-bit microcontroller that features 2kB of flash 128 bytes of RAM, 15input/output (I/O) lines, two 16-bits timers/counters, a five-vector two-level interrupt

    architecture, a full duplex serial port, a precision analogue comparator ,on chip oscillatorand clock circuitry. A 12MHz crystal is used for providing the basic clock frequency. AllI/O pins are reset to 1 as soon as RST goes high. Holding RST pin high for two machinecycles, while the oscillator is running, resets the device. Power on reset is derived fromresistor R6 and capacitor C7. Switch S1 is used for manual reset.

    Coin-detection output pin5 of NE556 is interfaced with port pin P3.0 ofthe microcontroller [IC2]. The microcontroller program counts the number of coinsinserted and the count is shown on a 7-segment display.

  • 8/13/2019 58726827 Put Coin and Draw Power

    12/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    12

    The A through D inputs of 7 -segment decoder IC3 are interfacedwith port pins P1.4 through P1.7 of IC2. IC3 accepts the BCD input and decodes it toshow on the 7-segment display. Coin-detection is also indicated by LED2, which isconnected to pin P3.7 of the microcontroller.

    After inserting the coin, close load switch S2. Port pin P1.1 of the

    microcontroller goes high to drive transistor T2 into saturation. Relay RL1 energises andLED3 glows to indicate that the load is now switched on. D1 acts as a free-wheelingdiode.

    As power is drawn by the load [pin P1.1 high], the count shown on the 7-segment display [DIS1] decrements .Port pin P1.0 of the microcontroller triggers thesecond timer of NE556. When trigger pin 8 of NE556 goes low, its out put pin 9 goeshigh for a time period decided by present VR1 and capacitor C4. The high output of thetimer is inverted by transistor T1 and fed to port pin P3.2 of the microcontroller [pin6 ofIC2]. The count display decrements by 1 after port pin P3.2 of the microcontrollerreceives five pulses [indicated by glowing of LED4].

    Fig.2 shows the power supply circuit. The 230V AC mains is stepped downby transformer X1 to deliver the secondary output of 9V, 500mA. The transformer outputis rectified by a full-wave bridge rectifier comprising diodes D2 through D5,filtered bycapacitor C8 and then regulated by ICs 7805 [IC4] and 7806 [IC5]. Capacitor C9 andC10 bypass the ripples present in the regulated 5V&6V power supplies.LED5 acts as thepower-ON indicator and resistor R25 limits the current through LED5.

    SOFTWARE

    The source program is written in Assembly language and assembled usingMetalinks ASM51 assembler , which is freely available on the Internet for download. Thesource program has been well commented for easy understanding. It works as per theflow-chart shown in Fig.

    First , the program initializes the microcontrollers registers, then itchecks whether memory register is zero. If register r3 is zero, it goes for coin-detection.Else, it proceeds to count update and display. Coin-counter register r3 is incremented byfive after insertion of one coin. When the load switch is closed, port pin P3.1 goes low.Port pin P1.1 goes high to energise relay RL1. Port pin P3.2 goes low five times thendisplay count number decrements by one.

  • 8/13/2019 58726827 Put Coin and Draw Power

    13/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    13

    $mod51; p3.0 coin detect pulse; p3.1 power on switch; p3.2 monostable pulse(time duration)sensed via transistor; p3.7 coin sensed LED; p1.0 monostable triggering signal

    ; p1.1 relay on or POWER BEING CONSUMED LEDindicator; p1.4 to p1.7 input to CD 4511(6.1,2,7) to display on 7seg; r0,r1 for delay; r2 count for 7 seg display; r3 count of 5 monostable pulses(ASSUME Rs 1/1 MINapprox);(r4 flag ON already triggered; r5 flag timer already triggered) not used,for further

    development;r6 count upto 5; r7 count for 7seg display left justified

    org 000hsjmp startorg 040h

  • 8/13/2019 58726827 Put Coin and Draw Power

    14/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    14

    start: ; -INITIALISATION START-mov r3,#000h ;count is 0mov r4 , #000h;flag resetmovr5 ,#000h;mono on flag reset

    mov r2,#000h;coin count 0mov r6,#oo5h;counter set to 5mov r7,#oooh;setb p3.0; no coin detectedsetbp3.2; mono output detected set highclr p3.7; coin detected LED offclr p1.1

    ;relay de-energised

    Setb p1.0

    ;monostable not triggeredclr p1.4clr p1.5

    ; 7 seg display 0clr p1.6

    clr p1.7;- INITIALISATION OVER-acall delayacall delayacall delayacall delayacall delayacall delayacall delay

    acall delayacall delayacall delayacall delayacall delay

    tst count:mov a,r3

  • 8/13/2019 58726827 Put Coin and Draw Power

    15/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    15

    cjne a,#oooh, tstpwrswclrp1.1 ;if r3=0

    de-energise relaycoindet: jnb p3.0, updtr3 ;coin sensed

    mov r4,#000h ;flag rest;-PUTTING COUNT ON 7 SEG START-

    mov a,r2 ;no of coins detectedrl arl arl a

    ;no of coins count in MS of r2rl a

    mov b,a ;copy in b

    mov a,p1an1 a,#oofh ;extract LS portin keep intactorl a,b

    ;count ored in a

    Movp1, a;-PUTTING COUNT ON 7 SEG OVER-sjmp tst count

    updt r3: mova,r3add a,#005hclr cmov r3,a ;added in r3mov a,r2; count no of coins in r2inc a

    clr ccjne a,#10,maxmov a, #9max:mov r2,aacall coin ;

    EVERY TIME COIN SENSED

  • 8/13/2019 58726827 Put Coin and Draw Power

    16/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    16

    sjmp tstcounttstpwrsw: jnb p3.1 ,swpwron

    clr p1.1sjmp coindet

    swpw ron : setb p1.1 ; relay onjnb p3.2,coindet ; is delay running ? if yes go and sense coindec r3dec r6 ;

    reduce count from 5 set in r6mov a,r6cjne a,#000h, bypss r2dec r2 ;1

    subtracted from r2 for every 5 in r3

    mov a,r2jz minrl arl a

    rl arl aclr cmov b,amov a,b1an1 a,#00fhorl a,bmov p1,amov r6 , #005h; initial count of 5 in r6

    bypssr2: acall delayacall delayacall delayacall delayacall delayacall delay

  • 8/13/2019 58726827 Put Coin and Draw Power

    17/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    17

    acall delayacall delay

    trigr: clrp1.0acall delay ;

    mono triggeredsetbp1.0ajmp tstcount

    min: mov p1,#01hajmp tstcount

    ;-ROUTINES-delay: mov r0,#0c8hloop2:mov r1,#ofah

    loop1:nop

    nopnopdjnz r1,loop1 ;loop1 approx 5 X 200=1msecdjnz r0,loop2 ;loop2 250 X1msec=250msecret

    coin : setb p3.7acall delayacall delayacall delayacall delayclr p3.7acall delayacall delayacall delay

    acall delayretend

  • 8/13/2019 58726827 Put Coin and Draw Power

    18/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    18

    START

    INITIALISE REGISTERS

    IS COINCOUNT=0?

    DE-ENERGISE RELAY

    INCREMENT r3 BY5 INDICATE COIN

    SENSED ON LED

    COIN

    SENSED?

    IS POWERON?

    TIME ON?

    ENERGISE RELAY

  • 8/13/2019 58726827 Put Coin and Draw Power

    19/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    19

    DECREMENT r3 BY 1

    WAIT FOR 2 SECOND

    [DELAY]

    START TIMER

    MONOSTABLE

  • 8/13/2019 58726827 Put Coin and Draw Power

    20/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    20

    UNIT = 6

    HARDWARE DETAILS

    RESISTORS

    CAPACITORS

    DIODE

    INTEGRATED CIRCUIT(IC)

    LIGHT EMITTING DIODE

    TRANSISTOR

  • 8/13/2019 58726827 Put Coin and Draw Power

    21/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    21

    TRANSFORMER

    RELAY

    DISPLAY

    SWITCH

    LDR

    RESISTORS:

    SYMBOL OF RESISTOR:

    A resistor is a two-terminal electrical or electronic component that opposesan electric current by producing a voltage drop between its terminals inaccordance with Ohm's law:

    The electrical resistance is equal to the voltage drop across the resistordivided by the current through the resistor while the temperature remains thesame. Resistors are used as part of electrical networks and electronic circuits

    COLOUR CODE OF RESISTOR:

    Four-band identification is the most commonly used color coding schemeon all resistors. It consists of four colored bands that are painted around the bodyof the resistor. The scheme is simple: The first two numbers are the first two

    http://wiki/Image:Resistor_symbol_America.svg
  • 8/13/2019 58726827 Put Coin and Draw Power

    22/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    22

    significant digits of the resistance value, the third is a multiplier, and the fourth isthe tolerance of the value. Each color corresponds to a certain number, shown inthe chart below. The tolerance for a 4-band resistor will be 1%, 5%, or 10%.

    Color1st

    band2nd

    band3rdband

    (multiplier)4thband

    (tolerance)Temp.

    Coefficient

    Black 0 0 100

    Brown 1 1 101 1% (F) 100 ppm

    Red 2 2 102 2% (G) 50 ppm

    Orange 3 3 103 15 ppm

    Yellow 4 4 104 25 ppm

    Green 5 5 10 0.5% (D)

    Blue 6 6 10 0.25% (C)

    Violet 7 7 107 0.1% (B)

    Gray 8 8 108 0.05% (A)

    White 9 9 109

    Gold 10-1 5% (J)

    Silver 10- 10% (K)

    None 20% (M)

  • 8/13/2019 58726827 Put Coin and Draw Power

    23/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    23

    Preferred values:

    5-band axial resistors

    5-band identification is used for higher precision (lower tolerance) resistors(1%, 0.5%, 0.25%, 0.1%), to notate the extra digit. The first three bands representthe significant digits, the fourth is the multiplier, and the fifth is the tolerance. 5-band standard tolerance resistors are sometimes encountered, generally on olderor specialized resistors. They can be identified by noting a standard tolerance colorin the 4th band.The 5th band in this case is the temperature coefficientResistorstandards

    Power dissipation:

    The power dissipated by a resistor is the voltage across the resistor

    multiplied by the current through the resistor:

    TYPES OF RESISTOR:

    All three equations are equivalent. The first is derived from Joule's law, andother two are derived from that by Ohm's Law.1.Fixed Resistor:

    2.Variable Resistor:

    http://wiki/Image:3_Resistors.jpghttp://wiki/Image:3_Resistors.jpg
  • 8/13/2019 58726827 Put Coin and Draw Power

    24/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    24

    APPLICATIONS: To establish a proper value of voltage drops.

    To limit the current.

    To provide proper load.

    CAPACITORS:A part from resistor and inductors, a capacitor is the other basic

    component used in electronics circuit. It is a device which,(1) has the ability to store change which neither a resistor nor an inductor can do.(2) oppose any charge of voltage in the circuit in which is connected.(3) block the passage of direct current through it.

    Capacitor are manufactured in various size, shapes type and are used forhundred of purpose.

    TYPES OF CAPACITORS:These can be group in two classes as detailed bellow.

    A) Non electrolyte type:It includes paper, mica and ceramic capacitors,

    such capacitors have no polarity requirement i.e.connected in either direction in circuit.

    B) Electrolytic capacitors:These capacitors are called electrolytic they usedand electrolyte as negative plate.

  • 8/13/2019 58726827 Put Coin and Draw Power

    25/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    25

    DIODE:A diode is a semiconductor diode which allows current to flow through it

    in only one direction. Although a transistor is also a semiconductor device, It doesnot operate the way a diode does. A diode is specifically made to allow current to

    flow through it in only one direction.

    DIODE CHARACTERISTIC:

    Figure shows combined forward bias and reverse bias V-I characteristics ofGe and Si diodes. From figure-1 we can easily see that leakage current of Ge diodejunction is much more than Si diode junction.

    APPLICATION:

  • 8/13/2019 58726827 Put Coin and Draw Power

    26/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    26

    High-speed switching

    FEATURES: Glass sealed envelope. (GSD) High speed. High reliability.

    TRANSFORMER:Different voltages are used for the transmission and distribution ofelectrical power. For example, the electrical power is done at l l Kv or 440V.

    Sometimes low voltage is required for specification application say electric arewelding requires 30 to 50 volts. Hence necessary to transform the power from onvoltage to anther voltage. Transformer does this at high efficiency. In the chapter;we shall study some basic aspects of single phase transformer.

    PRINCIPLE:Transformer works on the principle of mutual induction. In figure coils A

    and B are placer near to each other flux produced by coil A due to current flowlinks with coil B. If the current through the coil changes, the flux changes, so emfis induced in coil B. This inducer emf.

    BASIC CONSTRUCTION AND WORKING:Coil A having number of turns is wound on the limb of a laminated core.

    Another coil B having N2 turns is wound on the other limb.

    ADVANTAGES:I. Simple transformer without the centre tapping in secondary is needed.

  • 8/13/2019 58726827 Put Coin and Draw Power

    27/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    27

    II. Peak inverse voltage across the diode is half than that in the full waverectifier using two diodes.

    III. For the same secondary voltage. The output d.c.voltage is twice than thatinn the full wave rectifier with two diodes.

    DISADVANTAGES:I. Four diodes are required.

    II. Two diodes conduct in series so the voltage drop in the diode is twice. Thisbecomes important when the output voltage is low.

    RELAY

    A relay is an electrically operated switch. Current flowing through the coil of the relaycreates a magnetic field which attracts a lever and changes the switch contacts. The coil

  • 8/13/2019 58726827 Put Coin and Draw Power

    28/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    28

    current can be on or off so relays have two switch positions and they are double throw(changeover) switches.Relays allow one circuit to switch a second circuit which can be completely separate fromthe first. For example a low voltage battery circuit can use a relay to switch a 230V ACmains circuit. There is no electrical connection inside the relay between the two circuits,

    the link is magnetic and mechanical.The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but itcan be as much as 100mA for relaysdesigned to operate from lower voltages. Most ICs(chips) cannot provide this current and a transistor is usually used to amplify the smallIC current to the larger value required for the relay coil. The maximum output currentfor the popular 555 timer IC is 200mA so these devices can supply relay coils directlywithout amplification.Relays are usuallly SPDT or DPDT but they can have many more sets of switch contacts,for example relays with 4 sets of changeover contacts are readily available. For furtherinformation about switch contacts and the terms used to describe them please see the

    page on switches.Most relays are designed for PCB mounting but you can solder wires directly to the pinsproviding you take care to avoid melting the plastic case of the relay.The supplier's catalogue should show you the relay's connections. The coil will be obviousand it may be connected either way round. Relay coils produce brief high voltage 'spikes'when they are switched off and this can destroy transistors and ICs in the circuit. Toprevent damage you must connect a protection diode across the relay coil.The animated picture shows a working relay with its coil and switch contacts. You cansee a lever on the left being attracted by magnetism when the coil is switched on. Thislever moves the switch contacts. There is one set of contacts (SPDT) in the foregroundand another behind them, making the relay DPDT.

    The relay's switch connections are usually labelled COM, NC and NO:COM= Common, always connect to this, it is the moving part of the switch.NC= Normally Closed, COM is connected to this when the relay coil is off.NO= Normally Open, COM is connected to this when therelay coil is on.Connect to COM and NO if you want the switched circuit to be on when the relay coil ison.Connect to COM and NC if you want the switched circuit to be on when the relay coil isoff.Choosing a relayYou need to consider several features when choosing a relay:Physical size and pin arrangementIf you are choosing a relay for an existing PCB you will need to ensure that itsdimensions and pin arrangement are suitable. You should find this information in thesupplier's catalogue.Coil voltageThe relay's coil voltage rating and resistance must suit the circuit powering the relay coil.

  • 8/13/2019 58726827 Put Coin and Draw Power

    29/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    29

    Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readilyavailable. Some relays operate perfectly well with a supply voltage which is a little lowerthan their rated value.Coil resistanceThe circuit must be able to supply the current required by the relay coil. You can use

    Ohm's law to calculate the current:

    Relay coil current =supply voltage

    coil resistance

    For example: A 12V supply relay with a coil resistance of 400 passes a current of 30mA.This is OK for a 555 timer IC (maximum output current 200mA), but it is too much formost ICs and they will require a transistor to amplify the current.Switch ratings voltage and current)The relay's switch contacts must be suitable for the circuit they are to control. You willneed to check the voltage and current ratings. Note that the voltage rating is usuallyhigher for AC, for example: "5A at 24V DC or 125V AC".

    Switch contact arrangement SPDT, DPDT etc)Most relays are SPDT or DPDT which are often described as "single pole changeover"(SPCO) or "double pole changeover" (DPCO). For further information please see the pageon switches.

    Reed relaysReed relays consist of a coil surrounding a reed switch.Reed switches are normally operated with a magnet, butin a reed relay current flows through the coil to create amagnetic field and close the reed switch.

    Reed relays generally have higher coil resistances thanstandard relays (1000 for example) and a wide rangeof supply voltages (9-20V for example). They arecapable of switching much more rapidly than standardrelays, up to several hundred times per second; but theycan only switch low currents (500mA maximum for example).The reed relay shown in the photograph will plug into a standard 14-pin DIL socket ('ICholder').For further information about reed switches please see the page on switches.

    IC [INTERGRATED CIRCUIT]:

    Reed RelayPhotograph Rapid Electronics

    http://www.rapidonline.com/http://www.rapidonline.com/
  • 8/13/2019 58726827 Put Coin and Draw Power

    30/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    30

    Features Compatible with MCS-51 Products 2K Bytes of Reprogrammable Flash MemoryEndurance: 1,000 Write/Erase Cycles 2.7V to 6V Operating Range

    Fully Static Operation: 0 Hz to 24 MHz Two-level Program Memory Lock 128 x 8-bit Internal RAM 15 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial UART Channel Direct LED Drive Outputs On-chip Analog Comparator Low-power Idle andPower-down ModesDescriptionThe AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with2K bytes of Flash programmable and erasable read only memory (PEROM). Thedevice is manufactured using Atmels high-density nonvolatile memory technologyand is compatible with the industry-standard MCS-51 instruction set. By combining aversatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerfulmicrocomputer which provides a highly-flexible and cost-effective solution to manyembedded control applications.The AT89C2051 provides the following standard features: 2K bytes of Flash, 128bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interruptarchitecture, a full duplex serial port, a precision analog comparator, on-chip oscillator

    and clock circuitry. In addition, the AT89C2051 is designed with static logic for operationdown to zero frequency and supports two software selectable power savingmodes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serialport and interrupt system to continue functioning. The power-down mode saves theRAM contents but freezes the oscillator disabling all other chip functions until the nexthardware reset.Pin Configuration

  • 8/13/2019 58726827 Put Coin and Draw Power

    31/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    31

    Block Diagram

  • 8/13/2019 58726827 Put Coin and Draw Power

    32/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    32

    Pin DescriptionVCCSupply voltageGNDGround.Port 1Port 1 is an 8-bit bi-irectional I/O port. Port pins P1.2 toP1.7 provide internal pullups. P1.0 and P1.1 require externalpullups. P1.0 and P1.1 also serve as the positive input(AIN0) and the negative input (AIN1), respectively, of the

    on-chip precision analog comparator. The Port 1 outputbuffers can sink 20 mA and can drive LED displays directly.When 1s are written to Port 1 pins, they can be used asinputs. When pins P1.2 to P1.7 are used as inputs and areexternally pulled low, they will source current (IIL) becauseof the internal pullups.Port 1 also receives code data during Flash programmingand verification.Port 3Port 3 pins P3.0 to P3.5, P3.7 are seven bi-irectional I/O

    pins with internal pullups. P3.6 is hard-wired as an input tothe output of the on-chip comparator and is not accessibleas a general purpose I/O pin. The Port 3 output buffers cansink 20 mA. When 1s are written to Port 3 pins they arepulled high by the internal pullups and can be used asinputs. As inputs, Port 3 pins that are externally beingpulled low will source current (IIL) because of the pullups.Port 3 also serves the functions of various special features

  • 8/13/2019 58726827 Put Coin and Draw Power

    33/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    33

    of the AT89C2051 as listed below:Port 3 also receives some control signals for Flash programmingand verification.RSTReset input. All I/O pins are reset to 1s as soon as RST

    goes high. Holding the RST pin high for two machinecycles while the oscillator is running resets the device.Each machine cycle takes 12 oscillator or clock cycles.XTAL1Input to the inverting oscillator amplifier and input to theinternal clock operating circuit.XTAL2Output from the inverting oscillator amplifier.Oscillator CharacteristicsXTAL1 and XTAL2 are the input and output, respectively,

    of an inverting amplifier which can be configured for use asan on-chip oscillator, as shown in Figure 1. Either a quartzcrystal or ceramic resonator may be used. To drive thedevice from an external clock source, XTAL2 should be leftunconnected while XTAL1 is driven as shown in Figure 2.There are no requirements on the duty cycle of the externalclock signal, since the input to the internal clocking circuitryis through a divide-by-two flip-flop, but minimum and maximumvoltage high and low time specifications must beobserved.Figure 1. Oscillator ConnectionsNote

    CD4511 7-SEGMENT DECODER/DRIVERFigure 1 shows a simplified block of the 74LS48 BCD to 7-Segment Decoder. The 74LS48contains three main block circuits, a 7-segment decoder, a driver and a system of basicmemory units. The basic memory unit is often called a latch or a flip-flop. The decoderoutputs drive an encoder circuit made up of OR gates that generate the 7-segment codenecessary to display the digits 0 through 9 and the letters a through f. The output

  • 8/13/2019 58726827 Put Coin and Draw Power

    34/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    34

    devices are current driver transistors that supply the proper current to th e segments inthe driver.

    Figure 1

    Part 1. -- Set-Reset flip-flopWire the latch circuit shown in fiqure 2. The Set (A) and Reset (B) are the inputs and C(L1) and C (L2) are the outputs.Apply power to the circuit and create a truth table for S and R Inputs and C and Coutputs.Wire the latch circuit shown in figure 3. Repeat steps 1. and 2. for circuit 3. These newoutputs are labeled D and D.Why do we call this circuit a basic memory unit? What happens to the outputs when Sand R both 0? Refer to the textbook (Katz) for a discussion of flip-flops (chapter 6).Part 2. -- 7-Segment Decoder-Driver and Display)Construct the circuit shown in figure 4. Use the TTL handbook to verify the correctconections. The pin connections for the 74LS48 and the 7-Segment Display are shown infiqure 5.Calculate the value of the resistor between the 74LS48 and the 7-seg LED.

    Apply power to the circuit. Create a truth table for figure 4. Do the LEDs L1-L4 whichoutput the binary word agree with the output of the 7-Segment LED? What does the 7-Segment LED read in binary states 1010-1111? What do you think the LT, RBI and BI/ RBOpins do?

  • 8/13/2019 58726827 Put Coin and Draw Power

    35/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    35

    Figure 3

    Figure 4

  • 8/13/2019 58726827 Put Coin and Draw Power

    36/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    36

    KA78XX/KA78XXA3-Terminal 1A Positive Voltage Regulator

    Features Output Current up to 1A Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V Thermal Overload Protection

    Short Circuit Protection Output Transistor Safe Operating Area ProtectionDescriptionThe KA78XX/KA78XXA series of three-terminal positiveregulator are available in the TO-220/D-PAK package andwith several fixed output voltages, making them useful in awide range of applications. Each type employs internalcurrent limiting, thermal shut down and safe operating areaprotection, making it essentially indestructible. If adequateheat sinking is provided, they can deliver over 1A outputcurrent. Although designed primarily as fixed voltage

    regulators, these devices can be used with externalcomponents to obtain adjustable voltages and currents.

    TO-220 D-PAK

  • 8/13/2019 58726827 Put Coin and Draw Power

    37/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    37

    1. Input 2. GND 3. Output

    556

    DESCRIPTIONBoth the 556 and 556-1 Dual Monolithic timing circuits are highlystable controllers capable of producing accurate time delays oroscillation. The 556 and 556-1 are a dual 555. Timing is provided byan external resistor and capacitor for each timing function. The twotimers operate independently of each other, sharing only VCC and

    ground. The circuits may be triggered and reset on fallingwaveforms. The output structures may sink or source 200mA.FEATURES Turn-off time less than 2ms (556-1) Maximum operating frequency >500kHz (556-1) Timing from microseconds to hours Replaces two 555 timers Operates in both astable and monostable modes High output current Adjustable duty cycle

    TTL compatible Temperature stability of 0.005%/C SE556-1 compliant to MIL-STD or JAN

    APPLICATIONS Precision timing Sequential timing Pulse shaping Pulse generator Missing pulse detector

  • 8/13/2019 58726827 Put Coin and Draw Power

    38/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    38

    Tone burst generator Pulse width modulation Time delay generator Frequency division Touch-Tone[encoder

    Industrial controls Pulse position modulation Appliance timing Traffic light control

    LIGHT EMITTING DIODE:A light-emitting diode (LED) is a semiconductor device that emits

    incoherent monochromatic light when electrically biased in the forward direction.This effect is form of electroluminescence. The color depends on the semiconducting material used, and can be near-ultraviolet, invisible or infrared. NickHolon yak Jr. (1928) of the University of Illinois at Urbana-Champaign developedthe first practical visible-spectrum LED in 1962.

    PHYSICAL FUNCTION:An LED is a special type of semiconductor diode. Like a normal diode, it

    consists of a chip of semi conducting material impregnated, or doped, withimpurities to create a structure called a pn junction. Charge-carriers (electronsand holes) are created by an electric current passing through the junction. Whenan electron meets a hole, it falls into a lower energy level, and releases energy inthe from of a photon as it does so.

    LED MATERIALS:LED development began with infrared and red devices made with gallium

    arsenide. Advances in materials science have made possible the production ofdevices with ever shorter wavelengths, producing light in a variety of colors.

  • 8/13/2019 58726827 Put Coin and Draw Power

    39/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    39

    Conventional LEDs are made from a variety of inorganic minerals,producing the following colors:

    Aluminum gallium arsenide(AlGaAs ) - red and infrared Gallium aluminum phosphide green

    Gallium arsenide/phosphide (GaAsp) red orange-red, orange, and yellow Gallium nitride (GaN) green, pure green (or emerald green), and blue Gallium phosphide (GaP) red, yellow and green Zinc selenide (ZnSe) blue Indium gallium nitride (InGaN)-bluish-green and blue Indium gallium aluminum phosphide orange-red, orange, yellow, and

    green Silicon carbide (Sic)-blue Diamond - ultraviolet Silicon (Si) under development

    LED APPLICATIONS:Here is a list of known applications for LEDs, some of which are further

    elaborated upon in the following text: In general, commonly used as information indicators in various types of

    embedded systems (many of which are listed below) Thin lightweight message displays, e.g. in public information signs (at

    airports and railway stations, among other places) Status indicators, e.g. on/off lights on professional instruments and

    consumers audio/video equipment Infrared LEDs in remote controls (for TVs, VCRs, etc) Clusters in traffic signals, replacing ordinary bulbs behind colored glass Car indicator lights and bicycle lighting; also for pedestrians to be seen by

    car traffic Calculator and measurement instrument displays (seven segment displays),

    although now mostly replaced by LCDs Red or yellow LEDs are used in indicator and [alpha]numeric displays in

    environments where night vision must be retained: aircraft cockpits,submarine and ship bridges, astronomy observatories, and in the field, e.g.night time animal watching and military field use

    Red or yellow LEDs are also use in photographic darkrooms, for providinglighting which does not lead to unwanted exposure of the film

    Illumination, e.g. flashlights (US)/torches (UK).

  • 8/13/2019 58726827 Put Coin and Draw Power

    40/68

  • 8/13/2019 58726827 Put Coin and Draw Power

    41/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    41

    Now, in order to use this device in a simple circuit, all we need to do is put a voltageacross it and measure the current flowing through it. However, measuring current canbe a little tricky. So, we put another resistor in series, and measure the voltage across

    the LDR. This makes us a potential divider, and the voltage across the LDR isproportional to the current. The diagrams below show the concept.

    TRANSISTOR:

    Types of Transistor

    An NPN Transistor Configuration

    Note: Conventional current flow.

    We know that the transistor is a "CURRENT" operated device and that a large current

    (Ic) flows freely through the device between the collector and the emitter terminals.

    However, this only happens when a small biasing current (Ib) is flowing into the base

    terminal of the transistor thus allowing the base to act as a sort of current control input.

  • 8/13/2019 58726827 Put Coin and Draw Power

    42/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    42

    The ratio of these two currents (Ic/Ib) is called the DC Current Gain of the device and is

    given the symbol of hfe or nowadays Beta, (). Beta has no units as it is a ratio. Also, the

    current gain from the emitter to the collector terminal, Ic/Ie, is called Alpha, (), and is a

    function of the transistor itself. As the emitter current Ie is the product of a very small

    base current to a very large collector current the value of this parameter is very close

    to unity, and for a typical low-power signal transistor this value ranges from about 0.950

    to 0.999.

    and Relationships

    By combining the two parameters and we can produce two mathematical expressions

    that gives the relationship between the different currents flowing in the transistor.

    The values of Beta vary from about 20 for high current power transistors to well over

    1000 for high frequency low power type bipolar transistors. The equation for Beta can

    also be re-arranged to make Ic as the subject, and with zero base current (Ib = 0) the

  • 8/13/2019 58726827 Put Coin and Draw Power

    43/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    43

    resultant collector current Ic will also be zero, (x 0). Also when the base current is high

    the corresponding collector current will also be high resulting in the base current

    controlling the collector current. One of the most important properties of the BipolarJunction Transistor is that a small base current can control a much larger collectorcurrent. Consider the following example.

    PN Transistor are of a forward biased diode. Then the base voltage, (Vbe) of an NPN

    Transistor must be greater than this 0.7 V otherwise the transistor will not conduct with

    the base current given as.

    Where: Ib is the base current, Vb is the base bias voltage, Vce is the base-emitter volt

    drop (0.7v) and Rb is the base input resistor.

    The Common Emitter Configuration.

    One other point to remember about NPN Transistors. The collector voltage, (Vc) must begreater than the emitter voltage, (Ve) to allow current to flow through the device

    between the collector-emitter junction. Also, there is a voltage drop between the base and

    the emitter terminal of about 0.7v for silicon devices as the input characteristics of an

    Nas a switch to turn load currents "ON" or "OFF" by controlling the Base signal to the

    transistor, NPN Transistorscan also be used to produce a circuit which will also amplifyany small AC signal applied to its Base terminal. If a suitable DC "biasing" voltage is

    firstly applied to the transistors Base terminal thus allowing it to always operate withinits linear active region, an inverting amplifier circuit called a Common Emitter Amplifier

    is produced.

    One such Common Emitter Amplifierconfiguration is called aClass A Amplifier.A Class

    A Amplifier operation is one where the transistors Base terminal is biased in such a way

    http://www.electronics-tutorials.ws/amplifier/amp_1.htmlhttp://www.electronics-tutorials.ws/amplifier/amp_1.htmlhttp://www.electronics-tutorials.ws/amplifier/amp_1.htmlhttp://www.electronics-tutorials.ws/amplifier/amp_1.html
  • 8/13/2019 58726827 Put Coin and Draw Power

    44/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    44

    that the transistor is always operating halfway between its cut-off and saturation points,

    thereby allowing the transistor amplifier to accurately reproduce the positive and

    negative halves of the AC input signal superimposed upon the DC Biasing voltage.

    Without this "Bias Voltage" only the positive half of the input waveform would beamplified. This type of amplifier has many applications but is commonly used in audio

    circuits such as pre-amplifier and power amplifier stages.

    With reference to the common emitter configuration shown below, a family of curves

    known commonly as the Output Characteristics Curves, relates the output collector

    current, (Ic) to the collector voltage, (Vce) when different values of base current, (Ib) are

    applied to the transistor for transistors with the same value. A DC "Load Line" can also

    be drawn onto the output characteristics curves to show all the possible operating points

    when different values of base current are applied. It is necessary to set the initial value of

    Vce correctly to allow the output voltage to vary both up and down when amplifying AC

    input signals and this is called setting the operating point or Quiescent Point, Q-point for

    short and this is shown below.

    The Common Emitter Amplifier Circuit

  • 8/13/2019 58726827 Put Coin and Draw Power

    45/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    45

    Output Characteristics Curves for a Typical Bipolar Transistor

    The most important factor to notice is the effect of Vce upon the collector current Ic

    when Vce is greater than about 1.0 volts. You can see that Ic is largely unaffected by

    changes in Vce above this value and instead it is almost entirely controlled by the base

    current, Ib. When this happens we can say then that the output circuit represents that of

    a "Constant Current Source". It can also be seen from the common emitter circuit above

    that the emitter current Ie is the sum of the collector current, Ic and the base current, Ib,

    added together so we can also say that " Ie = Ic + Ib " for the common emitter

    configuration.

    By using the output characteristics curves in our example above and also Ohms Law, the

    current flowing through the load resistor, (RL), is equal to the collector current, Ic

    entering the transistor which inturn corresponds to the supply voltage, (Vcc) minus the

    voltage drop between the collector and the emitter terminals, (Vce) and is given as:

  • 8/13/2019 58726827 Put Coin and Draw Power

    46/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    46

    Also, a Load Line can be drawn directly onto the graph of curves above from the point of

    "Saturation" when Vce = 0 to the point of "Cut-off" when Ic = 0 giving us the "Operating"

    or Q-point of the transistor. These two points are calculated as:

    Then, the collector or output characteristics curves for Common Emitter NPN Transistors

    can be used to predict the Collector current, Ic, when given Vce and the Base current, Ib.

    A Load Line can also be constructed onto the curves to determine a suitable Operating

    or Q-point which can be set by adjustment of the base current.

    The PNP Transistor

    The PNP Transistoris the exact opposite to the NPN Transistordevice we looked at inthe previous tutorial. Basically, in this type of transistor construction the two diodes are

    reversed with respect to the NPN type, with the arrow, which also defines the Emitter

    terminal this time pointing inwards in the transistor symbol. Also, all the polarities arereversed which means that PNP Transistors "sink" current as opposed to the NPN

    transistor which "sources" current. Then, PNP Transistors use a small output base

    current and a negative base voltage to control a much larger emitter-collector current.

  • 8/13/2019 58726827 Put Coin and Draw Power

    47/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    47

    The construction of a PNP transistor consists of two P-type semiconductor materials

    either side of the N-type material as shown below.

    A PNP Transistor Configuration

    Note: Conventional current flow.

    The PNP Transistorhas very similar characteristics to their NPN bipolar cousins, exceptthat the polarities (or biasing) of the current and voltage directions are reversed for any

    one of the possible three configurations looked at in the first tutorial, Common Base,

    Common Emitter and Common Collector. Generally, PNP Transistors require a negative

    (-ve) voltage at their Collector terminal with the flow of current through the emitter-

    collector terminals being Holes as opposed to Electrons for the NPN types. Because the

    movement of holes across the depletion layer tends to be slower than for electrons, PNP

    transistors are generally more slower than their equivalent NPN counterparts when

    operating.

    To cause the Base current to flow in a PNP transistor the Base needs to be more negativethan the Emitter (current must leave the base) by approx 0.7 volts for a silicon device or

    0.3 volts for a germanium device with the formulas used to calculate the Base resistor,

    Base current or Collector current are the same as those used for an equivalent NPN

    transistor and is given as.

  • 8/13/2019 58726827 Put Coin and Draw Power

    48/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    48

    Generally, the PNP transistor can replace NPN transistors in electronic circuits, the only

    difference is the polarities of the voltages, and the directions of the current flow. PNP

    Transistors can also be used as switching devices and an example of a PNP transistor

    switch is shown below.

    A PNP Transistor Circuit

    The Output Characteristics Curves for a PNP transistor look very similar to those for an

    equivalent NPN transistor except that they are rotated by 180o to take account of the

    reverse polarity voltages and currents, (the currents flowing out of the Base and Collector

    in a PNP transistor are negative).

  • 8/13/2019 58726827 Put Coin and Draw Power

    49/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    49

    -SEGMENT DISPLAY

    The illustration to the right shows the basic layout of the segments in aseven-segment display. The segments themselves are identified with lower-caseletters "a" through "g," with segment "a" at the top and then counting clockwise.Segment "g" is the center bar.

    Most seven-segment digits also include a decimal point ("dp"), and some also

    include an extra triangle to turn the decimal point into a comma. This improvesreadability of large numbers on a calculator, for example. The decimal point isshown here on the right, but some display units put it on the left, or have adecimal point on each side.

    In addition, most displays are actually slanted a bit, making them look as ifthey were in italics. This arrangement allows us to turn one digit upside downand place it next to another, so that the two decimal points look like a colonbetween the two digits. The technique is commonly used in LED clock displays.

  • 8/13/2019 58726827 Put Coin and Draw Power

    50/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    50

    Seven-segment displays can be packaged in a number of ways. Three typicalpackages are shown above. On the left we see three small digits in a single 12-pin DIP package. The individual digits are very small, so a clear plastic bubble ismolded over each digit to act as a magnifying lens. The sides of the end bubblesare flattened so that additional packages of this type can be placed end-to-end

    to create a display of as many digits as may be needed.

    The second package is essentially a 14-pin DIP designed to be installedvertically. Note that for this particular device, the decimal point is on the left.This is not true of all seven-segment displays in this type of package.

    One limitation of the DIP package is that it cannot support larger digits. Toget larger displays for easy reading at a distance, it is necessary to change thepackage size and shape. The package on the right above is larger than the othertwo, and thus can display a digit that is significantly larger than will fit on a

    standard DIP footprint. Even larger displays are also available; some digitalclocks sport digits that are two to five inches tall.

    Seven-segment displays can be constructed using any of a number ofdifferent technologies. The three most common methods are fluorescent displays(used in many line-powered devices such as microwave ovens and some clocksand clock radios), liquid crystal displays (used in many battery-powered devicessuch as watches and many digital instruments), and LEDs (used in either line-powered or battery-powered devices). However, fluorescent displays require afairly high driving voltage to operate, and liquid crystal displays require specialtreatment that we are not yet ready to discuss. Therefore, we will work with a

    seven-segment LED display in this experiment.

    Schematic Diagram

  • 8/13/2019 58726827 Put Coin and Draw Power

    51/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    51

    As shown in the two schematic diagrams above, the LEDs in a seven-segmentdisplay are not isolated from each other. Rather, either all of the cathodes, or allof the anodes, are connected together into a common lead, while the other endof each LED is individually available. This means fewer electrical connections to

    the package, and also allows us to easily enable or disable a particular digit bycontrolling the common lead. (In some cases, the common connections aremade to groups of LEDs, and the external wiring must make the finalconnections between them. In other cases, the common connection is madeavailable at more than one location for convenience in laying out printed circuitboards. When laying out circuits using such devices, you simply need to take thespecific connection details into account.)

    There is no automatic advantage of the common-cathode seven-segment unitover the common-anode version, or vice-versa. Each type lends itself to certainapplications, configurations, and logic families. We'll learn more about this in

    later experiments. For the present, we will use a common-cathode display as ourexperimental example.

  • 8/13/2019 58726827 Put Coin and Draw Power

    52/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    52

    SWITCH

    Type of Switch Circuit Symbol Example

    ON-OFFSingle Pole, Single Throw = SPST

    A simple on-off switch. This type can beused to switch the power supply to a

    circuit.

    When used with mains electricity thistype of switch mustbe in the live wire,but it is better to use a DPST switch toisolate both live and neutral. SPST toggle switch

    (ON)-OFFPush-to-make = SPST Momentary

    A push-to-make switch returns to itsnormally open (off) position when yourelease the button, this is shown by thebrackets around ON. This is thestandard doorbell switch.

    Push-to-make switch

  • 8/13/2019 58726827 Put Coin and Draw Power

    53/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    53

    ON-(OFF)Push-to-break = SPST Momentary

    A push-to-break switch returns to itsnormally closed (on) position when you

    release the button. Push-to-break switch

    ON-ONSingle Pole, Double Throw = SPDT

    This switch can be on in both positions,switching on a separate device in eachcase. It is often called a changeoverswitch.For example, a SPDT switch

    can be used to switch on a red lamp inone position and a green lamp in theother position.

    A SPDT toggle switch may be used as a simpleon-off switch by connecting to COM and one ofthe A or B terminals shown in the diagram. Aand B are interchangeable so switches areusually not labelled.

    ON-OFF-ONSPDT Centre Off

    A special version of the standard SPDTswitch. It has a third switching positionin the centre which is off. Momentary(ON)-OFF-(ON) versions are alsoavailable where the switch returns to thecentral off position when released.

    SPDT toggle switch

    SPDT slide switch(PCB mounting)

    SPDT rocker switch

    Dual ON-OFFDouble Pole, Single Throw = DPST

    A pair of on-off switches which operatetogether (shown by the dotted line in thecircuit symbol).

    A DPST switch is often used to switchmains electricity because it can isolate DPST rocker switch

  • 8/13/2019 58726827 Put Coin and Draw Power

    54/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    54

    both the live and neutral connections.

    Dual ON-ONDouble Pole, Double Throw = DPDT

    A pair of on-on switches which operatetogether (shown by the dotted line in thecircuit symbol).

    A DPDT switch can be wired up as areversing switchfor a motor as shownin the diagram.

    ON-OFF-ONDPDT Centre Off

    A special version of the standard SPDTswitch. It has a third switching positionin the centre which is off. This can bevery useful for motor control becauseyou have forward, off and reversepositions. Momentary (ON)-OFF-(ON)versions are also available where theswitch returns to the central off position

    when released.

    DPDT slide switch

    Wiring for Reversing Switch

  • 8/13/2019 58726827 Put Coin and Draw Power

    55/68

  • 8/13/2019 58726827 Put Coin and Draw Power

    56/68

  • 8/13/2019 58726827 Put Coin and Draw Power

    57/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    57

  • 8/13/2019 58726827 Put Coin and Draw Power

    58/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    58

    UNIT = 7

    POWER SUPPLYINTRODUCTION

    Most of the electronics devices and circuits required D.C. sources of theiroperation. Dry cells and batteries are one of form the D.C. sources. They have theadvantages of being portable and ripple free.

    A typical D.C. power supply consists of three stages. They are follows:1. Rectification2. Filtering3. Regulation

    A single power can provide as many voltages as are needed; using a voltagedivider. A voltage divider is simple taped resistor connected across the output terminals.The taped resistor may consist of two or three resistor connected in series across thepower supply in fact, bleeder resister may also be use as voltage divider. Now we arediscuss about the three stages of D.C. power supply.

    RECTIFICATION:

    Rectification is process in which simple harmonic A.C. voltage is converted into aunidirectional voltage (D.C. voltage). It is a circuit, which employs one or more diode toconvert A.C. voltage into pulsating D.C. voltage. There are mainly three different types ofrectifier circuits. They are,

    2. Half wave rectifier,3. Full wave rectifier,4. Full wave bridge rectifier.

  • 8/13/2019 58726827 Put Coin and Draw Power

    59/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    59

    FULL WAVE RECTIFIERThe full wave rectifier is more expensive but more efficient then the full wave

    circuit. The circuit of a full wave rectifier is shown in figure.

    figThe circuit uses two rectifier elements and the transformer with secondary center

    tapped. The bridge circuit, however eliminate the use to secondary center tap but

    required four rectifier elements.

    FILTERS:

    The output of rectifier contains A.C. components of considerable magnitude. Theeffect of this A.C. components is to vary the output D.C. voltage. The filter system is

    used to reduce the magnitude of this ripple ( pulsation ) present in the output voltagesupplied by the rectifier and provide a regulated and constant voltage. No filters, inpractice give any output voltage as ripple free as that of D.C. battery but it approaches itso closely that the power supply performs well.

    The out of various rectifier circuit is pulsating. It has a D.C. value and some A.C.variation called ripples. This type of output is not useful driving, electronic circuits. Infact, these circuit required a very steady D.C. output that approached the smoothness outthe pulsating in the output.

    There are four popular filter circuits. They are,1. Series inductor filter,

    2. Shunt capacitor filter,3. LC filter,4. TT filter.

    REGULATION:

  • 8/13/2019 58726827 Put Coin and Draw Power

    60/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    60

    We have discussed about rectifiers and filters. They are capable of supplying D.C.voltage and current but the voltage supplied by the rectifier circuit never remainsconstant and it shows changes when load is changed or A.C. supply (main input)fluctuates. It also contains A.C. ripples which can not be completely eliminated byfiltering. It has been seen that with a capacitor filter voltage regulation is poor (D.C.

    output voltage changes when the load current is changed). For a choke input filter,output voltage also shows variation for low load currents. An other drawback with thisfilter circuit is that they can not filter out variation from the D.C. output voltage causedby fluctuations in the A.C. supply.

    We also know that in almost all circuit applications, it is important to have aconstant D.C. supply voltage but output of a filter shows frequent variations in D.C.supply. That caused unsatisfactory operation of equipment. It can also damage it. Due tothis reason voltage regulation is required.

    Voltage regulation is defined as the percentage change in the output voltagewhen the load is removed. The good regulation means that the output voltage remains

    constant.

  • 8/13/2019 58726827 Put Coin and Draw Power

    61/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    61

    UNIT = 8

    APPLICATIONSThis equipment can be used for.

    1. Paying guest house.2. Lodges.3. Trains.

    4. Fairs.5. Hotels.

  • 8/13/2019 58726827 Put Coin and Draw Power

    62/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    62

  • 8/13/2019 58726827 Put Coin and Draw Power

    63/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    63

    UNIT = 9COMPONENT PRICE LIST

    TOTAL PRIZE Rs. 415.00

    NAME QUANTITY PRIZE

    (1)Resistor

    24 Rs. 12.00

    (2) Capacitor 10 Rs. 16.00

    (3) Transistor 02 Rs. 12.00

  • 8/13/2019 58726827 Put Coin and Draw Power

    64/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    64

    (4) Diode 05 Rs. 05.00

    (5) Transformer 01 Rs. 40.00

    (6) LED 05 Rs. 10.00

    (7) IC 05 Rs. 150.00

    (8) Relay 01 Rs. 40.00

    (9) P.C.B 01 Rs. 80.00

    (10) LDR 01 Rs. 15.00

    (11) Display 01 Rs. 15.00

    (12) Switch 02 Rs. 20.00

  • 8/13/2019 58726827 Put Coin and Draw Power

    65/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    65

    UNIT = 1

    SUMMARY

  • 8/13/2019 58726827 Put Coin and Draw Power

    66/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    66

    After completion of this project we can say that by using PUT COINAND DRAW POWER we can save electricity.This system has wide range of use atindustrial level.

  • 8/13/2019 58726827 Put Coin and Draw Power

    67/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    Page

    67

    UNIT = 11BIBILOGRAPHY

  • 8/13/2019 58726827 Put Coin and Draw Power

    68/68

    MICROCONTROLLER BASED PUT COIN AND DRAW POWER

    BASIC ELECTRONICS

    - B.L. THERAJA

    THE 8051 MICROCONTROLLER- KENNETH J. AYALA

    A MONOGRAPH ON ELECTRONICS DESIGN

    PRINCIPLES

    - N.C. GOYAL