97
MICROCONTROLLER BASED PUT COIN AND DRAW POWER Page 1

Put Coin and Draw Power

Embed Size (px)

Citation preview

Page 1: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 1

Page 2: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 1

INTRODUCTION

The Microcontroller based put coin and draw power islatest technology for distibution of electric power for paying guest house, lodges and trains. It can be effectively used to operate to the equipments. Built on the lines of payphones, 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 may not be easily available. Moreover, for simply functions.

The system makes use of a sensor for detecting the coin and a microcontroller 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 the coin count on display starts decrementing. When the count decrements to zero, the relay de-energise to disconnect the load.

Page 2

Page 3: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 3

Page 4: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 2

COMPONENT LIST

RESISTORS: LED:

R1 = 220 Ω LED1-LED5 = 5 mm (red)R2= 33 KΩR3 = 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 ON C2,C3 = 0.01µF ceramic disk S2=ON/OFFC4=100 µF, 16 V electrolyticC5,C6=33pF ceramic diskC8=1000 µF,35V electrolyticC9,C10=0.1 µF ceramic disk

Page 4

Page 5: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

DIODE: TRANSISTOR:D1-D5=1N4007rectifierdiode T1,T2=npn transister

IC: DISPLAY: IC1 = NE556dual timer DIS1=LTS543

IC2=AT89C2051microcontroller common-cathode, 7-segmentdisplay IC3=CD5411 7-segment decoder/driverIC4= 7805 5V regulatorIC5= 7806 6V regulator

TRANSFORMER: RELAY:

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

Page 5

Page 6: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 6

Page 7: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 3

CIRCUIT DIAGRAM

Page 7

Page 8: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 8

Page 9: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 4

PCB LAYOUT

Page 9

Page 10: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 5

Page 10

Page 11: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 and 7806 (IC4 and IC5), and few discrete components.

LED1 is used as the light source for light-dependent resistor LDR1, which is made of cadmium sulphide and acts as the coin detector. Resistors R1 limits the current through 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 of producing accurate time delays. It is basically a dual NE555. In the time delay mode of operation, the time is precisely controlled by an external resistor and capacitor. The two timers operate independently of each other, sharing only Vcc and ground. The circuits may be triggered and reset on falling waveforms. One timer of NE556 is used for coin detection.

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 of IC1 goes high to make output pin 5 low. This high-to-low pulse is used by the microcontroller 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, 15 input/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

Page 11

Page 12: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

oscillator and clock circuitry. A 12MHz crystal is used for providing the basic clock frequency. All I/O pins are reset to ‘1’ as soon as RST goes high. Holding RST pin high for two machine cycles, while the oscillator is running, resets the device. Power on reset is derived from resistor R6 and capacitor C7. Switch S1 is used for manual reset. Coin-detection output pin5 of NE556 is interfaced with port pin P3.0 of the microcontroller [IC2]. The microcontroller program counts the number of coins inserted and the count is shown on a 7-segment display. The ‘A’ through ‘D’ inputs of 7 -segment decoder IC3 are interfaced with port pins P1.4 through P1.7 of IC2. IC3 accepts the BCD input and decodes it to show on the 7-segment display. Coin-detection is also indicated by LED2, which is connected 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 and LED3 glows to indicate that the load is now switched on. D1 acts as a free-wheeling diode. 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 the second timer of NE556. When trigger pin 8 of NE556 goes low, its out put pin 9 goes high for a time period decided by present VR1 and capacitor C4. The high output of the timer is inverted by transistor T1 and fed to port pin P3.2 of the microcontroller [pin6 of IC2]. The count display decrements by ‘1’ after port pin P3.2 of the microcontroller receives five pulses [indicated by glowing of LED4]. Fig.2 shows the power supply circuit. The 230V AC mains is stepped down by transformer X1 to deliver the secondary output of 9V, 500mA. The transformer output is rectified by a full-wave bridge rectifier comprising diodes D2 through D5,filtered by capacitor C8 and then regulated by ICs 7805 [IC4] and 7806 [IC5]. Capacitor C9 and C10 bypass the ripples present in the regulated 5V&6V power supplies.LED5 acts as the power-‘ON’ indicator and resistor R25 limits the current through LED5.

