electronics projects 20

200

Click here to load reader

Upload: lawrence96

Post on 19-Jan-2016

1.467 views

Category:

Documents


429 download

DESCRIPTION

magazine

TRANSCRIPT

Page 1: Electronics Projects 20
Page 2: Electronics Projects 20
Page 3: Electronics Projects 20

Electronics ProjectsVol. 20

Page 4: Electronics Projects 20

EFY Books & PublicationsFOR YOU

EFY is a reputed information house, specialising in electronics and information technology magazines. It also publishes directories and books on several topics. Its current publications are:

(A) CONSTRUCTION PROJECTS

1. Electronics Projects, Vol. 1: AcompilationofselectedconstructionprojectsandcircuitideaspublishedinElectronicsForYoumagazinesbetween1979and1980.

2. Electronics Projects, Vol. 2 to 19:Yearlycompilations(1981to1998)ofinterestingandusefulconstructionprojectsandcircuitideaspublishedinElectronicsForYou.

3. Electronics Projects, Vol. 20 to 24 (with CD):Yearlycompilations(1999to2003).

(B) OTHER BOOKS

1. Learn to Use Microprocessors (with floppy/CD): ByK.PadmanabhanandS.Ananthi(fourthenlargededition).AnEFYpublication with floppy disk. Extremely useful for the study of 8-bit processors at minimum expense.

2. ABC of Amateur Radio and Citizen Band: Authored by Rajesh Verma, VU2RVM, it deals exhaustively with the subject—giv-ingalotofpracticalinformation,besidestheory.

3. Batteries: By D.Venkatasubbiah. This publication describes the ins and outs of almost all types of batteries used in electronic appliances.

4. Chip Talk: ByGpCapt(Retd)K.C.Bhasin.Thebookexplainsfundamentalsofelectronicsandmorethan40fullytestedelec-tronicprojects.

5. Modern Audio-Visual Systems Including MP4, HD-DVD and Blu-ray: Explainsdiskworkingprinciples,troubleshootingandservicingbyGpCapt(Retd)K.C.Bhasin.

(C) DIRECTORIES

EFY Annual Guide (with CD): Includes Directory of Indian manufacturing and distributing units, Buyers’ Guide and Index of BrandNames,pluslotsofotherusefulinformation.

(D) MAGAZINES

1. Electronics For You (with CD): Inregularpublicationsince1969,EFYisthenaturalchoicefortheentire electronicsfraternity,beitthebusinessmen,industryprofessionalsorhobbyists.FrommicrocontrollerstoDVDplayers,fromPCBdesigningsoftwareto UPS systems, all are covered every month in EFY.

2. Linux For You (with CD and DVD): Asia’s first magazine on Linux. Completely dedicated to the Open Source community. Regular columns by Open Source evangelists. With columns focused for newbies, power users and developers, LFY is religeously read by IT implementers and CXOs every month.

3. Facts For You: A monthly magazine on business and economic affairs. It aims to update the top decision makers on key industry trends through its regular assortment of Market Surveys and other important information.

4. BenefIT: A technology magazine for businessmen explaining how they can benefit from IT.

5. Electronics Bazaar: AmonthlyB2Bmagazineforsourcingelectronicscomponents,productsandmachineries.Idealforbuyingdecision makers and influencers from electronics and non-electronics industry.

EFY Enterprises Pvt LtdD-87/1 Okhla Industrial Area, Phase-1

New Delhi 110020Phone: 26810601-03Fax: (011) 26817563

E-mail: [email protected]

Kits‘n’SparesD-88/5, Okhla Industrial Area,Phase-1, New Delhi 110020 Phone: 26371661, 26371662

E-mail: [email protected]: www.kitsnspares.com

Paramount Book AgencyArch No. 30 (West Approach) belowMahalaxmi Bridge, Mumbai 400034Phone: (022) 40497401, 40497402,

40497474 Fax: 40497434E-mail: [email protected]

For retail orders: For magazine subscriptions: For bulk orders:

Page 5: Electronics Projects 20

ELECTRONICSPROJECTS

VOL. 20

D-87/1 Okhla Industrial Area, Phase I,New Delhi 110020

Page 6: Electronics Projects 20

© EFY Enterprises Pvt Ltd.First Published in this Edition, November 2004

Published by Ramesh Chopra for EFY Enterprises Pvt Ltd,D-87/1, Okhla Industrial Area, Phase I, New Delhi 110020.

Typeset at EFY Enterprises Pvt Ltd andPrinted at Premier Printers, A-244, Okhla Industrial Area,

Phase I, New Delhi 110020

All rights reserved. No part of this book may be reproduced in anyform without the written permission of the publishers.

ISBN 81-88152-15-3

Page 7: Electronics Projects 20

FOREWARD

This volume of Electronics Projects is the eighteenth in the seriespublished by EFY Enterprises Pvt Ltd. It is a compilation of 22construction projects and 68 circuit ideas published in ElectronicsFor You magazine during 1999.

For the first time we are including a CD which contains datasheet ofmajor components used in construction projects as also many otherbooks, tutorials and goodies (specially for the Motorola MCU basedprojects included in this volume). Hopefully the readers will benefitfrom this add-on material. (Refer CD Contents Page)

In keeping with the past trend, all modifications, corrections andadditions, sent by the readers, have been included with each project,along with the replies and amendments, if any, proposed/suggestedby the authors themselves. It is a sincere endeavour on our part tomake each project as error-free and comprehensive as possible. However,responsibility cannot be taken if readers are unable to make acircuit successfully, for whatever reason.

This collection of a large number of tested circuit ideas andconstruction projects in a handy volume would provide all classes ofelectronics enthusiasts—be they students, teachers, hobbyists orprofessionals—with a valuable source of electronic circuits, whichcan be fabricated using readily-available and reasonably-pricedcomponents. These circuits could either be used independently or incombination with other circuits, described in this and other volumes.We are sure that this volume, like its predecessors, will generatetremendous interest among its readers.

Page 8: Electronics Projects 20

Section A: Construction Projects

1. Digital I/O Add-On Card for PC XT/AT ................................................................... 3

2. Versatile FM Stereo Receiver .................................................................................... 7

3. Switchless Musical Calling Bell with Counter ......................................................... 13

4. CompuMultiMeter—A Computer Interfaced Multimeter ........................................ 16

5. Calling Number Identification System Using Calculator ......................................... 20

6. Transformer Polarity Tester ....................................................................................... 23

7. Programmable Versatile Timer .................................................................................. 25

8. Caller-ID Unit Using Micro-controller ..................................................................... 28

9. Mains Frequency Monitor ......................................................................................... 36

10. Party Game How Old Are You? ................................................................................ 38

11. Chip-Card Reader–Programmer Using IBM PC ....................................................... 41

12. Morse Encoder ........................................................................................................... 46

13. Long-Range Remote Control ..................................................................................... 49

14. Fast Charger for Inverter Batteries ............................................................................ 52

15. Z-80 Based Dedicated Programmer Cum Emulator .................................................. 55

16. 8098 Development Board .......................................................................................... 69

17. Remote-Controlled Audio Processor Using Microcontroller ................................... 81

18. Soujunior—A Wireless Programmable Control Unit ............................................... 89

19. 50Hz Sinewave Inverter Using MOSFETs ................................................................ 94

20. An 8085 Microprocessor Kit for Instructors ............................................................. 97

21. Multichannel Code Lock System............................................................................... 105

22. Automatic Induction Motor Starter with Programmable Timer ............................... 108

Section B: Circuit Ideas

1. Telephone Line Vigilant ............................................................................................. 115

2. High and Low Voltage Cutout with Delay and Melody ............................................ 116

3. Running Message Display ......................................................................................... 117

4. Colour Sensor ............................................................................................................. 119

CONTENTS

Page 9: Electronics Projects 20

5. Low Current, High Voltage Power Supply ................................................................ 120

6. Audio-Visual Extra Ringer for Phone ....................................................................... 121

7. Handy Zener Diode Tester ......................................................................................... 121

8. Automatic Emergency Light ...................................................................................... 122

9. Automatic Room Power Control ............................................................................... 124

10. Telecom Headset ........................................................................................................ 125

11. Smart Phone Light ..................................................................................................... 126

12. Auto Reset Over/Under Voltage Cut-Out .................................................................. 127

13. Clap Remote ............................................................................................................... 128

14. Time Switch ............................................................................................................... 130

15. Water Level Indicator With Alarm ............................................................................ 132

16. IC Controlled Emergency Light with Charger .......................................................... 133

17. Wiper Speed Controller ............................................................................................. 134

18. CD-ROM Drive as Digital-Audio CD-Player ........................................................... 135

19. Automatic Dual-Output Display ................................................................................ 135

20. Miniature Strobe Light ............................................................................................... 136

21. Electronic Card-Lock System .................................................................................... 137

22. PC-Based 7-Segment Rolling Display ...................................................................... 139

23. Contactless AC Mains Voltage Detector ................................................................... 140

24. Frequency Measurements Using PC .......................................................................... 141

25. Telephone Number Display ....................................................................................... 142

26. Digital Switching System .......................................................................................... 144

27. 40-Metre Direct Conversion Receiver ....................................................................... 145

28. Precision 1Hz Clock Generator using Chip-on-Board .............................................. 146

29. Electronic Jam ............................................................................................................ 147

30. Tiny Dew Sensor ........................................................................................................ 148

31. Electronic Scoring Game ........................................................................................... 148

32. Simple Sensitive Remote Control Tester ................................................................... 149

33. Ultra Low Drop Linear Regulator ............................................................................. 150

34. Magnetic Proximity Switch ....................................................................................... 151

35. Simple Low-Cost Digital Code Lock ........................................................................ 151

36. Hand Proximity Musical Tone Generator .................................................................. 152

37. Wireless Musical Calling Bell ................................................................................... 153

38. Simple Telephone Privacy Circuit ............................................................................. 154

39. Bidirectional Code Converter .................................................................................... 154

Page 10: Electronics Projects 20

40. Priority Indicator For Quiz Contests ......................................................................... 156

41. Dual-Channel Digital Volume Control ...................................................................... 157

42. Water Level Controller Cum Motor Protector ........................................................... 158

43. Under Voltage Cut-out and Delay for Refrigerators ................................................. 159

44. Infrared Cordless Headphone .................................................................................... 160

45. Stabiliser with Auto Cut-off Arrangement ................................................................ 161

46. Simple Analogue-to-digital Converter ...................................................................... 162

47. Sleep-switch cum Wake-up Timer ............................................................................. 163

48. Charge Monitor for 12V Rechargeable Lead-acid Battery ....................................... 164

49. Window/Fence Charger ............................................................................................. 165

50. Cordless Phone Backup ............................................................................................. 166

51. PC-based Dice Game ................................................................................................. 167

52. Teleremote Control .................................................................................................... 168

53. Display Dialed Telephone Number Using Calculator ............................................... 169

54. 8253 Programmable Interval Timer ........................................................................... 170

55. Low-cost Transistorised Intercom ............................................................................. 171

56. Automatically Controlled Street Lights ..................................................................... 172

57. Timer for Students ..................................................................................................... 173

58. Protecting Three-phase Induction Motors ................................................................. 174

59. Radio Remote Control ............................................................................................... 174

60. Sequential Card Scanner ............................................................................................ 175

61. Divide-by-n Counter Using IC 7442 ......................................................................... 177

62. DTMF Remote Switching Board ............................................................................... 178

63. Electrical Equipment Control Using PC.................................................................... 179

64. Long-range FM Transmitter ...................................................................................... 181

65. Piezo Buzzer Finds Many Applications .................................................................... 182

66. Power Supply Circuits for Hams ............................................................................... 185

67. Cyclic On and Off Timer for Cooler Pump ............................................................... 186

68. Self-switching Power Supply .................................................................................... 187

Page 11: Electronics Projects 20

SECTION A:CONSTRUCTION PROJECTS

Page 12: Electronics Projects 20
Page 13: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 3

DIGITAL I/O ADD-ON CARDFOR PC XT/AT

As you are aware, the PC has amotherboard on which the mainCPU and the RAM/ROM memory

chips are located. All other functionalitieslike disk controllers, parallel and serialports and the display adapter are locatedon the add-on cards which plug into theexpansion slots on themotherboard. It is veryeasy for anyone to as-semble such a card. De-sign of a general-purposeadd-on card for the PC,which will be useful in anumber of applicationslike EPROM program-mer and copier, processcontroller, logic monitoretc, is presented here.The good news is that ittakes only four ICs to ac-complish this!

We will be designingthe card for the 8-bit PC(PC-XT) bus, which isthe lowest common de-nominator available. Forthis you will need a PCBedge connector with 62pins which are arrangedas two rows of 31 pinson each side of the ex-pansion slot, named sideA and side B. Fig. 2shows the signals avail-able on its various pins.

The circuit is basedon IC 8255A, which is aprogrammable digital I/O (input/output) devicewith three external 8-bitports. That means, youget 24 general-purposeinput and/or output pins.The circuit diagram of

the add-on card is given in Fig. 1.

DescriptionIC2 (74HCT688) is an 8-bit magnitudecomparator. The address bus lines A2through A9 are continuously monitored

V. RAJARAMAN AND MOHAN INGLE

by it, and compared with the address setby the resistors and the DIP switches onthe right side (in Fig. 1) of IC2.

Here, we have specified an address of300 hex, which is a vacant I/O address onthe IBM PC. This address has been re-served by IBM for experimental work. If

Fig. 1: Circuit diagram of digital input-output add-on card for PC

Page 14: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 204

you want to change this address, be surethat no other device with the intended I/Oaddress exists on the PC, to avoid a clash.

The AEN signal is also involved inthe addressselection,as can beseen fromthe connec-tion to pinNo. 12 ofIC2. This isdone in or-der to dis-able ourcircuit dur-

ing DMA operations. When the two ad-dresses (the one on the address bus ofIBM PC as extended to left side of IC2and the other set with the help of DIPswitches on the right-hand side of IC2)match, IC2 issues an active-low chip se-

lect signal to IC3 and IC4.The bi-directional bus transceiver IC3

(74HCT245) connects the data bus of thePC to the data lines of IC4 (8255A). Thedirection in which data is transmitted isdetermined by the DIR pin No. 1 of the

Fig. 2: Signals present on 62-pin expansion slotof an IBM PC XT/AT

Fig. 3: Connection diagram fortesting of add-on card

Fig. 4: Actual-size solder-side track layout for the add-on card

Fig. 5: Actual-size component-side track layout for the add-on card

Page 15: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 5

transceiver IC3. Note that this pin is con-trolled by the active low READ signal.This ensures proper direction of data flow.

IC 8255A is a versatile chip whichcan be programmed in three modes. Mode0 is a basic input-output mode. Modes 1and 2 involve advanced I/O operationswith handshaking. The chip has three 8-bit ports named A, B and C and a controlport (internal) which determines how thechip is programmed.

The two pins marked A0 and A1 (pins9 and 8 respectively) determine which ofthese four ports are accessed. This iswhy the two least significant address bitsof the PC bus are directly connected tothese pins. With our address assignmentof 300 (hex) as base address, the I/O ad-dresses of these 4 ports will be as givenbelow:

The three 8-bit ports A, B and C toge-ther with +5V and ground connection arebrought out on a 26-pin FRC type maleconnector for external use.

Incidentally, this circuit does not needan external power supply. Positive 5-voltsupply is readily available on pins B3 andB29 of the 62-pin PC edge connectors it-self. This is to be connected to the Vcc pinsof all the four ICs. Similarly, the groundpins of the four ICs are tied to the commonground point of the PC edge connector(pins B1, B10 and B31).

A proper actual-size double-sided PCBlayout for the circuit of Fig. 2 is given inFigs. 4 (solder-side) and 5 (component-side). The component layout for the PCBis given in Fig 6. Ensure that there is noshorting between the power supply andground pins, and insert the card into avacant expansion slot of the PC after as-sembly.

Test ProcedureThe easiest way to test the circuit is toconnect 24 LEDs to the connector pins 1through 24 using 26-pin FRC female con-nector with ribbon cable and switch themon/off to check the proper working of theindividual bits. Connect the LEDs throughbuffers (7406) as shown in Fig. 3. 5-voltsupply and ground connection for the buff-ers may be taken from pins 25 and 26respectively of the 26-pin FRC connectoritself. The program TEST.C produces a

running light effect on the LEDs.

An ApplicationWe will use the card as a logic monitor. Inlarge digital circuits, there would be anumber of points whose logic levels haveto be constantly monitored. This can bedone with the help of a logic probe, butthe probe has to be moved from point topoint on the circuit, and only one pointcan be observed at a time. Our add-oncard can be used to monitor up to 24 points

simultaneously and display them graphi-cally on the PC screen.

The program LOGICMON.C writtenin Turbo C can be used for this purpose.It draws 24 small boxes on the screen.The inside of the box will be dark if thecorresponding port pin is logic 0, and itwill be bright to indicate logic 1 state atthe pin.

Connect the 24 pins (1 through 24) ofthe FRC connector to 24 points of the cir-cuit to be monitored. Please note that TTLlogic levels are expected at the points tobe monitored. For CMOS circuits, you mayrequire suitable buffers.

Connect pin 26 to the digital groundof the circuit under observation. Run theprogram. Now whenever there is a changein the logic level at any of the 24 points,it will be immediately reflected in corre-sponding box on the screen. Thus you havea 24-channel logic monitor.

ProgramThe program first initialises the 8255 chipby sending the code 9B (hex) to the con-trol port. This sets up the chip to oper-ate in mode 0, with all the three 8-bitports acting as input ports. Of course, thisis only one of the several possible waysin which this powerful chip can be used.Freely experiment with other modes to

Fig. 6: Component layout for add-on card PCB

Address (hex) Port accessed300 Port A301 Port B302 Port C303 Control Port

PARTS LISTSemiconductors:IC1 - 74HCT08 quad 2-input AND

gateIC2 - 74HCT688 8-bit magnitude

comparatorIC3 - 74HCT245 8-bit bidirectional

bus driverIC4 - 8255A programmable

peripheral interface

Resistors (all ¼ watt, ± 5% carbon, unlessstated otherwise):R1-R8 - 10-kilo-ohm SIP 9-pin resistor

network

Capacitors:C1-C4 - 0.1µF ceramic disc

Miscellaneous:S1 - Dip switch 8-sectionCON1 - 26-pin male FRC connector

Page 16: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 206

/* LOGICMON.C *//* 24 channel logic monitor program */#include <dos.h>#include <conio.h>#include <stdio.h>#define PORTA 0x300#define PORTB 0x301#define PORTC 0x302#define CONTROL 0x303

void hide_cursor();void show_cursor();void initialize();void draw_box(int row);void scan (int port, int row);int column [] = {18,23,28,33,40,45,50,55};char box [3] [4]={ {0xda,0xc4,0xbf,0}, {0xb3,0x20,0xb3,0}, {0xc0,0xc4,0xd9,0} };/*_________________________________*/void main(){hide_cursor();initialize();while (!kbhit()){scan (PORTA, 7);scan (PORTB, 13);scan (PORTC, 19);

}show_cursor ();}/*_________________________________*/

void initialize (){clrscr ();gotoxy (14,7); putch (‘A’);draw_box (6);gotoxy (14,13);putch (‘B’);draw_box(12);gotoxy (14,19); putch (‘C’);draw_box (18);outport (CONTROL,0x9b);}/*_________________________________*/void draw_box (int row){int i,j;for (i=0; i<3; i++, row++){gotoxy (17, row);for (j=0; j<8;j++){printf (“%s “,box [i]);if (j==3) printf (“ “); }}}

/*_________________________________*/void scan (int port, int row){int i;unsigned char mask =0x80;unsigned char byte;byte = inport (port);for (i=0; i<8; i++, mask>>=1){gotoxy (column [i], row);if (byte & mask)putch(219);elseputch (32);}}/*_________________________________*/void hide_cursor(){_AH = 1;_CH = 8;_CL =8;geninterrupt (0x10);}/*_________________________________*/void show_cursor(){_AH = 1;_CH = 6;_CL = 7;geninterrupt (0x10);}

PROGRAM LISTING OF LOGICMON.C

/* TEST.C *//* produces running lights effect on LEDs */#define PORTA 0x300#define PORTB 0x301#define PORTC 0x302#define CONTROL 0x303main ()

for (i=1;i<0*101;i*=2){outportb (port,i);delay (250);if(kbhit())exit (0);}}}

{int i, port;/*intialise */outportb (CONTROL,0x80);while (1){for (port=PORTA; port <= PORTC;port++)

PROGRAM LISTING OF TEST.C

realise its full potential.After initalisation, the program scans

the three ports repeatedly in a loop. Itseparates each bit, tests whether the bit

is at logic 0 or 1 state, and switches on oroff the corresponding indicator on thescreen.

As the cursor rapidly moves from one

position to the next across the screen, itcauses distraction. Hence the cursor isdisabled during the execution of theprogram. ❑

Page 17: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 7

VERSATILE FM STEREORECEIVER

FM broadcast in India has gainedmuch popularity and AIR (All In-dia Radio) is now using FM chan-

nels for Vividh Bharti programmes also.Although the quality of FM transmissionis quite good and stereophonic, severallisteners often complain that their receiv-ers, including imported ones, produce quitea bit of noise (hiss and shrill). Indian mar-ket is flooded with such FM receivers,which though labeled as stereos, are notreally so. Their output power is so lowthat the stereophonic effect cannot be pro-duced.

Presented here is a versatile FMstereo receiver circuit which overcomesthe above-mentioned drawbacks. Its sali-ent features are:

1. Stereo reception and its faithful re-production with reasonably high outputpower for obtaining proper stereophoniceffect.

2. Auto-noise-mute (including inter-station noise mute) and stop-station func-tions.

3. LED indicators are provided forindication of the following conditions:

(a) FM fine tunning(b) Stereo decoder and amplifier sec-

tion power-on(c) Stereo signal presence.Apart from its primary function as a

quality FM stereo receiver and amplifier,the circuit or its sections can also be usedfor the following applications:

1. Burglar alarm having a long opera-tional range

2. Cordless FM intercom3. Cordless call bell4. Remote switch.

DescriptionA functional block diagram of the stereo

VIDYUT SARKAR

Fig. 1: Functional block diagram of versatile FM stereo receiver

receiver comprising various sub-sectionsis shown in Fig. 1. Brief description ofthe circuits within each block are givenbelow with reference to the circuit dia-gram of the complete system shown inFig. 2.

FM receiver: This sub-circuit is basedon the popular Sony single-chip radio ICCXA1019S (30-pin DIL). The IC is de-signed for economy receivers for FM andAM radio as well as TV applications. Butin the present circuit this IC has beenwired for FM reception only.

This IC also includes a tuning meter/LED driver circuit for fine tuning indica-tion. This meter/LED driver output isavailable at pin 20. Here this output isalso coupled to the auto-power on/off sec-tion.

The audio output available at pin 24of this IC (marked as point A) is con-nected to the input of stereo decoder IC

(pin 2) for further processing.Auto power on/off: This

section comprises a pnp tran-sistor AC188 (T1) and threenpn transistors BD139 (T2, T3and T4). Each of the transis-tors T2, T3 and T4 is employedfor switching on power supply(by completion of ground returnpath) to: (a) relay driver andbuzzer section, (b) stereo de-coder, preamplifier and poweramplifier circuit built aroundIC6, and (c) power amplifiercircuit built around IC5, respec-tively. Transistor T1 controlsthe base drive to transistors T2,T3 and T4 while conduction oftransistor T1 itself is control-led by the output at pin 20 (me-ter/LED driver) of IC1.

Whenever the FM receiveris tuned to any FM transmitter

Page 18: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 208

within its range, LED1 starts glowing (i.e.pin 20 goes to ground level). This in turnswitches on transistor T1 (AC188), mak-ing LED2 to glow (after proper adjust-ment of preset VR1). Transistor T1 canfurther switch on the other three transis-tors T2, T3 and T4, depending on the po-sition of slide switches S1 through S4.

Since, except IC1 and IC2, all otherparts of the circuit are powered throughthese three transistors, these receivepower only when LED2 is glowing (i.e.FM transmitter is on). Thus, wheneverthe transmitter is on, the audio amplifieris switched on automatically and the sameis indicated by glowing of LEDs 1 and 2.

Stop-station and inter-stationnoise mute functions: When the FMtransmitter at the radio station is off (orthe FM mike is switched off, i.e. modula-tion of the carrier is absent), LED1 stopsglowing. Thus transistor T1 is cut off,which in turn cuts off transistors T2, T3and T4. As a result, in the absence offrequency modulated input signal, the re-ceiver mutes itself, reducing the supplycurrent to only a few milliamperes. Thesame happens when the receiver is tunedfrom one station to another (frequency).

Consequently, this receiver never pro-duces the characteristic shrill sound asproduced by other FM receivers. This fea-ture enhances the FM receiver’s compat-ibility for use as an intercom, long-rangeremote-switch, call bell and burglar alarmetc.

Stereo decoder: In ordinary FM ra-dio receivers, output from FM receiverIC is directly fed to audio amplifiers ofthe stereo. Thus real stereophonic effectis not produced as the same input is fedto both the channels without any phasecontrol.

But in this receiver, FM stereo de-coder IC TEA1330 (IC3) is used for stereoreproduction from the aural signals. LED3glows only when the receiver receivesstereophonic signals.

Preamplifier: A low-gain

preamplifier based on the popular ICLA3161 has been used after the decoderstage. However, outputs provided by thedecoder IC can be used to directly drivelow-power audio amplifiers.

Audio power amplifier: In this cir-cuit two popular rugged TDA2002A ICsare used. This IC is a class B audio poweramplifier IC capable of driving low-im-pedance loads (up to 1.6 ohms). It canpump 10 watts of power at 12V supplyinto a 4-ohm impedance loudspeaker. Theoutput is quite adequate for all domesticpurposes.

Optional functions/features: Thisversatile receiver can perform followingoptional functions:

1. Long range remote switch. For this,switch off all switches except S3. Take anFM transmitter or an FM mike. Switch iton. Rotate the gang capacitor and tunethe receiver to the transmitter frequency.On proper tuning, LED1 will start glow-ing, and so also LED2.

Now this pair (FM mike/transmitterand the receiver) is ready to be used as aremote switch. Any electrically poweredappliance can be turned on and off viarelay RL1 by turning the transmitter (FMmike) on and off.

2. Long range cordless call bell. Switchoff all the switches except switch S4. Ad-just transmitter-receiver pair as men-tioned earlier.

Now this receiver and FM mike (trans-mitter) pair can be used as a cordless callbell. When mike is on, the buzzer willsound.

3. Cordless intercom or walkie-talkie.Two such receivers and a pair of FMmikes (or transmitters) can be used as anintercom set or a walkie-talkie. As it isfairly easy to construct an FM transmit-ter providing a good range (severalkilometers), the performance of this re-mote switch would be far better than anysimilar device working on IR pulses.

Functions of various LEDs andswitches are summarised in Tables I andII respectively. An actual-size single-sidedPCB layout for the circuit of Fig. 2 isshown in Fig. 3 and its components lay-out is shown in Fig. 4.

Construction andAdjustments

1. First construct the circuit around IC1and IC2 (up to top first dotted line in Fig.2) only. Then switch on the power supply.Adjust trimmers VC1 and VC2 to their

PARTS LISTSemiconductors:IC1 - LM7805 3-terminal

positive voltageregulator

IC2 - CXA1019S Sony single-chip FM/AM receiver

IC3 - TEA1330 FM stereodecoder

IC4 - LA3161 2-channel lownoise preamplifier

IC5,IC6 - TDA 2002A audio poweramplifier

T1 - AC188 pnp transistorT2-T4 - BD139 npn power

transistorLED1-LED3 - Coloured LEDZ1-Z2 - 3V zener diodeD1 - 1N4001 rectifier diode

Resistors (all ¼ watt, ±5% metal/carbonfilm, unless stated otherwise):R1 - 150-ohmR2, R3 - 330-ohmR4 - 680-ohmR5 - 33-ohm, ½ wattR6 - 1.2 kilo-ohmR7, R8, R12, R13R19, R20, R26 - 1 kilo-ohmR9 - 100-ohmR10 - 15 kilo-ohmR11, R16 - 100-ohm, ½ wattR28, R29 - 22 kilo-ohmR14, R15, R17R18 - 10 kilo-ohmR21, R22 - 2.2-ohmR23, R30 - 220-ohmR24, R25 - 1-ohmR27 - 8.2kR31, R32 - 3.9 kilo-ohmR33 - 100 kilo-ohm

Capacitors:C1 - 2200 µF, 25V electrolyticC2, C11, C15, C26C27, C38, C40 - 0.1µF, ceramic discC3 - 3.3µF, 16V electrolyticC4 - 3pF ceramic discC5, C33, C36 - 0.001µF ceramic discC6 - 22pF ceramic discC7, C8, C24C25, C47 - 0.02µF ceramic discC9 - 47µF, 25V electrolyticC10 - 0.01µF ceramic discC12, C13, C28C29 - 100µF, 16V electrolyticC14, C16, C43 - 10µF, 25V electrolyticC17, C30, C31 - 1µF, 25V electrolyticC18 - 680pF ceramic discC19, C35, C45C46 - 10µF, 16V electrolyticC20 - 100µF, 25V electrolyticC21 - 0.047µF ceramic discC22 - 0.22µF ceramic discC23 - 0.47µF ceramic discC32, C39, C41C42 - 1000µF, 25V electrolyticC34, C37 - 470µF, 10V electrolyticC44 - 470µF, 25V electrolyticMiscellaneousRL1 - 12V, 200-ohm, SPDT

relay- 2X gang

VC1, VC2 - Trimmers 0-22pFBZ1 - 12V buzzerS1-S4 - On/off miniature slide

switchesL1 - 3 turns | All coils are

hand wound on 3mm air

core formerL2 - 4 turns | using 22SWG

enamelled copper wireL3 - 5 turns |CF1 - 10.7 MHz ceramic

resonatorCF2 - 10.7 MHz ceramic filter

- Heat sinks for T3, T4 ,IC5 and IC6

- 12V DC power supplyenclosure, speakers,

- FM mike or FMtransmitter.

Page 19: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 9

zero positions. Nowrotate the gang ca-pacitor to the near-est FM broadcast sta-tion (or use an FMcordless mike if anFM station is notavailable). If it hasbeen tuned properlyand everything hasgone right, LED1 willglow; otherwiserecheck the circuit.Now adjust VC1 andVC2 for maximumbrightness of LED1and feed the audiooutput provided bythis IC to any work-ing audio amplifier(output available atpin No. 24 of IC1,marked as point A).Speak into the FMmike; you should beable to hear yourvoice from thespeaker.

2. Construction ofthe coils L1-L3 isquite easy. Take any3mm round rod. Use22SWG enamelledcopper wire. Windclosely three turns onthe rod and slip thecoil out from the rod.Use it as coil L1. Forcoil L2, wind fourslightly spaced turnson the same rod andslip it out. Similarly,for coil L3, wind fiveclose turns with thehelp of the same rod.

3. After success-ful completion of step1 and fabrication ofthe coils as per step2, assemble all thefour transistors andother components upto second dotted line(on the upper part ofthe circuit), tune thereceiver to your FMmike’s frequency tillLED1 starts glow-ing. Then adjust pre-set VR1 so thatLED2 glows. NowF

ig. 2

: Circ

uit d

iagr

am o

f ver

satil

e F

M s

tere

o re

ceiv

er

Page 20: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2010

switch off the FM mike. LED2 must stopglowing; otherwise again adjust VR1.LED2 must glow when the mike is on andmust not glow when it is off. Now If onlyS4 is closed, receiver will work as a re-mote switch which can turn any appli-ance on or off via the relay when the mikeis turned on or off.

4. After successful completion of step 3,construct the circuit around decoder ICTDA1330 (up to the first dotted line of thebottom part of the circuit in Fig. 2). Nowtune the receiver to any FM radio stationtransmitting stereo FM signals. If every-thing has gone alright, LED3 should glow,subject to a proper adjustment of preset

TABLE ILED IndicationLED1 Fine tuningLED2 Power onLED3 Stereo signal available

TABLE IISwitch Positions Mode of Operation Output FunctionOnly S3 ON Remote switch Relay ONOnly S4 ON Cordless bell Buzzer soundsOnly S1 ON Mono receiver, mono Sound from speaker

cordless FM intercom LS1Only S1 & S2 Stereo receiver, stereo Sound from bothON cordless FM intercom speakers LS1-LS2

Fig. 3: Actual-size single-sided PCB for the circuit in Fig. 2.

Fig. 4: Components layout for the PCB in Fig. 3.

VR3. This decoder IC provides a stereooutput which can be directly fed to a low-power audio amplifier.

5. Now construct the remaining partof the circuit. With that the constructionof the receiver would be complete.Potmeters VR4 and VR5 should be ad-justed for minimum distortion. For this,keep the volume of theaudio amplifier atmaximum and adjustpotmeters VR4 andVR5 till undistortedsound is delivered bythe speakers. Adjust-ment must be carried

out for eachchannel sepa-rately byswitching thespeaker of theother channeloff.

Switches S1and S2 can beused for con-verting the re-ceiver into amono. This fea-ture will be use-ful when the cir-cuit is poweredthrough a bat-tery and youwant to con-serve its energy,or when it isused as an inter-

com. When the receiver is used as a re-mote switch or cordless bell, both switches

S1 and S2 mustbe kept open(off).

PowerSupplyFor excel-

lent results,properly filteredand regulated12V DC powersupply is re-quired. Themaximum cur-rent cons-umption (whenall switches areon and volumeis maximum)will not exceed

Page 21: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 11

2A. Minimum current consumption (whenth- ere is no input signal) is only a fewmilliamperes, which makes it ideal for callbell and intercom applications.

Notes: 1. Since readymade FM re-

ceiver kit based on IC CXA10193 isavailable in the market, the same can beused in this project. In that case, omitcorresponding part of the circuit. How-ever, don’t forget to add an FM gang (2X)

appropriately.2. For remote switch and cordless bell,

only upper part of the circuit needs to beassembled.

Readers Comments:❏ This construction project looks perfectfor stereo reception, but I have an FM kitbased on Philips TEA5591 FM/AM ICwhich has only one output. Hence, I wouldlike to use the remaining part of yourcircuit for developing the stereo receiver.I have the following queries:

1. Can your FM stereo decoder ICTEA1330 be used with my circuit? If yes,how?

2. There is no tuning indicator in thePhilips IC. So, how can I use the facilityof auto power off/on, mute functions, etc?

3. What is FM 2X gang? Only a trim-mer has been provided in the kit.

Ruhil DhawanMeerut

❏ I have added one LED driver circuitto pin no. 20 of CXA1019S IC and changedthe gang with FM 2X. On fine tuning,LED1 glows properly and the audio is alsogood for both FM and AM.

I have further assembled the circuitaround IC TEA1330. The output is givento AF amplifier (TBA 810) directly for test-ing. LED2 does not glow at all. Even theinput reception is stereo. I tried by ad-justing preset VR3 but LED2 does notglow.

R. RajeshChennai

❏ I request the author to clarify the fol-lowing points:How can I introduce automatic gain con-trol (AGC) in the same circuit for betterand stable FM reception?

Vijay K. YadavRaipur

❏ While constructing the FM receiver, Icame across the following difficulties:

1. I could not find FM stereo decoderIC TEA1330 in the market. Is there anysubstitute which is easily available?Where can I obtain TEA1330 from?

2. What is the role of presets VR2 andVR3 in FM stereo decoder section?

3. What is 19kHz check (pin no. 12)and VCO (pin no. 9) in TEA1330?

4(a) In an earlier issue of EFY, an FMreceiver circuit based on TEA 5591A waspublished. Kindly let me know whether itcan be used in place of CXA1019S-basedkit, and whether output of TEA5591A canbe fed to TEA1330 as shown in case of

CXA1019S?4(b) I am interested

in adding AM radio re-ception in the same cir-cuit, with FM stereo re-ception. Kindly suggestthe modifications neededand provide modifiedPCB design for it.

Jaipal SinghNew Delhi

The author VidyutSarkar replies:I thank all readers fortheir keen interest in mycircuit. Replies to lettersfrom various readers aregiven below:

Mr Dhawan can usedecoder IC TEA1330with Philips FM/AM re-ceiver kit based onTEA5591. For this, heshould feed the audiooutput from IC TEA5591to the input of decoder ICTEA1330.

Auto power on/off andnoise-mute facilities can-not be exploited easilywhile using IC 5591 as ithas no tuning indicator.

There are two trim-mers in the actual kit.Therefore one can avoidFM 2X gang, but it willbe difficult to tune fromone frequency to another.

For simplicity andclarity in sound reproduction, I haveavoided AM section. To incorporate thispart, some more components and addi-tional tracks are needed on the PCB.

Regarding Mr Rajesh’s letter: Pleasecheck the frequency at pin 12 of IC3 by afrequency-meter and set the frequency to19 kHz by trimming VR3 (4.7k pot.).

The values of components R10, VR3and C18 collectively determine the fre-quency constant of the oscillator section ofIC3. Hence these are not critical. You maytake some different values like R10=10k,C18=680pF etc.

If the decoder still does not work, re-place it (TEA1330) with a new IC, as it

may not be working properly.Please note that LED3 (stereo indica-

tor) will glow only when there is strongstereo signal. In case of weak stereo sig-nals, it may not glow but the stereo out-put will still be available.

I do not suggest Mr Yadav to add ex-tra circuit for AGC in this unit as outputprovided by CXA1019S is stable to a largeextent. Also, for better stability, he mayselect some other IC like KA22426 which,though, may be difficult to procure.

Regarding Mr Jaipal’s letter:1. Yes, TEA1330 can be substituted

by KA2261. However, if audio output sup-plied by this IC contains noise, then he

Fig. 1: Pin configuration of Sony CXA1019S IC

Fig. 2: Pin configuration for TEA1330/KA2261

Page 22: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2012

may think of replacing C22 by 1µF ca-pacitor in the low-pass filter section.

2. Preset VR2 has been used to selectthe phase angle between the channels ofstereo output for stereophonic effect. Theseparation angle between the two chan-nels must be less than 90 degrees. This canbe obtained by setting VR2 around 200ohms.

Preset VR3 is used to set the frequencyof the oscillator section at 76 kHz.

3. After two successive divisions, thisappears at pin 12 as 19 kHz. Using thisfrequency, the phase comparator of thisdecoder IC decodes the information.

The term VCO stands for voltage con-

trolled oscillator, and the function of pin12 has been mentioned above.

I have omitted AM/SW/TV receptionpart of this IC for simplicity and betterreception of FM part.

4 (a) Yes, one can use the output ofTEA5591A. Also, one can use any otherFM radio IC in place of CXA1019S.

4 (b) Using a few additional compo-nents, one may add AM reception capa-bility as well. But only FM section is sug-gested for better results.EFY: Some readers have asked for com-plete circuit details for AM/SW/TV recep-tion. These can only be accomodated in aseparate article, and it is not possible to

discuss these here. However, the pin dia-grams of IC CXA1019S and TEA1330/KA2261 are given in Figs 1 and 2 respec-tively.

As regards the components for theproject, the same are easily available inthe local market and can also be pro-cured from some leading vendors whoare supplying components specially toelectronic hobbyists. 2Xgang refers to atwo-section variable capacitor with air/polyster insulation. Please consult EFYmagazines where addresses of suchdealers are published regularly throughadvertisements.

Page 23: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 13

SWITCHLESS MUSICALCALLING BELL WITH COUNTER

The switchless automatic callingbell system described here can befabricated using low-cost and eas-

ily available com-ponents. Thisproject uses in-frared transmit-ter and receivermodules whichare fitted face toface on both sidesof front entrydoor or corridor ofthe premises.

When a visi-tor enters thehouse, infraredbeam between IRemitter and IRdetector is inter-rupted for a moment. This results in aspecific musical tune being played anda display, indicating the number ofvisitors entering the house, advancesby one. When the next visitor entersthe house, a different musical tune isheard. In this way, up to 16 differentmusical tunes will be played on suc-cessive entry of the visitors. After thatthe musical tunes are repeated.

Maximum count of display is 99.After displaying 99, counter isautomatically reset to zero and startscounting again. Fig. 1 gives the overallview of the system.

DescriptionThe circuit comprises the following parts:

1. IR transmitter2. IR receiver3. Melody generator4. Counter with display5. Power supply.IR transmitter (Fig. 2): Infrared

transmitter module uses IC 555 as astablemultivibrator operating at a frequency ofaround 1 kHz. A pnp transistor (SK100

or BD140) is used in IRED (infrared emit-ter diode) driver stage at the output. Thistransmitter module emits modulatedinfrared light. Two IREDs are connectedin series for more range and widerdirectivity. The module can transmit IRrays up to 4 metres without use of anyexternal lens.

IR receiver circuit (Fig. 3): IR re-ceiver module is fully transistorised. Ithas a tone signal amplifier, a switchingcircuit and relay driver to switch on mu-

PRADEEP G.

Fig. 1: Overall view of the switchless calling bell system

Fig. 2: IR transmitter

Semiconductors:IC1, IC3 - NE555 timerIC2 - CIC4822/WE4822 melody

generatorIC4-IC5 - CD4033 decade counterIC6 - 7809 9-volt regulatorIC7 - 7806 6-volt regulatorT1 - SK100 pnp transistorT2 - 2N5777 IR photo transistorT3,T4 - BC549C npn transistorT5 - BC558 pnp transistorT6,T7 - BC548 npn transistorT8 - SL100 npn transistorD1,D2 - IREDD3,D4 - IN4148 switching diodeD5 - 3.6V, 0.5W zenerD6,D7 - 1N4001 rectifier diode

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 150 kilo-ohmR2,R16 - 1.5 kilo-ohmR3,R4 - 56 ohmR5 - 4.7 ohmR6,R14 - 4.7 kilo-ohmR7 - 470 kilo-ohmR8 - 3.3 kilo-ohmR9 - 2.2 kilo-ohmR10 - 2.7 kilo-ohmR11 - 470 ohmR12,R23,R24 - 100 kilo-ohmR24,R26R13 - 100 ohmR15 - 22 kilo-ohmR17,R18 - 1 kilo-ohmR19 - 82 kilo-ohmR20 - 470 ohmsR21 - 10 kilo-ohmR22 - 220 kilo-ohm

Capacitors:C1 - 10µF, 16V electrolyticC2,C9,C4,C16 - 0.01µF ceramic discC3,C7,C8,C18,C19,C20 - 0.1µF ceramic discC5,C14 - 47pF ceramic discC6 - 100µF, 16V electrolyticC10 - 2.2µF,16V electrolyticC11 - 2.2nF ceramic discC12 - 0.04µF ceramic discC13 - 10µF,16V electrolyticC15 - 4.7µF,16V electrolyticC17 - 1000µF, 25V electrolytic

Miscellaneous:DIS 1, DIS 2 - LT543 common-cathode

displayRL1 - 6V, 100-ohm DPDT relayLS - Speaker, 8-ohm, 0.5WX1 - 230V AC primary to 12V-0-

12V,500 mA sec transformer- PCB, switches, IC sockets

PARTS LIST

Page 24: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2014

sical bell and counter via the contacts of aDPDT relay.

When signals from transmitter are re-ceived by IR photo-transistor, AmplifiedAC output is obtained from the collector oftransistor T4. These amplified signals areused to bias pnp transistor T5. Only nega-

tive half cyclesof tone signalsforward biastransistor T5.Because ofpresence of ca-pacitor C10(2.2µF), tran-sistor T6 con-tinuously con-ducts duringthe periodwhen signalsfrom trans-

mitter are being received. When transis-tor T6 conducts, transistor T7 is cut-offand relay remains de-energised.

When IR beam is interrupted for amoment, due to passage of a visitor, noamplified AC signals are available at baseof transistor T5. This results in cutting-

Fig. 3: IR receiver

Fig. 5: Counter with display

Fig. 4: Melody generator circuit

off of transistors T5 as well asT6. As a result relay driver tran-sistor T7 gets forward biased viaresistor R16 and diode D3. Therelay is thus energised and itcauses application of triggerpulses to both the musical bellcircuit and the counter, via itsN/O contacts.

A short duration switchingpulse is sufficient to trigger boththe bell and counter. Once atrigger pulse is applied to musicalbell, it starts playing a tune andit will stop only on completion ofthe specific tune. After that it willreset automatically and be ready

for the next trigger/tune. Counter, mean-while, advances by one.

Melody generator (Fig. 4): IfCIC4822 or WE4822 IC is used, 16 differ-ent musical tunes can be generated. Aparticular tune/melody can be selected byusing two-way switch as shown in thediagram.

If UM3482 IC is used, 12 differenttunes can be heard. A number of optionscan be programmed with the help of pinsprovided for the purpose. For details onemay refer to the data sheets of these ICs.

Maximum safe voltage for the melodygenerator IC is 5volts. A 3.6V zenerdiode is used tol i m i t / p r o v i d estable 3.6-voltsupply to themelody IC.

T w o - d i g i tcounter module(Fig. 5): Two-digitcounter modulecomprises threeICs and two com-mon-cathode dis-plays. The first IC(IC3) is a 555 timerwhich is wired asm o n o s t a b l em u l t i v i b r a t o r .Time period ofmonostable hasbeen set for aboutone second. The

next two are CMOS decade counterCD4033 ICs, which are cascaded to drivethe common-cathode displays directly. Ifdesired, a 330-ohm resistors can be con-nected to each segment output from ICpins before connection to the displays.

Pin 2 of IC 555 is connected to one of

Page 25: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 15

Fig. 6: Power supply circuit

Fig. 8: Component layout for the PCB

Fig. 7: Actual-size single-sided PCB layout for the circuits in Figs 2 through 6

the poles of relay contacts. Other termi-nal (N/O) of relay contact is connected toground. When relay is activated for amoment, pin 2 of IC 555 is shorted toground. As a result IC 555 gets triggeredand applies clock pulse to counter input.For each clock pulse, the counter advancesby one count. The count can go up to 99(max. count). After that, the counter resetsto zero and starts counting again. S2 ismanual push-to-on reset switch. By

pushing it one can reset counter at anyinstant.

Power supply (Fig. 6): Power sup-ply for the complete unit can be de-rived from the mains using a step-downtransformer of 230V AC primary to12V-0-12V, 500mA secondary. A full-wave rectifier followed by a capacitorfilters the output voltage and feeds thefollowing 9-volt regulator whose outputis used to cater to the power supplyrequirement of IR receiver, melody gen-erator and counter modules. It is alsoused to provide input to a 6-volt regu-lator IC used for feeding the transmit-ter circuit.

An actual-size single-sided PCBcomprising circuits shown in Figs. 2through 6 is given in Fig. 7 while itscomponent layout is given in Fig. 8.PCB for the transmitter (Fig. 2) can becut out from the integrated PCB.

Use sockets for both CD4033 ICs.Don’t try to solder CMOS ICs directly onPCB. A 2-core cable may be used toconnect the IR transmitter module whilea 3-core cable will be necessary for IRreceiver module as shown in Fig. 1.

Power supply, musical bell withspeaker, relay and counter modulesmay be fitted inside the main cabinet.Both IREDs and photo transistor arefitted suitably on transmitter and IRreceiver/amplifier modules as shown inFig. 1 and properly aligned afterassembly. ❑

Page 26: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2016

COMPUMULTIMETER—A COMPUTER INTERFACED

MULTIMETER

L inking an electronic project withcomputer is a real fun, and thisproject is one such thing. The

project can be used to measure resistance(100 ohms – 100 k ohms), capacitance(0.001µF – 100µF) and voltage (1.25V –5V) by interfacing your personal compu-ter to the simple circuit presented here.

DescriptionThe circuit consists of a 555 timer operat-ing in the astable mode. This timer gen-erates square wave output at a frequencydependent on the values of external tim-ing components like Ra, Rb and C (seeFig. 1). Hence, the output frequency isindirectly a measure of the values of theseexternal components.

The output of this circuit is fed to theparallel port of the computer. Thefrequency of the output pulses is measuredby the software part of the project. Fromthis measured frequency, the value of theunknown component is calculated usingthe formula:

Frequency f = 1.44 / (Ra+2Rb)CHowever, from this formula only re-

sistance or capacitance can be measured.To measure voltage (between the limits1.25V and 5.00V (Vcc)), the 555 timer isused as a voltage controlled oscillator(VCO) or a voltage–to-frequency converter.The voltage at pin 5 (control) of the timervaries the frequency of the timer. Thusby calibrating the frequency with someknown values of voltages at pin 5 of theIC, unknown voltages can be found byapplying them across pin 5 and ground.

Suitable known standard values of Ra,Rb and C are selected with the help ofrotary switches S1, S2 and S3 respectively,as described later in the text. During meas-

u r e m e n to funknownresistor orcapacitor,switch S4is kept inthe posi-t i o nshown inFig. 1.D u r i n gmeasure-ment ofunknownvoltage be-tween thea b o v e -mentionedl i m i t s ,switch S4is to beflipped tothe otherside.

SoftwareThe software enables com-

munication between the exter-nal circuit and the computer.The codes have been written andcompiled in ‘C’. The software isa user-friendly one with GUI(graphics user interface).

First of all themode of operation,i.e. resistance or ca-pacitance or voltagemeasurement, isselected interac-tively. The range ofvalues of the com-

N.V. VENKATARAYALU

Fig. 1: Schematic circuit diagram of CompuMultimeter

TABLE IIUnknown Cap. Range Ra Rb Freq. Range Duty Cycle

0.001µF – 0.01µF 1M 1M 481 Hz – 48.1 Hz 66%0.01µF – 0.1µF 100k 100K 481 Hz – 48.1 Hz 66%0.1µF – 1µF 10k 10K 481 Hz – 48.1 Hz 66%1µF – 10µF 1k 1K 481 Hz – 48.1 Hz 66%10µF – 100µF 100 100 Ohm 481 Hz – 48.1 Hz 66%

TABLE IUnknown Ra C Frequency Duty CycleResistanceRange100 ohm 1k 10µF 120 Hz – 48 Hz 91% - 66%1k -10k 1k 10µF 48 Hz – 6.82 Hz 66% - 52%10k-100k 10k 1µF 48 Hz – 6.82 Hz 66% - 52%

ponents that can be measured are dis-played on the monitor’s screen.

Before selecting a suitable range, ap-propriate external components (shown in

Page 27: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 17

/*** CompuMultiMeter by N.V.Venkatarayalu***/#include <graphics.h>#include <time.h>#include <conio.h>#include <math.h>#include <string.h>

void initscreen(void);void evaluate(void);int mode;

void main(void){initscreen();evaluate();closegraph();return ;}

void initscreen(){int gd=DETECT,gm;initgraph(&gd,&gm,” “ );outp(0x378,0);setfillstyle(SOLID_FILL,EGA_CYAN);bar(10,10,630,470);setfillstyle(SOLID_FILL,EGA_WHITE);bar(12,12,628,50);setcolor(EGA_BLACK);settextstyle(COMPLEX_FONT,HORIZ_DIR,1);setusercharsize(4,8,6,7);outtextxy(210,10,”CompuMultiMeter”);setusercharsize(1,3,1,2);outtextxy(390,23,”By N.V.VENKATARAYALU.”);settextstyle(SIMPLEX_FONT,HORIZ_DIR,2);outtextxy(50,70,” OhmMeter “);outtextxy(50,100,” Capacitance Meter”);outtextxy(50,130,” Volt Meter”);settextstyle(SMALL_FONT,HORIZ_DIR,4);setfillstyle(SOLID_FILL,EGA_LIGHTGRAY);bar(12,455,628,468);outtextxy(510,455,”Press ‘Esc’ to Quit”);outtextxy(524,260,”To the Computer”);outtextxy(524,210,”From the Computer”);setfillstyle(SOLID_FILL,EGA_MAGENTA);fillellipse(40 ,85,5,5);fillellipse(40 ,115,5,5);fillellipse(40 ,145,5,5);mode=0;setlinestyle(SOLID_LINE,0,THICK_WIDTH);rectangle(50,70,225,100);setfillstyle(SOLID_FILL,EGA_YELLOW);bar(14,14,37,48);rectangle(16,16,34,46);rectangle(400,150,520,320);circle(460,95,5);line(460,150,460,100);line(460,125,350,125);line(350,125,350,145);moveto(350,145);lineto(355,150);lineto(345,160);lineto(355,170);lineto(350,175);lineto(350,185);lineto(400,185);moveto(350,185);lineto(350,195);lineto(355,200);lineto(345,210);lineto(355,220);lineto(350,225);lineto(350,235);lineto(400,235);moveto(350,235);lineto(350,275);lineto(400,275);line(350,275,350,325);line(335,325,365,325);arc(350,345,40,140,15);line(350,333,350,365);line(425,320,425,365);

line(475,320,475,345);line(475,345,460,345);line(460,335,460,355);arc(440,345,320,40,15);line(453,345,425,345);line(350,365,550,365);line(520,205,560,205);line(520,255,560,255);circle(555,365,5);circle(565,205,5);circle(565,255,5);

settextstyle(TRIPLEX_SCR_FONT,HORIZ_DIR,4);outtextxy(430,200,”555");settextstyle(TRIPLEX_SCR_FONT,HORIZ_DIR,1);outtextxy(405,180,”7");outtextxy(405,220,”6");outtextxy(405,260,”2");outtextxy(460,150,”8");outtextxy(420,295,”1");outtextxy(470,295,”5");outtextxy(505,195,”4");outtextxy(505,245,”3");outtextxy(320,145,”Ra”);outtextxy(320,205,”Rb”);outtextxy(320,325,”C”);}

void evaluate(){void getdata(void);int ch;setfillstyle(SOLID_FILL,EGA_CYAN);do{if (ch==80 && mode==0){setcolor(EGA_CYAN);rectangle(50,70,225,100);setcolor(EGA_BLACK);rectangle(50,100,225,130);outtextxy(370,325,”x”);bar(360,205,380,230);mode=1; }else if (ch==72 && mode==1){setcolor(EGA_CYAN);rectangle(50,100,225,130);setcolor(EGA_BLACK);rectangle(50,70,225,100);outtextxy(360,205,”x”);bar(370,325,390,350);mode=0; }else if (ch==80 && mode==1){setcolor(EGA_CYAN);rectangle(50,100,225,130);setcolor(EGA_BLACK);rectangle(50,130,225,160);bar(370,325,390,350);mode=2; }else if (ch==72 && mode==2){setcolor(EGA_CYAN);rectangle(50,130,225,160);setcolor(EGA_BLACK);rectangle(50,100,225,130);outtextxy(370,325,”x”);mode=1; }else if(ch==13) getdata();}while((ch=getch())!=27);return;}

void getdata(){float scanfreq(void);void calrescap(float,int);float freq;int select;setcolor(EGA_BLUE);rectangle(30,175,305,295);setfillstyle(SOLID_FILL,EGA_MAGENTA);bar(32,177,303,293);settextstyle(SMALL_FONT,HORIZ_DIR,5);setusercharsize(3,3,10,6);setcolor(EGA_BLACK);if(mode==0){outtextxy(35,185,” Select the range of theUnknown Resistor”);

outtextxy(40,215,”1. 100 Ohm - 1 KOhm (Ra=1KOhm ,C=10uF )”);outtextxy(40,230,”2. 1 KOhm - 10 KOhms (Ra=1KOhm ,C=10uF )”);outtextxy(40,245,”3. 10 KOhms - 100 KOhms(Ra=10 KOhms ,C=1uF)”);select=getch()-’0';}if(mode==1){outtextxy(35,185,” Select the range of theUnknown Capacitor”);outtextxy(45,215,”1. 0.001 uF - 0.01 uF (Ra=Rb=1MOhm )”);outtextxy(45,230,”2. 0.01 uF - 0.1 uF(Ra=Rb=100 KOhms)”);outtextxy(45,245,”3. 0.1 uF - 1 uF (Ra=Rb=10KOhms )”);outtextxy(45,260,”4. 1 uF - 10 uF (Ra=Rb=1KOhm )”);outtextxy(45,275,”5. 10 uF - 100 uF(Ra=Rb=100 Ohms )”);select=getch()-’0';

}setfillstyle(SOLID_FILL,EGA_CYAN);bar(29,174,306,296);setfillstyle(SOLID_FILL,EGA_BLUE);bar(30,200,285,240);setfillstyle(SOLID_FILL,EGA_MAGENTA);bar(32,202,283,238);if ((select >0 && select <6 && mode==1) ||(select>0 && select <4 && mode==0) || (select!=0 &&mode==2)){outtextxy(85,210,”Busy!! Wait for 5 seconds...”);freq=scanfreq();calrescap(freq,select);select=0;}else{outtextxy(65,210,”Data Input Error! Press anyKey...”);getch();}setfillstyle(SOLID_FILL,EGA_CYAN);bar(30,200,285,240);return;}float scanfreq(){float m=0;int s=127,t=127;clock_t start, end=0;outp(0x378,1);start = clock();for(;(end-start)<18.2*5;end=clock()){s=inp(0x379);if(s!=t)m++;t=s;}outp(0x378,0);return (m/10);}void calrescap(float fre,int selm){double roundresult(double);double result=0.0;char dispstr[50];setcolor(EGA_BLACK);rectangle(30,195,305,250);setfillstyle(SOLID_FILL,EGA_MAGENTA);bar(32,197,303,248);if (mode==0 && fre>0){switch(selm){case 1: result= (1.44/(fre*10e-6)-1e3)/2; break;case 2: result= (1.44/(fre*10e-6)-1e3)/2; break;case 3: result= (1.44/(fre*1e-6)-10e3)/2; break;

Software Program

Page 28: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2018

TABLE III PARTS LISTSemiconductors:IC1 - NE555 timer

Resistors (all 1/4W, ± 5% carbon, unlessstated otherwise):R1,R12 - 1 Meg-ohmR2,R11 - 100 kilo-ohmR3,R10 - 10 kilo-ohmR4,R9 - 1 kilo-ohmR5,R8 - 100 ohmR6 - 47 ohmR7 - 56 ohm

Capacitors:C1 - 0.01µF ceramic discC2 - 10µF,16V electrolyticC3 - 1µF,16V electrolytic

Miscellaneous:- 25-pin, male, female 'D'

connectors, ribbon cableand PCB etc.

Input voltage Frequency1.25 13101.50 12601.75 10532.00 8422.25 7152.50 5952.75 5133.00 4413.25 3713.50 3173.75 2704.00 2254.25 1834.50 1834.75 1555.00 125

}result=roundresult(result);sprintf(dispstr,”The value of the resistor Rb is:%1.1e Ohms”,result);}else if (mode==1 && fre >0){switch(selm){case 1: result=1.44/(fre*3.0*1e6); break;case 2: result=1.44/(fre*3.0*1e5); break;case 3: result=1.44/(fre*3.0*1e4); break;case 4: result=1.44/(fre*3.0*1e3); break;case 5: result=1.44/(fre*3.0*1e2); break;}result=roundresult(result);sprintf(dispstr,”The value of the Capacitance C is:%1.1e F”,result);}

else if (mode==2 && fre >0){result=(log(fre/3080.1))/log(0.5241);result=roundresult(result);sprintf(dispstr,”The Voltage drop is : %1.1eVolts”,result);}if (result<=0.0)sprintf(dispstr,”Calculation Error. Check forknown values”,result);outtextxy(40,210,dispstr);getch();setfillstyle(SOLID_FILL,EGA_CYAN);bar(29,194,306,296);return;}

double roundresult(double res){

char restr[10];double rres;int t,power;sprintf(restr,”%1.2e”,res);t=restr[3]-’0';power=(restr[6]-’0')*10+restr[7]-’0';rres=(restr[0]-’0')+(float)(restr[2]-’0')/10;if(t>4) rres+=0.1;

if(restr[5]==’-’)rres*=pow(10,-power);elserres*=pow(10,power);return rres;}

Table I) areselected us-ing the ro-t a r ys w i t c h e s .Once therange hasbeen se-lected, logic1 is passedto the paral-lel port us-ing the ‘out-put (0x378,1)’ state-ment, where

0x378 is the output port address. This

ordinary multimeter. The unknown ca-pacitance (Cx in Fig. 1) is placed betweenpin 6 and ground (arm C) of the IC. Otherexternal components, i.e. Ra and Rb, areselected as per Table II.

3. To measure the voltage within therange 1.25V to 5V, the same is to be con-nected across pin 5 of 555 IC and ground.In the above two modes (i.e. while measur-ing resistance or capacitance values), thispin was grounded through a 0.01µF capaci-tor. This reduces any noise at this pin andthe pin is maintained steadily at 2/3Vcc bya potential divider inside the IC. Becauseof this reason, whenever the external ca-pacitor charges to a voltage higher than 2/3Vcc (voltage at pin 5), the output statechanges and the capacitor starts discharg-ing. Again, when its potential reduces to 1/3Vcc, the output changes.

However, in this mode of operationpin 5 is forced to an external voltage. Thiscauses the output state to change whenthe capacitor’s voltage reaches the exter-nal voltage while charging and reacheshalf of the external voltage while discharg-

changes pin 2 (data bit #1) of the parallelport from logic 0 to logic 1. This pin isconnected to pin 4 of the 555 timer, whichis the RESET pin, and the timer actionbegins only when it is high. After thisthe program enters a ‘for loop’ that scansthe port address to which the output ofthe timer is connected (data bit #8 of port379 hex) for exactly five seconds. This isdone by using the statement ‘inp(0x379)’where 0x379 is the input port addressand it returns a byte from this hardwareport address.

Each time the port is scanned, the bytereturned is compared with the previousvalue. If these are not the same, it impliesthat either a high-to-low or a low-to-high

transition has occurred. Thus countingthe number of such transitions, until theend of the ‘for loop,’ gives twice the numberof cycles in five seconds. From this data,the number of cycles in one second, i.e.the frequency, is found. This is the valueof ‘f’ in the above formula. The programcalculates the unknown value, i.e. thevalue of the component, from this valueof ‘f.’ As the ‘for loop’ terminates, the 555IC is disabled by bringing its pin 4 to logic0. Sending 0 to the port using thestatement ‘outp(0x378, 0) does this. Thusthe timer is activated only when the pro-gram scans the parallel port.

The three modes of operation arepresented below:

1. To measure resistance, the rangeof resistance that is to be measured is tobe first known as in the case of anyordinary multimeter. The unknown re-sistance (Rx in Fig. 1) is placed betweenpins 6 and 7 (in Rb arm) of the IC. Otherexternal components (Ra and C) are se-lected with the help of Table I.

2. To measure capacitance, the rangeof capacitance that is to be measured isto be known first, as in the case of any

Fig. 2: Actual-size PCB layout for the circuit

Fig. 3: Component layout for the PCB

Page 29: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 19

ing. This in turn changes the frequency,depending on the external voltage at pin5 and other external components. The val-ues chosen for the external componentsare:

Ra = 22 kilo-ohmsRb = 56 ohmsC = 0.01 µFThe frequency of the output for vari-

ous voltages at pin 5, as computed by theauthor, is listed in Table III for Vcc =+5.25 V.

From this data, curve fitting has beendone to derive a relationship between thefrequency and voltage at pin 5. An exponen-tial regression leads to the relationship:

Frequency, f = a(b)V

Or

where a = 3080 and b = 0.524.The program uses this formula to cal-

culate the value of the unknown voltage.The resolution of this Compu-

MultiMeter in resistance and capacitancemeasurement modes is 0.1, and the re-sult is displayed in the format X.Xe±XXwhere ‘e’ stands for exponent to base 10.For example, 4.7 kilo-ohm is displayed as4.7e+3.

Accuracy of the results depends onthe tolerance level of the other external

components used. Hence, for better re-sults, components with 1 per cent toler-ance level are recommended.

This simple circuit can be easily wiredon a general-purpose PCB. However, forthose readers who still desire to wire upthe circuit using a proper track layout, asingle-sided actual-size PCB is shown inFig. 2 and the component layout for thesame is shown in Fig. 3.

Lab Note: During measurements, itwas observed that while the values of un-known resistors and capacitors could bemeasured fairly accurately, the results ofvoltage measurements were wide off themark. ❑

Reader Comments:❑ I have completed the software and hard-ware successfully, and it is working well.I, however, want to know as to how wecalculate the constants ‘a’, ‘b’ from curvefitting using (f-frequency) and (v-voltage),and also how we arrive at the formula f =a(b)V from linear regression?

S. Suresh KumarAlwarkurichi

The author N.V. Venkatarayalu replies:From Table III published in the con-

struction project, an exponential depend-ence of frequency on voltage can be no-ticed. So, an exponential regression of theform f = a(b)V would be best suited. Tofind the constants ‘a’ and ‘b’ the expres-sion is reduced to the linear form by tak-ing the logarithm of both sides in theabove equation, i.e.

log f=v log b + log awhich is of the form y=mx+cwhere y=log f, x=v, m=log b, andc=log a.The standard procedure for linear re-

gression available in any numerical math-ematics book can be used to find ‘m’ and‘c’ and hence the constants ‘a’ and ‘b’. Thevalues of ‘a’ and ‘b’ are found to be3080and 0.524 respectively. ❑

Page 30: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2020

CALLING NUMBERIDENTIFICATION SYSTEM

USING CALCULATOR

Here is a simple and inexpensivecircuit to identify the callingtelephone number of an incoming

telephone call. Recently the telecommu-nication department has introduced thefacility of calling number identification

system for cities like Mumbai and NewDelhi. Many companies have alreadyadvertised their products which candisplay the calling number with addedfeatures like storage of the previouscalling numbers and undesired number

G. GOWRISHANKAR

blanking etc. The circuit of calling numberidentification system presented here willcost around Rs 300 including the cost of asimple calculator which has been used inthis project for displaying the callingnumber.

Fig. 1: Circuit diagram of calling number identification system using calculator

Page 31: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 21

CMOS IC having the following features:1. Detects all 16 standard DTMF

tones.2. Typical power consumption is

15 mW.3. Single 5V power supply operation.4. Three-state output for interfacing

to microprocessors.5. Uses commonly available 3.579545

MHz crystal.6. Valid input signal range is as low

as -29 dbm.7. Can be used

in single-ended ordifferential inputsignal configura-tion.

Pin descriptionof KT3170/CM8870 IC isgiven in the boxabove. The BCDcoded outputsfrom decoder IC5are converted intod e c i m a lFig. 2: Power supply circuit

Semiconductors:IC1-IC3 - CD4016/CD4066 quad

analogue switch/analoguemultiplexer

IC4 - CD4028 BCD-to-decimaldecoder

IC5 - KT 3170 or 8870 DTMFdecoder

IC6 - CD4011 quad 2-inputNAND gate

IC7 - CD4081 quad 2-input ANDgate

IC8 - MCT2E opto-couplerT1 - 2N2222, npn switching

transistorD1-D10 - 1N4007, rectifier diode

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1, R7 - 47 kilo-ohmR2 - 330 kilo-ohmR3 - 1 mega-ohmR4, R5 - 1.5 kilo-ohmR6 - 100 kilo-ohmR8 - 1 kilo-ohmR9 - 12 kilo-ohmR10 - 10 kilo-ohm

Capacitors:C1 - 0.1µF, 10V polysterC2, C9 - 0.1µF ceramic discC3 - 0.47µF, 100V polysterC4 - 47µF, 16V electrolyticC5 - 470µF, 25V electrolyticC6 - 10µF, 10V electrolyticC7 - 1µF, 160V polysterC8 - 1000µF, 25V electrolytic

Miscellaneous:Xtal - 3.579545 MHz crystalX1 - 230V primary to 0-12V,

250mA secondarytransformer

X2 - 230V primary to 0-6V,500mA secondarytransformer

Calculator - 12 digit calculatorBattery - 1.5Vx4, R6 (UM-3DG) cells

PARTS LIST

The dedicated DTMF-to-BCD con-verter IC KT3170 or CM8870 forms theheart of this circuit. This IC converts theincoming DTMF signals sent by theMTNL in between the ringing signals intocorresponding BCD codes. IC KT3170 orits equivalent CM8870 is a low-power

Pin Description of CM8870Pin No. Symbol Description1 IN+ Non-inverting input of the op-amp2 IN- Inverting input of the op-amp3 GS Gain select. The output used for gain adjustment of analogue input signal

with a feedback resistor.4 VREF Reference voltage output (VDD/2, Typ.) can be used to bias the op-amp

input of VDD/2.5 IIN Input inhibit. High input states inhibit the detection of tones. This pin is

pulled down internally.6 PDN Control input for the stand-by power down mode. Power down occurs

when the signal on this input is in high state. This pin is pulled downinternally.

7.6 OSC1 Clock input/output. An inexpensive 3.579545MHz crystal connectedOSC2 between these pins completes internal oscillator. Also, external clock can

be used.9 GND Ground pin10 OE Output enable input. Outputs Q1-Q4 are CMOS push-pull when OE is

high and open circuited (high impedance) when disabled by putting OElow. Internal pull-up resistor built-in.

11-14 Q1-Q4 Three-state data output. When enabled by OE, these digital outputsprovide the hexadecimal code corresponding to the last valid tone pairreceived.

15 DSO Delayed steering output. Indicates that valid frequencies have beenpresent for the required guard time, thus constituting a valid signal.Presents a logic high when a received tone pair has been registered andthe output latch is updated. Returns to logic low when the voltage on SI/GTO falls below VTH.

16 ESO Early steering outputs. Indicates detection of valid tone outputs a logichigh immediately when the digital algorithm detects a recognisable tonepair. Any moemtary loss of signal condition will cause ESO to return tolow.

17 SI/GTO Steering input/Guard time output. A voltage greater than VTS detected atS1 causes the device to register the detected tone pair and update theoutput latch. A voltage less than VTS frees the device to accept a newtone pair. The GTO output acts to reset the external steering timeconstant, and its state is a function of ESO and the voltage on S1.

18 VDC Power Supply (+5V, Typ.)

equivalents by IC4 (CD4028) which is aBCD-to-decimal decoder. The output pinsof this IC will be ‘high’ corresponding tothe BCD code given at the input of IC4.The BCD output from IC5 is coupled toIC4 via four AND gates. The gates areenabled by the delayed steering output(DSO), a pulsed digital signal availableat pin 15 of IC5 which will be ‘high’ onlywhen the DTMF tone is detected by theIC.

IC1 through IC3 are all quad ana-logue switches controlled by the decimaloutputs from IC4. The analogue switchtriggers the corresponding decimalnumber in the calculator which is used asa display in the circuit.

IC4 responds to all the BCD codesexcept the zero decimal, because the out-put of IC5 for zero (corresponding to ‘0’key on dial key-pad ) will be 1010 whichwill not activate IC4. NAND gate (IC6(b)) is used to sense the zero code. Activelow output of gate IC6(b) is inverted byIC6(a) to trigger the ‘0’ display in thecalculator.

Page 32: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2022

IC9 (MCT2E) is an opto-coupler whichis well known to EFY readers. It is wiredto sense the ringing signals. When thefirst ring comes, the input to IC6(C) goeshigh because the transistor inside theopto-coupler conducts. Capacitor C5 holdsthe input high for a few seconds. Theoutput of IC6(d) also goes high simulta-neously and it causes a pulse to passthrough capacitor C4 which closes the

analogue switch IC1(a) and the calcula-tor is switched on.

Any common type of calculatorcan be used for this application. However,one should ensure that the calculator has12 or more digits so that the callingnumber along with area code etc could beaccommodated.

For interfacing the calculator with thiscircuit, remove cabinet of the calculator.

Now you can see that the tracks underthe pushbutton side are etched in such away that when a pushbutton is pressedthe corresponding two tracks under thepushbutton get shorted. You can take pairof leads from the corresponding two tracksby scratching the green mask and solder-ing the wires carefully.

A proper actual-size, single-sided PCBfor the circuits in Figs 1 and 2 is shownin Fig. 3 and its component layout isshown in Fig. 4. After assembly, the unitcan be fixed into a small plastic enclo-sure which should have a cut-out for thedisplay.

The power supply for the calculatorcan be taken from this circuit itself. If thecalculator requires 3V for operation, re-place the diodes D2 through D4 with a3.3V, 250mW zener. The given power sup-ply circuit having a battery back-up issuggested for proper operation.Lab note: The testing of the circuit wascarried out in simulated conditions usinginternal extensions (having DTMF dial-ling facility) of an EPABX. Not only thecalling numbers but even the called num-bers were displayed on calculator display.Apparently, lifting of the handset fromcradle, which causes sudden change ofvoltage from 48V to about 12 volts, sendsa pulse via opto-coupler to control pin ofIC1(a) to switch on the calculator todisplay the dialled number. Capacitor C7was added in the original circuit to obvi-ate loading of the telephone line to avoidits behaving as ‘busy’ while the handsetis still on the cradle.

Fig. 4: Components layout for the PCB

Prototype of caller-identification tested inEFY Lab

Fig. 3: Actual-size, single-sided combined PCB layout for the circuits of Figs 1 and 2

Page 33: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 23

TRANSFORMER POLARITYTESTER

Testing the winding polarity oftransformers, especially those ofmulti-winding SMPS, audio and

power transformers, is a common require-ment in the industry. An instrumentwhich could easily and quickly test thewinding polarity would be extremely use-ful for not only the industry but also theelectronics hobbyists and enthusiasts.

The circuit of transformer polaritytester given here can be easily fabricatedusing commonly available components.The supply voltage selected is 9V,

which suits portable battery-powered op-eration.

To test the relative polarity betweenany two windings, the user has to con-nect only two sets of probes (or crocodileclips) to the respective winding terminals,the reference winding and any otherwinding. The polarity is indicated withthe help of two LEDs with respect to thereference winding probe leads marked +(red) and - (black). The green LED when‘on’ would indicate that the two windingsare in phase, that is, the ‘+’ marked and

P.S. SINI

Fig. 1: Circuit diagram for transformer polarity tester

‘-’ marked probe leads are connected towinding terminals with identical ‘dot’ po-larity. On the contrary, red LED when‘on’ will indicate reverse dot polarity ofthe two windings.

The circuit is based on the principlethat when any winding of a transformeris excited with a voltage pulse, all othercoupled windings generate pulses of vary-ing amplitude decided by the turns ratio.The ‘dot’ ends of all the windings gener-ate voltages in phase with the ‘dot’ end ofthe excited winding. This presents the pos-

Page 34: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2024

sibility of performing a simple logic ANDoperation to determine the winding po-larity. In the circuit diagram given in Fig.1, NAND gate N2 does this job in con-junction with rest of the circuit.

DescriptionThough the simple AND gate will work inprinciple, various edge delays and ring-ing phenomenon commonly encounteredin transformer circuits will cause errors,making the test results invalid. Thecircuit presented here avoids theseerrors by sampling the pulses somewherein the middle part of the exciting pulseand then doing the logic detection of thephase.

The first part of the circuit is a simpleastable multivibrator with IC1 having an‘on’ period of 50 to 100 µs and ‘off’ periodof approximately 5 ms. Resistance R2Ashown in series with diode D1, which de-termines ‘on’ period, should be test se-lected to be low enough but adequate totrigger the MOSFET properly.

The positive going pulse output from

IC1 is used to drive the MOSFET (T3)which in turn produces the voltage pulse

at the excitationprobe terminals. Re-sistor R7 and diodeD2 provide the free-wheeling path whenreference winding oftransformer ‘undertest’ is connectedacross excitationprobes.

Resistor R10senses the excitationcurrent and, if this isexcessive, compara-tor IC4(a) gives apositive pulse outputto trigger the SCR(T1) to ‘on’ state. As aresult, further driveto the MOSFET is in-hibited until the re-set switch is pressed.This limits the cur-rent to a safe value incase of accidental

Semiconductors:IC1-IC3 - NE555, timerIC4 - TL084, quad JFET input

opampIC5 (N1,N2) - CD4011, quad NAND gateT1 - 2N5062 or 2PUM, SCR.T2 - BC557, pnp transistorT3 - IRF840 n-channel MOSFETD1 - 1N4148 switching diodeD2, D3 - MUR160 or1N4007

rectifier diodeD4 - Zener, 5.I volt

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 820-ohmR2 - 68 kilo-ohmR2A* - Test selected (refer text)R3, R16, R17 - 680-ohmR4, R6, R13 - 1.2 kilo-ohmR5 - 2 kilo-ohmR7 - 510-ohmR8 - 100-ohmR9, R14R21, R23 - 1 kilo-ohmR10 - 33-ohmR11 - 180-ohmR12, R20, R22 - 5.1 kilo-ohmR15 - 33 kilo-ohmR18 - 22 kilo-ohmR19 - 1.5 kilo-ohm

Capacitors:C1, C2, C6, C7 - 0.1µF ceramic discC3, C4, C5 - 0.22µF ceramic discC8 - 0.01µF ceramic discC9 - 3.3µF, 25V electrolytic

Miscellaneous:LED1 - Yellow LEDLED2 - Red LEDLED3 - Green LED

- Crocodile clips- Battery, 9-volt

PARTS LIST shorting of theprobes. This con-dition is indicatedby the glowing ofyellow LED1.

A samplingpulse is gener-ated by monoshotIC2 which gets adelayed triggerderived from theexciting pulse.Output of themonoshot isgiven to one ofthe pins of NANDgate N2 whichgives an activelow output whenthe precondi-tioned pulse ap-plied to its otherinput pin is avail-able simultane-ously with themonoshot highstate.

Resistors R20through R22,zener diode D4and IC4(b) do theconditioning ofthe input pulse byamplitude limit-

ing and comparator action. Care shouldstill be taken, if the turns ratio is veryhigh, to produce excessive voltage at themeasuring winding.

Timer IC3 is used for the indicationfunction. It is basically a re-triggerablemonoshot with 8ms period. The output ofthis monoshot remains high if NAND gateN2 output is low (active) which triggers itduring each measuring cycle. This causesthe green LED to continuously glow, indi-cating the same dot polarity of the un-known winding as that of the excitingwinding. When polarity is not the same,red LED will glow.

The circuit can be assembled using ageneral-purpose PCB. However, a properactual-size, single-sided PCB layout forthe circuit is given in Fig. 2. The compo-nents layout for the PCB is given in Fig. 3.

After assembly, the PCB can be fixedinside a small plastic case with LEDs andreset switch S1 protruding out. Crocodileclips with red and black coloured bandscan be used for the two pairs of probes forconnecting the reference and any otherwinding. ❑

Fig. 4: Pin configura-tion of transistor andMOSFET

Fig. 3: Component layout for the PCB of Fig. 2

Fig. 2: Actual-size, single-sided PCB for the circuit of Fig. 1

Page 35: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 25

PROGRAMMABLE VERSATILETIMER

Many timer circuits have beenpublished in EFY in the past.But this circuit based on dedi-

cated application-specific IC (ASIC) ICM7217A is quite versatile and compact.

ICM 7217A comprises a 4-digit decadecounter with multiplexed LED display driv-ers. ASIC versions with suffix A and C aremeant for common-cathode and theversions with nil or B suffix are meant forcommon-anode LED displays. The A andnil suffix versions have a maximum countof 9999 while suffix C and B versions,which are primarily meant for timing ap-plications, have a maximum count of 5959.

The BCD I/O port pins (7 through 4)

can be used for inputting BCD data to aregister inside the chip. The contents ofthis register are compared with the countheld in the counter and the results appearat output pins 2 (ZERO or Z) and 3 (EQUALor E). When both counter and registercontents are zero, pin 2 output becomeslogic 0 (active) and when contents ofcounter and register are equal, pin 3 outputgoes logic 0 (active). These features aremade use of in this circuit.

DescriptionThe schematic diagram of versatile pro-grammable timer is given in Figs 1 and 2

S. ARVIND

while its power supply circuit is given inFig. 3. Other than the power supply andground connections, certain points of Fig.1 (A through D) need to be connected(through use of jumper wires) to variouspoints (E through K in Fig. 2) for variousmodes of operation, as per Table I.

There are three modes of operationwhich have been covered in this article.These modes can be used for various ap-plications. Many other modes, limited onlyby one’s own imagination, are also possi-ble.

As mentioned earlier, ICM 7217A ver-sion is used with common-cathode LEDdisplays. The average segment current is

Fig. 1: Circuit diagram showing interfacing of ICM 7217A with 7-segment displays and thumbwheel switches

Page 36: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2026

required to be limited toabout 3 mA.

The clock input is afairly conventional one.Here the CMOS compat-ible clock is generated us-ing a crystal of 32.768 KHzin conjunction with ICCD4060 which is a 14-stage binary counter/di-vider and oscillator.

The final output of 2Hz at pin 3 of IC2 is fur-ther divided by 2 by IC3(CD4017) which isconfigured here as a tog-gle flip-flop to provide 1Hzpulses at pin 3 (point E).

Logic state at pin 10 ofIC1 determines the counting direction.When pin 10 is at logic 1, the direction ofcounting is upwards, and when it is atlogic 0, the direction of counting is down-wards.

Switches S1 through S3 are springloaded push-to-on switches. Switch S1 isused to load the counter with the BCDcount value selected via the thumb-wheelswitches TWS1 through TWS4. Switch S2is similarly used to load the internal reg-ister with the count value selected via thethumb-wheel switches. Once both, the con-tents of register and those of the counter,are equal, the output at pin 3 of IC1 goeslow. Switch S4 is used to reset the coun-ter to zero.

The three modes of operationselectable with the help of jumpers, asper Table I, are described below.

Mode 1: In this mode jumper J1 isplaced across points 1 and 2 while switchS4 is in closed position so that IC2 func-tions continuously. The 1Hz clock gener-ated by IC3 at point E is jumpered toclock pin 8 (point A) of IC1. Outputs frompoints C (ZERO) and D (EQUAL) are con-nected to inputs of gates N1 (point F) andN2 (point G) of the NAND latch circuit.Output (point H) from the NAND latchconnected to pin 10 of IC1 (point B) con-trols the direction of counting.

Assume that the registers have beenloaded with a specific value selected with

the help of thumb-wheel switches TWS1through TWS4. Whenthe counter is at 0, theoutput at pin 2 (pointC) becomes active low.This causes the outputof latch at point H togo high and the coun-ter starts counting up.When counter reachesthe preset value(loaded into the inter-nal register), pin 3 output (EQUAL) atpoint D becomes active low. This causesoutput of the latch to go low and, as aresult, the counter starts counting down.Thus in mode 1, the counter keeps count-ing back and forth between zero and thepreset value.

Mode 2: In this mode it functions likea preset timer to sound an alarm whenthe count reaches the programmed value.The 1Hz clock from point E is connectedto pin 8 (point A) of IC1, as in mode 1.

However, in this mode the counter isconfigured for counting up operation only,by connecting pin 10 (point B) of IC1 toVcc (point L), i.e. logic 1. The internalregister is loaded to the value preset bythumbwheel switches TWS1 throughTWS4 with the help of push-to-on switchS2. In this mode, switch S4 remains openand jumper J1 is placed across points 2and 3 so that master reset pin 12 of IC2 iscontrolled by the potential/logic level atthe collector of transistor T1. Simultane-ously, the collector of transistor T1 is con-nected to reset pin 4 of NE555 timer IC2which is configured as an astablemultivibrator operating in the audio fre-quency region. The base of transistor T1

via point J is connected to point D whichcarries the EQUAL output from pin 3 ofIC1.

Thus until the time the countercontents are less than the value held inthe internal register, the output at pin 3of IC1 is at logic 1. As a result, transistorT1 is forward biased and its collectoris pulled to near ground potential,which causes counter IC2 to remainoperative while timer IC4 remains non-operative.

Once the count reaches the value heldin the internal register of IC1, its outputat pin 3 goes logic 0. This causes transis-tor T1 to cut-off so that its collector volt-age becomes high and it resets counterIC2, while timer IC4 becomes operationaland the buzzer sounds to indicate the endof the preset timing interval.

Please note that the value set throughthumbwheel switches corresponds to thevalue in seconds since 1Hz clock is beingused for counting operation by IC1.

Mode 3: In this mode the counter op-erates in reverse way than in mode 2.Here the counter alone is used. The countvalue selected by thumb-wheel switchesis loaded into the counter using push-to-

Fig. 2: Interface circuit for achieving various modes of operation

Fig. 3: Power supply circuit

Page 37: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 27

Semiconductors:IC1 - ICM 7217A, 4-digit LED

driver cum programmableup/down counter

IC2 - CD4060, 14-stage counterand oscillator

IC3 - CD4017 decade counterIC4 - NE555 timerIC5 - 74LS00 quad 2-input

NAND gateIC6 - LM7805 voltage regulatorT1 - 2N2222A npn transistorT2 - SK100 pnp transistorD1-D16 - 1N4148 switching diodeD17-D19 - 1N4007 rectifier diode

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1, R2, R11 - 10 kilo-ohmR3-R6, R9, R10 - 1 kilo-ohmR7 - 220 kilo-ohmR8 - 6.8 kilo-ohmR12 - 22 kilo-ohmR13 - 2.2 kilo-ohmR14, R15 - 330 ohm

Capacitors:C1 - 10µF, 16V electrolyticC2, C4, C6, C7 - 0.1µF ceramic discC3 - 0.01µF ceramic discC5 - 1000µF, 25V electrolytic

Miscellaneous:XTAL1 - 32.768kHz crystalDIS1-DIS4 - LT543x4 common cathode

displayX1 - 230V AC primary to 12V-0-

12V, 250mA secondarytransformer

TWS1-TWS4 - BCD thumbwheel switchS1-S3 - Push-to-on switchS4 - SPST switchLED1 - Red LEDLED2 - Green LED

PARTS LISTtransistor T1 byshorting point Cto J.

Thus ini-tially, when thecount value isgreater than 0,transistor T1 re-mains forward bi-ased and its col-lector voltage isnear ground po-tential which, inturn, results inforward biasing ofpnp relay drivertransistor T2.Thus the loadconnected to sup-ply via N/O con-tacts of relay RL1is on. As thecounter countsdown from theloaded value andreaches zero, theoutput at pin 2 ofIC1 goes logic 0.This cuts off tran-sistor T1 and con-sequently tran-sistor T2 todeenergise therelay and switchoff the supply tothe load.

Applica-tions

Mode 1: A specialapplication of thismode could bemade in the taperecorders. The1Hz clock pulsesmay in that casebe replaced by 1pulse/revolutionof the tape. Thus

once the tape, during play, reaches a pre-set position, the counter reverses and thetape rewinds. Once the tape reaches 0position, it again starts playing in the for-ward direction and thus it keeps on re-peating a particular song or speech.

This mode would also have industrialapplications where a gadget is to operatein a particular direction/way for a pro-

grammable duration and then in the op-posite direction/other way for the sameperiod, repeatedly.

Mode 2: A simple applicationwould be as a lab timer or as a wake-upalarm on completion of the preset time.

Mode 3: This mode could be used inindustrial environments for switching on/off of any device after a preset delay. Manyother applications may also be similarlythought of not only for this but othermodes as well.

An actual-size, single-sided PCB lay-out for the circuits in Figs 1 through 3 isgiven in Fig. 4. The component layout forthe PCB is given in Fig. 5.

Normal precautions required for work-ing with CMOS ICs should be taken whileassembling this circuit. For easy fault di-agnosis and replacement, all the ICs maybe mounted on IC bases. The circuit, af-ter assembly, may be fitted inside a smallbox with cut-out for the display. Thepower supply transformer and the relaymay be mounted externally, if desired.

Fig. 4: Actual-size, single-sided PCB layout for the circuits in Figs 1 through 3

Fig. 5: Component layout for the PCB in Fig. 4

on switch S1. Like modes 1 and 2, the1Hz clock is applied to pin 8 of IC1 byconnecting point A to E. The position ofjumper J1 is the same as for mode 2.However, jumper 2 is used for connectingthe collector of transistor T1 to the baseof relay driver transistor T2 by shortingpoints 5 and 6, while ZERO output frompin 2 of IC1 is connected to the base of

Page 38: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2028

CALLER-ID UNIT USINGMICRO-CONTROLLER

The facility of knowing your call-er’s telephone number before an-swer-ing the call, which had been

available to cellular phone users only in

India earlier, has since been extended tothe normal telephone users also in Delhi,Mumbai and some other cities of Indiathrough MTNL and DoT since 1st

VINAY CHADDHA

January 1999.MTNL/DoT telephone exchanges

transmit the telephone number of callingparty just before the first ring while in

Fig. 1: Complete circuit diagram of caller-ID unit

Page 39: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 29

systems used in USA and China, the datarelating to the calling number is sent be-tween first and the second rings. Thenumber of calling party in India is trans-mitted by MTNL/DoT exchanges in DTMFcodes.

Two documents containing standardsand specifications issued by DoT’s Tel-ecommunications Engineering Centre(TEC) in the form of ‘Generic require-ments’ and ‘Interface requirements’ for‘Subscriber service unit for calling lineidentification presentation (SSU for CLIP)’are available from TEC, Khursheed LalBhawan, Janpath, New Delhi against pay-ment of Rs 250 each.

In older versions of telephones usingrotory dials, whenever a digit was dialled,telephone line was disconnected and re-connected for short durations. These werereferred to as pulses and the system wascalled pulse dialing system. The numberof connections and disconnections equaledthe dialled digit. For example, if number7 was dialled, the line was disconnected7 times for short durations. For number0, the number of connections anddisconnections equalled 10.

In later versions of telephones usingpush buttons and integrated circuits, thesame protocols are used to maintain com-patibility with older phones and ex-changes.

DTMF (dual tone multi frequency) sys-tem is replacing the pulse dialling systemin modern telephones and exchanges. InDTMF telephones (and exchanges), thenumbers are transmitted using differenttone frequency pairs and not by makingor breaking connections.

A normal telephone instrument has12 buttons (keys) arranged in three col-umns and four rows. Each row in the key-pad matrix activates a specific frequencytone. Similarly, each column also controlsa specific frequency tone. So when a keyis pressed, two different tones correspond-ing to the row and column combination ofthe key are generated.

Table I shows the tone frequency-pair

associated with each row andcolumn of the telephone key-pad. Thus pressing 8 willgenerate a combination con-sisting of row and column fre-quencies of 852 Hz and 1336Hz respectively. Similarly,pressing 4 will generate 770Hz and 1209 Hz combination.The same tone frequencycombinations are used fortransmitting calling party’snumber from exchange tothe called party’s telephoneinstrument.

Caller-ID circuitpresented here has thefollowing features:

• Displays diallednumbers (in tone modeonly).

• Displays incomingnumbers and stores them inmemory.

• Only last 99 numbersare stored in memory. (Older numbers areautomatically deleted and new numbersare stored when the stored numbersexceed 99—on first-in-first-out basis.)

• View incoming numbers and selec-tively delete stored numbers.

DescriptionThis caller-ID unit has seven functionalblocks: power supply, off-hook detector,DTMF decoder, LCD display unit, micro-controller, memory and keyboard. Themain electronic components are shown inTable II.

MC68HC705KJ1 is the latest low-costmicro-controller from Motorola. Otherparts like ICs MT 8870, 24C08, LM393and LCD module are standard parts thatare available from more than one source.

TABLE 1Column 1 Column 2 Column 31209 Hz 1336 Hz 1447 Hz

Row 1 1 2 3697 HzRow 2 4 5 6770 HzRow 3 7 8 9852 HzRow 4 * 0 #941 Hz

Fig. 2: Power supply

Power supply (Fig. 2): The powersupply unit is used to provide a constant5V supply to different ICs. This is a stand-ard circuit using external 12V DC adop-ter and fixed 3-pin voltage regulator. Di-ode is added in series to avoid damage tothe unit if reverse voltage is applied bymistake.

Off-hook detector (Fig. 3): The tel-ephone line voltage is around 48V whenunit is on-hook. This voltage falls toaround 10 V when telephone handset islifted from the cradle, and it remains thesame during dialling or conversation. Thisvoltage may vary by ± 20 per cent due tobattery voltage variations at exchange andline voltage drop, depending upon the dis-tance between exchange and the telephoneinstrument.

Off-hook detector circuit uses a bridgerectifier to take care of polarity reversalof telephone lines. Resistor divider com-prising R9 and R10 divides the line volt-age by 20 for comparison against a fixedvoltage (approximately 1 volt), which isderived from +5V supply using voltagedivider comprising resistors R7 and R8.Output of comparator IC4 at pin 7 is logiclow (0V) when unit is on-hook and logichigh (+5V) when unit is off-hook. Theoutput level from the comparator is suit-able for direct interfacing to micro-con-troller IC1.

LCD display unit (Fig. 4): LCD dis-play is a single-line, 16-character unit.This is a standard unit available in local

TABLE IIMicro-controller MC68HC705KJ1 IC1DTMF decoder MT8870 IC2Memory 24C08 IC3Comparator LM393 IC4Alphanumeric 16 characters DIS.1LCD x 1 Line

Fig. 4: LCD display unit

Fig. 3: Off-hook detector

Page 40: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2030

market. Interface with micro-controller isaccomplished via four data lines D7-D4and two control lines RS and E. Usingthese six lines, micro-controller displaysall messages and telephone numbers. The

signal names used here are the same asused by the LCD module/driver manufac-turers. Pin configuration for a typical 16-character x 1 line LCD module is shownin Table III.

Some LCD modules come with addi-tional one or two pins. These extra pinsare used for back-lighting. There is nofixed standard for the additional pins.

However, in case of Lampex, Orioleand Crystalonics (popular brandsavailable in India), connections forpins-15 and 16 are shown in TableIV.

LCD controller is a flexible con-troller and can be used with 8-bitor 4-bit micro-controller. In 4-bitmode, only D4-D7 are used, leav-ing D0-D3 open.

In our circuit, we have conectedR/W pin to ground as we are usingit for write operation only.Reading back of the module’sstatus, which is required tocheck if LCD module is busy,is not possible.

To avoid problems, extra

delays in software are provided afterevery write command so that beforewriting another command/data, LCDmodule should be ready (not busy).Further, only four data lines (D4-D7)have been used while the other four datalines (D0-D3) are left disconnected. Thuseven though we are using an 8-bit micro-controller, the LCD module has beeninterfaced for 4-bit mode. Again, to savepin count, RS line is shared with SDA(serial data) line for memory (IC3) sinceat any given moment micro-controller willeither interface with the LCD module orthe memory, and this does not affect thesystem operation.

Non-volatile memory (Fig. 5): 2-wire serial CMOS EEPROM 24C08 isused in this circuit to retain last 99 in-coming numbers. Numbers stored remainin memory even after power failure.

TABLE IIIPin No Signal Remarks1 Ground Vss2 + 5 V Vcc3 Contrast Ground for maximum contrast4 RS H = Data L = Command5 R/W H = Read L = Write6 E H = Enable L = disable7 - 10 D0 - D3 Data lines (Lower nibble) *11 - 14 D4 - D7 Data lines (Higher nibble) **Note : For 8-bit (byte) data interfacing all the eightdata lines (Pins 7 through 14) are used whereas for 4-bit (nibble) data operation, data lines for D4-D7 (pin 11through 14 only have to be used.)

TABLE IVPin/Manufacturer Lampex Oriole Crystalonics15 +5 V Ground Ground16 Gnd. X X

Fig.8: Keyboard using three tactile switches Fig. 9: DTMF decoder

Fig. 7: Sample of I2C bus message

Fig. 5: Non-volatile memory

Fig. 6: Wave form showing conditions existing in I2C bus transfer

Page 41: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 31

24C08 is an 8k(1024x8) bitsn o n - v o l a t i l ememory. 8kbits are inter-nally organisedas 1024 x 8 bitsor 1k bytes. Aseach byte canstore two digitsof a number, atotal of 8 bytesare reserved foreach number(for maximumof 16-digitlength). Sowhile this unit

can store 128 16-digit numbers, the soft-ware used is configured only for 99 num-bers, so that only 2 digits are required ondisplay for call counter. This IC is inter-faced with microcontroller using two con-trol lines SCL (serial clock) and SDA (se-rial data). This 2-wire interface is popu-larly known as I2C bus interface.

Overview of I2C bus : I2C devicesstands for inter-integrated circuit. Thiswas designed by Philips but now a numberof semiconductor device manufacturersare making compatible I2C bus.

This I2C bus is used mainly with sin-gle-chip based micro-controller systemsthat require general-purpose circuits likeEEPROM, RAM, real-time clock, LCD con-troller and audio/video tuning circuits. A

key advantage of this is thatonly two lines can connect mul-tiple devices. All I2C deviceshave one nibble of built-in ad-dress followed by one nibble ofH/W address determined by A0A1 A2 A3 lines. The 24C08 usedin this design has a device ad-dress of A0 (hex).

In circuit with multiple de-vices, one device (usually themicro-controller) takes the roleof master. Another device (onlyone of the multiple devices atany one time) acts as a slavedevice. Master device takes con-trol of SCL, i.e. SCL is set lowor high under the control ofmaster (usually the micro-con-troller). Slave device accepts thedata from micro-controller (e.g.writing into memory) or sendsthe data to micro-controller(reading from memory) underthe control of master device.

Four different conditionsexist in I2C bus transfers. Theseare start, stop, bit transfer(read/write) and acknowledge.All these conditions areexplained below with referenceto waveforms shown in Figs 6and 7.

1. Normal data bit write/read. During transfer of datafrom master (micro-controller)to slave device (e.g. EEPROM),SDA is set to logic 0 or 1 onlywhen SCL is low. After smalldelay, SCL is pulsed high toclock in data. During read op-eration, SDA is an input lineand its logic state is clocked in

Fig. 10: Micro-controller circuit

Fig .11: Actual-size, single-sided PCB layout for circuit in Fig. 1 including keypad in Fig. 8

Fig .12: Component layout for PCB in Fig 11

Page 42: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2032

with SCL going high. Master (micro-con-troller) can then read the level of SDA.

2. Start condition. Start is a specialcondition where SDA changes its statefrom high to low when SCL is high. BothSCL and SDA are controlled by master(micro-controller).

3. Stop condition. Stop is also a spe-cial condition where SDA goes from lowto high when SCL is high. Both SCL andSDA are controlled by master (micro-con-troller).

4. Acknowledge. After-transmittingeight data bits from micro controller tothe device (e.g. EEPROM), direction ofSDA line is reversed. One more clockpulse is given by micro-controller. Dur-ing this period, the slave device setsSDA to low. This indicates the acceptanceof data by receiving device (e.g.EEPROM). When data is read from slave

device (e.g. EEPROM), after reading eightbits, direction of SDA is reversed. SDAis set low (to send acknowledge) or high(to send no-acknowledge) and then SCLis pulsed.

How to write a byte inEEPROM

A sample I2C bus message is shown inFig. 7 while a typical example of writinginto memory (device address A0 hex) lo-cation 58 (hex) with data byte 30 (hex) isgiven below:

S 1 0 1 0 0 0 0 0 A 0 1 0 1 1 0 0 0 A 0 01 1 0 0 0 0 A P

Where S indicates start, P indicatesstop and A indicates acknowledgeconditions (as defined in procedingparagraph), while 1 and 0 are data bits.

Description of the above sequence isas follows:

• Action is started with start condi-tion generated by master (micro-control-ler).

• 1010 0000 (A0H) is transmitted asaddress for EEPROM.

• EEPROM responds with acknowl-edge during next clock pulse.

• 0101 1000 (58H) is transmitted asbyte address with EEPROM.

• Again EEPROM responds with ac-knowledge during next clock pulse.

• Finally, data byte 0011 0000 (30H)is transmitted.

• EEPROM acknowledges during nextclock pulse.

• At the end, master (micro-control-ler) generates stop condition.

Keyboard (Fig. 8): Three keys (tac-tile switches) are used to view stored num-bers and to delete selected numbers. Key-board is used in a scanning mode.

Each data line is set to low levelsequentially while keeping other lines athigh level. Then level of KBD signal ischecked. If it is low, it indicates that keyconnected to the data line which is lowis pressed, else it is not pressed. Due tohigh speed of micro-controller, all threekeys can be checked for their positionsquickly.

DTMF decoder (Fig. 9): DTMF de-coder IC2 MT8870 is AC coupled to tel-ephone lines and keeps on sensing tonefrequencies. As soon as a valid DTMF digitis detected, it sets STD signal (pin 15)high and interrupts the micro-controller.DTMF decoder also requires a 3.58MHzcrystal. For cost saving, the output of mi-cro-controller oscillator is connected to8870 oscillator input pin 7 through a ca-pacitor. Micro-controller then reads thedigital number on four data lines (D4-D7)by making TOE (output enable pin 10 ofIC2) high.

Micro-controller (Fig. 10): Micro-controller used is MC68HC705KJ1 fromMotorola which features:

• 11 I/O pins• 1240 bytes of program memory• 64 bytes of user RAM

Voltage On-hook Off-hookO/P of bridge 35 to 50 V 8 to 10 VPin 5/LM393 1.0 V 1.0 VPin 6/LM393 Above 1.8 V Below 0.7 VPin 7/LM393 0 V 5 V

Raw DC at 7805 input +12 V (+8 to+ 15 V)

Regulated DC at 7805 output +5V

Fig. 13: Software flow-chart of main program

Page 43: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 33

Semiconductors:IC1 - MC68HC705KJ1, micro-

controllerIC2 - MT8870, DTMF decoderIC3 - 24C08, serial CMOS

EEPROMIC4 - LM393, dual comparatorIC5 - 7805, voltage regulatorD1-D4, D8 - 1N4007, rectifier diodeD5-D7 - 1N4148, switching diodeD9, D10 - Zener, 8.2 volt

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1-R3, R5-R6R8, R19 - 10 kilo-ohmR4 - 1 kilo-ohmR7, R13 - 39 kilo-ohmR9 - 470 kilo-ohmR10 - 10 mega-ohmR11 - 300 kilo-ohmR12 - 62 kilo-ohmR14-R17 - 51 kilo-ohmR18 - 100 kilo-ohm

Capacitors:C1 - 10µF, 35V electrolyticC2, C3 - 33 pF ceramic discC4, C6-C9,C12, C13 - 0.1µF ceramic discC5 - 30 pF ceramic discC10, C11 - 0.01µF ceramic disc

Miscellaneous:XTAL - 3.5795 MHz crystalS1-S3 - Tactile switches (push-

to-on)DIS.1 - 16x1 LCD display module

- RG11 connectors- Tel. cable with connector- Body with knobs

PARTS LIST

• 15 stage multiple function timer.Out of 11 I/O pins, four pins are used

for data bus connection to LCD module,DTMF decoder and keyboard (tactileswitches). Two pins are used to interfaceDTMF decoder (TOE and STD). Two pinsare used for LCD controller (E and RS)interfacing. One pin is used for EEPROMclock signal (SCL). The pin required forEEPROM data signal (SDA) is multiplexedwith LCD module signal (RS). One pinscans keyboard. One pin scans off-hook/on-hook status of the hand-set.

A complete schematic diagram of the

caller-ID unit isgiven in Fig. 1.Actual-size, sin-gle-sided PCB lay-out for the circuitin Fig. 1, includedkeyboard (Fig. 8),is given in Fig. 11.The componentlayouts for PCB isgiven in Fig. 11.

S o f t w a r e :Software code in-stalled in ROM ofthe micro-control-ler for proper op-eration of thecaller-ID unit isintellectual prop-

erty of the author, and the same can notbe published at this stage for commercial/other reasons. However, software flowchart for the main program and subrou-tines is shown in Figs 13 and 14 through16.

Assembly and TestingAssembly of this unit is simple. Mount allparts as per the component/PCB layout.For mounting ICs (except 5-volt regula-tor) use sockets. No special soldering/as-sembly precautions are necessary. How-

ever, before mounting the ICs, proceed asfollows:

1. Do not connect telephone line.Power on the unit and check:

2. Mount LM393. Connect telephonelines. Check for following:

3. Install micro-controller, LCD mod-ule and memory IC. At power on “Have anice day” message should appear on LCDscreen.

4. Install DTMF decoder IC. Keeptelephone line connected. Pick up thehandset and press any key on yourtelephone (make sure that telephone isin tone mode) and keep it pressed. Checkvoltage at STD pin 15 of IC MT8870. Itwill be logic high as long as telephonekey is pressed.

The number pressed on telephone in-strument will also appear on LCD dis-play. Press more keys and numbers willcontinue to be displayed one after an-other. The number dialled will remainthere as long as phone is off-hook. Onceyou replace the handset, the standardmessage “Have a nice day” will appear

Fig. 14: Flow chart of key procedure

Fig. 15: Flow chart of DTMF procedure

Page 44: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2034

Fig 16: Flow chart of memory procedure

Fig. 17: Flow-chart for 4-bit data interfacing onLCD module (refer Tech.

again.5. Short pin 7 of comparator LM393

to ground. Press some digits quickly oruse redial switch to dial out the lastnumber. This condition simulates the in-coming number from telephone exchange.Micro-controller thinks that unit is on-hook (as pin 7 is forced to ground) andaccepts DTMF tones generated by tel-ephone handset as originating from ex-change. After receiving full number itstores it in memory. Repeat this proce-dure with a few more numbers. All thesenumbers will be stored in memory as in-coming numbers.

Remove the short. Unit is now in nor-mal condition. Last number displayed willremain on display till handset is pickedand replaced.

6. Press UP or DOWN key on key-board. The last number received will ap-pear on screen. Press DOWN again andsecond last number will appear on screen.Press UP or DOWN to scroll through listof received calls.

If no key is pressed for five seconds,the display reverts back to normal state,i.e. “Have a nice day” message or last re-ceived number is displayed. Pressing UP

and DOWN key againshows the last number re-ceived.

7. To delete anyspecific number, press UPor DOWN key to view thenumber to be deleted.Press DEL key when thenumber is on display. Dis-play will blank out and thenumber will be erasedfrom memory.

Pressing UP /DOWNkeys will show previous ornext numbers but the de-leted number will not beshown.

8. To delete all storednumbers, switch off theunit, press UP and DOWNkeys simultaneously.Switch on the unit whilekeeping both switchespressed. Display will show“Erasing Memory” mes-sage for a few seconds andthen “Have a nice day”message will be displayed.Now all numbers stored inthe memory are erasedpermanently.

Your unit is ready.Celebrate and have fun !

What Next ?Additional functions like storing outgoingcalls, missed calls, adding a new call indi-cator (blinking led), black listing speci-fied calls, date and time recording on alltypes of callers etc are also feasible. How-ever, that requires more program memoryin micro-controller. The present micro-con-troller version used has only 1240 bytesof program memory and 11 I/O lines. Forthe above-mentioned upgradations a µcontroller with more inbuilt memory andI/O lines has to be used.

Tech. Editor’s note: For more detailsregarding 68HC705KJ1 micro-controller,readers may refer to an article on thesubject in Electronics Projects Vol. 18. Youmay also access relevant technical databooks by pointing the browser to http://sps.motorola.com/csic if you have accessto Internet. The instruction set and pro-gramming aspects of LCD modules hadbeen dealt in some detail in a construc-tion article on the subject which appearedelsewhere in Electronics Project Vol. 18.However, the interfacing of LCD module

was done for 8-bit data. For 4-bit datainterfacing, a software flow-chart usingthe same instruction set is given inFig. 17 for the benefit of EFY readers/subscribers. Flow-chart indicates that in‘function set’ instruction the data lengthparameter ‘DL’ is first set to (logic 1) for8-bit data and then changed over to (logic0) for 4-bit data operation. Only data linesD4 through D7 are used for this initiali-sation. ❑

Page 45: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 35

Satyajit DuttaBhopal

� There is an error in displaying incom-ing caller number. The first digit of STDcode is displayed as the last digit of dis-play. For example, if STD code is 0824and phone number is 483521, the same isdisplayed as 8244835210.

How can I solve this problem?Satish A.

Mangalore� The circuit works perfectly when pin7 of the comparator is grounded. Butwhen it comes to the real caller-ID sig-nal, only the number of the first callingparty is displayed, which doesn’t getstored in the memory. The MCU is notreset, so it prevents further numbers frombeing displayed. These problems are notseen when pin 7 is shorted to ground.Please suggest the solution.

Deepa MohanThrough e-mail

The author, Vinay Chaddha, replies:In response to the letter from Praveen

Shankar I would like to say that:Microcontrollers can be programmed

using in-circuit emulator available fromMotorola or through its authoriseddistributors. However, as you have alsoexperienced that they usually do notprovide support to hobbyists, you can readand learn about KJ1 from data books avail-able from the Website of Motorola so youcan design digital radio. In case you faceany problem, please feel free to ask forany help.

In response to the letter from AmitKumar Yadav I would like to say follow-ing:

1. Caller ID unit will work only if yourexchange has this facility and they haveallowed this facility on your line.

2. The single piece of microcrontrollerthat you have procured through some elec-tronics shop must be a blank piece. Itcannot be used in the Caller-ID circuit. It isnot possible to program it without the

dedicated programmer and the software,both of which are not available to you.

In reply to Mr Dutta’s letter, I wouldlike to say:

The cost of a blank microcontroller isRs 100 in the local market. Programmedmicrocontrollers are available throughKits‘n’Spares (EFY’s associate).

It is not possible to use EPROM orROM in place of EEPROM, as the use ofthe EEPROM is to store incoming tele-phone numbers in memory and retainthem in the absence of power. Also, theuser should be able to delete the numbersas and when required. EPROM or ROMsdo not offer the facility of writing anderasing with 5V.

As far as the use of 8085 is concerned,it is possible. However, it will require aminimum of four ICs to replace a single16-pin microcontroller:

Microprocessor 8085 (40-pin device)EPROM 2764 (28-pin device)RAM 6264 (28-pin device)Address latch 74LS374 (20-pin device)8085 is an obsolete processor and is

not being used anywhere in any new orold design.

In reply to Mr Satish’s letter, I wouldlike to say:

Please note that MTNL or DoT ex-changes send STD code of calling partywithout zero prefix, i.e. Delhi code is sentas 11 and not as 011. Also, at the end, azero is added to mark the end of caller-IDinformation. This is the reason for theanamoly.

The microcontroller or hardware hasno problem or defect.

In reply to Mr Deepa Mohan’s letter,I would like to say:

When the phone handset is pickedup, pin 7 of the comparator should gohigh. When the phone handset is putdown on the cradle, pin 7 of the compa-rator should go low. If these equirementsare not met, there is some problem withthe circuit. �

Readers Comments:EFY. After publication of the article anumber of readers have been approachingthe author for more information on KJ1series microcontrollers from Motorola.Please note that EFY-CD’s issued withDec ’01, Jan ’02 and Feb ’02 issuescontains all necessary documents fromauthor and M/s Motorola. Author had alsooffered for any further assistance (forproduct development). Desirous readersmay contact the author at his e-mailaddress ‘[email protected].’ They may alsodownload any required documents, from‘www.motorola.com’ website.

Vinay Chaddha([email protected])

� Could you let me know how toprogram the microcontroller? It would befurther appreciated if you please suggestme an application for feeding serial datato frequency synthesiser chips, such asMC145156, used in digital radio tunerswith LCD frequency readout.

Praveen ShankerHardwar

� I request you to clarify my followingdoubts:

1. In our city neither DTMF mode norCLIP facility is available. Could the de-vice (ID) work under these conditions?Please give possible modifications so thatit can be used.

2. I have a (single) piece ofmicrocontroller IC MC68HC705KJ1,which I have prchased from an electron-ics outlet. Can I use it in the circuit?

Amit Kumar YadavFaizabad

� The Caller-ID project (April ’99) wasvery interesting. I would like to knowthe price and availability of theC68HC705KJ1 microcontroller chip used.In place of an EEPROM, is it possible touse an EPROM or other ROM chips thatare easily available? Can the circuit bemodified so as to work with Intel 8085microprocessor?

Page 46: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2036

MAINS FREQUENCY MONITOR

M ains frequency meters are usedon control panels of almost allelectrical equipment and thus

these are used in the industry in largenumbers. The circuit presented hereconverts the mains AC voltage to square

wave pulses, which are then routed to aphase-locked loop (PLL). The PLL multi-plies the incoming mains frequency by afactor of 100 and the resulting frequencyis displayed in a counter with a resolutionof 0.01 Hz.

DescriptionThe circuit is divided intothree sections:

1. Power supply andclipping circuit (Fig. 1).

2. PLL, counter anddisplay (Fig. 2).

3. Control circuit togenerate timing pulses forcounting the output fromVCO (Fig. 3).

The mains stepped-

S. ARVIND

Fig. 2: Phase locked loop, counter and display circuit

down sine wave pules are first filtered andthen clipped using 5.1-volt zener diodeD3. These clipped pulses are directly fedto the input of CMOS phase-locked loopCD4046 (IC1). IC 74LS390 (IC2), which isa dual decimal counter; it divides the volt-age-controlled oscillator (VCO) output fre-quency by a factor of 100. This dividedfrequency and the input mains frequencyare constantly tracked and kept in lock bythe PLL.

Thus the frequency output of the VCOis actually the mains frequency multipliedby 100. This frequency will be centredaround 5 kHz (based on mains nominalfrequency of 50 Hz). The output from VCOis fed to a 4-digit decade counter cumdisplay driver IC 74C926 (IC3).

CD4060 (IC4) is a binary counter/divider/oscillator IC which uses a 32.768Fig. 1: Power supply and clipper circuit

Page 47: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 37

Semiconductors:IC1 - CD4046 CMOS phase-

locked loopIC2 - 74LS390 dual decade

counterIC3 - 74C926 four-digit decade

counter/display driverIC4 - CD4060 14-stage counter/

divider and oscillatorIC5 - CD4017 decade counterIC6 - 74LS221 dual, one-shot,

monostable flip-flopIC7 - 7805 regulator, 5-voltD1, D2 - 1N4007 rectifier diodeD3 - 5.1-volt zenerT1-T4 - AC187 npn transistor

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 220-kilo-ohmR2-R5, R9 - 2.2-kilo-ohmR6 - 1-kilo-ohmR7 - 100-ohmR8, R11 - 10-kilo-ohmR10 - 150-kilo-ohmR12, R13 - 47-ohm

Capacitors:C1, C2 - 1nF ceramic discC3 - 1000µF, 25V electrolyticC4, C7, C8 - 0.1µF ceramic discC5 - 1µF paperC6 - 0.01µF ceramic disc

Miscellaneous:Xtal - 32.768 KHz crystalX1 - 230V AC primary to 12V-0

12V, 150mA sec. trans-former

DIS1-DIS4 - LT543 common-cathodedisplay

PARTS LIST

KHz crystal. This gives a final output of 2Hz at pin 3. This is again divided by 2using CD4017 (IC5) to obtain 1Hz sym-metrical output. This 1Hz output is fed toone of the inputs of 74LS221 (IC6), whichis a dual, one-shot, monostable flip-flop.This IC outputs a very-short-durationpulse which acts as the latch pulse for thedecade counter IC3 and thus it latches theoutput of the quad counters connected to7-segment displays.

This latch pulse triggers the secondmonostable flip-flop inside IC6. This secondmonoshot also generates a very-short-du-ration pulse which resets the quad countersand prepares them for another countingcycle. This cycle keeps on repeating.

The main advantage of this circuit isthat it gives a resolution of 0.01 Hz. Apartfrom that, it also has an inherent noise-rejection capability, and is quite stableand accurate.

The circuit can be wired on a gener-al-purpose PCB. However, a proper actu-al-size, single-sided PCB layout for thecomplete circuit shown in Figs 1 through3 is given in Fig. 4. The component lay-out for the PCB is given in Fig. 5. Nospecial precautions are required to be fol-lowed during construction. But due caremust be taken to handle the CMOS de-vices. Use of IC bases is recom-ended.This circuit can be easily fabricated us-ing readily-available components. ❑

Fig. 3: Control circuit

Fig. 4: Actual-size single-sided PCB for the circuits given in Figs 1 through Fig. 5: Component layout for the PCB shown in Fig. 4

Page 48: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2038

Fig. 1: Circuit diagram

PARTY GAMEHOW OLD ARE YOU?

This is an interesting circuit whichdisplays a person’s age on the ba-sis of clues provided by the person.

This could be an amusing party game whichcould also be used to guess a number.

DescriptionAt the heart of the circuit is an EPROM.The clues provided by an individual areconverted into a binary address for theEPROM. In each of the memory locations,a two-digit decimal number is stored inits binary-coded decimal (BCD) format,

VASUDEVA BHATTA K.

which is, in fact, the decimal equivalentof the binary address. The two decimalnumbers after decoding by BCD to 7-seg-ment decoders/drivers are displayed astwo LSB digits on common-anode displaysDIS1 and DIS2.

Since the circuit is restricted to showthe age up to 150 years, the third decimaldisplay is configured to show either ‘1’ or toremain blank. In case the display has toshow decimal number equal to or greaterthan 100, the ‘b’ and ‘c’ segments of thethird display digit are activated, makinguse of logic circuit and an LED driver

transistor, as explained later in the next.The EPROM is kept always in ‘read’ modeand the answer switch S10 (push-to-off) isconnected to the ‘display blank’ mode ofboth the 74LS47 ICs, so that the displayremains blank when the answer button isnot pressed.

There are eight push-to-on switches,S1 to S8, which are connected to eightseparate latches realised from sixteen 2-input NAND gates (N1 to N16) from IC1through IC4 (74LS00). One LED is con-nected to each of the latched outputs. TheLEDs remain glowing when the corre-

Page 49: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 39

76 4B 7577 4C 7678 4D 7779 4E 7880 4F 7981 50 8082 51 8183 52 8284 53 8385 54 8486 55 8587 56 8688 57 8789 58 8890 59 8991 5A 9092 5B 9193 5C 9294 5D 9395 5E 9496 5F 9597 60 9698 61 9799 62 98100 63 99101 64 00102 65 01103 66 02104 67 03105 68 04106 69 05107 6A 06108 6B 07109 6C 08110 6D 09111 6E 10112 6F 11113 70 12114 71 13115 72 14116 73 15117 74 16118 75 17119 76 18120 77 19121 78 20122 79 21123 7A 22124 7B 23125 7C 24126 7D 25127 7E 26128 7F 27129 80 28130 81 29131 82 30132 83 31133 84 32134 85 33135 86 34136 87 35137 88 36138 89 37139 8A 38140 8B 39141 8C 40142 8D 41143 8E 42144 8F 43145 90 44146 91 45147 92 46148 93 47149 94 48150 95 49151 96 50

1 3 5 7 9 11 13 15 17 1921 23 25 27 29 31 33 35 37 3941 43 45 47 49 51 53 55 57 5961 63 65 67 69 71 73 75 77 7981 83 85 87 89 91 93 95 97 99101 103 105 107 109 111 113 115 117 119121 123 125 127 129 131 133 135 137 139141 143 145 147 149

S1/D12 3 6 7 10 11 14 15 18 1922 23 26 27 30 31 34 35 38 3942 43 46 47 50 51 54 55 58 5962 63 66 67 70 71 74 75 78 7982 83 86 87 90 91 94 95 98 99102 103 106 107 110 111 114 115 118 119122 123 126 127 130 131 134 135 138 139142 143 146 147 150

S2/D24 5 6 7 12 13 14 15 20 2122 23 28 29 30 31 36 37 38 3944 45 46 47 52 53 54 55 60 6162 63 68 69 70 71 76 77 78 7984 85 86 87 92 93 94 95 100 101102 103 108 109 110 111 116 117 118 119124 125 126 127 132 133 134 135 140 141142 143 148 149 150

S3/D38 9 10 11 12 13 14 15 24 2526 27 28 29 30 31 40 41 42 4344 45 46 47 56 57 58 59 60 6162 63 72 73 74 75 76 77 78 7988 89 90 91 92 93 94 95 104 105124 125 126 127 136 137 138 139 140 141142 143

S4/D4

16 17 18 19 20 21 22 23 24 2526 27 28 29 30 31 48 49 50 5152 53 54 55 56 57 58 59 60 6162 63 80 81 82 83 84 85 86 8788 89 90 91 92 93 94 95 112 113114 115 116 117 118 119 120 121 123 124125 126 127 144 145 146 147 148 149 150

S5/D532 33 34 35 36 37 38 39 40 4142 43 44 45 46 47 48 49 50 5152 53 54 55 56 57 58 59 60 6162 63 96 97 98 99 100 101 102 103104 105 106 107 108 109 110 111 112 113114 115 116 117 118 119 120 121 122 123124 125 126 127

S6/D664 65 66 67 68 69 70 71 72 7374 75 76 77 78 79 80 81 82 8384 85 86 87 88 89 90 91 92 9394 95 96 97 98 99 100 101 102 103104 105 106 107 108 109 110 111 112 113114 115 116 117 118 119 120 121 122 123124 125 126 127

S7/D7128 129 130 131 132 133 134 135 136 137138 139 140 141 142 143 144 145 146 147148 149 150

S8/D8

Table I: Hex dump of EPROMSl. No. Address (Hex) Data (Hex)1 00 002 01 013 02 024 03 035 04 046 05 057 06 068 07 079 08 0810 09 0911 0A 1012 0B 1113 0C 1214 0D 1315 0E 1416 0F 1517 10 1618 11 1719 12 1820 13 1921 14 2022 15 2123 16 2224 17 2325 18 2426 19 2527 1A 2628 1B 2729 1C 2830 1D 2931 1E 3032 1F 3133 20 3234 21 3335 22 3436 23 3537 24 3638 25 3739 26 3840 27 3941 28 4042 29 4143 2A 4244 2B 4345 2C 4446 2D 4547 2E 4648 2F 4749 30 4850 31 4951 32 5052 33 5153 34 5254 35 5355 36 5456 37 5557 38 5658 39 5759 3A 5860 3B 5961 3C 6062 3D 6163 3E 6264 3F 6365 40 6466 41 6567 42 6668 43 6769 44 6870 45 6971 46 7072 47 7173 48 7274 49 7375 4A 74

quired logic 1 at the output of gate N25 tooperate ‘b’ and ‘c’ segments of the thirddisplay digit. Remaining logic is designedto give ‘high’ output at gate N25 only whenthe 4-bit BCD data stored in EPROM fordriving the second decimal digit is otherthan 1001 (i.e. decimal 9) and second nib-ble (4-bit MSB part) of the 8-bit hexadeci-mal address is 0110 or above. In otherwords, logic output of gate N25 will be logic1 only when the age of a person to be

sponding switch (S1 through S8) at theinput to the latch is pressed.

Outputs from NAND gates N10, N12,N14 and N16 are taken out through fourtransistors (T1 to T4) to obtain the re-

Page 50: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2040

Fig. 3: Component layout for the PCB of Fig. 2

displayed is 100 or more. This will be clearfrom EPROM’s hex data stored at variousaddresses as shown in Table I. When out-

put of gate N25 is logic 1, and if the answerpush switch is pressed, both inputs to ANDgate N26 are logic 1. This results in for-

ward biasing of transistor T7 tolight up LEDs 9 and 10 to form 1 inthe 100th digit. Alternatively, onecan discard the LEDs and use thesame transistor to energisesegments ‘b’ and ‘c’ of 7-segmentdisplay DIS3. Two 7447 ICs drivethe first two displays (DIS1 andDIS2) using 8-bit BCD data storedin EPROM, as mentioned earlier.

OperationBefore starting the game, one mustpress ‘reset’ switch S9 to ensurethat all the LEDs are in off stateinitially. There are eight blocks ofnumbers displayed on the frontdisplay panel and each block isassociated with a switch and anLED indicator. First, the personwhose age has to be guessed has tothoroughly search for his/her age(in full years) in each of the eightblocks. Then the switches (S1through S8) corresponding tothose blocks in which his/her agefigures, should be pressed (indi-cated by lighting of the corre-sponding LEDs mounted next toeach of the eight switches) oneafter the other. Once all the corre-sponding switches have beenpressed, you may press the answerpushbutton (S10) to get the agedisplayed on the board.

LogicIn fact, the numbers in each blockare so arranged that by pressingthe corresponding switches, you

are generating a binary number which isequivalent to the age (in decimal number).This binary number acts as address forEPROM, and the BCD data at thatlocation, when converted to decimal, isequivalent to the hex address itself.

Single-sided PCB for the circuit shownin Fig. 1 is given in Fig. 2 while its com-ponent layout is given in Fig. 3. Pleasenote that outputs from IC5 (pins 14, 15,16 and 17) have been brought to pins 1-4of SIP ‘A’ connector those from transistors(collectors) T4-T1 have been brought toSIP ‘B’. These are to be extended to I/Psof gates N18-N32 (except N26) usingjumper wires. Correct programming of theEPROM is the key to the successful op-eration of the circuit. Hence the program-ming should be done carefully. ❑

Fig. 2: Actual-size single-sided PCB pattern suggested for the circuit of Fig. 1

Semiconductors:IC1-IC4 - 74LS00 quad 2-input

NAND gateIC5 - 2732 EPROM (4096x8) bitIC6-IC8 - 74LS20 dual 4-input

NAND gateIC9 - 74LS21 dual 4-input AND

gateIC10 - 74LS32 quad input OR

gateIC11 - 74LS08 quad 2-input AND

gateIC12, IC13 - 74LS47 BCD to 7-segment

decoder/driverIC14 - 74LS04 hex inverterT1-T6 - BC547 npn transistor

PARTS LISTResistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1-R12 - 2.2-kilo-ohmR13-R20 - 390-ohmR21 - 100-ohmR22-R27 - 1.5-kilo-ohmR28-R32 - 1-kilo-ohm

Capacitors:C1, C2 - 0.1µF ceramic disc

Miscellaneous:DIS1-DIS3 - LT542 common-anode

displayS1-S9 - Tactile microswitch (N/O)S10 - Tactile microswitch (N/C)LED1-LED10 - Red LEDs

Page 51: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 41

CHIP-CARD READER–PROGRAMMER USING IBM PC

Over two billion chip-cards are ex-pected to be in circulation world-wide by the year 2000. Chip-cards

are the future of money and business.They represent an untapped source of op-portunities for various businesses—ATM/electronic cash, credit card payments,medical/employee information manage-ment, security/loyalty checking, etc. Rec-ognising this, the banks, card companies,telecom operators, transit authorities andeven government bodies are already de-veloping chip-card projects.

A chip-card stores and processes in-formation on a chip (i.e. an integratedcircuit) embedded in the card. A mini-mum amount of hardware is needed tobuild a chip-card as shown in the blockdiagram of Fig. 1. The use of a PC is notinevitable; instead of PC, a standalonemicroprocessor system capable of input/output (I/O) operations and some memorycan be used. But PC offers user-friendlyinterface as well as opens doors to manynew applications. Other chip-card appli-cations include its use as a credit card, atelephone card, an attendance card forfactory employees and an electronic door-lock system.

There is no limit to the extent towhich the parallel port of the PC can beused as it provides ample number of TTLcompatible input and output lines. Thepresent project uses parallel port (LPT1)for conveying data to and from the chip-card in a serial fashion.Lines from two ports ofLPT1—port A with ad-dress 378H and port Bwith address 379H—areused for this purpose.

The use of serial modeof data transfer is not sur-prising because a chip-cardshould have as few elec-trical contacts as possiblefor its reliable operation.This leads to the use of se-rial E2PROM as the datastorage IC of the chip-card.

The contacts of chip-card include the powerconnections (Vcc and Gnd),data lines (one each for in-put and output) and twocontrol input lines (chip-select and clock)—all op-erating at TTL levels. Fig.2 shows the schematic dia-gram of the chip-cardreader including its con-nection to the 25-pin D

H.K. BHARUCHA & A.A. RANA

connector of the parallel port.External power supply can be derived

from a 4.5V battery as the system con-sumes a very small amount of power be-cause the contacts are made only duringthe transactions and that too for a few sec-

TABLE IInstruction set for NM93C46

Start Operation Address Data ModeBit Code1 10 A5, A4, A3, A2, A1, A0 — Read register at address A5-A01 01 A5, A4, A3, A2, A1, A0 D15..D0 Write register at address A5-A01 11 A5, A4, A3, A2, A1, A0 — Erase register at address A5-A01 00 11XXXX — Erase/write enable1 00 00XXXX — Erase/write disable1 00 10XXXX — Erase all registers1 00 01XXXX D15..D0 Write all registers

Fig. 1: Block diagram of chip-chip reader-programmer

Fig.2: Schematic circuit diagram of chip-card reader-programmer

Semiconductors:IC1 - NM93C46 1024-bit serial

E2PROMD1 - 1N4148 switching diodeLED1 - Red LED

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 220-ohm

Miscellaneous:- 5-pin SIP connector- 25-pin male/female D

connectors with ribboncable

- 4.5V DC power supplysource

PARTS LIST

Page 52: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2042

onds only. This will be clear from the factthat the circuit is assembled in two parts ontwo different PCBs. One of the PCBs hascontact plates (on the top side, i.e. compo-nent side) which are connected to the 25-pin parallel port of PC using five leads andthe external supply (4.5V) using two leads.

The actual-size PCB and the silk

screen for the same are shown in Figs 3and 4 respectively. The other part of theassembly containing the E2PROM IC andother circuit components is assembled ona separate PCB with contact plates onthe bottom side such that when this PCBis placed over the former PCB with theircontact plates properly aligned, the cir-cuit gets completed for programming/transaction processing via the PC key-

board. This second PCB (the actual chip-card) and its component layout are shownin Figs 5 and 6 respectively.

The components on chip-card com-prise only one chip (NM93C46—a 1024-bit serial E2PROM) and a few passive com-ponents per card to store the data. Thisresults in a very compact sized chip-card.If further reduction is needed, as in thecase of a mobile telephone handset, an

Fig. 4: Silk-screen overlay for PCB of Fig. 3

Fig. 7: Flow chart for the main program

Fig. 5: Actual-size chip-card PCB with contactplates (bottom view)

Fig. 6: Component layout for PCB of Fig. 5

Fig. 3: Actual-size PCB (with contact plates ontop side) which is connected to PC and externalpower supply

Page 53: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 43

SMD version ofthe chip can beused to achievethe reduction insize.

The chip-card connectorlayout used inthis project isthe same as thatof SIM card(subscriber iden-tification mod-

ule) for mobile phones. The signals out-put from the PC (chip-card reader-pro-grammer) are CS (chip select), CLK(clock) and Din (data input to chip). Theseare supplied from LPT1 port A, pins PA0,PA2 and PA1 respectively. The signal in-put to the PC and output from chip-cardis Dout (data output from chip), which isread through LPT1 port B pin PB4. R1 isthe current limiting resistor and D2 is anLED which indicates whether the chip-card and the connector have perfect con-tacts or not. D1 protects the chip-cardfrom power supply reversal in case of anoperational mistake.

The National Semiconductor’sNM93C46 device contains 1024 bits ofnon-volatile, electrically erasable memorydivided into 64x16-bit registers. It fea-tures:

1. 2V to 5.5V op-eration in read modeand 2.5 to 5.5 V in allother modes.

2. Typical activecurrent of 400 µA andstandby current of 25µA.

3. Self-timed pro-gramming cycle.

4. 40 years data re-tention.

Table I describesthe commands ac-cepted by 9346.

Timing diagramscomprising synchro-nous data timing,read, write, write en-able and write disableare shown in Fig. 12.

The se-quence forcommunica-tion of pro-grammer (PCis used asprogrammer

here) with the chip-card contain-ing NM93C46-E2PROM is as fol-lows:

• The chip is selected bymaking the chip select line high.

• A start bit ‘1’ (as MSB ofany instruction) is sent on datainput line which indicates to thechip the beginning of memory ac-cess. A bit can be sent by plac-ing data on data i/p (Din) lineand activating the clock line. Abit can be read by activatingclock line and then samplingdata placed by the chip on dataoutput (Dout) line.

• Two operation code bits areset on Din line to indicate themode (e.g. read, write, erase etc.)

• Six bits are sent on Dinline to chip, specifying the ad-dress of the location which is tobe accessed.

• If a write operation is de-sired, sixteen bits are sent on Dinline to the chip specifying thedata to be written at the loca-tion specified in the previousstep.

• If a read operation isdesired, sixteen bits are readfrom Dout line, which are thecontents of the location specified Fig. 12: Timing charts for various operations

Fig. 8: Flow chart for write-9346function

Fig. 10: Flow chart for read-9346function

Fig. 9: Flow chart forwrite_bit function

Fig. 11: Flow-chart forread_bit function

in the previous step.• The chip-select line is inactivated.A sample application of the chip-card

as a credit card is presented here. The PCemulates the chip-card reader/program-mer machine. The software for data trans-fer and user interface is written in ‘C’.The user interface portion is divided into

three parts.These are ‘De-posit’, ‘With-drawal’ and‘Verify’ modulesr e s p e c t i v e l y .When the carduser depositsmoney, he/she ispresented withe-cash in theform of a chip-card with

Page 54: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2044

certain specific balance amount. For pay-ing the bills, the user now has to simplypress the card (PCB, Fig. 5) against thecard connector (PCB, Fig. 3) of card readermachine and the amount is deducted fromthe balance. Of course, in all the transac-tions, security is incorporated in the formof a password and identification numberchecking modules.

The chip-card transaction is achieved

by simply pressing the card against thecard connector and executing an appro-priate menu item of the program. Thebit-wise operations in ‘C’ and its capabil-ity to control hardware ports directly isused to full advantage in this applica-tion. A stream of 25 bits comprising onestart-bit, 2-bit op-code, 6-bit address and16-bit data are sent in serial fashion. Thebasic building blocks are the ‘write_bit’

and ‘read_bit’ functions. These in turn areused for larger blocks viz. ‘Write_9346’and ‘Read_9346’ functions to write andread a 16-bit data word respectively to/from the specified chip-card address. Restof the work is as simple as playing a gameof blocks! The flowcharts for the programare shown in Figs 7 through 11.

/* Chipcard Reader Programmer System by H.K.BHARUCHA & A.A.RANA */#include <stdio.h>#include <conio.h>#include <graphics.h>#include <stdlib.h>#include <string.h>

#define PORTA 0x378 /* Address for LPT1 */#define PORTB 0x379#define CS 0x01#define STARTBIT 0x01#define ID_ADD 0x05#define BAL_ADD 0x0f#define ID_NO 31572#define HORI_DIR 0

/* INITIALIZATION OF THE PROTOTYPES FOR THE MAIN PROGRAM */void enable_9346(void);void write_9346(int my_add,unsigned int

my_data);void disable_9346(void);unsigned int read_9346(int my_add);void write_bit(int data);int read_bit();void deposit(void);void withdrawal(void);void data_ent();void view();

void main(void){char pwd[]=”CHIPCARD” ,pass[10],FONT_SIZE=4,st[]=”*”, ch; /* CHIPCARD is

used as pass-word */int LEFT,RIGHT,TOP,BOTTOM;int i,x,y,try=0;int driver,mode;detectgraph(&driver,&mode);initgraph(&driver,&mode,”d:\\bc\\bgi”);/* path of bgi driver may be different ondifferent systems */x=getmaxx()/2;y=getmaxy()/2;enable_9346();delay(1000);write_9346(ID_ADD,ID_NO);delay(1000);disable_9346();/* Setup & Display Opening Screen in Graphics Mode. */LEFT=x/3;RIGHT=x;TOP=y/4;BOTTOM=y-y/4;while(!kbhit()){

setbkcolor(EGA_BLACK);setcolor(EGA_WHITE);rectangle(LEFT,TOP,RIGHT,BOTTOM);moveto(LEFT*2,TOP*2);lineto(RIGHT,TOP*2);moveto(LEFT*2+10,TOP*2+10);lineto(RIGHT,TOP*2+10);settextstyle(TRIPLEX_FONT,HORI_DIR,FONT_SIZE);settextjustify(CENTER_TEXT,CENTER_TEXT);outtextxy(x,y,”CHIP CARD READER /

PROGRAMMER”);outtextxy(x,y+100,” DEVELOPED BY:”);outtextxy(x,y+150,” H.K.Bharucha &

Rana Amisha”);delay(500);setcolor(EGA_BLACK);outtextxy(x,y,“CHIP-CARD READER

PROGRAMMER”);outtextxy(x,y+100,”DEVELOPED BY:”);outtextxy(x,y+150,” H.K.Bharucha & Rana

Amisha”);delay(500);}closegraph(); / *Back to the text mode */getch();while(try!=3) /* MAIN MENU */{printf(“ \n ENTER PASSWORD:”);for (i=0;i<8;i++) { pass[i]=getch(); printf(“ %c”,st); }pass[i]=’\0'; if(strcmp(pass,pwd)!=0)

{ printf(“\n Invalid password ! ! !”); printf(“\n Try Again ! !”); try++;

}else

{ break;

} if(try==3)

{ printf(“Only three trials allowed !!\n Exiting from program ...”);

exit(1);}

}for(;;)/* Main Menu Loop */ { clrscr(); printf(“\n Main Menu”); printf(“\n *********”);

printf(“ \n 1. Viewing Card Details “); printf(“ \n 2. Data Entry”); printf(“ \n 3. Exit”); printf(“\n YOUR CHOICE :”); scanf(“ %d”,&ch); switch(ch)

{case 1: view(); break;case 2: data_ent(); break;case 3: exit(0); default: printf(“\n Invalid Choice”);}

}} /* end of main */

/*Function to write a word(16-Bit) to EEPROM*/void write_9346(int my_add,unsigned int

my_data){int i,new_add,new_data;long int j;outportb(PORTA,CS); /* Give chip select high

to write a bit */write_bit(STARTBIT); /* Give startbit to write

a bit,refer Table.1*/write_bit(0x00); /* Give mode bit 1 for write

operation */write_bit(0x01); /* Give mode bit 2 for write

operation */j=0x20;for(i=0; i<6; i++) { new_add=(my_add & j); write_bit(new_add); j=j>>1; }j=0x8000; /* j is a 16-bit masking number */for(i=0; i<16; i++) { new_data=(my_data & j); /* mask all except

current bit */ write_bit(new_data); j=j>>1; }outportb(PORTA,0x00); /* Remove chip select */}

/* FUNCTION TO WRITE SINGLE BIT IN TO SERIAL E2PROM */void write_bit(int data) { if (data==0) { data=(CS); /* Continue to give chip select */ outportb(PORTA,data); }

Software Program

Page 55: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 45

else {data=(CS | 0x02); /* Mask all bits except data */outportb(PORTA,data); } data=(data | 0x04); /* Give clock pulse */ outportb(PORTA,data); data=(data ^ 0x04); /* Remove clock pulse */ outportb(PORTA,data); data=(CS); /* Continue to give Chip Select */ outportb(PORTA,data); return; }/* FUNCTION TO READ A WORD(16-bit) FROM SERIAL EEPROM */unsigned int read_9346(int my_add){int i,j,new_add,my_bit;long int my_data;outportb(PORTA,CS); /* Give chip select to read a bit */write_bit(STARTBIT); /* Give a startbit to read data,refer Table.1 */write_bit(0x01); /* Give mode bit 1 for read operation */write_bit(0x00); /* Give mode bit 2 for read operation */j=0x20;for(i=0; i<6; i++){

new_add=(my_add & j); write_bit(new_add); j=j>>1; }

my_data=0x0000;for(i=0; i<16; i++){

my_data=my_data<<1;/* Bitwise Left shift */ my_bit=read_bit(); /* Get one bit of data */ my_data=(my_bit | my_data); /* OR it with data word */

}outportb(PORTA,0x00); / *Remove chip select */return(my_data);}

/* FUNCTION TO READ SINGLE BIT FROM SERIAL E2PROM */int read_bit (){int data,rv;data=(CS | 0x04); /* Apply clock pulse */outportb(PORTA,data);rv=inportb(PORTB); /* Read the data from input port */data = (data ^ 0x04); /* Remove the clock pulse*/outportb(PORTA,data);rv = rv & 0x10; /* Mask everything except data bit */if (rv==0){ data=0x0; }else

{ data=0x1;

}return(data);}

/* FUNCTION TO ENABLE THE CHIP FOR

WRITING REFER TABLE.1 */void enable_9346(void){outportb(PORTA,CS);write_bit(STARTBIT); /* Give startbit to enable a bit */write_bit(0x00); /* Give mode Bit 1 for write enable operation */write_bit(0x00); /* Give mode Bit 2 for write enable operation */write_bit(0x01); /* Give address bits to enable 9346 */write_bit(0x01);write_bit(0x00);write_bit(0x00);write_bit(0x00);write_bit(0x00);outportb(PORTA,0x00);}

/* TO DISABLE THE SERIAL EEPROM CHIP IC-9346 */void disable_9346(void){outportb(PORTA,CS); /* Give chip select */write_bit(STARTBIT); /* Give a startbit to disable a bit */write_bit(0x00); /* Give mode bit 1 for write disable operation */write_bit(0x00); /* Give mode bit 2 for writedisable operation */write_bit(0x00); /* Give address bits to

disable 9346 */write_bit(0x00);write_bit(0x00);write_bit(0x00);write_bit(0x00);write_bit(0x00);outportb(PORTA,0x00); /* Remove chip select*/}

/* Function for Data Entry Menu */void data_ent(){unsigned int cid_no,ch;int my_add=0x05;clrscr();printf(“ DATA ENTRY SCREEN “);cid_no= read_9346(my_add);printf(“ \n IDENTIFICATION NUMBER: %u”, cid_no);printf(“ \n 1. Deposit”);printf(“ \n 2. Withdrawals”);printf(“ \n 3. Exit”);printf(“ \n Your Choice:”);scanf(“ %d”,&ch);switch(ch){case 1: deposit();

break;case 2: withdrawal();

break;case 3: exit(0);default: printf(“ Invalid choice”);}}

void deposit(void){unsigned int dep,c_bal,bal;unsigned long int get_dep;bal=read_9346(BAL_ADD);printf(“ Enter Deposit Amount Rs. “);

scanf(“ %lu”,&get_dep);if ((get_dep+bal) < 65535)

{dep = get_dep;c_bal=( dep + bal);enable_9346();delay(1000);write_9346(BAL_ADD,c_bal);delay(1000);disable_9346();delay(1000);}

else{

printf(“Deposit Amount / Balance too Large !!”);getch();}

return;}

void withdrawal(void){unsigned int bal,c_bal,with;unsigned long int get_with;printf(“ Enter Withdrawal Amount Rs. “);scanf(“ %lu”,&get_with);if (get_with < 65535)

{with = get_with;bal=read_9346(BAL_ADD);if( with > bal )

{ printf(“ \n The Withdrawal Amount Exceeds Balance Amount “);

printf(“ \n YOUR BALANCE IS Rs. %u”,bal);

}else

{c_bal= (bal - with );enable_9346();delay(1000);

write_9346(BAL_ADD,c_bal);delay(1000);disable_9346();delay(1000);

}}

else{

printf(“Withdrawal Amount too Large !!”); getch();

}printf(“ \n Press any key to continue”);getch();return;}/* Function for viewing/verifying Balance */void view(){unsigned int cid_no, bal_amt;clrscr();printf(“\n\n VIEWING SCREEN \n\n” );cid_no=read_9346(ID_ADD);printf(“ Identification Number: %u”, cid_no);bal_amt=read_9346(BAL_ADD);printf(“ \n YOUR BALANCE IS Rs. %u”, bal_amt);printf(“ \n Press any key to return to Main Menu”);getch();return;}

Page 56: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2046

MORSE ENCODER

A lthough better modes of com-munication such as voicecommunication are available,

Morse code is still being used universallyfor land and off-shore wirelesscommunications by professionals andamateurs alike. Its main advantages are:

1. The ability to use higher-powertransmitters for long-range communica-tion as the modulation percentage can goup to 100 per cent.

2. The regional accent and pronuncia-tion does not affect the faithful transmis-sion of a message using Morse code.

All defence forces, police, railways andtelecom organisations use Morse code forcommunication on a regular basis. Thus,the learning of Morse code forms an inte-gral part of the wireless communicationsystem.

DescriptionThe circuit presented here is usedfor learning and practising the receptionof Morse code. It converts each characterinto dots (pronounced as ‘di’ or ‘dit’) anddashes (pronounced as ‘dah’) correspond-ing to Morse code. This circuit can bedivided into two sections, viz, the key-board and coder sections.

Keyboardsection: Herematrix key-board is usedin scanningmode. Thescanning isdone using a3-line to 8-linedecoder 74LS138 (IC3)and a dual4-bit multi-plexer CD4052 (IC4).The binarynumber re-quired forscanning isprovided by a12-bit binarycounter CD4040 (IC2)and the clockpulses for thesame are ob-tained fromtimer 555(IC1), which isused as anastable multivibrator. Withthe timingcomponentsemployed asshown inFig.1, the fre-quency ofscanning isaround 2 kHz.

When aswitch isclosed at aparticular bi-nary numberoutput fromIC2, outputpin 13 of mul-tiplexer IC4

JUNOMON ABRAHAM

Fig. 1: Schematic circuit diagram of morse encoder

TABLE IMorse Code

Letters NumbersA . – K – . – U . . – 1 . – – – –B – . . . L . – . . V . . . – 2 . . – – –C – . – . M – – W . – – 3 . . . – –D – . . N – . X – . . – 4 . . . . –E . O – – – Y – . – – 5 . . . . .F . . – . P . – – . Z – – . . 6 – . . . .G – – . Q – – . – 7 – – . . .H . . . . R . – . 8 – – – . .I . . S . . . 9 – – – – .J . – – – T – 0 – – – – –

Some punctuation signs

Full stop . – . – . –Coma – – . . – –Colon – – – . . .Interrogation mark . . – – . .

+

Page 57: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 47

goes low and this resets the 555 timer.Thus, no further clock is supplied byIC1, and therefore IC2 CD4040 remainslatched in its existing state till thepressed key-switch is released. A uniquebinary number is associated with thiskey (switch) such that it activates a spe-cific column and row when this switch isclosed. Similarly, with each keyboardswitch, a different unique binary numberor row and column combination is asso-ciated. The same binary number is madeavailable to the coding section.

Coding section: The heart of thecoding section is EPROM 27C32 (IC6). Itcontains coded form of each character.The memory locations (addresses) andthe data stored against each address aregiven in Table II. Please note that an ‘X’,in the table means ‘do not care,’ i.e. thecontents could be any hex digit. Theaddressing of this EPROM is done bytwo ICs, one of which is 14-stage binarycounter and oscillator CD4060 (IC5). It

provides five lower address bits whilethe next five address bits are providedby CD4040 (IC2); the latter part ofaddress is considered the page address.The remaining address bits are grounded.The data are stored page-wise in theEPROM, with each page consisting of 32bytes. Thus, while the pages are ad-dressed by IC2, each of the 32 bytes ofevery page is addressed by IC5 in acyclic fashion as the oscillator formingintegral part of this IC functions as afree-running oscillator.

When a keyboard switch is closed, theoutput of IC2 is stable at a particularbinary value and CE pin 18 of EPROM,connected to output pin 13 of IC4, goeslow. This binary number is the addressof the page where the Morse code datafor the particular character is stored. Onlytwo data bits of the memory are used foreach character. With function switch S21in position 1, only bits D0 and D1 areaccessed while in position 2 of switch S21,

Fig. 2: Actual-size, single-sided PCB for the circuit

Fig. 3: Component layout for the PCB

PARTS LISTSemiconductors:IC1 - NE555 timerIC2 - CD4040, 12-bit binary

counterIC3 - 74LS138, 3-line to 8-line

decoderIC4 - CD4052, dual 4-bit multi-

plexerIC5 - CD4060, 14-stage binary

counter and oscillatorIC6 - 27C32, 4096x8 bit EPROMIC7 - 7805, 5-volt regulatorT1 - BC547, npn transistor

Resistors (all ¼-watt, ± 5% carbon, unlessstated otherwise):R1 - 6.8-kilo-ohmR2 - 15-kilo-ohmR3-R6 - 2.2-kilo-ohmR7, R10 - 4.7 kilo-ohmR8 - 1-mega-ohmR9, R11 - 10-kilo-ohmVR1 - 100-kilo-ohm variable (linear)VR2 - 47-kilo-ohm variable (log)Capacitors:C1 - 0.02µF ceramic discC2, C3 - 0.01µF ceramic discC4 - 0.1µF ceramic disc

Miscellaneous:S1-S20 - SPST push-to-on keyboard/

tactile switchS21 - DPDT switch

- Piezo buzzer

data bits D2 and D3 only are accessed.Only data bits D0 and D2 are used forproducing audible note whereas bits D1and D3 are used for resetting the bytecounter IC5 in positions 1 and 2 respec-tively of the function switch S21. Position1 of the function switch selects the firstcharacter as annotated at each of the key-board switch while position 2 selects thesecond series of characters as shown af-ter the oblique line at each switch. Thus,operation of the function switch is equiva-lent to shift-key operation in a typewriteror computer key-board.

A dot is represented by a single‘high’ (logic 1) bit and dash is representedby high bit in three sequential addresslocations (in same data-bit position),while a space between two elements isequal to a single low (logic 0) bit. Thesebits are stored in adjacent memorylocations in a specified order. When byteaddress is increased, each data is outputone by one. A high bit in D0/D2 positionproduces sound and thus converts a char-acter into audible Morse code. After thelast data, a reset bit is inserted atD1/D3 positions. When this memorylocation is accessed, the counter auto-matically resets and repeats the character

Page 58: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2048

Address Data Address Data Address Data Address DataAddress Data Address Data Address DataA/U

000 X5 06B X0 OCE X4 127 X1 18C X4 1E5 X4 22C X4001 X0 06C X0 0CF X4 128 X5 18D X0 1E6 X5 22D X4002 X5 06D X0 0D0 X4 129 X4 18E X0 1E7 X1 22E X4003 X1 06E X8 0D1 X0 12A X5 18F X0 1E8 X5 22F X0004 X5 E/Y 0D2 X0 12B X1 190 X8 1E9 X4 230 X4005 X4 080 X5 0D3 X0 12C X1 N/8 1EA X5 231 X4006 X4 081 X4 0D4 X8 12D X0 1A0 X5 1EB X0 232 X4007 X0 082 X4 H/2 12E X8 1A1 X5 1EC X4 233 X0008 X2 083 X0 0E0 X5 12F X0 1A2 X5 1ED X4 234 X0009 X0 084 X6 0E1 X0 130 X2 1A3 X0 1EE X6 235 X000A X8 085 X0 0E2 X5 K/5 1A4 X5 1EF X0 236 X8

B/V 086 X4 0E3 X0 140 X5 1A5 X4 1F0 X4 S/:020 X5 087 X4 0E4 X5 141 X1 1A6 X4 1F1 X4 240 X5021 X1 088 X4 0E5 X4 142 X5 1A7 X0 1F2 X4 241 X4022 X5 089 X0 0E6 X5 143 X0 1A8 X6 1F3 X0 242 X5023 X0 08A X4 0E7 X0 144 X5 1A9 X4 1F4 X0 243 X0024 X5 08B X4 0E8 X4 145 X0 1AA X4 1F5 X0 244 X5025 X0 08C X4 0E9 X4 146 X5 1AB X0 1F6 X8 245 X4026 X5 08D X0 0EA X6 147 X1 1AC X4 Q/. 246 X4027 X4 08E X0 0EB X0 148 X5 1AD X0 200 X5 247 X0028 X5 08F X0 0EC X4 149 X0 1AE X4 201 X1 248 X6029 X0 090 X8 0ED X4 14A X0 1AF X0 202 X5 249 X402A X0 F/Z 0EE X4 14B X0 1B0 X0 203 X4 24A X402B X0 0A0 X5 0EF X0 14C XA 1B1 X0 204 X5 24B X002C XA 0A1 X4 0F0 X0 L/6 1B2 X8 205 X1 24C X4

C/W 0A2 X5 0F1 X0 160 X5 O/9 206 X5 24D X0040 X5 0A3 X0 0F2 X8 161 X4 1C0 X5 207 X0 24E X4041 X1 0A4 X5 I/3 162 X5 1C1 X5 208 X5 24F X0042 X5 0A5 X5 100 X5 163 X1 1C2 X5 209 X4 250 X4043 X4 0A6 X5 101 X0 164 X5 1C3 X0 20A X5 251 X0044 X5 0A7 X0 102 X5 165 X0 1C4 X5 20B X1 252 X0045 X0 0A8 X5 103 X0 166 X5 1C5 X5 20C X5 253 X0046 X5 0A9 X0 104 X4 167 X0 1C6 X5 20D X0 254 X8047 X5 0AA X4 105 X0 168 X5 1C7 X0 20E X4 T/*048 X5 0AB X0 106 X6 169 X0 1C8 X5 20F X4 260 X5049 X0 0AC X2 107 X4 16A X4 1C9 X5 210 X6 261 X104A X1 0AD X0 108 X4 16B X0 1CA X5 211 X0 262 X504B X0 0AE X8 109 X0 16C X2 1CB X0 212 X0 263 X004C X8 G/1 10A X4 16D X0 1CC X4 213 X0 264 X404D X0 0C0 X5 10B X4 16E X8 1CD X4 214 X8 265 X404E X2 0C1 X1 10C X4 M/7 1CE X6 R/, 266 X6

D/X 0C2 X5 10D X0 180 X5 1CF X0 220 X5 267 X0060 X5 0C3 X4 10E X0 181 X5 1D0 X4 221 X4 268 X4061 X5 0C4 X5 10F X0 182 X5 1D1 X0 222 X5 269 X4062 X5 0C5 X1 110 X8 183 X0 1D2 X0 223 X1 26A X4063 X0 0C6 X5 J/4 184 X5 1D3 X0 224 X5 26B X0064 X5 0C7 X4 120 X5 185 X5 1D4 X8 225 X4 26C X4065 X0 0C8 X5 121 X0 186 X5 P/0 226 X5 26D X0066 X5 0C9 X0 122 X5 187 X0 1E0 X5 227 X0 26E X4067 X0 0CA X4 123 X1 188 X4 1E1 X4 228 X4 26F X0068 X4 0CB X4 124 X5 189 X0 1E2 X5 229 X0 270 X0069 X4 0CC X6 125 X0 18A X6 1E3 X1 22A X6 271 X006A X6 0CD X0 126 X5 18B X0 1E4 X5 22B X0 272 X8

TABLE II: Hex Contents of EPROM 27C32

again. This will continue until the key isopen, i.e. until another key is pressed.The volume can be controlled by varyingvolume control VR2. The Morse code cor-

responding to various letters of theEnglish alphabets, numerals and somepunctuation marks used in this project(keyboard) is given in Table I.

The actual-size, single-sided PCB forthe circuit is given in Fig. 2 and its com-ponent layout is shown in Fig. 3.

Page 59: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 49

LONG-RANGEREMOTE CONTROL

The circuit presented here can beused to remotely control a numberof electrical or electronic gadgets

connected to it. Unlike IR remote control,this circuit employs FM transmission andreception, and hence it can be used forcomparatively longer range. Any gadgetcan be switched on/off by keying thenumber allocated to it. The keyboard usedwith the transmitter is similar to thoseused in basic version of DTMF telephones.The system is thus composed of two sub-systems which are described below.

DescriptionCode generator and transmitter. Thecode generator part is shown in Fig. 1. It isa standard DTMF generator built aroundIC1, UM91215B. IC1 generates the DTMFsignal corresponding to the numberentered from the keyboard. The signal thusgenerated is fed to an FM transmitter. Asa number of FM transmitter circuits (forexample, Quality FM Transmitter byPradeep G. published in April ’98 (repro-duced in Electronics Project Vol. 19) havebeen published in EFY earlier, which canbe suitably adopted. The circuit of thetransmitter is therefore not included here.The operating range of the present systemwould, however, depend on the range ofthe transmitter.

Receiver and decoder. The circuitdiagram of receiver and decoder is shownin Fig. 3. The receiver being a common FMreceiver kit readily available in the mar-ket, no circuit is given for it either.

The output of the FM receiver, whichis a replica of the DTMF signal keyed inat the remote transmitter end, is fed toDTMF decoder IC 8870P (IC2) whichgives the binary output corresponding tothe signal received from the transmitter.

This 4-bit binary number is fed to IC3,which is a 4-line to16-line decoder IC. De-pending on the binary input, one of the

BHASKAR BANERJEE

outputs of IC3 will go high. A predeter-mined sequential output from IC3 acti-vates IC4 via two flip-flops IC5(a) and

Fig. 1: Schematic diagram of DTMF coder-transmitter

Fig. 2: Actual-size PCB layout for circuits in Figs 1 and 3

Page 60: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2050

IC5(b) connected to its outputs. Two ex-tra outputs of IC3 are used for activat-ing/deactivating IC4. The outputs fromIC4 are used to changeover the state oftoggle flip-flops, which in turn control thedevices using suitable interface (relaydriver/optocoupler etc) circuits.

Only two toggle flip-flops wiring us-ing IC6 (CD4013) is shown here in Fig. 3.IC6 circuit should be repeated for otherpairs of Q outputs of IC4. The presentcircuit can control up to 10 devices usingoutputs of IC4.

OperationWith the present circuit up to 100 differ-ent gadgets can be controlled (switched onand switched off). All the 100 channels aregrouped in 10x10 matrix format. That is,there are 10 locations, with each locationhaving 10 outputs to control up to 10 gadg-ets connected to it.

To understand the operation, assumethat we want to switch on gadget num-bered 5 at location 3. For this operationthe particular numbers to be entered in

the sequence are; 3 #5 *, in that order. Thebuttons marked # and*, generally availableon all the keyboards,are used to activateand then deactivate aparticular location.

On receiving thebinary code for deci-mal number 3, pin 6(Q3) of IC3 of decodercircuit will go high,making the set input(pin 8) of IC5(a) high.This forces pin 13 (Qoutput) of this flip-flop to go high,thereby making pin 5(data input) of IC 5(b) also high.

Then on receivingthe next digit # (cor-responding to decimaldigit 12), the D flip-flop configuredaround IC5(b) isclocked with the help

of Q12 output (at pin 19) of IC3 and inturn IC5(b) is activated and its Q outputat pin 2 enables IC4 by taking its pin 15active low.

The next keyed in digit 5 will makethe corresponding output (Q5) of IC4 (pin4) to go high. This positive going pulsecan then be used to trigger a CD4013 ICconfigured as toggle flip-flop (IC6). Thegadget to be controlled is connected tothe flip-flop via relay driver, optocoupleretc, as required. Receipt of the next input* (corresponding to decimal digit 11) willthen make Q11 output (pin 20) of IC3high to reset IC4 and thereby disable IC4.This will not, however, change the stateof the gadget under control. Thus when-ever * button on the keypad is pressed(transmitted), all the locations get reset/deactivated but the existing latched stateof the devices (‘on’ or ‘off’) at all the loca-tions remains unaffected.

To switch on gadgets at other loca-tions the numbers on the keypad shouldbe pressed (transmitted) as per the se-quence mentioned earlier. Now to switchoff the gadget, repeat the above switchingprocess, i.e. transmit 3 # 5 * for switchingoff (in fact, toggling the existing state)device/gadget 5 at location 3.

The sequence should be strictly fol-lowed, otherwise false switching may oc-cur. The schematic diagram in Fig. 3 shows

Fig. 4: Component layout for the PCB

Fig. 3: Schematic diagram of DTMF receiver/decoder and control circuits

Page 61: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 51

Semiconductors:IC1 - UM91215B DTMF dailerIC2 - CM8870P DTMF decoderIC3-IC4 - CD4067 DemultiplexerIC5-IC6 - CD4013 Dual D Flip-FlapD1 - 3.3V, zener diodeLED1 - 5mm Red LED

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 150 ohmR2, R6 - 1 kilo-ohmR3, R7-R11 - 10 kilo-ohmR4 - 120 kilo-ohmR5 - 220 kilo-ohm

Capacitors:C1 - 100µF, 25V electrolyticC2, C3 - 0.1µF, ceramic discC4 - 1000µF, 25V electrolytic

Miscellaneous:S1 - On/Off switch

- KeyboardXtal-1, Xtal-2 - 3.579542 MHz crystal

- +9V DC power supply orbattery

- Tx Antenna- Flexible wires

PARTS LIST

Readers Comments:❑ Is it possible to use IR source and IRreciver to operate the circuit in IR mode?Can the range of the circuit be increasedup to 10 metres?

the wiring for location 3. The circuit inFig. 3 needs be repeated for each locationwith only a slight change pertaining to theoutput pin of IC3, which is to be connectedto ‘set’ pin 8 of IC5(a). For locations 1through 10, IC3 pins 8, 7, 6, 5, 4, 3, 23, 22and 21 respectively should be connected topin 8 of IC5(a). If two units are located inclose proximity to each other, then a com-mon FM receiver may be used.

Please remember that the binaryequivalent code for ‘0’ in the keypad equalsdecimal 10 and as such ‘0’ on the keypadmay be marked as ‘10’. For the same rea-son, Q0 (pin 9) output of IC3 and IC4should never be used; instead Q10 (pin21) representing location/device 10 maybe used.

Construction and TestingThe circuit can be built on a veroboard.However, an actual-size, single-sided PCBcomprising circuits in Figs 1 and 3, ex-

Dilip [email protected]

The author, Bhaskar Banerjee, replies:IR transmitter and receiver may be

used in place of FM. For this, please refer

to the project ‘DTMF Remote SwitchingBoard’ by D. Sinha elsewhere in thisvolume. To increase the range, two or threeIR LEDs may be used in series. Lens/reflector may also be used. ❑

cept the FM transmitter and receivermodules, is shown in Fig. 2. The compo-nent layout is shown in Fig. 4. Circuit ofIC6 has been repeated on the PCB toenable control of up to 4 devices.

The DTMF generator and FM trans-mitter should be housed in metal box withthe keyboard suitably placed. Be carefulto watch the supply voltage of FM receivermodule if it shares a common supply withthe system.

After finishing the construction, switchon the transmitter and connect a smallspeaker or amplifier to the output of FMreceiver. Then press any key on thekeyboard and at the same time tune theFM receiver until a clear tone is heard andthe ‘signal received’ LED starts glowing.Always tune the FM receiver where thereis no signal from any radio centre. If theoutput of the FM receiver is too low, a low-power, compact amplifier may have to beused between receiver and decoder. Thesystem is now ready for use. ❑

Page 62: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2052

FAST CHARGER FORINVERTER BATTERIES

Nowadays inverters using tubularor automobile lead-acid batterieshave becomes more popular be-

cause of their higher Ah (ampere-hour)rating and longer life. However, torecharge these types of batteries, veryhigh charging current is required. Major-ity of inverter manufacturers use chargertransformers capable of charging at themaximum current rating of 10 amperes.

In most cities, the electricity board/authorities do not provide mains supplyfor even 20 hours in a day. The condition

is far worse in rural areas. For a fullydischarged battery of 150 Ah or highercapacity you may be able to just replen-ish the charge if you use 20-hour rate(i.e. 1/20th of the Ah capacity of the bat-tery). But for this you must have assuredmains supply for 20 hours per day, whichis not always possible. Hence 20-hourcharging rate is not quite practical, andthus charging at 10-hour rate may bemore appropriate to replenish the chargein reasonable time.

Batteries need charging in two steps,i.e. float/normalmode (10-hourto 20-hour rate)and tricklecharging mode.If normal modeis able to charge

D. DINESH

the battery fully, fairly quickly, the chargerreverts to trickle mode of charging andmaintains the battery in fully charged con-dition by replenishing the lost charge.

Over-discharged batteries should not becharged using the normal charging rate.Their output voltage should first be broughtup to a safe level using a much lower charg-ing current, and thereafter it could becharged using the normal charging current.The charger should changeover to tricklecharging mode when voltage across its cellsreaches its maximum permissible value.

There are quite a few charging methodsused in different chargers, but here a simpleconstant voltage with sine phase anglecontrol is employed, without sacrificingquality and performance. Battery chargershould have requisite built-in protectionsso that it is not only capable of protecting the

battery but is also capable ofprotecting itself.

The charger circuitpresented here is meant forcharging 24-volt batteries atnormal/float rate of 20amperes (i.e. 10-hour rate for200Ah capacity batteries).This charger can easily bemodified to cover batteries ofother voltages and ampere-hour ratings. The suitablecomponent selection forbatteries of other voltages areshown in Table I.

This charger incorporatesthe following protections andindicators:

1. Fuse protection onmains side.

2. Power factor improv-ing capacitor at mains side.

3. Moulded case circuitbreaker (MCB) on battery side.Fig. 1: Schematic diagram of fast battery charger

TABLE IComponent / Battery Voltage 6V 12V 24VTransformer X1 (Sec.) 7.5 15 30Relay RL1 6V, 100-ohm 12V, 200-ohm 24V, 200-ohmResistors (R7, R8) 680-ohm 1k 2.2kZeners (D4, D5) 3.3V 9.1V 17VResistor (R6) * May be test selected between 330-ohm and 2k.

Page 63: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 53

standard phase angle controlcircuit is used along with diac D7.The triac gate trigger signal isderived from MT2 terminal of thetriac, via a variable phase delaynetwork comprising preset VR3,LDR (illuminated by LED3), andcombination of resistor R4 and ca-pacitor C2. Capacitor C1(0.047µF, 400V) decreaseshysterisis effect while resistor R5in combination with capacitor C3serves as a snubber networkwhich protects the triac. Lightoutput of LED3 is coupled to LDR,which thus controls gate currentinto the triac according to batteryvoltage level. Preset VR3 (470k)is used to limit the maximumfiring angle, i.e. the minimumcharging current.

Transistors T1 and T2 andcomponents wired around themare used to control float chargingcurrent in the vicinity of higherand lower battery voltage limits. Forexample, when the voltage exceeds thehigher limit, zener D4 conducts and for-ward biases transistor T1. As a result col-lector of transistor T1 reaches near groundpotential to cut-off transistor T2, therebyswithing off LED3 and thus reducing theconduction period of triac T3 to minimum(to trickle charge level). And when thevoltage across battery drops below thethreshold value (higher limit), the

conduction period of triac in-creases and vice vesa.

When the voltage at wiperof preset VR1 is below 17 volts,transistor T1 is cut off and theillumination of LED3 is solelydetermined by preset VR2 whichnow controls the current throughtransistor T2 as well as LED3.At very low battery voltage val-ues, the charging current willreduce to a value much belowthe normal/float current valueas the battery now requires tobe charged at lower chargingcurrent and the same could beachieved by adjusting presetVR2 and VR3. The LED andLDR combination should behoused in a small sealed enclo-sure to prevent light from otherexternal sources from affectingthe operation of the charger.

Although remainder of thecircuit appears to be self-ex-

planatory, a brief explanation of the sameis included. Relay RL1 contacts in Fig. 1are shown in their de-energised state.Once battery is connected to the circuitwith proper polarity (as shown in thecircuit), the bulb will briefly glow (withlow intensity), provided triac T3 is con-ducting (under conditions as explained inpreceding paragraph) and relay RL1 willenergise to changeover its contacts suchthat battery is directly connected to thebridge rectifier output.

When the battery is connected withreverse polarity, LED1 (red LED) willlight up to warn you of wrong connection.With reverse connection of battery, LED3is off and hence triac is also notconducting, and thus there is no rectifieroutput. In case of any short across bat-tery, 25-ampere MCB will trip and iso-late the rectifier from the battery.

Construction and TestingTransformers X1 is a normal step-downtransformer capable of delivering 20 am-peres of secondary current at 30 volts.One may have additional taps for 32Vand 34V on the secondary side to caterfor low mains voltage. [Note: For thoseinterested in winding their own trans-former, here are the required details: Core:CRGO No. 7; stack: 2.5 inch or 6.3 cms;primary: 368 turns of 19 SWG; secondary48 turns for 30V AC, 51.5 turns for 32VAC and 54.5 turns for 34V AC using

Fig. 2: Outline of a modular bridge rectifier

4. Reverse battery polarity protection/indicator.

5. Provision for slow charging of over-discharged batteries.

6. Automatic change-over from normalto trickle mode of operation and vice versa.

7. Charging rate ammeter (optional).

DescriptionMains AC input to the circuit, as shownin Fig. 1, is connected through on/offswitch S1 and 3-ampere fuse F1. How-ever, no current can flow through trans-former X1 unless triac T3 is conducting.Thus we may say that charging current iscontrolled by triac T3 in series with theprimary of transformer X1. This triacshould be mounted on a small heat-sink.

To control firing angle of the triac,

Fig. 4: Component layout for the PCB

Fig. 3: Actual-size single-sided PCB layout for the circuit in Fig. 1

Fig. 5: Proposed enclosure and component mountinglayout plan for the battery charger

Page 64: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2054

12SWG wire.]Care should be taken while connect-

ing the wires to ensure that all connec-tions are firm. Weaker contacts causeheavy voltage drop and heat dissipationsince heavy current flows through them.

Bridge rectifier used should be of goodquality and capable of delivering at leasttwice the maximum charging current, andit should be used with adequate heat-sink.Modular bridge rectifiers of 50-amperecurrent rating available in the marketmay be used. Outline of a typical bridgerectifier of this type is shown in Fig. 2.Its metallic body serves as heat-sink andthe bridge rectifier can be secured tometal chassis with nut and bolt throughits centre hole.

The bulb having 24V, 3A rating is anautomobile bulb used here to limit charg-ing current when relay contacts are open.Capacitor C4 (10µF, 400V AC) is usedacross mains primary winding, which notonly improves power factor but also im-proves RF suppression.

Circuit may be easily assembled on apiece of general-purpose PCB. However,actual-size single-sided PCB layout andits component layout are shown in Figs 3and 4 respectively.

Care should be taken while adjusting470k preset VR3 as it carries live mains

voltages. Suitable enclosure with mount-ing layout plan for components is shownin Fig. 5. Mount all hardware one by one.LED holders, SPST switch, ammeter goon front panel, and MCB, fuses, batteryterminal and mains tag block on rear panel.Please note that all components in bottomhalf section of Fig. 1 are mounted on thechassis of the charger as shown in Fig. 5,and hence PCB size is small.

Before coupling the LED to LDR in asuitable enclosure, presets VR1 and VR2are to be adjusted as follows using anyexternal variable DC power supply sourcewithout connecting battery:

1. Disconnect collector of T1 (BC148).2. Connect variable power supply

across battery terminals.3. Adjust power supply for 21 volts

and adjust preset VR2 such that LED3just begins to light up.

4. Now connect collector of transistorT1 to base of transistor T2 and adjust DCsupply to 27 volts. Adjust preset VR1 suchthat LED begins to just light up.

Remove variable DC power supply andconnect a fully charged battery across bat-tery terminals.

The LED and LDR should be housedin a properly sealed enclosure to avoidlight from external sources impinging onthe LDR. Connect mains input after keep-

Fig. 6: Charging current vs battery terminal voltage for 24V lead-acid battery

Semiconductors:T1, T2 - BC548 npn transistorT3 - BT137 triacD1, D2, D6 - 1N4001 rectifier diodeD3 - 1N5401 rectifier diodeBR1 - 50A bridge rectifierD4, D5 - 17V,1/2W zenerD7 - DB-3 or equivalent diac

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1,R2 - 1-kilo-ohmR3,R9 - 470-ohmR4 - 10-kilo-ohmR5 - 22-ohm, 0.5WR6 - 330-ohmR7, R8 - 2.2-kilo-ohm

Capacitors:C1 - 0.047µF, 400V polyesterC2, C3 - 0.1µF, 400V polyesterC4 - 10µF, 400VAC (paper)

(motor start capacitor)

Miscellaneous:LED1 - Green LEDLED2 - Yellow LEDLED3 - Red LEDRL1 - Relay 24V, 200-ohmF1 - Fuse cartridge, 3AX1 - 230V AC primary to 34V,

20A secondary trans-former. With tapping for30 and 32V AC

- MCB for 25A- Bulb 24V, 3A (72W)- Light dependant resistor

(LDR)- Ammeter, 30A FSD- Chassis/cabinet

PARTS LIST

ing preset VR3 (470k) at the high- estresistance position. Adjust it for tric- klecharge level at 28 volts or near about(whatever is the terminal voltage of thefully charged battery). Repeat the setti-ngs 4 to 5 times, if necessary. Now thischarger is ready for normal operation.

A diagram showing charging currentvs battery terminal voltage for a typical24V lead-acid battery is shown in Fig. 6.The dotted lines in figure indicate theminimum and the maximum batteryterminal voltages within the usable range(off-charge), while the solid lines indicatethe terminal voltage with battery still onfloat charge.

Readers comments:❑ Please clarify the following:

1. How is this circuit a constant volt-age charger? Can it also be made con-stant current charger?

2. Why is 24V relay RL1 used? If adeep-discharged battery (17V terminalvoltage) is connected, will it not chatteror even fail to operate?

3. What for 24V bulb is used?

Chandrakant R. JoshiKolhapur

The author, D. Dinesh, replies:1. The charging current is controlled

by varying the firing angle of the triac inaccordance with the battery’s terminalvoltage, keeping the charging voltage con-stant. Converting the circuit into constant-voltage and constant-current charger isnot feasible.

2. Relay RL1 is used for protectionof battery as well as charger. If adeep-discharged battery is connected,a limited current flows through 24V,3A bulb until the relay energises.Once the relay energises, a normalcharging current flows through thebattery.

3. Use of 24V, 3A bulb is explainedabove. ❑

Page 65: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 55

Z-80 BASED DEDICATEDPROGRAMMER CUM

EMULATOR

Every microprocessor or micro con-troller based project needs anEPROM (or EEPROM) for its pro-

gram memory. Many day-to-day appli-ances like photocopier, film-developingmachine, printer, etc use EPROMs. PCsalso need EPROMs for their motherboardand various controller cards. Present-dayEPROMs have much larger memory. To-day it is possible to have 1 MB of pro-grammable memory in a single IC (27800).The full BASIC interpreter of a basiccomputer (refer EFY Dec. 1990 issue,reproduced in Electronics Project Vol. 11)can go into one EPROM of 16k.

Software for typicalprojects and robotic kitsalso need EPROMs to beprogrammed.

The EEPROM (electri-cally erasable PROM), inaddition to this family, canbe programmed at anyrandom location andoperates on a voltage ofonly +5 volts. One can elec-trically erase andreprogram any memorycell in such an EEPROM.The 2864A is a popular 8kdevice of this type.

Earlier machines suchas a film-processing ma-chine used to have fourEPROMs (2716) of 2keach. Now we canconveniently put all thatcode in one 2764 EPROM.The flexibility of a copieris an advantage in that

one can put the contents of one or moreearlier EPROMs into one of the fasterand denser EPROMs of today. Past tech-nology needed 25V for programming, aswith the 2716 (2k) EPROM, but n ow mostEPROMs are programmable at 12.5V. So,the risk is less.

The majority of today’s projects usethe 8k or 16k EPROMs, even though thecode programmed therein may not exceed2k. These 8k and higher size devices are28-pin types, while the 2k (2716) haveonly 24 pins. The numbering of the pinsof these devices is shown in Fig. 1, indi-cating that the extra four pins are accom-

K. PADMANABHAN & S. ANANTHI

modating the higher address lines toattain increased memory size.

DescriptionA dedicated EPROM programmer-cum-emulator circuit is presented here. It isconvenient for programming small codeapplications by entering data and burn-ing it into the EPROM or EEPROM. Thedata can be first entered into the RAM ofthe EPROM programmer and later trans-ferred to program the EPROM. Addition-ally, there is an application for using thisunit to emulate an EPROM in the target

Fig. 1: The common pin numbering method followed for accommodating 24-28-pin ICs in 28-pin DIP sockets.

Page 66: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2056

Fig.

2: S

chem

atic

dia

gram

of t

he m

ain

boar

d of

Z-8

0 ba

sed

EPRO

M p

rogr

amm

er

Page 67: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 57

board, whose program is being checkedduring development stage. This circuit hasthe following features:

1. It can be used to program the fol-lowing devices: 2716, 2732, 2764, 27128,27256 and 2864 EEPROM.

2. It can copy from any of the follow-ing EPROMs (source) into any otherEPROM (destination): 2716, 2732, 2532,2764, 27128, 27256.

3. It can emulate an EPROM (a 2k,2716) in a development board via a DIPjumper.

The circuit comprises a hexadecimalkeyboard and a 6-digit LED display. Thekeyboard has 20 keys and a reset key.The 20 keys include 16 keys for hexadeci-mal data entry and four command keys.A six-digit LED display is provided to dis-

play the address and data, four for theaddress field and two for the data field—all in hex format.

The system uses a Z-80 microproces-sor chip. The principle of programmingan EPROM using Z-80 is quite simple,and you do not require any additional pe-ripheral chip such as PIA for accessingthe EPROM address or data pins. In otherwords, the EPROM programming socketis like any other RAM chip to the Z-80microprocessor. The only difference is thatthe Z-80 is made to wait for the durationof the programming pulse, during whichperiod the address and data lines signalsare stable and the programming pulse(width = 50 ms) is applied, which causesthe EPROM device to be programmedinsitu. The EPROM can also be read after

Fig. 3: Schematic diagram of circuit on auxilary board

programming and contents of addressedlocation can be verified. In fact, the soft-ware programming routine checks theprogrammed data in each location beforeprogramming the next location so thatspurious programming is avoided. The fullsoftware is given for programming orcopying from a pre-programmed EPROM.

An emulate or program switch S4 (upduring program mode and down duringemulate mode) puts the Z-80 in hold stateduring emulation. The contents of a RAM(a 6116), loaded previously with the de-velopment system program, are used totransmit the information to the EPROMsocket on the development board via aDIP jumper. This DIP jumper plugs on aseparate socket in the Z-80 main PC boardand it can be unplugged when the system

Page 68: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2058

is not being used as an emulator but onlyas a programmer.

The CircuitThe entire unit consists of two parts. Oneis the main board comprising the Z-80microprocessor, the sockets for the follow-ing EPROMs: (i) copy master, (ii) theEPROM to be programmed, (iii) the socketfor emulator DIP plug (double-ended) andfew other ICs/components as shown in Fig.2. The other board, which is the input/output (I/O) board, comprises the keyswitches and the LED displays, etc, asshown in Fig. 3. The two boards are con-nected together using FRC connectorslinked by a ribbon cable.

The signals coming out of the Z-80board are the data bus (D0 to D7),the read (RD) and write (WR) signalsand address decoded port select signals(PORT 1 through PORT 3) which are forthe keyboard and display ports. TheI/O board consists of two numbers of out-put ports, each made up of a pair of 7475ICs. The segment driver port is desig-nated as I/O port No. 2 and the digit-driver port as port No.3. The input port,which is acquiring the key-code of thekey-pressed, is designated as read portNo.1.

The two pairs of 7475 output portsare connected to the LED display via seg-ment and digit driver ICs ULN 2003(IC17) and 74LS245 (IC18) respectively.The segment driver IC17 (ULN2003) sinksthe current from the LED segments andits input is the latched set of data valuesfrom the output pins of the IC12 and IC1374LS75. The other 7475 pair, comprisingICs 14 and 15, is used for the digit port. It

enables one digit of the LED display toglow at a time in a multiplexed manner.This port drives the digits via 74LS245IC18 which sources current to all the seg-ments of a common-anode LED display.One of the six displays (DIS1 throughDIS6) would be glowing at a time in amultiplexed manner, which is governedby software.

The input port is actually part of thekey-encoder IC20, the 74C923, which is a20-key encoder CMOS chip. This IC gen-

Fig. 4: Arrangement showing interconnections between EPROM programmer and a developmentboard during emulation mode

Table IKey Hex No. FunctionDesig. Repres-

entation

S 10 Store and Incrementkey: When pressed,stores the data shownin the data field(rightmost two LEDs)into the address(leftmost four LEDs)and increments theaddress

H 11 High address set key:Sets the high address(leftmost two LEDs)to the value displayedin data field

L 12 Low address set key:Sets low address (twomiddle LEDs) to thevalue displayed in thedata field

G 13 Go and execute pro-gram key: Program isexecuted from the ad-dress displayed in theaddress field.

Semiconductors:IC1 - Z-80 microprocessorIC2 - 74LS139 dual 1-of-4 decoderIC3 (N1-N6) - 74LS04 hex inverterIC4 - 74LS157 quad 2-input

multiplexerIC5 - 74LS121 monostable

multivibratorIC6 - 75452 dual high-current

NAND gateIC7 - µA723 (T0-5 voltage

regulator metal can package)IC8 (N7-N12) - 74LS06 flex inverter buffer/

driverIC9 - 2764 or 2716 8k or 2k

EPROM (monitor)IC10 - 6264 8k static RAMIC11 (N13-N16) - 74LS00 quad 2-input NAND

gateIC12-IC16 - 74LS75 4-bit bistable latchIC17 - ULN2003 high current/

voltage Darlington driversIC18 - 74LS245 actual bus

transceiverIC19 (N17-N20) - 74LS02 quad 2-input NOR

gateIC20 - 74C923 keyboard encoderIC21 - LM7805 or LM340 5-volt

regulatorT1-T3 - 2N2907 pnp transistorD1, D2 - 1N5401 3-amp rectifier diodeD3, D4 - 1N4001 1-amp rectifier diodeResistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1,R5,R6,R8,R9,R12,R24 - 1.5-kilo-ohmR4,R23 - 470-ohmR2,R3 - 1-kilo-ohmR7 - 330-ohmR10 - 6.8-kilo-ohmR11 - 1.2-kilo-ohmR13 - 10-ohmR14,R15 - 10-kilo-ohmR16 - 3.3-kil-ohmR17-R19,R22 - 4.7-kilo-ohmR20 - 3.3-kilo-ohmR21 - 150-ohmCapacitors:C1,C2,C5,C10 - 0.1µF ceramic discC3 - 15-60pF ceramic discC4 - 10µF, 16V electrolyticC6 - 1µF, 16V electrolyticC7 - 470µF, 35V electrolyticC8 - 220µF, 63V electrolyticC9 - 2200µF, 25V electrolyticMiscellaneous:DIS1-DIS6 - LT542 common anode

displayS1-S3 - SPST on/off switchS4 - DPDT on/off switchS5 - Push-to-on switchS6 - Rotary switch

- 16 keyboard switches(N/O) tactile type)

- FRC connectors male/female- Ribbon cable- Shorting plugs for FRC

connectors, wooden enclosure

PARTS LIST

erates the key-code of the key pressed.The keys are arranged in a matrix of fiverows and four columns. At the intersec-tion of each row and column, a switch iswired. When a switch is closed, the 74C923encodes the value of the switch and out-puts it to the data bus. Also, whenever a

Page 69: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 59

key is pressed, the data available (DAV),pin13 in this IC, goes high. This activeDAV logic-1 state indicates that the keypressed has been encoded and the data isready after proper debouncing of thepressed key. The IC contains its internaloscillator for which a capacitor is con-nected on its pin 6 and another capacitoron pin 7 for taking care of key debouncing.The data bus can read the data only whenthe data is available. The output pins (15through 19) are floated in tristate condi-tion until the OE pin is brought low.

Whenever a key is pressed, the activehigh DAV signal after inversion by gate N11is given to the INT (interrupt) pin16 of theZ-80 microprocessor. The Z-80 is inter-rupted and it goes into an interrupt serviceroutine (ISR). This ISR includes a readPORT 1 (active low) command which isused after combining with I/O addressPORT 1 signal (active low) in NOR gateN20 and inverted through gate N12 toenable OE pin14 of IC 74C923. This routinereads the keycode, acquires its value andacts accordingly. The IC 74C923 thus com-bines a port function along with keyencoding logic.

Out of the 20 keys of the keyboard 16keys are used for hex digits 0 through Fand the remaining four are the commandkeys. Only four simple commands are pro-vided, because in this programmer we nor-mally load data into the RAM or any other

chip within the address range provided.Therefore these keys are mainly meantfor loading of address and data and ex-ecution of programs. The designation ofthe four command keys, along with theirhex digit representation and functions, isgiven in Table I.

The high and low addresses are shownon the first four digits (from the left) anddata on the last two digits of the display.Upon pressing the reset key, for example,the display shows:

20 00 xx, which is the first RAM ad-dress (20 00 hex) and xx are the content(data) stored at that address. Any hexa-decimal key, when pressed, enters thatnumber (0 through F) as the right-mostdigit. For example, if 3 is pressed, the 6-digit display shows:

20 00 x 3(Note: x in the above examples de-

notes any random hex digit.)If one keeps the key pressed for too

long, the number repeats itself and thedisplay would show:

20 00 33Similarly, if one presses the S key for

too long, the address keeps onincrementing one by one. This is becausethe software is so written for the inter-rupt service routine.

Reverting to the explanation of thecircuit of the main board, it consists ofthe Z-80 microprocessor with a crystal

TABLE IIIC Type Mode Pin No. 18 20 21 -1 -2 +12716 READ CE Low 5V -- -- --

Write 50ms High 25V -- -- --(Prog.) Positive

pulse (TTL)2516 Same as above2732 READ CE Low A11 -- -- --

Write 50ms 25V A11 -- -- --negativeTTL pulse (21V for 2732A)

2532 READ A11 Low Low -- -- --Write A11 50ms 25V -- -- --

negativegoing TTLpulse

2764 READ CE Low A11 A12 5V HighWrtie Low High A11 A12 21V 50ms

(12.5V negativeor 2764A) going

pulse(TTL)

27128 READ CE Low A11 A12 5V HighWrite Low High A11 A12 12.5V TTL

50ms27256 READ CE Low A11 A12 5V A14

Write Low High A11 A12 12.5V A14pulse

2864A READ CE Low A11 A12 5V HighWrite Low High A11 A12 5V TTL

pulse

clock of 2.5 MHz which is realised by anoscillator configured around a couple of74LS04 gates (N3 through N5). The Z-80’s interrupt pin 16 is used for data en-try from the keyboard as mentioned ear-lier. The non-maskable interrupt NMI (pin17) is not used and is tied, always high.The BUSREQ or ‘hold’ pin 25 is broughtlow whenever the switch (program-emu-late) is thrown to the emulate position.During the emulate mode, both the databus and the address bus are tri-statedand float in the Z-80. The 6116 (or 6264)RAM chip, which has its data alreadyloaded therein, is connected to the devel-opment board, for which the other end ofthe DIP jumper plugs into its own EPROMsocket. Fig. 4 offers a glimpse of the ar-rangement showing interconnection be-tween EPROM programmer and a devel-opment board during the emulation mode.

The Z-80 microprocessor has 16 ad-dress lines, out of which 13 address lines(A0 through A12) are used to select blocksof 8k memory each. Address lines A13 andA14 are used in a 74LS139 decoder (IC2) toget four decoded address ranges, as under:

00 00 to 1F FF: This is the first 8kmemory address space which is set asidefor the monitor EPROM. All this 8k memoryspace is, however, not used because themonitor and the programming code hardlyoccupy a few pages (here a page refers to256 consecutive locations). A 2716 EPROMIC (24-pin) is used here. It will be mappedin the address space of 00 00 to 07 FF. If a2764 EPROM IC (28-pin) is used as themonitor, it will occupy the entire 8k ad-dress space (00 00 to 1F FF).

20 00 to 3F FF: This is the second 8kblock of memory space which is set asidefor a RAM chip. This socket (for IC10) isalso used during the emulation mode asmentioned earlier. Since an emulator doesnot normally need a program of over 2k, a6116 RAM chip is enough. However, itwould be better to use 6264 (8) RAM. Thestarting address for whichever chip is em-ployed, would always be 20 00. The usableend-address will differ depending on theRAM chip used. It would be 3F FF with6264 and 27FF with 6116.

40 00 to 7F FF: This next 8k block ofmemory is for copy EPROM. Here onewould fit a 2716/32/64 in which code to becopied is already burnt in. The addressranges for the above-mentioned EPROMshaving 24/28 pins as annotated againsteach within parenthesis are:

27128 (28-pin): 40 00 to 5F FF (8k)2764 (28-pin): 40 00 to 5F FF (8k)

Page 70: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2060

2732 (24-pin): 40 00 to 4F FF (4k)2716 (24-pin): 40 00 to 47 FF (2k).The 2764 or 27128 has a socket of 28

pins. If one were to insert a 2716 or 2732 init, one will have to avoid the four pinswhich are extra, which are on the leftextreme (looking from the front) of thesocket. Thus, while inserting a 2716 in thissocket, one should insert it in such awaythat pin 1 goes into the pin 3 position. Sothe socket pin numbers of the 2764 arerenumbered, starting from –2, -1, 1 through12, 13 through 24, +1 and +2 (refer Fig. 1).Thus there should be no confusion duringinsertion/use of 24- or 28-pin IC in 28-pinDIL (dual-in-line) socket if one renumbersits pins in this format.

80 00 – FF FF: Last 32k of memoryspace has been set aside for the targetEPROM to be inserted in the 28-pin ZIFsocket for programming.

The programming EPROM could be a2716/32/64/128/256. While programming,we have to apply a 50ms TTL pulse to theproper programming pin of the EPROMIC being programmed. Also, we have toput the Z-80 in Wait state, so that theaddress and the data, which are outputfrom the Z-80 microprocessor to theEPROM under programming, remain sta-ble for 50 ms, to ensure that program-ming of the location takes place properly.At the same time, a high voltage (12.5/21V/25V) must be applied to the corre-sponding VPP pin. Table II shows the pinsto which the programming pulse, highvoltage VPP, etc are applied to the differentEPROMs. The 2532 EPROM from TI isslightly different from the 2732 of Inteland other makes. The 2732A also has aminor difference in that it needs only 21V.The programming action takes place asfollows:

When the memory block of the pro-gramming socket, 80 00 – FF FF, is ad-dressed, the monostable 74LS121 (IC5) isenabled. It produces a 50ms output pulse.This pulse would be used for keeping the Z-80 in the Wait condition, whenever onewrites data (i.e. programs) into the pro-gramming socket. While reading from thatsocket however, one need not put Z-80 inthe Wait state. Therefore one has to distin-guish between read operation and writeoperation for the IC in the programmingsocket. By the same analogy, the signalsgoing to the programming socket also dif-fer between read and programming opera-tions and vary from one chip to another.That is why it is rather difficult to have theprovision for programming several ICs in

one programmer.In this circuit, programming of differ-

ent EPROMs has been made possiblethrough use of small plug-in modulescalled personality ‘P’ plugs. These plugsare exactly like a 14-pin IC, and plug intoa 14-pin DIL socket. If one programs a2716, he plugs a 2716-P plug, and if oneprograms a 2732, he plugs a 2732 P-plug,and so on, into the personality socket.These could be fabricated by grinding anyfailed throw-away 14-pin IC’s top so as toremove the silicon dice and then wiringdiodes, jumpers on the top between thepins as shown in Fig. 6.

The personality plugs ensure applica-tion of proper signals to the pins of the ICbeing programmed. For example, in a 2716,pin 21 must get a 25V supply, pin 18 shouldget a 50ms high-going TTL pulse and pin20 must be logic high. For reading, pin 20must be low, pin 18 must get chip-enableCE signal while pin 21 must be only at 5V.Thus, when the P-plug is inserted, the 5Vsupply, the 50ms programming pulse, 21VVPP are passed via the jumper connectionson this P-plug to the proper pins of theprogramming socket.

In addition, to change over from theprogram mode to the read mode, the sig-nals need to be altered. For this, a4-pole, 2-way changeover switch (quad 2-input multiplexer 74LS157 IC4) is uti-lised. It is changed over from one side tothe other between read and programmingoperations. The four signals selected ineach case are shown with a separation ‘/’in Fig. 2 (at pins 4, 7, 9 and 12 of IC4).The read operation for 2716 requires alow pulse while the programming opera-tion requires a high pulse (50 ms) on itspin 18. So, one pole of the switch (herepin 7 of IC4) changes from CE pulse tothe 50 ms high pulse. On a 2732, theprogramming pulse must be a low-going50ms pulse, as also for a 2764 or 27128.For reading, 2716 requires zero volt on its

pin 20, but 5V during programming.Therefore, a 5V/0V signal is also switchedby another pole (pin 9) of IC4 (74LS157).The switch is changed-over from one posi-tion (read) to another (write) by a com-mand. This command is obtained fromone of the decoded input-output ports.Since we have two bits of the digit port 3free (as only 6 digits are used), the D7 bitof port No. 3 (i.e. Q7) is used for thispurpose. If pin 1 of 74157 is high, it se-lects the switches for programming, andif it is low, it selects the switches for read-ing. The programming software shouldmake this pin high and throw the switchesto the programming side, so that properprogramming signals are applied to theprogramming socket.

In addition, the high voltage (12.5Vor 21V) supplies need to be switched ononly at the time of programming. For thispurpose, switching voltage regulator ICµA723 (IC7) is employed. The 723 IC isnormally set up to obtain 12.5V or 21Vand 25V at output pin 1 with the help ofresistor R14 (10k) and other resistor(s)switched in by transistors 2N2907 (T1through T3). Transistor T1 (when on) pro-vides 12.5V output, while transistors T2and T3 provide respectively 21V and 25Voutput using a supply voltage of 30 volts.But if pin 9 of the µA723 is pulled low,the output drops to zero. Hence its pin 9is normally pulled and kept low, so thatno high voltage appears on the program-ming socket. Only during the program-ming period, pin 9 is left high and the12.5V or 21V or 25V are obtainable frompin 1 of IC7 (µA723). EPROM 2732A re-quires VPP of 21V while 2764 requires12.5V and 2716 as well as 2732 require25-volt VPP supply. I/O Port 1 bits D0through D2 controlled via the softwareprogram can be used to control the VPP

voltage. Alternatively, 3-way switch S6can be used to select the VPP voltage. (Inthe PCB only S6 has been wired.)

Fig. 5: Schematic diagram of power supply

Page 71: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 61

Pin 9 of µA723IC7 cannot begrounded directlyand it is thereforebrought under soft-ware control. The D7bit (Q7) of port-3 isbrought high duringprogramming. TheQ7, which then goeslow, is connected toIC6 75452 (a highv o l t a g e / c u r r e n tNAND inverter pair).This NAND gatemakes pin 9 of IC7low. The Q7 of port-3makes the input ofthe 75452 gate lowand thereby the out-put pins 3 and 5 gohigh, causing pin 9 ofIC7 also to go high.This permits the12.5V or 21V or 25Vsupplies to be avail-able. Normally, pin 9is low upon reset, asQ7 goes high upon re-set operation and itcontinues to be highduring data loadinginto RAM or readingoperations. So, highvoltages are properlyswitched and appliedcarefully, i.e. onlyduring programming.Switch S3, whichsupplies the unregu-lated 30V to the ICµA723, is switched ononly during program-ming.

SoftwareSoftware for the

programmer is sim-ple. The interruptservice routine (ISR)reads the keyboardfrom port-1 and waitsfor a certain duration(delay) before takingaction on the keypressed. If it is anumber (hex.) key, itputs it in the last(rightmost) digit. Ifone presses 3 and EFig. 6: Wiring of personality (P) plugs for different EPROMs

one after the other, 3E is entered in thedata field. The address starts at the firstRAM address (2000H) where 3E gets en-tered. If one desires to employ this unitas a Z-80 trainer kit, it can be easily doneby entering the program in the RAM andexecuting it with the ‘G ‘ (GO) key. Forexample, the following program wouldmove a 1 from left to right on the display:20 00 3E 06 LDA 06 ;Move

;00000110 to;segments

20 02 D3 02 OUT 02 ;via port-220 04 3E 01 LDA 01 ;Move 1 to20 06 D3 03 P: OUT 03 ;digit port-320 08 CD 50 04 Call delay ;wait for

;flicker20 0B CD 50 04 Call delay ;wait for

;flicker20 0E CD 50 04 Call delay ;wait for

;flicker20 11 07 RLA ;Rotate left20 11 C3 06 20 JMP P

The keys for incrementing and set-ting address are the S, H and L keys,while the G key executes the program.The main monitor program simply dis-plays the current address and its datausing a multiplexed display, for which asoftware program is used, commencing at00 B0. The display stays on, until it isinterrupted by pressing any of the keys.

Programming software: TheEPROM programming program softwareis also simple (It starts at address: 04 00hex) since hardware takes care of the50ms pulse which is required for program-ming the EPROM. The Z-80’s CPIinstruction is used, after setting up thesource, destination and number of bytesin register pairs DE, HL and BC respec-tively.

The D7-bit of port-3 (Q7) is initialisedto a ‘1’ so that the 74LS157 switches overto programming mode. At the instant oftransfer of each byte of data from sourceto destination, the 50ms pulse is gener-ated and the Z-80 also waits for this 50mstime duration. A comparison is made af-ter every transfer (after switching backthe 74LS157 to the read-mode), with theprogrammed data by reading the EPROM.If data was correctly programmed at thatbyte location, it proceeds to program thenext byte after switching on the 74LS157to the program mode. When all locations(as many as desired) have been pro-grammed, a flag letter ‘C’ indicating cor-rect programming is displayed.

If a byte does not get programmedproperly, it is displayed at once, showing

Page 72: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2062

that particular address and the wronglyprogrammed data therein, before proceed-ing to program the next byte. The displayshowing this information (wrongly pro-grammed data along with address) is livefor about 4 seconds, for the user to notethe wrong data and its address. Then itproceeds to program the next byte. If thereare no more errors, it continues rightthrough until the entire required programhas been programmed into the EPROM.

Procedure for programming: Theaddresses of the source, destination andthe number of bytes/pages to be pro-grammed should be first entered. For thispurpose, the RAM addresses, 2000through 2005 are used as under.

Destination: 20 00 … Low orderaddress and

20 01 … High order address of EPROMsocket (destination) corresponding to theEPROM being programmed.

Suppose one wants to program only thesecond half of a 2732 EPROM starting withits page 8 and ending with page F, one en-ters the starting address 88 00 (please notethat starting address of EPROM ZIF socketis 80 00 hex) as follows:

20 00 = 0020 01 = 88For a 2764 EPROM there are four

parts, with starting addresses as under:80 00 = First part88 00 = Second part90 00 = Third part98 00 = Fourth partThus, the starting address of destina-

tion (within the allocated address spaceof 80 00 through FF FF) will vary de-pending upon which quarter of the 2764one wants to load a program into.

Number of bytes: Having loaded thedestination address into RAM locations20 00 and 20 01, one proceeds to load thenumber of bytes/pages to be programmedin RAM locations 20 02 and 20 03. Forinstance, if one wants to copy a full 2716EPROM, there are eight pages to be cop-ied. So one enters them as under:

20 02 = 00 ;zero bytes and20 03 = 08 ;eight pagesSource: If one wants to copy from

RAM (as source), after having loaded thedata in it, earlier, the RAM starting ad-dress must be entered in locations 20 02and 20 03.

Please note that pages 21 to 26 ofRAM address space only are available forstoring the data to be transferred toEPROM. The full 8 pages (available) inthe 6116 RAM cannot be utilised for load-

ing the data (to be programmed) at onetime, since we employ its page 20 for load-ing addresses of destination, source andnumber of bytes to be programmed andits page number 27 for the stack. If how-ever, 6264 RAM is used in place of 6116RAM, then we could use address spacefrom 2100 to 3EFF. It is also advisable,while loading from RAM, to program onepage at a time. For example, after loadingthe data to be programmed into page 21of the RAM one enters the number ofbytes to be programmed as under:

20 02 = 00 ; 0 byte20 03 = 01 ; and one page.Then the source start address for data

(2100) will have to be entered in locations20 04 and 20 05 as under:

20 04 = 0020 05 = 21 (meaning that data to be

copied into EPROM is loaded in twentyfirst RAM page)

If one wants to copy data from the‘copy EPROM socket’ of Fig. 2, then thesource address range available is 40 00 to7F FF. But if a 2716 is used in that copy-ing socket, the start address would be 4800 (since pin 21 is to be returned to +5V).Thus source address would be entered asunder:

20 04 = 0020 05 = 48After entering the source address, des-

tination address and the number of bytesto be programmed and selecting the VPP

voltage (after switching on S3) and usingeither rotary switch S6 or using I/O port-1 bits, the program is executed at 04 00using G-key.

For selection of Vpp voltage using soft-ware, the following instructions can besuitably added in the EPROM program-ming software:

3E 01 LDA, # 01 ; 01for12.5V, 02;for 21V, 04 for 25V

D3 01 OUT 01 ;Output to port 1 to;set Q0/Q1/Q2 in

C7 RST-7 ;the voltage control;circuit

On execution of EPROM programmingsoftware starting at location 04 00, it trans-fers a byte from the source to the destina-tion, verifies it and continues until theentire data has been programmed. Whenthe flag letter ‘C’ gets displayed (denotingcorrect programming), press reset switchand switch off the unit. The EPROM isthen removed and used. It takes about 20seconds for each page to be programmed. Ifthere are many errors during program-

ming, either the IC is loose in its socket orthe EPROM is defective. The EPROM canbe erased with an ultraviolet light sourceeraser and tried again.

ConstructionThe power supply circuit as given in Fig.5 is to be assembled first on a base plateat the back of the unit, which could be awooden board of about 25 cm x 35 cm.The transformer and the heat sink for7805 are then to be fitted. A lug board isused for wiring the power supply circuitwith diodes, capacitors, etc. A 230V ACprimary to 12-0-12V, 2A secondary trans-former is used to get the DC supplies. Avoltage doubler circuit is used to obtain30V unregulated output, which goes tothe µA723 ICs on the Z-80 board of Fig. 2.Please note that either LM 7805C or 340Tin TO3 metal package capable of supply-ing 1 ampere of current should be used.As the ready-made transformers availablein the market are highly over-rated, onemay use a transformer with secondarycurrent rating of 3 to 4 amperes to avoidexcess voltage drop in the secondary andover-heating.

A double-sided PTH glass-epoxy PCBis required for the circuit of Z-80 mainboard including a major part of the circuitof the auxilary board. This would leave uswith only the keyboard which can beassembled on a general-purpose PCB andconnected to the main board using FRC 16-pin connectors and ribbon cable.

The actual-size component-side tracklayout for the PCB is given in Fig. 7 andsolder-side track lay-out is given in Fig.8. The component lay-out for the PCB isgiven in Fig. 9. The Z-80 board houses allsockets for programming EPROM, copyEPROM and the emulator DIP plug. TheZ-80 main board is mounted on pillar sup-ports in a raised position of about 6.5 cm,above the transformer. Cuts are madeagainst the positions of the sockets to ex-pose them for inserting ICs (the EPROMsfor programming and copymaster as wellas the DIP jumper). 28-pin zero insertionforce (ZIF) sockets could be fitted for these,since their pins are thick, having 1.0 mmholes are made for this programmingsocket on the board.

The PCB containing the keyboard ismounted in a slightly slanted positionwith respect to the Z-80 main board, sothat the keys can be handled conve-niently. Sockets are to be used for allICs in this board as well. The display is

Page 73: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 63

Fig. 7: Com

ponent-side track layout

Page 74: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2064

Fig.

8: S

olde

r-si

de tr

ack

layo

ut

Page 75: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 65

Fig. 9: Com

ponent layout

Page 76: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2066

mounted in a raised position using sock-ets and that make the display in levelwith the keyswitch tops, so that whilecovering up, these can both become ex-posed by a profile cut on the front panelplate. The switches S1-S6 are mountedon the side.

After wiring and interconnection, it isworthwhile to carry out a cold check byusing a continuity tester for all lines, par-ticularly the address and data lines tothe sockets for EPROM, RAM socket forprogramming, switches, etc. on the mainboard and the display/key board.

A check could be made of the pres-ence of 12.5/25V/21V voltages on the pro-gramming socket, when the programmingprogram at location 04 00 is executed.

The pulse of 50 ms going to pin 18 (say2716 P-plug) can be looked on a CRO. Forthe 2764 P-plug, the pin 2 gets the 21V.For the 2732, the pin 20 gets the 25V.These details are given in Table I. Thepersonality plugs should thus also bechecked. A sample program could beprogrammed into an IC to verify properprogramming.

Emulator: This is used to develop aprogram for a development board. Thisprogram should be loaded into the RAMfrom address 20 00 onwards using thekeyboard. Then, the program/emulateswitch S4 is thrown to emulate position.The chip select pin of the 6116 (or 6264)is now free and the Z-80 is in hold state.The DIP plug is now inserted on the de-

0000 C3 50 00 JP L1

0050 ED 56 L1: IM 10052 C3 00 02 JP L2

0200 31 FF 27 L2: LD SP,27FFH0203 21 00 20 LD HL,2000H0206 4E LD C,(HL)0207 CD B0 00 CALL DISPLAY020A FB EI020B F3 L: DI020C CD B0 00 CALL DISPLAY020F FB EI0210 C3 0B 02 JP L

0038 F5 PUSH AF0039 C3 AF 01 JP 01AFH

01AF DB 01 IN A,(01)01B1 32 00 27 LD (2700H),A01B4 47 LD B,A01B5 DB 01 IN A,(01)01B7 D9 EXX01B8 08 EX AF,AF’01B9 11 FF 57 LD DE,57FFH01BC 1B Q: DEC DE01BD 7A LD A,D01BE B3 OR E01BF 20 FB JR NZ,Q01C1 D9 EXX01C2 08 EX AF,AF’01C3 C3 00 03 JP LX

0300 3A 00 27 LX: LD A,(2700H)0303 E6 1F AND 1FH0305 FE 10 CP 10H0307 30 0D JR NC,A10309 47 LD B,A030A 79 LD A,C030B 17 RLA030C 17 RLA030D 17 RLA030E 17 RLA030F E6 F0 AND F0H0311 B0 OR B0312 4F LD C,A0313 F1 POP AF0314 ED 4D RETI0316 FE 12 A1: CP 12H0318 20 05 JR NZ,A2031A 69 LD L,C031B 4E LD C,(HL)031C F1 POP AF031D ED 4D RETI

031F FE 11 A2: CP 11H0321 20 05 JR NZ,A30323 61 LD H,C0324 4E LD C,(HL)0325 F1 POP AF0326 ED 4D RETI0328 FE 10 A3: CP 10H032A 20 06 JR NZ,A4032C 71 LD (HL),C032D 23 INC HL032E 4E B1: LD C,(HL)032F F1 POP AF0330 ED 4D RETI0332 FE 13 A4: CP 13H0334 20 F8 JR NZ,B10336 3E 79 LD A,79H0338 D3 02 OUT (02),A033A D3 03 OUT (03),A033C E9 JP (HL)

00B0 00 DISPLAY: NOP00B1 F5 PUSH AF00B2 7C LD A,H ; H is displayed00B3 E6 F0 AND F0H00B5 0F RRCA00B6 0F RRCA

00B7 0F RRCA00B8 0F RRCA00B9 5F LD E,A00BA 3E 20 LD A,20H00BC D3 03 OUT (03),A00BE CD 10 01 CALL SEGDISP00C1 7C LD A,H00C2 E6 0F AND 0FH00C4 5F LD E,A00C5 3E 10 LD A,10H00C7 D3 03 OUT (03),A00C9 CD 10 01 CALL SEGDISP00CC 7D LD A,L ; L is displayed00CD E6 F0 AND F0H00CF 0F RRCA00D0 0F RRCA00D1 0F RRCA00D2 0F RRCA00D3 5F LD E,A00D4 3E 08 LD A,0800D6 D3 03 OUT (03),A00D8 CD 10 01 CALL SEGDISP00DB 7D LD A,L00DC E6 0F AND 0FH00DE 5F LD E,A00DF 3E 04 LD A,04H00E1 D3 03 OUT (03),A

Z80 ASSEMBLY LANGUAGE PROGRAM FOR EPROM PROGRAMMERADDR OPCODE LABLE MNEMONICS COMMENTS ADDR OPCODE LABLE MNEMONICS COMMENTS

velopment board. For example if one isdeveloping an 8035 system board, thenthe EPROM socket on it is plugged by theother end of the DIP jumper. After reset-ting the 8035 in that board, the programin the 6116 (or 6264) here would be ex-ecuted by that 8035. One can check thatprogram for proper functioning. Whenchanges are necessary in the program,the 8035 is reset, and the DIP jumperunplugged. The program/emulate switchis thrown to program position and theRAM reloaded accordingly.

Tech Editor’s Note: The EPROM pro-grammer after fabrication at EFY wastested using a short test program as givenat the end. We could successfully programan EPROM using the same.

Page 77: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 67

00E3 CD 10 01 CALL SEGDISP00E6 79 LD A,C00E7 E6 F0 AND F0H00E9 0F RRCA00EA 0F RRCA00EB 0F RRCA00EC 0F RRCA00ED 5F LD E,A00EE 3E 02 LD A,0200F0 D3 03 OUT (03),A00F2 CD 10 01 CALL SEGDISP00F5 79 LD A,C00F6 E6 0F AND 0FH00F8 5F LD E,A00F9 3E 01 LD A,01H00FB D3 03 OUT (03),A00FD CD 10 01 CALL SEGDISP0100 F1 POP AF0101 00 NOP0102 C9 RET

0110 16 01 SEGDISP: LD D,01H0112 3E F0 LD A,F0H0114 B3 OR E0115 5F LD E,A0116 1A LD A,(DE)0117 D3 02 OUT (02),A0119 CD 20 01 CALL DELAY1 ; show it011C AF XOR A ; clear it011D D3 02 OUT (02),A011F C9 RET0120 F5 DELAY1: PUSH AF0121 D5 PUSH DE0122 1E 17 LD E,17H0124 1D P: DEC E0125 20 FD JR NZ,P0127 D1 POP DE0128 F1 POP AF0129 C9 RET

01F0 ORG 01F0H01F0 3F DEFB 3FH01F1 06 DEFB 06H01F2 5B DEFB 5BH01F3 4F DEFB 4FH01F4 66 DEFB 66H01F5 6D DEFB 6DH01F6 7D DEFB 7DH01F7 07 DEFB 07H01F8 7F DEFB 7FH01F9 67 DEFB 67H01FA 77 DEFB 77H01FB 7C DEFB 7CH01FC 39 DEFB 39H01FD 5E DEFB 5EH01FE 79 DEFB 79H

01FF 71 DEFB 71H

0400 F3 DI0401 ED 5B 04 20 LD DE,(2004H) ;DESTINATION

POINTER0405 2A 00 20 LD HL,(2000H) ;SOURCE

POINTER0408 ED 4B 02 20 LD BC,(2002H) ;BYTE-COUNT

POINTER040C 3E 80 LP: LD A,80H040E D3 03 OUT (03),A0410 CD 50 04 CALL TIMEDELAY

0413 1A LD A,(DE)0414 77 LD (HL),A0415 97 SUB A0416 D3 03 OUT (03),A0418 1A LD A,(DE)0419 13 INC DE041A ED A1 CPI041C C2 2F 04 JP NZ,ERROR041F EA 0C 04 JP PE,LP0422 3E 39 LD A,39H0424 D3 03 OUT (03),A0426 D3 02 OUT (02),A0428 76 HALT

042F F5 ERROR: PUSH AF0430 2B DEC HL0431 C5 PUSH BC0432 4E LD C, (HL)0433 D5 PUSH DE0434 110001 LD DE, 00010437 D5 PUSH DE0438 CD B000 CALL DISPLAY043B D1 POP DE043C 1B DEC DE043D 7A 1D A,D043E B3 OR E043F C2 3804 JP NZ P20442 D1 POP DE0443 C1 POP BC0444 23 INC HL0445 F1 POP AF0446 C30C04 JP LP

0450 F5 TIMEDELAY: PUSH AF0451 D5 PUSH DE0452 11 FF 02 LD DE,02FFH0455 1B A9: DEC DE0456 7A LD A,D0457 B3 OR E0458 20 FB JR NZ,A9045A D1 POP DE045B F1 POP AF045C C9 RET

ADDR OPCODE LABLE MNEMONICS COMMENTS ADDR OPCODE LABLE MNEMONICS COMMENTS

0400 F3 DI0401 ED 5B 04 20 LD DE,(2004H)0405 2A 00 20 LD HL,(2000H)0408 ED 4B 02 20 LD BC,(2002H)040C 3E 80 LP: LD A,80H040E D3 03 OUT (03),A0410 CD 50 04 CALL TIMEDELAY0413 ED A0 LDI0415 3E 00 LD A,0H0417 D3 03 OUT (03),A0419 EA 0C 04 JP PE,LP041C 3E 73 LD A,73H041E D3 03 OUT (03),A0420 D3 02 OUT (02),A0422 76 HALT

0450 F5 TIMEDELAY: PUSH AF0451 D5 PUSH DE0452 11 FF 02 LD DE,02FFH0455 1B A9: DEC DE0456 7A LD A,D

0457 B3 OR E0458 20 FB JR NZ,A9045A D1 POP DE045B F1 POP AF045C C9 RET

PROGRAM FOR VERIFICATION OF EPROM PROGRAM0500 F3 DI0501 ED 5B 00 20 LD DE,(2000H)0505 2A 04 20 LD HL,(2004H)0508 ED 4B 02 20 LD BC,(2002H)050C 3E 00 X: LD A,00H050E D3 03 OUT (03),A0510 1A LD A,(DE)0511 BE CP (HL)0512 23 INC HL0513 13 INC DE0514 0B DEC BC0515 C2 30 05 JP NZ,ERROR0518 EA 0C 05 JP PE,X051B 3E 39 LD A,39H

TEST PROGRAM FOR PROGRAMMING OF EPROMADDR OPCODE LABLE MNEMONICS ADDR OPCODE LABLE MNEMONICS

Page 78: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2068

Readers Comments:❑ 1. How can a hexdump be pro-grammed?

2. I have not found the contents of themonitor EPROM (2716/64). Does it meanthat it could be loaded with the monitorprogram of the 8088 given in the ‘LearnTo Use Microprocessors’ book?

3. Please let me know the steps forloading a 2716 with character generatorlisting in the article, i.e., how the programis to be written in Z80 assembly language?

Praveen ShankarHaridwar

The author, Prof. K. Padmanabhanreplies:

1. Programming any EPROM meansfilling its memory locations with code,i.e., numbers. Each cell in the chip iswritten with a particular code, i.e., anumber between 0 and 255 (or 00 to FFin hexadecimal notation). A ‘hexdump’ isjust a series of numbers which occupythese cells in the EPROM. In an EPROMprogrammer, these numbers are entered

by keyboard into the RAM of the pro-grammer and then transferred (written)into the EPROM chip.

2. In the Z80 programmer article,there is a program listing given, alongwith the code (i.e., numbers). These num-bers have to be entered into an EPROMfixed in the Z80 programmer board. Forthis purpose, one has to use anotherEPROM programmer, as the present Z80programmer is not yet ready!

The program that makes this ‘Z80 Pro-grammer’ work is specific to it and henceonly this programmer will work with it.The 8088 monitor program pertains to the8088 kit only and is totally different.

3. The numbers which go into thecharacter generator 2716 are, as given inthe article. Enter these numbers one-by-one using the keyboard into the Z80-basedprogrammer unit and then run the pro-gram for burning this data into the 2716EPROM. In other words, use the presentZ80-based program unit to burn anyEPROM with data. ‘Burning’ means writ-

ing data permanently into an EPROMchip by suitable application of higher volt-age pulses in sequence, which is themethod for entering data into an EPROM,in a nonvolatile manner. This unit (i.e.,the Z80-based programmer) has theneeded circuitry for this.

Remember again, that as far as theEPROM is concerned, its contents are justnumbers in the range 0-255, written inits cells. A 2716 has 2k (2048) cells, a2764 has 8k (8192) cells, and so on. TheZ80 assembly language has no connectionwith this. The unit uses a Z80 chip and sowe have given the operating program forthe unit in terms of Z80’s instruction set,in the form of Z80’s assembly language.

The character generator codes arejust numbers which give the patternof dots for each and every character—A,B, C, ... etc, while they appear on theCRT screen. These numbers do nothave anything to do with the Z80’s in-struction sets, or for that matter, anyother microprocessor. ❑

051D D3 03 OUT (03),A051F D3 02 OUT (02),A0521 76 HALT

0530 2B ERROR: DEC HL0531 4E LD C,(HL)0532 D5 PUSH DE0533 11 FF 0F LD DE,0FFFH0536 D5 P2: PUSH DE0537 C5 PUSH BC

0538 CD B0 00 CALL DISPLAY053B C1 POP BC053C D1 POP DE053D 1B DEC DE053E 7A LD A,D053F B3 OR E0540 20 F4 JR NZ,P20542 D1 POP DE0543 23 NC HL0544 C3 0C 05 JP X

Page 79: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 69

8098 DEVELOPMENT BOARD

Amongst the 16-bit family of Intelmicrocontrollers, the 8098 is theone which is more economical and

useful for developing a simple system forunderstanding the architecture and soft-ware details of 8x9x family. Housed in a48-pin DIP package (Fig.1), it has an 8-bit external data bus which is convenientfor interfacing to the byte-wide memoryIC’s data bus. Although it does not pos-sess full features of the main 8x9x fam-

ily, it has all of them at least partially.For example, instead of eight analogueinput channels on the main IC, this 48-pin version has provision for four. Like-wise, the high-speed input and output fa-cilities are also available in a lesser quan-tity than in the main IC with the gridchip carrier. Though the hardware fea-tures are present in slightly reduced pro-portion in the 48-pin version of 8098, yetall the software features of the main chipare fully supported by this smaller ver-sion as well.

In order to evaluate and understandthe features and various other aspects ofthe 8x9x family hardware and software,it is essential to have a system boardwhich is operating with the IC. Such sys-tems are not yet readily available in In-dia, though Intel, itself markets a systemknown as iSBE-96. As per Intel, “It is atool available to designers for developingsystems based on the 8096microcontroller. It uses the IBM PC todownload to the iSBE-96, and is used intypical development environment for de-

K. PADMANABHAN & S. ANANTHI

signing and proto-typing of the 8x9x prod-ucts. With its facilities, one can build aprototype of the target product, developfirmware for it, and debug and test itsoperation prior to the product enteringthe manufacturing stage.”

As the iSBE-96 is both expensive andunobtainable, one Mr Coates developedand published a system board workingwith a dumb terminal or PC as the host.On this system, programs are developedonly at machine-code level, bydownloading instructions from the PC, orthe dumb terminal, which the systemboard executes. Even this is not a suffi-ciently handy system for quick and eco-nomical software development on this verycomplex chip.

Therefore, it was decided (by the au-thors) to develop and present a dedicated,simple but effective system developmentboard/kit around this 8098, to enable allof its software and multi-tasking featuresto be tested/experimented with and usedto develop suitable boards for the neededinstrumentation applications.

Note: A satisfactory demonstration of theperformance of the author’s 8098 prototypekit was witnessed by EFY’s Chennai repre-sentative.

Fig. 1: Pin configuration of IC 8098

Fig. 2: Internal block diagram of 8098

Page 80: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2070

+5V

+5V

4 56

+5V

18

+5V

+5V

14 7

321

14+

5V

7

4

1414

RD

33 +5V

14

7

Fig

. 3: S

chem

atic

dia

gram

of 8

098

deve

lopm

ent b

oard

Unlike a simple beginner’s microproc-essor kit, such as the 8085 or Z-80 kitswith 7-segment and LED displays, thisdevelopment system needs alphanumeric

display for effectively using its softwarerepertoire. Therefore this developmentboard has been designed using a 16-char-acter, single-line alphanumeric display

module LT-111R from Philips. Such dis-plays are now commonly available in ourcountry from multiple sources.

As instructions have to be entered for

Page 81: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 71

program execution, a hexadecimal key-board was built into the board, though itwould have been equally possible to addan IBM PC compatible keyboard.

The instruction set of the 8098 is verycomplex, with its various multi-operandformats. However, it is not as complex asthe 8096 where bit-level addressing modi-fications into the code are involved. Thismakes it absolutely impossible to writehand-code. The same is also true ofMotorola’s 68000 family. In this respect

one should appreci-ate the wiz kids ofIntel who developedthis 8x9x family soft-ware. The code isspecific for each in-struction type and addressing mode.Please refer Tables I through III for itsinstructions set.

Intel sells cross-assembler, workingon the PC, which can be used to developcode for 8098. This is comparatively ex-

Fig. 4: Block diagram of 16-characters x 1-line LCD module

Fig. 5: Dimensional details of a typical 16 character x 1-line LCD module

ARITHMATIC INSTRUCTIONSADD 2 64 3 4 65 4 5 66 3 6/11 3 7/12 67 4 6/11 5 7/12ADD 3 44 4 5 45 5 6 46 4 7/12 4 8/13 47 5 7/12 6 8/13ADDB 2 74 3 4 75 3 4 76 3 6/11 3 7/12 77 4 6/11 5 7/12ADDB 3 54 4 5 55 4 5 56 4 7/12 4 8/13 57 5 7/12 6 8/13ADDC 2 A4 3 4 A5 4 5 A6 3 6/11 3 7/12 A7 4 6/11 5 7/12ADDCB 2 B4 3 4 B5 3 4 B6 3 6/11 3 7/12 B7 4 6/11 5 7/12SUB 2 68 3 4 69 4 5 6A 3 6/11 3 7/12 6B 4 6/11 5 7/12SUB 3 48 4 5 49 5 6 4A 4 7/12 4 8/13 4B 5 7/12 6 8/13SUBB 2 78 3 4 79 3 4 7A 3 6/11 3 7/12 7B 4 6/11 5 7/12SUBB 3 58 4 5 59 4 5 5A 4 7/12 4 8/13 5B 5 7/12 6 8/13SUBC 2 A8 3 4 A9 4 5 AA 3 6/11 3 7/12 AB 4 6/11 5 7/12SUBCB 2 B8 3 4 B9 3 4 BA 3 6/11 3 7/12 BB 4 6/11 5 7/12CMP 2 88 3 4 89 4 5 8A 3 6/11 3 7/12 8B 4 6/11 5 7/12CMPB 2 98 3 4 99 3 4 9A 3 6/11 3 7/12 9B 4 6/11 5 7/12

MULU 2 6C 3 25 6D 4 26 6E 3 27/32 3 28/33 6F 4 27/32 5 28/33MULU 3 4C 4 26 4D 5 27 4E 4 28/33 4 29/34 4F 5 28/33 6 29/34MULUB 2 7C 3 17 7D 3 17 7E 3 19/24 3 20/25 7F 4 19/24 5 20/25MULUB 3 5C 4 18 5D 4 18 5E 4 20/25 4 21/26 5F 5 20/25 6 21/26MUL 2 ➁ 4 29 ➁ 5 30 ➁ 4 31/36 4 32/37 ➁ 5 31/36 6 32/37

MUL 3 ➁ 5 30 ➁ 6 31 ➁ 5 32/37 5 33/38 ➁ 6 32/37 7 33/38

MULB 2 ➁ 4 21 ➁ 4 21 ➁ 4 23/28 4 24/29 ➁ 5 23/28 6 24/29

MULB 3 ➁ 5 22 ➁ 5 22 ➁ 5 24/29 5 25/30 ➁ 6 24/29 7 25/30DIVU 2 8C 3 25 8D 4 26 8E 3 28/32 3 29/33 8F 4 28/32 5 29/33DIVUB 2 9C 3 17 9D 3 17 9E 3 20/24 3 21/25 9F 4 20/24 5 21/25DIV 2 ➁ 4 29 ➁ 5 30 ➁ 4 32/36 4 33/37 ➁ 5 32/36 6 33/37

DIVB 2 ➁ 4 21 ➁ 4 21 ➁ 4 24/28 4 25/29 ➁ 5 24/28 6 25/29

Notes:

� Long indexed and indirect + instructions have indentical opcodes with short indexed and indirect modes, respectively.The second byte of instructions using any indirect or indexed addressing mode specifies the exact mode used. If thesecond byte is even, use indirect or short indexed. If it is odd, use indirect + or long indexed. In all cases the secondbyte of the instruction always specifies as even (word) location for the address referenced.

➀ Number of state times shown for internal/external operands.➁ The opcodes for signed multiply and divide are the opcodes for the unsigned function with an ‘FE’ appended as a prefix.

MN

EM

ON

IC

OP

ER

AN

DS

OPC

OD

E

BY

TE

S

STA

TE

TIM

ES

OPC

OD

E

BY

TE

SS

TAT

ET

IME

S

OPC

OD

E

BY

TE

S

STA

TE

➀T

IME

S

BY

TE

S

STA

TE

➀T

IME

S

OPC

OD

E

BY

TE

S

STA

TE

➀T

IME

S

BY

TE

S

STA

TE

➀T

IME

S

TABLE IOpcode and State Time Listing

DIRECT IMMEDIATE INDIRECT� INDEXED�

NORMAL AUTO-INC. SHORT LONG

pensive. The authors were, however, ableto obtain a cross-assembler from an al-ternate source (Pseudo Corp., USA) forjust $50 in order to develop the neededsoftware for the firmware of the develop-ment board and its applications that fol-

low. This is the background whichled the authors to develop an 8098system of their own.

DescriptionThe circuit is described with refer-ence to the schematic diagram ofthe system board shown in Fig.3.The main IC is the 8098microcontroller itself whose inter-nal block diagram is shown in Fig.2.On its left, all input-output pinsare shown. These include HSI andHSO (HS stands for high speed)pins, the four analogue signal in-put pins, the transmit and receivepins of its serial interface and thecrystal oscillator as well as the resetinput pins. Output pins 7 and 8(HSO0 and HSO1) are providedwith high-current drivers (part ofIC ULN2003) to enable interfacingto relays etc.

The 8098 has a multi-facet re-set pin, which requires a carefulconnection of the power-on resetpulse to itself. Instead of just asimple resistor-capacitor network,as found in most othermicroprossors, this one has a gateto ensure a sharp reset input. In-put must be low for at least 2 statetimes to reset the chip. The clock isinternally generated with the crys-tal connected between its pins 35and 36. A 12MHz crystal is thestandard one, though lower fre-

Page 82: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2072

quencies down to 4MHz could be used.Here an 8MHz crystal has been used. Theactual system clock is one-third of the crys-tal frequency and the state time is thus325 ns (250 ns with 12MHz crystal).

Pins 11 and 37 are the ground or Vsspins while pins 38 and 46 are connectedto positive 5 volts or Vcc. The referencevoltage for the analogue-to-digital covertersection is applied at pin 45, which is alsoconnected here to +5V. Pin 44 is the ana-logue ground pin. Though this has conti-nuity with the digital ground or Vss, itstrack has to be separately brought out forinputting the analogue signals. The vari-ous high-speed input-output pins are givenbelow for quick reference.Pin Pin designation/no. function3 HSI.0

MN

EM

ON

IC

OP

ER

AN

DS

OPC

OD

E

BY

TE

S

STA

TE

TIM

ES

OPC

OD

E

BY

TE

SS

TAT

ET

IME

S

OPC

OD

E

BY

TE

S

STA

TE�

TIM

ES

BY

TE

S

STA

TE�

TIM

ES

OPC

OD

E

BY

TE

S

STA

TE�

TIM

ES

BY

TE

S

STA

TE�

TIM

ES

TABLE IIOpcode and State Time Listing

DIRECT IMMEDIATE INDIRECT� INDEXED�

NORMAL AUTO-INC. SHORT LONG

JUMPS AND CALLSMNECONIC OPCODE BYTES STATES MNEMONIC OPCODE BYTES STATESLJMP E7 3 8 LCALL EF 3 13/16�

SJMP 20-27� 2 8 SCALL 28-2F� 2 13/16�

BR[ ] E3 2 8 RET F0 1 12/16�

TRAP� F7 1Notes:

� Number of state times shown for internal/external operands.� The assembler does not accept this mnemonic� The least significant 3 bits of the opcode are concatenated with the following 8 bits to form an 11-bit, 2's

complement, offset for the relative call or jump� State times for stack located internal/external.� The asssembler uses the generic jump mnemonic (BR) to generate this instruction.

LOGICAL INSTRUCTIONSAND 2 60 3 4 61 4 5 62 3 6/11 3 7/12 63 4 6/11 5 7/12AND 3 40 4 5 41 5 6 42 4 7/12 4 8/13 43 5 7/12 6 8/13ANDB 2 70 3 4 71 3 4 72 3 6/11 3 7/12 73 4 6/11 5 7/12ANDB 3 50 4 5 51 4 5 52 4 7/12 4 8/13 53 5 7/12 6 8/13OR 2 80 3 4 81 4 5 82 3 6/11 3 7/12 83 4 6/11 5 7/12ORB 2 90 3 4 91 3 4 92 3 6/11 3 7/12 93 4 6/11 5 7/12XOR 2 84 3 4 85 4 5 86 3 6/11 3 7/12 87 4 6/11 5 7/12XORB 2 94 3 4 95 3 4 96 3 6/11 3 7/12 97 4 6/11 5 7/12

DATA TRANSFER INSTRUCTIONSLD 2 A0 3 4 A1 4 5 A2 3 6/11 3 7/12 A3 4 6/11 5 7/12LDB 2 B0 3 4 B1 3 4 B2 3 6/11 3 7/12 B3 4 6/11 5 7/12ST 2 C0 3 4 – – – C2 3 7/11 3 8/12 C3 4 7/11 5 8/12STB 2 C4 3 4 – – – C6 3 7/11 3 8/12 C7 4 7/11 5 8/12LDBSE 2 BC 3 4 BD 3 4 BE 3 6/11 3 7/12 BF 4 6/11 5 7/12LDBZE 2 AC 3 4 AD 3 4 AE 3 6/11 3 7/12 AF 4 6/11 5 7/12

STACK OPERATIONS (internal stack)PUSH 1 C8 2 8 C9 3 8 CA 2 11/15 2 12/16 CB 3 11/15 4 12/16POP 1 CC 2 12 – – – CE 2 14/18 2 14/18 CF 3 14/18 4 14/18PUSHF 0 F2 1 8POPF 0 F3 1 9

STACK OPERATIONS (external stack)PUSH 1 C8 2 12 C9 3 12 CA 2 15/19 2 16/20 CB 3 15/19 4 16/20POP 1 CC 2 14 – – – CE 2 16/20 2 16/20 CF 3 16/20 4 16/20PUSHF 0 F2 1 12POPF 0 F3 1 13

4 HSI.15 HSI.2 or HSO.46 HSI.3 or HSO.57 HSO.08 HSO.19 HSO.210 HSO.313 Port 2 bit 5 or PWM output43 Port 0.4 or analogue channel 442 Port 0.5 or analogue channel 540 Port 0.6 or analogue channel 641 Port 0.7 or analogue channel 71 Transmit data or Port 2 bit 12 Receive data or Port 2 bit 0

It may be noted that due to paucity ofpins on this 48-pin chip, some pins assumea dual role, controlled by software, whilesome functions are missing (not available).For example, analogue channels 0 through3 for analogue input are not available

while analogue channels 4 through 7are available. Analogue input for chan-nel 4 has been routed through a very-high-impedance op-amp CA3130 for usewith very-low-level analogue signals.Also, full 8-bit ports are not available;only some bits are available for thoseports.

As with most Intel processors, the8-bit data bus is multiplexed with thelow order address lines. However, inthe 8x9x, there are two versions of theaddress latch signal; one of them iscalled ALE and the other is called ADV.A 74LS373 IC is used for segregatingand latching A0 through A7 signalsfrom the AD0-AD7. The data bus isbuffered using a 74LS245 bidirectionalbuffer. This is enabled by the RD sig-nal for data flow direction towards the8098 data bus.

A dual 2-line to 4-line decoder IC,74LS139, is used as address decoderfor memory and input-output addressrange selection. Address lines A14 andA15 are used to select a set of fourgroups of memory addresses in one ofthe decoders in the 64k address rangeas under:1. 0000H-3FFFH 2. 4000H-7FFFH3. 8000H-BFFFH 4. C000H-FFFFH

The first group is meant forEPROM area, which contains the moni-tor program. The second address groupis used for input-output devices, andtherefore the ready pin 16 of the 8098is brought low when this group isselected. This group is further subdi-vided into four smaller ranges in thesecond decoder of 74LS139 as under:1. 4000H-4FFFH 2. 5000H-5FFFH

Fig. 6: Shows author’s prototype of 8098development board

Page 83: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 73

TABLE IIIConditional Jumps

All conditional jumps are 2 byte instructions. They require 8 state times if the jump is taken, 4 if it is not.MNEMONIC OPCODE MNEMONIC OPCODE MNEMONIC OPCODE MNEMONIC OPCODEJC DB JE DF JGE D6 JGT D2JNC D3 JNE D7 JLT DE JLE DAJH D9 JV DD JVT DC JST D8JNH D1 JNV D5 JNVT D4 JNST D0

JUMP ON BIT CLEAR OR BIT SETThese instructions are 3-byte instructions. They require 9 state times if the jump is taken, 5 if is it is not.MNECONIC BIT NUMBER

0 1 2 3 4 5 6 7JBC 30 31 32 33 34 35 36 37JBS 38 39 3A 3B 3C 3D 3E 3F

LOOP CONTROLDJNZ OPCODE EO. 3 BYTES: 5/9 STATE TIMES (NOT TAKEN/TAKEN)

SINGLE RESISTOR INSTRUCTIONSMNECONIC OPCODE BYTES STATES MNEMONIC OPCODE BYTES STATESDEC 05 2 4 EXT 06 2 4DECB 15 2 4 EXTB 16 2 4NEG 03 2 4 NOT 02 2 4NEGB 13 2 4 NOTB 12 2 4INC 07 2 4 CLR 01 2 4INCB 17 2 4 CLRB 11 2 4

SHIFT INSTRUCTIONSINSTR WORD INSTR BYTE INSTR DBL WDMNEMONIC OP B MNEMONIC OP B MNEMONIC OP B STATE TIMESSHL 09 3 SHLB 19 3 SHLL 0D 3 7 + 1 PER SHIFT�SHR 08 3 SHRB 18 3 SHRL 0C 3 7 + 1 PER SHIFT�SHRA 0A 3 SHRAB 1A 3 SHRAL 0E 3 7 + 1 PER SHIFT�

SPECIAL CONTROL INSTRUCTIONSMNEMONIC OPCODE BYTES STATES MNEMONIC OPCODE BYTES STATESSETC F9 1 4 D1 FA 1 4CLRC F8 1 4 E1 FB 1 4CLRVT FC 1 4 NOP FD 1 4RST FF 1 16 SKIP 00 2 4

NORMALIZENORML 0F 3 11 + 1 PER SHIFTNotes:

� This instruction takes 2 states to pull RST low, then holds it low for 2 states to initiate a reset. The reset takes 12 states, at which timethe program restarts at location 2080H

� Execution will take at least 8 states, even for 0 shift.

3. 6000H-6FFFH 4. 7000H-7FFFHThe 8000H and C000H groups are

each of 16k. Two 28-pin sockets are pro-vided for two RAM ICs. These could befixed with 8k static RAM such as the 6264or the 32k RAM 62256. One may also usea RAM chip in the first socket and anEEROM (such as 2864A) in the secondsocket. The EEROM will permit perma-nent storage of data or code.

An 8-bit data output port using latchIC 74LS373 is provided to enable out-putting of temporary data during pro-gram development. This port is at theaddress range 4000H-4FFFH. The clockfor this 74LS373 IC is obtained by thecombining 4000H chip select signalwith WR signal in a NOR gate ofIC 74LS02. For indication of the logiclevel at the output pins of this 74LS373IC, eight LEDs are fixed on the boardwith current limiting resistors of 220

ohms each.A keyboard encoder of the matrix type

is used for connection to the hexadecimalkeyboard. This is a 74C922 IC having itsown scan oscillator. The 16 keys are ar-ranged in a 4 x 4 matrix for hex digits 0through F. Whenever a key is closed, the

contact is debouncedand valid code is avail-able at A through Doutput pins of the IC.Simultaneously, ‘dataavailable’ informationis output from pin 12of the IC. The outputdata (A through D) and‘data available’ pins areinterfaced to bitsD0 through D3 and D7respectively of thedata bus via tri-statebuffer IC 74LS365for reading by themicrocontroller. Thereis another key calledthe command key (CK),which is connected topositive supply througha pull-up resistor.When this key ispressed, D6 bit be-comes low. Thus bypressing this key, to-gether with the nu-meric (hex) keys, weget additional set ofkey codes.

The monitor soft-ware program readsthe keyboard buffer ataddress 5000H. Thepresence of any key-clo-sure is detected by theD7 bit going high. Thecommand key closure isnoted by looking at the

D6 bit status (low or high). The 74LS365buffer is read by the RD signal at itspin 15.

The LCD Display ModuleThe LCD module used in this project is16-character single-row type. The inter-nal block diagram and dimensional detailof a typical 16-character x 1-line LCD mod-ule are given in Figs 4 and 5 respectively.The display is a dot-matrix of 5 x 8 dotsfor each character, with the bottom dotline used for the cursor. The module workswith its own SMD LCD driver and con-troller LSI having internal memory com-prising character generator (CG) ROMand RAM as well as display data (DD)RAM. The data can be entered into thismodule from the 8098 through the databus. There is a separate instruction setfor the LCD module. Additional Software

TABLE IVPin Functions of LCD Module

Pin No. Function Level1 V

SS0V

2 VDD +5V3 V

O0.7V

4 RS 0=inst: 1=char5 R/W 0 = write: 1 = read6 E latch on fall7 DB0 Databit 08 DB1 Databit 19 DB2 Databit 210 DB3 Databit 311 DB4 Databit 412 DB5 Databit 513 DB6 Databit 614 DB7 Databit 7

Page 84: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2074

is therefore required to meaningfully writeinformation into the LCD module, i.e.characters, numbers, etc. The data byteis obtained from the character code map.(Refer page 50 of Apr’97 issue of EFY forcharacter code map or construction projectnamed as “microprocessor LCD module”in Electronics Project Vol. 18) The instruc-tion set of LCD module is given in TableV. There are instructions for display setup,cursor positioning, setting the location ofthe next character, writing the character,reading the DD RAM, shifting the dis-play right or left and even blinking thecursor, etc.

For interfacing the LCD module, thereis a 14-pin connector on LCD module. Thedata bus connects to pins 7 through 14(DB0 through DB7). Pin 2 is connected to5V and pin 1 is connected to ground. Acontrast control potentiometer (10-kilo-

Meaning of Bit ValuesBIT 1 0I/D Increment DecrementS Enable DisableS/G Display shift Cursor moveR/L Shift to right Shift to leftD/L 8-bit mode 4-bit modeN 2 lines 1 lineBF Busy ReadyF Not used 5 x 7 dots

ohm) connects to pin 3 of the module. Thepin 4, register select (RS=0 selects instruc-tion register and RS=1 selects data regis-ter) is connected to address line A0 toselect one of the two internal registers.Pin 5 is the read/write (R/W) signal, ob-tained by inverting the RD in an inverter.Pin 6 is active high enable (E) signal. Thechip select at address 6000H is invertedand connected to pin 6. Some LCDs comewith 1 or 2 extra pins (pin nos. 15 and 16)for backplane illumination. In Lampexsupplied modules pin 15 is connected to+5V via 33-ohm resistor while in Orioleand Crystlonics supplied modules , it isconnected to ground. Pin 16 in Lampexmodule is grounded while the other twomanufacturers do not use the same.

SoftwareThe listing of the monitor program is givenin the Appendix ‘A’. Provision for entry ofprograms into the RAM memory, startingat address 8000H or anywhere else, andexecuting them is made. Upon power on,or pressing the reset switch, the LCD dis-play shows:

80,000 xxwhich means that the high address is 80H

and the low order address is00H. xx represents any ran-dom data which may bepresent in the RAM at ad-dress 8000H. Using the Hexkeyboard, data can be enteredagainst the displayed ad-dress. For example, if B0 isentered one by one, then dis-

TABLE VICommand key and numeric key 1 Set high addressCommand key and numeric key 2 Set low addressCommand key and numeric key 3 Execute program at

current display addressCommand key and numeric key 4 Decrement addressCommand key and numeric key 7 Store current data and

increment addressCommand key and numeric key 8 Just increment address

Semiconductors:IC1 - 8098, 16-bit MicrocontrollerIC2, IC7 - 74LS373 octal D-type latchIC3 - 74LS245 octal bus trans-

receiverIC4 - 2764, 8k byte EPROMIC5 - 6264, 8k byte static RAMIC6 - 74LS139 dual 1-of-4 decoderIC8 - ULN2003 high current

driversIC9 - CA3130 high input

impedance op-ampIC10 - 74LS02 quad 2-input NOR

gateIC11 - 74LS04 Hex inverterIC12 - 74LS365 Hex buffer driverIC13 - 74C922 keyboard encoderIC14 - 74LS26 positive Nand gateD1 - 0A91 detector diodeD2, D3 - 1N4148 switching diodeLED1-LED8 - Coloured LED

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1-R9 - 10-kilo-ohmR10 - 33-kilo-ohmR11, R12 - 10-kilo-ohmR13-R20 - 220-ohmR21 - 100-ohmR22 - 39-kilo-ohmR23 - 1-kilo-ohmVR1 - 10-kilo-ohm

Capacitors:C1, C2 - 33pF ceramic discC3 - 4.7µF, 10V electrolyticC4, C5 - 0.1µF ceramic disc

Miscellaneous:- 16 character x 1-line

LCD module- Tactile switches

S1 - SPST switch- Ni-Cd battery 1.2Vx3

Xtal - 8MHz quartz crystal

PARTS LIST

play will show (onkeying in B first):

80 00 xBand after keying in 0,the display will show:

80 00 B0Entries roll away

to left and enable cor-rections to be made.To advance to thenext address, theCommand key andkey 8 are pressed.That is, keeping theCommand keypressed, numeric key8 is pressed. The dis-play will then show:

80 01 xxIf in place of Com-

mand key and 8 wepress Command key

and numeric key 7, data B0 is storedagainst address 8000H before advancing

TABLE VLCD Module Instruction Set

CodeInstruction RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 CommentsClear display 0 0 0 0 0 0 0 0 0 1 Clears display and home cursorHome cursor 0 0 0 0 0 0 0 0 1 x Returns cursor to home positionEntry set 0 0 0 0 0 0 0 1 I/D S Selects cursor direction and shiftmodesDisplay control 0 0 0 0 0 0 1 D C B Selects display, cursor and flash modesCursor or Displayshift 0 0 0 0 0 1 S/G R/L x x Moves cursor and shifts displayFunction set 0 0 0 0 1 DL N F x x Sets interface mode number of linesand

character fontCG RAM address 0 0 0 1 MSB ACG LSB Selects CG RAM address

Following data is stored in CG RAMDD RAM address 0 0 1 MSB ADD LSB Selects DD RAM address

Following data stored in DD RAMRead busy flagand address 0 1 BF MSB AC LSB Reads busy flag

Indicates if module readyWrite data to CGor DD RAM 1 0 MSB Write data LSB Writes data into CG or DD RAMRead data from CG

Page 85: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 75

to the next address location, i.e. 80 01. Ifnow we want to decrement the address,command key and the numeric key 4 arepressed together and the display shows:

80 00 B0Now we can enter a small sample pro-

gram as given below:80 00 A1 LD 80H, 4000H : load register 80

with 4000H80 01 00 : which is LED

port address80 02 4080 03 8080 04 B1 LD 70H,#55H : to output 55 to

LED port80 05 5580 06 7080 07 C6 STB 70,(80) : store contents

of 70 into80 08 8080 09 70 : memory point-

ed to by 80, 8180 0A 27 SJMP $ :80 0B FE : loop here

In the above program, the addresses70, 80 are internal RAM locations, calledInternal Registers of the 8098. For out-putting on the LED port, indirect address-ing via contents of RAM locations 80, 81has been employed. After entry of theabove programs from address locations 8000 through 80 0B, one can execute theprogram by pressing command key andthen key no.3. The display would show:

80 00 B0 G_which means that the program from startaddress 8000 H is going on.

The interpretation of commands asso-ciated with Command key in combinationwith a numeric key are given in Table VI.

Using the above commands it is pos-sible to enter a program, read the enteredprogram or execute a program starting atany address.

If an EEPROM is fitted in the spareRAM socket (covering the address rangeC000H – FFFFH) such as 2864A, it ispossible to write or read data to/from theEEPROM in the mentioned address range.It will retain the code even after switchoff and thus help in development work.However, for reading stored data we mustuse Command key and numeric key 8 (re-fer Table VI) instead of the Commandkey and numeric key 7, as that wouldresult in alteration of stored data becauseEEPROMs take time to write the data.Therefore while using EEPROMs, pleaseremember to use:

—Command key and numeric key 7... to enter fresh byte at current address

Appendix ‘A’ Monitor ProgramAddr OpCode Label Mnemonics/Ass. Directives Comments

; LCD MONITOR PROGRAM USING; INTEL-8098 MICROCONTROLLER; ASSEMBLER USED - Pseudosam 96; (Cross-Assembler for 8096, 98 and 196kc; families) by PsedoCorp, USA.

2000 ORG h’ 20002000 0081 ORG h’ 2000 DBh’00,h’ 81 ; TIMER OVERFLOW INTERRUPT

; VECTOR2002 ORG h’ 20022002 0282 DB h’ 02, h’ 82 ; A/D CONVERSION2004 ORG h’ 20042004 0483 DB h’ 04, h’ 83 ; HSI DATA AVAILABLE2006 ORG h’ 20062006 0684 DB h’ 06, h’ 84 ; HSO EXECUTION2008 ORG h’ 20082008 0885 DB h’ 08, h’ 85 ; HSI . 0200A ORG h’ 200A200A 0A86 DB h’ 0A, h’ 86 ; SOFTWARE TIMER200C ORG h’ 200C200C 0C87 DB h’ OC, h’ 87 ; SERIAL INPUT/OUTPUT200E ORG h’ 200E200E 0E88 DB h’ OE, h’ 88 ; EXT. INTERRUPT2018 ORG h’ 20182018 95 DB h’ 95 ; CHIP CONFIGRATION BYTE20192080 ORG h’ 20800018 EQU SP, h’ 0018 ; STACK POINTER0042 EQU REG42, h’ 0042 ;0043 EQU REG43, h’ 0043 ;0044 EQU REG44, h’ 0044 ;0045 EQU REG45, h’ 0045 ;0046 EQU REG46, h’ 0046 ; INTERNAL REGISTERS0048 EQU REG48, h’ 0048 ;0052 EQU REG52, h’ 0052 ;0054 EQU REG54, h’ 0054 ;0056 EQU REG56, h’ 0056 ;0058 EQU REG58, h’ 0058 ;20802080 A1C00018 LD SP, #h’ 00C0 ; SET STACK TO INT. “RAM”2084 A1008042 LD REG42, #h’ 8000 ; FIRST “RAM” ADDRESS EXT.2088 B24244 LDB REG44, [REG 42] ; GET DATA208B A 1026058 LD REG 58, #h’ 6002 ; DATA REGISTER OF “LCD”208F A 1006054 LD REG 54, #h’ 6000 ; COMMAND REG. OF “LCD”2093 B13852 LDB REG 52 #h’ 38 ; “LCD” FUNC. SET COMMAND2096 EF5800 LCALL CMD ; WRITE COMMAND TO “LCD”2099 B10E52 LDB REG 52, #h’ 0E ; DISPLAY CONTROL COMMAND209C EF5200 LCALL CMD209F B 10652 LDB REG 52, #h’ 06 ; “LCD” MODE COMMAND20A2 EF4C00 LCALL CMD20A5 B24244 SC2: LDB REG 44, [REG 42] ; GET ADDRESS HIGH IN 4420A8 B10152 SC1: LDB REG 52, #h’ 01 ; CLEAR DISPLAY20AB EF4300 LCALL CMD ; COMMAND TO LCD20AE EF6F00 LCALL DISPLAY ; WRITE ADDR AND DATA IN20B1 EF4C00 LCALL KBD ; SCAN AND GET A KEY20B4 994048 CMPB REG48, #h’ 40 ; IS KEYCODE> 48??20B7 DB08 JC D20B9 092C04 SHL 4, 44 ; ROTATE NIBBLE LEFT20BC 904448 ORB REG48, REG 44 ; AND JOIN WITH NEW HEX20BF 27E7 SJMP SCI20C1 994148 D: CMPB REG48, #h’ 41 ; COMPARE WITH KEY 4120C4 D705 JNE E20C6 B04344 LDB REG44, REG43 ; SET HIGH ADDRESS20C9 27DA SJMP SC220CB 994248 E: CMPB REG48, #h’ 42 ; COMPARE WITH KEY 4220CE D705 JNE F20D0 B04342 LDB REG42, REG44 ; SET LOW ADDRESS20D3 27D0 SJMP SC220D5 994448 F: CMPB REG48, #h’ 44 ; COMPARE WITH KEY 4420D8 D704 JNE P20DA 0542 DEC REG42 ; DECREMENT ADDRESS20DC 27C7 SJMP SC220DE 994748 P: CMPB REG48, #h’47 ; COMPARE WITH KEY 4720E1 D707 JNE G20E3 C64244 STB REG44, [REG42] ; STORE IN RAM &20E6 0742 INC REG42 ; INCREMENT ADDRESS20E8 27BB SJMP SC220EA 994248 G: CMPB REG48, #h’ 43 ; COMPARE IF 43 KEY20ED D70E JNE K20EF E342 BR [REG42] ; JUMP INDIRECT TO ADDR.20F1 C65452 CMD: STB REG52, [REG54] ; WRITE INTO LCD

Page 86: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2076

Addr OpCode Label Mnemonics/ CommentsAss. Directives

20F4 A1FF0556 LD REG56, #h’ 05FF ; FOR DELAYLOOP COUNT

20F8 0556 AGAIN: DEC REG5620FA D7FC JNE AGAIN20FC F0 RET20FD E7B000 K: LJMP INKEY2100 A 1005046 KBD: LD REG46, #h’ 5000 ; KEYBOARD

INPUT ADDR.2104 A24648 LD REG48, [REG46] ; READ FROM

KEYBOARD2107 3F48F6 JBS REG48, 7, KBD ; LAST LEY

RELEASED?210A EF9300 LCALL DELAY210D A24648 LOOP: LD REG48, [REG46]2110 3748F4 JBC REG48, 7, LOOP ; AWAIT A KEY

PRESSING2113 EF8A00 LCALL DELAY2116 A24648 LD REG48, [REG46] ; READ AGAIN KBD2119 3748F1 JBC REG48, 7, LOOP ; CHECK VALID KEY211C 714F48 ANDB REG48, #h’ 4F ; MASK KEY CODE

WITH 4F21 IF F0 RET2120 B04345 DISPLAY: LDB REG45, REG43 ; GET HIGH

ADDRESS2123 180445 SHRB REG45, 4 ; UPPER NIBBLE

SHIFTED2126 EF4000 LCALL ASCIIOUT ; CONVERT ASCII

AND2129 B04345 LDB REG45, REG 43 ; OUTPUT212C 710F45 ANDB REG45, #h’ 0F ; LOW NIBBLE212F EF3700 LCALL ASCIIOUT ; CONVERT &

LCD OUTPUT2132 B12045 LDB REG45, #h’ 20 ; SPACE TO FOLLOW2135 C65845 STB REG45, [REG58] ; WRITE TO

LCD DATA REG.2138 EF6500 LCALL DELAY213B B04245 LDB REG45, REG42 ; FETCH LOW

ADDRESS213E 180445 SHRB REG45, 4 ; PICK UPPER

NIBBLE2141 EF2500 LCALL ASCIIOUT ; & OUTPUT TO LCD2144 B04245 LDB REG45, REG42 ; AGAIN LOW

ADDRESS2147 710F45 ANDB REG45, #h’ 0F ; GET LOW NIBBLE214A EF1C00 LCALL ASCIIOUT214D B12045 LDB REG45, #h’ 202150 C65845 STB REG45, [REG58] ; SPACE TO FOLLOW2153 EF4A00 LCALL DELAY ; GET DATA FIELD2156 B04445 LDB REG45, REG44 ; PICK UPPER

NIBBLE2159 180445 SHRB REG45, 4 ; CONVERT AND

OUTPUT215C EFOA00 LCALL ASCIIOUT ; DATA FIELD AGAIN215F B04445 LDB REG45, REG44 ; LOW NIBBLE2162 710F45 ANDB REG45, #h’ 0F2165 EF0100 LCALL ASCIIOUT2168 F0 RET2169 990A45 ASCIIOUT: CMPB REG45, #h’ 0A ; FIND IS HEX

VALUE>A?216C D305 JNC T216E 753045 ADDB REG45, #h’ 30 ; IF LESS THAN A,

ADD 372171 276B SJMPP2173 753045 T: ADDB REG45, #h’ 30 ; FI HEX 0-9 ADD 302176 A1FF0556 LD REG56, #h’ 05FF ; FOR DELAY COUNT217A 0556 A1: DEC REG56217C D7FC JNEA1217E C65845 STB REG45, [REG58] ; WRITE INTO LDC2184 F0 RET21A0 . ORG h’ 21A021A0 A1FF0556 DELAY: LD REG56, #h’ 05FF ; DELAY COUNT21A4 0556 A2: DEC REG5621A6 D7FC JNE A221A8 F0 RET21B0 . ORG h’21B021B0 994848 INKEY: CMPB REG48, #h’ 4821B3 D702 JNEP121B5 0742 INC REG4221B7 E7EBFE P1: LJMP SC221BA21BA

—Command key and numeric key 8... to read already en-tered stored data.

Some typical software programs worked on the developmentboard which will demonstrate its proper usage:

1. Direct & Immediate register addressingThe following instructions are used for loading and storing

words. Note that the immediate data 1234 will go into registerssuch that 34 goes into even address 60 and 12 goes into oddaddress 61.Code Label Mnemonics CommentsA1 34 12 60 LD 60, #1234 ; Immediate load regrs. 60, 61

; with 1234A0 60 50 LD 50, 60 ; Load reg. 60 into reg. 50C0 70 50 ST 50,70 ; Store reg. 50 into reg. 7027 FE Here: SJMP HereThe following instructions are for loading and storing bytes.Code Mnemonics CommentsB1 AA 60 LDB 60, 0AAH ; Immediate loading reg. 60A1 60 50 LDB 50, 60 ; Load from reg. 60 into reg. 50C4 70 50 STB 50 , 70 ; Store from reg. 50 into reg. 70

2. Register Indirect addressingCode Label Mnemonics CommentsA1 AA 55 50 LD 50, #55AA ; Immediate loading of data

; into 50,51A1 50 82 60 LD 60, #8250 ; Immediate loading of data

; into 60,61C2 60 50 ST 50, (60) ; Store from 50,51 into

; address in 8250 & 8251A2 60 70 LD 70, (60) ; Load contents of 8250,8251

; into; registers 70,71

27 FE SJMP HereAfter running the above program at address 8000H, we can

reset the system and examine memory:Address Data00 70 AA00 71 55

The above are word operating instructions. The followingare byte operating instructions:Code Label Mnemonics Comments

B1 FF 50 LDB 50, #FF ; Load byte FF into reg. 50

A1 60 83 60 LD 60, # 8360 ; Load 8360 into reg. 60,61

C6 60 50 STB 50, (60) ; Store FF into memory

B2 60 70 LDB 70, (60) ; Load from memory into 70

27 FE SJMP Here

Upon examining memory after running and resetting:Address Data00 70 FF

3. Indirect Addressing with auto incrementThe following program is for block movement from one

memory area to another, in 08 words block. The source addressis 8300H, and the destination address is 8400H.Code Label Mnemonics CommentsA1 00 84 80 LD 80, #8400 ; Destination address in Reg.

; 80A1 00 83 60 LD 60, #8300 ; Source addressB1 08 50 LD 50, #08 ; words in 50A2 61 70 Read: LD 70, [60]+ ; Load [60] into 70 and

; increment; 2 bytes

Page 87: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 77

Fig. 7: Actual-size component-side track layout for the circuit of Fig. 3 except LCD and keyboard interface circuits.

Fig. 8: Solder-side track layout for the circuit mentioned in Fig. 7.

Page 88: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2078

C2 81 70 ST 70, [80]+ ; Store from 70, 71 into address; 8400 and increment

E0 50 F1 DJNZ 50, Read ; Decrement word count; register; and repeat read & store op.

27 FE Here: SJMP Here

4. Based or Indexed Addressing modeThe following is an example of short-indexed addressing.

This index can have values from -127 to +128.There is another form called long-indexed addressing. In

this a full address range indexing is possible.Code Label Mnemonics CommentsA1 20 84 50 LD REG 1, #8420H ; Reg1 IS 50

; Load word into 50,51A3 50 04 60 LD REG 2, 4 [reg1] ; Load word pointed to by

; reg. 1 + 4 into reg. 2 (60)07 50 INC REG1 ; Increment register 1A3 50 05 70 LD REG3, 5 [REG1] ; Load word pointed to

; by Reg1 +5 into Reg.; 3(70)

27 FE Here: SJMP HereLong Range Indexing:C3 51 00 10 60 ST REG2,

1000H [REG1] ; STORE Contents of; Register 2 at location; pointed to by REG1 + 1000H

5. Zero Register AddressingThere is a zero register or SRF at 0000H, which always

contains only a zero. Use of zero register addressing is depictedin the following instruction:Code Label Mnemonics CommentsA1 01 44 44 50 LD REG1 (50), ; Load reg. 1 with the con-

tents4444H [0] ; of 4444H+0H

This is just equivalent to a direct or absolute memory ad-dressing.

6. Carry and Borrow in 8098In 8098, the C flag is set if there is no borrow in either a

subtract or compare instruction.CNP 50, #55 ; Compare the contents of

; internal

TABLE VIIHSO Command Tag Format

D7 D6 D5 D4 D3 D2 D1 D0X T D I n n n nWhere X = Do not careT = Timer2/Timer1D = Set/Clear HSO pin if relevantI = Interrupt On/Offnnnn = 0 - 5 = HSO0 - HSO5nnnn = 6 = HSO0 AND HSO1nnnn = 7 = HSO2 AND HSO3nnnn = 8 - B = Software timers 8-Bnnnn = E = Reset Timer 2nnnn = F = Start ADC

Fig. 9: Component layout for the PCB of Figs 7 and 8.

Page 89: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 79

; register 50 with value 55JC exit ; If value is greater than 55,

; exit

7. Use of Conditional Jump Instructions:JUMP IF CARRY JCJUMP IF EQUAL JEJUMP IF BIT SET JBSJUMP IF BIT CLEAR JBC

The above are commonly used jump instructions which useshort jumps from –127 to +128 only. P2 EQU 10H ; Port 2 is the SFR at

; 0010H8100H 35 10 03 JBC, P2, 5, NOTADD ; If port 2 bit 5 (pin 13)

; is low, then branch; NOTADD

E7 2A 01 LJMP ADD18240H ADD1: . . . . .

Here, a long jump is taken to ADD1 if the bit No. 5 is notclear at port 2. Note that the ADD1 is at a distance given by:

8240H – 8106H = 012AHwhich is the displacement in the LJMP instruction.

A SJMP which can branch between –1023 and +1028 can beemployed if the distance is not too far. In the code itself, thepage number bit is included to allow for jumps within + or – 1K.(20-27); 20 to 23 for negative values of offset and 24 to 27 forpositive values of offset (refer Table III).

8. Indirect branch instructionA1 00 50 50 LD 50, #5000HE3 50 BR [50] ;Branches to 5000H

The above is a method of branching to the address pointed toby a register (word). Now the branching takes place indirectlythrough the word register 50.

9. Decrement and Jump instructions.There is a decrement jump (not zero instruction), which can

use any register for counting or looping.; TIME DELAY PROGRAM

8200HF2 TIME: PUSHFB1 10 80 LDB 80, #10 ; Load a register 80 with

; 10A1 FF FF 90 LOAD: LD 90, #0FFFFH ; Load word FFFF into reg.

; 9005 90 A: DEC 90D7 FC JNE AE0 80 F5 DJNZ 80, LOAD ; Decrement and jump to

; LOADF3 POPFF0 RET

The inner loop uses a word decrement operation for whichthe DJNZ cannot be employed. It works only up to FF.Like Jump, there are two Call Instuctions:SCALL for short distances -1024 to +1023LCALL for anywhere in memory (uses 3 bytes of code)

10. Multiply and Divide InstructionsThere is a three-operand instruction called MUL. It uses

two-word registers, multiplies their content and puts the prod-uct in another 32-bit register. For example:MUL IREG, WREG1, WREG2

Here let IREG equal 30H, WREG1 equal 40H, and WREG2equal 50H. The values used are supposed to be two’s comple-ment signed numbers and the result is a two’s complement 32-bit number.8000H FE 4C 50 40 30 MUL 30, 40, 50

27 FE SJMP $ ;HaltThe MULB instruction multiplies signed bytes. For example:

8000H FE 5C 50 40 30 MULB 30, 40, 50This instruction would multiply the two bytes in 40 and 50

and place the word result in 30 and 31 (low order and highorder).

The MULU instruction is meant to be used for unsignedintegers, for word operation and MULUB for byte operation.

Divide instructions available are DIV, DIVU (unsigned) forword and byte operations respectively. DIVB is for byte operation(signed) and DIVUB for unsigned division respectively. Forexample:FE 8C 40 30 DIV IREG, WREG ; Divide 32-bit integer in IREG

; by 16-bit integer in WREGHere 30 is the start address of IREG and 40 is that of

WREG. Dividend must be in 30, 31, 32, 33H; divisor in 40, 41H.and result is in 30, 31H respectively. For example:00 02 00 40... is stored in locations 32 30; (30) = 00; (31) = 40; (32) = 00;

(33) = 0200 01 . . . is stored in location 40, 41 (00 in 40 and 01 in 41)

Result after program execution is in word at location 30 as0200H, or 512. Remainder is in word at location 32 as 0 0 4 0H or 64 (dec).

Some Programs Using High-speed Output: There are sixHSO usable pins in the 8098, from HSO.0 to HSO.5. In addition,high-speed output function can also be associated with ‘Softwaretimers’ and ‘starting of A/D conversion’ at a predetermined time.

The software timer interrupt can be employed for realisingthe function of something like a darkroom stop-watch, whichcan be set to ring at a predetermined time. The followingprogram illustrates this application. It causes the LEDs of port4000H on the board to flicker at one second intervals. In usingHSO functions, the following registers of the SFR are impor-tant:

MINT ...Mask interrupt register 08HPINT ...Pending inerrupt register 09HHSOCMD ...HSO Command registerHSOTIME ...The HSO time from current time

Addr. Code Mnemonics Comments8000H FA DI ; Disable interrupt8001 B1 28 08 LDB MINT, 28H

; Bit 5 Software timer int.; Bit 3 HSO interrupt ; so 28H

8004 B0 60 50 LDB 50,60 ; Transfer 60 to 50; this is no. of interrupts/cycles

8007 B1 38 06 LED HSOCMD,#38 ; Here 38H would mean that; Timer 1 is used and; interrupt is on.; Also that software timer 8 is; used.; Refer Table VII for HSO; Command; tag format

800A 45 00 80 0A 04 ADD HSOTIM, T1, #8000H; This command loads the time reg. with

Page 90: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2080

; with a time of 65 ms later800F A1 00 40 72 LD 72, #4000H; LED Address is 4000h8013 C6 72 74 LDB 74, #00 ; 0 is stored in 74H8016 FB EI ; Enable

; interrupt801A 27 FE SJMP $ ; Other task

; (LOOP HERE)The above is the main program. The interrupt service routine

is at 200AH. In our monitor program, we have placed a jumpfrom there to RAM location at 810AH.810AH B1 38 06 LDB HSOCMD #38 ; Again replace the command 0D 45 00 80 0A 04 ADD HSOTIM, T1, #8000 ; reload the number 12 E0 50 09 DJNZ 50, RET 15 B0 60 50 LDB 50, 60 18 95 FF 74 XORB 74, #FF ; Toggle the LEDs 1B C6 72 74 STB (72), 74 1E F0 RET

Upon executing this program, the port LEDs flicker at1-second interval, if register 60 is loaded with 10H.10H x 65 ms = 16 x 65 ms = 1 sec on and 1 sec off.

HSO Pulse Generation And Measurement of PulseWidth in HSI. As an application of pulse generation using HSOand reading the pulse width using HSI, both input and outputunits are used. The main program can be any other program(multi-tasking).Addr. Code Label Mnemonics Comments8000 FA DI ; Disable interrupt8001 B1 08 08 LDB MINT, #8 ; HSO alone int. enabled8004 EF 03 03 LCALL LDCAM ; CAM LOAD Routine 07 FB EI 08 B1 01 15 LDB IOC0.1, #01 ; IOC0 = 15, Bit 0 is 1.

; enables HSI. 0 0B B1 03 03 LDB HSIMODE, #03

; 00000011 both edges to; look in the pulse

0E 36 16 FD JBC 16, 6, $ ; 16 is HSISTAT, bit 6 is; FIFO full; wait till 6 edges are; detected

11 39 06 05 JBS HSISTAT, 1, P ; Is HSI.0 = 1, then it is; positive edge

14 A0 04 70 LD 70, HSITIME ; Dummy read to omit the; negative edge

17 FD FD NOP (2) 19 A0 04 3A P: LD TIHI, HSITIM ; Read time of + edge into

; 3A 1C FD FD NOP (2) 1E A0 04 38 LD TILO, HSITIM ; Time at -ve edge into 38 21 FD FD NOP (2) 23 48 3A 38 30 SUB 30, 38, 3A ; Subtract 38-3A TO find

; pulse width 27 A1 00 40 72 LD 72, # 4000H ; Load address 2B C6 72 30 STB 30, 72 ; At 4000H into 72H

; and 2E 27 FE SJMP $ ; Loop hereHSO ISR: VECTORS FROM 2006H

HSOTIM EQU 15HHSOCMD EQU 06H

8306 EF 01 00 LCALL LDCAMF0 RET

0A B1 20 06 LDCAM: LDB HSOCMD #20h

; To set HSO.0 w/o intr. 0D 45 10 00 0A 04 ADD HSOTIM,

T1, #0010 ; Pulse time 12 FD FD NOP NOP 14 B1 10 06 LDB HSOCMD #10H

; Clear HSO with; int. enabled

17 45 15 00 0A 04 ADD HSOTIM,T1, 0015 ; Pulse low period

1C FD FD NOP NOP 1F F0 RET

This program displays the pulse width in the LED port.Pulse can also be observed on the CRO at pin HSO.0 (pin 7).

ANALOGUE DIGITAL CONVERSIONPROGRAMS

There are four channels of analogue input. Each channel gives a10-bit at a conversion time of 42 microseconds. The range ofinput voltage is 0 to 5V.

The various registers concerning A-D conversion are:A/D COMMAND . . . 02H (WRITE)A/D RESULT . . . 02H (READ)A/D RESULT . . . 02H (HIGH bits and status information)

02H = x | x | x | x | G | 2 | 1 | 0Bits 0-2 : channel number;Bit 3 : Go, convert; Go = 1 means convert now;

Go = 0, start conversion by HSO interrupt.(later at a predetermined interval).

Suppose we want conversion on analogue channel 4 (0-3 notavailable on the 8098) now.

So, enter xxxx1100 on register 02H (AD.command)Result:

03H 02HD7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D0 D19 8 7 6 5 4 3 2 1 0 x x S 2 1 0<------- analog digitised value ------> � <--ch. no-->

Status 0 = idle; 1 = busyA/D program for one channel:

8000H B1 0C 02 B: LDB ADCOM #0C ; Start now, ch. 4FD NOPFD NOPFD NOP3B O2 FD $: JBS, 3, 02h, $

A1 00 40 70 LD 70H, #4000H ; Led port addr. in 70HC6 70 03 STB 03H, (70) ; Output to LEDs27 EE SJMP B ; MS byte only

The above program takes samples and displays the mostsignificant 8 bits of the analogue value on the LED displaycontinuously.

PCB LayoutThe actual-size component-side and solder-side track layouts forthe schematic diagram of Fig. 3, except the LCD and keyboardinterfaces, are given in Figs 7 and 8 respectively. The componentlayout for the PCB is given in Fig. 9. Please note that IC8(ULN2003) is not used in PCB. If required it may be wiredexternally from connector.

Page 91: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 81

REMOTE-CONTROLLEDAUDIO PROCESSOR

USING MICROCONTROLLERVINAY CHADDHA

M ost hi-fi audio CD systemsnowadays are available withremote control. However, no such

circuit is available for adding to the AFpower amplifiers made as hobby projects.The design of such an add-on circuit alongwith remote control is presented here. Itcan be used by hobbyists as an attachmentto their audio power amplifiers.

This design is based on audio control-ler TDA7315 from SGS-THOMSON andMotorola microcontroller MC68HC705KJ1.The microcontroller, after programmingwith the specific software code for the cur-rent application, has been renamed GVC-AUD-257. Other construction projects bythe author using the same series ofmicrocontrollers, which can be referred tofor additional details, have been publishedin EFY in Jun. ’97 (Set-Top Converter)reproduced in Electronics Project Vol. 18and Caller ID project, elsewhere in thisvolume. In addition to audio controllerand microcontroller the circuit comprisesthe following standard parts that are usedin any normal system:

1. Power supply2. LED indicator panel to indicate sta-

tus/keys pressed3. Relay to switch on/off the supply to

the power amplifier or the main unitThe following parts are used in re-

mote systems for VCR, TV, etc:1. Memory (24C02).2. Remote handset with 12 keys3. IR receiver for remote operationFunctionality of these parts is explain-

ed below with reference to Figs 1 and 3.

DescriptionMemory. 24C02 is an I2C bus compatible2k-bit EEPROM, organised as 256 x 8 bits.

It can retain data for a period of more thanten years, including the current settings ofvolume, treble, balance, bass, as well as theon/off status of the main amplifier unit orthe relay status. The various audio param-eters can be stored in just six bytes.

Mains power failure is quite commonin India. This does not allow the last set-tings of volume, tone and balance to re-main intact. To overcome this themicrocontroller unit (MCU) must store allaudio settings of the user in memory(EEPROM). The memory ensures thateven after a power trip, the MCU willread the latest saved settings from theEEPROM.

Using two lines, SCL (serial clock) andSDA (serial data), the microcontroller canread and write six bytes for all the audioparameters. For more details on I2C busand memory interfacing, please refer toCaller ID construction project, elsewherein this volume.

At power ‘on,’ the last-saved audio set-tings are read by the MCU. In case memoryIC cannot be read by the microcontroller,volume LED will blink three times toindicate the problem. The possible reasonscould be either a bad memory IC, or adiscontinuity/shorting of its tracks, orimproper insertion of the IC in its socket.

Under the circumstances, the unit willstill work, but it will not remember thelast settings and will select the centrevalues of treble, balance and bass. Volumewill be set at 50 per cent of the maximumvalue and the relay will be off. Loudnessand mute will also remain in the off mode.A remote handset can be used to changethe settings as desired.

Audio controller. TDA7315 is a sin-gle-chip I2C bus-compatible audio control-ler which is used to control all functions

Semiconductors:IC1 - TDA7315 digitally controlled

audio processorIC2 - MC68HC705KJ1CP

Motorola microcontroller(GVC-AUD-257)

IC3 - 24C02 I2C serial EEPROMIC4 - 7805 fixed regulator +5VIC5 - 7809 fixed regulator +9VIC6 - µPD6121 infrared remote

controlT1,T2,T3 - BC547 npn transistorT4 - 2SC2001 npn transistorD0-D7 - Red LEDD8, D10-D11 - 1N4007 rectifier diodeD9 - 8.2V,0.5W zenerD12 - IR LED

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1,R2,R15,R16- 10-kilo-ohmR3,R4,R14 - 1-kilo-ohmR0,R5-R9,R12,R13 - 330-ohmR10,R11 - 5.6-kilo-ohmR17 - 2-ohm, 0.5WR18,R19 - 200-kilo-ohm

Capacitors:C1 - 10µF, 16V electrolyticC2-C4,C7,C19,C20 - 0.1µF ceramic discC15,C16,C9,C10,C11,C13 - 0.1µF polyesterC5,C6 - 33pF ceramic discC8 - 22µF, 25V electrolyticC12,C14 - 2.7nF polysterC17,C18 - 2.2µF, 16V electrolyticC21,C22 - 220pF ceramic discC23 - 10µF, 50V electrolytic

Miscellaneous:RL1 - 12V, 150 ohm, SPST relay

OEN Pt. No. 57DP-12-1C6XTAL - 4MHz quartz crystalY - 455kHz, ceramic resonator

- Battery 1.5V, pencil cell- IR sensor module- Remote control handset,

complete with keyboard- Connectors for audio input-

output and power supply- 12V DC, 250mA battery

eliminator

PARTS LIST

Page 92: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2082

of the audio amplifier. Stereo audio inputfrom the preamplifier is fed to the IC in-put. A microcontroller can control volume,treble, balance, bass and loudness. Allthese parameters are programmed bymicrocontroller using SCL and SDA lines,which are the same lines as used for thememory IC, as mentioned earlier. The au-dio controller reference data is given inTable I.

To program any of the parameters,the following interface protocol is usedfor sending the data from the MCU toTDA7315. The interface protocol com-prises:

• A start condition (S)• A chip address byte (80H) followed

by an acknowledgement bit (ACK)• A sequence of data bytes, with each

byte followed by an acknowledge-ment bit• A stop conditionFor explanation of start,

acknowledgment andstop conditions of I2Cprotocol, elsewhere inthis volume. A typicalmessage format, com-prising an address byteand two data bytes, isshown in Table II.

Address byte andaudio parameters ofTDA7315, showing thecoding as well as

weightage of bits representing audio pa-rameters, are shown in Table III. Forsending the address and complete func-tional parameters (six) of Table III, themicrocontroller has to send seven bytes of

Fig. 1: Schematic diagram of remote-controlled audio processor using microcontroller

Parameter ValueSupply voltage 6 to 10V DC, 9V typicallyMax input signal 2 V minimumTotal harmonic distortion 0.01 % typical, 0.1% maximumSignal-to-noise ratio 106 db typicalChannel separation 103 db @ 1 kHzVolume control 1.25 db step 0 to –78.75 dBBass and treble control 2 db step +14 to –14 dBBalance control 1.25 db step 0 to –38.75 dBMute attenuation 100 dB typical

TABLE IThe Audio Controller Reference

Page 93: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 83

data as well as start and stop conditionbits through I2C bus. The acknowledg-ment bit, after receipt of every byte, issent by the slave unit (TDA7315 in thiscase).

Details of each audio control byte arediscussed below:

Volume-control byte. Any numberfrom 00 to 63 (or 3FH) can be sent (pro-grammed). Minimum attenuation isachieved with 00H. Each increment in

number addsattenuationof 1.25 dB.

Speaker-control (L)byte. Anynumber from128 to 159(80H to 9FH)can be sent.Minimum at-tenuation forleft channelis at1 2 8 ( 8 0 H ) .

Each increment in number adds attenua-tion of 1.25 dB. The maximum attenua-tion is typically 37.5 dB.

Speaker-control (R) byte. Anynumber, from 160 to 191 (0A0H to 0BFH),can be sent. Minimum attenuation for theright channel is 160(0A0H). Each incre-ment in number adds an attenuation of1.25 dB. The maximum attenuation istypically 37.5 dB.

Loudness byte. It has only two possi-ble values. When 64(40H) is sent, it setsthe loudness on and when 70(44H) is sent,it sets the loudness off.

Bass control byte. Any number, from

TABLE IIMSB …… TDA7315 …… ADDR…… LSB MSB …… DATA……. LSB MSB…… DATA…….. LSB

S 1 0 0 0 0 0 0 0 A X X X X X X X X A X X X X X X X X A PC C CK K K

S = start condition ACK = acknowledgement P = stop condition X = any hex digit

Fig. 2(a): Software flow chart (contd.)

Fig. 2(b): Software flow chart (contd.)

TABLE IIIMSB LSB FUNCTION1 0 0 0 0 0 0 0 TDA7315 Chip address = 80H0 0 B2 B1 B0 A2 A1 A0 Volume control byte1 0 0 B1 B0 A2 A1 A0 Speaker control (L) byte1 0 1 B1 B0 A2 A1 A0 Speaker control (R) byte0 1 0 X X L X X Loudness byte0 1 1 0 C3 C2 C1 C0 Bass control byte0 1 1 1 C3 C2 C1 C0 Treble control byteBx = 10dB steps Ax = 1.25dB steps Cx = 2dB steps X = Don’t care

Page 94: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2084

from 112 to127 (70H to7FH), can besent. This canchange thetreble valuefrom 14 dBgain to 14 dBattenuation.Table IVgives thegain/attenua-tion for vari-ous values ofbass and tre-ble bytes.

Thus tohave volumeat 10 dB at-t e n u a t i o nwith perfectlyb a l a n c e dsound, i.e.both speak-ers at equallevel, loud-ness on andm a x i m u mtreble andm i n i m u mbass, themessage to besent by theMCU to theTDA7315 onthe I2C buswould be asfollows:

S T A R T -80-08-80-A0-40-78-60-STOP

(Note: Normally, in the I2C interfacedata changes state only when the SCLsignal is low. However, ‘start’ and ‘stop’are special conditions, which indicate startof I2C activity and end of I2C activityrespectively on the bus. In start condi-tion, SDA goes from high to low whenSCL is high. In a stop condition, SDAgoes from low to high when SCL is high.Refer Apr. ’99 issue of EFY for details.)

Microcontroller is programmed tocheck this IC (TDA7315) at power on. Ifthe microcontroller cannot communicatewith it through the I2C bus, it will indi-cate the error by flashing treble LED threetimes at power on. In this case audio val-ues cannot be changed as communicationbetween the microcontroller and the au-dio controller is not possible. However,other parts of the unit will still function.For instance, the remote unit can be used

to switch on and switch off the relay.Microcontroller. The function of

microcontroller is to receive commandsfrom the remote handset, program audiocontrollers as per the commands, and up-date the EEPROM if no new command isgiven from the handset for six seconds.However, for on/off and mute commands,it will update the EEPROM data immedi-ately. The delay in updating the EEPROMis provided as normally the listener willchange the value continuously till he issatisfied. The MCU will, however, nottransfer all values (from RAM toEEPROM) as and when these arechanged. Only when no key is pressed forsix seconds, will the MCU assume thatthe listener is satisfied and save the audiovalues in the EEPROM.

This 16-pin microcontroller fromMotorola (68HC705KJ1), used in thisproject, has a total of 11 I/O lines/pins.Two pins each are used for power supplyand crystal while one pin is used for resetfunction. Balance lines are available forany programming functions. Out of 11 I/O lines, eight lines are exclusively usedfor LED outputs. Relay RL1 used forswitching the mains supply to the outputpower amplifier shares the same line (PA0),which is used for STDBY LED D0 output.Two lines are used for I2C bus which areconnected both to the EEPROM as wellas the audio controller. One line (IRQ) isconnected to the IR sensor output. In fact,this pin serves the dual purpose of beingused as an interrupt as well as an inputpin whose status can be read by the MCU.The data sent from the remote handset isreceived at this pin.

The microcontroller also checks thefunctioning of the memory IC ST24C02and the audio controller IC TDA7315. If itis not able to communicate with these twoICs on the I2C bus, it flashes the volumeand treble LEDs respectively to indicatethat communication is not possible withthe respective ICs. Refer the assembly andtesting section for more details.

Remote control (Fig. 3). Remote con-trol is based on NEC µPD6121 custom-ised remote transmitter IC. This IC isalso used by a number of TV manufactur-ers. The handset sends data in a specifiedformat whenever any key is pressed onthe handset. The MCU reads the dataand decides which key has been pressed.In this project, 12 keys have been used:1. Loudness 2. Treble up3. Balance right 4. Balance left5. Bass up 6. Power on/standby

Fig. 2(c): Software flow chart (continued)

TABLE IVBass byte Treble byte Gain(+) /Attn(-)96(60H) 112(70H) -14 dB97(61H) 113(71H) -12 dB98(62H) 114(72H) -10 dB99(63H) 115(73H) -8 dB100(64H) 116(74H) -6 dB101(65H) 117(75H) -4 dB102(66H) 118(76H) -2 dB103(67H) 119(77H) 0 dB111(6FH) 127(7FH) 0 dB110(6EH) 126(7EH) +2 dB109(6DH) 125(7DH) +4 dB108(6CH) 124(7CH) +6 dB107(6BH) 123(7BH) +8 dB106(6AH) 122(7AH) +10 dB105(69H) 121(79H) +12 dB104(68H) 120(78H) +14 dB

96 to 111 (60H to 6FH), can be sent. Thiscan change the bass range from 14 dBgain to 14dB loss (attenuation).

Treble-control byte. Any number,

Page 95: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 85

7. Audio centre 8. Bass down9. Treble down 10. Mute

11. Vol up12. Voldown

Standby,l o u d n e s sand mutekeys aretoggle keys,i.e. if youpress themonce, theywill changethe currentstate. Fori n s t a n c e ,pressing thel o u d n e s skey whenloudness isalready ‘on’will cancelloudness.

Volume,treble, bal-ance andbass keysare repeatkeys. If you

press them once and keep them pressed,the selected function keeps on repeating.

For instance, if you press the vol up keyand keep it pressed, the volume will keepon increasing until it is maximum.

The audio centre key is the selectionkey. Pressing it once will cause it to setall audio parameters in centre. Pressingit again will have no further effect. It willnot cancel the audio centre mode, unlikethe standby, mute or loudness keys.

Remote handset circuit diagram issimilar to that used for the Set-Top Con-verter published in Jun. ’97 issue of EFY(reproduced in Electronics Projects Vol.18). The only difference is that one of thetwo 200 kilo-ohm resistors is nowconnected to pin 12 in place of 13 of ICµPD6121. Also, the key names aredifferent and only 12 keys are used insteadof 21 in set-top converter.

Transmission code. The remote’stransmission code consists of a ‘leaderpulse,’ ‘16-bit customer code’ and ‘16-bitdata code.’ The carrier frequency with455kHz ceramic resonator is 38 kHz (1/12f0, where f0 is resonator’s fundamental fre-quency). The code used is based on pulseposition modulation (PPM). The leaderpulse consists of a 9ms carrier waveform(w/f) followed by 4.5ms off period. A ‘logic0’ consists of 0.56ms of carrier w/f fol-

lowed by 0.56ms of off period, anda ‘logic 1’ consists of 1.125ms ofcarrier w/f followed by 1.125msof off period. Each code byte(starting with LSB) is followedby inverse code byte to give anextremely low-error rate.

The customer code (also re-ferred to as custom code) ofµPD6121 suffix G-001 can beconfigured as follows: The firstbyte (high-order byte) bits are allzeros (00000000) if no diode isplaced between K I/O pins andCCS pin (cathode towards CCS).For instance, if a diode is placedacross K I/O1 and CCS then thehigher order byte will become01000000 (starting with LSB) or02H. The low-order byte will beinverse (10111111) of the high-order byte, unless K I/O pins arepulled to Vcc. For instance, if onlypin K I/O5 is pulled high then thebit at that position only will not bereversed. Thus the low-order bytewill become 10111011 (startingwith LSB) or DD (Hex). With theabove-mentioned diode and pull-up resistor, the 16-bit custom codewould be 02DD (Hex). So, you can

Fig. 2(d): Software flow chart (continued)

Fig. 3: Schematic diagram of remote control

Page 96: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2086

figure out how the custom code for thepresent remote control circuit has beenarrived at. The key code for each key isannotated on the keys in Fig. 3. Groundingof SEL pin 7 results in bit D7 of key code tobe set to 1. Hence, key at intersection of row0 and column 0 would generate 80H as thekey code. Complete remote code table forthe present circuit configuration is givenin Table V.

IR receiver module. This is a 3-pindevice incorporating surface mount IC.Two pins are for +5V supply and groundwhile the third pin is for data output. IRreceiver module receives the data sent byremote handset, amplifies, demodulatesand converts it to MCU-compatible volt-age format and outputs it on its data out-put pin. The MCU can decode this signaland act as per the key pressed.

Relay. This relay is used to switch offthe main power amplifier circuit. Thus,when the unit is switched off from re-mote, supply to the amplifier circuit isswitched off, and this saves electricity.Only the circuit in this construction arti-cle remains active and waits for any re-mote key operation. Relay can be used tocontrol AC supply or DC supply of theamplifier as desired. This choice is left to

Fig. 4: Actual-size single-sided track layout for the schematic of Fig. 1

Fig. 5: Component layout for the PCB of Fig. 4

Page 97: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 87

the reader assembling the circuit. Relayand standby LED share the same pin fromthe microcontroller as stated earlier.

LED indicator panel. Eight LEDsare used in the circuit. Their functions are:

Standby. This LED is on when theunit is in standby mode (power amplifieroff). When this LED is on, all other LEDswill be off and all keys, except the standbykey, are rejected. Pressing the standbykey, in this state, will switch the unit on.

Mute. This LED is on when the unitis in the mute mode. Pressing the mutekey will toggle the state of LED and unit,i.e. from mute to sound or sound to mute.This LED is also switched off when theunit is in sound mode, i.e. when any keywhich changes the volume level is pressed(e.g. vol down, treble up/treble down, bassup/bass down, balance up/balance down,loudness and audio centre).

Loudness. This LED is on when theloudness mode is on. Pressing the loud-ness key will change the state of LEDand unit—from loudness on to loudnessoff or loudness off, to loudness on. Press-ing audio centre key will switch off thisLED (if on) and set the loudness off.

Audio centre. This LED (marked flat)goes on when the audio centre key ispressed. All tone parameters are set atnormal, i.e. zero-attenuation for speak-ers, with bass and treble at 0 dB (no gain/no attenuation) and loudness is switchedoff. Mute is cancelled if active. Just flatfrequency response. Volume remains un-disturbed. Changing treble/balance/bass/loudness level from the remote controllerwill switch off this LED.

Volume. This LED is on when the volup/vol down key is pressed. The LED goesoff as soon as the key is released.

Treble. This LED is on when the trebleup/treble down key is pressed. The LEDgoes off as soon as the key is released.

Bass: This LED is on when the bass up/bass down key is pressed.

Balance: This LED is on when the bal-ance left or balance right key is pressed.The LED goes off as soon as the key isreleased.

Power supply. The unit requires +5Vregulated supply for all three major com-ponents—MCU/ EEPROM/IR Sensor. Theaudio controller requires +9V for the au-dio amplifier section. Supply design uses

TABLE VIIndication Possible Fault And Remedial ActionAll LEDs blink thrice but remote Micro controller OK. Check infra-red sensordoes not function connections or remote handset.No LED blinks Check supply voltage/crystal connection to MCU/pull

up resistance and capacitor at reset pin of MCU.Vol.LED blinks thrice Replace 24C02, check supply, SCL/SDA lines to 24C02Treble LED blinks thrice Replace 7315, check supply SCL/SDA lines to TDA7315Vol &Treble LED blink thrice Check pull up resistance on SDA.Replace 24C02 and

TDA7315. Check SCL and SDA lines

TABLE VRemote Code Table

Custom code 00 7EPower (PWR) 85Mute (MUT) 8FTreble up (TR+) 88Treble down (TR-) 8BBass up (B+) 81Bass down (B-) 83Volume up (VL +) 93Volume down (VL -) 97Balance left (BL) 94Balance right (BR) 90Audio centre (AC) 86Loudness 80

external +12V adaptor and two linearindustry-standard regulators, 7805 and7809. External +12V DC is also used forrelay driving. So, make sure that the adap-tor is capable of catering for the relayload easily. On full load, its voltage shouldnot drop below +11V DC.

Assembly and TestingComplete circuit comprising the MCU, thememory, the audio controller and the IRreceiver, as also the power supply circuit,is shown in Fig. 1. Actual-size, single-sidedPCB for the circuit of Fig. 1 is shown inFig. 4. The component layout for the PCBis shown in Fig. 5. No PCB is shown forremote. However, suitable pre-assembledremote control for the project is proposedto be made available to readers throughKits‘n’Spares outlet.

The circuit is very simple, having veryfew components. Before installing themain ICs for MCU, memory, audio con-troller in their sockets and soldering theIR receiver module, make sure that sup-ply voltage is correct. All parts, exceptthe audio controller, require +5V as logicsupply. The audio controller requires +9Vsupply for the audio control section. Theremote can be operated with two 1.5-voltpencil cells.

The unit has built-in diagnostics,which will make the job of testing veryeasy. Use Table VI to test the unit andidentify/rectify faults.

Software flow chartFor commercial reasons the software

for the project, which is intellectual prop-erty of the author, is not included. How-ever, logical flow charts of the softwareare given in Figs 2(a) through 2(d), whichare quite self-explanatory.

Readers Comments:❏ Can I use an IR sensor of the typeused in Philips CTV in the circuit?❏ Is it possible to add a key-pad at theprocessor board, so that it can be oper-ated even without a remote control unit?❏ Can we have PCB layout of remotetransmitter unit?❏ Could you tell me from where to getready programmed microcontroller for thecircuit?❏ Could I have addresses of vendorswho can supply development tools, hard-

ware, software, and documentation fordeveloping projects using MotorolaMC68HC705KJ1 MCU? Are there anybooks available on this microcontrollerand I2C bus technology?

Somnath BhattacharyyaCalcutta

❏ What should be put in place of thesensor module for IR sensing?❏ Where is the entire assembly of theproject to be connected in an audio sys-tem (CD system for example)?❏ How can I get data-sheet of processor

6121 (not available at Internet site ofNEC)?

Ronak ChokshiBaroda

❏ Is TDA7315, which after program-ming is renamed as GVC-AUD257,readily available in the market?❏ Is the remote set with key-pads andcabinet available with Kits‘n’Spares?❏ What is the change observed when200k resistance is connected to pin 12 orpin 13 of IC 6121 in remote control?❏ I think there is no I/O pin free in the

Page 98: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2088

microcontroller. How can functions suchas play, stop, skip for CD, and CD/TAPE/FM be performed?

Rajeesh Kr. VermaMeerut Cantt

❏ What is meant by ‘I2C bus’?❏ Is any buffer required before or afterthe processor for impedance matching?❏ Can you suggest similar control for‘deck front panel?’❏ What is the difference between crys-tal and resonator?❏ What do you mean by renaming ofprocessor as GVC-AUD257 after program-ming?

A.G. BabuLakshadweep

❏ Is the audio controller in-built withaudio power amplifier?❏ Are the left and right outputs fromaudio controller TDA7315 again fed to thepower amplifier?

Sandeep A. SalunkhePune

❏ I feel the IR receiver details are pur-posely witheld. This amounts to falselyenticing a reader to buy the magazine.

Aroon [email protected]

The author, Vinay Chaddha, replies:Mr Bhattacharyya can use IR sensor ofPhilips TV. But in this circuit it is notpossible to add local key-pad. Themicrocontroller used in this circuit haslimited number of I/O pins and memorywhich are not sufficient for adding localkeyboard routines.

The complete kit of remote control unitand programmed microcontroller may beprocured through Kits‘n’Spares.

He can download all relevant datafrom Websites of Motorola, Philips, andSGS-Thomson. Development kit formicrocontroller KJ1 is available throughMotorola’s authorised distrbutors.

Regarding Mr Chokshi’s queries, sen-sor module for IR are available from Kits‘n’Spares as well as local markets in Delhiand Mumbai. These may be available fromTV repair workshops in your city also.

This system is to be used after pream-

plifier and before power amplifier. In areadymade system, preamplifier outputsare usually marked as line output.

6121’s data-sheets are available withEFY.

(The data-sheets comprise 22 pages.These can be provided on payment ofRs 50 by DD (in favour of EFY Enter-prises Pvt Ltd) to cover postage and han-dling charges.

—EditorAs for Mr Verma’s questions, GVC-AUD257 is available with Kits‘n’Spares(as part of kit) and is not available inlocal market. Remote set is also availablefrom Kits‘n’Spares.

200k resistance is added for generat-ing custom code in remote handset. If cus-tom code is changed by changing resis-tance positions, the microcontroller willnot respond to the remote handset.

For additional functions, a differentmicrocontroller with more pins andmemory is required. KJ1 version cannotbe used for additional functions.

Regarding the queries of Mr Babu,some details regarding I2C bus are avail-able in the construction article by the au-thor published in April ’99 issue of EFYor elsewhere in this volume.

No special impedance matching is re-quired.

Logic tape decks specially designed andmanufactured for remote control operationsare not easily available in India. However,it is possible to use a different micro-controller with more memory and I/O pinsto control it. That is a big project whichcannot be handled through these columns.

Crystal is more accurate and expen-sive compared to resonator which is low-cost and not very reliable or accurate.

Renaming of the processor is similarto a blank audio cassette being recordedwith songs in your own voice and thenputting some specific label to indicatewhat it contains.

Mr Salunkhe may note, there is noin-built power amplifier. Separate poweramplifier is required at the output ofTDA7315.Regarding Mr Kakad's queries:The description of IR receiver moduleshave been covered in a number of EFYissues, in detail. Please go through ‘IRRemote Control’ project published in Dec.’97 (Electronics Projects Vol. 18) and Jun.’98 (Electronics Projects Vol. 19). Thesehave also been covered in Jun. ’99 circuitidea titled ‘Simple Sensitive Remote Con-trol Tester’ (elsewhere in this volume).

Such IR receiver modules manufac-tured by various firms (Sharp, Sony,Telefunken, etc) are used in most remoteTV and VCP/VCR sets and hence are nosecret. The pin configuration (positive,ground, and signal terminals) in thesemodules differ from one manufacturer tothe other. The internal block diagram ofTelefunken model IR sensor and its pinconfiguration are given in Fig. 1. One maysubstitute the IR sensor module with ICµPD1373 (used in conjunction with aphoto-diode—refer EFY May’98 or Elec-tronic Project Vol. 19). Also refer the Q/Asection following for some more informa-tion.

—Tech Editor ❏

Fig. 1 Block schematic and pin configuration of Telefunken IR sensor (Rxr) module

Page 99: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 89

SOUJUNIOR — AWIRELESS PROGRAMMABLE

CONTROL UNIT

O ne of the most exciting and ad-venturous expeditions of thiscentury was done not by a hu-

man being but by a small machine calledSoujurner. It was a kind of rover thattraversed all the ridges and grooves on aplanet whose terrain was unknown to theman of yesteryears. Well, before you be-gin to think that a science fiction story isgoing to be told, the author would like toenlighten you about the relevance ofSoujurner to this project, Soujunior.

The basic technology of Soujurner, asall technicians might know, consists of areceiver unit that receives signals or com-mands from humans on earth and ex-ecutes the instructions on the remoteplanet. It also has an on-board microproc-essor which helps it to take decisions onits own, in environments that are alien tohuman kind. In this project a similar con-cept is used. Although it would not be ascomplex as the Rover, it serves its pur-pose.

DescriptionThis project basically consists of thefollowing modules (refer block diagram ofFig. 1).

1. A PC from which information istransmitted to the control unit wirelessly,using either IR or RF beam.

2. An 8085 control unit receives thesignals serially and executes the instruc-tions after it receives the execute com-mand from the PC. The microprocessor

board may be replaced bya conventional 8085 kit,but the port addresseshave to be modified in thesoftware accordingly.

3. An IR or a RF link.Here an IR link has beenused to reduce the com-plexity of the project. Butwith FM transmittersand receivers being eas-ily available in the mar-ket, all one has to do isto connect the FM trans-mitter in the final output stage at therespective ends.

8085 microprocessor-based controlunit. As we all know, the 8085 micro-processor is intrinsically an 8-bit micro-processor, but it is more than sufficientfor real-time applications where rugged-ness is a more important parameter thanspeed and complexity. The device has 40pins, and there is no need to discuss thesignificance of each pin on the IC as it isreadily available in any microprocessorhandbook. But one significant pin whichmany of us do not use much on the kits isthe SID pin 5. It is the serial input datapin that can be used to get data seriallyinto the microprocessor at the desired rate.There is also a complementary SOD pin 4(not used here) which is used as serialdata output pin. The SID line is used byusing a software instruction called RIMin the 8085 assembly mnemonic. The demosystem here is not an interrupt driven

one, al-though itrequiresonly as l i g h tmodifica-

T. GAUTHAM KUMAR

Fig. 1: Block diagram of Soujunior

Fig. 2: 8255 control word register

Fig. 3: PC-transmitter interface

tion in the software to convert it into aninterrupt driven one.

Interfacing of the 8085 to the exter-nal world has been done using 8255 chip(programmable peripheral interface orPPI) which is present on most of the 8085kits. The 8255 IC consists of 4 ports (portA, port B, port C, and a control port orregister). Ports A through C can beconfigured to operate as either input oroutput ports depending on our require-

Page 100: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2090

ments. This isachieved bywriting a controlword into thecontrol register.Here, in thisproject, all thethree ports havebeen configuredas output portsas no input datais required to bereceived via8255. All thethree ports couldbe used to con-trol external de-vices or move-ments. Controlword can beformed with thehelp of Fig. 2.Serial input datais envisaged tobe received di-rectly via SIDpin of 8085.

All the in-s t r u c t i o n s —starting fromthe initialisa-tion of the 8085,8255 to acquir-ing of input datafrom the SIDline, storing, ar-ranging, and in-terpreting of thed a t a — a r estored in theEPROM (such as 2764 or 27128) of the8085 kit as monitor program. The tempo-rary data, which may keep varying, can-not be stored in the EPROM and hencethe same is stored in a RAM (such as62256) chip of the 8085 kit. RAM loca-tions have been used to store the data/instructions received via the SID line forlater execution. The instructions that arereceived from the central control unit (thePC in this case) are stored in a queue,and when the execute instruction is re-ceived from the PC, the 8085 processor ofthe kit starts execution of the instruc-tions on a FIFX (first in first execute)basis.

The 8085 kit also contains necessaryaddress selection circuitry to allocaterange of addresses for memory devices(RAM/EPROM) and input-output devices(e.g. 8255 and keyboard decoder IC) on

the kit. These can normally be found inthe documentation of the kit.

OperationFollowing are the memory and input-out-put device addresses (for 8085 controlunit) used in this project:Memory Mapped AddressesEPROM address range : 0000 to 3FFFHRAM address range : 4000 to BFFFHInput-output Addresses8255 port A : - 00H8255 port B : - 01H8255 port C : - 02H8255 control register : - 03H

Transmitter interface (Fig. 3). Thetransmitter-end hardware used for inter-facing to the PC in this project comprisesan IR transmitter. It basically consists ofa 555 IC, which modulates the IR beam

at 38 kHz as the IR receiver is sensitiveto that frequency.

Pin 3 of the parallel port correspond-ing to data bit D1 of port 378H has beenused for outputting the serial data. Thespeed selected is 100 bps (bit durationof 10 ms), and this can be easily in-creased with modification in the soft-ware part alone.

Reset pin 4 of IC 555 has been usedto control the 555 output via pin 3 of theparallel port as mentioned already.

When reset pin goes high, a 40kHz modu-lated IR beam is transmitted, while thereis no transmission when the reset pin islow.

The protocol used for communicationconsists of a start bit (accomplishedthrough software) followed by four databits that carry the instruction to the re-mote receiver. The transmitter (and re-ceiver) end waveforms at various pins ofNE555 are shown in Fig. 5.

Receiver interface (Fig. 4). The re-ceiver-end hardware interface consists ofan IR receiver module followed by a high-input-impedance-emitter-follower circuitto prevent overloading. The output fromthe emitter-follower is then directly con-nected to the SID pin of 8085 on the kit.The output of the IR module, when thereis no IR beam, is high, and vice versa.

The software monitor program in the

Fig. 4: Receiver-8085 kit interface

TABLE IKey Binary Code Screen Display Decimal Eqlnt. OfPre- Transmitted Binary Values Displayedssed by LEDs At Receiver

(8085) End on ExecutionAfter Start Bit (1) Sequence to be executed

a 1010 A 0001 0011 0101 1, 3, 5 (sequentially)b 0110 B 0010 0100 0110 2, 4, 6c 1110 C 1111 1110 1101 15, 14, 13d 1100 D 1100 1011 1010 12, 11, 10e 1000 E 0111 1000 1001 7, 8, 9x 0100 Executing Instructions !! Not Applicable

Press Any Key to continue!

Page 101: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 91

8085 kit continuously scans the SID line.When it detects a low signal it identifies itas the start bit. The first instruction bit isscanned after a delay of 15 ms, i.e. at themiddle position of the first data bit. Theremaining three data bits are like-wisescanned after 10ms delay so that the scan-ning is done at the middle position of eachbit. An instruction sequence comprising astart bit 1 followed by binary bits 0010, asavailable on SID pin of 8085, is graphi-cally depicted in Fig. 5. (The logic level oftransmitted data is complement of the dataat SID pin).

It then stores the instruction compris-ing four bits in sequential RAM addresses.

The rearranging of the seri-ally acquired data bits is donebefore it is stored in the RAMas a 4-bit data, i.e. the serialdata is converted into paral-lel data format.

Finally, when it receivesthe 4-bit ‘execute’ instruction,it starts executing theinstructions that have previ-ously been stored in the RAMlocations—one by one,sequentially. A unique countsequence output is used inthe program for each instruc-tion. Identical output se-quence corresponding to eachinstruction (on execution) is

made available from port A as well asport B of 8255.

The outputs PA0 through PA3 (as wellas PB0 through PB3) of 8255 have beenused here to light LEDs (LED1 to LED4and LED5 to LED8 respectively). Open-collector hex buffer/driver ICs 74LS07have been used to augment the outputdrive capability of 8255 ports.

In actual practice an 8085 control unitmay not be required. But when the deviceto be controlled at the receiver end re-quires some intelligence of its own (suchas a robot), a microprocessor board in-cluding on-board RAM, ROM, and PPIfacilities is essentially required. Such a

Fig. 5: Waveforms at transmitter and receiver end

Semiconductors:IC1 - NE555 timerIC2,IC3 - 74LS07 hex buffers/driversT1 - BC107 npn transistorIR LED1,IR LED2 - SE303A, SE307, or

equivalent infrared lightemitting diode

LED1- LED8 - Red LEDs

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1 - 47-kilo-ohmR2 - 56-kilo-ohmR3 - 22-ohm, 0.5WR4, R6-R13 - 100-ohmR5 - 1-meg-ohmR14-R21 - 330-ohm x 8 SIP resistor

network (RNW)

Capacitors:C1 - 220pF ceramicC2 - 0.1µF ceramic

Miscellaneous:TSOP 1738 - IR receiver module

(38KHz)- Male/female mating

connectors for 25-pin ‘D’ ofparallel PC port and 8255O/P port of 8085 kit

- 8085 kit with 8255 PPI

PARTS LIST

control unit could be used even for a morecomplex process.

As 8085 kits including RAM, ROM/EPROM, and 8255 PPI are economicallyavailable in the market.

SoftwareThe source code for the software at thePC end and at the receiver end is givenbelow. The former software is written in‘Turbo C’ while the latter software, to bestored in the EPROM of 8085 kit, is writ-ten in 8085 Assembly language.

The PC-end software is interactive.When you run the program on the PC, itprints the the following message on thecomputer screen:

Enter Instruction key!In response, you are required to enter

any one of the letters from ‘a’ through ‘e,’or ‘x’. While letters ‘a’ through ‘e’ are tobe used for different instructions, letter‘x’ is used for prompting the execution ofthe previously entered instructions.

The binary codes transmitted in re-sponse to depression of each of theabovementioned letters on the keyboard,together with messages printed on thescreen, are summarised in Table I. Thelast column indicates the LEDs at outputof register A and register B of 8255 at8085 kit end which will sequentially lightup as a result of execution of specific in-

Fig. 6: Actual-size, single-side PCB layout for Fig. 3 and 4

Fig. 7: Component layout for the PCB

Page 102: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2092

#include <dos.h>#include <stdio.h>#include <conio.h>#include <graphics.h>void main(){int gd=DETECT,gm;int keyp,seqp;char c;initgraph(&gd,&gm,“”);outtextxy(20,20,“Enter Instruction Key!”);outtextxy(400,20,“Sequence to be Exectuted:”);keyp=seqp=40;c=getch();while(c!=’q’){ if(c==’a’)

{outtextxy(20,keyp,“A”);outtextxy(400,seqp,“0001 0011 0101");keyp=keyp+15;seqp=seqp+15;outp(0x378,2);delay(10);outp(0x378,2);delay(10);outp(0x378,0); /*1010*/delay(10);outp(0x378,2);delay(10);outp(0x378,0);}

if(c==’b’){outtextxy(20,keyp,“B”);outtextxy(400,seqp,“0010 0100 0110”);keyp=keyp+15;seqp=seqp+15;outp(0x378,2);delay(10);

outp(0x378,0);delay(10);outp(0x378,2); /*0110*/delay(10);outp(0x378,2);delay(10);outp(0x378,0);}

if(c==’c’){outtextxy(20,keyp,“C”);outtextxy(400,seqp,“1111 1110 1101”);keyp=keyp+15;seqp=seqp+15;outp(0x378,2);delay(10);outp(0x378,2);delay(10);outp(0x378,2); /*1110*/delay(10);outp(0x378,2);delay(10);outp(0x378,0);}

if(c==’d’){outtextxy(20,keyp,“D”);outtextxy(400,seqp,“1100 1011 1010”);keyp=keyp+15;seqp=seqp+15;outp(0x378,2);delay(10);outp(0x378,2);delay(10);outp(0x378,2); /*1100*/delay(10);outp(0x378,0);delay(10);outp(0x378,0);}

if(c==’e’){outtextxy(20,keyp,“E”);outtextxy(400,seqp,“0111 1000 1001”);keyp=keyp+15;seqp=seqp+15;outp(0x378,2);delay(10);outp(0x378,2);delay(10);outp(0x378,0); /*1000*/delay(10);outp(0x378,0);delay(10);outp(0x378,0);}if(c==’x’){outp(0x378,2);delay(10);outp(0x378,0);delay(10);outp(0x378,2); /*0100*/delay(10);outp(0x378,0);delay(10);outp(0x378,0);outtextxy(150,240,“Executing Instructions!!”);outtextxy(150,260,“Press Any Key to Continue!”);getch();setfillstyle(SOLID_FILL,0);bar(0,30,640,480);keyp=seqp=40;}

c=getch(); }}

Transmitter-end ‘C’ Listing

structions.The receiver end monitor software

starts with initialisation of stack at ad-dress 47FFH and configuration of 8255with control word 80H (all registers inoutput mode). The RAM location 4900Hinitialised to 0 is used as a counter forstoring the number of instructions re-ceived prior to receipt of ‘execute’ com-mand, while the RAM locations starting

4801H are used for storing the actualinstructions.

The program continuously scans theSID pin for receipt of start bit (causingSID pin to go low). If start bit is received,it scans for the next bit after a delay of 15ms, and thereafter a delay of 10 ms forthe next bit, until all four bits are scanned.

The four bits so received are properlyarranged and checked to find out if it is

an instruction or execution command. Ifit is an instruction, the same is stored.All instructions are like-wise stored in se-quential RAM locations starting with4801H. If it is ‘execute’ command, thestored instructions are sequentially ex-ecuted by branching to specific sub-rou-tine for each instruction. Each specificroutine here lights different LEDs as perthe last column of Table I.

CREG EQU 03H ; 8255 Control Reg; Addr

PRTA EQU 00H ; 8255 Port AddrPRTB EQU 01HPRTC EQU 02HSTACKEQU 47FFH ; Stack addr in 62256

; On ResetORG 0000HJMP 0060HORG 0060H

; Initialisation Procedure

INITS: DI ; Disabling InterruptsLXI SP,STACK; Initialising StackMVI A,80HOUT CREG ; Setting CReg Value

LXI H,4900HMVI M,0LXI H,4801HPUSH H

SCAN: RIM ; Scanning for Start BitANI 80HJNZ SCANCALL DELAY1MVI C,4HMVI B,0H

READ: RIM ; Reading Data via SIDANI 80HJZ ONE

ZERO: STC ; When Zero is Received

CMCMOV A,BRALMOV B,APUSH BCALL DELAYPOP BDCR CJNZ READJMP INTERPRET

ONE: STC ; When One is ReceivedMOV A,BRALMOV B,APUSH BCALL DELAYPOP B

Receiver-end 8085 Assembly Language Listing

Page 103: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 93

Readers Comments:❑ Please answer the following queriesregarding this circuit:

1. Should we cover the receiver mod-ule during reception as it receives only indark?

2. Can we use FM receiver instead ofthe receiver module?

3. Did LEDs in your transmitter andreceiver circuit glow? During our demo,LEDs in the transmitter and receiver didnot glow.

4. Using CRO, we confirmed the trans-

mitter circuit to be in working condition.But we don’t know how to check the re-ceiver circuit.

5. We used Microsoft kit and port ad-dress 41h for Port A, 42h for Port B, and43h for Port C. Is there any possibility oferror due to this address usage?

K.R. AnuradhaThrough e-mail

EFY: IR receiver module receives in day-light too, so it need not be covered. We haveused IR receiver module during testing andit worked satisfactorily. FM receiver is not

to be used. LEDs did glow in our prototype.As mentioned in the text, output pin of

the IR receiver module should be ‘high’when there is no IR transmission. It shouldgo ‘low’ when a modulated IR beam falls onit. Please check if you have used correct pinconnections in the module and whether themodule’s frequency matches with transmit-ter’s modulating frequency.

If you have used a different kit, youhave to change the port addresses (togetherwith control word register address) in thereceiver-end program. ❑

DCR CJNZ READ

INTERPRET:MOV A,B ;Interpreting ReceivedCPI 0AH ;DataJZ STORECPI 06HJZ STORECPI 0EHJZ STORECPI 0CHJZ STORECPI 08HJZ STORECPI 04HJZ EXECJMP SCAN

STORE:POP H ;Storing Received DataMOV M,A ;in RAMINX HPUSH HLXI H,4900HINR MJMP SCAN

EXEC: LXI H,4900H ; When ExecuteMOV C,M ; Command is ReceivedLXI H,4801H

EXECUTE:MOV A,M ; Execution ProcedurePUSH HPUSH BCPI 0AHJZ EX1CPI 06HJZ EX2CPI 0EHJZ EX3CPI 0CHJZ EX4CPI 08HJZ EX5

SUB: POP BPOP HINX HDCR C

JNZ EXECUTEMVI A,0HOUT PRTAOUT PRTB ;Resetting O/P andLXI H,4900H ;Memory for new DataMVI M,0LXI H,4801HPUSH HJMP SCAN

EX1: MVI A,1H ;Exec 1 Seq = 1,3,5

OUT PRTAOUT PRTBCALL DEL2SMVI A,3HOUT PRTAOUT PRTBCALL DEL2SMVI A,5HOUT PRTAOUT PRTBCALL DEL2SJMP SUB

EX2: MVI A,2H ;Exec 2 Seq = 2,4,6OUT PRTAOUT PRTBCALL DEL2SMVI A,4HOUT PRTAOUT PRTBCALL DEL2SMVI A,6HOUT PRTAOUT PRTBCALL DEL2SJMP SUB

EX3: MVI A,0FH ;Exec 3 Seq = 15,14,13OUT PRTAOUT PRTBCALL DEL2SMVI A,0EHOUT PRTAOUT PRTBCALL DEL2SMVI A,0DHOUT PRTAOUT PRTBCALL DEL2SJMP SUB

EX4: MVI A,0CH ;Exec 4 Seq = 12,11,10OUT PRTAOUT PRTBCALL DEL2SMVI A,0BHOUT PRTAOUT PRTBCALL DEL2SMVI A,0AHOUT PRTAOUT PRTBCALL DEL2SJMP SUB

EX5: MVI A,7H ;Exec 5 Seq = 7,8,9OUT PRTAOUT PRTBCALL DEL2SMVI A,8H

OUT PRTAOUT PRTBCALL DEL2SMVI A,9HOUT PRTAOUT PRTBCALL DEL2SJMP SUB

DELAY1:MVI C,7H ;Delay 1 = 15ms

DEL1: MVI B,64HDEL2: NOP

NOPNOPANI 3HORI 4HPUSH BPOP BSTA 4920HDCR BJNZ DEL2DCR CJNZ DEL1RET

DELAY:MVI C,4H ;Delay 2 = 10msDELS1: MVI B,64HDELS2: MVI A,8H

NOPNOPANI 3HORI 4HPUSH BPOP BSTA 4920HDCR BJNZ DELS2DCR CJNZ DELS1RET

DEL2S: MVI C,0B6H ;Delay 3 = 2SecsDEL2S1:MVI B,0FFHDEL2S2: PUSH B

POP BSTA 4920HSTA 4920HPUSH BPOP BSTA 4920HPUSH BPOP BSTA 4920HDCR BJNZ DEL2S2DCR CJNZ DEL2S1RETEND

Page 104: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2094

50Hz SINEWAVEINVERTER

USING MOSFETs

At present, most uninterruptiblepower supply (UPS) systemsavailable in the market provide

square wave output, which is unsuitablefor powering those equipment which haverotating machinery such as induction mo-tors and blowers. Also, for computer sys-tems, which make use of linear power sup-plies (for maintaining lower noise levels),square wave input results in higher noiselevel.

Sine wave (230V AC at 50 Hz) in-verter is the ideal choice for poweringdevices such as EPABX, cordless phone,medical electronics equipment and evenTV, VCR, or computer etc, during mainsfailure. Circuit of such an inverter, usingMOSFETs in the final power amplifierstage, is presented here.

The CircuitAn RC coupled oscillator has been cho-sen for developing the gate drive for thefinal MOSFET power amplifier circuit (re-fer Fig. 2) as it is inherently stable. There

are two basic configurations: high passand low pass.

The low pass type is generally pre-ferred because the feedback network at-tenuates harmonics of the fundamentalfrequency, resulting in purer sine waveoutput. Accordingly, the low frequencymodel has been adopted here, which hasresistors in the series arm and capacitorsin the parallel arms. The applicable for-mulas for the given configuration are:

(a) Frequency

where C denotes shunt arm capaci-tance and R the series arm resistance val-ues.

(b) Minimum required current gain =56 [in common emitter configuration – forsustaining oscillations]

In Fig. 2, R = R1 = R2 = R3 = 22 kilo-ohm and C=C1=C2=C3=0.47µF provide afrequency of approximately 50 Hz.

As amplitude of sine wave output fromtransistor T1 is quite low, it is amplifiedby transistors T2 and T3. The collector

load for transistorT3 is a 9-volttransistor radio’sdriver trans-former. CapacitorC7 (10µF) wastest selected forthe optimumpulse shape andamplitude (18Vp e a k - t o - p e a kacross primary).The value of ca-pacitor C7 woulddepend upon thedriver trans-former used, as

R.V. DHEKALE

PARTS LISTSemiconductors:T1,T2,T3 - BC548 npn transistorT4,T5,T6,T7 - BC549 npn transistorT8,T9 - IRF250, n-channel power

MOSFETD1,D2 - 1N4007 rectifier diodeD3,D4 - 12V, 1W zener diode

Resistors (all ¼-watt, ± 5% carbon, unlessstated otherwise):R1-R3,R5,R8 - 22-kilo-ohmR4,R12 - 4.7-kilo-ohmR6,R10 - 68-kilo-ohmR7,R23,R24 - 470-ohmR9 - 92-kilo-ohmR11,R19,R20 - 100-ohmR13,R14 - 1-kilo-ohmR15,R17 - 15-kilo-ohmR16,R18 - 1.5-kilo-ohmR21,R22 - 10-kilo-ohmVR1,VR2 - 4.7 kilo-ohm potCapacitors:C1,C2,C3 - 0.47µ, 25V tantalumC4,C6 - 1µF, 25V electrolyticC5,C8 - 100µF, 16V electrolyticC7 - 10µF, 25V electrolyticC9,C10 - 0.1µF polysterC11,C12 - 47µF, 25V electrolyticC13* - 12 or 16µF, 440V AC,

paperC14 - 0.1µF ceramic disc

Miscellaneous:X1 - Driver transformer

(9V transistor radio type)X2* - 9V-0-9V AC, 16A

primary to 200V,0.75Asecondary transformer

- Battery 12V, 40Ah- Heat sink, mica washers- Multi-strand teflon

insulated wire, teflonwashers

- Heat sink compound

its parameters may differ widely from onemanufacturer to the other.

With this circuit, a sine wave with apeak amplitude of 6-volt across secondaryFig. 1: Oscilloscope picture of the sine wave output waveform

Page 105: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 95

230V AC is 750 mH and the calculatedvalue of capacitor is 13.5 µF. One couldpractically use a value of 12 to 16 µF(440V AC rating) to obtain a reasonablesine wave shape. The detailed specifica-tions of the power transformer X2 usedduring the actual testing of the proto-type are as follows:

Core material: CRGOCore type: 7EITongue width: 5.08 cmWindow area: 18.969 sq. cmStack height: 6.35 cmPrimary turns: 15 + 15 (bifiliar) of 12

SWGSec. turns: 345 + 22.5 + 22.5One may also use a ready-made

transformer with primary voltage speci-fication of 9V AC – 0 – 9V AC (16-ampere current rating) and a secondaryvoltage rating of 200V AC (750mA orhigher current rating). The supply forthe circuit may be taken from a single12-volt, 40Ah battery, which is adequatefor catering to about 150-watt load formore than two hours in the absence ofmains supply. Higher ampere-hour bat-teries could be used for obtaining longerstandby capacity/period. Circuit for floatcharger is not included as the same canbe adopted from several of batterycharger circuits published in EFY maga-zine off and on.

Suitable actual-size, single-sided PCBfor the circuit of Fig. 2 is given in Fig. 4.The component layout for the PCB isshown in Fig. 5. All components, withthe exception of MOSFETs are accom-modated on the PCB. The two MOSFETs,are to be mounted on appropriate heatsink. A single heat sink may be used butthe MOSFETs may be insulated fromthe heat sink using mica insulators and

Fig.

2: C

ompl

ete

circ

uit d

iagr

am o

f 50H

z si

ne w

ave

inve

rter

of driver transformer could be observedduring testing of the prototype. Phasesplitting (1800) of the output across sec-ondary of driver transformer takes placebecause of transformer action. The centretap of secondary winding of transformerX1 is connected to positive rails via 4.7-kilo-ohm resistor R12 while the two endsare connected to amplifiers comprisingtransistors T4 and T5 for raising the levelof the input 50Hz signal to around 10-

volt peak.The 50 Hz

sine wave out-put from tran-sistor amplifi-ers T4 and T5are applied tothe gates ofMOSFETs T8and T9(IRF250) viaemitter follow-ers (T6 andT7), protectivediodes (D1 andD2), currentlimiting resis-tors (R23 andR240), andgate protectingzeners (D3 andD4).

D u r i n geach half cycle,only one of thetwo MOSFETsconducts anddrives currentthrough half ofthe primarywindings ofoutput trans-former X2 (inopposite direc-tions). Thus al-ternating cur-rent flowsthrough theprimary (andso also throughsecondary) oftransformerX2. PotmetersVR1 and VR2have been pro-vided for vary-ing the basedrive for tran-sistors T4 andT5, so as to ob-

tain equal gate drives for MOSFETs T8and T9 respectively.

The value of capacitor C13 acrossthe secondary windings of transformerX2 (shown separately in Fig. 3) is sochosen that it resonates with the sec-ondary inductance at the 50Hzfrequency to maintain the output wave-form as close to a sine wave as possible.The measured value of secondary induc-tance across terminals marked 0 and Fig. 3: Transformer X2 details

Page 106: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2096

Fig. 4: Actual-size single-sided PCB layout for 50Hz sinewave inverter

Fig. 5: Component layout for the PCB of Fig. 3

Fig. 6: Wiring diagram showing interconnectionsbetween different parts of the inverter

Readers Comments:❑ The author is requested to clear myfollowing doubts.

1. To drive 600W load, a transformerof 9-0-9V, 50A primary to 230V, 4A sec-ondary rating was used. How is the trans-former rating for this load decided? If thereis any formula, please mention the same.

2. On what factor does the number ofMOSFETs connected in the circuit de-pend? (e.g. 5+5, 1+1, etc)

3. With 600W load, how long can afully charged battery work?

4. How can we run 3-phase inductionmotor using this circuit?

V.S. NaraGuldgudd

The author, R.V. Dhekale, replies:In reply to Mr Nara’s letter I would

like to say:1. For the inverter a transformer of 9-

0-9V, 50A is used since the supply volt-age for the transformer is 12 volts

Input Power = 12 x 50 = 600 wattsOutput Power = 230 x 2.6 = 600 wattsSecondary current rating can be con-

sidered as 2.6 amp, but sometimes outputvoltage may rise to 260V. In order to tol-erate the additional secondary current, 4amp rating is considered.

2. For 150 watts, 1+1 IRF250MOSFETs are required. This means cur-rent Id through each MOSFET with sup-ply of 12 volts is:

i.e. 4+4 MOSFETs are required.Additional 4+4 MOSFETs can be used,

since as the number of MOSFETs in-creases, the heat radiated by theMOSFETs decreases.

3. For 600-watt load, with supply of12V, the supply current Ip is:

This means a battery of 12V, 105 amphour can be used for 2 hours.

For three-phase motor it is necessaryto have three outputs with 120 phase dif-ference between any two outputs.

secured using either teflon screws/nutsor appropriate teflon washers, ensuringthat the drain/body is not shorted to theheat sink. Also use heat sink compoundbetween the MOSFET body and micainsulator as well as between mica insu-lator and the heat sink. Precaution byway of shorting all three terminals ofMOSFETs together, using a thin copperstrand and soldering them together, maybe taken when the item is being handledduring assembly. Remove this shortingonly after the assembly and completewiring is over.

Fig. 6 shows the wiring diagram ofdifferent parts of the inverter. Multi-strand teflon insulated wires of suitablecurrent handling capacity should be usedfor extending the connections from bat-tery as well as transformer X2 to theMOSFET terminals. The PCB (withoutMOSFETs) should be fully tested beforeconnecting the final gate outputs to theMOSFETs. ❑

Page 107: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 97

AN 8085 MICROPROCESSORKIT FOR INSTRUCTORS

The course on microprocessors inmost electronic engineering insti-tutions begins with Intel 8085. The

main reasons are that it is easy to under-stand, can be taught at any level—schoolor college—and covers all the essentialfeatures of any general-purpose micropro-cessor. The blackboard teaching for thismicroprocessor must be supplemented byboth practical training on circuit assem-bly and testing, as well as simple exer-cises comprising elementary programs forgaining confidence in the use of 8085 in-struction set. Although many commercialtrainer kits are available in the market,with each one possessing certain uniquefeatures, for the purpose of gaining prac-tical knowledge, one should wire up a cir-cuit board himself. Amongst others, aninstructor should invariably do so beforeembarking on teaching or writing textsfor microprocessor training classes. Hereis one such kit, which is not only compactbut also possesses certain features (neededfor teaching purposes), hitherto not avail-able in any of the commercial kits.

This kit comprises an on-board LCDdisplay module. It has a 16-character, sin-gle-line, alphanumeric display. This mod-ule has an integral microcontroller (suchas KS0066 LCD driver IC from Samsung),which easily interfaces to the 8085 kit.The module provides character display(with contrast adjustment facility), whichis a very useful feature for showing themnemonics (e.g. MVI A, etc) on its screen.Such display modules are available forabout Rs 200. The total cost of compo-nents, including LCD modules, is notlikely to exceed Rs 1500.

Software exercises involving the8085’s arithmetic and logic instructionscan be executed and directly verifiedthrough the in-built 8-bit LED port pro-

vided in this kit. This is in addition tothe LCD display which shows theaddress and data fields as well as themnemonics. The monitor program of thekit has provision for disassembly of in-structions, i.e., showing the mnemonicof the code at every location. While im-parting training, the instructor first asksthe trainee to write the codes by refer-ring to the instruction set, so that hemay get familiar with them. Subse-quently, the instructor can check andverify if the instructions are as per themnemonics using the disassembler mode(CRL +D).

The simply hexadecimal keyboard hasonly 16 key switches which make it com-pact. All commands are entered throughthe extra control (CRL) key. For example,CRL key pressed together with numerickey 1 will set the high address. Similarly,CRL + 2 keys will set the low address,while CRL + 3 keys will execute the pro-gram at the current address, and so on.Table I lists all these command instruc-tions. Incidentally, the same commandshave been used by the authors in theirbook ‘Learn toUse Microproces-sors,’ with the ex-ception of the keyfor disassembly(CRL + D).

The LCDmodule, whichhas a single-line,16-character dis-play, shows thekit’s address,

K. PADMANABHAN, S. ANANTHI & R.S. SANKARAN

data, and mnemonics in the format asdepicted in Table II.

The second row in the table shows thecharacter slot positions of the LCD mod-ule. The third row shows how the highaddress 10H, the low address 00H, andthe data 3E at that address are showntowards the left half (character positions1 to 8), while the mnemonics appear onthe right half of the display (characterpositions 9 to 16).

The kit has provision for an EPROM(a 2716 or a 2764), which is preprog-rammed with the monitor program firm-ware, given in Appendix ‘A’ as a hex dump.This occupies pages 0 to 7 only. If one fitsa EPROM 2764, there is plenty of extraspace for the instructor to load teachingprograms for demonstration to students.

There is an additional socket whichcan hold a 6264 (8k RAM) or a 2864 (8kRAM) EEPROM. EEPROM 2864 is meantfor students to try lengthy programs whichmight take few days—with the kit beingturned off in the evening after the practi-cal session. The EEPROM 2864 is pro-grammed in-situ as one enters data into

TABLE IIH. Addr. L. Addr. Data Mnemonics1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161 0 0 0 3 E M V I A

TABLE ICommand Key Usage for the LCD 8085 Kit

Keys Pressed Function(CRL + 1) Sets the high address to the value in the display(CRL + 2) Sets the low address to the value in the display(CRL + 3) Executes program at the current address in display(CRL + 4) Decrements the address by one and shows data there(CRL + 7) Stores the data into the address and increments it(CRL + 8)* Increments address only, does not store data(CRL + D) Starts to disassemble from the current address*Note: CRL + 8 combination is used for disassembly and reading the

on-board EEROM which could be programmed on the kit.

Page 108: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 2098

the EEPROM (address range 4000-7FFF).A number of programs can be accommo-dated in one such device and several stu-dents can work together on the kit—eachwith his own individual program.

The following key sequence is usedfor feeding data or program into theEEPROM:50 00 xx Set the address at 50 high and 00

low xx indicates some random datathat might be present there.

50 00 3E To enter code 3E (MVI A), one en-ters 3 and E .

50 00 3E Now (CRL + 7) keys are pressed. Thiswrites 3 E there.

50 01 xx Thereupon, after writing, the addressgets incremented by one and the data(xx) appears.

In this manner one keeps enteringdata, pressing CRL + 7 keys and continu-ing till a program is fully fed into theEEPROM. To verify the data programmedinto the EEPROM, one should not usethe CRL + 7 keys. Instead, use the CRL +8 keys.

When a beginner (student) enters aprogram (in a general kit), involvingjumps and return instructions, he usu-ally makes mistakes which lead to cor-rupt data being entered at certain loca-tions; this causes frustration and loss oftime because the student has to re-keythe entire program. This is a commonhazard during microprocessor trainingsessions. But, in this kit, which uses anEEPROM, even if a student makes mis-takes while entering, say, the jump andreturn instructions, no such alteration ofentered data takes place because theEEPROM retains the data which cannotbe altered during the execution of a pro-gram.

DescriptionThe complete circuit schematic is shownin Fig. 1. As with every 8085 circuit, thereis an address latch 74LS373 (IC2). Usingcontrol signal ALE (address latch enable),it segregates and latches the addressesA0 through A7 at its output from the AD0through AD7 lines from 8085. These ad-dress lines (A0 through A7) are routed toall the memory ICs. IC3 is used for stor-ing the monitor program. For IC3 we mayeither use a 2716 or a 2764 EPROM IC.Either of these ICs can be fitted to the 28-pin socket. The 2716 IC is inserted withthe right edge aligned to the IC socket.This IC has to be programmed with thehex data given in Appendix ‘A’ using anexternal EPROM programmer. There is aprovision for using either a 6116 RAM orFi

g. 1

: Sch

emat

ic d

iagr

am o

f 808

5 m

icro

proc

esso

r kit

Page 109: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 99

Fig. 2: Actual-size component-side track layout for the circuit of Fig. 1 Fig. 3: Actual-size solder-side track layout for the circuit of Fig. 1

a 6264 RAM in the socket for IC4.IC5 is the socket in which one can fix

an EEPROM, usually EEPROM 2864,which is a 5V programmable device. Thiscosts just around Rs 150. This is a re-

placeable part for the kit and each stu-dent can have one for his programs, whichhe or she fits into the IC5 socket andstarts working. Address decoder IC6(74LS139) decodes the address groups as

under:0000 - 1FFF Monitor EPROM space (If a 2716

is used, it would use 0000-07FFonly)

2000 - 3FFF RAM address space (If a 6116 isused, it would use 2000-27FF only)

Page 110: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20100

16 key switches. Fora detailed descrip-tion of this circuit,refer to a book called‘Learn to Use Micro-processors’ pub-lished by EFY.

The keyboarddata is read fromthe input port com-prising IC14(74LS244). The dataincludes the ‘key-pressed’ information(on D7 bit) alongwith the keycode(D0-D3) and controlkey information(D6). The keyboardcomprises 16 hexa-decimal keys (0 to 9and A to F) and alsoa separate controlkey. A Reset key,which is connectedto the reset pin 36of IC 8085, is alsofixed on this key-board.

An optionaltimer circuit is in-cluded in the kit.This is meant for ex-ercises based on ac-curate timings (oneor ten seconds), suchas generation of in-terrupts on the kitat precise timing in-tervals. With inter-rupt-based program-ming, one can runanother program inthe background.(Multi-tasking exer-cise).

IC15 (5369) pro-vides a 60Hz outputsquare wave from a3.579 MHz crystaland the CD4518(IC16) divides it by60 (note the diodefeedback) to give1Hz output. Furtherdivision by 10 usinga 7490 IC enables interrupt at 10-secondintervals. The output going to the pin 7 of8085 is differentiated by capacitor C6 andresistor R8 combination to produce a wave-form with sharp edges which causes in-

terrupt RST 7.5. Of course, for using thistimed interrupt, the instructor is requiredto teach the students how to enable theRST 7.5 interrupt and write an interrupt-driven program.

PARTS LISTSemiconductors:IC1 - 8085 microprocessorIC2 - 74LS373 octal transparent D

latchesIC3 - 2716/2764 2K/8k-byte

EPROMIC4 - 6116/6264 2K/8k-byte SRAMIC5 - 2864 8k-byte EEPROMIC6 - 74LS139 dual 2-line to 4-line

decodersIC7, IC13,IC18 - 74LS00 quad NAND gatesIC8 - 74LS02 quad NOR gatesIC9, IC10 - 74LS75 4-bit bi-stable latchesIC11, IC12 - 74148 8-line to 3-line priority

encoderIC14 - 74LS244 octal buffers/driversIC15 - 5369 clock generatorIC16 - CD4518 dual BCD counterIC17 - 7490 decade counterIC19 - 74LS374 octal D flip-flopsD1, D2 - 1N4148 switching diodeD3-D10 - LED 4mm, red

Resistors (all ¼-watt, ± 5% carbon, unlessstated otherwise):R1-R5,R7, R9 - 1-kilo-ohmR6, R8 - 1.2-kilo-ohmR10-R17 - 220-ohmVR1 - 10-kilo-ohm pot., linear

Capacitors:C1-C3, C5 - 22pF ceramic disc.C4 - 10µF, 10V electrolyticC6 - 0.1µF ceramic disc

Miscellaneous:Xtal-1 - Crystal 4 MHzXtal-2 - Crystal 3.579 MHz

- key-switches, tactile type(N/O)- 18

- LCD display module, 16-char.X 1-line

- IC bases- bergstrip- Jumpers for bergstrip

4000 - 5FFF Additional RAM or EEPROM ad-dress space

The LCD module is wired, not as amemory, but as an input-output device.Its port address is C0H. ICs 7 and 8(74LS00 and 74LS02 respectively) are em-ployed to select this address in combina-tion with the I/O/M signal from 8085. Thesecond half of the decoder IC6 is meantfor providing select output signals for theinput-output devices. These are as under:

Keyboard input address 02 hex8-bit LED address 04 hexThe 8-LED port is energised using the

latched outputs of ICs 9 and 10 (74LS75)via current-limiting series resistors of 220ohms each.

A simple circuit, using a pair of 74148ICs (ICs 11 and 12), and IC 13 (74LS 00),provides the keyboard encoding circuit for

Fig. 4: Component layout for the PCB.

Page 111: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 101

A program for a sixteen character message display is given below:

Addr. Code Label Mnemonics Comments2000 3E 38 MVI A 38 ; 38 is LCD module function set command2002 CD 50 20 CALL COMMAND

3E 0E MVI A 0E ; Turns display on, cursor on; Replace 0E with 0F for blinking cursor; or 0C for no cursor

2007 CD 50 20 CALL COMMAND200A 3E 06 MVI A 06 ; Shift cursor right200C CD 50 00 CALL COMMAND200F 3E 80 MVI A 80 ; Address at left end (C0 is for IInd half)2011 CD 50 20 CALL COMMAND2014 3E 01 MVI A 01 ; 01 is for clearing display2016 CD 50 20 CALL COMMAND2019 C3 20 20 JMP A

2020 3E 80 A: MVIA 80 ; to set to 0 address on LCD2022 D3 C0 OUT C0 ; Write to LCD command register2024 0E 02 MVI C 02 ; for 2 lines each of 8 characters2026 11 00 21 LXI D 21 00 ; point to message table at 21002029 06 10 C: MVI B 10H ; for 16 characters202B 1A B: LDAX D ; Get first ASCII code from address202C 13 INX D ; point to next character in RAM202D 05 DCR B ; All 8 characters over?202E CD 80 00 CALL WRITE ; Writing data into register2031 C2 2B xx JNZ B2034 CD BF 00 CALL delay 10ms2037 76 HLT

ORG 2050H2050 COMMAND:2050 D3 C0 OUT C02052 CD BF 00 CALL delay 10ms : refer subroutine address given ab2055 C9 RET

2080 WRITE DATA (DD RAM FILL)2080 F5 WRITE: PUSH PSW2081 DB C0 P: IN C0 ; read status register of LCD2083 E6 80 ANI 80 ; check bit D72085 C2 ,, ,, JNZ P ; wait otherwise2088 F1 POP PSW2089 D3 C1 OUT C1 ; write to DD RAM208B C9 RET

Now (45 4C 45 43 54 52 4F 4E 49 43 53) enter at 2100 onwards: The ascii codes for ‘Electronics.’ This will get displayed on the LCDmodule’s display.

Appendix ‘A’

Hex Dump of 8085 Monitor Program for the KitAddr. 0 1 2 3 4 5 6 7 8 9 A B C D E F

0000 C3 00 01 FF FF FF CD 50 01 C3 0A 01 FF FF FF FF0010 4E C3 50 00 CD BF 00 D3 C1 CD BF 00 C3 06 00 FF0020 FF FF FF FF FF FF FF FF FF FF FF0030 FF FF FF FF FF FF FF FF FF FF FF0040 CD 50 00 CD 50 01 C9 FF D3 C0 CD BF 00 C9 FF FF0050 F5 3E 38 CD 48 00 3E 0E CD 48 00 3E 06 CD 48 000060 3E 80 CD 48 00 3E 01 CD 48 00 3E 80 D3 C0 7C E60070 F0 0F 0F 0F 0F CD D0 00 CD F0 00 7C E6 0F CD D00080 00 CD F0 00 3E 20 CD F0 00 7D E6 F0 0F 0F 0F 0F0090 CD D0 00 CD F0 00 7D E6 0F CD D0 00 CD F0 00 3E00A0 20 CD F0 00 79 E6 F0 0F 0F 0F 0F CD D0 00 CD F000B0 00 79 E6 0F CD D0 00 CD F0 00 F1 C9 FF FF FF F500C0 D5 11 30 09 1B 7A B3 C2 C4 00 D1 F1 C9 FF FF FF00D0 FE 0A D2 D8 00 F6 30 C9 F6 40 D6 09 C9 3E C1 D300E0 C0 06 06 1A 13 CD F0 00 CD BF 00 05 C2 E3 00 C900F0 F5 DB C0 E6 80 C2 F1 00 F1 E6 7F D3 C1 C9 FF FF0100 31 FF 27 21 00 20 4E CD 40 00 FE 40 D2 1C 01 470110 79 17 17 17 17 E6 F0 B0 4F C3 07 01 FE 42 C2 250120 01 69 C3 06 01 FE 41 C2 2E 01 61 C3 06 01 FE 440130 C2 37 01 2B C3 06 01 FE 47 C2 41 01 71 23 C3 060140 01 FE 43 C2 70 01 3E C1 D3 C0 3E 47 CD F0 00 E90150 DB 02 B7 FA 50 01 CD BF 00 DB 02 B7 00 00 00 F20160 59 01 CD BF 00 DB 02 B7 F2 59 01 EE C0 E6 4F C9

Page 112: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20102

Addr. 0 1 2 3 4 5 6 7 8 9 A B C D E F

0170 FE 48 CA AA 01 FE 4D C2 06 01 3E 00 32 FF 27 4E0180 CD E9 01 1A B7 FA 8E 01 CD DD 00 C3 06 00 3A FF0190 27 3C 32 FF 27 13 1A B7 FA 9F 01 1B C3 88 01 3A01A0 FF 27 3C 32 FF 27 1B C3 88 01 00 C3 00 17 C2 B901B0 01 23 4E CD 00 C3 7F 01 3D 32 FF 27 23 4E CD 5001C0 00 79 E6 F0 0F 0F 0F 0F CD D0 00 F5 3E C2 D3 C001D0 F1 CD BF 00 D3 C1 CD BF 00 79 E6 0F CD D0 00 F501E0 3E C3 D3 C0 F1 C3 14 00 FF FF C5 06 00 EB 21 0001F0 00 09 09 E5 29 C1 09 01 00 02 09 EB C1 C9 FF FF

0200 4E 4F 50 20 20 20 CC D8 49 20 42 20 53 54 41 580210 20 42 49 4E 58 20 42 20 49 4E 52 20 42 20 44 43021A 52 20 42 20 CD 56 49 20 42 20 52 4C 43 20 20 200230 20 45 52 52 20 20 44 41 44 20 42 20 4C 44 41 580240 20 42 44 43 58 20 42 20 49 4E 52 20 43 20 44 430250 52 20 43 20 CD 56 49 20 43 20 52 52 43 20 20 200260 FF 45 52 52 20 20 CC D8 49 20 44 20 53 54 41 580270 20 44 49 4E 58 20 44 20 49 4E 52 20 44 20 44 430280 52 20 44 20 CD 56 49 20 44 20 52 41 4C 20 20 200290 20 45 52 52 20 20 44 41 44 20 42 20 4C 44 41 5802A0 20 44 44 43 58 20 44 20 49 4E 52 20 45 20 44 4302B0 52 20 45 20 CD 56 49 20 45 20 52 41 52 20 20 2002C0 52 49 4D 20 20 20 CC D8 49 20 48 20 D3 C8 4C 4402D0 20 20 49 4E 58 20 48 20 49 4E 52 20 48 20 44 4302E0 52 20 48 20 CD 56 49 20 48 20 44 41 41 20 20 2002F0 20 20 20 20 20 20 44 41 44 20 48 20 CC C8 4C 44

0300 20 20 44 43 58 20 48 20 49 4E 52 20 4C 20 44 430310 52 20 4C 20 CD 56 49 20 4C 20 43 4D 41 20 20 200320 53 49 4D 20 20 20 CC D8 49 20 53 50 D3 D4 41 200330 20 20 49 4E 58 20 53 50 49 4E 52 20 4D 20 44 430340 52 20 4D 20 CD 56 49 20 4D 20 53 54 43 20 20 200350 20 20 20 20 20 20 44 41 44 20 53 50 CC C4 41 200360 20 20 44 43 58 20 53 50 49 4E 52 20 41 20 44 430370 52 20 41 20 CD 56 49 20 41 20 43 4D 43 20 20 200380 4D 4F 56 20 42 42 4D 4F 56 20 42 43 4D 4F 56 200390 42 44 4D 4F 56 20 42 45 4D 4F 56 20 42 48 4D 4F03A0 56 20 42 4C 4D 4F 56 20 42 4D 4D 4F 56 20 42 4103B0 4D 4F 56 20 43 42 4D 4F 56 20 43 43 4D 4F 56 2003C0 43 44 4D 4F 56 20 43 45 4D 4F 56 20 43 48 4D 4F03D0 56 20 43 4C 4D 4F 56 20 43 4D 4D 4F 56 20 43 4103E0 4D 4F 56 20 44 42 4D 4F 56 20 44 43 4D 4F 56 2003F0 44 44 4D 4F 56 20 44 45 4D 4F 56 20 44 48 4D 4F

0400 56 20 44 4C 4D 4F 56 20 44 4D 4D 4F 56 20 44 410410 4D 4F 56 20 45 42 4D 4F 56 20 45 43 4D 4F 56 200420 45 44 4D 4F 56 20 45 45 4D 4F 56 20 45 48 4D 4F0430 56 20 45 4C 4D 4F 56 20 45 4D 4D 4F 56 20 45 410440 4D 4F 56 20 48 42 4D 4F 56 20 48 43 4D 4F 56 200450 48 44 4D 4F 56 20 48 45 4D 4F 56 20 48 48 4D 4F0460 56 20 48 4C 4D 4F 56 20 48 4D 4D 4F 56 20 48 410470 4D 4F 56 20 4C 42 4D 4F 56 20 4C 43 4D 4F 56 200480 4C 44 4D 4F 56 20 4C 45 4D 4F 56 20 4C 48 4D 4F0490 56 20 4C 4C 4D 4F 56 20 4C 4D 4D 4F 56 20 4C 4104A0 4D 4F 56 20 4D 42 4D 4F 56 20 4D 43 4D 4F 56 2004B0 4D 44 4D 4F 56 20 4D 45 4D 4F 56 20 4D 48 4D 4F04C0 56 20 4D 4C 48 4C 54 20 20 20 4D 4F 56 20 4D 4104D0 4D 4F 56 20 41 42 4D 4F 56 20 41 43 4D 4F 56 2004E0 41 44 4D 4F 56 20 41 45 4D 4F 56 20 41 48 4D 4F04F0 56 20 41 4C 4D 4F 56 20 41 4D 4D 4F 56 20 41 41

0500 41 44 44 20 42 20 41 44 44 20 43 20 41 44 44 200510 44 20 41 44 44 20 45 20 41 44 44 20 48 20 41 440520 44 20 4C 20 41 44 44 20 4D 20 41 44 44 20 41 200530 41 44 43 20 42 20 41 44 43 20 43 20 41 44 43 200540 44 20 41 44 43 20 45 20 41 44 43 20 48 20 41 440550 43 20 4C 20 41 44 43 20 4D 20 41 44 43 20 41 200560 53 55 42 20 42 20 53 55 42 20 43 20 53 55 42 200570 44 20 53 55 42 20 45 20 53 55 42 20 48 20 53 550580 42 20 4C 20 53 55 42 20 4D 20 53 55 42 20 41 200590 53 42 42 20 42 20 53 42 42 20 43 20 53 42 42 2005A0 44 20 53 42 42 20 45 20 53 42 42 20 48 20 53 4205B0 42 20 4C 20 53 42 42 20 4D 20 53 42 42 20 41 2005C0 41 4E 41 20 42 20 41 4E 41 20 43 20 41 4E 41 2005D0 44 20 41 4E 41 20 45 20 41 4E 41 20 48 20 41 4E05E0 41 20 4C 20 41 4E 41 20 4D 20 41 4E 41 20 41 2005F0 58 52 41 20 42 20 58 52 41 20 43 20 58 52 41 20

Page 113: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 103

0600 44 20 58 52 41 20 45 20 58 52 41 20 48 20 58 520610 41 20 4C 20 58 52 41 20 4D 20 58 52 41 20 41 200620 4F 52 41 20 42 20 4F 52 41 20 43 20 4F 52 41 200630 44 20 4F 52 41 20 45 20 4F 52 41 20 48 20 4F 520640 41 20 4C 20 4F 52 41 20 4D 20 4F 52 41 20 41 200650 43 4D 50 20 42 20 43 4D 50 20 43 20 43 4D 50 200660 44 20 43 4D 50 20 45 20 43 4D 50 20 48 20 43 4D0670 50 20 4C 20 43 4D 50 20 4D 20 43 4D 50 20 41 200680 52 4E 5A 20 20 20 50 4F 50 20 42 20 CA DE 5A 200690 20 20 CA CD 50 20 20 20 C3 CE 5A 20 20 20 50 5506A0 53 48 20 42 C1 44 49 20 20 20 52 53 54 20 30 2006B0 52 5A 20 20 20 20 52 45 54 20 20 20 CA DA 20 2006C0 20 20 20 20 20 20 20 20 C3 DA 20 20 20 20 C3 C1

IC18 (74LS00) is used for decodingport address 80H. This additional addresscan be used for external add-on boards,such as the 8255 board, etc, which theinstructor could use suitably for training.Alternatively, there is an additional 8-bitlatch provided on the kit, using a 74LS374(IC19) which can give eight latched out-puts. These can be wired to LEDs or othercontrols, using external hardware, suchas stepper motor, etc for exercise pur-poses. This IC 19 need not be fitted if anexternal 8255 add-on board is used.

The LCD module is fitted on a single-line IC strip base having 16 pins (to ca-ter for 14 as well as 15/16-pin modules).The LCD module has edge fingers with2.54mm pitch as applicable for DIP ICs.One has to solder berg-pins into the holeson the edge fingers and thereby makethe LCD module fit snugly onto thesingle-line IC strip holder provided on thePCB.

The LCD module connections areshown in the circuit diagram. There is acontrast control which is connected to thepin 3 of the module. A 10k potentiometeron board is used for adjusting the con-trast. Pins 1 and 2 of the LCD module arefor +5V and ground respectively. For moredetails of the LCD module, readers mayrefer to the LCD module description inthe author’s article ‘8098 DevelopmentBoard’ published elsewhere in this vol-ume.

A double-sided PCB is required for

proper accommodation of the complete cir-cuit, including the LCD display module ona single board. The actual-size component-side and solder-side track lay-outs for thecircuit of Fig. 1 are given in Figs 2 and 3respectively. The component lay-out forthe PCB is given in Fig. 4.

Using the DisassemblerThe kit’s monitor program includes the8085 disassembler. This enables one tocheck programs with the mnemonics. Thestudent first enters the code of his pro-gram, as usual, by entering them one af-ter another into the memory area. Forinstance, if he writes his program at ad-dress 5000 onwards (into the EEROM foradding two bytes (47 and 28 for instance)as under:

50 00 3E50 01 4750 02 C650 03 2850 04 2750 05 D350 06 0450 07 76After the entry is over, the address is

set back at 5000, and then CRL +D keysare pressed.

The display then shows:50 00 3E MVI AThen CRL + 8 keys are repeatedly

pressed to see the disassembled listing asunder:50 00 3E MVI A ; Move into accumulator the50 01 47 47 ; value 4750 02 C6 ADI ; Add with immediately

; following value of50 03 28 28 ; 2850 04 27 DAA ; Decimal adjust accumulator50 05 D3 OUT ; Output to50 06 04 4 ; port address 4 for the 8

single LEDs on kit50 07 76 HLT ; Halt program.

Upon execution of the program, itis verified on LEDs panel (in BCDformat) as:

0 1 1 1 0 1 0 1 .... i.e. 75In the above program, the instructor

should ask the student to enter 00 (theNOP or no-operation instruction) at ad-dress 5004 and re-execute the program.The display on the 8-LED panel wouldshow:

0 1 1 0 1 1 1 1 ... i.e. 6FHe could then proceed to explain the

use and working of DAA instruction, etc.

ConclusionA kit with the abovementioned featureshas been found to be very useful for freshstudents to learn about microprocessors.The use of LCD display has its advan-tages as one could show some simple elec-trical symbols and graphics, includingwaveforms, on its display (refer Fig. 5).The following addresses in the firmwareEPROM contain several LCD module-based routines which an instructor or aprogrammer may make use of. By suit-ably calling these routines, useful pro-grams can be prepared.Sub-routine Start addressTime-delay for 10 ms 00 BFInitialisation of the LCD 00 40Keyboard input routine 01 50Write to display and shift (H,L,C) 00 50Write LCD command register 00 48Writing to DD RAM of LCD 00 F0Long-delay routine 00 E8

Fig. 5: LCD display showing symbols/graphics

Fig. 6: A prototype kit developed by authors

Page 114: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20104

Readers Comments:❑ I request the author to reply to thefollowing queries:

1. How to write an interrupt drivenprogram while running another programin the background?

2. How to display formulae, wave-forms, and electric symbols on the LCDdisplay?

3. For what purpose are SIP1, SIP2,SIP3, and SIGS connectors provided? Howcan they be interfaced with external hard-ware?

4. In our lab. we have a kit with a 26-pin FRC connector. How can these con-nectors (SIP1…SIP3), having 8-pins (8 I/Olines), be interfaced with hardware inour lab?

5. What is the port address of IC19(74LS374), and what will be the port ad-dress if we use an external add-on boardhaving an 8255 PPI, and where is thisboard to be connected?

6. How to add an 8255 in this kit forparallel interfacing, and how can this kitbe used in serial I/O mode?

7. In hex dump (Appendix ‘A’),row 0020 and 0030 have some datamissing. Please check and confirm theirintegrity.

8. In which format do we have towrite hex dump? You have mentionedthat plenty of space is available toload teaching programs if we use 2764EEPROM. What type of programs can

be loaded?9. Can we display time in this kit by

using external hardware (IC 5387) orthrough a software program?

D. SelvarajChennai

The author K. Padmanabhan replies:1. This is described at pages 49-50

pages ‘Learning to Use Microprocessor’(LUM) book published by EFY. You canwrite a main program. For example,a running display and the interrupt serv-ice program can be doing event-countingby looking at the signals on the interruptpin.

2. The LCD display module hasthe facility to display some graphiccharacters which can be user-defined.These are well described in the LCD mod-ule's datasheets (available through manu-facturers). Since this article was meantfor teachers, we did not giveeverything very elaborately, and justhinted on the possiblities, giving someexamples.

3. The various signals pins from the8085 for external use are:SIG1 - SOD - Serial output dataSIG2 - SID - Serial input dataSIG3 - READY - Ready inputSIG4 - SIG7 - The four interrupt inputs

Regarding usage of SIG and SOD, youmay refer LUM Book pages 44-45. Theready pin can be used when we want to‘hold’ the processor. Please read the Z-80

Programmer article in Sept ’99 issue,where such a provision is made to extendthe memory cycle to a longer time neededfor programming an EPROM. For usageof interrupt pins, you may again refer theLUM book.

4. Connector types are immaterial—the connection has to be makde, that isall. For normal use of the kit, these exter-nal pins are not connected to anything atall. Simple switches, a slow-going 555timer working on 5V supply and an LEDwith series resistor of 220-ohm are allthat may be required to demonstrate thefunctions of SID, interrupt pins, etc by ateacher.

5. The port address of 74LS374 is 80H.You may connect an external 8255 board,such as the one given in Chapter VI ofthe LUM Book, using the same address80H line (connected to pin 11 of 74LS374)as chip select input for the 8255.

6. Please refer Chapter VI of LUMbook.

7. Missing data is FF only.8. The collection of codes in sequence

is tested program is the hex dump. Anyprogram which you may find useful forteaching, say an 8-bit×8-bit multiplica-tion, a 16-bit by 8-bit division, etc, can beloaded.

9. Please see Appendix ‘A’ in LUMbook and alter the display routine for LCDdisplay as suggested in the article.

Page 115: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 105

MULTICHANNELCODE LOCK SYSTEM

The circuit presented here is a code-based electronic locking system tocontrol the operation of several ap-

pliances.The circuit uses a three-digit decimal

coding system for operating any appliance.Thus, for each appliance a unique three-digit code, from numbers 101 to 999, isselected.

Although this circuit can be used tocontrol as many as 999 appliances, for thesake of simplicity, the operation of justthree appliances is being shown here. Ad-ditional appliances, if required, can bewired via the 10-pin connectors providedin the circuit. For the operation of eachappliance, a manually-operated appliance-specific toggle switch is turned on prior tothe selection of the appliance code.

The code selection is done throughthree push-to-on switches, with each oneassociated with a specific digit. The se-lected number is displayed on three 7-segment displays for a short duration. Onselection of any appliance, the countersand the displays are automatically reset.However, the selected appliance stays ondue to latching action of the relay, througha pair of its own contacts. A fresh selec-tion is accompanied by a short-durationmusical note. Arrangement for manualresetting of the counters and displays isalso included.

The circuitThe circuit consists of a 555 timer (IC1)which is wired as an astable multivibratorwith 50 per cent duty cycle and a clock-period of one second. The output of IC1 isused as clock for CD4033 decade countercum display driver ICs (IC2 through IC4)and CD4017 Johnson ring counter ICs(IC5 through IC7). In fact, the clock to

the pairs, formed by IC2 plus IC5, IC3plus IC6, and IC4 plus IC7, is routed viapush-to-on switches S1, S2, and S3respectively. The three sets (eachcomprising a CD4033, a CD4017, and a 7-digit display) function independently withthe reset pin 15 of all CD4017 and CD4033ICs tied together. On reset, only the Y0outputs of the ring counter ICs (CD4017)are high, while all other outputs (Y1through Y9) are low. At this instant, theoutput of all CD4033 counters would alsocorrespond to zero count and thus thedisplay would show 000.

When the first clock pulse is applied toany of the CD4017-CD4033 pairs, the highoutput of CD4017 shifts from Y0 to Y1. Atthe same time the count on its pairedCD4033 advances from zero to one andthe corresponding seven-segment alsodisplays 1. For the second clock pulse, thehigh level shifts to Y2 output, the count onthe paired CD4033 increments by onecount, and the corresponding display shows2. The count can be incremented by amaximum of nine clock cycles when Y9output goes high and the correspondingdisplay also shows 9. On the next clock(tenth), the Y0 output again goes high andthe display also shows 0. Thereafter, thecycle repeats itself.

The outputs of ICs CD4017 (IC5through IC7) are connected to the inputsof three 3-input AND gates N1, N2, andN3 inside IC8 (CD4073). Depending uponthe desired code for any given appliance’soperation, one can make correspondingconnections from the outputs of CD4017ICs to the AND gate used for controllingthe operation of the specific appliance. Forexample, if you want code for appliance 1to be 794, then connect output Y7 of IC5,Y9 of IC6 and Y4 of IC7 to the inputs ofAND gate N1. The output of gate N1 is

VIJAY D. SATHE

Semiconductors:IC1, IC10 - NE555 timerIC2-IC4 - CD4033 decade counter, 7-

segment decoder anddriver

IC5-IC7 - CD4017 decade ringcounter

IC8 - CD4073 triple 3-inputAND gate

IC9 - ULN2003 high-currentDarlington driver

IC11 - UM66 musical tonegenerator

T1 - BC548 npn transistorD1-D5 - IN4007 rectifier diodeD6 - 3.1V zener diodeLED1-LED3 - Green LEDsDIS.1-DIS.3 - LT543, 7-segment

common cathode display

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1-R2 - 22-kilo-ohmR3-R23,R26-R28 - 1-kilo-ohmR24 - 100-kilo-ohmR25 - 100-ohm

Capacitors:C1 - 0.1µF, 10V polysterC1 - 33µF, 25V electrolyticC2, C4, C5 - 0.01µF ceramic discC3 - 47µF, 25V electrolytic

Miscellaneous:Xtal - 3.579545 MHz crystalS1-S3 - Push-to-on switchS4 - SPDT changeover switchS5-S7 - Simple on/off switchRL1-RL3 - 6V, 100-ohm DPDT relayRL4 - 6V, 100-ohm SPDT relay

- Bergstrip male/femaleconnectors

PARTS LIST

connected for control of appliance number1 through high-current Darlington arrayIC ULN2003 (input pin 2 and output pin15) to DPDT relay RL1. When relay RL1energises, assuming switch S5 is in on po-sition, the relay gets latched as it receivesthe positive supply via the switch andground via one of its N/O contacts. Thus,once an appliance is operated after its cor-

Page 116: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20106

responding switch and codehave been correctly selected, itcan be switched off manuallyby flipping its correspondingswitch (S5, S6, or S7) to offposition.

Similarly, for control ofother appliances, outputs ofAND gates N2 and N3 are con-nected to input pins 3 and 4 ofrelay driver IC ULN2003, andits output pins 14 and 13 areconnected to relays RL2 andRL3 respectively. Externalfree-wheeling diodes are notrequired across relay coils be-cause they are built within theULN2003 IC itself.

The circuit incorporatesautomatic reset arrangement.The outputs of all AND gatesare connected in a wired-ORfashion to pin 1 of ULN2003IC by making use of diodesD2 through D4. Thus, whenthe output of any AND gategoes high, pin number 1 of IC9also goes high. This causes itspin 16 to go low and energiseRL4, which, in turn, causesthe positive supply rail to beextended to the common resetline of all counter ICs (IC2through IC7). Once thecounters get reset, the ANDgates’ output drops low andRL4 is de-energised. Simulta-neously, the display alsoreturns to show 000, since thecounters have been reset. Re-setting of the counters and dis-play does not, however, affectthe operation of any appliancebecause of the latching actionof the relay, as explainedabove.

Also, when the circuit isreset automatically, as ex-plained above, it produces amusical tone for about five sec-onds to indicate that some ap-pliance has been switched on.As mentioned earlier, pin 16 ofULN2003 goes low momentar-ily to automatically reset thecounters through operation ofrelay RL4. The high-to-low-go-ing transition at pin 16 ofULN2003 is also passed to trig-ger pin 2 of timer IC NE555(IC10) which is configured hereFi

g. 1

: Sch

emat

ic c

ircu

it d

iagr

am o

f a m

ulti

chan

nel c

ode

lock

sys

tem

Page 117: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 107

as a five-second monostable flip-flop. Theoutput of IC10 is connected to musicaltone generator IC UM66 (IC11), whichgenerates a musical tone for the five-secondduration of monostable pulse output.

The code is entered using push-to-on

Fig. 2: Actual-size, single-sided PCB layout for circuit of Fig. 1

Fig. 3: Component layout for PCB of Fig. 2

switches S1, S2, and S3. In case wrongcode gets entered, you can re-enter thecorrect code after resetting the circuitmanually, by pressing reset switch S4.During manual resetting, the system willnot produce any musical note. During re-

set a logic high level is applied to the pin15 of all counter and counter/seven-seg-ment driver ICs. In normal case thesereset pins are at a logic-low state.

The circuit shows the connection ofthree appliances having codes 794, 969,and 337 respectively. To operate the firstappliance, reset the counters by pressingswitch S4 momentarily. Flip switch S5 toon position. Now press switch S1 so thatclock pulses are applied to IC2 and IC5pair, and they start counting. Releaseswitch S1 as soon as DIS.1 displays digitseven. Similarly, press switches S2 andS3 for second and third digits of the code.The other two devices can also be oper-ated similarly.

For control of additional appliances,just add additional AND gates, ULN2003Darlington arrays, relays, and switches.Do not forget to connect all AND gates’outputs to pin 1 of IC9 via diodes for auto-matic resetting operation. The inputs foradditional AND gates can be obtained fromthe outputs of CD4017 ICs terminated onconnectors as shown in the schematicdiagram of Fig. 1. Since these CMOSdevices have a high fan-out capability(about 50 devices), you can connect eachoutput to a large number of AND gateswithout degrading their performance. Eachdevice is to be allocated a unique codebetween 001 and 999 (decimal). If youdesire to expand the code, you may do soby just adding the sets comprising ICsCD4017, CD4033, and a seven-segmentdisplay. The AND gates used should havethe same input (or greater) capacity as thenumber of sets/digits.

The actual-size, single-sided PCBlayout for the schematic circuit of Fig. 1 isgiven in Fig. 2. Please note that the PCBdoes not contain IC8, IC9, and theconnected relays/components. These canbe assembled on general-purpose PCBs asper the number of appliances to be con-trolled by the user. The required pointshave been brought out on Bergstrip con-nectors. The component layout for PCB isgiven in Fig. 3.

Readers Comments:❑ The display runs continuously from 0to 9, without stopping. I have assembledthe circuit on a self-etched PCB.

Rakesh P. PatilThane

The author, Vijay D. Sathe, replies:Mr Patil should check the tracks of thepush-to-on switches S1, S2, and S3—theymay be shorted. He may remove the 555circuit from the system and use the cir-

cuit given in Fig. 1 for switching purposes.To enter the code 794, switch S1 shouldbe pressed seven times, S2 nine times,and S3 four times.

Page 118: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20108

AUTOMATIC INDUCTIONMOTOR STARTER

WITH PROGRAMMABLE TIMER

Induction motors are popular due totheir low-cost, sturdy construction,fast pick-up, low maintenance ex-

penditure and good efficiency. The DOL(direct-on-line) starters and star/deltastarters used for starting and running ofinduction motors provide coarse type ofprotections against voltage fluctuationsand single phasing. Induction motors arevery sensitive to low voltage and singlephasing during which they draw a heavycurrent and can burn out unless switchedoff within few seconds of occurrence ofsuch conditions. This makes the require-ment of a sensitive protective device ab-solutely essential to avoid burning of in-duction motors under such conditions.

The circuit of an automatic starter,incorporating the important features givenbelow, is described here. It is meant to beused in conjunction with a DOL starter.

1. Under-voltage and over-voltagecutout.

2. Single phasing prevention.3. Automatic start on resumption of

proper conditions.4. 24-hour programmable off timer

(on completion of actual run-time of themotor).

5. Specially suited for remote opera-tion of induction motor.

6. Simple, easy to construct, and low-cost.

The circuitAs the circuit being described is requiredto be used with a DOL starter, the inter-nal diagram of the same is given in Fig.1. The three phases (R, Y, and B) enter-ing the starter are passed via fuses F1,F2, and F3. The current rating of the fuses

would depend on contactor and motor cur-rent ratings. The three phases from theDOL starter are extended to the auto-matic starter circuit of Fig. 2 via pointsmarked R’, Y’, and B’. The other pointswhich are to be extended to Fig. 2 aremarked C through F. All the pointsmarked identically in Figs 1 and 2 are tobe connected together.

Functions of switches and relays.To understand the circuit operation, it isessential to know the effect of switchesS1 through S6 and contacts of relays RL1and RL2 in on and off conditions. Theseare discussed below.

When switches S1 and S2 are off, onlymanual operation of the DOL starter,

ARTHUR LOUIS

without protections offered by the circuitof Fig. 2, is possible. The C and D pointsare shorted (via switch S1 in off position)whereas E and F points remain open. Inthis state, relay contacts have no effecton the DOL starter operation. The motorcan be switched on by momentaryoperation of start switch S6 (green button).Please note that red (R) phase is alwaysconnected to one side of the EM (electro-magnetic) coil of contactor. The blue (B)phase gets extended to the other side ofcontactor coil through switch S6 (indepressed state), normally made contactsof stop switch S5 (red button) and shortedC and D points (via switch S1 in offposition). Once the contactor coil is

Fig. 1: Internal wiring diagram of a typical DOL starter

Page 119: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 109

energised, it is latched viaits own contact marked ‘5’and closed dry run pointsD1 and D2 to provide alter-nate path for B phase to thecontactor coil. All threephases (R, Y, and B) areextended to the inductionmotor via the closed con-tacts of the contactor, andthe motor runs.

When switch S1 is onand switch S2 is off, the red(R) phase connection totransformer X1 is through,while yellow (Y) phase is al-ready connected to bottomend of transformer X2. Inthis state, sensing circuitand B-Y phase detector cir-cuits of Fig. 2 are effective.If all phases are availableand voltages are withinproper limits, relay RL1 willget energised (as explainedlater in the text) to closecontacts C and D. However,contacts E and F remainopen irrespective of thestate of relay RL2 (contactsof relay RL2 come in paral-lel with the contacts of startswitch, provided switch S2is on). Thus in this condi-tion, although safety cir-cuits are functional, autostarting is not feasible.Manual start button S6 hasto be pressed for startingthe induction motor. Thismode of operation is termedhere as mode 1.

When switches S1 andS2 are both on, then thesensing circuit (for under/over voltages and singlephasing) as well as autostart circuits are opera-tional. The effect of switchS1 and relay RL1 has al-ready been explained above.Relay RL2, which remainson for a short while (as ex-plained later in the text),along with energisation ofrelay RL1, acts in the sameway as momentary depres-sion of start switch S6 toprovide auto start/ restartfacility when 3-phasevoltages are within limits.Fi

g. 2

: Sch

emat

ic d

iagr

am o

f aut

omat

ic in

duct

ion

mot

or s

tart

er

Page 120: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20110

This is termed here as mode 2 operation.Switch S3 is used for automatic

switching off of the induction motor afterit has operated for a preprogrammed pe-riod selected with the help of rotary switchS4. During mode 1 (switch 1 on and switch2 off) operation when switch 3 is on, theinduction motor will be switched off whenprogrammed on-time is completed orwhenever power fails. However, afterpower resumes (and if all phase voltagesare within limits), the motor can be re-started with the help of start switchmanually, provided the programmedperiod is not over. During mode 2 (bothswitches S1 and S2 on) operation if switchS3 is on, the motor will keep restartingautomatically whenever power resumes

(or all 3-phase voltages become alright)until the programmed running period isover.

Power supply. The power supply forthe schematic circuit of Fig. 2 is derivedfrom R and Y phases, using two mainstransformers with primary voltage ratingof 230V AC connected in series across itthrough DPDT slide switch S1. Their sec-ondaries rated at 6V-0-6V AC, 200mA arealso connected in series to realise 12V-0-12V output across rectifier diodes D1 andD2, connected as full-wave rectifiers. Theoutput of rectifier, after some smoothingby capacitor C1, is used for the purpose ofsampling of under/over voltage conditions.The output across capacitor C1, after pass-ing through diode D3, is further filtered

by capacitor C3 before regulation by 9-volt regulator 7809 (IC1). The regulatedoutput of IC1 regulator is used forpowering the entire circuit. No heat sinkis required for regulator 7809.

Note: When two transformers (X1 andX2) are used in this fashion, the AC out-put voltage should be checked after con-necting the secondaries of both transform-ers in series. If no voltage is present acrossanodes of diodes D1 and D2 then eitherprimary or secondary connections needbe reversed (but not both).

Under/over voltage cutout. This sec-tion comprises an 8-pin dual comparatorLM393N (IC3) in DIL (dual-in-line) pack-age. The output of the two comparators(at pins 1 and 7) has been combined in awired-OR fashion . This output is high aslong as sampled voltages being monitoredare within preset limits. When sampledvoltages are out of limits, the wired-ORoutput goes low.

Here IC2(a) is used as over-voltagedetector, while IC2(b) is used as under-voltage detector. The 4.2V developedacross zener D4 is used as reference volt-age for both the comparators. Thepotmeter VR1 is so adjusted that whenthe phase-to-phase (R-Y) input voltageacross primary of transformer (X1 and X2combined) is less than a specific desiredlevel (say 350V RMS), the voltage at itswiper contact goes less than 4.2 volts.Thus, the output of comparator IC2(b) andalso the wired-OR output goes low,irrespective of output of comparatorIC2(a). Similarly, potmeter VR2 is so ad-justed that when the voltage between R-Y phases exceeds certain desired value(say 480V AC RMS), the voltage at itswiper contact goes higher than 4.2 volts,and the output of comparator IC2(a) goeslow. Thus, we observe that whenever theR-Y phase-to-phase voltages are beyondacceptable limits, the output of compara-tor goes low to switch off the motor aftera delay of four seconds, as explained inthe following section.

On/off time delay. The popularNE555 timer is so configured as to pro-vide an on-time delay of 12 seconds afterall conditions are suitable (i.e. all 3 phasesare present and the phase-to-phasevoltages are also within limits). If all con-ditions are alright (at the time of start—with slide switch S1 in on position), ca-pacitor C4 will be charged via resistorsR2 and R4 which would take about 12seconds to make pin 2 of 555 high, so thatits output (at pin 3) goes low to cut off

Fig. 4: Component layout for the PCB

Fig. 3: Actual-size, single-sided PCB layout for the circuit

Page 121: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 111

transistor T3. As a result, base of transis-tor T4 gets forward biased via resistor R9(and R13) to energise relay RL1 to shortpoints C and D (refer Figs 1 and 2)through its contacts, and energisecontactor in the DOL starter of Fig. 1 viathe start switch (in pressed state) or dueto energisation of relay RL2 for shortduration with switch S2 on (explanationcovered under ‘Auto start unit’ sub-heading). Thus, motor starts after an on-time delay of 12 seconds.

When comparator IC2 senses under-voltage or over-voltage condition, its out-put goes low and capacitor C4 dischargesvia resistance R4. This will take about

four seconds before it causes pin 2 of IC3to go low or its output to go high, whichin turn causes de-energisation of relayRL1 to eventually switch off the motor.This is the off-time delay which allowsthe motor not to switch off if the voltagereturns to normal state within this 4-second period. If the voltage does not re-turn to normal state within this periodthen only the motor is switched off. Thisavoids unnecessary switching off of themotor during momentary voltage fluctua-tions.

Single-phase cutout. When a singlephase failure occurs, the motor will con-tinue to run on remaining two phases,drawing heavy load current. This wouldresult in overheating of windings and itseventual burning in a short time if it is notdisconnected. The single-phase cutout cir-cuit employed here is very simple and ithas the capability to sense all three phases,including low voltage condition of phaseB. Sensing of under-voltage and over-volt-age condition of R and Y phases is alreadytaking place, as described earlier.

Phase failure of R and/or Y phase(s)results in no supply to the circuit andrelays RL1 and RL2 will be in de-ener-gised state and the motor is, therefore,switched off. In Y-B single phase detectorpart of the circuit, the diode D12 in Yphase path rectifies the voltage before po-tential divider network, comprising resis-tors R16 and R17, reduces the voltagewith respect to phase B. Capacitor C7smooths the voltage across resistor R17.If this voltage is greater than 27V, zenerD11 as well as the diode inside opto-cou-pler IC4 will conduct. As a result, base oftransistor T2 is pulled to ground and it iscut off. This causes the comparator outputto be applied to pin 2 of timer NE555without any change (modification). But incase the B-phase voltage is very low, or ifit is missing altogether, transistor T2 willbe biased to saturation condition, dis-charging capacitor C4 via resistor R5. Asa result, pin 2 of timer 555 would go lowimmediately and eventually switches offrelay RL1 to cut off the contactor in DOLstarter as well as the motor.

Auto start unit. The necessity of autostart unit has, of late, increased due tofrequent power interruptions, includingsingle phasing. Many auto start units areavailable in the market. The auto startcircuit comprises the circuitry aroundrelays RL1 and RL2 (and their contacts),slide switches S1 and S2, and the DOLstarter.

During normal conditions, the out-put of timer NE555 will initially go highfor 12 seconds on resumption of poweror when normal state is reached. Thecapacitor C6 will be charged through re-sistor R11. However, the base of transis-tor T5 will be held to ground potentialby diode D6, which is forward biased dueto the condition of transistor T3. As aresult, relay RL2 will be in off state dueto non-conduction of transistor T5. WhenNE555 IC changes its output state fromhigh to low after 12 seconds, diode D6will be reverse-biased due to the posi-tive voltage at anode of diode D6. Ca-pacitor C6 will get discharged via resis-tor R11 and transistor T5 will come toconduction state due to the positive volt-age at its base. As a result, relay RL2will get energised. The dischargeaction of capacitor C6 continues forabout two seconds (which is sufficient tobring the electromagnetic relay of DOLstarter to on position). Once the starterEM relay energises, it is latched as ex-plained under ‘Functions of relays andswitches’ subheading. After two seconds,the base of transistor T5 will fall toground potential and relay RL2 will beswitched off. However, relay RL1 willcontinue to be on and hold the motor inon state.

Timer. The timer is built around 14-stage CMOS counter CD 4060 which hasan on-chip oscillator. The timing compo-nent, comprising resistor R24 and capaci-tor C8, is selected to get an approximateoff-time delay of 20 minutes at Q7, 45minutes at Q8, 1.5 hours at Q9, 3 hoursat Q10, 6 hours at Q11, 12 hours at Q12,and 24 hours at Q13 output. The timer isnot affected by power cuts as it is pro-vided with a backup, using a 9V, PP3battery. The timer function comes intoplay when switch S3 is flipped to on posi-tion.

When power fails, transistor T6 willcut off due to absence of any forward biasvoltage at its base. This forward biasesdiode D14, which makes pin 11 of thecounter high and the counter suspendsfurther counting. When power resumes,the counter proceeds further and the timecount is thus not lost. The same thingoccurs when an unhealthy condition ofline is detected. Pin 3 of timer 555 goeshigh and diode D13 causes suspension ofcounting. When the final count is reached,the corresponding output pin of IC5 goeshigh. The IC5 output is coupled to pin 11via diode D12 to suspend the counting. At

Semiconductors:IC1 - 7809 fixed regulator +9 voltsIC2 - LM393 voltage comparatorIC3 - NE555 timerIC4 - CD4060 14-stage ripple

counter/oscillatorIC5 - MC2TE opto-couplerT2,T3 - BC547 npn transistorT4,T5,T6 - 2N2222 switching transistorD1-D3,D5-D10,D12-D16 - 1N4007 rectifier diodeD4 - 4.2V, 0.5W zenerD11 - 27V, 0.5W zenerLED1-LED3 - Coloured LED

Resistors (all ¼ W, ± 5% carbon, unlessstated otherwise):R1,R5,R8-R10,R12R15,R18,R21 - 1-kilo-ohmR2,R22 - 22-kilo-ohmR3,R7,R19,R20,R25 - 10-kilo-ohmR4 - 47-kilo-ohmR6 - 220-kilo-ohmR11,R14 - 4.7-kilo-ohmR15 - 470-kilo-ohmR16,R17 - 47-kilo-ohm, 1WR22 - 22-kilo-ohmR23 - 1-mega-ohmR24 - 100-kilo-ohmR26 - 22-kilo-ohm, 1WVR1,VR2 - 4.7-kilo-ohm potmeter

Capacitors:C1,C8 - 47µF, 25V electrolyticC2 - 1000µF, 25V electrolyticC3 - 470µF, 16V electrolyticC4 - 100µF, 16V electrolyticC5 - 0.01µF ceramic discC6 - 220µF, 16V electrolyticC7 - 4.7µF, 63V electrolyticC9 - 0.1µF ceramic discC10 - 4.7µF, 25V electrolytic

Miscellaneous:LED1 - Yellow LEDRL1,RL2 - 9V, 150-ohm, SPST relayS1,S2,S3 - Slide switches DPDTX1,X2 - 250V primary to 6V-0-6V,

200 mA sec. transformer- Battery PP9V

S4 - Rotary switch single-pole7-throws

- DOL starter (refer Fig. 1for details)

- Bergstrip connectors-male/female

PARTS LIST

Page 122: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20112

the same time this high output is alsoconnected to the base of transistor T3,which starts conducting and takes thebase of transistor T4 to cut-off. As a resultrelay RL1 de-energises to switch off themotor.

To set the counter timing, firstset the value of time by rotary switch S4and then flip switch S3 on to start thetimer. To reset the timer push switch S3

to off and then switch it on again.LED indicators. LED1, when on, in-

dicates that switch S1 is on and R-Y phasesupplies and 9V output from the regulatorIC1 are available. LED2, when on, indi-cates that relay RL1 has energised. LED3is on when switch S3 is on and 9V supplyfrom IC1 for timer is available.

An actual-size, single-sided PCB forthe circuit of Fig. 2 is shown in Fig. 3.

The component layout for the PCB is givenin Fig. 4. All switches, relays, and trans-formers are to be mounted externally. Asthe B-Y phase detector circuit containshigh voltages, it is recommended to cutout the phase detector part up to opto-coupler from the PCB and install the sameexternally. Only the output leads fromthe opto-coupler may be soldered on tothe points provided on the PCB. ❑

Page 123: Electronics Projects 20

SECTION B:

CIRCUIT IDEAS

Page 124: Electronics Projects 20
Page 125: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 115

TELEPHONE LINE VIGILANTK. UDHAYA KUMARAN (VU3GTH)

Here is a telephone line vigilantcircuit to guard against misuseof your telephone lines. It moni-

tors telephone lines round-the-clock andprovides visual as well as an audio warn-ing (when someone is using your tel-ephone lines) which can be heard any-where in the house.

Another advantage of using this cir-cuit is that one comes to know of the mis-use and snapping of the lines (due to anyreason) instantaneously, on its occurance.This enables the subscriber to take neces-sary remedial measures in proper time.Various telephone line conditions andresulting audio-visual indications avail-able from the circuit are summarised inTable I.

Even when the subscriber himself isusing his telephone (handset off-cradle)while the vigilant circuit is on, the buzzerbeeps once every 5 seconds since the vigi-lant circuit cannot distinguish betweenself-use of the subscriber lines or its mis-use by any unauthorised person. Thus toavoid unnecessary disturbance, it is ad-visable to install the vigilant unit awayfrom the phone. However, if one wishes tofit the unit near the telephone then switchS1 may be flipped to ‘off’ position to switchoff the buzzer. But remember to flip theswitch to ‘on’ position while replacing thehandset on cradle.

Irrespective of telephone line polarityat the input to the circuit, proper DC po-larity is maintained across C1 due tobridge rectifier comprising diodes D1 to D4.The DC voltage developed across capacitor

C1 is used to check telephone line condi-tion as per Table I. This circuit draws neg-ligible current from telephone line;thus when it is connected to the telephoneline, the normal telephone operation is

not affected.The circuit may be divided into two

parts. The first part comprises zener D9,transistors T1 to T4 and diode D5. It isused to verify whether telephone line loopis intact or discontinuous. The second partcomprising zener D10 and transistors T5to T10 is used to check whether telephoneline is in use (or misuse) or not.

The zener diode D9 (3.3V) conductswhen phone line loop is intact and not bro-ken. On conduction Zener D9 provides for-ward bias for transistors T1, T2 and T3 toconduct and reverse bias for T4 to cut off.As a result, green LED lights but no sound

TABLE IS. No. Telephone line Green Red Line Audio indication

condition LED LED Voltage1. Telephone line Not Lit Lit 0V Continuous sound

disconnected2. Phone line in Lit Lit 9V DC Beep, once every

use (H/S off-cradle) (approx.) 5-seconds3. Phone line not in use Lit Not Lit 48V DC No sound

(H/S on-cradle)

Page 126: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20116

Voltage variations and power cutsadversely affect various equipment such as TVs, VCRs, music

systems and refrigerators. This simple cir-cuit will protect the costly equipment from

high as well as low voltages and the volt-age surges. It also gives a melodious tunewhen mains power resumes after a break.

When mains voltage is normal, theDC voltage at the cathode of zener diode

D4 is less then 5.6V. As a result transis-tor T1 is in ‘off’ state. The DC voltage atthe cathode of zener diode D5 is greaterthan 5.6V and as a result transistor T2 isin ‘on’ state. Consequently, relay RL1 gets

HIGH AND LOW VOLTAGE CUTOUTWITH DELAY AND MELODY

ARTHUR LOUIS

is heard from the buzzer.When phone line loop is discontinu-

ous, no voltage is available across capaci-tor C1. Thus zener D9 and transistorsT1, T2 and T3 do not conduct while T4conducts. Now green LED extinguishesand a continuous sound is heard from thebuzzer.

When telephone line is alright but isnot in use, zener D10 conducts as voltageacross capacitor C1 is quite high. This

results in conduction of transistors T5 andT6 and cutting off of transistor T7 (ascollector of transistor T6 is near groundpotential). Thus positive 9V rail is notextended to the following multivibratorcircuit built around transistors T8 andT9. Consequently, the red LED is not litand buzzer does not sound.

When phone line is in use, zener D10does not conduct. As a result, transistorsT5 and T6 also do not conduct, while tran-

sistor T7 conducts. Now +9V is extendedto multivibrator circuit. This mult-ivibrator is designed such that collector oftransistor T9 goes high once every 5 sec-onds to forward bias transistor T10 and itconducts. Thus at every 5-second intervala beep sound is heard from buzzer. Thebeep sound interval can be increased or de-creased by changing the value of capacitorC3 while the volume can be adjusted withthe help of preset VR3.

Readers Comments:I have successfully constructed the

circuit but output of the buzzer is very low.As a result the buzzer cannot be heard in aroom where a television set is operating.

I would like the author to modify thecircuit by using a transistor amplifier to

increase the output. The base-emitter cir-cuit of the amplifier should replace thebuzzer and the collector should be con-nected to 9V DC supply through the buzzer.

Ajay K.S.Bhopal

The author K. Udhaya Kumaran

replies:Please recheck your circuit connec-

tions. Spurious buzzers produce lesssound. Good-quality, continuous-tonebuzzers with built-in oscillator producesufficient sound which overrides all sur-rounding noise.

Page 127: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 117

energised, which is indicated by lightingup of green LED.

Under high mains voltage condition,transistor T1 switches to ‘on’ state be-cause the voltage at cathode of zener di-ode D4 becomes greater than 5.6V. Con-sequently, transistor T2 switches to ‘off’state, making the relay to de-energise

Under low mains voltage condition,transistor T1 switches to ‘off’ state and asa result transistor T2 also switches to ‘off’state, making the relay to de-energise.

Timer IC 555 in the circuit is configuredto operate in a monostable mode. The pulse

width is about 10 seconds with the timingcomponent values used in the circuit.

When the power resumes after abreak, pin 2 of IC 555 goes low brieflyand this triggers it. Its output makesmusic IC UM66 to operate throughtransistor T3. Simultaneously, transistorT1 also gets forward biased asthe monostable IC1 output is connectedto its base via diode D8 and resistor R7.As a result, transistor T1 conductsand biases transistor T2 to cut off. Thusrelay RL1 remains de-energisedfor the duration of mono pulse and the

load is protected against the voltagesurges.

To adjust presets VR1 and VR2, youmay use a manually variable auto-trans-former. Set the output of auto-transformerto 270V AC and connect it to the primaryof transformer X1. Adjust preset VR1 suchthat relay RL1 just de-energises. Next setthe output of auto-transformer to 170VAC. Now adjust preset VR2 such that re-lay RL1 again de-energises. Volume con-trol VR3 may be adjusted for the desiredoutput volume of the tune generated byIC UM66.

Readers Comments:I have assembled the circuit and ob-

served that even after setting the low andhigh voltage presets for 170V and 270V

respectively, the relay starts chatter-ing when the voltage reaches 260V.The same is true for the lower voltagelimit also. To overcome the problem I

have tried the circuit given inFig. 1 for upper limit and itworks satisfactorily. A similarcircuit can also be used forlower cut-off limit. I would,however, like the author to sug-gest suitable changes for properoperation of the original circuit.

Mukesh P. TatiyaAhmednagar

The author Arthur Louisreplies:

To avoid chattering of relay onFig. 1: Suggested circuit for hi/low cut off

Fig. 2: Modification of melody circuit suggested by theauthor

reaching the threshold level, please con-nect a capacitor of 470µF, 16V in parallelwith relay coil. I also suggest slight modi-fication of melody circuit after transistorT3, as shown in Fig. 2, for its proper op-eration.

RUNNING MESSAGE DISPLAYV. KANNAN

L ight emitting diodes are advanta-geous due to their smaller size,low current consumption and

catchy colours they emit. Here is a run-ning message display circuit wherein theletters formed by LED arrangement lightup progressively. Once all the letters ofthe message have been lit up, the circuitgets reset.

The circuit is built around Johnsondecade counter CD4017BC (IC2). One ofthe IC CD4017BE’s features is its provi-sion of ten fully decoded outputs, makingthe IC ideal for use in a whole range of

sequencing operations. In the circuit onlyone of the outputs remains high andthe other outputs switch to high statesuccessively on the arrival of eachclock pulse.

The timer NE555 (IC1) is wired as a1Hz astable multivibrator which clocksthe IC2 for sequencing operations. Onreset, output pin 3 goes high and drivestransistor T7 to ‘on’ state. The output oftransistor T7 is connected to letter ‘W’ ofthe LED word array (all LEDs of a letterarray are connected in parallel) and thusletter ‘W’ is illuminated. On arrival of

first clock pulse, pin 3 goes low and pin 2goes high. Transistor T6 conducts andletter ‘E’ lights up. The preceding letter‘W’ also remains lighted because of for-ward biasing of transistor T7 via diodeD21. In a similar fashion, on the arrivalof each successive pulse, the other lettersof the display are also illuminated andfinally the complete word becomes visible.On the following clock pulse, pin 6 goes tologic 1 and resets the circuit, and thesequence repeats itself. The frequency ofsequencing operations is controlled withthe help of potmeter VR1.

Page 128: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20118

The display can be fixed on averoboard of suitable size and connectedto ground of a common supply (of 6V to9V) while the anodes of LEDs are to be

connected to emitters of transistors T1through T7 as shown in the circuit.

The above circuit is very versatile andcan be wired with a large number of LEDs

to make an LED fashion jewellery of anydesign. With two circuits connected in asimilar manner, multiplexing of LEDs canbe done to give a moving display effect.

Readers Comments:❑ The circuit seems to have been madeunnecessarily complicated. All diodes canbe eliminated by using 8-bit register IC74HCT164 in place of decade counter IC4017.

Pradeep G.Alappuzhu

❑ Since the transistors T1 to T7 (2N3053)are not readily available in the market,can we use transistor 2N3055 instead?

V. SundareshSalem

❑ Although the above-mentioned circuitis functioning well, it can be further sim-plified by using lesser number of diodes asshown in Fig. 1.

Louis MandyaMandya

❑ What is the maximum number of LEDsthat can be used per word?

Ajay GuptaPantnager

❑ Can we increase or decrease the numberof characters in the message?

Faisel K. QaziNew Mumbai

The author, V. Kannan, replies:In reply to Pradeep’s letter, I would liketo say that the idea of using IC7AHCT164 is good, but the actual circuitwas designed using two 4017 ICs to ob-tain a miltiplexed display. Since the cir-cuit became too complicated, it was re-drawn for simplicity keeping the basicidea unchanged—allowing room formultiplexing operations.

In reply to Sundaresh, I would like to

Fig. 1: Suggested circuit for moving message display

say that transistors T1 to T7 (2N3053)have a maximum current-rating of 700mA,whereas transistor 2N3055 has a current-rating of 3A-5A, which is not necessary.If transistor 2N3053 is not available, tran-sistor 2N3447 or any npn transistor of500mA to 700mA current-rating can beused.

Cascading of diodes, as mentioned byLouis Mandya, would have the followingeffect: base-terminal voltage of each suc-

Page 129: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 119

Fig. 2: Cascading of CD4017s

In reply to Ajay Gupta and Faisel K.Qazi I would like to say that the numberof LEDs that can be connected in paralleldepends upon the current rating ofthe transistor. This may be calculatedas under:Maximum Number of Parallel LEDs=Collector CurrentRating of Transistor ÷ Current drawn by One LED

Using a single IC, a maximum of tencharacters (and a minimum of one) canbe obtained. By cascading two 4017 ICs,we can obtain up to 17 characters. (Note:Outputs 0 and 10 are high even duringreset and hence these may not be used.)

Tech Editor: The circuit diagramfor cascading two CD4017 is shown inFig. 2.

ceeding transistor would be 0.65V lessthan its predecessor. As a result, the last

few transistors would not be sufficientlyforward-baised to conduct properly.

COLOURSENSOR

TONY GLADVIN GEORGE

Colour sensor is an interestingproject for hobbyists. The circuitcan sense eight colours, i.e. blue,

green and red (primary colours); magenta,yellow and cyan (secondary colours); andblack and white. The circuit is based onthe fundamentals of optics and digitalelectronics.

The object whose colour is required tobe detected should be placed in front ofthe system. The light rays reflected fromthe object will fall on the three convexlenses which are fixed in front of the threeLDRs. The convex lenses are used to con-verge light rays. This helps to increasethe sensitivity of LDRs.

Blue, green and red glass plates(filters) are fixed in front of LDR1, LDR2and LDR3 respectively. When reflectedlight rays from the object fall on thegadget, the coloured filter glass platesdetermine which of the LDRs would gettriggered. The circuit makes use of only‘AND’ gates and ‘NOT’ gates.

When a primary coloured light rayfalls on the system, the glass plate cor-responding to that primary colour willallow that specific light to pass through.But the other two glass plates will not

13

Page 130: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20120

LOW CURRENT, HIGHVOLTAGE POWER SUPPLY

NAGESH UPADHYAYA

A high voltage power supply is avery useful source which can beeffectively used in many appli-

cations like biasing of gas-discharge tubesand radiation detectors etc. Such a powersupply could also be used for protection ofproperty by charging of fences. Here thecurrent requirement is of the order of afew microamps. In such an application,high voltage would essentially existbetween a ‘live’ wire and ground. Whenthis ‘live’ wire is touched, the dischargeoccurs via body resistance and it gives anon-lethal but deterrent shock to an in-truder.

The circuit is built around a transis-torised blocking oscillator. An importantelement in this circuit is the transformer.It can be fabricated using easily availableferrite core. Two ‘E’ sections of the coreare joined face-to-face after the enamelledcopper wire wound on former is placed init. The details of the transformer windingsare given in the Table.

In this configuration, the primary wind-ing and the feedback winding are arrangedsuch that a sustained oscillations areensured once the supply is switched on.The waveform’s duty cycle is asymmetri-cal, but it is not very important in thisapplication. Please note that if the oscilla-tions do not occur at the ‘switch-on’ time,the transformer winding terminals of thefeedback or the primary winding (but notboth) should be reversed.

TABLEDetails of the Transformer WindingsWindings No. of Standard wire

turns gauge (SWG)Primary 50 31Feedback 12 31Secondary 1650 41

allow any light to pass through. Thusonly one LDR will get triggered and thegate output corresponding to that LDRwill become logic 1 to indicate whichcolour it is.

Similarly, when a secondary colouredlight ray falls on the system, the two pri-mary glass plates corresponding to themixed colour will allow that light to passthrough while the remaining one will notallow any light ray to pass through it. Asa result two of the LDRs get triggered

and the gate output corresponding to thesewill become logic 1 and indicate whichcolour it is.

When all the LDRs get triggered orremain untriggered, you will observewhite and black light indications respec-tively. Following points may be carefullynoted:

1. Potmeters VR1, VR2 and VR3 maybe used to adjust the sensitivity of theLDRs.

2. Common ends of the LDRs should

be connected to positive supply.3. Use good quality light filters.The LDR is mounded in a tube, be-

hind a lens, and aimed at the object. Thecoloured glass filter should be fixed infront of the LDR as shown in thefigure. Make three of that kind andfix them in a suitable case. Adjust-ments are critical and the gadget perform-ance would depend upon its proper fabri-cation and use of correct filters as well aslight conditions.

The primary oscillations amplitude isabout 24V(p-p). This gets further ampli-fied due to the large step-up ratio of thetransformer and we get about 800V(p-p)across the secondary. A simple series volt-age multiplier (known as Cockroft-Waltoncircuit) is used to boost up this voltagein steps to give a final DC voltage of about2 kV.

The output voltage, however, is notvery well regulated. But if there is a con-

stant load, the final voltage can be ad-justed by varying the supply voltage. Thepresent configuration gives 2 kV for aninput DC voltage of 15 V. Though highervoltages could be achieved by increasinginput supply, one word of caution isnecessary: that the component ratingshave to be kept in mind. If the ratings areexceeded then there will be electricaldischarges and breakdowns, which willdamage the device.

Page 131: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 121

AUDIO-VISUAL EXTRARINGER FOR PHONE

T.K. HAREENDRAN

M any a times one needs an ex-tra telephone ringer in an ad-joining room to know if there is

an incoming call. For example, if thetelephone is installed in the drawing roomyou may need an extra ringer in thebedroom. All that needs to be done is toconnect the given circuit in parallel withthe existing telephone lines using twinflexible wires.

This circuit does not require any ex-ternal power source for its operation. Thesection comprising resistor R1 and diodesD5 and LED1 provides a visual indica-tion of the ring. Remaining part of thecircuit is the audio ringer based on IC1(BA8204 or ML8204). This integr- atedcircuit, specially designed for telec- om

led by resistor R5 and capacitor C4, andthe repetition rate is controlled by resis-tor R4 and capacitor C3. A little experi-mentation with the various values of theresistors and capacitors may be carriedout to obtain desired pleasing tone.

Working of the circuit is quite simple.The bell signal, approximately 75V AC,passes through capacitor C1 and resistorR2 and appears across the diode bridgecomprising diodes D1 to D4. The rectifiedDC output is smoothed by capacitor C2.The dual-tone ring signal is output frompin 8 of IC1 and its volume is adjustedby volume control VR1. Thereafter, it isimpressed on the piezo-ceramic soundgenerator.

Readers Comments:❑ I would like the author to clarify myfollowing doubts:

1. Is the polarity of the output posi-tive or negative? If it is positive, can nega-tive polarity output be obtained, and viceversa?

2. Can higher values of voltage be

obtained (around 8kV to 9kV) by increas-ing the number (not value) of capacitorsand diodes of the series voltage multi-plier?The author Nagesh Upadhyaya re-plies:

1. The polarity of output is positive. Itis not possible to get a negative polarity

output with this circuit.2. Higher voltages can be obtained by

increasing the number of stages. But af-ter finite number of stages, the currentcapacity becomes unusable and we haveto resort to either increasing the inputvoltage or the number of turns in thesecondary windings of the transformer.

application as bell sound generator,requires very few external parts. It isreadily available in 8-pin mini DIP pack.

Resistor R3 is used for bell sensitivityadjustment. The bell frequency is control-

HANDY ZENER DIODE TESTERK. UDHAYA KUMARAN (VU3GTH)

H ere is a handy zener diodetester which tests zener diodeswith breakdown voltages ex-

tending up to 120 volts. The main ad-vantage of this circuit is that it workswith a voltage as low as 6V DC andconsumes less than 8 mA current.

The circuit can be fitted in a 9V bat-tery box. Two-third of the box may be used

for four 1.5V batteries and the remainingone-third is sufficient for accommodatingthis circuit. In this circuit a commonlyavailable transformer with 230V AC pri-mary to 9-0-9V, 500mA secondary is usedin reverse to achieve higher AC voltageacross 230V AC terminals.

Transistor T1 (BC547) is configuredas an oscillator and driver to obtain re-

quired AC voltage across transformer’s230V AC terminals. This AC voltage is con-verted to DC by diode D1 and filter capaci-tor C2 and is used to test the zener diodes.R3 is used as a series current limitingresistor.

After assembling the circuit, check DCvoltage across points A and B withoutconnecting any zener diode. Now switch

Page 132: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20122

S1 on. The DC voltage across A-B shouldvary from 10V to 120V by adjustingpotmeter VR1 (10k). If every thing is allright, the circuit is ready for use.

For testing a zener diode of unknownvalue, connect it across points A and Bwith cathode towards A. Adjust potmeterVR1 so as to obtain the maximum DCvoltage across A and B. Note down thiszener value corresponding to DC voltagereading on the digital multimeter.

When testing zener diode of value lessthan 3.3V, the meter shows less voltageinstead of the actual zener value. However,correct reading is obtained for zener diodesof value above 5.8V with a tolerance of ±10per cent. In case zener diode shorts, themultimeter shows 0 volts.

AUTOMATIC EMERGENCY LIGHTLOKESH KUMATH

T he circuit of automatic emer-gency light presented here hasthe following features:

1. When the mains supply (230V AC)is available, it charges a 12V battery upto 13.5V and then the battery is discon-nected from the charging section.

2. When the battery discharges up to10.2V, it is disconnected from the loadand the charging process is resumed.

3. If the mains voltage is availableand there is darkness in the room, load(bulb or tube) is turned on by taking powerfrom the mains; otherwise the battery isconnected to the load.

4. When the battery discharges up to10.2V and if the mains is not yet avail-able, the battery is completely discon-nected from the circuit to avoid its fur-ther discharge.

The mains supply of 230V AC isstepped down to 18V AC (RMS) using a230V AC primary to 0-18V AC, 2A sec-ondary transformer (X1), generally usedin 36cm B&W TVs. Diodes D1 throughD4 form bridge rectifier and capacitor C5filters the voltage, providing about 25VDC at the output.

Charging section includes 33-ohm, 10-watt resistor R2 which limits the charg-ing current to about 425 mA when bat-

tery voltage is about 10.2V, or to 325 mAwhen battery voltage is about 13.5V.

When the battery charges to 13.5V(as set by VR2), zener diode D17 breaksdown, thereby triggering triac TR1. Now,since DC is passing through the triac, itremains continuously ‘on’ even if the gatecurrent is reduced to zero (by disconnect-ing the gate terminal). Once the batteryis fully charged, charging section is cut-off from the battery due to energisation ofrelay RL2. This relay remains ‘on’ even ifthe power fails because of connection tothe battery via diode D10. Switch S4, anormally closed switch, is included tomanually restart the charging process ifrequired.

Battery disconnect and chargingrestart section comprises an NE555timer (IC2) wired asmonostable multi-vibrator. When the bat-tery voltage is above10.2V (as indicated byred LED D15), zenerdiode (D16) remains inthe breakdown region,making the trigger pin2 of IC2 high, therebymaintaining output pin3 in low voltage state.

Thus, relay RL3 is ‘on’ and relay RL4 is‘off.’

But as soon as the battery voltagefalls to about 10.2V (as set by presetVR1), zener diode D16 comes out ofconduction, making pin 2 low and pin 3high to turn ‘on’ relay RL4 and orangeLED D13. This also switches off relayRL3 and LED D15.

Now, if the mains is available, charg-ing restarts due to de-energisation of re-lay RL2 because when relay RL4 is ‘on,’it breaks the circuit of relay RL2 and triacTR1. But if the mains supply is notpresent, both relays RL3 and RL1de-energise, disconnecting the batteryfrom the remaining circuit.

Thus when battery voltage falls to 10.2volts, its further discharge is curtailed.

Page 133: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 123

But as soon as the mains supply resumes,it energises relay RL1, thereby connectingthe battery again to the circuit.

Light sensor section also makes useof a 555 timer IC in the monostablemode. As long as normal light keepsfalling on LDR1, its resistance is com-paratively low. As a result pin 2 of IC3is held near Vcc and its output at pin 3is at low level.

In darkness, LDR resistance is veryhigh, which causes pin 2 of IC3 to fall tonear ground potential and thus triggerit. As a consequence, output pin 3 goeshigh during the monostable pulse period,forward biasing transistor T3 which goesinto saturation, energising relay RL5.

With auto/bypass switch S2 off (in automode), the load gets connected to supplyvia switch S3. If desired, the load may beswitched during the day-time by flippingswitch S2 to ‘on’ position (manual).

Preset VR3 is the sensitivity controlused for setting threshold light level atwhich the load is to be automaticallyswitched on/off. Capacitors across the re-lays ensure that there is no chattering ofthe relays.

When the mains is present, diode D8couples the input voltage to regulator IC1whereas diode D10 feeds the input volt-age to it (from battery) in absense ofmains supply. Diode D5 connects the loadto the power supply section via resistorR5 when mains is available (diode D18does not conduct). However, when mainspower fails, the situation reverses anddiode D18 conducts while diode D5 doesnot conduct.

The load can be any bulb of 12 voltswith a maximum current rating of 2 am-

peres (24 watts). Resistor R5 is sup-posed to drop approximately 12 voltswhen the load current flows through itduring mains availability. Hence powerdissipated in it would almost be equal tothe load power. It is therefore desirableto replace R5 with a bulb of similar volt-age and wattage as the load so that dur-ing mains availability we have more (dou-ble) light than when the load is fed fromthe battery.

For setting presets VR1 and VR2, justtake out diodes D7, D10 and D18 (desolderone end). Connect a variable source ofpower supply in place of battery. Setpreset VR1 so that battery-high LED D15is just off at 10.2V output from the vari-able source. Increase the potential of thevariable source and observe the shift fromLO BAT LED D13 to Hi Batt LED D15.Now make the voltage of the source 13.5Vand set preset VR2 so that relay RL2 justenergises. Then decrease the voltageslowly and observe that relay RL2 doesnot de-energise above 10.2V. At 10.2V,LED D15 should be off and relay RL2should de-energise while LED D13 shouldlight up.

Preset VR3 can be adjusted duringevening hours so that the load is ‘on’during the desired light conditions.

Page 134: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20124

AUTOMATIC ROOM POWER CONTROLTONY GLADVIN GEORGE

An ordinary automatic room powercontrol circuit has only one lightsensor. So when a person enters

the room it gets one pulse and the lightscome ‘on.’ When the person goes out itgets another pulse and the lights go ‘off.’But what happens when two persons en-ter the room, one after the other? It getstwo pulses and the lights remain in ‘off’state.

The circuit described here overcomesthe above-mentioned problem. It has asmall memory which enables it to auto-matically switch ‘on’ and switch ‘off’ thelights in a desired fashion.

The circuit uses two LDRs which areplaced one after another (separated by adistance of say half a metre) so that theymay separately sense a person going intothe room or coming out of the room.

Outputs of the two LDR sensors, af-ter processing, are used in conjunctionwith a bicolour LED in such a fashionthat when a person gets into the room itemits green light and when a person goesout of the room it emits red light, andvice versa. These outputs are simultane-ously applied to two counters.

One of the counters will count as +1,+2, +3 etc when persons are coming intothe room and the other will count as -1,-2, -3 etc when persons are going out ofthe room. These counters make use ofJohnson decade counter CD4017 ICs. Thenext stage comprises two logic ICs whichcan combine the outputs of the twocounters and determine if there is anyperson still left in the room or not.

Since in the circuit LDRs have beenused, care should be taken to protect themfrom ambient light. If desired, one mayuse readily available IR sensor modulesto replace the LDRs. The sensors are in-stalled in such a way that when a personenters or leaves the room, he interceptsthe light falling on them sequentially—one after the other.

When a person enters the room, firsthe would obstruct the light falling onLDR1, followed by that falling on LDR2.When a person leaves the room it will bethe other way round.

In the normal case light keeps fallingon both the LDRs, and as such their

Page 135: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 125

resistance is low (about 5 kilo-ohms). Asa result, pin 2 of both timers (IC1 andIC2), which have been configured asmonostable flip-flops, are held near thesupply voltage (+9V).

When the light falling on the LDRs isobstructed, their resistance becomesvery high and pin 2 voltages drop to nearground potential, thereby triggering theflip-flops. Capacitors across pin 2 andground have been added to avoid falsetriggering due to electrical noise.

When a person enters the room, LDR1is triggered first and it results intriggering of monostable IC1. Theshort output pulse immediately chargesup capacitor C5, forward biasing transis-tor pair T1-T2. But at this instant thecollectors of transistors T1 and T2 are inhigh impedance state as IC2 pin 3 is atlow potential and diode D4 is not con-ducting.

But when the same person passesLDR2, IC2 monostable flip-flop istriggered. Its pin 3 goes high and thispotential is coupled to transistor pair T1-

T2 via diode D4. As a result transistorpair T1-T2 conducts because capacitor C5retains the charge for some time as itsdischarge time is controlled by resistorR5 (and R7 to an extent). Thus green LEDportion of bi-colour LED is lit momentar-ily.

The same output is also coupled toIC3 for which it acts as a clock. Withentry of each person IC3 output (highstate) keeps advancing. At this stage tran-sistor pair T3-T4 cannot conduct becauseoutput pin 3 of IC1 is no longer positiveas its output pulse duration is quite shortand hence transistor collectors are in highimpedance state.

When persons leave the room, LDR2is triggered first, followed by LDR1. Sincethe bottom half portion of circuit is iden-tical to top half, this time, with the de-parture of each person, red portion of bi-colour LED is lit momentarily and outputof IC4 advances in the same fashion as incase of IC3.

The outputs of IC3 and those of IC4(after inversion by inverter gates N1

through N4) are ANDed by AND gates(A1 through A4) and then wire ORed (us-ing diodes D5 through D8). The net effectis that when persons are entering, theoutput of at least one of the ANDgates is high, causing transistor T5 toconduct and energise relay RL1. The bulbconnected to the supply via N/O contactof relay RL1 also lights up.

When persons are leaving the room,and till all the persons who entered theroom have left, the wired OR output con-tinues to remain high, i.e. the bulb con-tinues to remains ‘on,’ until all personswho entered the room have left.

The maximum number of persons thatthis circuit can handle is limited to foursince on receipt of fifth clock pulse thecounters are reset. The capacity of thecircuit can be easily extended tohandle up to nine persons by removingthe connection of pin 1 from reset pin(15) and utilising Q1 to Q9 outputs ofCD4017 counters. Additional inverters,AND gates and diodes will, however, berequired.

A compact, inexpensive andlow component counttelecom head-set can be

constructed using two readily avail-able transistors and a few other elec-tronic components. This circuit isvery useful for hands-free operationof EPABX and pager communica-tion. Since the circuit draws verylittle current, it is ideal for paralleloperation with electronic telephoneset.

Working of the circuit is simpleand straightforward. Resistor R1and an ordinary neon glow-lampforms a complete visual ringer cir-cuit. This simple arrangement doesnot require a DC blocking capacitor be-cause, under idle conditions, the telephoneline voltage is insufficient to ionise theneon gas and thus the lamp does not light.Only when the ring signal is beingreceived, it flashes at the ringing rate toindicate an incoming call.

The bridge rectifier using diodes D1through D4 acts as a polarity guard whichprotects the electronic circuit from anyreversal in the telephone line polarity.Zener diode D5 at the output of this bridgerectifier is used for additional circuit pro-tection.

Section comprising transistor T1, re-sistors R2, R3 and zener diode D6 forms aconstant voltage regulator that provides alow voltage output of about 5 volts.Dial tone and speech signals from ex-change are coupled to the audio amplifierstage built around transistor T2 and re-

T.K. HAREENDRAN

TELECOM HEADSET

Page 136: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20126

JAYAN A.R.

SMART PHONE LIGHT

T he circuit shown here is used toswitch on a lamp when the tele-phone rings, provided that the

ambient light is insufficient.

The circuit can be implemented usingjust two ICs. A light dependent resist-ance (LDR), with about 5 kilo-ohms re-sistance in the ambient light and greather

than 100 kilo-ohms in darkness, is at theheart of the circuit.

The circuit is fully isolated from thephone lines and it draws current only

lated parts, i.e. resistors R7, R6 and ca-pacitor C5. Amplified signals from collec-tor of transistor T2 are coupled to dy-namic receiver RT-200 (used as earpiece)via capacitor C7.

A condenser microphone, connected asshown in the circuit, is used as transmit-ter. Audio signals developed across themicrophone are coupled to the base oftransistor T1 via capacitor C3. ResistorR4 determines the DC bias required forthe microphone. After amplification bytransistor T1, the audio signals arecoupled to the telephone lines via the diodebridge.

The whole circuit can bewired on a very small PCBand housed in a medium sizeheadphone, as shown in theillustration. For better re-sults at low line currents,value of resistor R2 may bereduced after testing.

Readers Comments:❑ I have assembled the above-mentionedcircuit and observed that although thecircuit is functioning satisfactorily, the vol-ume in the earpiece is quite low. How canwe increase the volume?

A. RahmanAchlady

The author T.K. Hareendran replies:I have retested my prototype, and I

like to say that the output level is notvery low as stated by Mr Rehman. Irequest the reader to check his assem-bled circuit carefully. A single transis-tor-based audio amplifier, as in mycircuit, is good enough for a telecom

headset.One can, however, increase the out-

put power by further modification. Forthis, a two-transistor amplifier is used.Please refer my circuit idea ‘Handy Tel-ephone Receiver’ published in April ’98issue of EFY. (Reproduced in ElectronicsProjects Vol. 19.)

Page 137: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 127

when the phone rings. The lamp can bebattery powered to provide light duringpower failure or load shedding also.

The light switches off automaticallyafter a programmable time period. If re-quired, the lamp lighting period canbe extended by simply pressing apushbutton switch (S1).

The first part of the circuit functionsas a ring detector. When telephone is on-hook, around 48V DC is present acrossthe TIP and RING terminals. The diodein the opto-coupler is ‘off’ during thiscondition and it draws practically nocurrent from the telephone lines. The opto-

coupler also isolates the circuit from thetelephone lines. Transistor in the opto-coupler is normally ‘off’ and a voltage of+5V is present at the ring indicator lineB.

When telephone rings, an AC voltageof around 70-80V AC present across thetelephone lines turns on the diode insidethe opto-coupler (IC2), which in turnswitches on transistor inside the opto-coupler. The voltage at its collector dropsto a low level during ringing to triggerIC3 74LS123(A) monostable flip-flop.

The other opto-coupler (IC1) is usedto detect the ambient light condition.

When there is sufficient light, LDR has alow resistance of about 5 kilo-ohms andthe transistor inside the opto-coupler isin ‘on’ state. When there is insufficientlight available, the resistance of LDRincreases to a few mega-ohms and thetransistor switches to ‘off’ state. Thusthe DC voltage present at the collector oftransistor of the opto-coupler is normallylow and it jumps to 5V when there is nolight or insufficient light.

The 74LS123 retriggerablemonostable multivibrator IC is used togenerate a programmable pulse-width.The first monostable 74LS123(A) gener-ates a pulse from the trigger input avail-able during ringing, provided its pin 2input (marked B) is logic high (i.e.during darkness). It remains high forthe programmed duration andswitches back to 0V at the end of thepulse period.

This high-to-low transition (trailingedge) is used to trigger the secondmonostable flip-flop 74LS123(B) in thesame package. Output of the secondmonostable is used to control a relay.The lamp being controlled via the N/Ocontacts of the relay gets switched ‘on.’The ‘on’ period can be extended by simplypressing pushbutton switch S1. If nobodyattends the phone, the light turns offautomatically after the specific timeperiod equal to the pulse-width of thesecond flip-flop.

The light sensitivity of LDR can bechanged by changing resistance R3 con-nected at collector of the transistor in lightmonitor circuit. Similarly, switch-onperiod of the lamp can be controlled bychanging capacitor C3’s value in thesecond 74123(B) monostable circuit.

AUTO RESET OVER/UNDERVOLTAGE CUT-OUT

J. GOPALAKRISHNAN

T his over/under voltage cut-outwill save your costly electricaland electronic appliances from the

adverse effects of very high and very low

mains voltages.The circuit features auto reset and

utilises easily available components. Itmakes use of the comparators available

inside 555 timer ICs. Supply is tappedfrom different points of the power supplycircuit for relay and control circuit opera-tion to achieve reliability.

Page 138: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20128

CLAP REMOTES. CHANDRA SEKHAR

A n infra-red or wireless remotecontrol has the disadvantage thatthe small, handy, remote (trans-

mitter) is often misplaced. The sound op-

erated switch has the advantage that thetransmitter is always with you. Thisproject offers a way to control up to fourlatching switches with two claps of your

hand. These switches may be used to con-trol lights or fans—or anything else thatdoes not produce too loud a sound.

To prevent an occasional loud sound

pin 7 is thereforeoff. The output(at pin 3) re-verses (goes low)when pin 2 istaken morepositive than1/3 Vcc. At thesame time pin7 goes low (asQ output ofinternal flip-flop is high) andthe LED con-nected to pin7 is lit. Bothtimers (IC1and IC2) are

configured to function in the samefashion.

Preset VR1 is adjusted for under volt-age (say 160 volts) cut-out by observingthat LED1 just lights up when mainsvoltage is slightly greater than 160V AC.At this setting the output at pin 3 of IC1is low and transistor T1 is in cut-off state.As a result RESET pin 4 of IC2 is heldhigh since it is connected to Vcc via 100kilo-ohm resistor R4.

Preset VR2 is adjusted for over volt-

*

age (say 270V AC) cut-out by observingthat LED2 just extinguishes whenthe mains voltage is slightly lessthan 270V AC. With RESET pin 4 of IC2high, the output pin 3 is also high. As aresult transistor T2 conducts and ener-gises relay RL1, connecting load to powersupply via its N/O contacts. This is thesituation as long as mains voltage isgreater than 160V AC but less than 270VAC.

When mains voltage goes beyond270V AC, it causes output pin 3 of IC2 togo low and cut-off transistor T2 and de-energise relay RL1, in spite of RESETpin 4 still being high. When mains volt-age goes below 160V AC, IC1’s pin 3 goeshigh and LED1 is extinguished. The highoutput at pin 3 results in conduction oftransistor T1. As a result collector of tran-sistor T1 as also RESET pin 4 of IC2 arepulled low. Thus output of IC2 goes lowand transistor T2 does not conduct.As a result relay RL1 is de-energised,which causes load to be disconnectedfrom the supply. When mains voltageagain goes beyond 160V AC (butless than 270V AC) the relay againenergises to connect the load to powersupply.

The circuit utilises comparator 2 forcontrol while comparator 1 output(connected to reset pin R) is kept lowby shorting pins 5 and 6 of 555 IC.The positive input pin of comparator2 is at 1/3rd of Vcc voltage. Thus aslong as negative input pin 2 is less posi-tive than 1/3 Vcc, comparator 2 outputis high and the internal flip-flop isset, i.e. its Q output (pin 3) is high.At the same time pin 7 is in highimpedance state and LED connected to

Page 139: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 129

from causingmal funct ion ,the circuit isnormally quies-cent. The firstclap takes it outof standby stateand starts ascan of eightpanel-mountedLEDs. Each ofthe fourswitches areaccompaniedwith twoLEDs—one forindicating the‘on’ and theother for indi-cating the ‘off’state. A secondclap, while thea p p r o p r i a t eLED is lit, acti-vates that func-tion. For exam-ple, if you clapwhile LED10used in conjunc-tion with Lamp1 is lit then thelamp turns on.(If it is alreadyon, nothinghappens and itremains on.)

A condensermicrophone, asused in tape re-corders, is usedhere to pick upthe sound of theclaps. The sig-nal is thenamplified andshaped into apulse by threeinverters (N1through N3)contained inCMOS hexinverter ICCD4069. Aclock generatorbuilt from twoof the invertergates (N5 andN6) suppliesclock pulses to adecade counterCD4017 (IC2).

Eight outputs of this IC drive LEDs (1through 8). These outputs also go to the Jand K inputs of four flip-flops inside twoCD4027 ICs (IC3 and IC4). The clock in-puts of these flip-flops are connected tothe pulse shaped sound signal (availableat the output of gate N3).

Additional circuitry around theCD4017 counter ensures that it is in thereset state, after reaching count 9, andthat the reset is removed when a soundsignal is received.

Outputs of the four flip-flops are buff-ered by transistors and fed via LEDs tothe gates of four triacs. These triacs switchthe mains supply to four loads, usuallylamps. If small lamps are to be controlled,these may be directly driven by the tran-sistors.

If this circuit is to be active, i.e. scan-ning all the time, some componentsaround CD4017 IC could be omitted andsome connections changed. But then itwould no longer be immune to an occa-sional, spurious loud sound.

The condenser microphone usuallyavailable in the market has two termi-nals. It has to be supplied with power forit to function. Any interference on thissupply line will be passed on to the out-put. So the supply for the microphone issmoothed by resistor-capacitor combina-tion of R2, C1 and fed to it via resistorR1.

CD4069, a hex unbuffered inverter,contains six similar inverters. When theoutput and input of such an inverter isbridged by a resistor, it functions as aninverting amplifier. Capacitor C2 couplesthe signal developed by the microphoneto N1 inverter in this IC, which isconfigured as an amplifier. The output ofgate N1 is directly connected to the inputof next gate N2. Capacitor C3 couples theoutput of this inverter to N3 inverter,which is connected as an adjustable levelcomparator. Inverter N4 is connected asan LED (9) driver to help in setting thesensitivity.

Preset VR1 supplies a variable biasto N3. If the wiper of VR1 is set towardsthe negative supply end, the circuit be-comes relatively insensitive (i.e. requiresa thunderous clap to operate). As thewiper is turned towards resistor R4, thecircuit becomes progressively more sensi-tive. The sound signal supplied by gateN2 is added to the voltage set by presetVR1 and applied to the input of gate N3.When this voltage crosses half the sup-ply voltage, the output of gate N3 goes

Page 140: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20130

low. This output is normally high sincethe input is held low by adjustment ofpreset VR1.

The output of gate N3 is used for twothings: First, it releases the reset state ofIC2 via diode D1. Second, it feeds theclock inputs to the four flip-flops containedin IC3 and IC4. In the quiescent state,IC2 is reset and its ‘Q0’ output is high.Capacitor C4 is charged positively and itholds this charge due to the connectionfrom R5 to this output (Q0).

IC2 is a decade counter with fullydecoded outputs. It has ten outputs la-belled Q0 to Q9 which go successivelyhigh, one at a time, when the clock inputis fed with pulses. IC3 and IC4 are dualJK flip-flops. In this circuit they store(latch) the state of the four switches andcontrol the output through transistors andtriacs.

At the first clap, the output of gateN3 goes low and diode D1 conducts, dis-charging capacitor C4. The reset input ofIC2 goes low, releasing its reset state. Allthe J and K inputs of the four flip-flopsare low and so these do not change state,even though their clock inputs receivepulses.

When the reset input of IC2 is low,each clock pulse causes IC2 to advance byone count and its outputs go high succes-sively, lighting up the corresponding LEDsand pulling high the J and K inputs of thefour flip-flops, one after the other. ResistorR8 limits the current through LEDs 1through 8 to about 2 mA. Larger currentmight cause malfunction due to the out-puts of IC2 being pulled down below thelogic 1 state input voltage.

If a second clap is detected while the Jinput of a particular flip-flop is high, its Qoutput will go high, regardless of whatstate it was in previously. Similarly, if itsK input was high, the output will go low.

(If both J and K are high, the output willchange state at each clock pulse.) Thusalthough all flip-flops receive the clapsignal at their clock inputs, only the oneselected by the active output of IC2 willchange state. Resistor R9 and capacitorC6 ensure that the flip-flops start in theoff state when power to the circuit isswitched on, by providing a positive power-on-reset pulse to the reset input pins whenpower is applied. The preset input pinsare not used and are therefore connecteddirectly to ground.

When, after eight clock pulses, out-put Q8 of IC2 becomes high, diode D2conducts, charging capacitor C4, therebyresetting IC2 and making its Q0 outputhigh. And there it stays, awaiting thenext clap.

The four Q outputs of IC3 and IC4are buffered by npn transistors, fedthrough current limiting resistors andLEDs (to indicate the on/off state of theloads) to the gates of four triacs. Fourlamps operating on the mains may thusbe controlled. For demonstrations, itmight be better to drive small lamps(drawing less than 100 mA at 12V) di-rectly from the emitters of the transis-tors. In this case the triacs, LEDs andtheir associated current limiting resistorsmay be omitted.

It has to be noted that one side ofthe mains has to be connected to thenegative supply line of this circuit whenmains loads are to be controlled. Thisnecessitates safe construction of the cir-cuit such that no part of it is liable to betouched. The advantage is that it may bemounted out of reach of curious handssince it does not need to be handledduring normal operation. It is advisableto start with the low voltage version andthen upgrade to mains operation, onceyou are sure everything else is working

TIME SWITCHAVNISH PUNDIR

This circuit is especially designedfor those who often need to wakeup early in the morning. Ordinary

alarms in electronic watches are not loudenough and very often they fail to wake

one up. The switch circuit described herewill come handy; it can be used to switchon a TV, radio or tape recorder etc, whichwill not allow even the laziest amongst usto ignore their sound for too long. Be-

sides, this time switch can also be used toswitch on/off any other electric or elec-tronic gadget at any time. What you needis a simple analogue electronic clock withalarm facility and a small circuit to im-

satisfactorily.CMOS ICs are used in this circuit for

implementing the amplifyingand logicfunctions. Use of a dedicated supply isrecommended because the integrated cir-cuits will be damaged if the supply volt-age is too high, or is of wrong polarity. Anexternal power supply may get connectedup the wrong way around, or beinadvertently set to too high a voltage.

Therefore it is a good idea to start byconstructing the power supply sectionand then add the other components ofthe circuit. If the clock is working, youmay turn your attention to the amplifier.LED9 should be off, and should flashwhen the terminals of capacitor C2 aretouched with a wet finger (the classicwet finger test). Preset VR1 may need tobe adjusted until LED9 just turns off.

The output of gate N2 will be atabout half the supply voltage. The outputof gate N3 would normally be high. Thevoltage at the input of gate N3 shouldvary when preset VR1 is varied. High-efficiency LEDs should preferably be usedin this circuit.

The microphone has two terminals,one of which is connected to its body. Thisterminal has to be connected to circuitground, and the other to the junction ofresistor R2 and capacitor C2. These wiresare preferably kept short (one or twocentimetres) to avoid noise pickup. Withthe microphone connected, a loud sound(a clap) should result in LED9 blinking.Adjust preset VR1 so that LED9 stays offon the loudest of background noises butstarts glowing when you clap.

If the clap-to-start feature is not re-quired, it may be disabled by omittingcomponents D1, D2, R5, C4 and connect-ing a wire link in place of diode D2.Then IC2 will be alive and kicking allthe time.

Page 141: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 131

plement the timeswitch.

This timeswitch has twomodes. One is‘time-on’ modeand the other is‘time-off’ mode. Intime-on mode,you set up thealarm in yourclock as per normal procedure and at theset time this switch turns on the gadgetconnected at the output socket-1. In time-off mode, it turns your gadget off at the settime. The optional output socket-2 is wiredin such a way that when you use thissocket, the mode changes without havingto flip the mode switch (i.e. mode switchcan be omitted).

Please refer to the back panel dia-gram of a typical analogue clock and theaudio jack, to see how the existing buzzerof the clock is required to be wired to theaudio output from the clock. This will en-sure that when plug is inserted in theaudio jack, the clock’s buzzer will remainoff and not consume any power unneces-sarily.

The audio alarm output from the clock

Readers Comments:❑ In electronic clocks, if we set the alarmto sound, say, 45 minutes after the settime, the alarm will sound after 45 min-utes and then stop automatically. How-ever, in your circuit, if the clock continuesto be used after the set time, it will togglewhen the clock pulses arrive again afterthe set time.

P. Sasi KumarCoimbatore

The author Avnish Pundir replies:As per your question, the time switch

is going to toggle after 45 minutes ‘if theclock pulses arrive again.’ But this can-not happen as the R-S latch is being usedin the circuit whose one input is perma-nently connected to +Vcc and the other

is coupled to the AF detector built aroundlow-power switching transistor T1. Dur-ing alarm, the collector of transistor T1will fluctuate around ground level andVcc. During absence of audio alarm in-put, the collector of transistor T1 is heldat Vcc potential.

The next stage consists of an S-R latchbuilt around NAND gates N1 and N2.Capacitor C2 and resistor R4 are used forpower-on-reset. On switching the powersupply, gate N2 output will acquire logic1 and that of gate N1 logic 0 state. This isthe initial state, irrespective of the posi-tion of mode switch. At the time of alarm,when point A connected to collector oftransistor T1 passes through logic 0 state,the output logic state of both the gateswill toggle.

Assuming that mode switch is flipped

to ‘Off Mode’ position at power-on-reset(when point D is at logic 1), initially diodeD1 would be in blocking state andtransistor T2 would be forward biased viaresistor R5 and diodes D2 and D3. As aresult, the relay is in energised state,which makes output power available atoutput socket-1 and cuts it off from socket-2. At alarm time, the audio signal toggleslogic output states of both gates N1 andN2. As a result, point D goes to logic 0state. Diode D1 conducts, taking the volt-age at junction of diodes D1 and D2 tonear about 1 volt. Diode D3 ensures thatits series combination with diode D2 putsthem in blocking mode. Capacitor C3meanwhile discharges via resistor R6 andthe voltage at base of transistor T2 ap-proaches towards ground level, cutting offtransistor T2 and de-energising relay RL1.Now the power at output socket-1 wouldbe cut off while it becomes available insocket-2.

If the above operation is repeated withswitch S1 in ‘Mode On’ position, the powerwould initially be not available in socket-1 (but available in socket-2). But afterthe alarm, the power would become avail-able in socket-1 and not in socket-2.

receives clock signal via the detector.At switching on instant, the flip-flop out-

put at point ‘D’ will be in high state. Afterfirst pulse from detector, point D would golow and remain so, irrespective of whethermore pulses arrive or not. So, there cannotbe any toggling of flip-flop, until and unlessthere is a power loss or somebody shortscapacitor ‘C2’ momentarily.

Page 142: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20132

WATER LEVELINDICATOR

WITH ALARMVIJAY D. SATHE

H ere is a simple, versatile circuitwhich indicates the level ofwater in a tank. This circuit pro-

duces alarm when water level is belowthe lowest level L1 and also when waterjust touches the highest level L12. Thecircuit is designed to display 12 differentlevels. However, these display levels canbe increased or decreased dependingupon the level resolution required. Thiscan be done by increasing or decreasingthe number of level detector metal strips(L1 through L12) and their associatedcomponents.

In the circuit, diodes D1, D2 and D13form half-wave rectifiers. The rectifiedoutput is filtered using capacitors C1through C3 respectively.

Initially, when water level is belowstrip L1, the mains supply frequency os-cillations are not transferred to diode D1.Thus its output is low and LED1 does notglow. Also, since base voltage of transisterT1 is low, it is in cut-off state and itscollector voltage is high, which enablesmelody generating IC1 (UM66) and alarmis sounded.

When water just touches level detec-tor strip L1, the supply frequency oscilla-tions are transferred to diode D1. Itrectifies the supply voltage and a positiveDC voltage develops across capacitor C1,which lights up LED1. At the same timebase voltage for transistor T1 becomeshigh, which makes it forward biased andits collector voltage falls to near-groundpotential. This disables IC1 (UM66) andalarm is inhibited.

Depending upon quantity of waterpresent in the tank, corresponding levelindicating LEDs glow. It thus displaysintermediate water levels in the tank inbar-graph style.

When water in the tank just touchesthe highest level detector strip L12, theDC voltage is developed across capacitorC2. This enables melody generating IC1(UM66) and alarm is again sounded.

Page 143: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 133

The circuit shown here is that ofthe IC controlled emergencylight. Its main features are: auto-

matic switching-on of the light on mainsfailure and battery charger with over-charge protection.

When mains is absent, relay RL2 is inde-energised state, feeding battery supplyto inverter section via its N/C contacts andswitch S1. The in-verter section com-prises IC2 (NE555)which is used inastable mode toproduce sharppulses atthe rate of 50 Hzfor driving theMOSFETs. Theoutput of IC3 is fedto gate of MOSFETT4 directly whileit is applied toMOSFET T3 gateafter inversion bytransistor T2. Thusthe power amplifierbuilt aroundMOSFETs T3 andT4 functions inpush-pull mode.

The outputacross secondary oftransformer X2 caneasily drive a 230-volt, 20-wattfluorescent tube. Incase light is notrequired to be onduring mains fail-ure, simply flipswitch S1 to off po-sition.

Battery over-charge preventercircuit is builtaround comparatorIC1 (LM308). Itsnon-inverting pinis held at a refer-ence voltage of ap-

IC CONTROLLED EMERGENCYLIGHT WITH CHARGER

A.P.S. DHILLON

proximately 6.9 volts which is obtainedusing diode D5 (1N4148) and 6.2-voltzener D6. The inverting pin of IC1 isconnected to the positive terminal of bat-tery. Thus when mains supply is present,IC1 comparator output is high, unlessbattery voltage exceeds 6.9 volts. So tran-sistor T1 is normally forward biased,which energises relay RL1. In this state

the battery remains on charge via N/Ocontacts of relay RL1 and current limit-ing resistor R2. When battery voltage ex-ceeds 6.9 volts (overcharged condition),IC1 output goes low and relay RL1 getsde-energised, and thus stops furthercharging of battery.

MOSFETs T3 and T4 may bemounted on suitable heat sinks.

Page 144: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20134

WIPER SPEEDCONTROLLER

PRADEEP G.

A continuously working wiperin a car may prove to be anuisance, especially when it

is not raining heavily. By using thecircuit described here one can varysweeping rate of the wiper from oncea second to once in ten seconds.

The circuit comprises two timerNE555 ICs, one CD4017 decadecounter, one TIP32 driver transistor,a 2N3055 power transistor (orTIP3055) and a few other discretecomponents.

Timer IC1 is configured as amonostable multivibrator which pro-duces a pulse when one pressesswitch S1 momentarily. This pulseacts as a clock pulse for the decadecounter (IC2) which advances by onecount on each successive clock pulseor the push of switch S1.

Ten presets (VR1 through VR10),set for different values by trial anderror, are used at the ten outputsof IC2. But since only one output ofIC2 is high at a time, only one pre-set (at selected output) effectivelycomes in series with timing resistorsR4 and R5 connected in the circuitof timer IC3, which functions inastable mode.

As presets VR1 through VR10 areset for different values, different timeperiods (or frequencies) for astablemultivibrator IC3 can be selected.The output of IC3 is applied to pnpdriver transistor T1 (TIP32) for driv-ing the final power transistor T2(2N3055) which in turn drives thewiper motor at the selected sweepspeed. The power supply for the wipermotor as well as the circuit is tappedfrom the vehicle’s battery itself. Theduration of monostable multivibratorIC1 is set for a nearly one secondperiod.

Page 145: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 135

CD-ROM DRIVE AS DIGITAL-AUDIOCD-PLAYER

M.P. VERMA

mains since it has self-contained powersupply circuit inside.

While there may be minor differencesamongst the available CD-ROM drives’external controls, a typical drive’s con-

trols are shown in the figurehere. Please ensure that aproper power supply connectoravailable from computer spareparts vendor is used forconnection to CD-ROM drive. Toidentify +5V and +12V pins onthe drive connector, please notethat in the computer +12V is

routed using a yellow wire andfor +5V a red wire is used, while forground black wires are used with thesupply connector.

Once the power supply has beenconnected correctly, you will noticethat LED indicator on the drive startsflashing. Now the digital audio CD canbe loaded after pushing the eject button.A second push of the same button causesretraction of CD carriage into the drive.One can change the track (song) on theCD using play switch on theCD-ROM drive.

ACD-ROM drive can be used as astand-alone unit for playing dig-ital audio CDs without interfac-

ing with a computer. The stereo output ofCD player available at the audio jack canbe amplified using audio input facilitywhich is normally available on atape-deck/tape-recorder or a stereo am-plifier. Audio socket on front/rear of theCD-ROM drive is capable of driving head-phones or speakers of less than 500 mW.Proper stereo jacks for interconnectionbetween CD-ROM drive and tape deckare available from computer/tape recorderspares vendors. The principle of opera-tion is illustrated here with the help ofblock diagram.

The 4-pin power supply socket avail-able at the rear of a CD-ROM player ismeant for +5V, ground (two middle pins)and +12V inputs. The power supply canbe easily derived using a conventionalpower supply circuit as shown in the fig-ure. If you have an external CD-ROMdrive, it can be simply plugged into the

RAJESH K.P.

AUTOMATIC DUAL-OUTPUT DISPLAY

This circuit lights up ten bulbssequentially, first in one directionand then in the opposite direction,

thus presenting a nice visual effect.

In this circuit, gates N1 and N2 forman oscillator. The output of this oscillatoris used as a clock for BCD up/down counterCD4510 (IC2).

Depending on the logic state at its pin10, the counter counts up or down. Duringcount up operation, pin 7 of IC2 outputsan active low pulse on reaching the ninth

Page 146: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20136

count. Similarly, during count-downoperation, you again get a low-going pulseat pin 7.

This terminal count output from pin7, after inversion by gate N3, is connectedto clock pin 14 of decade counter IC3(CD4017) which is configured here as atoggle flip-flop by returning its Q2 outputat pin 4 to reset pin 15. Thus output atpin 3 of IC3 goes to logic 1 and logic 0

state alternately at each terminal countof IC2.

Initially, pin 3 (Q0) of IC3 is high andthe counter is in count-up state. Onreaching ninth count, pin 3 of IC3 goeslow and as a result IC2 starts countingdown. When the counter reaches 0 count,Q2 output of IC3 momentarily goes highto reset it, thus taking pin 3 to logic 1state, and the cycle repeats.

The BCD outputs of IC2 are connectedto 1-of-10 decoder CD4028 (IC4). Duringcount-up operation of IC2, the outputs ofIC4 go logic high sequentially from Q0 toQ9 and thus trigger the triacs and light-ing bulbs 1 through 10, one after the other.Thereafter, during count-down operationof IC2, the bulbs light in the reverse order,presenting a wonderful visual effect.

T.K. HAREENDRAN

MINIATURE STROBE LIGHT

S trobe lights are widely used bydisco lovers to create wonderfulvisual effects in disco halls and

auditoria. The circuit of a battery oper-ated portable miniature strobe light,which can be constructed using readilyavailable inexpensive components, isdescribed here.

For convenience and simplicity, anordinary neon lamp is used here in placeof the conventional Xenon tube. The wholegadget can thus be easily accommodatedin a small cabinet, such as a mains adap-tor cover, with a suitable reflector for neonlamp to give a proper look. Since currentrequirement of this circuit is very small, it

Readers Comments:❑ Please intimate the changes that needto be incorporated to replace the lampswith LEDs to display a message?

J. ChandrasekaranChennai

The author Rajesh K.P. replies:I would advise the reader to first ar-

range the letters of the display and thenwire the LEDs in series. Many similarcircuits have been published in earlierissues of EFY which may also be referred

may be powered by two medium-size drycells (3V) or Ni-Cd cells (2.4V).

Transistors T1 and T2 in thecircuit form a complimentary-pair ampli-fier. When switch S1 is momentarilydepressed, the circuit oscillates becauseof the positive feedback provided via re-sistor R2 and capacitor C1 to the base of

to.The total number of LEDs that may

be used varies directly as the input volt-age. Also, connect a 1/2W, 100-ohm re-sistor in series with the LEDs.

Page 147: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 137

transistor T1. The sharp pulses in thesecondary windings induce a high voltagein primary windings of transformer X1,which in fact is a line driver transformer(used in reverse) generally used in 36cmTV sets.

High voltage pulses induced in pri-mary side are rectified by diode D1 andrapidly charge reservoir capacitor C2 tonearly 300V DC. When switch S1 is re-leased, capacitor C2 holds the voltage levelfor a finite period while capacitor C3charges slowly through resistor R3. Whenvoltage across capacitor C3 becomes highenough, neon strikes and the capacitorrapidly discharges through the lamp.When voltage across capacitor C3 fallsbelow the extinguishing potential of neonlamp, it goes off and capacitor C3 startscharging again. This cycle keeps onrepeating for a short time, based on the

reservoir capacitor C2’s value.Precautions. The neon lamp flasher

section of this circuit carries dangerouslyhigh voltages. All precautions should

therefore be taken for protection. Beforeany repair work, discharge capacitor C2using a short length of wire with a 100kresistor connected in series.

ELECTRONIC CARD-LOCK SYSTEMVIJAY D. SATHE

The circuit presented here can beused as a lock for importantelectronic/electrical appliances.

When card is inserted inside its mecha-nism, depending upon theposition of punched hole onthe card, a particular ap-pliance would be switchedon.

The card is inserted justlike a floppy disk inside thedisk drive. This card shouldbe rectangular in shapewith only one punched holeon it.

The circuit uses eightphoto-transistors (T1through T8). When there isno card in the lock, lightfrom incandescent lamp L1(40-watt, 230V) falls on allthe photo- transistor detec-tors. Transistor T8 is usedas enable detector for IC1(74LS244). When light isincident on it, it conductsand its collector voltage

goes low. This makes transistor T16 tocut-off, and its collector voltage goes high.This logic high on its collector terminalwill inhibit IC1 as long as light is present

on photo-transistor T8.IC1 will get enabled only when the

card is completely inserted inside the lockmechanism. This arrangement ensures

Page 148: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20138

that only the selected appliance isswitched on and prevents false operationof the system.

You can make these cards using ablack, opaque plastic sheet. A small rec-tangular notch is made on this card to

indicate proper direction for insertion ofthe card. If an attempt is made to insertthe card wrongly, it will not go completelyinside the mechanism and the system willnot be enabled.

When card for any appliance (say ap-

pliance 1) is completely inserted in themechanism, the light will fall only onphoto-transistor T1. So only T1 will be onand other photo-transistors will be in offstate. When transistor T1 is on, itscollector voltage falls, making transistor

Page 149: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 139

T9 to cut-off. As a result, collector voltageof transistor T9 as also pin 2 of IC1 gologic high. This causes pin 18 (output Q1)also to go high, switching LED1 on.Simultaneously, output Q1 is connectedto pin 1 of IC2 (ULN2003) for driving therelay corresponding to appliance 1. Simi-larly, if card for appliance 2 is inserted,only output pin 16 (Q2) of IC1 will gohigh-making LED2 on while at the sametime energising relay for appliance 2 viaULN2003. The same is true for othercases/appliances also.

The time during which card is presentinside the mechanism, the system gener-ates musical tone. This is achieved withthe help of diodes D1 through D7 whichprovide a wired-OR connection at their

common-cathode junction. When any ofthe outputs of IC1 is logic high, the com-mon-cathode junction of diodes D1through D7 also goes logic high, enablingIC3 (UM66) to generate a musical tone.

In this circuit IC1 (74LS244) is usedas buffer with Schmitt trigger. All out-puts (Q1 through Q7) of this IC are con-nected to IC2 (ULN2003) which is usedas relay driver. IC2 consists of seven high-current relay drivers having integral di-odes. External free-wheeling diodes aretherefore not required.

When an input of this IC is madelogic high, the corresponding outputwill go logic low and relay connected tothat pin gets energised. This switcheson a specific appliance and the corre-

sponding LED.Once a specific card is inserted to

switch on a specific relay, that relay getslatched through its second pair of con-tacts. Thus even when the card is re-moved, the specific appliance remains on.The same holds true for all other relays/appliances as well. The only way to de-energise a latched relay after removal ofthe corresponding card is to switch off thecorresponding switch (S1 through S7)which would cut-off the supply to thedesired relay.

The +5V and +12V supplies can beobtained with conventional arrangementusing a step-down transformer followedby rectifier, filter and regulator (using7805 and 7812 etc).

PRASHANT R. DESHMUKH

PC-BASED 7-SEGMENTROLLING DISPLAY

It is very interesting and convenient to be able to controleverything while sitting at your

PC terminal. Here, a simple hard-ware circuit and software is used tointerface a 7-segment based rollingdisplay.

The printer port of a PC pro-vides a set of points with some act-ing as input lines and some othersas output lines. Some lines are opencollector type which can be used asinput lines. The circuit given herecan be used for interfacing withany type of PC’s printer port.

The 25-pin parallel port connec-tor at the back of a PC is a combi-nation of three ports. The addressvaries from 378H-37AH. The 7 linesof port 378H (pins 2 through 8) areused in this circuit to output thecode for segment display throughIC1. The remaining one line of port378H (pin 9) and four lines of port37AH (pins 1, 14, 16, 17) are usedto enable the display digits (one atime) through IC2.

The bits D0, D1 and D3 of port37AH connected to pins 1, 14 and

Page 150: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20140

P R O G R A M/*DISP.C*** PC BASED ROLLING

DISPLAY *//* P.R.DESHMUKH*/#include<stdio.h>#include<conio.h>#include<dos.h>#define PORTA 0x378#define PORTB 0x37avoid main(){int

dno[6]={0x0a,0x09,0x0f,0x03,0x80};/* code for

“hallo”*/int

m[5]={0x76,0x77,0x38,0x38,0x3f};/*code for the

selection of display*/int f,j;clrscr();for(f=200;f<=500;f+=100){sound(f);delay(100);}nosound();while (!kbhit()){for (j=0;j<=4;j++){

outportb(PORTA,m[j]);if(j<=3){outportb(PORTB,dno[j]);delay(300);

}

else{outportb(PORTB,0x0b); outportb(PORTA,m[j]);outportb(PORTA ,(m[j] || (

0x80)));

17 of ‘D’ connector are inverted by thecomputer before application to the pinswhile data bit D2 is not inverted. There-fore to get a logic high at any of formerthree pins, we must send logic 0 output tothe corresponding pin of port 37AH.

Another important concept illustratedby the project is the time divisionmultiplexing. Note that all the five 7-segment displays share a common databus. The PC places the 7-segment codefor the first digit/character on the databus and enables only the first 7-segmentdisplay. After delay of a few millisec-onds, the 7-segment code for the digit/character is replaced by that of the nextcharter/digit, but this time only seconddisplay digit is enabled.

After the display of all characters/digits in this way, the cycle repeats itselfover and over again. Because of this rep-etition at a fairly high rate, there is anillusion that all the digits/characters arecontinuously being displayed. DISP1 is tobe physically placed as the least signifi-cant digit.

IC1 (74LS244) is an octal buffer whichis primarily used to increase the drivingcapability. It has two groups of four buff-ers with non-inverted tri-state outputs.The buffer is controlled by two active lowenable lines. IC2 (75492) can drive a maxi-mum of six 7-segment displays. (Fordriving up to seven common-cathode dis-plays one may use ULN2003 described inthe previous circuit idea.)

The program for rolling display isgiven in the listing DISP.C above. What-ever the message/characters to be dis-played (here five characters have beendisplayed), these are separated and storedin an array. Then these are decoded.

Decoding software is very simple. Justreplace the desired character with thebinary equivalent of the display code. Thedisplay code is a byte that has theappropriate bits turned on. For example,to display character ‘L’, the segments tobe turned on are f, e and d. This is equiva-lent to 111000 binary or 38 hex.

Please note that only limited charac-ters can be formed using 7-segment dis-play. Characters such as M, N and Kcannot be formed properly.

PRADEEP G.

CONTACTLESS AC MAINSVOLTAGE DETECTOR

T his is a CMOS IC (CD4033) basedcircuit which can be used to de-tect presence of AC mains volt-

age without any electrical contact withthe conductor carrying AC current/volt-age. Thus it can be used to detect mainsAC voltage without removing the insula-tion from the conductor. Just take it inthe vicinity of the conductor and it woulddetect presence of AC voltage.

If AC voltage is not present, the dis-play would randomly show any digit (0through 9) permanently. If mains supplyis available in the conductor, the electricfield would be induced into the sensingprobe. Since IC used is CMOS type, its

input impedance is ex-tremely high and thus theinduced voltage is sufficientto clock the counter IC. Thusdisplay count advances rap-idly from 0 to 9 and thenrepeats itself. This is theindication for presence ofmains supply. Display stopsadvancing when the unit istaken away from the mainscarrying conductor.

For compactness, a 9-volt PP3 battery may beused for supply to thegadget.

Page 151: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 141

FREQUENCY MEASUREMENTSUSING PC

PROBIR GOYAL

H ere is a simple technique formeasuring frequencies overquite a wide frequency range

and with acceptable accuracy limits us-ing a PC. It follows the basic technique ofmeasuring low frequencies, i.e. at lowfrequency, period is measured for a com-plete wave and frequency is calculatedfrom the measured time-period.

Cascaded binary counters are used forconverting the high-frequency signals intolow-frequency signals. The parallel portof a computer is used for data input frombinary counters. This data is used formeasuring time and calculating thefrequency of the signal.

The block diagram shows the basicconnections of the counters and parallelport pin numbers on 25-pin ‘D’ connectorof a PC (control register 379 Hex is usedfor input). External hardware is used onlyfor converting the higher frequency sig-nals into low frequency signals. Thus, themajor role in frequency-measurement isplayed by the software.

The PC generates a time-interruptat a frequency of 18.21 Hz, i.e. afterevery 54.92 millisecond. Software usesthis time-interrupt as a time-reference.The control register of the PC’s parallelport is read and the data is stored con-tinuously in an array for approximately54.9 ms using a loop. This stored data isthen analysed bit-wise. Initially, thehigher-order bit (MSB or the seventh-bit) of every array element is scannedfor the presence of a complete squarewave. If it is found, its time period ismeasured and if not then the second-highest order bit (sixth bit) is scanned.This operation is performed till the thirdbit and if no full square wave is stillfound, an error message is generatedwhich indicates that either there is anerror in reading or the frequency signalis lower than 19 Hz.

Lower three bits of the control regis-

ter are not used. When a wave is found,along with its time-period and frequencycomponents, its measurement precision inpercentage is also calculated and dis-played. Number of data taken in 54.9 msis also displayed.

As stated above, the lower startingrange is about 19 Hz. Data is read forapproximately 54.9 ms. Thus, the lowestpossible frequency that can be measuredis 1/.0549 Hz. Lower frequency range de-pends only on the sampling time and ispractically fixed at 19 Hz (18.2 Hz, to beprecise). Upper frequency range dependson factors such as value of the MOD coun-ter used and the operating frequencyrange of the counter IC. If MOD-N coun-ter is used (where N is an integer), upper

limit (UL) of frequency is given byUL=19xN5 Hz. Thus for MOD 16 countersUL≈20 MHz, and for MOD 10 countersUL≈1.9 MHz. Care should be taken toensure that this upper limit is within theoperating frequency range of counter ICused. Precision of measurement is a ma-chine-dependent parameter. High-speedmachines will have better precision com-pared to others. Basically, precision de-pends directly upon the number of dataread in a standard time. Precision of mea-surement varies inversely as the value ofMOD counter used. Precision is high whenMOD 10 counters are used in place ofMOD 16 counters, but this will restrictthe upper limit of frequency measurementand vice-versa.

Page 152: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20142

PROGRA

M

PROGRAM IN TURBO C

#include <stdio.h>#include <dos.h>#include <conio.h>#define MOD 16 /* define counter mod used */#define LPT 0x379/* LPT1 input port address */void interrupt (*old_clock)();void interrupt new_clock ();static int t;void main(){ /* tick = Time for which LPT will be read */float div,mul,tick=54800.0; /* tick is in micro sec. */double fq,tm,pri;char data[50000],c;int count,ls,ps,k,j,N,st;unsigned i;old_clock = getvect(0x08);///* capturing time vector */setvect(0x08,new_clock); /* assigning new time vector */do{ i=0; t=0; clrscr();gotoxy(25,1); printf(“FREQUENCY MEASUREMENTS”);gotoxy(23,17); printf(“Press any key to Pause.....”);while(!kbhit()) /* reading LPT between two time interrupts */{ /* use “inp(LPT)” if using MS product */while(t<8) while(t>2 && t<4) {data[i] = inportb(LPT); i++; }}if(t==8){ div=tick/i; for(k=7;k>2;k—) /* analyzing each bit of read data */{ N=1; for(j=0;j<k;j++) N=N*2; st=0; count=0; ps=(data[0] & N); ls=ps; for(j=0;j<i;j++)

{ ps=data[j] & N; if(ls!=ps) st++; /* finding a complete wave */ if(st>0 && st<4) count++; if(st==3) break; /* wave found */ ls=ps; } if(st==3) /* calculate frequency of the wave */ {mul=1; for(j=3;j<k;j++) mul=mul*MOD;count--; printf(“%d %f %d “,k,mul,count); tm=((count*div)/mul); fq=1/tm; pri=(100.0/count); gotoxy(20,7); printf(“Frequency = %0.3lf Kilo Hz “, fq*1000); gotoxy(20,10); printf(“Time = %0.3lf micro sec “, tm); gotoxy(15,23); printf(“Precision = %0.5lf percent of mainfrequency”,pri); gotoxy(15,24); printf(“Samples taken in %0.2f ms = %d “, tick/1000, i); break; } if(st<3 && k==3) /* no complete wave was present */ { gotoxy(24,7); printf(“Error in Reading ...!”); } } } t=0; i=0; } getch(); gotoxy(13,21); printf(“ Press E Esc for Exit any other key to continue”); c=getch();}while (c!=27 && c !=’e’ && c!=’E’);setvect(0x08,old_clock); /* assigning original time interupt */}void interrupt new_clock() /* new time interrupt service */{ t++; (*old_clock)(); }

TELEPHONE NUMBER DISPLAYBHASKAR BANERJEE

The given circuit, when connectedin parallel to a telephone, dis-plays the number dialled from the

telephone set using the DTMF mode. Thiscircuit can also show the number dialledfrom the phone of the calling party. Thisis particularly helpful for receiving anynumber over the phone lines.

The DTMF signal—generated by thephone on dialling a number—is decodedby DTMF decoder CM8870P1 (IC1), whichconverts the received DTMF signal into

its equivalent BCD number that corre-sponds to the dialled number. This bi-nary number is stored sequentially in 10latches each time a number is dialled fromthe phone. The first number is stored inIC5A (1/2 of CD4508) while the secondnumber is stored in IC5B and so on. Thebinary output from IC1 for digit ‘0’ asdecoded by IC1 is 10102 (=1010), and thiscannot be displayed by the seven-segmentdecoder, IC10. Therefore the binary out-put of IC1 is passed through a logic-cir-

cuit which converts an input of ‘10102’into ‘00002’ without affecting the inputs‘1’ through ‘9’. This is accomplished bygates N13 through N15 (IC11) and N1(IC12).

The storing of numbers in respectivelatches is done by IC2 (4017). The datavalid output from pin 15 of IC1 isused to clock IC2. The ten outputs of IC2are sequentially connected to the storeand clear inputs of all the latches,except the last one, where the clear

Page 153: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 143

input is tied to ground. When an outputpin of IC2 is high, the correspondinglatch is cleared of previous data andkept ready for storing new data. Then,on clocking IC2, the same pin becomeslow and the data present at the inputsof that latch at that instant gets storedand the next latch is cleared and keptready. The similar input and outputpins of all latches are connected togetherto form two separate input and outputbuses.

There is only one 7-segment decoder/driver IC10 for all the ten displays. Thisnot only reduces size and cost but re-duces power requirement too. The out-put from a latch is available only whenits disable pins (3 and 15) are broughtlow. This is done by IC3, IC12 and IC13.IC3 is clocked by an astable multivibratorIC4 (555). IC3 also drives the displaysby switching corresponding transistors.When a latch is enabled, its correspond-ing display is turned on and the contentof that latch, after decoding by IC10,gets displayed in the corresponding dis-play. For instance, contents of IC5A aredisplayed on display ‘DIS1,’ that of IC5Bon ‘DIS2’ and so on. The system shouldbe connected to the telephone lines via aDPDT switch (not shown) for manualswitching, otherwise any circuit capableof sensing handset’s off-hook conditionand thereby switching relays, etc. can beused for automatic switching. The power-supply switch can also be replaced then.Such circuits, under different captions,can be found in EFY’s back issues.Though this circuit is capable of showinga maximum of ten digits, one can reducethe display digits as required. For doingthis, connect the reset pin of IC2, say,for a 7-digit display, with S6 output atpin 5.

The present circuit can be builton a veroboard and housed in asuitable box. The displays are common-cathode type. To make the systemcompact, small, 7-segment displays canbe used but with some extra cost. Also,different colour displays can be used forthe first three or four digits to separatethe exchange code/STD code, etc. Thecircuit can be suitably adopted forcalling-line display.

Readers Comments:❑ I would like to have the following doubtsclarified:

1. What is the function of externalreset switch S2? How it is used?

2. The pin connections of DIS1 to DIS9are not mentioned properly. How shouldwe connect them?

Sunny HercleasHyderabad

❑ I have the following queries regardingthis circuit:

1. What is meant by DTMF mode?2. Can the proposed circuit be used in

a telephone set that doesn’t have the

Page 154: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20144

DTMF output, e.g. Priyadarshni set?3. Can I use an LCD instead of 7-

segment display? If yes, what are thechanges to be made in the circuit?

4. Is it possible to increase the num-ber of 7-segment displays from 10 to 12?If yes, kindly suggest the changes to bemade in the circuit.

5. Can the proposed circuit beused with telephone exchanges whichhave calling line identification (CLI)facility?

T. KartikMadurai

The author Bhaskar Banarjee replies:In reply to Sunny Hercleas:When the circuit is switched on,

it is automatically reset, it has to bereset manually each time, which is doneusing switch S2. You may also use acomparator circuit to monitor the linevoltage and provide a positive pulse topin 15 of IC2 each time the handset inlifted.

Regarding displays, all the similarpins of the ten displays should be con-nected together and then the seven com-mon wires connected to the IC10. Also

note that the output of IC1corresponding to ‘0’ in thetelephone is converted to‘0’ binary by gates P1, P2,P3 and N1 (and not asstated in the text). Thougha 5V supply is shown, abetter choice would be a9V supply.

In reply to T. Kartik, Iwould like to thank thereader for showing inter-est in my circuit idea. Hereare the answers to his que-ries:

1. With modern tele-phones, we can dial anumber in pulse mode orin tone mode. In DTMF(dual-tone multi-frequency) mode (tonemode) of dialling, a particular frequencypair is generated corresponding to the keypressed instead of pulses in the pulsemode of dialling. The generated tones canbe heard in the earphone.

2. The present circuit cannot be usedwith telephones that don’t have tone dial-ling (DTMF) mode.

Fig. 1: Cascading for up to 18-digit display

3. LCD cannot be used with this cir-cuit. It is possible only after considerablechanges in the present circuit.

4. To increase the display up to 18digits, cascade another 4017 with IC2 asshown in Fig. 1.

5. This circuit can be used as CLI, butit is too basic and rather uneconomicalfor such purpose.

DIGITAL SWITCHING SYSTEMRAJESH K.P.

This circuit can control any one outof 16 devices with the help of twopush-to-on switches. An up/down

counter acts as a master-controller for thesystem. A visual indication in the form ofLEDs is also available.

IC1 (74LS193) is a presettable up/down counter. IC2 and IC3 (74LS154) (1of 16 decoder/demultiplexer) perform dif-

Page 155: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 145

ferent functions, i.e. IC2 is used to indi-cate the channel number while IC3switches on the selected channel.

Before using the circuit, press switchS1 to reset the circuit. Now the circuit isready to receive the input clock. By press-ing switch S2 once, the counter advancesby one count. Thus, each pressing ofswitch S2 enables the counter to advance

by one count. Likewise, by pressing switchS3 the counter counts downwards.

The counter provides BCD output.This BCD output is used as address inputfor IC2 and IC3 to switch one (desiredchannel) out of sixteen channels by turn-ing on the appropriate triac and the cor-responding LED to indicate the selectedchannel.

The outputs of IC3 are passed throughinverter gates (IC4 through IC6) becauseIC3 provides negative going pulses whilefor driving the triacs we need positive-going pulses. The high output of invertergates turn on the npn transistors to drivethe triacs. Diodes connected in series withtriac gates serve to provide unidirectionalcurrent for the gate-drive.

40-METRE DIRECTCONVERSION RECEIVER

PRADEEP G.

U sing the circuit of direct-conver-sion receiver described here, onecan listen to amateur radio QSO

signals in CW as well as in SSB mode inthe 40-metre band.

The circuit makes use of threen-channel FETs (BFW10). The firstFET (T1) performs the function of ant./RF amplifier-cum-product detector,while the second and third FETs (T2 andT3) together form a VFO (variable fre-quency oscillator) whose output is injected

into the gate of first FET (T1) through10pF capacitor C16. The VFO is tuned toa frequency which differs from theincoming CW signal frequency by about 1kHz to produce a beat frequency note inthe audio range at the outputof transformer X1, which is an audiodriver transformer of the type used intransistor radios.

The audio output from transformer X1is connected to the input of audio amplifierbuilt around IC1 (TBA820M) via volume

control VR1. An audio output from theAF amplifier is connected to an 8-ohm, 1-watt speaker.

The receiver can be powered by a 12-volt power-supply, capable of sourcingaround 250mA current. Audio-outputstage can be substituted with a readymadeL-plate audio output circuit used intransistor amplifiers, if desired. Thenecessary data regarding the coils usedin the circuit is given in the circuitdiagram itself.

Page 156: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20146

PRECISION 1HZ CLOCK GENERATORUSING CHIP-ON-BOARD

K. UDHAYAKUMARAN, VU3GTH

Usually the circuits for generationof 1Hz clock for applications indigital clock and counter circuits

make use of ICs in conjunction with acrystal and trimmer capacitors, etc. How-ever, similar or better accuracy can beachieved using a chip-on-board (COB)device found inside a digital clock, whichis readily available in the market forRs 15-20. This COB consists of IC, ca-pacitors and quartz crystal, etc which aremounted on its surface. It works on 1.4volt DC source. This COB can be used toderive 1Hz clock.

Resistor R1, capacitor C3, diodes D1and D2 shown in the circuit convert 5VDC into 1.4V DC. A ½Hz clock is avail-able at terminals A and B with a phasedifference of 90o. The two outputs, arecombined using capacitors C1 and C2 toobtain a complete 1Hz clock. This 1Hz

clock pulse has a very low amplitudeof the order of a few milli-volts whichcannot be used to drive the digital cir-cuits directly. This low-level voltage isamplified several times by op-amp ICCA3140.

The op-amp CA3140 is connected ina non-inverting mode, and its gain is setby resistors R4 and R3. Capacitor C2reduces the AC gain and unwanted straypick-up and thus improves stability ofthe circuit.

The input impedance of IC CA3140is very high and thus there is no drop at

the input when 1Hz clock signal of lowlevel is connected across its input termi-nals from the COB. Amplified 1Hz clockpulse is available at its output pin 6,which is further amplified by transistorsT1 and T2 to drive the digital clocks andtimers.

Preset VR1is offset nullcontrol used toadjust proper1Hz pulse at theoutput terminal‘E’. Connect oneLED in serieswith 220-ohmresistor betweenthe terminal ‘E’and ground and adjust preset VR1 tillthe LED blinks once every second.When using the COB, affix the same

on a general-pur-pose PCB using rub-ber based adhesiveand solder the ter-minals neatly usingthin single-strandwire.

Lab Note: TheCOBs used in dif-ferent watches maydiffer some-what intheir configuration.But by trial-and-error one canalways find out theappropriate pointscorresponding to

points A, B, C and D. Figure of a secondCOB used by EFY Lab is shown along-side. The points A and B (on the COBused by us) were observed to havecomplementary 1Hz outputs and henceanyone (only) could be used as input toopamp CA3140.

Readers Comments:❑ I thought of using these COBs whichare easily available as scrap at watchrepair shops. Is it possible to usethem with some add-on circuitry to

make digital clocks?R.R. KodialNew Delhi

The author K. Udhaya Kumaranreplies:

You may use an electronicquartz analogue wall clock COB inany circuit without any modification,but both terminals A and B should beused.

Page 157: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 147

ELECTRONIC JAMRAJESH K.P.

T his jam circuit can be used in quizcontests wherein any participantwho presses his button (switch)

before the other contestants, gets the firstchance to answer a question. The circuitgiven here permits up to eight contestantswith each one allotted a distinct number(1 to 8). The display will show the numberof the contestant pressing his button beforethe others. Simultaneously, a buzzer willalso sound. Both, the display as well asthe buzzer have to be reset manually usinga common reset switch.

Initially, when reset switch S9 is mo-mentarily pressed and released, all out-puts of 74LS373 (IC1) transparent latchgo ‘high’ since all the input data lines arereturned to Vcc via resistors R1 throughR8. All eight outputs of IC1 are connectedto inputs of priority encoder 74LS147 (IC2)

as well as 8-input NAND gate 74LS30(IC3). The output of IC3 thus becomeslogic 0 which, after inversion by NANDgate N2, is applied to latch-enable pin 11of IC1. With all input pins of IC2 beinglogic 1, its BCD output is 0000, whichis applied to 7-segment decoder/driver74LS47 (IC6) after inversion by hex in-verter gates inside 74LS04 (IC5). Thus, onreset the display shows 0.

When any one of the push-to-onswitches—S1 through S8—is pressed, thecorresponding output line of IC1 islatched at logic 0 level and the displayindicates the number associated with thespecific pressed switch. At the same time,output pin 8 of IC3 becomes high, whichcauses outputs of both gates N1 and N2to go to logic 0 state. Logic 0 output ofgate N2 inhibits IC1, and thus pressing

of any other switch S1 through S8 hasno effect. Thus, the contestant whopresses his switch first, jams the displayto show only his number. In the unlikelyevent of simultaneous pressing (withinfew nano-seconds difference) of more thanone switch, the higher priority number(switch no.) will be displayed.Simultaneously, the logic 0 output of gateN1 drives the buzzer via pnp transistorBC158 (T1). The buzzer as well thedisplay can be reset (to show 0) bymomentary pressing of reset switch S9so that next round may start.

Lab Note: The original circuit sentby the author has been modified as it didnot jam the display, and a higher numberswitch (higher priority), even whenpressed later, was able to change the dis-played number.

Page 158: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20148

T.K. HAREENDRAN

TINY DEW SENSOR

D ew (condensed moisture) ad-versely affects the normal per-formance of sensitive electronic

devices. A low-cost circuit described herecan be used to switch off any gadgetautomatically in case of excessivehumidity.

At the heart of the circuit is an inex-pensive (resistor type) dew sensor ele-ment. Although dew sensor elements arewidely used in video cassette players andrecorders, these may not be easily avail-able in local market. However, the same

can be procured from authorised servicecentres of reputed companies. The authorused the dew sensor for FUNAI VCPmodel No. V.I.P. 3000A (Part No: 6808-08-04, reference no. 336) in his prototype.In practice, it is observed that all dewsensors available for video applicationpossess the same electrical characteris-tics irrespective of their physical shape/size, and hence are interchangeable andcan be used in this project.

The circuit is basically a switchingtype circuit made with the help of a popu-

lar dual op-amp IC LM358N which is con-figured here as a comparator. (Note thatonly one half of the IC is used here.) Un-der normal conditions, resistance of thedew sensor is low (1 kilo-ohm or so) andthus the voltage at its non-inverting ter-minal (pin 3) is low compared to that atits inverting input (pin 2) terminal. Thecorresponding output of the comparator(at pin 1) is accordingly low and thus noth-ing happens in the circuit.

When humidity exceeds 80 per cent,the sensor resistance increases rapidly.As a result, the non-inverting pin becomesmore positive than the inverting pin. Thispushes up the output of IC1 to a highlevel. As a consequence, the LED insidethe opto-coupler is energised. At the sametime LED1 provides a visual indication.The opto-coupler can be suitablyinterfaced to any electronic device forswitching purpose.

Circuit comprising diode D1, resistorsR8 and R6 and capacitor C1 forms a low-voltage, low-current power supply unit.This simple arrangement obviates therequirement for a bulky and expensivestep-down transformer.

SUDHEESH N.

ELECTRONIC SCORING GAME

Y ou can play this game aloneor with your friends. Thecircuit comprises a timer IC,

two decade counters and a displaydriver along with a 7-segmentdisplay.

The game is simple. As statedabove, it is a scoring game and thecompetitor who scores 100 pointsrapidly (in short steps) is the win-ner. For scoring, one has the optionof pressing either switch S2 or S3.

Page 159: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 149

Switch S2, when pressed, makes the coun-ter count in the forward direction, whileswitch S3 helps to count downwards. Be-fore starting a fresh game, and for thatmatter even a fresh move, you must pressswitch S1 to reset the circuit. Thereafter,press any of the two switches, i.e. S2 orS3.

On pressing switch S2 or S3, thecounter’s BCD outputs change veryrapidly and when you release the switch,the last number remains latched at theoutput of IC2. The latched BCD numberis input to BCD to 7-segment decoder/driver IC3 which drives a common-anode display DIS1. However, you canread this number only when you pressswitch S4.

The sequence of operations for play-ing the game between, say two players ‘X’and ‘Y’, is summarised below:

1. Player ‘X’ starts by momentarypressing of reset switch S1 followedby pressing and releasing of eitherswitch S2 or S3. Thereafter he pressesswitch S4 to read the display (score)and notes down this number (say X1)manually.

2. Player ‘Y’ also starts by momen-tary pressing of switch S1 followedby pressing of switch S2 or S3 andthen notes down his score (say Y1),after pressing switch S4, exactlyin the same fashion as done by the firstplayer.

3. Player ‘X’ again presses switch S1

SIMPLE SENSITIVE REMOTECONTROL TESTER

HARISH KUMAR

Here is a handy gadget for test-ing of infrared (IR) based re-mote control transmitters used

for TVs and VCRs etc.The IR signals from a remote control

transmitter are sensed by the IR sensormodule in the tester and its output atpin 2 goes low. This in turn switches ontransistor T1 and causes LED1 to blink.At the same time, the buzzer beeps atthe same rate as the incoming signalsfrom the remote control transmitter. Thepressing of different buttons on the re-mote control will result in different pulserates which would change the rate atwhich the LED blinks or the buzzerbeeps.

When no signal is sensed by thesensor module, output pin 2 of the sen-sor goes high and, as a result, transistorT1 switches off and hence LED1 andbuzzer BZ1 go off. This circuit requires5V regulated power supply which can beobtained from 9V eliminator and con-nected to the circuit through a jack.

Capacitor C1 smoothes DC inputwhile capacitor C2 suppresses any spikesappearing in the input supply.

Proper grounding of the metal casewill ensure that the electromagnetic emis-sions which are produced by tube-lightsand electronic ballasts etc (which liewithin the bandwidth of receiver circuit)

and repeats the steps shown in step 1above and notes down his new score (say,X2). He adds up this score to his previousscore. The same procedure is repeated byplayer ‘Y’ in his turn.

4. The game carries on until the scoreattained by one of the two players totalsup to or exceeds 100, to be declared as thewinner.

Several players can participate in thisgame, with each getting a chance to scoreduring his own turn.

The circuit may be assembledusing a multipurpose board. Fix thedisplay (LEDs and 7-segment display) ontop of the cabinet along with thethree switches. The supply voltage forthe circuit is 5V.

are effectively grounded and do not inter-fere with the functioning of the circuit.The proposed layout of the box containingthe circuit is shown in the figure. The 9-volt DC supply from the eliminator canbe fed into the jack using a banana-typeplug.

Page 160: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20150

ULTRA LOW DROP LINEARREGULATOR

P.S. SINI

T he circuit is a MOSFET basedlinear voltage regulator with avoltage drop of as low as 60 mV

at 1 ampere. Drop of a fewer millivolts ispossible with better MOSFETs havinglower RDS(on) resistance.

The circuit in Fig. 1 uses 15V-0-15Vsecondary output from a step-down trans-former and employs an n-channelMOSFET IRF540 to get the regulated 12Voutput from DC input, which could be aslow as 12.06V. The gate drive voltage re-quired for the MOSFET is generated us-ing a voltage doubler circuit consisting ofdiodes D1 and D2 and capacitors C1 andC4. To turn the MOSFET fully on, thegate terminal should be around 10V abovethe source terminal which is connected tothe output here. The voltage doubler feedsthis voltage to the gate through resistorR1. Adjustable shunt regulator TL431(IC2) is used here as an error amplifier,and it dynamically adjusts the gate volt-age to maintain the regulation at the out-put.

With adequate heatsink for theMOSFET, the circuit can provide up to 3A

output at slightly elevated minimum volt-age drop. Trimpot VR1 in the circuit is usedfor fine adjustment of the output voltage.Combination of capacitor C5 and resistorR2 provides er-r o r - a m p l i f i e rcompensation.

The circuit isprovided with as h o r t - c i r c u i tcrow-bar protec-tion to guard thec o m p o n e n t sagainst over-stress during ac-cidental short atthe output. Thiscrow-bar protec-tion will work asfollows: Under normal working conditions,the voltage across capacitor C3 will be6.3V and diode D5 will be in the off statesince it will be reverse-biased with theoutput voltage of 12V. However, duringoutput short-circuit condition, the outputwill momentarily drop, causing D5 to con-duct and the opto-triac MOC3011 (IC1)

will get triggered, pulling down the gatevoltage to ground, and thus limiting theoutput current. The circuit will remainlatched in this state, and input voltage

has to be switched off to reset the circuit.The circuit shown in Fig. 2 follows a

similar scheme. It can be utilised whenthe regulator has to work from a DC railin place of 15V-0-15V AC supply. The gatevoltage here is generated using an LM555charge pump circuit as follows:

When 555 output is low, capacitor C2will get charged through di-ode D1 to the input voltage.In the next half cycle, whenthe 555 output goes high, ca-pacitor C3 will get charged toalmost double the input volt-age. The rest of the circuitworks in a similar fashion asthe circuit of Fig. 1.

The above circuits will helpreduce power-loss by allowingto keep input voltage range tothe regulator low during ini-tial design or even in existingcircuits. This will keep the out-put regulated with relativelylow input voltage compared tothe conventional regulators.

The minimum voltagedrop can be further reducedusing low RDS(on) MOSFETs orby paralleling them.Fig. 1

Fig. 2

Page 161: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 151

MAGNETIC PROXIMITY SWITCHT.K. HAREENDRAN

H ere is an interesting circuit fora magnetic proximity switchwhich can be used in various

applications.The circuit, consists of a reed switch

at its heart. When a magnet is broughtin the vicinity of the sensor (reed switch),its contacts close to control the restof the switching circuit. In place of thereed switch, one may, as well, use ageneral-purpose electromagnetic reed re-lay (by making use of the reed switchcontacts) as the sensor, if required. Thesetiny reed relays are easily available asthey are widely used in telecom prod-ucts. The reed switch or relay to be usedwith this circuit should be the ‘normallyopen’ type.

When a magnet is brought/placedin the vicinity of the sensor elementfor a moment, the contacts of thereed switch close to trigger timerIC1 wired in monostable mode. As

a consequence its output at pin 3goes high for a short duration andsupplies clock to the clock input(pin 3) of IC2 (CD4013—dual D-typeflip-flop). LED D2 is used as a responseindicator.

This CMOS IC2 consists of two inde-pendent flip-flops though here only one is

used. Note that the flip-flop is wired intoggle mode with data input (pin 5) con-nected to the Q (pin 2) output. On receiptof clock pulse, the Q output at pin 1changes from low to high state and due tothis the relay driver transistor T1 getsforward-biased. As a result the relay RL1is energised.

A. JEYABAL

SIMPLE LOW-COSTDIGITAL CODE LOCK

Many digital code lock circuitshave been published in thismagazine. In those circuits a

set of switches (conforming to code) arepressed one by one within the specifiedtime to open the lock. In some other cir-cuits, custom-built ICs are used and posi-tive and negative logic pulses are keyedin sequence as per the code by twoswitches to open the lock.

A very simple low-cost digital code

lock circuit is presented in this article.Here the keying-in code is rather unique.Six switches are to be pressed to openthe lock, but only two switches at a time.Thus a total of three sets of switcheshave to be pressed in a particular se-quence. (Of these three sets, one set isrepeated.) The salient features of thiscircuit are:

1. Use of 16 switches, which suggeststhat there is a microprocessor inside.

2. Elimination of power amplifier tran-sistor to energise the relay.

3. Low cost and small PCB size.An essential property of this electronic

code lock is that it works in monostablemode, i.e. once triggered, the outputbecomes high and remains so for a periodof time, governed by the timingcomponents, before returing to the quies-cent low state. In this circuit, timer IC555 with 8 pins is used. The IC is inex-

Page 162: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20152

pensive and easily available. Its pin 2 isthe trigger input pin which, when heldbelow 1/3 of the supply voltage, drives theoutput to high state. The threshold pin 6,when held higher than 2/3 of the supplyvoltage, drives the output to low state. Byapplying a low-going pulse to the resetpin 4, the output at pin 3 can be broughtto the quiescent low level. Thus the resetpin 4 should be held high for normal op-eration of the IC.

Three sets of switches SA-SC,S1-S8 and S3-S4 are required to bepressed, in that order, to open the lock.On pressing the switches SA and SCsimultaneously, capacitor C3 chargesthrough the potential divider comprisingresistors R3 and R4, and on releasing

these two switches, capacitor C3 startsdischarging through resistor R4. Capaci-tor C3 and resistor R4 are so selectedthat it takes about five seconds to fullydischarge C3.

Depressing switches S1 and S8 in uni-son, within five seconds of releasing theswitches SA and SC, pulls pin 2 to groundand IC 555 is triggered. The capacitor C1starts charging through resistor R1. As aresult, the output (pin 3) goes high forfive seconds (i.e. the charging time T ofthe capacitor C1 to the threshold voltage,which is calculated by the relation T=1.1R1 x C1 seconds).

Within these five seconds, switches SAand SC are to be pressed momentarily onceagain, followed by the depression of last

code-switch pair S3-S4. These switchesconnect the relay to output pin 3 and therelay is energised. The contacts of the relayclose and the solenoid pulls in the latch(forming part of a lock) and the lock opens.The remaining switches are connected be-tween reset pin 4 and ground. If any one ofthese switches is pressed, the IC is resetand the output goes to its quiescent lowstate. Possibilities of pressing these resetswitches are more when a code breakertries to open the lock.

LED D5 indicates the presence ofpower supply while resistor R5 is a cur-rent limiting resistor.

The given circuit can be recoded eas-ily by rearranging connections to theswitches as desired by the user.

HAND PROXIMITY MUSICALTONE GENERATOR

RISHI KHATRI

This circuit generates a musicaltone whose pitch varies as thedistance of the hand from the sen-

sor varies. It consists of two stages:1. Hand proximity detector2. Oscillator and output stageThe detector portion consists of a sen-

sor plate (10cm x 10cm) which can bemade from an aluminium sheet, or wemay use a circular loop (10cm in diam-eter) made from an insulated copper oraluminium wire. The capacitance betweenthe sensor plate (or loop) and ground

through a player’s hand will vary as thehand’s distance varies from the sensor.

The sensor plate is connected to anunstable op-amp IC1(a) (1/2 µA747) whichoscillates at varying frequency in theneighbourhood of 20 kHz. This frequencylies in the slew rate limited range. Thusoutput at pin 12 of IC1 is a triangularwave whose peak varies with frequency.This is followed by a peak detector wiredaround IC1(b).The net output of proxim-ity detector is a voltage whose magnitudedepends upon distance of hand from

the sensor.The output of hand proximity detec-

tor is fed to IC2(a) which forms a voltagecontrolled oscillator. The output of oscil-lator at pin 12 of IC2 is a triangularwave whose frequency lies in the audiorange. This output is fed into power stagerealised from µA741 (IC3) acting as avoltage amplifier followed by a powerstage which uses TIP 122 (npn) andTIP127(pnp) power Darlingtons connectedin class AB complementary push-pull con-figuration. Their output is fed into an 8-

Page 163: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 153

PRADEEP G.

WIRELESS MUSICAL CALLING BELL

M usical and voice-generatingelectronic calling bells are verypopular nowadays. These call-

ing bells use a pair of wires between theswitch and bell circuit. The circuit ideadescribed here is for a remote wirelesscalling bell which can work up to a dis-tance of about 15 metres.

For wireless operation, a pair of sealedVHF remote control transmitter andreceiver modules have been employed.

Transmitter module VG40T is com-pact, measuring 3.4cm x 2.9cm x 1cm. It

has three terminals. One lead is con-nected to a compact 9V PP3 battery andthe other is connected to negative termi-nal of the battery. Central terminal isconnected to trigger switch as shown inthe diagram. The transmitter’s standbycurrent is only 5 microamperes. Thus a9V PP3 battery would have a long lifewhen used in this circuit. When microswitch S1 is pressed, a modulated signalis transmitted which has a receptionrange of about 15 metres (50 feet) fromthe transmitter module.

Remote control receiver moduleVG40R is connected in input side of themusical bell as shown in the figure.

Dimensions of receiver module are4.5cm x 2.1cm x 1.3cm. This module isalso sealed and has three externalterminals. One terminal is positive andthe other is negative across which a 3Vbattery is connected. The third terminal,the trigger terminal, is connected toinput of musical circuit as shown in thediagram. Standby current drawn bythe receiver module is about 300 micro-

amperes.No PCB is required for the

transmitter because transmit-ter module does not need anyexternal component. Transmit-ter generates VHF signals ofabout 300 MHz frequency. PCBof musical section is freelyavailable from the componentsvendors at a low cost. Modulescan be connected to the circuitwith a short length of flexiblewire.

Connect a 9V PP3 batteryFig. 1: Transmitter Fig. 2: Receiver

ohm, 4W loudspeaker. The maximum out-put thus obtained is 3.6W.

Log potentiometer VR2 (10 kilo-ohm)can be used to adjust the volume. TIP122and TIP127 should be mounted on sepa-rate heat sinks or on the same heat sinkbut should be isolated from the heat sinkusing a mica sheet insulator.

Variable resistor VR1 is a 10klinearly variable resistance. Its wiperarm is varied and adjusted until loud-speaker output lies in reasonablefrequency range and the sound is pleas-ant to hear—with your hand and bodyaway from the sensor. Then as the handis brought near the sensor, the outputfrequency decreases. Potmeter VR1should, in fact, be so adjusted that theoutput becomes zero when the hand isbrought extremely close to the sensor(without touching it).

Page 164: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20154

to the transmitter and 3V battery to thereceiver. Keep the transmitter at a dis-tance of about 5 metres. Press pushswitch S1 of transmitter for a moment.The music will be heard from the remotebell. After completing a musical note, it

Readers Comments:❑ In the call bell circuit, modules VG40Tand VG40R have been used. Where canthese be procured from? Can an aerial beattached to the circuit to extend the rangefurther?

can be connected to these moduleswithout opening their plastic moulding.These remote control modules areavailable with leading componentsuppliers in metro cities, such as VishaElectronics, Mumbai.

will automatically stop. Depression ofswitch S1 on transmitter again willgenerate the musical tone again.

If UM3481/3482 ICs are used in thecircuit, 12 different tunes can be heard.If CIC4822 IC is used, then up to 16

tunes can be heard. Transmitter andreceiver-sealed modules have no antenna.Without any antenna, a range of up to15 metres is possible. Range will behigher if the gadget is used in openspace.

K. VenugopalCuddapah

The author, Pradeep G. replies:VG40T transmitter and VG40R

receiver are scaled modules which haveno antenna terminal. Thus no aerial

SIMPLE TELEPHONEPRIVACY CIRCUIT

RAJ K. GORKHALI

When several telephone exten-sions use one telephone linepair, it becomes possible for an-

other extension user to overhear your con-versation. This very simple circuit arrange-ment prevents that possibility, cutting offall extensions except the one in use, withno discernible effect on performance.

As the diagram shows, each handsetis connected via a diac. The telephone linevoltage is around 48V DC when allhandsets are on hook and it drops to 6V to10V DC when any one of the handsets islifted. Diacs start to conduct when theapplied voltage is above their breakovervoltage of ± 25 to 35V DC and continue toconduct when voltage drops to a low level,

ceasing conductionwhen current is too lowto sustain it.

Diacs permit theringing tone to pass,since they conductboth ways as long aspeak voltage exceedstheir break-over volt-age of ± 25V to 35V.If an extension thenlifts its handset, breakdown occurs atthat diac and the extension is operativesince the diac is conducting with 6V nowacross it and with a current of around 20mA through the handset. The other diacscannot break over at this voltage of 6V

to 10V.If two handsets are lifted simulta-

neously, the one with the diac of lowerbreakover voltage will be activated. Thusat one time only one of the several exten-sions become operative.

BIDIRECTIONAL CODE CONVERTERP.R. NARAYANASWAMY

There are a number of codes in usein digital systems. One such codeis the Gray code. A number in

natural binary can be converted to Gray

code or vice versa using EXCLUSIVE OR(XOR) gates. Only the modes of connec-tion of the XOR gates differ. This is illus-trated in Fig. 1(a). When switches S1(a)

and S1(b) are in position 1, the circuitworks as a binary-to-Gray code converter.In position 2 of these switches, it func-tions as a Gray-to-binary code converter.

Page 165: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 155

The number of switches in-creases with the increasingvalue of binary or Gray codeinput.

These switches can bereplaced by a 2-line to 1-linemultiplexer shown in Fig.1(b). In Fig. 1(b), whenswitch S1 is at logic 1, the

upper AND gate isenabled, perform-ing binary-to-Graycode conversion.When switch S1 isflipped to logic 0,the lower ANDgate is enabled,performing Gray-to-binary code con-version.

A complete 6-bit code converterusing quad 2-lineto 1-line multi-plexer 74LS157(IC1) is shown inFig. 1(c). Data bits

D5-D0 are the input code bits and Y5-Y0are the output code bits. When switch isin logic 1 position, the output at pins 4, 7,9 and 12 of 74LS157 correspond to inputdata bits D4 - D1 respectively, perform-ing binary-to-Gray code conversion. Whenswitch S1 is flipped to logic 0, the outputsat pins 4, 7, 9 and 12 of IC1 correspond tooutput data bits Y4 - Y1 respectively, per-

forming Gray-to-binary codeconversion.

Fig. 2 shows a test circuitwhich the author used fortesting of the code converterusing software (MICRO-LOGIC II). For clarity andsimplicity in testing thecircuit using software MI-CROLOGIC II, a four-bit in-put code is used. The data in-puts DATA4 to DATA1 are forgenerating a four-bit inputcode D3 - D0 ranging from 00 0 0 through 1 1 1 1 in as-cending order. DATA5 in Fig.2 simulates the switch S1 inFig. 1(c).

The simulation resultsobtained are shown in Fig. 3.When data S is at logic 0 (low)

position, a Gray code input (Y3-Y0) of 0 11 1 results in corresponding binary output(D3-D0) of 0 1 0 1. Similarly, when signalS is at logic 1 (high), a binary input (D3 -D0) of 0 1 1 1, results in the correspond-ing Gray code output (Y3 - Y0) of 0 1 0 0.When signal S was low and also when itwas high, all other input codes and thecorresponding output codes were verifiedand found correct.

Simulation results indicate that thecode converter of Fig. 1(c) performsbi-directional code conversion. The codeconverter of Fig. 1(c) is thus an idealproposition. This is an interestinglaboratory assignment for undergradu-ate degree curriculum in ElectricalEngineering.

Page 166: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20156

PRIORITY INDICATORFOR QUIZ CONTESTS

SUSOBHAN DAS

In a quiz show, a contestant whopresses his button before any othercontestant gets the top priority for

answering the quiz. Similarly, the prior-ity of the other contestants is decided bythe order in which each one presses his/her answer button.

In this circuit, the main role is playedby IC3 (74LS89) which is a 64-bit RAMorganised as 4-bit x 16-word array. It isused for storing the sequence in whichthe contestants, during a quiz contest,

press their buttons. The present circuitcan be used for a maximum of four con-testants.

The answer button allocated to eachcontestant is used in conjunction with anon-retriggerable monostable flip-flop74LS121. These mono flip-flop ICs (IC5through IC8) function with switches S1through S4 respectively. IC4, which isagain a 74LS121 flip-flop, is used for gen-erating a write pulse (active low) for writ-ing the status (Q output logic level) on

data lines of RAM against the currentaddress (on its address lines A0 throughA3). A sixth 74LS121 (IC10) is used forviewing/checking the contestants’ prior-ity for answering the quiz and also forclearing contents of the selected RAM lo-cation by writing 0000 against it.

For understanding the circuit opera-tion, assume that switch S7 is in normalposition, switch S8 is open and counterIC2 (74LS93) is reset (with the help ofswitch S6) so that all of its output pins

Page 167: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 157

are low. Thus initial address output ofIC2 is 0000. This address (0) is also dis-played on 7-segment display after decod-ing by IC1 (74LS47). This is the situationat the start of a fresh quiz.

At this stage if any competitorpresses his answer button, the concerned74LS121 generates a single clock pulseat its Q output. This Q output is con-nected to a specific data line of IC3.Simultaneously Q output of the same74LS121 IC causes output of IC9 (74LS20)to go high and triggers IC4. The Q outputof IC4 is used for writing the data presenton data lines at address 0000. The ad-dress which was being indicated on thedisplay (0), gets incremented by one atthe trailing end of the pulse whichbecomes available at the output of 74LS20

(IC9) when Q output of any of the fourflip-flops (IC5 through IC8) makes atransition from high to low.

Now that the address has incrementedto 0001 at the output of 74LS93 (IC2), thenext depression of an answer button by acompetitor has his data (logic 1) writtenagainst address 0001. The address line atend of each depression of the switches (S1through S4) increments by one so as toenable writing of new data at anincremented address.

When answering time allotted for aquestion is over, the person conducting thequiz flips switch S7 to check position andresets counter output to 0000 using resetswitch S6. Now the contestant which hadpressed his button first would be indicatedby lighting of the corresponding lamp (L1

through L4). This happens because onlythat data output pin (5, 7, 9 or 11) whichcorresponds to the first depression of ananswer button by a specific contestantwould go to logic 0 and activate correspond-ing relay/bulb via its driver transistor (T1through T4). The address of the concernedcontestant is simultaneously displayed on7-segment display.

The address can be incremented byone by a momentary depression of switchS5 to check the next contestant whopressed his answer button next. Afterthe round is over, switch S7 is tobe flipped to its normal position. SwitchS8, which is optional, can be used forerasing RAM contents against the dis-played locations by pressing switch S5momentarily.

DUAL-CHANNEL DIGITALVOLUME CONTROL

SHEENA K.

This circuit could be used for re-placing your manual volume con-trol in a stereo amplifier. In this

circuit, push-to-on switch S1 controls theforward (volume increase) operation ofboth channels while a similar switch S2controls reverse (volume decrease) opera-tion of both channels.

Here IC1 timer 555 is configured asan astable flip-flop to provide low-fre-quency pulses to up/down clock inputpins of pre-setable up/down counter74LS193 (IC2) via push-to-on switches

S1 and S2. To vary the pulse width ofpulses from IC1, one may replace timingresistor R1 with a variable resistor.

Operation of switch S1 (up) causes thebinary output to increment while opera-tion of S2 (down) causes the binary outputto decrement. The maximum count being15 (all outputs logic 1) and minimumcount being 0 (all outputs logic 0), it re-sults in maximum and minimum volumerespectively.

The active high outputs A, B, C andD of the counter are used for controlling

two quad bi-polar analogue switches ineach of the two CD4066 ICs (IC3 andIC4). Each of the output bits, when high,short a part of the resistor network com-prising series resistors R6 through R9for one channel and R10 through R13for the other channel, and thereby con-trol the output of the audio signals be-ing fed to the inputs of stereo amplifier.Push-to-on switch S3 is used for reset-ting the output of counter to 0000, andthereby turning the volume of both chan-nels to the minimum level.

Page 168: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20158

WATER LEVEL CONTROLLERCUM MOTOR PROTECTOR

RAMAKRISHNAN K.

Nowadays, usage of overhead tank(OHT) with an electrically oper-ated water pump is a common

sight. The pump, being a costly item,should be protected against damage dueto high and low voltages. People find itvery inconvenient to switch off the pumpeven when their OHT starts overflowing,specially when they are busy or it is rain-ing. This circuit provides a solution for allsuch problems. The main features of thiscircuit are:

1. Low and high voltage cut-off2. Automatic switching off of motor

when overhead tank is full3. Use of convenient push-to-on but-

tons for switching on and switching off ofmotor.

The heart of the circuit is IC CD4011,which has four inverter gates. When thecircuit gets 12V power supply, capacitorC1 pulls input of N1 low, and this causesthe output of N2 to go low. This state is

latched by resistor R1 and transistor T1is biased to cut-off state, and hence bothrelay RL1 and motor M are in off state.

When we push switch S1 momentarily,the input of inverter gate N1 becomes highand output of gate N2 also becomes high.As a result, transistor T1 turns on and bothrelay RL1 and motor are activated (pro-vided transistors T2 and T3 are forwardbiased). When water level in OHTtouches the sensors, input of N1 becomelow, which turns relay RL1 off and themotor stops. The motor can be turned offmanually also by pushing switch S2 atany time. Transistors T2 and T3 are bothforward biased if the line voltage iswithin certain low and high voltage limits,as explained below.

When the voltage level rises above apre-determined value, input to gate N3becomes high and its output become low,which turns off transistor T2 and also therelay. When the voltage level drops below

a pre-determined value, output of gateN4 becomes high, which turns offtransistor T3 and relay RL1. Thus whenthe mains AC voltage (or the DC voltagesample derived from mains) is above orbelow certain limits, which could damagethe pump motor, the supply to the motor

is cut-off.D2 provides a constant DC voltage

to IC1.For setting the low voltage cut-off,

adjust potmeter VR2 in such a way thatwhen supply voltage goes below 190V,output of N4 goes high. Similarly, forsetting the high voltage cut-off, adjustpotmeter VR1 in such a way that whensupply voltage goes above 250V, outputof N3 goes low. The high and low cut-offvoltages can be changed according tothe requirement for a given motor.

Two wires are needed to connect thecircuit to the sensors which are fittedin the OHT. Sensors must be fitted asshown in figure. A simple power supplycircuit is also shown here. The circuitcan be assembled on a general-purposePCB and housed in an eliminator casewhich is easily available in the market.Use good-quality insulated wire to con-nect sensor to the circuit.

Page 169: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 159

UNDER VOLTAGE CUT-OUTAND DELAY FORREFRIGERATORS

S. CHANDRA SEKHAR

The circuits previously published,and also those which are used inmajority of voltage stabilisers sold

in the market, either use too many com-ponents to perform what is after all asimple task, or perform this task badly,or both. Some elaborate designs use 555timers and comparator ICs but the delayis present at the start of each power-up.

Other circuits implement the timedelay correctly as the minimum timebetween power off and power on.That is, time delay is not executed ifthe power failure lasts longer thanthe set time delay. But then, this typeof time delay uses relay contacts forswitching the timing capacitor around -but the relay contacts designedfor high current do not switchlow voltages verywell. And slightmisalignment orwear and tear of thecontacts is reflectedin erratic timing.

The circuitpresented here usesthe principle ofcharging a capacitorduring the ‘on’ timeand discharging itthrough a resistorduring the ‘off’ time.This is implementedelectronically, avoid-ing relay contacts.Consequently, therelay can be a simple‘normally off’ type.The rest of the circuit,including the voltagesensing part, is thesame as that pub-

lished in various circuit ideas and alsoincorporated in the devices available inthe market.

This circuit is most economical asboth the above-mentioned functionsare implemented using only three tran-sistors, and needs only a single contact(N/O type) relay. Since the operatingforces are not shared amongst multiplecontacts, the relay with a singlecontact is sturdier than multiple contacttypes. The time delay is entirely electronic,does not use relay contacts for switchingand comes into operation only whenneeded.

When relay RL1 operates, its contactsconnect the supply voltage to the com-pressor in the refrigerator. At the sametime, capacitor C2 charges to the supply

voltage through diode D6 and resistor R6.When the supply fails, capacitor C2discharges through resistors R7 and R8and the base-emitter junction of transis-tor T3. If the supply is resumed after theset time delay, capacitor C2 will be com-pletely discharged and transistor T3 wouldremain cut-off.

If the supply resumes before capacitorC2 has been completely discharged,transistor T3 turns on and clampsthe base of transistor T2, preventingit from turning on. The emitter currentof transistor T3 (about 200 microamperes)is insufficient to actuate the relay.When, after the required delay, transistorT3 turns off, the base of transistorT2 rises to the fraction of the supplyvoltage set by preset VR1. If this voltage is

Page 170: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20160

greater than 7.4 volts (zener voltage + VBE

of transistor T2) then transistor T2 turnson, applying forward bias to transistor T1,which drives the relay on. If this voltagefalls below 7.4V, transistor T2 will turnoff, cutting off the base current of transis-tor T1 which turns off, causing the relay tode-energise. Preset VR1 is used to adjustthe voltage corresponding to the mainsvoltage, at which this happens.

Resistors R3 and R4 introduce posi-tive feedback for a certain amount ofhysterisis. This is necessary to prevent

INFRARED CORDLESSHEADPHONE

PRADEEP G.

U sing this low-cost project one canreproduce audio from TV with-out disturbing others. It does not

use any wire connection between TV andheadphones. In place of a pair of wires, ituses invisible infrared light to transmitaudio signals from TV to headphones.Without using any lens, a range of up to6 metres is possible. Range can be ex-tended by using lenses and reflectors withIR sensors comprising transmitter andreceiver.

IR transmitter uses two-stage tran-

sistor amplifier to drive two series-con-nected IR LEDs. An audio outputtransformer is used (in reverse) to coupleaudio output from TV to the IR transmit-ter. Transistors T1 and T2 amplifythe audio signals received from TVthrough the audio transformer. Low-impedance output windings (lower gaugeor thicker wires) are used for connectionto TV side while high-impedance wind-ings are connected to IR transmitter.This IR transmitter can be powered froma 9-volt mains adapter or battery. Red

relay chatter because the supply voltagedrops as the relay turns on. If over-voltage cut-off is also desired, therequired circuitry around transistor T4may be added. Preset VR2 may be ad-justed such that transistor T4 conductswhen the mains voltage reaches the over-voltage level. This would cause the col-lector of transistor T4 (and base oftransistor T2) to be clamped to around6V to cut-off transistors T2 and T1 andrelay RL1.

The time delay is dependent on

the supply voltage to a certain extent.Connecting a 12V, 250mW zener diodeacross capacitor C2 will eliminate thisdependence.

The circuit can be assembled on ageneral-purpose PCB and convenientlywired into the refrigerator. This hasthe advantage that the lamp inside therefrigerator is always operational, andthat the compressor motor is protectedeven if the thermostat turns off and on inquick succession.

LED1 in transmitter circuit functions asa zener diode (0.65V) as well as supply-on indicator.

IR receiver uses 3-stage transistoramplifier. The first two transistors (T4and T5) form audio signal amplifier whilethe third transistor T6 is used to drive aheadphone. Adjust potmeter VR2 for max.clarity.

Direct photo-transistor towards IRLEDs of transmitter for max. range. A 9-volt battery can be used with receiver forportable operation.

Page 171: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 161

STABILISER WITH AUTOCUT-OFF ARRANGEMENT

S.C. DAS

Stabilisers incorporating auto cut-off arrangement are manufac-tured by most of the reputed

manufacturers using different methods.The stabiliser circuit presented heremakes use of the following major compo-nents to provide the auto cut-off facility:

1. One relay with single changeovercontacts

2. One relay with two changeover con-tacts

3. One start push-button, a DPDTchangeover switch and a rotary switch

4. One bridge rectifier to energise the

relay at serial No. 1.To operate the stabiliser, it is to be

plugged into a mains wall socket andthe following sequence of operations isto be performed:

Start push-button is momentarilypressed so that the neutral line connec-

Readers Comments:❑ I have doubt on the audio outputtransformer, as the rating was not men-tioned on it. I used a 6V audio outputtransformer. Also, the part number ofthe IR phototransistor in the receiverwas not mentioned. Please clear

my doubts.Sukanta Kumar Swain

Ganjam, OrissaEFY: You have correctly used the6V audio output transformer. Thereare a number of brands availablein the market. You can use 2-pin

phototransistors. The part numbers areTS-8, PT-224, and SLT-15 flat head(product brochure is available at‘www.microimpex.com’ of Mumbai). Thepin with a longer lead is normally thecollector and the pin with a shorter leadis the emitter.

Page 172: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20162

tion to lower limb of auto-transformer iscompleted through it while the other limbof auto-transformer is connected to liveline through one of the contacts of theDPDT switch. The voltage developedacross secondary of transformer X1 isavailable to the bridge rectifier via oneset of normally-closed contacts of relayRL1. As a result relay RL2 getsenergised to provide hold-on contactsacross start switch S1 to connect neutralline to the neutral point of outputsocket as well as the lower limb of auto-transformer. The live line from theselected (by rotary switch S4) tap of the

auto-transformer is connected to livepoint of the output socket via contacts ofswitch S3 and second set of normally-closed contacts of relay RL1. Notethat rotary switch is thrown to upposition when mains voltage is higherthan the required output voltage and itis flipped to down position when mainsvoltage is lower than the output voltage.

The secondary of transformer X1 isalso used to sample the output voltage.When the output voltage exceeds apreset value, dependent upon thethreshold value set by preset VR1, tran-sistor T1 conducts and as a result

B.P. LADGAONKAR

SIMPLE ANALOGUE-TO-DIGITAL CONVERTER

N ormally analogue-to-digital con-verter (ADC) needs interfacingthrough a microprocessor to con-

vert analogue data into digital format. Thisrequires additional hardware and neces-sary software, resulting in increased com-plexity and hence the total cost.

The circuit of A-to-D converter shown

here is configured around ADC 0808,avoiding the use of a microprocessor. TheADC 0808 is an 8-bit A-to-D converter,having data output lines D0-D7. It workson the principle of successive approxima-tion. It has a total of eight analogue inputchannels, out of which any one can be se-lected using address lines A, B and C.

Here, in this case, input chan-nel IN0 is selected by ground-ing A, B and C address lines.

Usually the control signalsEOC (end of conversion), SC(start conversion), ALE (ad-dress latch enable) and OE(output enable) are interfacedby means of a microprocessor.However, the circuit shownhere is built to operate in itscontinuous mode without usingany microprocessor. Thereforethe input control signalsALE and OE, being active-high,are tied to Vcc (+5 volts). Theinput control signal SC, beingactive-low, initiates start ofconversion at falling edge of thepulse, whereas the outputsignal EOC becomes high aftercompletion of conversion

(digitisation). This EOC output is coupledto SC input, where falling edge of EOCoutput acts as SC input to direct the ADCto start the next conversion.

As the conversion starts, EOC signalgoes high. At next clock pulse EOC out-put again goes low, and hence SC is en-abled to start the next conversion. Thus,it provides continuous 8-bit digital outputcorresponding to instantaneous value ofanalogue input. The maximum level ofanalogue input voltage should be appro-priately scaled down below positive refer-ence (+5V) level.

The ADC 0808 IC requires clocksignal of typically 550 kHz, which canbe easily derived from an astablemultivibrator constructed using 7404 in-verter gates. In order to visualise thedigital output, the row of eight LEDs(LED1 through LED8) have been used,wherein each LED is connected to respec-tive data output lines D0 through D7.Since ADC works in the continuous mode,it displays digital output as soon as ana-logue input is applied. The decimalequivalent digital output value D for agiven analogue input voltage Vin canbe calculated from the relationship

relay RL1 energises while relay RL2de-energises, cutting off supply to theauto-transformer as well as the outputsocket.

Now the supply can be resumed onlyafter manual change of voltage tappingusing rotary switch S4 and DPDT switchS3, or by varying the threshold voltagelevel using preset VR1. Start switch isagain required to be pressed for gettingthe output. This arrangement protects theload against mains voltage variationsabove the preset limit. (Note: Once ad-justed, preset VR1 should not be fiddledwith, unnecessarily.)

Page 173: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 163

SLEEP-SWITCH CUMWAKE-UP TIMER

SHEENA K.

H ere is a sleep-switch circuit thatcan be easily converted into awake-up timer. A dual-mode time

setting makes the system versatile. Thecircuit is low-cost and can function as aprecise timer.

The heartbeat produced by IC1 is asharp 1Hz square wave signal having aduty cycle of 50 per cent. This is achievedby using a 4.194304MHz crystal in combi-nation with discrete components aroundit. The 1Hz output of IC1 is connected toIC2 as well as one of the terminals ofswitch S1. IC2 is configured as divide-by-6counter while IC3 further divides theoutput of IC2 by ten to produce one-minuteoutput at its pin 12. This is brought to thesecond terminal of two-way switch S1 tohelp select either the ‘minutes’ or the ‘sec-onds’ mode of operation for IC4.

The decade counter IC4 provides bi-

nary output as it counts up the inputpulses and IC5 decodes/converts them to1-of-10 outputs (units). Similarly, the IC6-IC7 pair provides tens output since IC6clock input pin is connected to D outputpin of IC4.

Rotary switches S2 and S3 can be setto select any time between either 0 to 99seconds or 0 to 99 minutes, dependingupon the position of mode switch S1.Switches S2 and S3 could also be replacedby thumb-wheel type switches or 10-posi-tion DIP switches with one of their sideterminals shorted together to serve as apole. Please note that IC5 and IC7 (74145)have active low outputs.

The outputs from switches S2 and S3are input to a two-input OR gate insideIC8 (7432) to obtain active low output oncompletion of the set time delay to deacti-vate relay RL1 through relay driver tran-

sistor T1 (normally conducting) when settime is reached. When transistor T1 cutsoff, its collector goes high to reset oscilla-tor IC1, and thus count at output of IC4and IC6 gets locked. For resetting orrestarting, the power supply to the circuitshould be switched off and then switchedon again.

The BCD outputs of IC4 and IC6 areconverted to seven-segment outputs byIC9 and IC10 to drive the units and tensdisplays respectively for indicatingelapsed time continuously. The relay con-tacts (normally open and normally closed)can be suitably used to energise or de-energise an alarm after the preset delay.It can thus be used as wake-up alarm orsleep timer.

If you want to de-energise the relay,say after 30 minutes, then set switch S1to minutes mode, S2 to 0 and S3 to 3, and

Page 174: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20164

SIDDHARTH SINGH AND SRINIVAS REDDY PINGLE

CHARGE MONITOR FOR 12VRECHARGEABLE LEAD-ACID BATTERY

A battery is a vital element of anybattery-backed system. In manycases the battery is more expen-

sive than the system it is backing up.Hence we need to adopt all practical mea-sures to conserve battery life.

As per manufacturer’s data sheets, a12V rechargeable lead-acid battery shouldbe operated within 10.1V and 13.8V. Whenthe battery charges higher than 13.8V itis said to be overcharged, and when itdischarges below 10.1V it can be deeplydischarged. A single event of overchargeor deep discharge can bring down thecharge-holding capacity of a battery by

15 to 20 per cent.It is therefore necessary for all con-

cerned to monitor the charge level of theirbatteries continuously. But, in practice,many of the battery users are unable todo so because of non-availability of rea-sonably-priced monitoring equipment. Thecircuit idea presented here will fill thisvoid by providing a circuit for monitoringthe charge level of lead-acid batteries con-tinuously. The circuit possesses two vitalfeatures:

• First, it reduces the requirement ofhuman attention by about 85 per cent.

• Second, it is a highly accurate and

sophisticated method.Input from the battery under test is

applied to LM3914 IC. This applied volt-age is ranked anywhere between 0 and 10,depending upon its magnitude. The lowerreference voltage of 10.1V is ranked ‘0’ andthe upper voltage of 13.8V is ranked as‘10.’ (Outputs 9 and 10 are logically ORedin this circuit.) The calibration procedureof reference voltages is explained later.

IC 74LS147 is a decimal-to-BCD pri-ority encoder which converts the outputof LM3914 into its BCD complement. Thetrue BCD is obtained by using the hexinverters inside IC 74LS04. This BCD

then switch on the supply to the circuit.After 30 minutes the outputs at poles ofswitches S2 and S3 will go low and soalso the output of OR gate (IC8). As a

result, transistor T1 will be cut-off to de-energise the relay.

One can easily add 0-99 hours capa-bility by cascading two counters similar

to the minutes counter section compris-ing IC2 and IC3. Input clock for hourscounter would be the minutes clock avail-able at pin 12 of IC3.

Page 175: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 165

output is displayed as a decimal digitafter conversion using IC5 (74LS247),which is a BCD-to-seven-segmentdecoder/driver. The seven-segment LEDdisplay (LTS-542) is used because it iseasy to read compared to a bar graph or,for that matter, an analogue meter. Thecharge status of the battery can bequickly calculated from the display. Forinstance, if the display shows 4, it meansthat the battery is charged to 40 percent of its maximum value of 13.8V.

The use of digital principles enable usto employ a buzzer that sounds wheneverthere is an overcharge or deep discharge,or there is a need to conserve batterycharge. A buzzer is wired in the circuitsuch that it sounds whenever battery-

charge falls to ten per cent. At this point itis recommended that unnecessary load beswitched off and the remaining charge beconserved for more important purposes.

Another simple combinational logiccircuit can also be designed that will soundthe buzzer when the display shows 9. Fur-ther charging should be stopped at thispoint in order to prevent overcharge.

The circuit is powered by the batteryunder test, via a voltage regulator IC. Thecircuit takes about 100 mA for its opera-tion.

For calibrating the upper and lowerreference levels, a digital multimeter anda variable regulated power supply sourceare required. For calibrating the lowerreference voltage, follow the steps given:

• Set the output of power supplysource to 10.1V.

• Connect the power supply source inplace of the battery.

• Now the display will show somereading. At this point vary preset VR2until the reading on the display justchanges from 1 to 0.

The higher reference voltage is cali-brated similarly by setting the power sup-ply to 13.8V and varying preset VR1 untilreading on the display just changes from8 to 9.

After the calibration is completed, thecircuit may be housed in a suitable enclo-sure. The cost of all the components,including the enclosure, would be aroundRs 200.

T.K. HAREENDRAN

WINDOW/FENCE CHARGER

Circuit of a compact electrified win-dow/fence charger is presentedhere. The circuit is intended to

produce non-lethal mild shock to keepaway intruders.

It comprises transistors T1 and T2which form an astable (free-running)multivibrator with the associated resis-tors and capacitors. The pulse repetitionrate is determined by the values of RCtime constant. With the component val-ues used, it is about 6 Hz. The pulsespacing can be increased by increasingthe values of resistors R3 and R4.

A high voltage generator is realisedwith the help of an ordinary step-downtransformer and a medium-power tran-sistor which follows the astablemultivibrator. Output of the astablemultivibrator, from the collector of tran-sistor T2, is directly connected to the baseof switching transistor T3 to generatehigh-amplitude pulses. LED D1 indicates

the pulse activity.When power is initially applied, ca-

pacitor C3 is charged through resistorR6. This RC network is used deliber-ately to limit the maximum output powerapplied to the fence/window frame. Atthe same time, oscillator starts working

and its output triggers switchingtransistor T3. As a result, capacitor C3is rapidly discharged via secondary wind-ing of transformer X1. Consequently, ahigh voltage is induced in the primary ofX1. At next pulse, the process repeatsitself.

Readers Comments:❑ The multivibrator stage comprisingtransistors T1 and T2 works well, but whenI connect the base of switching transistorT3 (D313) to the collector of transistor T2,the collector voltage drops to 0.4 volt andand hence it is unable to drive transistor

T3. Kindly suggest the required modifica-tions.

J.T. JoglekarNagpur

EFY: We’ve retested the circuit andfound that the collector voltage during

conduction of transistor T3 measures 0.8volt (correct) and the circuit gave 150V(peak) pulses at around 150ms intervals.On reducing the value of resistor R5 from4.7k to 1k, the pulse amplitude increasedto 250V (peak).

Page 176: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20166

Readers Comments:❑ The Cordless Phone Backup circuit hasno protection circuitry to avoid overcharg-ing of cells. Can an LED be added toindicate supply availability from thebackup during a power failure? Please givethe details of LM317. Can I use this circuitfor a cordless phone which runs on 9V,800mA?

Tribikram Kar56 APO

❑ My cordless, Sanyo CLT-6700, has a9V-250mA adapter. Please suggest a modi-fication to this circuit so that I can use itwith my cordless phone.

The number of cells required, asshown is 1.2V×7 (=8.4V) for a 12V adap-tor. Please explain how will it work with8.4V?

From where can I get the cabinet tohouse the circuit and the cells?

Abhay K. ChangediaPune

The author, P.V. Vinod Kumar,replies:

I have designed the circuit for a cord-less phone that runs on a 12V adaptor. Touse my circuit with Sanyo CLT-6700, youwill need a new 12V adaptor.

Inside the base unit of Sanyo CLT420 cordless phone there is a 7805 regu-lator. Hence, giving anything above 8V issufficient for the base unit to operate. Onemay use either a 12V adaptor or 8.4V Ni-Cd cells or 6AA cells.

Keeping the simplicity and the cost ofthe circuit in mind. I have compromisedon the cell-protection feature.

To improve the Ni-Cd cells’ life, theyshould be charged and used. Chargedcells should not be stored for longperiods (even three days). To keep thecells in good condition, they must be dis-charged—once a month—by shortingthem with the parallel combination oftwo 4.7-ohm, 10W resistors. This shouldbe done periodically to erase the memory-effect of Ni-Cd cells.

You can buy a plastic box from anyplastic shop to use it as a cabinet. It isbetter to make a battery pack ratherthan using cell holdres. To make one,solder and interconnect cells together tomake the pack compact. Fold the cellson a thick paper and tape them. Takeout two leads for positive and negativeconnections.

CORDLESS PHONEBACKUP

P.V. VINOD KUMAR

Normally the base of a cordlessphone has an adaptor and thehandset has Ni-Cd cells for its

operation. The base unit becomes inop-erative in case of power fail-ure. Under such conditions, itis better to provide a backupusing Ni-Cd cells externally.Here is a simple powersupply back-up circuit whichcan be used with cordlessphone SANYO CLT-420 orsimilar sets.

The working is simple.When AC mains is present,Ni-Cd cells are chargedthrough IC LM317L, whichis wired as a current source.Also, diode D3 is reverse-biased, which keeps Ni-Cd cellsisolated from positive rail.When AC mains goes off, theNi-Cd cells provide supplyto the cordless phone base

unit through diode D3. A green LEDis used to indicate the presence of ACmains.

Each Ni-Cd cell costs around Rs 34,

and the cost of the backup unit, includ-ing the box and cells, would not exceedRs 300. Hence the circuit is well worththe investment.

Page 177: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 167

PC-BASED DICE GAMEV. RAJARAMAN

The dice has been used to deter-mine one’s fortune from the ear-liest days of civilisation. It has

been used by gamblers, fortune tellers andstatisticians alike. Dice made of wood, sil-ver, ivory, etc can be seen in many museums.

A hi-tech die can be built around acomputer using a handful of LEDs andan IC, as shown in the figure.

Seven LEDs are arranged in the shapeof the dots on a die. While a real die is a

cube having six faces, this electronic diehas a single face, on which the dot patternwould change dynamically.

These LEDs are activated using theparallel port of a PC. The interface circuitnecessary for this is given in the figure. Itcomprises seven LEDs connected to buffer/driver IC 74245 through current-limitingresistors.

The buffer helps to protect the com-puter circuitry in case something goeswrong with this circuit. Whenever a home-made gadget is connected to the PC, it is

a good idea to use a buffer to preventaccidental damage to the PC.

Arrange the seven LEDs on a vero-board, or other suitable mounting plateexactly as per pattern shown in the fig-ure. Connect the circuit to parallel portdesignated LPT1 on the computer. If portLPT2 is to be used, a minor modificationis necessary in the software. Just changethe line

“#define PORT 0X378” to“#define PORT 0X278” and the rest

remains as it is.There is a small test program TEST.C

written using Borland C to test the inter-face. Switch on 5V power supply and runthe test program. Every time you press akey, LEDs 1 through 7 light up one byone, in the same order. This order is im-portant—otherwise the circuit will workbut the dot pattern on the die will not beconsistent. Recheck the connections ifthese appear out of order.

Now we are ready to test our fortune.Run the program DICE.C and press anykey. With every key-stroke your die willappear to roll. Finally, when it settlesdown, it displays a random digit, betweenone and six. Press ESC to terminate theprogram.

The program makes use of the ran-dom () function of the compiler to gener-ate the pseudo random number. The com-puter, using some fixed algorithm, gen-erates this number. In this sense it is notstrictly ‘random,’ since a true randomnumber is completely unpredictable, andcannot be generated by any mathemati-cal formula! That is why it is called apseudo random number. But do not worry,this level of randomness is sufficient forall day-to-day needs.

To make it even more random, we haveused the randomise () function. This takesa clue from the real-time clock of the com-puter to initialise or ‘seed’ the randomnumber generator. So we are assured thateach time the program is started, we get adifferent sequence of digits.

Note how the bit pattern necessary tolight the different combinations of LEDs

is taken from a look-up table. This acts asthe translator between random numbergenerator and display.

If necessary, similar display unit canbe connected to the second parallel portof the computer to simulate throwing oftwo dice simultaneously. The modificationnecessary to the program is quite simple,and is left as an exercise for the reader.Good luck!

/* TEST.C */#include <dos.h>#include <stdio.h>#include <conio.h>#include <stdlib.h>#define PORT 0X378main (){int i;for (i=1; i < 0X7F; i *=2)

{printf (“Press any key…\n”)’outportb (PORT, ~i);getch ();}

outportb (PORT, 0XFF);}

/* DICE.C */#include <dos.h>#include <stdio.h>#include <conio.h>#include <stdlib.h>#define PORT 0X378#define ESC 0X1Bint code[6] = {0XBF, 0XF3, 0X9E, 0XD2, 0X92, 0XC0};void run();main(){int number;printf (“press any key to throw the die. ESC to exit…\n”);randomize (); /* initialize the generator */while (getch() !=ESC)

{number = random(6);printf (“%4d”,number+1);run ();outportb (PORT, code [number]);}

outportb (PORT, 0XFF); /* all off */}/*———————————————————*/void run (){/* create running LEDs effect */int i;for (i=1; i < 0X7F; i *=2)

{outporb (PORT, ~i);delay (200);}

}/*———————————————————*/

Page 178: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20168

TELEREMOTE CONTROLR.G. KALE

Here is a teleremote cir-cuit which enablesswitching ‘on’ and ‘off’ of

appliances through telephone lines.It can be used to switch appliancesfrom any distance, overcoming thelimited range of infrared and radioremote controls.

The circuit can be used toswitch up to nine appliances (cor-responding to the digits 1 through9 of the telephone key-pad). TheDTMF signals on telephone instru-ment are used as control signals.The digit ‘0’ in DTMF mode is usedto toggle between the appliancemode and normal telephone opera-tion mode. Thus the telephone canbe used to switch on or switch offthe appliances also while beingused for normal conversation.

The circuit uses IC KT3170(DTMF-to-BCD converter), 74154(4-to-16-line demult-iplexer), andfive CD4013 (D flip-flop) ICs. Theworking of the circuit is asfollows.

Once a call is established (af-ter hearing ring-back tone), dial‘0’ in DTMF mode. IC1 decodesthis as ‘1010,’ which is furtherdemultiplexed by IC2 as output O10

(at pin 11) of IC2 (74154). The ac-tive low output of IC2, after inver-sion by an inverter gate of IC3(CD4049), becomes logic 1. This isused to toggle flip-flop-1 (F/F-1)and relay RL1 is energised. RelayRL1 has two changeover contacts,RL1(a) and RL1(b). The energisedRL1(a) contacts provide a 220-ohmloop across the telephone linewhile RL1(b) contacts inject a10kHz tone on the line, which in-dicates to the caller that appliancemode has been selected. The 220-ohm loop on telephone line discon-nects the ringer from the telephoneline in the exchange. The line is

Page 179: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 169

now connected for appliance mode of op-eration.

If digit ‘0’ is not dialed (in DTMF)after establishing the call, the ring con-tinues and the telephone can be used fornormal conversation. After selection of theappliance mode of operation, if digit ‘1’ isdialed, it is decoded by IC1 andits output is ‘0001’. This BCD codeis then demultiplexed by 4-to-16-linedemultiplexer IC2 whose corresponding

output, after inversion by a CD4049inverter gate, goes to logic 1 state.This pulse toggles the correspondingflip-flop to alternate state. The flip-flopoutput is used to drive a relay (RL2)which can switch on or switch off theappliance connected through its contacts.By dialing other digits in a similar way,other appliances can also be switched‘on’ or ‘off .’

Once the switching operation is over,

the 220-ohm loop resistance and 10kHztone needs to be removed from the tel-ephone line. To achieve this, digit ‘0’ (inDTMF mode) is dialed again to toggle flip-flop-1 to de-energise relay RL1, whichterminates the loop on line and the 10kHztone is also disconnected. The telephoneline is thus again set free to receive nor-mal calls.

This circuit is to be connected in par-allel to the telephone instrument.

Readers Comments:❏ 1. Can we get some confirmation thatthe state of the appliance has reallytoggled?

2. Can we include some electronicsecurity system (such as code lock),so that only the owner can use thisfacility?

3. Instead of the 10 kHz oscillator usedfor return tone, can the three-pin melodi-ous IC UM66 be used?

4. In the circuit both TTL and CMOSICs have been used. As TTL counterparts

for inverters and flip-flops are easily avail-able, I suggest their use.

5. Instead of using separate drivingstages for the relays, I suggest the use ofcheaply available relay driving IC ULN2003.

K.P. DeshmukhSolapur

The author R. G. Kale replies:1. Relays with two changeovers may

be used for getting a confirmation aboutthe state of the appliance. One changeovercontact may be used for the appliance and

SMIT KAPILA

DISPLAY DIALED TELEPHONENUMBER USING CALCULATOR

Sometimes, while dialing a num-ber on the telephone, we maypress a wrong key, but by using

a simple calcu-lator’s displaywe can checkwhether the di-aled number iscorrect or not.This can be doneas follows.

Disconnectthe ribbon cableof the key-padfrom rest of thetelephone cir-cuitry and inserta series resis-tance of 27 kilo-ohm in all ten(nine in somekey-pads) wires

of the ribbon cable. Thereafter, connect itback to the telephone circuitry as shownin Fig. 1. The resistors are used to buffer

the telephone circuitry so that it does notaffect the working of the calculator—since

the other may be used to send a beeptone on the line when the appliance turnson.

2. Readers are welcome to make theirown modifications to the circuit—like in-cluding code lock.

3. IC UM66 may be used in place ofthe 10kHz oscillator.

4 & 5. I agree with the suggestionsput forward by the reader.

Keep the circuit disconnected whilemaking outgoing calls to prevent un-wanted switching of the devices.

Fig. 1 Fig. 2

Page 180: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20170

Two such connections joining keyslabeled ‘0’ and ‘1’ on telephone setand calculator are shown in Fig. 2.Other connections may also be madein a similar way for keys ‘2’ through ‘9.’The advantage of this circuit is thatit needs only 9 or 10 resistances and

connecting leads; no other circuitcomponents are required. Care shouldbe taken that leads are not shortedtogether.

After the above-mentioned modifica-tion, you will observe that the dialed num-ber gets displayed on the calculator screen.

8253 PROGRAMMABLEINTERVAL TIMER

JUNOMON ABRAHAM

The circuit presented here is basedon the commercially availableprogrammable interval timer/

counter IC 8253. IC 8253 was primarilydesigned for use as an MCS-80 periph-eral, but is now used in conjunction with

almost all 8-bit microprocessors.Using this circuit we can studythe operation of 8253 IC.

A long-time interval timer canalso be constructed using this IC.

It contains three independent 16-bitcounters that can operate in any one ofthe six modes (refer Table II(C)). It can

telephone is a high voltage device whilecalculator is a very sensitive device oper-ating with low voltage. Now, take twoleads directly from each of the contacts ofthe keys numbered ‘0’ through ‘9’ of thetelephone key-pad PCB and join them tocorresponding keys of the calculator.

TABLE IIControl Word Byte

D7 D6 D5 D4 D3 D2 D1 D0SC1 SCO RW1 RWO M2 M1 MO BCD

TABLE II(A)SC-Select Counter (bits D6 and D7)

SC1 SC0 Description0 0 Select Counter 00 1 Select Counter 11 0 Select Counter 21 1 Read Back Command

TABLE ISystem Addresses

A1 A0 Selects0 0 Counter 00 1 Counter 11 0 Counter 21 1 Control Word Register

TABLE II(C)M-mode bits (D1, D2, and D3)

M2 M1 M0 Description0 0 0 Mode 0: Interrupt on

terminal count0 0 1 Mode 1: Hardware one shotX 1 0 Mode 2: Pulse generatorX 1 1 Mode 3: Square wave

generator1 0 0 Mode 4: Software triggered

strobe1 0 1 Mode 5: Hardware

triggered strobe

Page 181: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 171

TABLE II(D)BCD or Binary (bit D0)

Value Description0 Binary counter, 16 bits1 Binary coded decimal counter,

4 decades

TABLE IIIC4 R15 Clock frequency10µ 18k 2.5 Hz1µ 18k 25 Hz100n 18k 250 Hz10n 18k 2.5 kHz1n 18k 25 kHz

operate with clock frequencies rangingfrom a few hertz to 2 MHz.

To initialise the counter, the follow-ing sequential steps are necessary:

1. Write a control word into its con-trol word register. The control word de-cides the selection of a specific counter(number 0 or 1 or 2), its mode of opera-tion, loading sequence of the count, andselection of binary or BCD counting mode.

2. Load the lower order byte of thecount word in the counter register.

3. Load the higher order byte of thecount word in the counter register.

The abovementioned functions arerealised in the following manner:

1. Select the control word register us-ing switches S2 and S3 (both ‘on’) becausethe address of control word register is 11binary (i.e. A0 = 1, A1 = 1) as given inTable I.

2. Form control word byte of Table II

using switches S4 to S11.3. Enter the control word into control

word register by depressing S1 momen-tarily.

4. Select counter 1 using switch S3(‘on’) . Note that address of counter 1 is01 binary as per Table II(A).

5. Select lower order byte of countword using switches S4 through S11.

6. Enter the lower order byte of countword into counter 1 by depressing S1 mo-mentarily.

7. Select the higher order byte of countword using switches S4 to S11.

8. Enter the higher order byte of countword into counter 1 by depressing S1.

Out of six possible modes of opera-tion, as shown in Table II(C), only fourmodes are discussed here:

Mode 0 (Interrupt on terminal count).Control word: 70 H

In this mode the counter output is

initially low, and after the terminal countthe counter output goes high.

Mode 2 (Rate generator). Controlword: 74H

When a count is loaded, the outputstays high until the count reaches ‘1’ andthen goes low for one clock period.

Mode 3 (Square wave generator). Con-trol word: 76H

In this mode input frequency is di-vided by the count word that is loaded inthe counter registor.

Mode 4 (Software triggered strobe).Control word: 78H

In this mode output is initially high,and it goes low for one clock period at theend of the count.

Please note that if we want to enter anumber into the counter register, thatnumber is first converted to binary for-mat and then loaded into the counterregister. Timer 555 is used here inmonostable mode for generating write sig-nal. The value of capacitor C5 to be usedwith timing resistor R15 (18 kilo-ohm) forrealising different clock frequencies isgiven in Table III. The circuit can beeasily assembled on a general-purposePCB.

PRADEEP G.

LOW-COST TRANSISTORISEDINTERCOM

Several intercom circuits have ap-peared in EFY using integratedcircuits. The circuit described here

uses three easily available transistorsonly. Even a beginner can easily assembleit on a piece of veroboard.

The circuit comprises a 3-stage resis-tor-capacitor coupled amplifier. When ring

button S2 ispressed, the ampli-fier circuit formedaround transistorsT1 and T2 gets con-verted into an asym-metrical astablemultivib-rator gen-erating ring signals.These ring signalsare amplified by

transistor T3 to drive the speaker of ear-piece.

Current consumption of this intercom

is 10 to 15 mA only. Thus a 9-volt PP3battery would have a long life, when usedin this circuit.

Page 182: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20172

For making a two-wayintercom, two identicalunits, as shown in figure,are required to be used.Output of one amplifierunit goes to speaker of theother unit, and vice versa.For single-battery opera-tion, join corresponding

supply and ground terminals of both theunits together.

The complete circuit, along withmicrophone and earpiece etc, can behoused inside the plastic body of a toycellphone, which is easily available inthe market. Suggested cellphone cabi-net, with the position of switches, speak-ers and mike etc is shown.

AUTOMATICALLY CONTROLLEDSTREET LIGHTS

YOGESH PRASAD

The circuit given herecan be used fora u t o m a t i c a l l y

switching ‘on’ and switching‘off’ the streetlights at ap-propriate time. The circuituses a light-dependentphoto-resistor (LDR) as thesensor whose resistancechanges in accordance withthe surrounding light’s in-tensity. The circuit is so ad-justed that when it turnsdark, the relay is energisedand the lights are switchedon, and during daylight theygo off automatically. TheLDR used should have a‘dark’ resistance of about 15mega-ohms, which may dropto around 15 kilo-ohms inbright daylight.

The LDR isused in conjunc-tion with a compa-rator (IC LM311).When it gets dark,the voltage acrossthe LDR increasesand thus voltageVA>VT (refer cir-cuit), and so theoutput of the com-parator goes high.This in turn for-

6

**

*

Page 183: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 173

K.K. MURTY

TIMER FOR STUDENTS

These are the days of competitiveexaminations. Nowadays, stu-dents are required to answer a set

of objective type of questions in a giventime which may extend to 15 minutes, 30minutes, or one hour. Speed and accuracywin the race. Practice helps in achievingit.

Here is a timer that gives an alarmafter a preset time of 30 minutes. It alsogives out a few beeps at half the selectedtime period. The timer could be pro-grammed for other periods as well. The

Y1

Y2Y3

alarm can be reset for a fresh start.The heart of the circuit is a CMOS IC

CD 4060. It has a built-in oscillator and a14-stage divider, wherein the basic oscil-lator frequency is divided by 16,384. Herethe oscillator frequency may be set usingpotmeter VR1 (in series with resistor R1)and capacitor C1. Potmeter VR1 is ad-justed for a time period of 15 minutes atoutput Q12 (pin 2). The output Q13 (pin 3)will go ‘high’ after 30 minutes. Use a multi-turn potmeter for better accuracy.

When Q13 goes high, the 3-terminal

piezo-buzzer becomes active and givesout a tone. This buzzer also beeps for afew seconds at half the set time. Transis-tor T1 prevents further oscillations afterthe elapsed time. Red LED1 is used asactivity indicator.

For simplicity, 6-volt supply is chosenfor operation of the circuit. To obtain 6Vsupply one may either use five Ni-Cd cellsor four dry cells. A charger circuit is notincluded here as a host of charger circuitshave appeared in EFY on and off.However, you may use a standard bridge

ward biases relay driver transistor SL100and the relay gets energised. As a resultthe lights are switched on. When there isbright daylight, the VDR resistance dropsand VA<VT. This causes the output of com-parator to go low. As a result the basedrive to SL100 also goes low and the relayde-energises and the lights go off.

Opto-coupler MCT2E is used for isola-tion of the relay driver and the mainsoperated part of the circuit from rest of thecircuit. The DC supplies for both parts ofthe circuit are also similarly isolated. As

shown in Fig. 2, isolation transformerX2, fed by a 555 astable multivibrator, isused to generate isolated DC supplyacross secondary of transformer X2. Thepresets VR1 and VR2 are used for cali-bration. Diode D6 is used to protect thetransistor from inductive kick, whilediode D5 (Fig. 2) is used as rectifier.

After the circuit is assembled, it isrequired to be calibrated as follows:

1. Adjust the voltage at point VT toabout 11.50V by adjusting preset VR1.

2. Now keep the LDR at the dark-

ness level at which you want to switch onthe lights. If initially the relay is ener-gised and lights are on, adjust preset VR2such that they go off. Now trim presetVR2 such that the lights just come on atthe same preset level.

After the system has been calibrated,the circuit should be so placed thatthe light from the sources controlled bythe circuit do not interfere with the LDRoperation. The LDR should be so placedthat it is surrounded by the natural lightsources.

Page 184: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20174

rectifier with 7806 as regulator for thepower supply and charger.

Pressing the reset button momentarilypulls all the internal counters of CD4060to zero and the timer starts again. Thetimer is reliable, accurate, and consumesabout 10 mA of current when the buzzer

is active.Piezo-electric buzzers are reliable,

rugged, and serve as cheap audio alarms.They are available for operation in con-tinuous and intermittent modes, and alsowith musical notes. However, if you re-quire louder sound, say for a classroom,

then you have an optional 555 circuitwired up as an astable multivibrator. Thiscan be brought into operation by shortingpoints x-x in the circuit. But then thepiezo buzzer needs to be disconnected fromthe circuit at the points marked Y1, Y2and Y3.

PROTECTING THREE-PHASEINDUCTION MOTORS

ANKUR BAL

Damage to induction motor ismostly caused by unchecked op-eration during single-phase fail-

ure. In case of a single-phase blackout,the motor continues to run on the remain-ing two phases, endangering the windings.The given arrangement of three relays,as shown in the figure, disconnects theremaining two phases in the event of asingle-phase failure, thus stopping andprotecting the motor. One of the threephases may still remain connected to themotor, but that is not much cause for con-cern because of the absence of a rotatingmagnetic field in the motor.

Three 230-volt relays with singlechangeover contacts are used in this ar-

rangement. For the purpose of explana-tion, let us assume that blue (B) phase ismissing. Since none of the three relayscan energise, none of the phase outputsis available. Now, if yellow (Y) phase ismissing, relay RL3 will not energise, andthus yellow and blue phase output willnot be available. Similarly, if red (R)phase is missing, relay RL2 will not en-ergise, and thus red and yellow phase out-puts will not be available. The motorresumes normal operation automaticallyas soon as all the three phases are re-stored.

230-volt AC relays, with appropriatecontact ratings, should be selected (de-pending on motor ratings).

RADIO REMOTE CONTROLPRADEEP G.

This Electronic Project volumecontains a circuit idea “WirelessMusical Calling Bell” which is uses

VG40T and VG40R VHF remote controlmodules.

After its publication many readerswanted to develop remote control switchesto control mains load using these compact,sealed VHF remote control modules. Afew designs for remote control switches,using VG40T and VG40R remote controlpair, are shown here.

The miniature transmitter module Fig. 1

shown in Fig. 1,which just meas-ures 34 mm x 29mm x 10 mm, canbe used to operateall remote controlr e c e i v e r - c u m -switch combina-tions described inthis project. A com-pact 9-volt PP3battery can be usedwith the transmit-

ter. It can transmit signals up to 15metres without any aerial. The operatingfrequency of the transmitter is around300 MHz. The following circuits, usingVG40R remote control receiver module(measuring 45 mm x 21 mm x 13 mm),can be used to:

(a) activate a relay momentarily,(b) activate a relay for a preset pe-

riod,(c) switch on and switch off a load.To activate a relay momentarily (see

Fig. 2), the switch on the transmitter unit

Page 185: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 175

is pressed, and correspondinglya positive voltage is obtained atoutput pin of VG40R module.This voltage is used to biasingthe relay driver transistor. Therelay gets activated by just press-ing push-to-on micro switch onthe transmitter unit. The relayremains energised as long as theswitch remains pressed. Whenthe switch is released, the relaygets deactivated. Any electrical/electronic load can be connectedvia N/O contacts of the relay.

To activate a relay for a pre-set period (refer Fig. 3), the switchon the transmitter unit is pressedmomentarily. The transistor getsbase bias from VG40R module.As a result the transistor conducts andapplies a trigger pulse to IC 555, which iswired as a monostable multivibrator. Therelay remains activated for the preset timeis determined by the pulse width of themonostable multivibrator. Time delay canbe varied from a few seconds to a fewminutes by adjusting timing components.

To switch on and switch off a load(refer Fig. 4), a 555 IC and a decade coun-

Fig. 3

Fig. 2

SEQUENTIAL CARD SCANNERGIRISH JADHAV

This circuit of a sequential cardscanner can be used for any typeof control application. The card,

when inserted into its slot, will get alignedin such a fashion that light from the scan-ning LEDs will be blocked from falling on

corresponding LDRs if there is no hole(cut) on the card at the specific position,and vice versa. The resulting output fromthe scanner can be used for control appli-cations.

The circuit consists of five NE555 timer

IC chips, a CD4017B CMOS decade coun-ter, a CD4043B SR latch, and a few otherdiscrete components. The timer IC1configured as an astable flip-flop, gener-ates the clock for the CD4017B. An LED isconnected at the timer output (pin 3) for

ter 4017 IC are used. Here the 4017 IC iswired as a flip-flop for toggle action. Thisis achieved by connecting Q2 output toreset terminal while Q1 output is unused.Q0 output of IC2 is used for energising therelay. The relay is activated and deacti-vated by pressing the transmitter switchalternately. So, to activate the load, justpress the transmitter switch once, mo-mentarily. The relay will remain activated.

To switch off the relay, press the transmit-ter switch again. This process can be re-peated. Time delay of monostablemultivibrator is set for about one second.

Note: Short length of shielded wireshould be used between VG40R receivermodule output and the rest of the circuit.The transmitter with 9V battery must behoused inside a nonmetallic (say, plastic)cabinet for maximum range of operation.

Fig. 4

Page 186: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20176

monitoring the activity.These clock pulses are fedto clock pin 14 of the di-vide-by-10 Johnson coun-ter CD4017.

For the first clockpulse, Q0 output will behigh, and for the secondclock pulse, Q1 outputwill be high, and so on.Outputs Q0 through Q3of CD4017B are used ascontrol signals for quadbilateral switches insideCD4066 (IC3) while Q4output is used for indica-tion purpose as follows:

• When LED6 is ON:It indicates that the scan-ning is complete.

• When LED6 isOFF: It indicates that thescanning process is notcompleted.

To understand the op-eration of the circuit, as-sume that the card is inthe card slot. Now pressthe reset button for abouta second. During reset allthe monostable flip-flops(IC4 through IC7) remainin triggered state andtheir outputs are high.The outputs of invertersN1 through N4 connectedto set pins of CD4043 areat logic 0 while reset pins(3, 7, 11 and 15) are con-nected to Vcc via a resetswitch. As a result, alloutputs (A, B, C and D) ofCD4043 are 0000 on re-set. (Please refer to thetruth table of CD4043 inthis connection.) On re-leasing the reset button,further operation takesplace as follows:

During the first clockpulse, Q0 will be logichigh, and this output,when applied as a con-trol signal to E0 pin ofthe bilateral switch,causes Vcc (6 to 9V DC)to be switched from Y0 to Z0. This willcause LED1 to be lighted. Now, suppos-ing that no cut in the card exists at thatposition, the LDR resistance will be highand monostable flip-flop IC4 will func-

tion in retriggerable mode. Its output atpin 3 will remain high or the output ofinverter gate N1 will remain low. Withreset pins (3, 7, 11 and 15) of all latchesof CD4043 are pulled low via 10-kilo-

ohm resistor R13; a low level at set pindoes not change the output, and thus Aoutput remains low. On the other hand,if there was a hole/cut in the card be-tween LED1 and LDR1, the LDR1 resis-

Function Table of CD4043Inputs Output

Eo Sn Rn OnL X X ZH L H LH H X HH L L LatchedZ=high impedence stateX=state immaterialL=low levelH=high level

Page 187: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 177

tance would drop during thepulse through LED1, causing outputof IC4 to remain low or that ofinverter gate N1 to be high duringthe pulse period. This would causeoutput A to remain latched in highstate.

During second clock pulse, Q1 willbe logic high and this output, whenapplied as a control signal to E1 pinof the bilateral switch, will causeVcc (6 to 9V DC) to be switched fromY1 to Z1. This will light up LED2. Ifthere is a cut/hole in the card be-

tween LED2 and LDR2, output B willlatch to high state, else it will remainlow. Similar operation will take place atthe third and fourth clock pulses, andthe outputs A, B, C and D will corre-spond to the hole/no-hole state at LED/LDR position of the card. At fifth clock,IC2 alone is reset, and the above opera-tion keeps repeating without affectingthe output as long as card remains inthe slot.

Potentiometers VR1 through VR4 areused to set proper triggering level at pin2 of monostables IC4 through IC7.

DIVIDE-BY-N COUNTERUSING IC 7442

PRAMOD KUMAR

The combination of ICs 7490 and7447 is normally used as decadecounter cum seven-segment de-

coder/LED display driver. It advances from‘0’ to ‘9’ after each clock pulse and the countcan be displayed on a 7-segment common-anode LED display such as LT542. Thecount/display repeats itself after everytenth pulse. On several occasions, one needsto reset the counter after n counts. This can-not be accomplished by the above-men-tioned pair of ICs 7490 and 7447 alone.

A method for tackling the problem withthe help of rotary switch S1 and an addi-tional IC 7442 is shown in the circuit. With

this circuit we can realise a divide-by-ncounter. Selected output of IC 7442 is usedto reset decade counter 7490.

In the circuit diagram, timer IC 555is used in astable mode. Output of thisIC is used as clock for IC 7490. The out-put of IC 7490 is connected to IC 7447and IC 7442 in the usual manner. Out-put of 7447 IC is used to drive common-anode LED display LT542. Rotary switchS1 selects one of the ten outputs of IC4(after inversion by IC5 or IC6 invertergates). Pole of switch S1 is wired to pins2 and 3 of IC 7490, which are reset pins.Now one can select division by any inte-

ger less than ten using rotary switch S1.For example, if one wants to use the

circuit as divided-by-4 counter, the pole ofrotary switch should be kept on output Q4of IC4. The display would advance from 0to 3. On next clock pulse the Q4 output ofIC4 would go high after inversion by IC5(7404) and reset counter IC 7490 to zero.As a result the display would not be able toshow the number 4 for a perceptible period.Hence the maximum number displayedappears to be one less than the selecteddivision factor. Similarly, when we selectdivision-by-2, the counter will show 0 and1 repetitively.

Page 188: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20178

DTMF REMOTE SWITCHING BOARDDHURJATI SINHA

T he DTMF (dual tone multi-frequency) tone generatorchip UM95089 generally

used in telephony for tone dialing(used here as part of remote IRtransmitter) and DTMF tone de-coder (tone to 4-bit binary output) chipCM8870 (used in remote switching board)are at the heart of this circuit.

The tone generator chip UM 95089(IC1) has the capability to generate 16different pairs of tones with the help of3.5795MHz quartz crystal, XTL1. A keymatrix type switching system has beenprovided, for selecting a particular fre-quency pair. The coresponding outputavailable at pin 16 of the IC1. This signalis amplified and used for modulating in-frared light with the help of transistor T1and IR LED1.

The infrared signal is detected by theinfrared sensor, converted into electrical

Fig. 3: IR remote switching board

Fig. 1: Block diagram of DTMF remote switching board

Fig. 2: IR transmitter

Page 189: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 179

Readers Comments:❑ Please clarify my doubts:

1. Is IC TCM5089 equivalent to ICUM95089 (IC1)?

2. In the transmitter circuit, shouldany row and column be shorted momen-tarily, or both be grounded momentarily?How can the working of the transmitterbe tested?

3. Can any IR sensor used in TV cir-cuits be substituted in this circuit?

4. The output voltage of the IR sensoris continuously fluctuating between 5.25Vand 4.70V. Why?

5. Why are the relays connected tothe emitters of transmitters? Can thesebe connected to the collectors?

6. How can the proper working of thereceiver be tested?

Nitin S. DigheMumbai

The author, Dhurjati Sinha, replies:1. I am not aware whether both the ICs

are equivalent.2. Only rows and columns are to be

connected. To test the circuit, connect out-put pin 16 of IC1 through a capacitor to aheadphone or an audio amplifier line-interminal. Press one combination at a time.If DTMF tones are heard, the circuit isworking correctly.

3. Any ordinary IR sensor used in TVcan be used. To check the working of thesensor, connect an LED temporarily be-tween output and +5V. When transmitterswitches are pressed, glowing of the LEDindicates the proper working of the sen-sor.

4. Fluctuation of voltage at variouspins is possibly due to stray electric field.As CMOS chips have been used, pleaseshield the circuit.

5. Relays may be connected to thecollectors of transistors, as shown inFig. 1.

6. If IR detection is taking place cor-rectly, connect four LEDs through 560-

ohm resistors at the output of IC2and press sixteen different row-column combinations of the transmittercircuit, one by one. The output statusshould change from 0000 to 1111. Next,remove these LEDs and connect sixteenLEDs through 560-ohm resistors atthe output of IC3. Press the sixteen com-

binations again. All the LEDs shouldglow one by one. Do not solder these ICsdirectly; use IC bases.

ELECTRICAL EQUIPMENT CONTROLUSING PC

P.V. VINOD KUMAR

Here is a novel ideafor using the printerport of a PC, for con-

trol application using soft-ware and some interfacehardware. The interface cir-cuit along with the given soft-ware can be used with theprinter port of any PC for con-trolling up to eight equip-ment.

The interface circuitshown in the figure is drawn

specific frequency pair, for the duration,the incoming signal is present.

Now these 16 outputs are groupedinto eight pairs to control two quad S-Rlatches inside IC4 and IC5 (CD4043B).The outputs of the latches are used tocontrol the eight relays (RL1 throughRL8) via the relay driver transistors,which finally drive the AC loads. Q0 and

signals, and internally amplified in the IRreceiver module. This amplified signal isthen fed into pin 2 of the DTMF receiverchip CM 8870 (IC2) and the 4-bit binaryoutputs B0, B1, B2, and B3 are availableat pins 11 through 14. The binary signalis further processed by the 4- to 16-linedecoder chip IC3 (CD4514B), and one ofthe pins (Q0 through Q15) goes high for a

all even outputs of IC3 are used to set(switch on), and all odd outputs are usedto reset (switch off) the latches and thecorresponding relays.

One can easily convert this IR-basedsystem to FM-based system by using toneoutput from IC1 for modulating an FMtransmitter, and in Fig. 2, IR receiver mod-ule can be replaced by an FM receiver.

Fig. 1: Connection of relays

for only one device, being controlled byD0 bit at pin 2 of the 25-pin parallel port.Identical circuits for the remaining data

Page 190: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20180

Program Listing in BasicCLS : SCREEN 2KEY(1) ON: ON KEY(1) GOSUB FINISKEY(5) ON: ON KEY(5) GOSUB RETIREKEY(10) ON: ON KEY(10) GOSUB ALLONPORT% = &H378OUT PORT%, 0LOCATE 8, 10: PRINT “<— —>”V$ = STRING$(27, “❚ ”)REM ❚ obtained by pressing CTRL+ATL+2+1+9 (ASCII)LOCATE 5, 6: PRINT V$; SPC(1); “CONTROL PANEL”; SPC(2); V$LINE (40, 31)-(600, 180), 1, BLINE (40, 40)-(600, 180), 1, BLINE (40, 100)-(600, 120), 1, BFLINE (140, 40)-(460, 110), 1, BLOCATE 8, 65: PRINT “ON------Q”LOCATE 12, 65: PRINT “OFF-----W”LOCATE 19, 15: PRINT “F1”; SPC(24); “F5”; SPC(27); “F10”LOCATE 21,10: PRINT “EMERGENCY OFF”; SPC(16); “LOGOUT”;

SPC(24); “ALLON”D$ = DATE$J$ = LEFT$(D$, 2)K$ = MID$(D$, 4, 2)L$ = RIGHT$(D$, 4)LOCATE 5, 7: PRINT SPC(1); K$; “–”; J$; L$; SPC(1); “”STAT:PSET (145, 85): DRAW “R20U10L20D10”PSET (185, 85): DRAW “R20U10L20D10”PSET (225, 85): DRAW “R20U10L20D10”PSET (265, 85): DRAW “R20U10L20D10”PSET (305, 85): DRAW “R20U10L20D10”PSET (345, 85): DRAW “R20U10L20D10”PSET (385, 85): DRAW “R20U10L20D10”PSET (425, 85): DRAW “R20U10L20D10”T$ = TIME$Y$ = LEFT$(T$, 2)Y = VAL(Y$)IF Y < 12 THEN PP$ = “AM” ELSE PP$ = “PM”IF Y > 12 THEN Y = Y - 12U$ = MID$(T$, 3, 3)LOCATE 5, 64: PRINT SPC(1); Y; U$; PP$; SPC(1); “”LOCATE 9, 20: PRINT “1”; SPC(4); “2”; SPC(4); “3”; SPC(4); “4”; SPC(4);

“5”; SPC(4); “6”; SPC(4); “7”; SPC(4); “8”LOCATE 12, 19: PRINT AA; SPC(2); SS; SPC(2); DD; SPC(2); FF;SPC(2); GG; SPC(2); HH; SPC(2); JJ; SPC(2); KKX$ = INKEY$X$ = RIGHT$(X$, 1)N = INP(PORT%)IF X$ = “K” THEN J = J - 40IF X$ = “M” THEN J = J + 40PSET (J + 105, 85): DRAW “R20U10L20D10R2U10R2D10R2U10R2

D10R2U10R2D10R2U10R2D10R2U10R2D10”FOR T = 1 TO 400: NEXTPRESET (J + 105, 85): DRAW “R20U10L20D10R2U10R2D10R2U10R2

D10R2U10R2D10R2U10R2D10R2U10R2D10”IF J + 105 < 105 THEN J = 0IF J >= 360 THEN J = 360IF (J = 40) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB APPLEIF (J = 40) AND (X$ = “W” OR X$ = “w”) THEN GOSUB APPLEOFIF (J = 80) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB BATIF (J = 80) AND (X$ = “W” OR X$ = “w”) THEN GOSUB BATOFIF (J = 120) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB TALEIF (J = 120) AND (X$ = “W” OR X$ = “w”) THEN GOSUB TALEOFIF (J = 160) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB FLATIF (J = 160) AND (X$ = “W” OR X$ = “w”) THEN GOSUB FLATOFIF (J = 200) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB FAT

IF (J = 200) AND (X$ = “W” OR X$ = “w”) THEN GOSUB FATOFIF (J = 240) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB SILKIF (J = 240) AND (X$ = “W” OR X$ = “w”) THEN GOSUB SILKOFIF (J = 280) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB SEVENIF (J = 280) AND (X$ = “W” OR X$ = “w”) THEN GOSUB SEVENOFIF (J = 320) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB LASTIF (J = 320) AND (X$ = “W” OR X$ = “w”) THEN GOSUB LASTOFGOTO STAT ‘————ALL THE SUBROUTINES ARE BELOW———APPLE: SOUND 500, 2AA = 1LOCATE 6, 50Q = 1 OR NOUT PORT%, QRETURNBAT: SOUND 500, 2SS = 1W = 2 OR NOUT PORT%, WRETURNTALE: SOUND 500, 2DD = 1Q = 4 OR NOUT PORT%, QRETURNFLAT: SOUND 500, 2FF = 1Q = 8 OR NOUT PORT%, QRETURNFAT: SOUND 500, 2GG = 1Q = 16 OR NOUT PORT%, QRETURNSILK: SOUND 500, 2HH = 1Q = 32 OR NOUT PORT%, QRETURNSEVEN: SOUND 500, 2JJ = 1Q = 64 OR NOUT PORT%, QRETURNLAST: SOUND 500, 2KK = 1Q = 128 OR NOUT PORT%, QRETURNTALEOF: SOUND 400, 1IF DD = 0 THEN RETURNDD = 0IF N = 4 THEN P = 0IF N < 4 THEN P = NIF N > 4 THEN P = N - 4OUT PORT%, PRETURNAPPLEOF: SOUND 400, 1IF AA = 0 THEN RETURNAA = 0IF N = 1 THEN I = 0IF N > 1 THEN I = N - 1OUT PORT%, IRETURNBATOF: SOUND 400, 1

bits D1 through D7 (available at pins 3through 9) have to be similarly wired. Theuse of opto-coupler ensures complete isola-tion of the PC from the relay driver cir-cuitry.

When the program is loaded and run,

the monitor will show the control panel—with the control bar at the extreme left.The bar can be moved using the right andleft arrow keys. Switching on/off of bitsD0-D7 is done by bringing the bar overthe appropriate square and then pressing

the ‘Q’ key for ON and ‘W’ key for OFFoperation. The monitor will show the sta-tus of the relevant switch by indicating ‘1’for ON and ‘0’ for OFF status of the switch.In addition, the current date and time isalso displayed on the screen.

Page 191: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 181

IF SS = 0 THEN RETURNSS = 0IF N = 2 THEN U = 0IF N > 2 THEN U = N - 2IF N < 2 THEN U = NOUT PORT%, URETURNFLATOF: SOUND 400, 1IF FF = 0 THEN RETURNFF = 0IF N = 8 THEN E = 0IF N < 8 THEN E = NIF N > 8 THEN E = N - 8OUT PORT%, ERETURNFATOF: SOUND 400, 1IF GG = 0 THEN RETURNGG = 0IF N = 16 THEN Y = 0IF N < 16 THEN Y = NIF N > 16 THEN Y = N - 16OUT PORT%, YRETURNSILKOF: SOUND 400, 1IF HH = 0 THEN RETURNHH = 0IF N = 32 THEN Y = 0IF N < 32 THEN Y = NIF N > 32 THEN Y = N - 32

OUT PORT%, YRETURNSEVENOF: SOUND 400, 1IF JJ = 0 THEN RETURNJJ = 0IF N = 64 THEN U = 0IF N < 64 THEN U = NIF N > 64 THEN U = N - 64OUT PORT%, URETURNLASTOF: SOUND 400, 1IF KK = 0 THEN RETURNKK = 0IF N = 128 THEN Z = 0IF N < 128 THEN Z = NIF N > 128 THEN Z = N - 128OUT PORT%, ZRETURNALLON: SOUND 500, 4OUT PORT%, 255AA = 1: SS = 1: DD = 1: FF = 1: GG = 1: HH = 1: JJ = 1: KK = 1RETURNFINIS: SOUND 400, 2OUT PORT%, 0AA = 0: SS = 0: DD = 0: FF = 0: GG = 0: HH = 0: JJ = 0: KK = 0RETURNRETIRE:OUT PORT%, 0END

LONG-RANGE FM TRANSMITTERPRADEEP G.

Several circuits for constructing FMtransmitters have been publishedin EFY. The power output of most

of these circuits were very low because nopower amplifier stages were incorporated.

The transmitter circuit described herehas an extra RF power amplifier stage,after the oscillator stage, to raise thepower output to 200-250 milliwatts. Witha good matching 50-ohm ground—planeantenna or multi-element Yagi antenna,this transmitter can provide reasonablygood signal strength up to a distance ofabout 2 kilometres.

The circuit built around transistorT1 (BF494) is a basic low-power vari-able-frequency VHF oscillator. A varicapdiode circuit is included to change thefrequency of the transmitter and to pro-vide frequency modulation by audio sig-nals. The output of the oscillator is about50 milliwatts. Transistor T2 (2N3866)forms a VHF-class A power amplifier. Itboosts the oscillator signals’ power fourto five times. Thus, 200-250 milliwatts ofpower is generated at the collector oftransistor T2.

For better results, assemble the cir-cuit on a good-quality glass epoxy boardand house the transmitter inside an alu-minium case. Shield the oscillator stageusing an aluminium sheet.

Coil winding details are given below:L1 – 4 turns of 20 SWG wire close

wound over 8mm diameter plastic former.L2 – 2 turns of 24 SWG wire near top

end of L1.

(Note: No core (i.e. air core) is usedfor the above coils)

L3 – 7 turns of 24 SWG wire closewound with 3mm diameter air core.

L4 – 7 turns of 24 SWG wire-woundon a ferrite bead (as choke)

Potentiometer VR1 is used to set thecentre frequency whereas potentiometerVR2 is used for power control. For hum-free operation, operate the transmitter on

Page 192: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20182

a 12V rechargeable battery pack of 10 x1.2-volt Ni-Cd cells. Transistor T2 mustbe mounted on a heat sink. Do not switchon the transmitter without a matching

antenna. Adjust both trimmers (VC1 andVC2) for maximum transmission power.Adjust potentiometer VR1 to set the cen-tre frequency near 100 MHz.

This transmitter should only be usedfor educational purposes. Regular trans-mission using such a transmitter withouta licence is illegal in India.

Readers Comments:❑ Without licence, what is the maximumpower of FM transmission permissible inIndia? What are the changes required ifthe range is to be limited to the permissi-ble power?

Can preamplified signal be directlygiven by replacing the condenser mic?What are the modifications required forstereo transmission?

M.P. MurugesanTuticorin

❑ I would like the author to clarify thefollowing points:

1. Can a local Philips radio be used toreceive the FM signals?

2. Is it possible to use an aerial inplace of multi-element Yagi antenna, witha 50-ohm, half-watt resistor?

3. Can an RF amplifier (made usingtransistor BD139) be added to the circuitto increase the power output of the trans-mitter?

TinkkuBhagalpur

❑ I could not achieve a range of morethan 200 metres. Please help me.

Deepak AgrawalRaipur

The author, Pradeep G. replies:In reply to Murugesan’s letter, I wouldlike to say: This transmitter can be usedfor education purposes. Transmission inFM broadcast band is not allowed even

for licensed hams. Allowed VHF trans-mission frequency is 144 MHz (not 88-108 MHz). By adjusting the number ofturns in the oscillator coil, frequency oftransmitter can be increased to 144 MHz(i.e. 2-metre Ham band). To limit therange below half kilometre, avoid ampli-fier stage wired around transistor2N3866. Connect the aerial directly to col-lector terminal of oscillator transistorBF494.

If audio signal from other sources areto be fed to the transmitter, eliminatemicrophone biasing resistor. This trans-mitter cannot be modified for stereobroadcasting, which is much more com-plicated.

In reply to Tinkku's letter, I wouldlike to say: Any radio receiver coveringFM broadcast band can be used to receive

signals from the FM transmitter.My prototype was tested usingPhilips two-band AM/FM pocketradio. The range of the transmit-ter is 1.5 km with a 70cm tel-escopic antenna and 3 km with athree-element Yagi antenna.

An RF power amplifier usingtransistor BD139 cannot be usedin VHF range. It can be used inHF range only. For VHF amplifi-cation, readily available transis-tor 2N3553 can be used in classC mode, as shown in here in Fig.

1. The coil details are as follows:L1, L2 - 4 turns of 20 SWG wire, close

would on 4mm dia air-coreL2 - 4 turns of 20 SWG wire, loose

wound on 4mm dia air-coreL4 - 3½ turns of 20 SWG wire, close

wound on 4mm dia air-coreRegarding Mr Agrawal’s letter:EFY: For FM band frequencies (near

100 MHz), you could use a half-wavedipole with intrinsic impedance of 72ohms or a 300-ohm folded dipole withreflectors and directors (as used for TVreception) to achieve higher gain/range.For directional design use horizontal di-pole/folded dipole, and for achieving omni-directional characteristics use vertical di-pole/folded dipole. The line of shoot (di-rection of maximum radiation) is at rightangle to the dipole.

PIEZO BUZZER FINDS MANYAPPLICATIONS

A. JEYABAL

P iezo buzzer is a low-cost, lowpower consuming, space-saving,PCB-mountable device. It can

work on a wide range of supply voltages—starting from 1.5V to 27V. It is a self-oscillating handy sounder with a varietyof sound modes (continuous, intermittent,

etc). Many of us think that its applicationis limited to sophisticated instruments anddomestic appliances. However, many low-cost useful devices can be constructed bysimply adding a transistor to it. This ex-tra transistor provides the third high-im-pedance control terminal (base of the

transistor). This transistor acts as an elec-tronic switch.

The piezo buzzer described here is ofcontinuous type, and its constructionwould cost around Rs 20. When applyingmore than 12V, please confirm its maxi-mum supply voltage rating, as some buzz-

Fig. 1: VHF amplifier using transistor 2N3553 in class C mode

Page 193: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 183

Fig. 4: Game of steady hands

Fig. 2: Continuity checker, diode, LED, transistor, and capacitortester

Fig. 1: Simple buzzer circuit

Fig. 3: Transistor testers

(a) (b)

placing the prods across the capacitor. Abeep sound of a small duration, for low-value capacitors, confirms that they arein good condition. Higher-value capaci-tors, which produce a long beep (gradu-ally decreasing in sound level), are in agood condition. (For a 100µF capacitor, ittakes about one minute for the sound tostop.) A non-stop sound means that thecapacitor is short and no sound implies itis open. While checking electrolytic ca-pacitors, touch the positive lead of thecapacitor with the red prod and the nega-

tive lead with the black prod. For all testsand checks do not use more than 3Vpower supply to avoid damage to the com-ponents being tested.

Game of steady hand. This gametests one’s steadiness while taking out aring through a zig-zag rod without touch-ing the rod with the ring.

Take a rod of length 40 to 50 cm with3mm diameter and bend it in a zig-zagshape as shown in Fig. 4 and fix it on awooden block. Take another piece of simi-lar rod and bend it in the form of a ring atone end. The inner diameter of the ringshould be slightly bigger than the diam-

eter of the zig-zag rod. Connect the prods tothe wires A and B. Now try to take out thering through the zig-zag rod. If the ringtouches the rod, the buzzer beeps and thecontestant loses the chance and shouldstart from the beginning. After taking outthe ring, another contestant may try to putthe ring in its initial position, i.e. from topto bottom. Use more than 3V power supplyfor higher sound output.

Water-level monitor. It is a boon foran absent-minded person whocan now use this circuit tofill his bathtub without wast-ing water. The buzzer soundswhen the tub is full and hecan immediately close thetap.

For this, connect twometal strips or metal spoonsto the prods and hang themover the bathtub such thatthe tips of the spoons are atthe required water level (Fig.

5). When the watertouches the spoons’base, current flowsthrough transistor T1(Fig. 2) and the buzzersounds. Use a 6V or a9V power supply forrich sound.

Rain alarm.Etch the pattern shown in Fig. 6 on apiece of copper-clad board. The pattern isnot critical but any rain drops that fallanywhere on the board should join thetwo tracks. Veroboard can also be used byproperly connecting the appropriatetracks. Connect the two ends of the cop-per tracks to the prods. Place the boardin a slanting position outside the premiseswhere the rain drops can fall on it. Whenit rains, the rain drops connect the twotracks to allow the base current to flowinto transistor T1 and the alarm sounds.Use a 6V or a higher voltage power sup-ply to get high sound levels.

Heat sensor. The buzzer can be made

ers have a maximum supply voltage rat-ing of 15V.

Table buzzer. Fig. 1 shows the simplebuzzer circuit. Connect the buzzer to thebattery via push-to-on switch S1. Use aproper battery box or a battery holder.Now it can be used as a simple tablebuzzer using 6V or 9V power supply,which is quite adequate.

Morse code sender. When switch S1in Fig. 1 is replaced with a Morse key, itimmediately becomes a Morse code sender.Press the key and enjoy sending Morsecode.

Continuity checker. Connect tran-sistor BC547 (T1) and a 68-kilo-ohm re-sistor (R1) as depicted in Fig. 2. Touchwith the testing prods the points betweenwhich the continuity is to be checked. Ifthere is a connection between thesepoints, base current flows through resis-tor R1 and the said points. In turn, thetransistor conducts and the current flowsthrough the buzzer and activates it. Us-ing this continuity tester we can alsocheck milky lamps, tubelight filaments,chokes, coils, wires, and transformers forcontinuity. Continuity checker can alsobe used as ‘go/no-go’ resistor tester. Touchthe terminals of the resistor with prods.If the resistor is open, no sound will beheard. The buzzer sounds for the goodone. Resistors of up to 1 meg-ohm can bechecked with this device.

Diode/LED tester and lead identi-fier. Touch the prods on the leads of adiode or LED. Interchange the prods andtest again. If the buzzer sounds duringboth the tests, the diode/LED is short. Nosound implies the diode/LED is open. If itsounds only during one of the tests, itmeans the diode/LED is good. For a gooddiode/LED, the buzzer sounds when thered prod and the black prod are touchedto the anode and the cathode of the diode/LED respectively. Thus we can identifythe leads as well.

Transistor tester. For testing pur-poses, the transistor can be consideredequivalent to two diodes connected backto back and the common junction is base(refer Fig. 3). Now check the transistor bytouching the red and the black prods asper Table I. The table also lists the us-ability of the transistor from the observa-tions made. Please note that power tran-sistors cannot be checked in this fashionas they are leaky and give wrong results.

Capacitor checker. Capacitors ofvalues ranging from 0.01 µF to 100 µFcan also be checked with this tester by

Page 194: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20184

to sound when a preset temperature isreached. Connect a low-resistance ther-mistor (PTC) between the base and theemitter of transistor T1 with a pair ofwires and a 1-kilo-ohm resistor (R2) anda 100-kilo-ohm potentiometer (VR1) to thebase and the collector of transistor T1(Fig. 7). Fix the thermistor on the body ofthe device or material whose temperatureis to be sensed. When the required ormaximum permissible temperature isreached, adjust potmeter VR1 (lower theresistance) until the buzzer sounds. Thenext time the buzzer would automaticallysound at this particular temperature.

In case the buzzer sounds even whenpotmeter VR1 is in the highest resistanceposition, fix a 22k resistor (RT) in parallelwith the thermistor and adjust VR1 again.The correct value of RT can be found by

trial and error.Light-interrupted alarm/smoke

alarm. Any unauthorised entry can bebrought to the notice of the user withthis light-interrupted alarm shown in Fig.8. Put LDR (light dependent resistor) R4inside a plastic tube of 5 to 10cm lengthand connect the leads of the LDR to thebase and the emitter of transistor T1. Fixthe tube on one side of the entry and inthe axis of the tube fix a 6V or a 12Vbulb on the other side of the entry sothat light falls on the LDR.

Rotate VR1 to the high-resistance po-sition. Obstruct the light falling on theLDR and adjust potentiometer VR1 untilthe buzzer sounds. Now re-move the obstruction. Ifthe buzzer still sounds,connect a 10k resistor (RT)in parallel with the LDRand adjust potentiometerVR1 again after obstruct-ing the light. The correctvalue of RT can be foundby trial and error. Whenthe light is obstructed, theLDR’s resistance in-creases. As the LDR is partof the potential divider,when its voltage-drop in-creases, it forward-biasestransistor T1 which beginsto conduct and the buzzer sounds.

Smoke alarm. Fix a bulb and an LDRat the top of the room where the smokemay accumulate. When the smoke ob-structs the light, the resistance of the LDRincreases and the buzzer sounds.

External control. The positive out-put from any device or gadget, suitablyreduced to 0.6V level, can be connectedbetween the base and the emitter of tran-sistor T1 (SOC 2 in Fig. 9) to sound thealarm.

All-in-one circuit. A very enthusi-astic hobbyist will like to do all theseexperiments. He can assemble the cir-

TABLE I

Type of Emitter Base Collector ObservationsTransistor Faulty Good

Transistor Transistor

- Red Black No sound (base collector open) SoundN - Black Red Sound (base collector short) No soundP Black Red - No sound (base emitter open) SoundN Red Black - Sound (base emitter short) No sound

- Red Black Sound (base collector short) No soundP - Black Red No sound (base collector open) SoundN Black Red - Sound (base emitter short) No soundP Red Black - No sound (base emitter open) Sound

Fig. 8: Light interrupter alarm, smoke alarm

Fig. 7: Heat sensor

Fig. 6: Rain alarm

Fig. 5: Water level monitor

cuit depicted in Fig. 9 and try all thealarms. When experimenting with thealarms shown in Figs 7 and 8, plug in ashorted plug in SOC1. All the compo-nents, including batteries (pen torchcells), can be put inside an audiocassettebox. One can even use a smaller box.The transistor can be directly solderedto the sockets SOC1 and SOC2. Usingthis device one can assemble many othergadgets, such as a plant tender, firealarm, dead man’s handle, power-on/power-off alarm, mail announcer, pres-sure sensitive alarm, infrared alarm,headlights on reminder, and many more.

Fig. 9: Schematic diagram of all-in-one circuit

Page 195: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 185

POWER SUPPLY CIRCUITS FOR HAMSN. S. HARISANKAR – VU3NSH

Lots of power supply circuits havebeen printed by different maga-zines. Here is a simple home-

brew, high-current power supply unit(PSU). The speciality of this PSU is verygood performance despite the minimumuse of components. The PSU delivers12V output at 12A. At input a noisesuppressor is added. The ready-madenoise suppressors like ‘Schaffner’ NO-FU1211, Switzerland, or equivalent areeasily available in the market. Series-pass transistor T1 2N6320 or 2N 6321 isused for this circuit. (During testing atEFY lab, BD 249 transistor with currentrating of 25A was substituted.) It is ahigh-current, high-voltage transistor withpower dissipation rating of 300W. Thecomponents comprising 14V zener D2,resistors R2, R3, and SCR T2 (BT151used at EFY during testing) form thecrowbar protection circuit to short-circuitthe input AC voltage and blow fuse F1in case the output voltage crosses 14VDC level.

Use a heat sink with adequate heatdissipation capability along with a cool-ing fan for transistor T1. However, a smallheat sink is adequate for regulator IC7812. The diode across the output is forreverse polarity protection. All compo-nents are available in the market. Youmay use a mains step-down transformerwith 0-20V AC, 15A secondary rating forthe circuit. The SCR should be of 18A,200V type. Ferrite beads (FB) at base andoutput terminals avoid RF interference.Use a 16A, 200V PIV (peak inverse volt-age rating) bridge rectifier, followed by a15,000µF, 60V-rated capacitor for rectifi-cation and filtering.

One can use this power supply circuitfor high-current applications like HF andVHF mobile stations. If current require- Fig. 1: Economical high current power supply unit

ment is more, say around 19-20A, thensome minor changes are necessary in thecurrent rating of transformer and bridgerectifier, etc. One can also substitute tran-sistor T1 with two 2N3773 transistors (inparallel). Noise filter circuit to be usedbetween the 230V AC mains and the trans-former input is shown in Fig. 2. However,you may also use readymade ELCOM noisefilter for the purpose. This PSU is easy toassemble, RF immune, and overvoltage/reverse-polarity protected.

General-purpose. This is a general-purpose power supply for your shack,which can be used for QRP transceiveroperation, testing of QRP RF amplifiers,and VFO or other general-purpose appli-cations like 2m/70cm handheld rigs. Thereis no need for external components otherthan two capacitors and one diode. The

power supply gives 12V ± 0.25V DC at1.5A max. The IC SI-3120CA is a 5-pin,hybrid dropper-type regulator with amaximum input voltage (VIN) of 35V andpower dissipation (PD) of 18 watts. TheIC has a number of internal protections,including overvoltage, overcurrent, andoverheat protections. Specified VIN rangeis 13V to 30V. Its ripple rejection factoris 54dB. Further, there is no need for ex-ternal protections like crowbar. Use ofheat sink for the IC is recommended. Youmay use it with a mains stepdown trans-former of 0-22V AC, 2A secondary rating.Diode 1N4007 is a reverse polarity pro-tection diode.

Discrete PSU For QRO (Fig. 3).This PSU design is meant for QRO trans-ceivers (50W) and RF linear amplifiers,etc. IC LM396 is a high-current voltage

Readers Comments:❑ Fig. 8 has certain problems. Thebuzzer produces sound even afterconnecting 10k resistor (RT) in parallelto the LDR and adjusting potentiometerVR1.

A. Jacab LalrinahhanaAizawl

The author, A. Jeyabal replies:It seems the reader used a power supplyof more than 6V. He should reduce thevalue of RT to 2k. The resistance of LDR

and the intensity of light should also betaken into account. The value of RTshould be found by trial and error andVR1 adjusted. If the buzzer still sounds,the transistor must be shorting and henceneeds to be replaced.

Page 196: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20186

CYCLIC ON AND OFF TIMER FORCOOLER PUMP

PRATAP CHANDRA SAHU

This IC does not de-pend on external ca-pacitors for frequencystabilisation. Internalstructure of the IC com-bines high-powerdiscrete transistor tech-nology with modernmonolithic linear ICprocessing. This combi-nation yields a high-performance, single-chip regulator capableof supplying 10amperes of current.

Maximum input voltage rating is 20Vand ripple rejection is 74 dB. The outputvoltage is decided by resistors R1 andR2.

Vout = 1.25 (R1+R2/R1)

Fig. 2: General-purpose power supply unit

regulator meant for providing an adjust-able output votage of 1.25V to 15V atcurrent up to 10A. Its power dissipation(PD) is 70W. For setting output voltage,only two external resistors are needed.

Fig. 3: Discrete power supply unit for QRO

Transistor T1 is used for currentboosting. In this circuit the power dissi-pation (PD) of the IC is limited to 50W.So, we need an outboard transistor forcurrent boosting. In this circuit the cur-rent boosting transistor used is TIP36C,and its PD is 90W. A current-sensingresistor (R5) of 0.15 ohm is used. Whenthe current is less than 4A, the voltageacross R5 is less than 0.6V and the tran-sistor is in off state. The voltage regula-tion works as before. LM396 holds theoutput voltage constant and the load cur-rent passes through LM396. When theload current is greater than 4A, then thevoltage across R5 is greater than 0.6Vand the transistor turns on. The outboardtransistor will supply extra load currentof more than 4A.

It is a beautiful circuit because thetransistor current adjusts to the value ofthe excess load current. The currentthrough LM396 is slightly more than 4A.The outboard transistor handles the restof the current. Crowbar protection isadded against high-voltage DC output.LED1 at VIN terminal is a normal voltageindicator. If it goes off, it means that VIN

is very low. Capacitor between Adj. ter-minal of the regulator and the groundincreases ripple rejection.

Lab note: The protection diodes pre-vent the high-value capacitors, at the out-put stage of the regulator, from discharg-ing via the low-current points into theregulator and damaging it.

Many of us use cooler pumps dur-ing summer. An air-cooler unit,in addition to the fan motor,

uses a 35- to 50-watt pump motor. Thepump runs continuously and unnecessar-ily wastes power. The pump motor can,in fact, be switched off for some time oncethe pads are wet—save power and alsoprolong the life of the motor. The givencircuit is a cyclic on-and-off timer whichhelps to achieve this objective.

The circuit is simply an extended ver-

sion of 555-based astable multivibratorwith a long time-period. The length of on-time is a multiple of the period of 555output and the number of used CD4017outputs being connected together in wired-OR fashion, using diodes. The off-time pe-riod is a multiple of the period of 555 andthe number of unused outputs of CD4017.The circuit thus increases the on and offtime of the 555 waveform with the help of4017 counter. The 4017 output being pro-grammable, can be used to get different

duty-cycles of the overall on-off period, asdesired. It is recommended to set the on-time for three-four minutes and the off-time for seven-eight minutes as it suitsmost coolers.

When there is inadequate water inthe tank, the pump is automaticallyswitched off. This is achieved by pullingthe reset and inhibit pins of 4017 to sup-ply voltage. Taking these pins towardsground potential (while the tank waterlevel is sufficient) through the water in-

Page 197: Electronics Projects 20

ELECTRONICS PROJECTS Vol. 20 187

SELF-SWITCHING POWER SUPPLYANAND S. TAMBOLI

side the tank, en-sures that CD4017is active. In the ab-sence of water be-tween sensor pins,the circuit is both in-hibited and reset.

Other uses ofthe circuit includeon-and-off timer forthe exhaust fan. Itcan also be usedwhere asymmetricwaveform of verylong time-period isrequired for timerapplications.

One of the main features of theregulated power supply circuitbeing presented is that though

fixed-voltage regulator LM7805 is usedin the circuit, its output voltage is vari-able. This is achieved by connecting apotentiometer between common terminalof regulator IC and ground. For every100-ohm increment in the in-circuit valueof the resistance of potentiometer VR1,the output voltage increases by 1 volt.Thus, the output varies from 3.7V to 8.7V(taking into account 1.3-volt drop acrossdiodes D1 and D2).

Another important feature of the sup-ply is that it switches itself off when noload is connected across its outputterminals. This is achieved with the helpof transistors T1 and T2, diodes D1 andD2, and capacitor C2. When a load isconnected at the output, potential dropacross diodes D1 and D2 (approximately1.3V) is sufficient for transistors T2 andT1 to conduct. As a result, the relay getsenergised and remains in that state aslong as the load remains connected. Atthe same time, capacitor C2 gets chargedto around 7-8 volt potential through tran-sistor T2. But when the load is discon-nected, transistor T2 is cut off. However,capacitor C2 is still charged and it startsdischarging through base of transistorT1. After some time (which is basicallydetermined by value of C2), relay RL1 is

de-energised, which switches off themains input to primary of transformerX1. To resume the power again, switchS1 should be pressed momentarily.Higher the value of capacitor C2, morewill be the delay in switching off thepower supply on disconnection of the load,and vice versa.

Though in the prototype a trans-former with a secondary voltage of12V-0V, 250mA was used, it can

nevertheless be changed as per user’srequirement (up to 30V maximum and1-ampere current rating). For drawingmore than 300mA current, the regulatorIC must be fitted with a small heatsink over a mica insulator. When thetransformer’s secondary voltage increasesbeyond 12 volts (RMS), potentiometerVR1 must be redimensioned. Also,the relay voltage rating should beredetermined.

Page 198: Electronics Projects 20
Page 199: Electronics Projects 20
Page 200: Electronics Projects 20