Page 12

Page 13: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

SOFTWARE

The source program is written in Assembly language and assembled using Metalink’s ASM51 assembler , which is freely available on the Internet for download. The source program has been well commented for easy understanding. It works as per the flow-chart shown in Fig. First , the program initializes the microcontroller’s registers, then it checks 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 by five 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 then display count number decrements by one.

Page 13

Page 14: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

$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 LED indicator; 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 MIN approx);(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 000h sjmp start org 040hstart: ; -INITIALISATION START- mov r3,#000h ;count is 0 mov r4 , #000h;flag reset movr5 ,#000h;mono on flag reset mov r2,#000h;coin count 0 mov r6,#oo5h;counter set to 5 mov r7,#oooh; setb p3.0; no coin detected setbp3.2; mono output detected set high clr p3.7; coin detected LED off clr p1.1 ;relay de-energised Setb p1.0

Page 14

Page 15: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

;monostable not triggered clr p1.4 clr p1.5; 7 seg display 0 clr p1.6 clr p1.7;- INITIALISATION OVER- acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay tst count:mov a,r3 cjne a,#oooh, tstpwrsw clrp1.1 ;if r3=0de-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 detected rl a rl a rl a ;no of coins count in MS of r2 rl a mov b,a ;copy in b

Page 15

Page 16: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

mov a,p1 an1 a,#oofh ;extract LS portin keep intact orl a,b ;count ored in a Movp1, a ;-PUTTING COUNT ON 7 SEG OVER- sjmp tst countupdt r3: mova,r3 add a,#005h clr c mov r3,a ;added in r3 mov a,r2; count no of coins in r2 inc a clr c cjne a,#10,max mov a, #9 max:mov r2,a acall coin ;EVERY TIME COIN SENSED sjmp tstcount tstpwrsw: jnb p3.1 ,swpwron clr p1.1 sjmp coindet swpw ron : setb p1.1 ; relay on jnb p3.2,coindet ; is delay running ? if yes go and sense coin dec r3 dec r6 ;reduce count from 5 set in r6 mov a,r6 cjne a,#000h, bypss r2

dec r2 ;1 subtracted from r2 for every 5 in r3

Page 16

Page 17: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

mov a,r2 jz min rl a rl a rl a rl a clr c mov b,a mov a,b1 an1 a,#00fh orl a,b

mov p1,a mov r6 , #005h; initial count of 5 in r6bypssr2: acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay trigr: clrp1.0 acall delay ; mono triggered setbp1.0 ajmp tstcount min: mov p1,#01h ajmp tstcount ;-ROUTINES- delay: mov r0,#0c8h loop2:mov r1,#ofah loop1:nop

Page 17

Page 18: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

nop nop djnz r1,loop1 ;loop1 approx 5 X 200=1msec djnz r0,loop2 ;loop2 250 X1msec=250msec ret coin : setb p3.7 acall delay acall delay acall delay acall delay clr p3.7 acall delay acall delay acall delay acall delay ret end

START

Page 18

Page 19: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

INITIALISE REGISTERS

IS COINCOUNT=0?

DE-ENERGISE RELAY

INCREMENT r3 BY5 INDICATE COINSENSED ON LED

COIN SENSED?

IS POWER ON?

TIME ON?

ENERGISE RELAY

DECREMENT r3 BY 1

WAIT FOR 2 SECOND [DELAY]

START TIMER MONOSTABLE

Page 19

Page 20: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 6

Page 20

Page 21: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

HARDWARE DETAILS

RESISTORS

CAPACITORS

DIODE

INTEGRATED CIRCUIT(IC)

LIGHT EMITTING DIODE

TRANSISTOR

TRANSFORMER

RELAY

DISPLAY

SWITCH

LDR

RESISTORS:

Page 21

Page 22: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

SYMBOL OF RESISTOR:

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

The electrical resistance is equal to the voltage drop

across the resistor divided by the current through the resistor while the temperature remains the same. 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 scheme on all resistors. It consists of four colored bands that are painted around the body of the resistor. The scheme is simple: The first two numbers are the first two significant digits of the resistance value, the third is a multiplier, and the fourth is the tolerance of the value. Each color corresponds to a certain number, shown in the chart below. The tolerance for a 4-band resistor will be 1%, 5%, or 10%.

Color 1st 2nd 3rd band 4th band Temp.

Page 22

Page 23: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

band band (multiplier) (tolerance) CoefficientBlack 0 0 ×100

Brown 1 1 ×101 ±1% (F) 100 ppmRed 2 2 ×102 ±2% (G) 50 ppm

Orange 3 3 ×103 15 ppmYellow 4 4 ×104 25 ppmGreen 5 5 ×105 ±0.5% (D)Blue 6 6 ×106 ±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-2 ±10% (K)None ±20% (M)

Preferred values :

5-band axial resistors

Page 23

Page 24: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 represent the significant digits, the fourth is the multiplier, and the fifth is the tolerance. 5-band standard tolerance resistors are sometimes encountered, generally on older or specialized resistors. They can be identified by noting a standard tolerance color in the 4th band. The 5th band in this case is the temperature coefficientResistor standards

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, and other two are derived from that by Ohm's Law.

1.Fixed Resistor:

2.Variable Resistor:

APPLICATIONS:

To establish a proper value of voltage drops. To limit the current. To provide proper load.

Page 24

Page 25: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 for hundred 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 used and electrolyte as negative plate.

Page 25

Page 26: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 does not 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 of Ge and Si diodes. From figure-1 we can easily see that leakage current of Ge diode junction is much more than Si diode junction.

Page 26

Page 27: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

APPLICATION:

• High-speed switching

FEATURES:

• Glass sealed envelope. (GSD)• High speed.• High reliability.

TRANSFORMER:

Different voltages are used for the transmission and distribution of electrical power. For example, the electrical power is done at l l Kv or 440V. Sometimes low voltage is required for specification application say electric are welding requires 30 to 50 volts. Hence necessary to transform the power from on voltage 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 flow links with coil B. If the current through the coil changes, the flux changes, so emf is induced in coil B. This inducer emf.

Page 27

Page 28: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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.

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

III. For the same secondary voltage. The output d.c.voltage is twice than that inn 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. This becomes important when the output voltage is low.

Page 28

Page 29: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

RELAY

A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil 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 from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains 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 it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil. The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without 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 further information 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 pins providing you take care to avoid melting the plastic case of the relay.

Page 29

Page 30: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

The supplier's catalogue should show you the relay's connections. The coil will be obvious and 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. To prevent 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 can see a lever on the left being attracted by magnetism when the coil is switched on. This lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground and 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 the relay coil is on.Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.

Choosing a relayYou need to consider several features when choosing a relay:Physical size and pin arrangement If you are choosing a relay for an existing PCB you will need to ensure that its dimensions and pin arrangement are suitable. You should find this information in the supplier's catalogue.Coil voltage The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value.

Page 30

Page 31: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Coil resistance The 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 voltagecoil 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 for most 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 will need to check the voltage and current ratings. Note that the voltage rating is usually higher 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 page on switches.

Reed relaysReed relays consist of a coil surrounding a reed switch. Reed switches are normally operated with a magnet, but in a reed relay current flows through the coil to create a magnetic field and close the reed switch.Reed relays generally have higher coil resistances than standard relays (1000 for example) and a wide range of supply voltages (9-20V for example). They are capable of switching much more rapidly than standard relays, up to several hundred times per second; but they can only switch low currents (500mA maximum for example).The reed relay shown in the photograph will plug into a standard 14-pin DIL socket ('IC holder').

Page 31

Reed RelayPhotograph © Rapid Electronics

Page 32: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

For further information about reed switches please see the page on switches.

IC [INTERGRATED CIRCUIT]:

Features• Compatible with MCS-51™ Products• 2K Bytes of Reprogrammable Flash Memory– Endurance: 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 and Power-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 Atmel’s 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.

Page 32

Page 33: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 oscillatorand 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

Page 33

Page 34: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Block Diagram

Page 34

Page 35: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Pin DescriptionVCCSupply voltage

GNDGround.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 theon-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/Opins 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 featuresof the AT89C2051 as listed below:

Page 35

Page 36: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Port 3 also receives some control signals for Flash programmingand verification.RSTReset input. All I/O pins are reset to 1s as soon as RSTgoes 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/DRIVER

Page 36

Page 37: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Figure 1 shows a simplified block of the 74LS48 BCD to 7-Segment Decoder. The 74LS48 contains three main block circuits, a 7-segment decoder, a driver and a system of basic memory units. The basic memory unit is often called a latch or a flip-flop. The decoder outputs drive an encoder circuit made up of OR gates that generate the 7-segment code necessary to display the digits 0 through 9 and the letters a through f. The output devices are current driver transistors that supply the proper current to th e segments in the 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 C outputs.Wire the latch circuit shown in figure 3. Repeat steps 1. and 2. for circuit 3. These new outputs are labeled D and D.Why do we call this circuit a basic memory unit? What happens to the outputs when S and R both 0? Refer to the textbook (Katz) for a discussion of flip-flops (chapter 6).Part 2. -- (7-Segment Decoder-Driver and Display)

Page 37

Page 38: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Construct the circuit shown in figure 4. Use the TTL handbook to verify the correct conections. The pin connections for the 74LS48 and the 7-Segment Display are shown in fiqure 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 which output 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/ RBO pins do?

Figure 3

Page 38

Page 39: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Figure 4

Page 39

Page 40: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 voltageregulators, these devices can be used with externalcomponents to obtain adjustable voltages and currents.

Page 40

Page 41: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

TO-220 D-PAK

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 andground. 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

Page 41

Page 42: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

APPLICATIONS• Precision timing• Sequential timing• Pulse shaping• Pulse generator• Missing pulse detector• 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 semi conducting material used, and can be near-ultraviolet, invisible or infrared. Nick Holon yak Jr. (1928) of the University of Illinois at Urbana-Champaign developed the first practical visible-spectrum LED in 1962.

PHYSICAL FUNCTION:

Page 42

Page 43: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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, with impurities to create a structure called a pn junction. Charge-carriers (electrons and holes) are created by an electric current passing through the junction. When an electron meets a hole, it falls into a lower energy level, and releases energy in the 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 of devices with ever shorter wavelengths, producing light in a variety of colors.

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:

Page 43

Page 44: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

• 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 providing lighting which does not lead to unwanted exposure of the film

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

Page 44

Page 45: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

LDR

Everything has an electrical resistance, some more than others. An LDR will have a resistance that varies according to the amount of visible light that falls on it. A close up of an LDR is shown below:

The light falling on the brown zigzag lines on the sensor, causes the resistance of the device to fall. This is known as a negative co-efficient. There are some LDRs that work in the opposite way i.e. their resistance increases with light (called positive co-efficient). I won't go into the physics of how the device changes its resistance, so just take it as read.

Now, in order to use this device in a simple circuit, all we need to do is put a voltage across it and measure the current flowing through it. However, measuring current can be 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

Page 45

Page 46: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

across the LDR is proportional 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. The ratio of these two currents (Ic/Ib) is

Page 46

Page 47: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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.

Page 47

Page 48: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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

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 Bipolar

Junction Transistor is that a small base current can control a

much larger collector current. 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 be greater 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

Page 48

Page 49: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 Transistors can also be used to produce a circuit

which will also amplify any 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 within

its linear active region, an inverting amplifier circuit called a

Common Emitter Amplifier is produced.

One such Common Emitter Amplifier configuration is called a

Class A Amplifier. A Class A Amplifier operation is one where the

transistors Base terminal is biased in such a way 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 be amplified. 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 β

Page 49

Page 50: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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

Page 50

Page 51: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 Ohm´s Law, the current flowing through the load

Page 51

Page 52: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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:

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.

Page 52

Page 53: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

The PNP Transistor

The PNP Transistor is the exact opposite to the NPN

Transistor device we looked at in the 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 are reversed 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. 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 Transistor has very similar characteristics to their NPN

bipolar cousins, except that the polarities (or biasing) of the

Page 53

Page 54: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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 negative than 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.

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

Page 54

Page 55: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

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).

Page 55

Page 56: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

7-SEGMENT DISPLAY

The illustration to the right shows the basic layout of the segments in a seven-segment display. The segments themselves are identified with lower-case letters "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 improves readability of large numbers on a calculator, for example. The decimal point is shown here on the right, but some display units put it on the left, or have a decimal point on each side.

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

Page 56

Page 57: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Seven-segment displays can be packaged in a number of ways. Three typical packages 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 is molded over each digit to act as a magnifying lens. The sides of the end bubbles are 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 installed vertically. 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. To get larger displays for easy reading at a distance, it is necessary to change the package size and shape. The package on the right above is larger than the other two, 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 digital clocks sport digits that are two to five inches tall.

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

Page 57

Page 58: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Schematic Diagram

As shown in the two schematic diagrams above, the LEDs in a seven-segment display are not isolated from each other. Rather, either all of the cathodes, or all of the anodes, are connected together into a common lead, while the other end of 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 by controlling the common lead. (In some cases, the common connections are made to groups of LEDs, and the external wiring must make the final connections between them. In other cases, the common connection is made available at more than one location for convenience in laying out printed circuit boards. When laying out circuits using such devices, you simply need to take the specific connection details into account.)

Page 58

Page 59: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

There is no automatic advantage of the common-cathode seven-segment unit over the common-anode version, or vice-versa. Each type lends itself to certain applications, configurations, and logic families. We'll learn more about this in later experiments. For the present, we will use a common-cathode display as our experimental example.

SWITCH

Type of Switch Circuit Symbol Example

ON-OFFSingle Pole, Single Throw = SPST

A simple on-off switch. This type can be used to switch the power supply to a circuit.

When used with mains electricity this type of switch must be in the live wire, but it is better to use a DPST switch to

SPST toggle switch

Page 59

Page 60: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

isolate both live and neutral.

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

A push-to-make switch returns to its normally open (off) position when you release the button, this is shown by the brackets around ON. This is the standard doorbell switch.

Push-to-make switch

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

A push-to-break switch returns to its normally 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 each case. It is often called a changeover switch. For example, a SPDT switch can be used to switch on a red lamp in one position and a green lamp in the other position.

A SPDT toggle switch may be used as a simple on-off switch by connecting to COM and one of the A or B terminals shown in the diagram. A and B are interchangeable so switches are usually not labelled.

ON-OFF-ONSPDT Centre OffA special version of the standard SPDT switch. It has a third switching position in the centre which is off. Momentary (ON)-OFF-(ON) versions are also available

SPDT toggle switch

SPDT slide switch(PCB mounting)

Page 60

Page 61: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

where the switch returns to the central off position when released.

SPDT rocker switch

Dual ON-OFFDouble Pole, Single Throw = DPST

A pair of on-off switches which operate together (shown by the dotted line in the circuit symbol).

A DPST switch is often used to switch mains electricity because it can isolate both the live and neutral connections. DPST rocker switch

Page 61

Page 62: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Dual ON-ONDouble Pole, Double Throw = DPDT

A pair of on-on switches which operate together (shown by the dotted line in the circuit symbol).

A DPDT switch can be wired up as a reversing switch for a motor as shown in the diagram.

ON-OFF-ONDPDT Centre OffA special version of the standard SPDT switch. It has a third switching position in the centre which is off. This can be very useful for motor control because you have forward, off and reverse positions. Momentary (ON)-OFF-(ON) versions are also available where the switch returns to the central off position when released.

DPDT slide switch

Wiring for Reversing Switch

Page 62

Page 63: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Type of Switch Example

Push-Push Switch (e.g. SPST = ON-OFF)

This looks like a momentary action push switch but it is a standard on-off switch: push once to switch on, push again to switch off. This is called a latching action.

Microswitch (usually SPDT = ON-ON)

Microswitches are designed to switch fully open or closed in response to small movements. They are available with levers and rollers attached.

Keyswitch

A key operated switch. The example shown is SPST.

Tilt Switch (SPST)

Tilt switches contain a conductive liquid and when tilted this bridges the contacts inside, closing the switch. They can be used as a sensor to detect the position of an object. Some tilt switches contain mercury which is poisonous.

Page 63

Page 64: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Reed Switch (usually SPST)

The contacts of a reed switch are closed by bringing a small magnet near the switch. They are used in security circuits, for example to check that doors are closed. Standard reed switches are SPST (simple on-off) but SPDT (changeover) versions are also available.

DIP Switch (DIP = Dual In-line Parallel)

This is a set of miniature SPST on-off switches, the example shown has 8 switches. The package is the same size as a standard DIL (Dual In-Line) integrated circuit.

This type of switch is used to set up circuits, e.g. setting the code of a remote control.

Multi-pole Switch

The picture shows a 6-pole double throw switch, also known as a 6-pole changeover switch. It can be set to have momentary or latching action. Latching action means it behaves as a push-push switch, push once for the first position, push again for the second position etc.

Multi-way Switch

Multi-way switches have 3 or more conducting positions. They may have several poles (contact sets). A popular type has a rotary action and it is available with a range of contact arrangements from 1-pole 12-way to 4-pole 3 way.

The number of ways (switch positions) may be reduced by adjusting a stop under the fixing nut. For example if you need a 2-pole 5-way switch you can buy the 2-pole 6-way version and adjust the stop.

Contrast this multi-way switch (many switch positions) with the multi-pole switch (many contact sets) described above.

Multi-way rotary switch

1-pole 4-way switch symbol

Page 64

Page 65: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 65

Page 66: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 7

POWER SUPPLY

INTRODUCTION :

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

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

A single power can provide as many voltages as are needed; using a voltage divider. 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 the power supply in fact, bleeder resister may also be use as voltage divider. Now we are discuss about the three stages of D.C. power supply.

RECTIFICATION:

Rectification is process in which simple harmonic A.C. voltage is converted into a unidirectional voltage (D.C. voltage). It

Page 66

Page 67: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

is a circuit, which employs one or more diode to convert A.C. voltage into pulsating D.C. voltage. There are mainly three different types of rectifier circuits. They are,

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

FULL WAVE RECTIFIER The 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.

fig The 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. The effect 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 voltage supplied by the rectifier and provide a regulated and constant voltage. No filters, in practice give any output voltage as

Page 67

Page 68: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

ripple free as that of D.C. battery but it approaches it so 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. In fact, these circuit required a very steady D.C. output that approached the smoothness out the 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:

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 remains constant 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 by filtering. 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 this filter circuit is that they can not filter out variation from the D.C. output voltage caused by fluctuations in the A.C. supply.

We also know that in almost all circuit applications, it is important to have a constant 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 to this reason voltage regulation is required.

“Voltage regulation is defined as the percentage change in the output voltage when the load is removed.” The good regulation means that the output voltage remains constant.

Page 68

Page 69: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 69

Page 70: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 8

APPLICATIONS

This equipment can be used for.

1. Paying guest house.2. Lodges.3. Trains. 4. Fairs.5. Hotels.

Page 70

Page 71: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 71

Page 72: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 9

COMPONENT PRICE LIST TOTAL PRIZE Rs.

415.00

Page 72

NAME QUANTITY PRIZE

(1) Resistor 24 Rs. 12.00

(2) Capacitor 10 Rs. 16.00

(3) Transistor 02 Rs. 12.00

(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

Page 73: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 73

Page 74: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 10

SUMMARY

After completion of this project we can say that by using “ PUT COIN AND DRAW POWER” we can save electricity.This system has wide range of use at industrial level.

Page 74

Page 75: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

Page 75

Page 76: Put Coin and Draw Power

MICROCONTROLLER BASED PUT COIN AND DRAW POWER

UNIT = 11BIBILOGRAPHY

BASIC ELECTRONICS- B.L. THERAJA

THE 8051 MICROCONTROLLER - KENNETH J. AYALA

A MONOGRAPH ON ELECTRONICS DESIGN PRINCIPLES- N.C. GOYAL

Page 76