Electronics Projects Vol. 20

EFY Books & Publications

FOR 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: A compilation of selected construction projects and circuit ideas published in Electronics For You magazines between 1979 and 1980. 2. Electronics Projects, Vol. 2 to 19: Yearly compilations (1981 to 1998) of interesting and useful construction projects and circuit ideas published in Electronics For You. 3. Electronics Projects, Vol. 20 to 24 (with CD): Yearly compilations (1999 to 2003). (B) OTHER BOOKS 1. Learn to Use Microprocessors (with floppy/CD): By K. Padmanabhan and S. Ananthi (fourth enlarged edition). An EFY publication 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—giving a lot of practical information, besides theory. 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: By Gp Capt (Retd) K. C. Bhasin. The book explains fundamentals of electronics and more than 40 fully tested electronic projects. 5. Modern Audio-Visual Systems Including MP4, HD-DVD and Blu-ray: Explains disk working principles, troubleshooting and servicing by Gp Capt (Retd) K. C. Bhasin. (C) DIRECTORIES

EFY Annual Guide (with CD): Includes Directory of Indian manufacturing and distributing units, Buyers’ Guide and Index of Brand Names, plus lots of other useful information.

(D) MAGAZINES 1. Electronics For You (with CD): In regular publication since 1969, EFY is the natural choice for the entire electronics fraternity, be it the businessmen, industry professionals or hobbyists. From microcontrollers to DVD players, from PCB designing software to 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: A monthly B2B magazine for sourcing electronics components, products and machineries. Ideal for buying decision makers and influencers from electronics and non-electronics industry. For retail orders:

Kits‘n’Spares

D-88/5, Okhla Industrial Area, Phase-1, New Delhi 110020 Phone: 26371661, 26371662 E-mail: [email protected] Website: www.kitsnspares.com

For magazine subscriptions:

For bulk orders:

EFY Enterprises Pvt Ltd

Paramount Book Agency

D-87/1 Okhla Industrial Area, Phase-1 New Delhi 110020 Phone: 26810601-03 Fax: (011) 26817563 E-mail: [email protected]

Arch No. 30 (West Approach) below Mahalaxmi Bridge, Mumbai 400034 Phone: (022) 40497401, 40497402, 40497474 Fax: 40497434 E-mail: [email protected]

ELECTRONICS PROJECTS VOL. 20

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

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

All rights reserved. No part of this book may be reproduced in any form without the written permission of the publishers. ISBN 81-88152-15-3

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 and Printed at Premier Printers, A-244, Okhla Industrial Area, Phase I, New Delhi 110020

FOREWARD This volume of Electronics Projects is the eighteenth in the series published by EFY Enterprises Pvt Ltd. It is a compilation of 22 construction projects and 68 circuit ideas published in Electronics For You magazine during 1999. For the first time we are including a CD which contains datasheet of major components used in construction projects as also many other books, tutorials and goodies (specially for the Motorola MCU based projects included in this volume). Hopefully the readers will benefit from this add-on material. (Refer CD Contents Page) In keeping with the past trend, all modifications, corrections and additions, sent by the readers, have been included with each project, along with the replies and amendments, if any, proposed/suggested by the authors themselves. It is a sincere endeavour on our part to make each project as error-free and comprehensive as possible. However, responsibility cannot be taken if readers are unable to make a circuit successfully, for whatever reason. This collection of a large number of tested circuit ideas and construction projects in a handy volume would provide all classes of electronics enthusiasts—be they students, teachers, hobbyists or professionals—with a valuable source of electronic circuits, which can be fabricated using readily-available and reasonably-priced components. These circuits could either be used independently or in combination with other circuits, described in this and other volumes. We are sure that this volume, like its predecessors, will generate tremendous interest among its readers.

CONTENTS

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

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

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

SECTION A: CONSTRUCTION PROJECTS

DIGITAL I/O ADD-ON CARD FOR PC XT/AT V. RAJARAMAN AND MOHAN INGLE

A

s you are aware, the PC has a the add-on card is given in Fig. 1. motherboard on which the main CPU and the RAM/ROM memory Description chips are located. All other functionalities like disk controllers, parallel and serial IC2 (74HCT688) is an 8-bit magnitude ports and the display adapter are located comparator. The address bus lines A2 on the add-on cards which plug into the through A9 are continuously monitored expansion slots on the motherboard. It is very easy for anyone to assemble such a card. Design of a general-purpose add-on card for the PC, which will be useful in a number of applications like EPROM programmer and copier, process controller, logic monitor etc, is presented here. The good news is that it takes only four ICs to accomplish this! We will be designing the card for the 8-bit PC (PC-XT) bus, which is the lowest common denominator available. For this you will need a PCB edge connector with 62 pins which are arranged as two rows of 31 pins on each side of the expansion slot, named side A and side B. Fig. 2 shows the signals available on its various pins. The circuit is based on IC 8255A, which is a programmable digital I/ O (input/output) device with three external 8-bit ports. That means, you get 24 general-purpose input and/or output pins. The circuit diagram of Fig. 1: Circuit diagram of digital input-output add-on card for PC

by it, and compared with the address set by the resistors and the DIP switches on the right side (in Fig. 1) of IC2. Here, we have specified an address of 300 hex, which is a vacant I/O address on the IBM PC. This address has been reserved by IBM for experimental work. If

ELECTRONICS PROJECTS Vol. 20

3

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

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

you want to change this address, be sure that no other device with the intended I/O address exists on the PC, to avoid a clash. The AEN signal is also involved in the address selection, as can be seen from the connection to pin No. 12 of IC2. This is done in order to disable our Fig. 3: Connection diagram for testing of add-on card circuit dur-

4

ELECTRONICS PROJECTS Vol. 20

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

ing DMA operations. When the two addresses (the one on the address bus of IBM PC as extended to left side of IC2 and the other set with the help of DIP switches 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 the PC to the data lines of IC4 (8255A). The direction in which data is transmitted is determined by the DIR pin No. 1 of the

transceiver IC3. Note that this pin is controlled by the active low READ signal. This ensures proper direction of data flow. IC 8255A is a versatile chip which can be programmed in three modes. Mode 0 is a basic input-output mode. Modes 1 and 2 involve advanced I/O operations with handshaking. The chip has three 8bit ports named A, B and C and a control port (internal) which determines how the chip is programmed. The two pins marked A0 and A1 (pins 9 and 8 respectively) determine which of these four ports are accessed. This is why the two least significant address bits of the PC bus are directly connected to these pins. With our address assignment of 300 (hex) as base address, the I/O addresses of these 4 ports will be as given below: The three 8-bit ports A, B and C together with +5V and ground connection are brought out on a 26-pin FRC type male connector for external use. Incidentally, this circuit does not need an external power supply. Positive 5-volt supply is readily available on pins B3 and B29 of the 62-pin PC edge connectors itself. This is to be connected to the Vcc pins of all the four ICs. Similarly, the ground pins of the four ICs are tied to the common ground point of the PC edge connector (pins B1, B10 and B31). A proper actual-size double-sided PCB layout for the circuit of Fig. 2 is given in Figs. 4 (solder-side) and 5 (componentside). The component layout for the PCB is given in Fig 6. Ensure that there is no shorting between the power supply and ground pins, and insert the card into a vacant expansion slot of the PC after assembly.

Test Procedure The easiest way to test the circuit is to connect 24 LEDs to the connector pins 1 through 24 using 26-pin FRC female connector with ribbon cable and switch them on/off to check the proper working of the individual bits. Connect the LEDs through buffers (7406) as shown in Fig. 3. 5-volt supply and ground connection for the buffers may be taken from pins 25 and 26 respectively of the 26-pin FRC connector itself. The program TEST.C produces a Address (hex) 300 301 302 303

Port accessed Port A Port B Port C Control Port

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

PARTS LIST Semiconductors: IC1 - 74HCT08 quad 2-input AND gate IC2 - 74HCT688 8-bit magnitude comparator IC3 - 74HCT245 8-bit bidirectional bus driver IC4 - 8255A programmable peripheral interface Resistors (all ¼ watt, ± 5% carbon, unless stated otherwise): R1-R8 - 10-kilo-ohm SIP 9-pin resistor network Capacitors: C1-C4 - 0.1µF ceramic disc Miscellaneous: S1 - Dip switch 8-section CON1 - 26-pin male FRC connector

running light effect on the LEDs.

An Application We will use the card as a logic monitor. In large digital circuits, there would be a number of points whose logic levels have to be constantly monitored. This can be done with the help of a logic probe, but the probe has to be moved from point to point on the circuit, and only one point can be observed at a time. Our add-on card can be used to monitor up to 24 points

simultaneously and display them graphically on the PC screen. The program LOGICMON.C written in 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 the corresponding port pin is logic 0, and it will be bright to indicate logic 1 state at the pin. Connect the 24 pins (1 through 24) of the FRC connector to 24 points of the circuit to be monitored. Please note that TTL logic levels are expected at the points to be monitored. For CMOS circuits, you may require suitable buffers. Connect pin 26 to the digital ground of the circuit under observation. Run the program. Now whenever there is a change in the logic level at any of the 24 points, it will be immediately reflected in corresponding box on the screen. Thus you have a 24-channel logic monitor.

Program The program first initialises the 8255 chip by sending the code 9B (hex) to the control port. This sets up the chip to operate in mode 0, with all the three 8-bit ports acting as input ports. Of course, this is only one of the several possible ways in which this powerful chip can be used. Freely experiment with other modes to ELECTRONICS PROJECTS Vol. 20

5

PROGRAM LISTING OF TEST.C /* TEST.C */ /* produces running lights effect on LEDs */ #define PORTA 0x300 #define PORTB 0x301 #define PORTC 0x302 #define CONTROL 0x303 main ()

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

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

PROGRAM LISTING OF LOGICMON.C /* LOGICMON.C */ /* 24 channel logic monitor program */ #include #include #include #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);

realise its full potential. After initalisation, the program scans the three ports repeatedly in a loop. It separates each bit, tests whether the bit

6

ELECTRONICS PROJECTS Vol. 20

} 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 (“ “); } } }

is at logic 0 or 1 state, and switches on or off the corresponding indicator on the screen. As the cursor rapidly moves from one

/*_________________________________*/ 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); else putch (32); } } /*_________________________________*/ void hide_cursor() { _AH = 1; _CH = 8; _CL =8; geninterrupt (0x10); } /*_________________________________*/ void show_cursor() { _AH = 1; _CH = 6; _CL = 7; geninterrupt (0x10); }

position to the next across the screen, it causes distraction. Hence the cursor is disabled during the execution of the program. ❑

VERSATILE FM STEREO RECEIVER VIDYUT SARKAR

F

M broadcast in India has gained much popularity and AIR (All India Radio) is now using FM channels for Vividh Bharti programmes also. Although the quality of FM transmission is quite good and stereophonic, several listeners often complain that their receivers, including imported ones, produce quite a bit of noise (hiss and shrill). Indian market is flooded with such FM receivers, which though labeled as stereos, are not really so. Their output power is so low that the stereophonic effect cannot be produced. Presented here is a versatile FM stereo receiver circuit which overcomes the above-mentioned drawbacks. Its salient features are: 1. Stereo reception and its faithful reproduction with reasonably high output power for obtaining proper stereophonic effect.

2. Auto-noise-mute (including interstation noise mute) and stop-station functions. 3. LED indicators are provided for indication of the following conditions: (a) FM fine tunning (b) Stereo decoder and amplifier section 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 used for the following applications: 1. Burglar alarm having a long operational range 2. Cordless FM intercom 3. Cordless call bell 4. Remote switch.

Description A functional block diagram of the stereo

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

receiver comprising various sub-sections is shown in Fig. 1. Brief description of the circuits within each block are given below with reference to the circuit diagram of the complete system shown in Fig. 2. FM receiver: This sub-circuit is based on the popular Sony single-chip radio IC CXA1019S (30-pin DIL). The IC is designed for economy receivers for FM and AM radio as well as TV applications. But in the present circuit this IC has been wired for FM reception only. This IC also includes a tuning meter/ LED driver circuit for fine tuning indication. This meter/LED driver output is available at pin 20. Here this output is also coupled to the auto-power on/off section. The audio output available at pin 24 of this IC (marked as point A) is connected to the input of stereo decoder IC (pin 2) for further processing. Auto power on/off: This section comprises a pnp transistor AC188 (T1) and three npn transistors BD139 (T2, T3 and T4). Each of the transistors T2, T3 and T4 is employed for switching on power supply (by completion of ground return path) to: (a) relay driver and buzzer section, (b) stereo decoder, preamplifier and power amplifier circuit built around IC6, and (c) power amplifier circuit built around IC5, respectively. Transistor T1 controls the base drive to transistors T2, T3 and T4 while conduction of transistor T1 itself is controlled by the output at pin 20 (meter/LED driver) of IC1. Whenever the FM receiver is tuned to any FM transmitter ELECTRONICS PROJECTS Vol. 20

7

PARTS LIST Semiconductors: IC1 - LM7805 3-terminal positive voltage regulator IC2 - CXA1019S Sony singlechip FM/AM receiver IC3 - TEA1330 FM stereo decoder IC4 - LA3161 2-channel low noise preamplifier IC5,IC6 - TDA 2002A audio power amplifier T1 - AC188 pnp transistor T2-T4 - BD139 npn power transistor LED1-LED3 - Coloured LED Z1-Z2 - 3V zener diode D1 - 1N4001 rectifier diode Resistors (all ¼ watt, ±5% metal/carbon film, unless stated otherwise): R1 - 150-ohm R2, R3 - 330-ohm R4 - 680-ohm R5 - 33-ohm, ½ watt R6 - 1.2 kilo-ohm R7,R8,R12,R13 R19, R20, R26 - 1 kilo-ohm R9 - 100-ohm R10 - 15 kilo-ohm R11, R16 - 100-ohm, ½ watt R28, R29 - 22 kilo-ohm R14,R15,R17 R18 - 10 kilo-ohm R21, R22 - 2.2-ohm R23, R30 - 220-ohm R24, R25 - 1-ohm R27 - 8.2k R31, R32 - 3.9 kilo-ohm R33 - 100 kilo-ohm Capacitors: C1 C2, C11, C15, C26 C27, C38, C40 C3 C4 C5, C33, C36 C6 C7, C8, C24 C25, C47 C9 C10 C12, C13, C28 C29 C14, C16, C43 C17, C30, C31 C18 C19, C35, C45 C46 C20 C21 C22 C23 C32, C39, C41 C42 C34, C37 C44 Miscellaneous RL1 -

8

VC1, VC2 BZ1 S1-S4

-

L1

-

2200 µF, 25V electrolytic 0.1µF, ceramic disc 3.3µF, 16V electrolytic 3pF ceramic disc 0.001µF ceramic disc 22pF ceramic disc 0.02µF ceramic disc 47µF, 25V electrolytic 0.01µF ceramic disc 100µF, 16V electrolytic 10µF, 25V electrolytic 1µF, 25V electrolytic 680pF ceramic disc 10µF, 16V electrolytic 100µF, 25V electrolytic 0.047µF ceramic disc 0.22µF ceramic disc 0.47µF ceramic disc 1000µF, 25V electrolytic 470µF, 10V electrolytic 470µF, 25V electrolytic 12V, 200-ohm, SPDT relay 2X gang Trimmers 0-22pF 12V buzzer On/off miniature slide switches 3 turns | All coils are hand wound on 3mm air

ELECTRONICS PROJECTS Vol. 20

L2 L3 CF1 CF2

core former - 4 turns | using 22SWG enamelled copper wire - 5 turns | - 10.7 MHz ceramic resonator - 10.7 MHz ceramic filter - Heat sinks for T3, T4 , IC5 and IC6 - 12V DC power supply enclosure, speakers, - FM mike or FM transmitter.

within its range, LED1 starts glowing (i.e. pin 20 goes to ground level). This in turn switches on transistor T1 (AC188), making LED2 to glow (after proper adjustment of preset VR1). Transistor T1 can further switch on the other three transistors T2, T3 and T4, depending on the position of slide switches S1 through S4. Since, except IC1 and IC2, all other parts of the circuit are powered through these three transistors, these receive power only when LED2 is glowing (i.e. FM transmitter is on). Thus, whenever the transmitter is on, the audio amplifier is switched on automatically and the same is indicated by glowing of LEDs 1 and 2. Stop-station and inter-station noise mute functions: When the FM transmitter at the radio station is off (or the FM mike is switched off, i.e. modulation of the carrier is absent), LED1 stops glowing. Thus transistor T1 is cut off, which in turn cuts off transistors T2, T3 and T4. As a result, in the absence of frequency modulated input signal, the receiver mutes itself, reducing the supply current to only a few milliamperes. The same happens when the receiver is tuned from one station to another (frequency). Consequently, this receiver never produces the characteristic shrill sound as produced by other FM receivers. This feature enhances the FM receiver’s compatibility for use as an intercom, long-range remote-switch, call bell and burglar alarm etc. Stereo decoder: In ordinary FM radio receivers, output from FM receiver IC is directly fed to audio amplifiers of the stereo. Thus real stereophonic effect is not produced as the same input is fed to both the channels without any phase control. But in this receiver, FM stereo decoder IC TEA1330 (IC3) is used for stereo reproduction from the aural signals. LED3 glows only when the receiver receives stereophonic signals. Preamplifier: A low-gain

preamplifier based on the popular IC LA3161 has been used after the decoder stage. However, outputs provided by the decoder IC can be used to directly drive low-power audio amplifiers. Audio power amplifier: In this circuit two popular rugged TDA2002A ICs are used. This IC is a class B audio power amplifier IC capable of driving low-impedance loads (up to 1.6 ohms). It can pump 10 watts of power at 12V supply into a 4-ohm impedance loudspeaker. The output is quite adequate for all domestic purposes. Optional functions/features: This versatile receiver can perform following optional functions: 1. Long range remote switch. For this, switch off all switches except S3. Take an FM transmitter or an FM mike. Switch it on. Rotate the gang capacitor and tune the receiver to the transmitter frequency. On proper tuning, LED1 will start glowing, and so also LED2. Now this pair (FM mike/transmitter and the receiver) is ready to be used as a remote switch. Any electrically powered appliance can be turned on and off via relay RL1 by turning the transmitter (FM mike) on and off. 2. Long range cordless call bell. Switch off all the switches except switch S4. Adjust transmitter-receiver pair as mentioned earlier. Now this receiver and FM mike (transmitter) pair can be used as a cordless call bell. When mike is on, the buzzer will sound. 3. Cordless intercom or walkie-talkie. Two such receivers and a pair of FM mikes (or transmitters) can be used as an intercom set or a walkie-talkie. As it is fairly easy to construct an FM transmitter providing a good range (several kilometers), the performance of this remote switch would be far better than any similar device working on IR pulses. Functions of various LEDs and switches are summarised in Tables I and II respectively. An actual-size single-sided PCB layout for the circuit of Fig. 2 is shown in Fig. 3 and its components layout is shown in Fig. 4.

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

Fig. 2: Circuit diagram of versatile FM stereo receiver

zero positions. Now rotate the gang capacitor to the nearest FM broadcast station (or use an FM cordless mike if an FM station is not available). If it has been tuned properly and everything has gone right, LED1 will glow; otherwise recheck the circuit. Now adjust VC1 and VC2 for maximum brightness of LED1 and feed the audio output provided by this IC to any working audio amplifier (output available at pin No. 24 of IC1, marked as point A). Speak into the FM mike; you should be able to hear your voice from the speaker. 2. Construction of the coils L1-L3 is quite easy. Take any 3mm round rod. Use 22SWG enamelled copper wire. Wind closely three turns on the rod and slip the coil out from the rod. Use it as coil L1. For coil L2, wind four slightly spaced turns on the same rod and slip it out. Similarly, for coil L3, wind five close turns with the help of the same rod. 3. After successful completion of step 1 and fabrication of the coils as per step 2, assemble all the four transistors and other components up to second dotted line (on the upper part of the circuit), tune the receiver to your FM mike’s frequency till LED1 starts glowing. Then adjust preset VR1 so that LED2 glows. Now

ELECTRONICS PROJECTS Vol. 20

9

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

switch off the FM mike. LED2 must stop glowing; otherwise again adjust VR1. LED2 must glow when the mike is on and must not glow when it is off. Now If only S4 is closed, receiver will work as a remote switch which can turn any appliance on or off via the relay when the mike is turned on or off. 4. After successful completion of step 3, construct the circuit around decoder IC TDA1330 (up to the first dotted line of the bottom part of the circuit in Fig. 2). Now tune the receiver to any FM radio station transmitting stereo FM signals. If everything has gone alright, LED3 should glow, subject to a proper adjustment of preset

VR3. This decoder IC provides a stereo output which can be directly fed to a lowpower audio amplifier. 5. Now construct the remaining part of the circuit. With that the construction of the receiver would be complete. Potmeters VR4 and VR5 should be adjusted for minimum distortion. For this, keep the volume of the audio amplifier at maximum and adjust Switch Positions potmeters VR4 and Only S3 ON VR5 till undistorted Only S4 ON Only S1 ON sound is delivered by the speakers. Adjust- Only S1 & S2 ment must be carried ON

out for each channel separately by switching the speaker of the other channel off. Switches S1 and S2 can be used for converting the receiver into a mono. This feature will be useful when the circuit is powered through a battery and you want to conserve its energy, or when it is used as an intercom. When the receiver is used as a remote switch or cordless bell, both switches TABLE I LED LED1 LED2 LED3

Indication Fine tuning Power on Stereo signal available

TABLE II Mode of Operation

Output Function

Remote switch Cordless bell Mono receiver, mono cordless FM intercom Stereo receiver, stereo cordless FM intercom

Relay ON Buzzer sounds Sound from speaker LS1 Sound from both speakers LS1-LS2

S1 and S2 must be kept open (off).

Power Supply

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

10

ELECTRONICS PROJECTS Vol. 20

For excellent results, properly filtered and regulated 12V DC power supply is required. The maximum current consumption (when all switches are on and volume is maximum) will not exceed

2A. Minimum current consumption (when th- ere is no input signal) is only a few milliamperes, which makes it ideal for call bell and intercom applications. Notes: 1. Since readymade FM re-

ceiver kit based on IC CXA10193 is available in the market, the same can be used in this project. In that case, omit corresponding part of the circuit. However, don’t forget to add an FM gang (2X)

Readers Comments: ❏ This construction project looks perfect for stereo reception, but I have an FM kit based on Philips TEA5591 FM/AM IC which has only one output. Hence, I would like to use the remaining part of your circuit for developing the stereo receiver. I have the following queries: 1. Can your FM stereo decoder IC TEA1330 be used with my circuit? If yes, how? 2. There is no tuning indicator in the Philips IC. So, how can I use the facility of auto power off/on, mute functions, etc? 3. What is FM 2X gang? Only a trimmer has been provided in the kit. Ruhil Dhawan Meerut ❏ I have added one LED driver circuit to pin no. 20 of CXA1019S IC and changed the gang with FM 2X. On fine tuning, LED1 glows properly and the audio is also good for both FM and AM. I have further assembled the circuit around IC TEA1330. The output is given to AF amplifier (TBA 810) directly for testing. LED2 does not glow at all. Even the input reception is stereo. I tried by adjusting preset VR3 but LED2 does not glow. R. Rajesh Chennai ❏ I request the author to clarify the following points: How can I introduce automatic gain control (AGC) in the same circuit for better and stable FM reception? Vijay K. Yadav Raipur ❏ While constructing the FM receiver, I came across the following difficulties: 1. I could not find FM stereo decoder IC TEA1330 in the market. Is there any substitute which is easily available? Where can I obtain TEA1330 from? 2. What is the role of presets VR2 and VR3 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 FM receiver circuit based on TEA 5591A was published. Kindly let me know whether it can be used in place of CXA1019S-based kit, and whether output of TEA5591A can be fed to TEA1330 as shown in case of

CXA1019S? 4(b) I am interested in adding AM radio reception in the same circuit, with FM stereo reception. Kindly suggest the modifications needed and provide modified PCB design for it. Jaipal Singh New Delhi The author Vidyut Sarkar replies: I thank all readers for their keen interest in my circuit. Replies to letters from various readers are given below: Mr Dhawan can use decoder IC TEA1330 with Philips FM/AM receiver kit based on TEA5591. For this, he Fig. 1: Pin configuration of Sony CXA1019S IC should feed the audio output from IC TEA5591 to the input of decoder IC TEA1330. Auto power on/off and noise-mute facilities cannot be exploited easily while using IC 5591 as it has no tuning indicator. There are two trimmers in the actual kit. Therefore one can avoid FM 2X gang, but it will be difficult to tune from one frequency to another. Fig. 2: Pin configuration for TEA1330/KA2261 For simplicity and clarity in sound reproduction, I have may not be working properly. avoided AM section. To incorporate this Please note that LED3 (stereo indicapart, some more components and additor) will glow only when there is strong tional tracks are needed on the PCB. stereo signal. In case of weak stereo sigRegarding Mr Rajesh’s letter: Please nals, it may not glow but the stereo outcheck the frequency at pin 12 of IC3 by a put will still be available. frequency-meter and set the frequency to I do not suggest Mr Yadav to add ex19 kHz by trimming VR3 (4.7k pot.). tra circuit for AGC in this unit as output The values of components R10, VR3 provided by CXA1019S is stable to a large and C18 collectively determine the freextent. Also, for better stability, he may quency constant of the oscillator section of select some other IC like KA22426 which, IC3. Hence these are not critical. You may though, may be difficult to procure. take some different values like R10=10k, Regarding Mr Jaipal’s letter: C18=680pF etc. 1. Yes, TEA1330 can be substituted If the decoder still does not work, reby KA2261. However, if audio output supplace it (TEA1330) with a new IC, as it plied by this IC contains noise, then he

appropriately. 2. For remote switch and cordless bell, only upper part of the circuit needs to be assembled.

ELECTRONICS PROJECTS Vol. 20

11

may think of replacing C22 by 1µF capacitor in the low-pass filter section. 2. Preset VR2 has been used to select the phase angle between the channels of stereo output for stereophonic effect. The separation angle between the two channels must be less than 90 degrees. This can be obtained by setting VR2 around 200 ohms. Preset VR3 is used to set the frequency of the oscillator section at 76 kHz. 3. After two successive divisions, this appears at pin 12 as 19 kHz. Using this frequency, the phase comparator of this decoder IC decodes the information. The term VCO stands for voltage con-

12

ELECTRONICS PROJECTS Vol. 20

trolled oscillator, and the function of pin 12 has been mentioned above. I have omitted AM/SW/TV reception part of this IC for simplicity and better reception of FM part. 4 (a) Yes, one can use the output of TEA5591A. Also, one can use any other FM radio IC in place of CXA1019S. 4 (b) Using a few additional components, one may add AM reception capability as well. But only FM section is suggested for better results. EFY: Some readers have asked for complete circuit details for AM/SW/TV reception. These can only be accomodated in a separate article, and it is not possible to

discuss these here. However, the pin diagrams of IC CXA1019S and TEA1330/ KA2261 are given in Figs 1 and 2 respectively. As regards the components for the project, the same are easily available in the local market and can also be procured from some leading vendors who are supplying components specially to electronic hobbyists. 2Xgang refers to a two-section variable capacitor with air/ polyster insulation. Please consult EFY magazines where addresses of such dealers are published regularly through advertisements. ❑

SWITCHLESS MUSICAL CALLING BELL WITH COUNTER PRADEEP G.

T

he switchless automatic calling transmitter module uses IC 555 as astable bell system described here can be multivibrator operating at a frequency of fabricated using low-cost and easaround 1 kHz. A pnp transistor (SK100 ily available components. This project uses infrared transmitter and receiver modules which are fitted face to face on both sides of front entry door or corridor of the premises. When a visitor enters the house, infrared beam between IR emitter and IR Fig. 1: Overall view of the switchless calling bell system detector is interrupted for a moment. This results in a specific musical tune being played and a display, indicating the number of visitors entering the house, advances by one. When the next visitor enters the house, a different musical tune is heard. In this way, up to 16 different musical tunes will be played on successive entry of the visitors. After that the musical tunes are repeated. Maximum count of display is 99. After displaying 99, counter is Fig. 2: IR transmitter automatically reset to zero and starts or BD140) is used in IRED (infrared emitcounting again. Fig. 1 gives the overall ter diode) driver stage at the output. This view of the system. transmitter module emits modulated infrared light. Two IREDs are connected Description in series for more range and wider The circuit comprises the following parts: directivity. The module can transmit IR 1. IR transmitter rays up to 4 metres without use of any 2. IR receiver external lens. 3. Melody generator IR receiver circuit (Fig. 3): IR re4. Counter with display ceiver module is fully transistorised. It 5. Power supply. has a tone signal amplifier, a switching IR transmitter (Fig. 2): Infrared circuit and relay driver to switch on mu-

PARTS LIST Semiconductors: IC1, IC3 - NE555 timer IC2 - CIC4822/WE4822 melody generator IC4-IC5 - CD4033 decade counter IC6 - 7809 9-volt regulator IC7 - 7806 6-volt regulator T1 - SK100 pnp transistor T2 - 2N5777 IR photo transistor T3,T4 - BC549C npn transistor T5 - BC558 pnp transistor T6,T7 - BC548 npn transistor T8 - SL100 npn transistor D1,D2 - IRED D3,D4 - IN4148 switching diode D5 - 3.6V, 0.5W zener D6,D7 - 1N4001 rectifier diode Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 150 kilo-ohm R2,R16 - 1.5 kilo-ohm R3,R4 - 56 ohm R5 - 4.7 ohm R6,R14 - 4.7 kilo-ohm R7 - 470 kilo-ohm R8 - 3.3 kilo-ohm R9 - 2.2 kilo-ohm R10 - 2.7 kilo-ohm R11 - 470 ohm R12,R23,R24 - 100 kilo-ohm R24,R26 R13 - 100 ohm R15 - 22 kilo-ohm R17,R18 - 1 kilo-ohm R19 - 82 kilo-ohm R20 - 470 ohms R21 - 10 kilo-ohm R22 - 220 kilo-ohm Capacitors: C1 C2,C9,C4,C16 C3,C7,C8, C18,C19,C20 C5,C14 C6 C10 C11 C12 C13 C15 C17 -

10µF, 16V electrolytic 0.01µF ceramic disc 0.1µF ceramic disc 47pF ceramic disc 100µF, 16V electrolytic 2.2µF,16V electrolytic 2.2nF ceramic disc 0.04µF ceramic disc 10µF,16V electrolytic 4.7µF,16V electrolytic 1000µF, 25V electrolytic

Miscellaneous: DIS 1, DIS 2 - LT543 common-cathode display RL1 - 6V, 100-ohm DPDT relay LS - Speaker, 8-ohm, 0.5W X1 - 230V AC primary to 12V-012V,500 mA sec transformer - PCB, switches, IC sockets

ELECTRONICS PROJECTS Vol. 20

13

Fig. 3: IR receiver

tive half cycles of tone signals forward bias transistor T5. Because of presence of capacitor C10 (2.2µF), transistor T6 continuously conducts during the period when signals from transFig. 4: Melody generator circuit

Fig. 5: Counter with display

sical bell and counter via the contacts of a DPDT relay. When signals from transmitter are received by IR photo-transistor, Amplified AC output is obtained from the collector of transistor T4. These amplified signals are used to bias pnp transistor T5. Only nega-

14

ELECTRONICS PROJECTS Vol. 20

mitter are being received. When transistor T6 conducts, transistor T7 is cut-off and relay remains de-energised. When IR beam is interrupted for a moment, due to passage of a visitor, no amplified AC signals are available at base of transistor T5. This results in cutting-

off of transistors T5 as well as T6. As a result relay driver transistor T7 gets forward biased via resistor R16 and diode D3. The relay is thus energised and it causes application of trigger pulses to both the musical bell circuit and the counter, via its N/O contacts. A short duration switching pulse is sufficient to trigger both the bell and counter. Once a trigger pulse is applied to musical bell, it starts playing a tune and it will stop only on completion of the specific tune. After that it will reset automatically and be ready for the next trigger/tune. Counter, meanwhile, advances by one. Melody generator (Fig. 4): If CIC4822 or WE4822 IC is used, 16 different musical tunes can be generated. A particular tune/melody can be selected by using two-way switch as shown in the diagram. If UM3482 IC is used, 12 different tunes can be heard. A number of options can be programmed with the help of pins provided for the purpose. For details one may refer to the data sheets of these ICs. Maximum safe voltage for the melody generator IC is 5 volts. A 3.6V zener diode is used to limit/provide stable 3.6-volt supply to the melody IC. Two-digit counter module (Fig. 5): Two-digit counter module comprises three ICs and two common-cathode displays. The first IC (IC3) is a 555 timer which is wired as monostable multivibrator. Time period of monostable has been set for about one second. The next two are CMOS decade counter CD4033 ICs, which are cascaded to drive the common-cathode displays directly. If desired, a 330-ohm resistors can be connected to each segment output from IC pins before connection to the displays. Pin 2 of IC 555 is connected to one of

Fig. 6: Power supply circuit

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

Fig. 8: Component layout for the PCB

the poles of relay contacts. Other terminal (N/O) of relay contact is connected to ground. When relay is activated for a moment, pin 2 of IC 555 is shorted to ground. As a result IC 555 gets triggered and applies clock pulse to counter input. For each clock pulse, the counter advances by one count. The count can go up to 99 (max. count). After that, the counter resets to zero and starts counting again. S2 is manual push-to-on reset switch. By pushing it one can reset counter at any instant. Power supply (Fig. 6): Power supply for the complete unit can be derived from the mains using a step-down transformer of 230V AC primary to 12V-0-12V, 500mA secondary. A fullwave rectifier followed by a capacitor filters the output voltage and feeds the following 9-volt regulator whose output is used to cater to the power supply requirement of IR receiver, melody generator and counter modules. It is also used to provide input to a 6-volt regulator IC used for feeding the transmitter circuit. An actual-size single-sided PCB comprising circuits shown in Figs. 2 through 6 is given in Fig. 7 while its component layout is given in Fig. 8. PCB for the transmitter (Fig. 2) can be cut out from the integrated PCB. Use sockets for both CD4033 ICs. Don’t try to solder CMOS ICs directly on PCB. A 2-core cable may be used to connect the IR transmitter module while a 3-core cable will be necessary for IR receiver module as shown in Fig. 1. Power supply, musical bell with speaker, relay and counter modules may be fitted inside the main cabinet. Both IREDs and photo transistor are fitted suitably on transmitter and IR receiver/amplifier modules as shown in Fig. 1 and properly aligned after assembly. ❑

ELECTRONICS PROJECTS Vol. 20

15

COMPUMULTIMETER— A COMPUTER INTERFACED MULTIMETER N.V. VENKATARAYALU

L

inking an electronic project with computer is a real fun, and this project 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 computer to the simple circuit presented here.

Description The circuit consists of a 555 timer operating in the astable mode. This timer generates square wave output at a frequency dependent on the values of external timing components like Ra, Rb and C (see Fig. 1). Hence, the output frequency is indirectly a measure of the values of these external components. The output of this circuit is fed to the parallel port of the computer. The frequency of the output pulses is measured by the software part of the project. From this measured frequency, the value of the unknown component is calculated using the formula: Frequency f = 1.44 / (Ra+2Rb)C However, from this formula only resistance or capacitance can be measured. To measure voltage (between the limits 1.25V and 5.00V (Vcc)), the 555 timer is used as a voltage controlled oscillator (VCO) or a voltage–to-frequency converter. The voltage at pin 5 (control) of the timer varies the frequency of the timer. Thus by calibrating the frequency with some known values of voltages at pin 5 of the IC, unknown voltages can be found by applying them across pin 5 and ground. Suitable known standard values of Ra, Rb and C are selected with the help of rotary switches S1, S2 and S3 respectively, as described later in the text. During meas-

16

ELECTRONICS PROJECTS Vol. 20

urement o f unknown resistor or capacitor, switch S4 is kept in the posit i o n shown in Fig. 1. During measurement of unknown voltage between the abovementioned limits, switch S4 is to be flipped to Fig. 1: Schematic circuit diagram of CompuMultimeter the other ponents that can be measured are disside. played on the monitor’s screen. Before selecting a suitable range, apSoftware propriate external components (shown in The software enables comTABLE I munication between the exterUnknown Ra C Frequency Duty Cycle nal circuit and the computer. The codes have been written and Resistance Range compiled in ‘C’. The software is 100 ohm 1k 10µF 120 Hz – 48 Hz 91% - 66% a user-friendly one with GUI 1k -10k 1k 10µF 48 Hz – 6.82 Hz 66% - 52% (graphics user interface). 10k-100k 10k 1µF 48 Hz – 6.82 Hz 66% - 52% First of all the mode of operation, TABLE II i.e. resistance or ca- Unknown Cap. Range Ra Rb Freq. Range Duty Cycle pacitance or voltage 0.001µF – 0.01µF 1M 1M 481 Hz – 48.1 Hz 66% measurement, is 0.01µF – 0.1µF 100k 100K 481 Hz – 48.1 Hz 66% selected interac- 0.1µF – 1µF 10k 10K 481 Hz – 48.1 Hz 66% 1k 1K 481 Hz – 48.1 Hz 66% tively. The range of 1µF – 10µF 100 100 Ohm 481 Hz – 48.1 Hz 66% values of the com- 10µF – 100µF

Software Program /*** CompuMultiMeter by N.V.Venkatarayalu ***/ #include #include #include #include #include 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 the Unknown Resistor”);

outtextxy(40,215,”1. 100 Ohm - 1 KOhm (Ra=1 KOhm ,C=10uF )”); outtextxy(40,230,”2. 1 KOhm - 10 KOhms (Ra=1 KOhm ,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 the Unknown Capacitor”); outtextxy(45,215,”1. 0.001 uF - 0.01 uF (Ra=Rb=1 MOhm )”); 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=10 KOhms )”); outtextxy(45,260,”4. 1 uF - 10 uF (Ra=Rb=1 KOhm )”); 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 any Key...”); 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;

ELECTRONICS PROJECTS Vol. 20

17

} 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.1e Volts”,result); } if (result<=0.0) sprintf(dispstr,”Calculation Error. Check for known values”,result); outtextxy(40,210,dispstr); getch(); setfillstyle(SOLID_FILL,EGA_CYAN); bar(29,194,306,296); return; }

Table I) are selected using the rot a r y switches. Once the range has been selected, logic 1 is passed to the parallel port using the ‘output (0x378, 1)’ statement, where 0x378 is the output port address. This

changes pin 2 (data bit #1) of the parallel port from logic 0 to logic 1. This pin is connected to pin 4 of the 555 timer, which is the RESET pin, and the timer action begins only when it is high. After this the program enters a ‘for loop’ that scans the port address to which the output of the timer is connected (data bit #8 of port 379 hex) for exactly five seconds. This is done by using the statement ‘inp(0x379)’ where 0x379 is the input port address and it returns a byte from this hardware port address. Each time the port is scanned, the byte returned is compared with the previous value. If these are not the same, it implies that either a high-to-low or a low-to-high transition has occurred. Thus counting the number of such transitions, until the end of the ‘for loop,’ gives twice the number of cycles in five seconds. From this data, the number of cycles in one second, i.e. the frequency, is found. This is the value of ‘f’ in the above formula. The program calculates the unknown value, i.e. the value of the component, from this value of ‘f.’ As the ‘for loop’ terminates, the 555 IC is disabled by bringing its pin 4 to logic 0. Sending 0 to the port using the statement ‘outp(0x378, 0) does this. Thus the timer is activated only when the program scans the parallel port. The three modes of operation are presented below: 1. To measure resistance, the range of resistance that is to be measured is to be first known as in the case of any ordinary multimeter. The unknown resistance (Rx in Fig. 1) is placed between pins 6 and 7 (in Rb arm) of the IC. Other external components (Ra and C) are selected with the help of Table I. 2. To measure capacitance, the range of capacitance that is to be measured is to be known first, as in the case of any

TABLE III

Input voltage 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00

Frequency 1310 1260 1053 842 715 595 513 441 371 317 270 225 183 183 155 125

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

Fig. 3: Component layout for the PCB

18

ELECTRONICS PROJECTS Vol. 20

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); else rres*=pow(10,power); return rres; }

double roundresult(double res){

PARTS LIST Semiconductors: IC1 - NE555 timer Resistors (all 1/4W, ± 5% carbon, unless stated otherwise): R1,R12 - 1 Meg-ohm R2,R11 - 100 kilo-ohm R3,R10 - 10 kilo-ohm R4,R9 - 1 kilo-ohm R5,R8 - 100 ohm R6 - 47 ohm R7 - 56 ohm Capacitors: C1 C2 C3

- 0.01µF ceramic disc - 10µF,16V electrolytic - 1µF,16V electrolytic

Miscellaneous: - 25-pin, male, female 'D' connectors, ribbon cable and PCB etc.

ordinary multimeter. The unknown capacitance (Cx in Fig. 1) is placed between pin 6 and ground (arm C) of the IC. Other external components, i.e. Ra and Rb, are selected as per Table II. 3. To measure the voltage within the range 1.25V to 5V, the same is to be connected across pin 5 of 555 IC and ground. In the above two modes (i.e. while measuring resistance or capacitance values), this pin was grounded through a 0.01µF capacitor. This reduces any noise at this pin and the pin is maintained steadily at 2/3Vcc by a potential divider inside the IC. Because of this reason, whenever the external capacitor charges to a voltage higher than 2/ 3Vcc (voltage at pin 5), the output state changes and the capacitor starts discharging. Again, when its potential reduces to 1/ 3Vcc, the output changes. However, in this mode of operation pin 5 is forced to an external voltage. This causes the output state to change when the capacitor’s voltage reaches the external voltage while charging and reaches half of the external voltage while discharg-

Frequency, f = a(b)V Or

ing. This in turn changes the frequency, depending on the external voltage at pin 5 and other external components. The values chosen for the external components are: Ra = 22 kilo-ohms Rb = 56 ohms C = 0.01 µF The frequency of the output for various voltages at pin 5, as computed by the author, is listed in Table III for Vcc = +5.25 V. From this data, curve fitting has been done to derive a relationship between the frequency and voltage at pin 5. An exponential regression leads to the relationship:

where a = 3080 and b = 0.524. The program uses this formula to calculate the value of the unknown voltage. The resolution of this CompuMultiMeter in resistance and capacitance measurement modes is 0.1, and the result is displayed in the format X.Xe±XX where ‘e’ stands for exponent to base 10. For example, 4.7 kilo-ohm is displayed as 4.7e+3. Accuracy of the results depends on the tolerance level of the other external

components used. Hence, for better results, components with 1 per cent tolerance level are recommended. This simple circuit can be easily wired on a general-purpose PCB. However, for those readers who still desire to wire up the circuit using a proper track layout, a single-sided actual-size PCB is shown in Fig. 2 and the component layout for the same is shown in Fig. 3. Lab Note: During measurements, it was observed that while the values of unknown resistors and capacitors could be measured fairly accurately, the results of voltage measurements were wide off the mark. ❑

Reader Comments: ❑ I have completed the software and hardware successfully, and it is working well. I, however, want to know as to how we calculate the constants ‘a’, ‘b’ from curve fitting using (f-frequency) and (v-voltage), and also how we arrive at the formula f = a(b)V from linear regression? S. Suresh Kumar Alwarkurichi

The author N.V. Venkatarayalu replies: From Table III published in the construction project, an exponential dependence of frequency on voltage can be noticed. So, an exponential regression of the form f = a(b)V would be best suited. To find the constants ‘a’ and ‘b’ the expression is reduced to the linear form by taking the logarithm of both sides in the above equation, i.e.

log f=v log b + log a which is of the form y=mx+c where y=log f, x=v, m=log b, and c=log a. The standard procedure for linear regression available in any numerical mathematics book can be used to find ‘m’ and ‘c’ and hence the constants ‘a’ and ‘b’. The values of ‘a’ and ‘b’ are found to be 3080and 0.524 respectively. ❑

ELECTRONICS PROJECTS Vol. 20

19

CALLING NUMBER IDENTIFICATION SYSTEM USING CALCULATOR G. GOWRISHANKAR

H

ere is a simple and inexpensive circuit to identify the calling telephone number of an incoming telephone call. Recently the telecommunication department has introduced the facility of calling number identification

system for cities like Mumbai and New Delhi. Many companies have already advertised their products which can display the calling number with added features like storage of the previous calling numbers and undesired number

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

20

ELECTRONICS PROJECTS Vol. 20

blanking etc. The circuit of calling number identification system presented here will cost around Rs 300 including the cost of a simple calculator which has been used in this project for displaying the calling number.

PARTS LIST Semiconductors: IC1-IC3 - CD4016/CD4066 quad analogue switch/analogue multiplexer IC4 - CD4028 BCD-to-decimal decoder IC5 - KT 3170 or 8870 DTMF decoder IC6 - CD4011 quad 2-input NAND gate IC7 - CD4081 quad 2-input AND gate IC8 - MCT2E opto-coupler T1 - 2N2222, npn switching transistor D1-D10 - 1N4007, rectifier diode Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1, R7 - 47 kilo-ohm R2 - 330 kilo-ohm R3 - 1 mega-ohm R4, R5 - 1.5 kilo-ohm R6 - 100 kilo-ohm R8 - 1 kilo-ohm R9 - 12 kilo-ohm R10 - 10 kilo-ohm Capacitors: C1 C2, C9 C3 C4 C5 C6 C7 C8

-

0.1µF, 10V polyster 0.1µF ceramic disc 0.47µF, 100V polyster 47µF, 16V electrolytic 470µF, 25V electrolytic 10µF, 10V electrolytic 1µF, 160V polyster 1000µF, 25V electrolytic

Miscellaneous: Xtal - 3.579545 MHz crystal X1 - 230V primary to 0-12V, 250mA secondary transformer X2 - 230V primary to 0-6V, 500mA secondary transformer Calculator - 12 digit calculator Battery - 1.5Vx4, R6 (UM-3DG) cells

The dedicated DTMF-to-BCD converter IC KT3170 or CM8870 forms the heart of this circuit. This IC converts the incoming DTMF signals sent by the MTNL in between the ringing signals into corresponding BCD codes. IC KT3170 or its equivalent CM8870 is a low-power

Fig. 2: Power supply circuit

Pin Description of CM8870 Pin No. 1 2 3

Symbol IN+ INGS

4

VREF

5

IIN

6

PDN

7.6

OSC1 OSC2

9 10

GND OE

11-14

Q1-Q4

15

DSO

16

ESO

17

SI/GTO

18

VDC

Description Non-inverting input of the op-amp Inverting input of the op-amp Gain select. The output used for gain adjustment of analogue input signal with a feedback resistor. Reference voltage output (VDD/2, Typ.) can be used to bias the op-amp input of VDD/2. Input inhibit. High input states inhibit the detection of tones. This pin is pulled down internally. 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 down internally. Clock input/output. An inexpensive 3.579545MHz crystal connected between these pins completes internal oscillator. Also, external clock can be used. Ground pin Output enable input. Outputs Q1-Q4 are CMOS push-pull when OE is high and open circuited (high impedance) when disabled by putting OE low. Internal pull-up resistor built-in. Three-state data output. When enabled by OE, these digital outputs provide the hexadecimal code corresponding to the last valid tone pair received. Delayed steering output. Indicates that valid frequencies have been present for the required guard time, thus constituting a valid signal. Presents a logic high when a received tone pair has been registered and the output latch is updated. Returns to logic low when the voltage on SI/ GTO falls below VTH. Early steering outputs. Indicates detection of valid tone outputs a logic high immediately when the digital algorithm detects a recognisable tone pair. Any moemtary loss of signal condition will cause ESO to return to low. Steering input/Guard time output. A voltage greater than VTS detected at S1 causes the device to register the detected tone pair and update the output latch. A voltage less than VTS frees the device to accept a new tone pair. The GTO output acts to reset the external steering time constant, and its state is a function of ESO and the voltage on S1. Power Supply (+5V, Typ.)

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 or differential input signal configuration. Pin description of KT3170/ CM8870 IC is given in the box above. The BCD coded outputs from decoder IC5 are converted into d e c i m a l

equivalents by IC4 (CD4028) which is a BCD-to-decimal decoder. The output pins of this IC will be ‘high’ corresponding to the BCD code given at the input of IC4. The BCD output from IC5 is coupled to IC4 via four AND gates. The gates are enabled by the delayed steering output (DSO), a pulsed digital signal available at pin 15 of IC5 which will be ‘high’ only when the DTMF tone is detected by the IC. IC1 through IC3 are all quad analogue switches controlled by the decimal outputs from IC4. The analogue switch triggers the corresponding decimal number in the calculator which is used as a display in the circuit. IC4 responds to all the BCD codes except the zero decimal, because the output of IC5 for zero (corresponding to ‘0’ key on dial key-pad ) will be 1010 which will not activate IC4. NAND gate (IC6 (b)) is used to sense the zero code. Active low output of gate IC6(b) is inverted by IC6(a) to trigger the ‘0’ display in the calculator. ELECTRONICS PROJECTS Vol. 20

21

Prototype of caller-identification tested in EFY Lab

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

Fig. 4: Components layout for the PCB

IC9 (MCT2E) is an opto-coupler which is well known to EFY readers. It is wired to sense the ringing signals. When the first ring comes, the input to IC6(C) goes high because the transistor inside the opto-coupler conducts. Capacitor C5 holds the input high for a few seconds. The output of IC6(d) also goes high simultaneously and it causes a pulse to pass through capacitor C4 which closes the

22

ELECTRONICS PROJECTS Vol. 20

analogue switch IC1(a) and the calculator is switched on. Any common type of calculator can be used for this application. However, one should ensure that the calculator has 12 or more digits so that the calling number along with area code etc could be accommodated. For interfacing the calculator with this circuit, remove cabinet of the calculator.

Now you can see that the tracks under the pushbutton side are etched in such a way that when a pushbutton is pressed the corresponding two tracks under the pushbutton get shorted. You can take pair of leads from the corresponding two tracks by scratching the green mask and soldering the wires carefully. A proper actual-size, single-sided PCB for the circuits in Figs 1 and 2 is shown in Fig. 3 and its component layout is shown in Fig. 4. After assembly, the unit can be fixed into a small plastic enclosure which should have a cut-out for the display. The power supply for the calculator can be taken from this circuit itself. If the calculator requires 3V for operation, replace the diodes D2 through D4 with a 3.3V, 250mW zener. The given power supply circuit having a battery back-up is suggested for proper operation. Lab note: The testing of the circuit was carried out in simulated conditions using internal extensions (having DTMF dialling facility) of an EPABX. Not only the calling numbers but even the called numbers were displayed on calculator display. Apparently, lifting of the handset from cradle, which causes sudden change of voltage from 48V to about 12 volts, sends a pulse via opto-coupler to control pin of IC1(a) to switch on the calculator to display the dialled number. Capacitor C7 was added in the original circuit to obviate loading of the telephone line to avoid its behaving as ‘busy’ while the handset is still on the cradle. ❑

TRANSFORMER POLARITY TESTER P.S. SINI

T

esting the winding polarity of transformers, especially those of multi-winding SMPS, audio and power transformers, is a common requirement in the industry. An instrument which could easily and quickly test the winding polarity would be extremely useful for not only the industry but also the electronics hobbyists and enthusiasts. The circuit of transformer polarity tester given here can be easily fabricated using commonly available components. The supply voltage selected is 9V,

which suits portable battery-powered operation. To test the relative polarity between any two windings, the user has to connect only two sets of probes (or crocodile clips) to the respective winding terminals, the reference winding and any other winding. The polarity is indicated with the help of two LEDs with respect to the reference winding probe leads marked + (red) and - (black). The green LED when ‘on’ would indicate that the two windings are in phase, that is, the ‘+’ marked and

‘-’ marked probe leads are connected to winding terminals with identical ‘dot’ polarity. On the contrary, red LED when ‘on’ will indicate reverse dot polarity of the two windings. The circuit is based on the principle that when any winding of a transformer is excited with a voltage pulse, all other coupled windings generate pulses of varying amplitude decided by the turns ratio. The ‘dot’ ends of all the windings generate voltages in phase with the ‘dot’ end of the excited winding. This presents the pos-

Fig. 1: Circuit diagram for transformer polarity tester

ELECTRONICS PROJECTS Vol. 20

23

PARTS LIST Semiconductors: IC1-IC3 - NE555, timer IC4 - TL084, quad JFET input opamp IC5 (N1,N2) - CD4011, quad NAND gate T1 - 2N5062 or 2PUM, SCR. T2 - BC557, pnp transistor T3 - IRF840 n-channel MOSFET D1 - 1N4148 switching diode D2, D3 - MUR160 or1N4007 rectifier diode D4 - Zener, 5.I volt Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 820-ohm R2 - 68 kilo-ohm R2A* - Test selected (refer text) R3, R16, R17 - 680-ohm R4, R6, R13 - 1.2 kilo-ohm R5 - 2 kilo-ohm R7 - 510-ohm R8 - 100-ohm R9, R14 R21, R23 - 1 kilo-ohm R10 - 33-ohm R11 - 180-ohm R12, R20, R22 - 5.1 kilo-ohm R15 - 33 kilo-ohm R18 - 22 kilo-ohm R19 - 1.5 kilo-ohm Capacitors: C1, C2, C6, C7 C3, C4, C5 C8 C9

-

Miscellaneous: LED1 LED2 LED3 -

0.1µF ceramic disc 0.22µF ceramic disc 0.01µF ceramic disc 3.3µF, 25V electrolytic Yellow LED Red LED Green LED Crocodile clips Battery, 9-volt

sibility of performing a simple logic AND operation to determine the winding polarity. In the circuit diagram given in Fig. 1, NAND gate N2 does this job in conjunction with rest of the circuit.

Description Though the simple AND gate will work in principle, various edge delays and ringing phenomenon commonly encountered in transformer circuits will cause errors, making the test results invalid. The circuit presented here avoids these errors by sampling the pulses somewhere in the middle part of the exciting pulse and then doing the logic detection of the phase. The first part of the circuit is a simple astable multivibrator with IC1 having an ‘on’ period of 50 to 100 µs and ‘off’ period of approximately 5 ms. Resistance R2A shown in series with diode D1, which determines ‘on’ period, should be test selected to be low enough but adequate to trigger the MOSFET properly. The positive going pulse output from

24

ELECTRONICS PROJECTS Vol. 20

shorting of the probes. This condition is indicated by the glowing of yellow LED1. A sampling pulse is generated by monoshot IC2 which gets a delayed trigger derived from the exciting pulse. Output of the monoshot is given to one of Fig. 2: Actual-size, single-sided PCB for the circuit of Fig. 1 the pins of NAND gate N2 which gives an active low output when the preconditioned pulse applied to its other input pin is available simultaneously with the monoshot high state. Resistors R20 through R22, zener diode D4 and IC4(b) do the conditioning of Fig. 3: Component layout for the PCB of Fig. 2 the input pulse by amplitude limiting and comparator action. Care should IC1 is used to drive the MOSFET (T3) which in turn produces the voltage pulse still be taken, if the turns ratio is very at the excitation high, to produce excessive voltage at the measuring winding. probe terminals. Resistor R7 and diode Timer IC3 is used for the indication D2 provide the freefunction. It is basically a re-triggerable monoshot with 8ms period. The output of wheeling path when reference winding of this monoshot remains high if NAND gate transformer ‘under N2 output is low (active) which triggers it during each measuring cycle. This causes test’ is connected across excitation the green LED to continuously glow, indiprobes. cating the same dot polarity of the unknown winding as that of the exciting Resistor R10 senses the excitation winding. When polarity is not the same, current and, if this is red LED will glow. The circuit can be assembled using a excessive, comparator IC4(a) gives a general-purpose PCB. However, a proper positive pulse output actual-size, single-sided PCB layout for the circuit is given in Fig. 2. The compoto trigger the SCR (T1) to ‘on’ state. As a nents layout for the PCB is given in Fig. 3. result, further drive After assembly, the PCB can be fixed inside a small plastic case with LEDs and to the MOSFET is inhibited until the rereset switch S1 protruding out. Crocodile set switch is pressed. clips with red and black coloured bands can be used for the two pairs of probes for This limits the curFig. 4: Pin configurarent to a safe value in connecting the reference and any other tion of transistor and case of accidental winding. ❑ MOSFET

PROGRAMMABLE VERSATILE TIMER S. ARVIND

M

any timer circuits have been published in EFY in the past. But this circuit based on dedicated application-specific IC (ASIC) ICM 7217A is quite versatile and compact. ICM 7217A comprises a 4-digit decade counter with multiplexed LED display drivers. ASIC versions with suffix A and C are meant for common-cathode and the versions with nil or B suffix are meant for common-anode LED displays. The A and nil suffix versions have a maximum count of 9999 while suffix C and B versions, which are primarily meant for timing applications, have a maximum count of 5959. The BCD I/O port pins (7 through 4)

can be used for inputting BCD data to a register inside the chip. The contents of this register are compared with the count held in the counter and the results appear at output pins 2 (ZERO or Z) and 3 (EQUAL or E). When both counter and register contents are zero, pin 2 output becomes logic 0 (active) and when contents of counter and register are equal, pin 3 output goes logic 0 (active). These features are made use of in this circuit.

Description The schematic diagram of versatile programmable timer is given in Figs 1 and 2

while its power supply circuit is given in Fig. 3. Other than the power supply and ground connections, certain points of Fig. 1 (A through D) need to be connected (through use of jumper wires) to various points (E through K in Fig. 2) for various modes of operation, as per Table I. There are three modes of operation which have been covered in this article. These modes can be used for various applications. Many other modes, limited only by one’s own imagination, are also possible. As mentioned earlier, ICM 7217A version is used with common-cathode LED displays. The average segment current is

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

ELECTRONICS PROJECTS Vol. 20

25

required to be limited to about 3 mA. The clock input is a fairly conventional one. Here the CMOS compatible clock is generated using a crystal of 32.768 KHz in conjunction with IC CD4060 which is a 14stage binary counter/divider and oscillator. The final output of 2 Hz at pin 3 of IC2 is further divided by 2 by IC3 (CD4017) which is configured here as a toggle flip-flop to provide 1Hz pulses at pin 3 (point E). Logic state at pin 10 of Fig. 2: Interface circuit for achieving various modes of operation IC1 determines the counting direction. the help of thumbWhen pin 10 is at logic 1, the direction of wheel switches TWS1 counting is upwards, and when it is at through TWS4. When logic 0, the direction of counting is downthe counter is at 0, the wards. output at pin 2 (point Switches S1 through S3 are spring C) becomes active low. loaded push-to-on switches. Switch S1 is This causes the output used to load the counter with the BCD of latch at point H to count value selected via the thumb-wheel go high and the counswitches TWS1 through TWS4. Switch S2 ter starts counting up. is similarly used to load the internal regWhen counter reaches ister with the count value selected via the the preset value Fig. 3: Power supply circuit thumb-wheel switches. Once both, the con(loaded into the intertents of register and those of the counter, nal register), pin 3 output (EQUAL) at via point J is connected to point D which are equal, the output at pin 3 of IC1 goes point D becomes active low. This causes carries the EQUAL output from pin 3 of low. Switch S4 is used to reset the counoutput of the latch to go low and, as a IC1. ter to zero. result, the counter starts counting down. Thus until the time the counter The three modes of operation Thus in mode 1, the counter keeps countcontents are less than the value held in selectable with the help of jumpers, as ing back and forth between zero and the the internal register, the output at pin 3 per Table I, are described below. preset value. of IC1 is at logic 1. As a result, transistor Mode 1: In this mode jumper J1 is Mode 2: In this mode it functions like T1 is forward biased and its collector placed across points 1 and 2 while switch a preset timer to sound an alarm when is pulled to near ground potential, S4 is in closed position so that IC2 functhe count reaches the programmed value. which causes counter IC2 to remain tions continuously. The 1Hz clock generThe 1Hz clock from point E is connected operative while timer IC4 remains nonated by IC3 at point E is jumpered to to pin 8 (point A) of IC1, as in mode 1. operative. clock pin 8 (point A) of IC1. Outputs from However, in this mode the counter is Once the count reaches the value held points C (ZERO) and D (EQUAL) are conconfigured for counting up operation only, in the internal register of IC1, its output nected to inputs of gates N1 (point F) and by connecting pin 10 (point B) of IC1 to at pin 3 goes logic 0. This causes transisN2 (point G) of the NAND latch circuit. Vcc (point L), i.e. logic 1. The internal tor T1 to cut-off so that its collector voltOutput (point H) from the NAND latch register is loaded to the value preset by age becomes high and it resets counter connected to pin 10 of IC1 (point B) conthumbwheel switches TWS1 through IC2, while timer IC4 becomes operational trols the direction of counting. TWS4 with the help of push-to-on switch and the buzzer sounds to indicate the end Assume that the registers have been S2. In this mode, switch S4 remains open of the preset timing interval. loaded with a specific value selected with and jumper J1 is placed across points 2 Please note that the value set through and 3 so that master reset pin 12 of IC2 is thumbwheel switches corresponds to the controlled by the potential/logic level at value in seconds since 1Hz clock is being the collector of transistor T1. Simultaneused for counting operation by IC1. ously, the collector of transistor T1 is conMode 3: In this mode the counter opnected to reset pin 4 of NE555 timer IC2 erates in reverse way than in mode 2. which is configured as an astable Here the counter alone is used. The count multivibrator operating in the audio frevalue selected by thumb-wheel switches quency region. The base of transistor T1 is loaded into the counter using push-to-

26

ELECTRONICS PROJECTS Vol. 20

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

transistor T1 by shorting point C to J. Thus initially, when the count value is greater than 0, transistor T1 remains forward biased and its collector voltage is near ground potential which, in turn, results in forward biasing of pnp relay driver transistor T2. Thus the load connected to supply via N/O contacts of relay RL1 is on. As the counter counts down from the loaded value and reaches zero, the output at pin 2 of IC1 goes logic 0. This cuts off transistor T1 and consequently transistor T2 to deenergise the relay and switch off the supply to the load.

Applications

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

on switch S1. Like modes 1 and 2, the 1Hz clock is applied to pin 8 of IC1 by connecting point A to E. The position of jumper J1 is the same as for mode 2. However, jumper 2 is used for connecting the collector of transistor T1 to the base of relay driver transistor T2 by shorting points 5 and 6, while ZERO output from pin 2 of IC1 is connected to the base of

Mode 1: A special application of this mode could be made in the tape recorders. The 1Hz clock pulses may in that case be replaced by 1 pulse/revolution of the tape. Thus once the tape, during play, reaches a preset position, the counter reverses and the tape rewinds. Once the tape reaches 0 position, it again starts playing in the forward direction and thus it keeps on repeating a particular song or speech. This mode would also have industrial applications where a gadget is to operate in a particular direction/way for a pro-

PARTS LIST Semiconductors: IC1 - ICM 7217A, 4-digit LED driver cum programmable up/down counter IC2 - CD4060, 14-stage counter and oscillator IC3 - CD4017 decade counter IC4 - NE555 timer IC5 - 74LS00 quad 2-input NAND gate IC6 - LM7805 voltage regulator T1 - 2N2222A npn transistor T2 - SK100 pnp transistor D1-D16 - 1N4148 switching diode D17-D19 - 1N4007 rectifier diode Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1, R2, R11 - 10 kilo-ohm R3-R6,R9, R10 - 1 kilo-ohm R7 - 220 kilo-ohm R8 - 6.8 kilo-ohm R12 - 22 kilo-ohm R13 - 2.2 kilo-ohm R14, R15 - 330 ohm Capacitors: C1 C2, C4, C6, C7 C3 C5

-

10µF, 16V electrolytic 0.1µF ceramic disc 0.01µF ceramic disc 1000µF, 25V electrolytic

Miscellaneous: XTAL1 - 32.768kHz crystal DIS1-DIS4 - LT543x4 common cathode display X1 - 230V AC primary to 12V-012V, 250mA secondary transformer TWS1-TWS4 - BCD thumbwheel switch S1-S3 - Push-to-on switch S4 - SPST switch LED1 - Red LED LED2 - Green LED

grammable duration and then in the opposite direction/other way for the same period, repeatedly. Mode 2: A simple application would be as a lab timer or as a wake-up alarm on completion of the preset time. Mode 3: This mode could be used in industrial environments for switching on/ off of any device after a preset delay. Many other applications may also be similarly thought of not only for this but other modes as well. An actual-size, single-sided PCB layout for the circuits in Figs 1 through 3 is given in Fig. 4. The component layout for the PCB is given in Fig. 5. Normal precautions required for working with CMOS ICs should be taken while assembling this circuit. For easy fault diagnosis and replacement, all the ICs may be mounted on IC bases. The circuit, after assembly, may be fitted inside a small box with cut-out for the display. The power supply transformer and the relay may be mounted externally, if desired. ❑

ELECTRONICS PROJECTS Vol. 20

27

CALLER-ID UNIT USING MICRO-CONTROLLER VINAY CHADDHA

T

he facility of knowing your caller’s telephone number before answer-ing the call, which had been available to cellular phone users only in

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

28

ELECTRONICS PROJECTS Vol. 20

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

January 1999. MTNL/DoT telephone exchanges transmit the telephone number of calling party just before the first ring while in

TABLE 1

Row 1 697 Hz Row 2 770 Hz Row 3 852 Hz Row 4 941 Hz

Column 1 Column 2 1209 Hz 1336 Hz 1 2

Column 3 1447 Hz 3

4

5

6

7

8

9

*

0

#

systems used in USA and China, the data relating to the calling number is sent between first and the second rings. The number of calling party in India is transmitted by MTNL/DoT exchanges in DTMF codes. Two documents containing standards and specifications issued by DoT’s Telecommunications Engineering Centre (TEC) in the form of ‘Generic requirements’ and ‘Interface requirements’ for ‘Subscriber service unit for calling line identification presentation (SSU for CLIP)’ are available from TEC, Khursheed Lal Bhawan, Janpath, New Delhi against payment of Rs 250 each. In older versions of telephones using rotory dials, whenever a digit was dialled, telephone line was disconnected and reconnected for short durations. These were referred to as pulses and the system was called pulse dialing system. The number of connections and disconnections equaled the dialled digit. For example, if number 7 was dialled, the line was disconnected 7 times for short durations. For number 0, the number of connections and disconnections equalled 10. In later versions of telephones using push buttons and integrated circuits, the same protocols are used to maintain compatibility with older phones and exchanges. DTMF (dual tone multi frequency) system is replacing the pulse dialling system in modern telephones and exchanges. In DTMF telephones (and exchanges), the numbers are transmitted using different tone frequency pairs and not by making or breaking connections. A normal telephone instrument has 12 buttons (keys) arranged in three columns and four rows. Each row in the keypad matrix activates a specific frequency tone. Similarly, each column also controls a specific frequency tone. So when a key is pressed, two different tones corresponding to the row and column combination of the key are generated. Table I shows the tone frequency-pair

associated with each row and column of the telephone keypad. Thus pressing 8 will generate a combination consisting of row and column frequencies of 852 Hz and 1336 Hz respectively. Similarly, pressing 4 will generate 770 Hz and 1209 Hz combination. The same tone frequency combinations are used for transmitting calling party’s Fig. 3: Off-hook detector number from exchange to the called party’s telephone instrument. Caller-ID circuit presented here has the following features: • Displays dialled numbers (in tone mode only). • Displays incoming numbers and stores them in memory. Fig. 4: LCD display unit • Only last 99 numbers Power supply (Fig. 2): The power are stored in memory. (Older numbers are supply unit is used to provide a constant automatically deleted and new numbers 5V supply to different ICs. This is a standare stored when the stored numbers ard circuit using external 12V DC adopexceed 99—on first-in-first-out basis.) ter and fixed 3-pin voltage regulator. Di• View incoming numbers and selecode is added in series to avoid damage to tively delete stored numbers. the unit if reverse voltage is applied by

Description This caller-ID unit has seven functional blocks: power supply, off-hook detector, DTMF decoder, LCD display unit, microcontroller, memory and keyboard. The main electronic components are shown in Table II. TABLE II Micro-controller DTMF decoder Memory Comparator Alphanumeric LCD

MC68HC705KJ1 MT8870 24C08 LM393 16 characters x 1 Line

IC1 IC2 IC3 IC4 DIS.1

MC68HC705KJ1 is the latest low-cost micro-controller from Motorola. Other parts like ICs MT 8870, 24C08, LM393 and LCD module are standard parts that are available from more than one source.

Fig. 2: Power supply

mistake. Off-hook detector (Fig. 3): The telephone line voltage is around 48V when unit is on-hook. This voltage falls to around 10 V when telephone handset is lifted from the cradle, and it remains the same during dialling or conversation. This voltage may vary by ± 20 per cent due to battery voltage variations at exchange and line voltage drop, depending upon the distance between exchange and the telephone instrument. Off-hook detector circuit uses a bridge rectifier to take care of polarity reversal of telephone lines. Resistor divider comprising R9 and R10 divides the line voltage by 20 for comparison against a fixed voltage (approximately 1 volt), which is derived from +5V supply using voltage divider comprising resistors R7 and R8. Output of comparator IC4 at pin 7 is logic low (0V) when unit is on-hook and logic high (+5V) when unit is off-hook. The output level from the comparator is suitable for direct interfacing to micro-controller IC1. LCD display unit (Fig. 4): LCD display is a single-line, 16-character unit. This is a standard unit available in local ELECTRONICS PROJECTS Vol. 20

29

Fig. 5: Non-volatile memory

market. Interface with micro-controller is accomplished via four data lines D7-D4 and two control lines RS and E. Using these six lines, micro-controller displays all messages and telephone numbers. The

However, in case of Lampex, Oriole TABLE III and Crystalonics (popular brands Pin No Signal Remarks available in India), connections for 1 Ground Vss pins-15 and 16 are shown in Table 2 +5V Vcc IV. 3 Contrast Ground for maximum contrast RS H = Data L = Command LCD controller is a flexible con- 4 R/W H = Read L = Write troller and can be used with 8-bit 5 6 E H = Enable L = disable or 4-bit micro-controller. In 4-bit 7 - 10 D0 - D3 Data lines (Lower nibble) * mode, only D4-D7 are used, leav- 11 - 14 D4 - D7 Data lines (Higher nibble) * ing D0-D3 open. *Note : For 8-bit (byte) data interfacing all the eight In our circuit, we have conected data lines (Pins 7 through 14) are used whereas for 4R/W pin to ground as we are using bit (nibble) data operation, data lines for D4-D7 (pin 11 through 14 only have to be used.) it for write operation only. Reading back of the module’s TABLE IV status, which is required to Pin/Manufacturer Lampex Oriole Crystalonics check if LCD module is busy, 15 +5 V Ground Ground is not possible. 16 Gnd. X X To avoid problems, extra

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

Fig. 7: Sample of I2C bus message

signal names used here are the same as used by the LCD module/driver manufacturers. Pin configuration for a typical 16character x 1 line LCD module is shown in Table III. Some LCD modules come with additional one or two pins. These extra pins are used for back-lighting. There is no fixed standard for the additional pins.

Fig.8: Keyboard using three tactile switches

30

ELECTRONICS PROJECTS Vol. 20

Fig. 9: DTMF decoder

delays in software are provided after every write command so that before writing another command/data, LCD module should be ready (not busy). Further, only four data lines (D4-D7) have been used while the other four data lines (D0-D3) are left disconnected. Thus even though we are using an 8-bit microcontroller, the LCD module has been interfaced for 4-bit mode. Again, to save pin count, RS line is shared with SDA (serial data) line for memory (IC3) since at any given moment micro-controller will either interface with the LCD module or the memory, and this does not affect the system operation. Non-volatile memory (Fig. 5): 2wire serial CMOS EEPROM 24C08 is used in this circuit to retain last 99 incoming numbers. Numbers stored remain in memory even after power failure.

Fig. 10: Micro-controller circuit

24C08 is an 8k (1024x8) bits non-volatile memory. 8k bits are internally organised as 1024 x 8 bits or 1k bytes. As each byte can store two digits of a number, a total of 8 bytes are reserved for each number (for maximum of 16-digit length). So while this unit

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

can store 128 16-digit numbers, the software used is configured only for 99 numbers, so that only 2 digits are required on display for call counter. This IC is interfaced with microcontroller using two control lines SCL (serial clock) and SDA (serial data). This 2-wire interface is popularly known as I2C bus interface. Overview of I2C bus : I2C devices stands for inter-integrated circuit. This was designed by Philips but now a number of semiconductor device manufacturers are making compatible I2C bus. This I2C bus is used mainly with single-chip based micro-controller systems that require general-purpose circuits like EEPROM, RAM, real-time clock, LCD controller and audio/video tuning circuits. A key advantage of this is that only two lines can connect multiple devices. All I2C devices have one nibble of built-in address followed by one nibble of H/W address determined by A0 A1 A2 A3 lines. The 24C08 used in this design has a device address of A0 (hex). In circuit with multiple devices, one device (usually the micro-controller) takes the role of master. Another device (only one of the multiple devices at any one time) acts as a slave device. Master device takes control of SCL, i.e. SCL is set low or high under the control of master (usually the micro-controller). Slave device accepts the data from micro-controller (e.g. writing into memory) or sends the data to micro-controller (reading from memory) under the control of master device. Four different conditions exist in I2C bus transfers. These are start, stop, bit transfer (read/write) and acknowledge. All these conditions are explained below with reference to waveforms shown in Figs 6 and 7. 1. Normal data bit write/ read. During transfer of data from master (micro-controller) to slave device (e.g. EEPROM), SDA is set to logic 0 or 1 only when SCL is low. After small delay, SCL is pulsed high to clock in data. During read operation, SDA is an input line and its logic state is clocked in ELECTRONICS PROJECTS Vol. 20

31

Raw DC at 7805 input Regulated DC at 7805 output Voltage O/P of bridge Pin 5/LM393 Pin 6/LM393 Pin 7/LM393

Fig. 13: Software flow-chart of main program

with SCL going high. Master (micro-controller) can then read the level of SDA. 2. Start condition. Start is a special condition where SDA changes its state from high to low when SCL is high. Both SCL and SDA are controlled by master (micro-controller). 3. Stop condition. Stop is also a special condition where SDA goes from low to high when SCL is high. Both SCL and SDA are controlled by master (micro-controller). 4. Acknowledge. After-transmitting eight data bits from micro controller to the device (e.g. EEPROM), direction of SDA line is reversed. One more clock pulse is given by micro-controller. During this period, the slave device sets SDA to low. This indicates the acceptance of data by receiving device (e.g. EEPROM). When data is read from slave

32

ELECTRONICS PROJECTS Vol. 20

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

How to write a byte in EEPROM A sample I2C bus message is shown in Fig. 7 while a typical example of writing into memory (device address A0 hex) location 58 (hex) with data byte 30 (hex) is given below: S10100000A01011000A00 110000AP Where S indicates start, P indicates stop and A indicates acknowledge conditions (as defined in proceding paragraph), while 1 and 0 are data bits.

On-hook 35 to 50 V 1.0 V Above 1.8 V 0V

+12 V (+8 to + 15 V) +5V Off-hook 8 to 10 V 1.0 V Below 0.7 V 5V

Description of the above sequence is as follows: • Action is started with start condition generated by master (micro-controller). • 1010 0000 (A0H) is transmitted as address for EEPROM. • EEPROM responds with acknowledge during next clock pulse. • 0101 1000 (58H) is transmitted as byte address with EEPROM. • Again EEPROM responds with acknowledge during next clock pulse. • Finally, data byte 0011 0000 (30H) is transmitted. • EEPROM acknowledges during next clock pulse. • At the end, master (micro-controller) generates stop condition. Keyboard (Fig. 8): Three keys (tactile switches) are used to view stored numbers and to delete selected numbers. Keyboard is used in a scanning mode. Each data line is set to low level sequentially while keeping other lines at high level. Then level of KBD signal is checked. If it is low, it indicates that key connected to the data line which is low is pressed, else it is not pressed. Due to high speed of micro-controller, all three keys can be checked for their positions quickly. DTMF decoder (Fig. 9): DTMF decoder IC2 MT8870 is AC coupled to telephone lines and keeps on sensing tone frequencies. As soon as a valid DTMF digit is detected, it sets STD signal (pin 15) high and interrupts the micro-controller. DTMF decoder also requires a 3.58MHz crystal. For cost saving, the output of micro-controller oscillator is connected to 8870 oscillator input pin 7 through a capacitor. Micro-controller then reads the digital number on four data lines (D4-D7) by making TOE (output enable pin 10 of IC2) high. Micro-controller (Fig. 10): Microcontroller used is MC68HC705KJ1 from Motorola which features: • 11 I/O pins • 1240 bytes of program memory • 64 bytes of user RAM

PARTS LIST Semiconductors: IC1 - MC68HC705KJ1, microcontroller IC2 - MT8870, DTMF decoder IC3 - 24C08, serial CMOS EEPROM IC4 - LM393, dual comparator IC5 - 7805, voltage regulator D1-D4, D8 - 1N4007, rectifier diode D5-D7 - 1N4148, switching diode D9, D10 - Zener, 8.2 volt Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1-R3, R5-R6 R8, R19 - 10 kilo-ohm R4 - 1 kilo-ohm R7, R13 - 39 kilo-ohm R9 - 470 kilo-ohm R10 - 10 mega-ohm R11 - 300 kilo-ohm R12 - 62 kilo-ohm R14-R17 - 51 kilo-ohm R18 - 100 kilo-ohm Capacitors: C1 C2, C3 C4, C6-C9, C12, C13 C5 C10, C11 Fig. 14: Flow chart of key procedure

Fig. 15: Flow chart of DTMF procedure

• 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 (tactile switches). Two pins are used to interface DTMF decoder (TOE and STD). Two pins are used for LCD controller (E and RS) interfacing. One pin is used for EEPROM clock signal (SCL). The pin required for EEPROM data signal (SDA) is multiplexed with LCD module signal (RS). One pin scans keyboard. One pin scans off-hook/ on-hook status of the hand-set. A complete schematic diagram of the

caller-ID unit is given in Fig. 1. Actual-size, single-sided PCB layout for the circuit in Fig. 1, included keyboard (Fig. 8), is given in Fig. 11. The component layouts for PCB is given in Fig. 11. Software: Software code installed in ROM of the micro-controller for proper operation of the caller-ID unit is intellectual property of the author, and the same can not be published at this stage for commercial/ other reasons. However, software flow chart for the main program and subroutines is shown in Figs 13 and 14 through 16.

Assembly and Testing Assembly of this unit is simple. Mount all parts as per the component/PCB layout. For mounting ICs (except 5-volt regulator) use sockets. No special soldering/assembly precautions are necessary. How-

- 10µF, 35V electrolytic - 33 pF ceramic disc - 0.1µF ceramic disc - 30 pF ceramic disc - 0.01µF ceramic disc

Miscellaneous: XTAL - 3.5795 MHz crystal S1-S3 - Tactile switches (pushto-on) DIS.1 - 16x1 LCD display module - RG11 connectors - Tel. cable with connector - Body with knobs

ever, before mounting the ICs, proceed as follows: 1. Do not connect telephone line. Power on the unit and check: 2. Mount LM393. Connect telephone lines. Check for following: 3. Install micro-controller, LCD module and memory IC. At power on “Have a nice day” message should appear on LCD screen. 4. Install DTMF decoder IC. Keep telephone line connected. Pick up the handset and press any key on your telephone (make sure that telephone is in tone mode) and keep it pressed. Check voltage at STD pin 15 of IC MT8870. It will be logic high as long as telephone key is pressed. The number pressed on telephone instrument will also appear on LCD display. Press more keys and numbers will continue to be displayed one after another. The number dialled will remain there as long as phone is off-hook. Once you replace the handset, the standard message “Have a nice day” will appear ELECTRONICS PROJECTS Vol. 20

33

Fig 16: Flow chart of memory procedure

again. 5. Short pin 7 of comparator LM393 to ground. Press some digits quickly or use redial switch to dial out the last number. This condition simulates the incoming number from telephone exchange. Micro-controller thinks that unit is onhook (as pin 7 is forced to ground) and accepts DTMF tones generated by telephone handset as originating from exchange. After receiving full number it stores it in memory. Repeat this procedure with a few more numbers. All these numbers will be stored in memory as incoming numbers. Remove the short. Unit is now in normal condition. Last number displayed will remain on display till handset is picked and replaced. 6. Press UP or DOWN key on keyboard. The last number received will appear on screen. Press DOWN again and second last number will appear on screen. Press UP or DOWN to scroll through list of 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 received number is displayed. Pressing UP

34

ELECTRONICS PROJECTS Vol. 20

and DOWN key again shows the last number received. 7. To delete any specific number, press UP or DOWN key to view the number to be deleted. Press DEL key when the number is on display. Display will blank out and the number will be erased from memory. Pressing UP /DOWN keys will show previous or next numbers but the deleted number will not be shown. 8. To delete all stored numbers, switch off the unit, press UP and DOWN keys simultaneously. Switch on the unit while keeping both switches pressed. Display will show “Erasing Memory” message for a few seconds and then “Have a nice day” message will be displayed. Now all numbers stored in the memory are erased permanently. Your unit is ready. Celebrate and have fun !

What Next ? Additional functions like storing outgoing calls, missed calls, adding a new call indicator (blinking led), black listing specified calls, date and time recording on all types of callers etc are also feasible. However, that requires more program memory in micro-controller. The present micro-controller version used has only 1240 bytes of program memory and 11 I/O lines. For the above-mentioned upgradations a µ controller with more inbuilt memory and I/O lines has to be used. Tech. Editor’s note: For more details regarding 68HC705KJ1 micro-controller, readers may refer to an article on the subject in Electronics Projects Vol. 18. You may also access relevant technical data books by pointing the browser to http:// sps.motorola.com/csic if you have access to Internet. The instruction set and programming aspects of LCD modules had been dealt in some detail in a construction article on the subject which appeared elsewhere in Electronics Project Vol. 18. However, the interfacing of LCD module

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

was done for 8-bit data. For 4-bit data interfacing, a software flow-chart using the same instruction set is given in Fig. 17 for the benefit of EFY readers/ subscribers. Flow-chart indicates that in ‘function set’ instruction the data length parameter ‘DL’ is first set to (logic 1) for 8-bit data and then changed over to (logic 0) for 4-bit data operation. Only data lines D4 through D7 are used for this initialisation. ❑

Readers Comments: EFY. After publication of the article a number of readers have been approaching the author for more information on KJ1 series microcontrollers from Motorola. Please note that EFY-CD’s issued with Dec ’01, Jan ’02 and Feb ’02 issues contains all necessary documents from author and M/s Motorola. Author had also offered for any further assistance (for product development). Desirous readers may contact the author at his e-mail address ‘[email protected].’ They may also download any required documents, from ‘www.motorola.com’ website. Vinay Chaddha ([email protected]) G Could you let me know how to program the microcontroller? It would be further appreciated if you please suggest me an application for feeding serial data to frequency synthesiser chips, such as MC145156, used in digital radio tuners with LCD frequency readout. Praveen Shanker Hardwar G I request you to clarify my following doubts: 1. In our city neither DTMF mode nor CLIP facility is available. Could the device (ID) work under these conditions? Please give possible modifications so that it can be used. 2. I have a (single) piece of microcontroller IC MC68HC705KJ1, which I have prchased from an electronics outlet. Can I use it in the circuit? Amit Kumar Yadav Faizabad G The Caller-ID project (April ’99) was very interesting. I would like to know the price and availability of the C68HC705KJ1 microcontroller chip used. In place of an EEPROM, is it possible to use an EPROM or other ROM chips that are easily available? Can the circuit be modified so as to work with Intel 8085 microprocessor?

Satyajit Dutta Bhopal G There is an error in displaying incoming caller number. The first digit of STD code is displayed as the last digit of display. For example, if STD code is 0824 and phone number is 483521, the same is displayed as 8244835210. How can I solve this problem? Satish A. Mangalore G The circuit works perfectly when pin 7 of the comparator is grounded. But when it comes to the real caller-ID signal, only the number of the first calling party is displayed, which doesn’t get stored in the memory. The MCU is not reset, so it prevents further numbers from being displayed. These problems are not seen when pin 7 is shorted to ground. Please suggest the solution. Deepa Mohan Through 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 from Motorola or through its authorised distributors. However, as you have also experienced that they usually do not provide support to hobbyists, you can read and learn about KJ1 from data books available from the Website of Motorola so you can design digital radio. In case you face any problem, please feel free to ask for any help. In response to the letter from Amit Kumar Yadav I would like to say following: 1. Caller ID unit will work only if your exchange has this facility and they have allowed this facility on your line. 2. The single piece of microcrontroller that you have procured through some electronics shop must be a blank piece. It cannot be used in the Caller-ID circuit. It is not 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 would like to say: The cost of a blank microcontroller is Rs 100 in the local market. Programmed microcontrollers are available through Kits‘n’Spares (EFY’s associate). It is not possible to use EPROM or ROM in place of EEPROM, as the use of the EEPROM is to store incoming telephone numbers in memory and retain them in the absence of power. Also, the user should be able to delete the numbers as and when required. EPROM or ROMs do not offer the facility of writing and erasing with 5V. As far as the use of 8085 is concerned, it is possible. However, it will require a minimum of four ICs to replace a single 16-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 or old design. In reply to Mr Satish’s letter, I would like to say: Please note that MTNL or DoT exchanges send STD code of calling party without zero prefix, i.e. Delhi code is sent as 11 and not as 011. Also, at the end, a zero is added to mark the end of caller-ID information. This is the reason for the anamoly. The microcontroller or hardware has no problem or defect. In reply to Mr Deepa Mohan’s letter, I would like to say: When the phone handset is picked up, pin 7 of the comparator should go high. When the phone handset is put down on the cradle, pin 7 of the comparator should go low. If these equirements are not met, there is some problem with the circuit. G

ELECTRONICS PROJECTS Vol. 20

35

MAINS FREQUENCY MONITOR S. ARVIND

M

ains frequency meters are used on control panels of almost all electrical equipment and thus these are used in the industry in large numbers. The circuit presented here converts the mains AC voltage to square

wave pulses, which are then routed to a phase-locked loop (PLL). The PLL multiplies the incoming mains frequency by a factor of 100 and the resulting frequency is displayed in a counter with a resolution of 0.01 Hz.

Description

Fig. 1: Power supply and clipper circuit

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

36

ELECTRONICS PROJECTS Vol. 20

The circuit is divided into three sections: 1. Power supply and clipping circuit (Fig. 1). 2. PLL, counter and display (Fig. 2). 3. Control circuit to generate timing pulses for counting the output from VCO (Fig. 3). The mains stepped-

down sine wave pules are first filtered and then clipped using 5.1-volt zener diode D3. These clipped pulses are directly fed to the input of CMOS phase-locked loop CD4046 (IC1). IC 74LS390 (IC2), which is a dual decimal counter; it divides the voltage-controlled oscillator (VCO) output frequency by a factor of 100. This divided frequency and the input mains frequency are constantly tracked and kept in lock by the PLL. Thus the frequency output of the VCO is actually the mains frequency multiplied by 100. This frequency will be centred around 5 kHz (based on mains nominal frequency of 50 Hz). The output from VCO is fed to a 4-digit decade counter cum display driver IC 74C926 (IC3). CD4060 (IC4) is a binary counter/ divider/oscillator IC which uses a 32.768

PARTS LIST Semiconductors: IC1 - CD4046 CMOS phaselocked loop IC2 - 74LS390 dual decade counter IC3 - 74C926 four-digit decade counter/display driver IC4 - CD4060 14-stage counter/ divider and oscillator IC5 - CD4017 decade counter IC6 - 74LS221 dual, one-shot, monostable flip-flop IC7 - 7805 regulator, 5-volt D1, D2 - 1N4007 rectifier diode D3 - 5.1-volt zener T1-T4 - AC187 npn transistor

Fig. 3: Control circuit

KHz crystal. This gives a final output of 2 Hz at pin 3. This is again divided by 2 using CD4017 (IC5) to obtain 1Hz symmetrical output. This 1Hz output is fed to one of the inputs of 74LS221 (IC6), which is a dual, one-shot, monostable flip-flop. This IC outputs a very-short-duration pulse which acts as the latch pulse for the decade counter IC3 and thus it latches the output of the quad counters connected to 7-segment displays. This latch pulse triggers the second monostable flip-flop inside IC6. This second monoshot also generates a very-short-duration pulse which resets the quad counters and prepares them for another counting cycle. This cycle keeps on repeating.

The main advantage of this circuit is that it gives a resolution of 0.01 Hz. Apart from that, it also has an inherent noiserejection capability, and is quite stable and accurate. The circuit can be wired on a general-purpose PCB. However, a proper actual-size, single-sided PCB layout for the complete circuit shown in Figs 1 through 3 is given in Fig. 4. The component layout for the PCB is given in Fig. 5. No special precautions are required to be followed during construction. But due care must be taken to handle the CMOS devices. Use of IC bases is recom-ended. This circuit can be easily fabricated us❑ ing readily-available components.

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

Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 220-kilo-ohm R2-R5, R9 - 2.2-kilo-ohm R6 - 1-kilo-ohm R7 - 100-ohm R8, R11 - 10-kilo-ohm R10 - 150-kilo-ohm R12, R13 - 47-ohm Capacitors: C1, C2 C3 C4, C7, C8 C5 C6

-

1nF ceramic disc 1000µF, 25V electrolytic 0.1µF ceramic disc 1µF paper 0.01µF ceramic disc

Miscellaneous: Xtal - 32.768 KHz crystal X1 - 230V AC primary to 12V-0 12V, 150mA sec. transformer DIS1-DIS4 - LT543 common-cathode display

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

ELECTRONICS PROJECTS Vol. 20

37

PARTY GAME HOW OLD ARE YOU? VASUDEVA BHATTA K.

T

his is an interesting circuit which displays a person’s age on the basis of clues provided by the person. This could be an amusing party game which could also be used to guess a number.

Description At the heart of the circuit is an EPROM. The clues provided by an individual are converted into a binary address for the EPROM. In each of the memory locations, a two-digit decimal number is stored in its binary-coded decimal (BCD) format,

Fig. 1: Circuit diagram

38

ELECTRONICS PROJECTS Vol. 20

which is, in fact, the decimal equivalent of the binary address. The two decimal numbers after decoding by BCD to 7-segment decoders/drivers are displayed as two LSB digits on common-anode displays DIS1 and DIS2. Since the circuit is restricted to show the age up to 150 years, the third decimal display is configured to show either ‘1’ or to remain blank. In case the display has to show decimal number equal to or greater than 100, the ‘b’ and ‘c’ segments of the third display digit are activated, making use of logic circuit and an LED driver

transistor, as explained later in the next. The EPROM is kept always in ‘read’ mode and the answer switch S10 (push-to-off) is connected to the ‘display blank’ mode of both the 74LS47 ICs, so that the display remains blank when the answer button is not pressed. There are eight push-to-on switches, S1 to S8, which are connected to eight separate latches realised from sixteen 2input NAND gates (N1 to N16) from IC1 through IC4 (74LS00). One LED is connected to each of the latched outputs. The LEDs remain glowing when the corre-

Table I: Hex dump of EPROM Sl. No.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

Address (Hex)

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A

Data (Hex)

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

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

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151

4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

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

1 21 41 61 81 101 121 141

3 23 43 63 83 103 123 143

5 25 45 65 85 105 125 145

7 27 47 67 87 107 127 147

9 29 49 69 89 109 129 149

2 22 42 62 82 102 122 142

3 23 43 63 83 103 123 143

6 26 46 66 86 106 126 146

7 27 47 67 87 107 127 147

10 30 50 70 90 110 130 150

4 22 44 62 84 102 124 142

5 23 45 63 85 103 125 143

6 28 46 68 86 108 126 148

7 29 47 69 87 109 127 149

12 30 52 70 92 110 132 150

8 26 44 62 88 124 142

9 27 45 63 89 125 143

10 28 46 72 90 126

11 29 47 73 91 127

12 30 56 74 92 136

16 26 52 62 88 114 125

17 27 53 63 89 115 126

18 28 54 80 90 116 127

19 29 55 81 91 117 144

20 30 56 82 92 118 145

32 42 52 62 104 114 124

33 43 53 63 105 115 125

34 44 54 96 106 116 126

35 45 55 97 107 117 127

36 46 56 98 108 118

64 74 84 94 104 114 124

65 75 85 95 105 115 125

66 76 86 96 106 116 126

67 77 87 97 107 117 127

68 78 88 98 108 118

11 31 51 71 91 111 131

13 33 53 73 93 113 133

15 35 55 75 95 115 135

17 37 57 77 97 117 137

19 39 59 79 99 119 139

14 34 54 74 94 114 134

15 35 55 75 95 115 135

18 38 58 78 98 118 138

19 39 59 79 99 119 139

14 36 54 76 94 116 134

15 37 55 77 95 117 135

20 38 60 78 100 118 140

21 39 61 79 101 119 141

14 40 58 76 94 138

15 41 59 77 95 139

24 42 60 78 104 140

25 43 61 79 105 141

22 48 58 84 94 120 147

23 49 59 85 95 121 148

24 50 60 86 112 123 149

25 51 61 87 113 124 150

38 48 58 100 110 120

39 49 59 101 111 121

40 50 60 102 112 122

41 51 61 103 113 123

70 80 90 100 110 120

71 81 91 101 111 121

72 82 92 102 112 122

73 83 93 103 113 123

S1/D1 11 31 51 71 91 111 131

S2/D2 13 31 53 71 93 111 133

S3/D3 13 31 57 75 93 137

S4/D4 21 31 57 83 93 119 146

S5/D5 37 47 57 99 109 119

S6/D6 69 79 89 99 109 119

S7/D7 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150

S8/D8

quired logic 1 at the output of gate N25 to operate ‘b’ and ‘c’ segments of the third display digit. Remaining logic is designed to give ‘high’ output at gate N25 only when the 4-bit BCD data stored in EPROM for driving the second decimal digit is other than 1001 (i.e. decimal 9) and second nibble (4-bit MSB part) of the 8-bit hexadecimal address is 0110 or above. In other words, logic output of gate N25 will be logic 1 only when the age of a person to be ELECTRONICS PROJECTS Vol. 20

39

ward biasing of transistor T7 to light up LEDs 9 and 10 to form 1 in the 100th digit. Alternatively, one can discard the LEDs and use the same transistor to energise segments ‘b’ and ‘c’ of 7-segment display DIS3. Two 7447 ICs drive the first two displays (DIS1 and DIS2) using 8-bit BCD data stored in EPROM, as mentioned earlier.

Operation

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

Before starting the game, one must press ‘reset’ switch S9 to ensure that all the LEDs are in off state initially. There are eight blocks of numbers displayed on the front display panel and each block is associated with a switch and an LED indicator. First, the person whose age has to be guessed has to thoroughly search for his/her age (in full years) in each of the eight blocks. Then the switches (S1 through S8) corresponding to those blocks in which his/her age figures, should be pressed (indicated by lighting of the corresponding LEDs mounted next to each of the eight switches) one after the other. Once all the corresponding switches have been pressed, you may press the answer pushbutton (S10) to get the age displayed on the board.

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

PARTS LIST Semiconductors: IC1-IC4 - 74LS00 quad 2-input NAND gate IC5 - 2732 EPROM (4096x8) bit IC6-IC8 - 74LS20 dual 4-input NAND gate IC9 - 74LS21 dual 4-input AND gate IC10 - 74LS32 quad input OR gate IC11 - 74LS08 quad 2-input AND gate IC12, IC13 - 74LS47 BCD to 7-segment decoder/driver IC14 - 74LS04 hex inverter T1-T6 - BC547 npn transistor

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

40

ELECTRONICS PROJECTS Vol. 20

Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1-R12 - 2.2-kilo-ohm R13-R20 - 390-ohm R21 - 100-ohm R22-R27 - 1.5-kilo-ohm R28-R32 - 1-kilo-ohm Capacitors: C1, C2

- 0.1µF ceramic disc

Miscellaneous: DIS1-DIS3 - LT542 common-anode display S1-S9 - Tactile microswitch (N/O) S10 - Tactile microswitch (N/C) LED1-LED10 - Red LEDs

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

In fact, the numbers in each block are so arranged that by pressing the corresponding switches, you are generating a binary number which is equivalent to the age (in decimal number). This binary number acts as address for EPROM, and the BCD data at that location, when converted to decimal, is equivalent to the hex address itself. Single-sided PCB for the circuit shown in Fig. 1 is given in Fig. 2 while its component layout is given in Fig. 3. Please note that outputs from IC5 (pins 14, 15, 16 and 17) have been brought to pins 1-4 of SIP ‘A’ connector those from transistors (collectors) T4-T1 have been brought to SIP ‘B’. These are to be extended to I/Ps of gates N18-N32 (except N26) using jumper wires. Correct programming of the EPROM is the key to the successful operation of the circuit. Hence the program❑ ming should be done carefully.

CHIP-CARD READER– PROGRAMMER USING IBM PC H.K. BHARUCHA & A.A. RANA

O

ver two billion chip-cards are expected to be in circulation worldwide by the year 2000. Chip-cards are the future of money and business. They represent an untapped source of opportunities for various businesses—ATM/ electronic cash, credit card payments, medical/employee information management, security/loyalty checking, etc. Recognising this, the banks, card companies, telecom operators, transit authorities and even government bodies are already developing chip-card projects. A chip-card stores and processes information on a chip (i.e. an integrated circuit) embedded in the card. A minimum amount of hardware is needed to build a chip-card as shown in the block diagram of Fig. 1. The use of a PC is not inevitable; instead of PC, a standalone microprocessor system capable of input/ output (I/O) operations and some memory can be used. But PC offers user-friendly interface as well as opens doors to many new applications. Other chip-card applications include its use as a credit card, a telephone card, an attendance card for factory employees and an electronic doorlock system. PARTS LIST Semiconductors: IC1 - NM93C46 1024-bit serial E2PROM D1 - 1N4148 switching diode LED1 - Red LED Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 220-ohm Miscellaneous: - 5-pin SIP connector - 25-pin male/female D connectors with ribbon cable - 4.5V DC power supply source

connector of the parallel port. There is no limit to the extent to External power supply can be derived which the parallel port of the PC can be from a 4.5V battery as the system conused as it provides ample number of TTL sumes a very small amount of power becompatible input and output lines. The cause the contacts are made only during present project uses parallel port (LPT1) the transactions and that too for a few secfor conveying data to and from the chipcard in a serial fashion. Lines from two ports of LPT1—port A with address 378H and port B with address 379H—are used for this purpose. The use of serial mode of data transfer is not surprising because a chip-card Fig. 1: Block diagram of chip-chip reader-programmer should have as few electrical contacts as possible for its reliable operation. This leads to the use of serial E2PROM as the data storage IC of the chip-card. The contacts of chipcard include the power connections (Vcc and Gnd), data lines (one each for input and output) and two control input lines (chipselect and clock)—all operating at TTL levels. Fig. 2 shows the schematic diagram of the chip-card reader including its connection to the 25-pin D Fig.2: Schematic circuit diagram of chip-card reader-programmer TABLE I Instruction set for NM93C46 Start Bit 1 1 1 1 1 1 1

Operation Code 10 01 11 00 00 00 00

Address

Data

Mode

A5, A4, A3, A2, A1, A0 A5, A4, A3, A2, A1, A0 A5, A4, A3, A2, A1, A0 11XXXX 00XXXX 10XXXX 01XXXX

— D15..D0 — — — — D15..D0

Read register at address A5-A0 Write register at address A5-A0 Erase register at address A5-A0 Erase/write enable Erase/write disable Erase all registers Write all registers

ELECTRONICS PROJECTS Vol. 20

41

Fig. 3: Actual-size PCB (with contact plates on top side) which is connected to PC and external power supply

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

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

Fig. 7: Flow chart for the main program Fig. 6: Component layout for PCB of Fig. 5

onds only. This will be clear from the fact that the circuit is assembled in two parts on two different PCBs. One of the PCBs has contact plates (on the top side, i.e. component side) which are connected to the 25pin parallel port of PC using five leads and the external supply (4.5V) using two leads. The actual-size PCB and the silk

42

ELECTRONICS PROJECTS Vol. 20

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

board. This second PCB (the actual chipcard) and its component layout are shown in Figs 5 and 6 respectively. The components on chip-card comprise only one chip (NM93C46—a 1024bit serial E2PROM) and a few passive components per card to store the data. This results in a very compact sized chip-card. If further reduction is needed, as in the case of a mobile telephone handset, an

1. 2V to 5.5V opin the previous step. eration in read mode • The chip-select line is inactivated. and 2.5 to 5.5 V in all A sample application of the chip-card other modes. as a credit card is presented here. The PC 2. Typical active emulates the chip-card reader/programcurrent of 400 µA and mer machine. The software for data transstandby current of 25 fer and user interface is written in ‘C’. µA. The user interface portion is divided into 3. Self-timed prothree parts. gramming cycle. These are ‘De4. 40 years data reposit’, ‘Withtention. drawal’ and Table I describes ‘Verify’ modules the commands acrespectively. cepted by 9346. When the card Timing diagrams user deposits comprising synchromoney, he/she is nous data timing, presented with read, write, write ene-cash in the able and write disable Fig. 11: Flow-chart for form of a chipread_bit function are shown in Fig. 12. card with The sequence for communication of programmer (PC is used as Fig. 8: Flow chart for write-9346 Fig. 10: Flow chart for read-9346 function function programmer SMD version of here) with the chip-card containthe chip can be ing NM93C46-E2PROM is as follows: used to achieve • The chip is selected by the reduction in making the chip select line high. size. • A start bit ‘1’ (as MSB of The chipany instruction) is sent on data card connector input line which indicates to the layout used in chip the beginning of memory acthis project is cess. A bit can be sent by placthe same as that ing data on data i/p (Din) line of SIM card Fig. 9: Flow chart for and activating the clock line. A (subscriber idenwrite_bit function bit can be read by activating tification modclock line and then sampling ule) for mobile phones. The signals outdata placed by the chip on data put from the PC (chip-card reader-prooutput (Dout) line. grammer) are CS (chip select), CLK • Two operation code bits are (clock) and Din (data input to chip). These set on Din line to indicate the are supplied from LPT1 port A, pins PA0, mode (e.g. read, write, erase etc.) PA2 and PA1 respectively. The signal in• Six bits are sent on Din put to the PC and output from chip-card line to chip, specifying the adis Dout (data output from chip), which is dress of the location which is to read through LPT1 port B pin PB4. R1 is be accessed. the current limiting resistor and D2 is an • If a write operation is deLED which indicates whether the chipsired, sixteen bits are sent on Din card and the connector have perfect conline to the chip specifying the tacts or not. D1 protects the chip-card data to be written at the locafrom power supply reversal in case of an tion specified in the previous operational mistake. step. The National Semiconductor’s • If a read operation is NM93C46 device contains 1024 bits of desired, sixteen bits are read non-volatile, electrically erasable memory from Dout line, which are the divided into 64x16-bit registers. It feacontents of the location specified Fig. 12: Timing charts for various operations tures: ELECTRONICS PROJECTS Vol. 20

43

certain specific balance amount. For paying the bills, the user now has to simply press the card (PCB, Fig. 5) against the card connector (PCB, Fig. 3) of card reader machine and the amount is deducted from the balance. Of course, in all the transactions, security is incorporated in the form of a password and identification number checking modules. The chip-card transaction is achieved

by simply pressing the card against the card connector and executing an appropriate menu item of the program. The bit-wise operations in ‘C’ and its capability to control hardware ports directly is used to full advantage in this application. A stream of 25 bits comprising one start-bit, 2-bit op-code, 6-bit address and 16-bit data are sent in serial fashion. The basic building blocks are the ‘write_bit’

and ‘read_bit’ functions. These in turn are used for larger blocks viz. ‘Write_9346’ and ‘Read_9346’ functions to write and read a 16-bit data word respectively to/ from the specified chip-card address. Rest of the work is as simple as playing a game of blocks! The flowcharts for the program are shown in Figs 7 through 11. ❑

Software Program /* Chipcard Reader Programmer System by H.K.BHARUCHA & A.A.RANA */ #include #include #include #include #include #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 on different 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()) {

44

ELECTRONICS PROJECTS Vol. 20

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); }

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); }

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; }

/* 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 write disable 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 */ }

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

/* 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. “);

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; }

ELECTRONICS PROJECTS Vol. 20

45

MORSE ENCODER JUNOMON ABRAHAM

A

lthough better modes of communication such as voice communication are available, Morse code is still being used universally for land and off-shore wireless communications by professionals and amateurs alike. Its main advantages are: 1. The ability to use higher-power transmitters for long-range communication as the modulation percentage can go up to 100 per cent. 2. The regional accent and pronunciation does not affect the faithful transmission of a message using Morse code. All defence forces, police, railways and telecom organisations use Morse code for communication on a regular basis. Thus, the learning of Morse code forms an integral part of the wireless communication system.

Description The circuit presented here is used for learning and practising the reception of Morse code. It converts each character into dots (pronounced as ‘di’ or ‘dit’) and dashes (pronounced as ‘dah’) corresponding to Morse code. This circuit can be divided into two sections, viz, the keyboard and coder sections. TABLE I Morse Code Letters A.– B–... C–.–. D–.. E. F..–. G––. H.... I.. J.–––

K–.– L.–.. M–– N–. O––– P.––. Q––.– R.–. S... T–

U..– V...– W.–– X–..– Y–.–– Z––..

Some punctuation signs Full stop . – . – . – Coma – – . . – – Colon – – – . . . Interrogation mark . . – – . .

46

ELECTRONICS PROJECTS Vol. 20

Numbers 1.–––– 2..––– 3...–– 4....– 5..... 6–.... 7––... 8–––.. 9––––. 0–––––

Keyboard section: Here + matrix keyboard is used in scanning mode. The scanning is done using a 3-line to 8-line decoder 74 LS138 (IC3) and a dual 4-bit multiplexer CD 4052 (IC4). The binary number required for scanning is provided by a 12-bit binary counter CD 4040 (IC2) and the clock pulses for the same are obtained from timer 555 (IC1), which is used as an astable multi vibrator. With the timing components employed as shown in Fig.1, the frequency of scanning is around 2 kHz. When a switch is closed at a particular binary number output from IC2, output pin 13 of multiplexer IC4 Fig. 1: Schematic circuit diagram of morse encoder

PARTS LIST Semiconductors: IC1 - NE555 timer IC2 - CD4040, 12-bit binary counter IC3 - 74LS138, 3-line to 8-line decoder IC4 - CD4052, dual 4-bit multiplexer IC5 - CD4060, 14-stage binary counter and oscillator IC6 - 27C32, 4096x8 bit EPROM IC7 - 7805, 5-volt regulator T1 - BC547, npn transistor Resistors (all ¼-watt, ± 5% carbon, unless stated otherwise): R1 - 6.8-kilo-ohm R2 - 15-kilo-ohm R3-R6 - 2.2-kilo-ohm R7, R10 - 4.7 kilo-ohm R8 - 1-mega-ohm R9, R11 - 10-kilo-ohm VR1 - 100-kilo-ohm variable (linear) VR2 - 47-kilo-ohm variable (log) Capacitors: C1 - 0.02µF ceramic disc C2, C3 - 0.01µF ceramic disc C4 - 0.1µF ceramic disc

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

Miscellaneous: S1-S20 - SPST push-to-on keyboard/ tactile switch S21 - DPDT switch - Piezo buzzer

Fig. 3: Component layout for the PCB

goes low and this resets the 555 timer. Thus, no further clock is supplied by IC1, and therefore IC2 CD4040 remains latched in its existing state till the pressed key-switch is released. A unique binary number is associated with this key (switch) such that it activates a specific column and row when this switch is closed. Similarly, with each keyboard switch, a different unique binary number or row and column combination is associated. The same binary number is made available to the coding section. Coding section: The heart of the coding section is EPROM 27C32 (IC6). It contains coded form of each character. The memory locations (addresses) and the data stored against each address are given in Table II. Please note that an ‘X’, in the table means ‘do not care,’ i.e. the contents could be any hex digit. The addressing of this EPROM is done by two ICs, one of which is 14-stage binary counter and oscillator CD4060 (IC5). It

provides five lower address bits while the next five address bits are provided by CD4040 (IC2); the latter part of address is considered the page address. The remaining address bits are grounded. The data are stored page-wise in the EPROM, with each page consisting of 32 bytes. Thus, while the pages are addressed by IC2, each of the 32 bytes of every page is addressed by IC5 in a cyclic fashion as the oscillator forming integral part of this IC functions as a free-running oscillator. When a keyboard switch is closed, the output of IC2 is stable at a particular binary value and CE pin 18 of EPROM, connected to output pin 13 of IC4, goes low. This binary number is the address of the page where the Morse code data for the particular character is stored. Only two data bits of the memory are used for each character. With function switch S21 in position 1, only bits D0 and D1 are accessed while in position 2 of switch S21,

data bits D2 and D3 only are accessed. Only data bits D0 and D2 are used for producing audible note whereas bits D1 and D3 are used for resetting the byte counter IC5 in positions 1 and 2 respectively of the function switch S21. Position 1 of the function switch selects the first character as annotated at each of the keyboard switch while position 2 selects the second series of characters as shown after the oblique line at each switch. Thus, operation of the function switch is equivalent to shift-key operation in a typewriter or computer key-board. A dot is represented by a single ‘high’ (logic 1) bit and dash is represented by high bit in three sequential address locations (in same data-bit position), while a space between two elements is equal to a single low (logic 0) bit. These bits are stored in adjacent memory locations in a specified order. When byte address is increased, each data is output one by one. A high bit in D0/D2 position produces sound and thus converts a character into audible Morse code. After the last data, a reset bit is inserted at D1/D3 positions. When this memory location is accessed, the counter automatically resets and repeats the character ELECTRONICS PROJECTS Vol. 20

47

TABLE II: Hex Contents of EPROM 27C32 Address A/U 000 001 002 003 004 005 006 007 008 009 00A B/V 020 021 022 023 024 025 026 027 028 029 02A 02B 02C C/W 040 041 042 043 044 045 046 047 048 049 04A 04B 04C 04D 04E D/X 060 061 062 063 064 065 066 067 068 069 06A

Data

Address

Data

Address

Data

Address DataAddress Data

X5 X0 X5 X1 X5 X4 X4 X0 X2 X0 X8

06B 06C 06D 06E

X0 X0 X0 X8

OCE 0CF 0D0 0D1 0D2 0D3 0D4

X4 X4 X4 X0 X0 X0 X8

127 128 129 12A 12B 12C 12D 12E 12F 130

X5 X1 X5 X0 X5 X0 X5 X4 X5 X0 X0 X0 XA X5 X1 X5 X4 X5 X0 X5 X5 X5 X0 X1 X0 X8 X0 X2 X5 X5 X5 X0 X5 X0 X5 X0 X4 X4 X6

E/Y 080 081 082 083 084 085 086 087 088 089 08A 08B 08C 08D 08E 08F 090

X5 X4 X4 X0 X6 X0 X4 X4 X4 X0 X4 X4 X4 X0 X0 X0 X8 F/Z

0A0 0A1 0A2 0A3 0A4 0A5 0A6 0A7 0A8 0A9 0AA 0AB 0AC 0AD 0AE

X5 X4 X5 X0 X5 X5 X5 X0 X5 X0 X4 X0 X2 X0 X8 G/1

0C0 0C1 0C2 0C3 0C4 0C5 0C6 0C7 0C8 0C9 0CA 0CB 0CC 0CD

X5 X1 X5 X4 X5 X1 X5 X4 X5 X0 X4 X4 X6 X0

H/2 0E0 0E1 0E2 0E3 0E4 0E5 0E6 0E7 0E8 0E9 0EA 0EB 0EC 0ED 0EE 0EF 0F0 0F1 0F2 I/3 100 101 102 103 104 105 106 107 108 109 10A 10B 10C 10D 10E 10F 110

ELECTRONICS PROJECTS Vol. 20

X5 X0 X5 X0 X4 X0 X6 X4 X4 X0 X4 X4 X4 X0 X0 X0 X8 J/4

120 121 122 123 124 125 126

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

48

X5 X0 X5 X0 X5 X4 X5 X0 X4 X4 X6 X0 X4 X4 X4 X0 X0 X0 X8

X5 X0 X5 X1 X5 X0 X5

X1 X5 X4 X5 X1 X1 X0 X8 X0 X2 K/5

140 141 142 143 144 145 146 147 148 149 14A 14B 14C

X5 X1 X5 X0 X5 X0 X5 X1 X5 X0 X0 X0 XA L/6

160 161 162 163 164 165 166 167 168 169 16A 16B 16C 16D 16E

X5 X4 X5 X1 X5 X0 X5 X0 X5 X0 X4 X0 X2 X0 X8 M/7

180 181 182 183 184 185 186 187 188 189 18A 18B

X5 X5 X5 X0 X5 X5 X5 X0 X4 X0 X6 X0

Address

18C 18D 18E 18F 190

X4 X0 X0 X0 X8 N/8

1A0 1A1 1A2 1A3 1A4 1A5 1A6 1A7 1A8 1A9 1AA 1AB 1AC 1AD 1AE 1AF 1B0 1B1 1B2

X5 X5 X5 X0 X5 X4 X4 X0 X6 X4 X4 X0 X4 X0 X4 X0 X0 X0 X8 O/9

1C0 1C1 1C2 1C3 1C4 1C5 1C6 1C7 1C8 1C9 1CA 1CB 1CC 1CD 1CE 1CF 1D0 1D1 1D2 1D3 1D4

X5 X5 X5 X0 X5 X5 X5 X0 X5 X5 X5 X0 X4 X4 X6 X0 X4 X0 X0 X0 X8 P/0

1E0 1E1 1E2 1E3 1E4

responding to various letters of the English alphabets, numerals and some punctuation marks used in this project (keyboard) is given in Table I.

X5 X4 X5 X1 X5

Data Address

Data

1E5 1E6 1E7 1E8 1E9 1EA 1EB 1EC 1ED 1EE 1EF 1F0 1F1 1F2 1F3 1F4 1F5 1F6

22C 22D 22E 22F 230 231 232 233 234 235 236

X4 X5 X1 X5 X4 X5 X0 X4 X4 X6 X0 X4 X4 X4 X0 X0 X0 X8 Q/.

200 201 202 203 204 205 206 207 208 209 20A 20B 20C 20D 20E 20F 210 211 212 213 214

X5 X1 X5 X4 X5 X1 X5 X0 X5 X4 X5 X1 X5 X0 X4 X4 X6 X0 X0 X0 X8 R/,

220 221 222 223 224 225 226 227 228 229 22A 22B

X5 X4 X5 X1 X5 X4 X5 X0 X4 X0 X6 X0

X4 X4 X4 X0 X4 X4 X4 X0 X0 X0 X8 S/:

240 241 242 243 244 245 246 247 248 249 24A 24B 24C 24D 24E 24F 250 251 252 253 254

X5 X4 X5 X0 X5 X4 X4 X0 X6 X4 X4 X0 X4 X0 X4 X0 X4 X0 X0 X0 X8 T/*

260 261 262 263 264 265 266 267 268 269 26A 26B 26C 26D 26E 26F 270 271 272

X5 X1 X5 X0 X4 X4 X6 X0 X4 X4 X4 X0 X4 X0 X4 X0 X0 X0 X8

The actual-size, single-sided PCB for the circuit is given in Fig. 2 and its component layout is shown in Fig. 3. ❑

LONG-RANGE REMOTE CONTROL BHASKAR BANERJEE

T

he circuit presented here can be used to remotely control a number of electrical or electronic gadgets connected to it. Unlike IR remote control, this circuit employs FM transmission and reception, and hence it can be used for comparatively longer range. Any gadget can be switched on/off by keying the number allocated to it. The keyboard used with the transmitter is similar to those used in basic version of DTMF telephones. The system is thus composed of two subsystems which are described below.

Description Code generator and transmitter. The code generator part is shown in Fig. 1. It is a standard DTMF generator built around IC1, UM91215B. IC1 generates the DTMF signal corresponding to the number entered from the keyboard. The signal thus generated is fed to an FM transmitter. As a number of FM transmitter circuits (for example, Quality FM Transmitter by Pradeep G. published in April ’98 (reproduced in Electronics Project Vol. 19) have been published in EFY earlier, which can be suitably adopted. The circuit of the transmitter is therefore not included here. The operating range of the present system would, however, depend on the range of the transmitter. Receiver and decoder. The circuit diagram of receiver and decoder is shown in Fig. 3. The receiver being a common FM receiver kit readily available in the market, no circuit is given for it either. The output of the FM receiver, which is a replica of the DTMF signal keyed in at the remote transmitter end, is fed to DTMF decoder IC 8870P (IC2) which gives the binary output corresponding to the signal received from the transmitter.

Fig. 1: Schematic diagram of DTMF coder-transmitter

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

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

outputs of IC3 will go high. A predetermined sequential output from IC3 activates IC4 via two flip-flops IC5(a) and ELECTRONICS PROJECTS Vol. 20

49

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

Fig. 4: Component layout for the PCB

IC5(b) connected to its outputs. Two extra outputs of IC3 are used for activating/deactivating IC4. The outputs from IC4 are used to changeover the state of toggle flip-flops, which in turn control the devices using suitable interface (relay driver/optocoupler etc) circuits. Only two toggle flip-flops wiring using IC6 (CD4013) is shown here in Fig. 3. IC6 circuit should be repeated for other pairs of Q outputs of IC4. The present circuit can control up to 10 devices using outputs of IC4.

50

ELECTRONICS PROJECTS Vol. 20

Operation With the present circuit up to 100 different gadgets can be controlled (switched on and switched off). All the 100 channels are grouped in 10x10 matrix format. That is, there are 10 locations, with each location having 10 outputs to control up to 10 gadgets connected to it. To understand the operation, assume that we want to switch on gadget numbered 5 at location 3. For this operation the particular numbers to be entered in

the sequence are; 3 # 5 *, in that order. The buttons marked # and *, generally available on all the keyboards, are used to activate and then deactivate a particular location. On receiving the binary code for decimal number 3, pin 6 (Q3) of IC3 of decoder circuit will go high, making the set input (pin 8) of IC5(a) high. This forces pin 13 (Q output) of this flipflop to go high, thereby making pin 5 (data input) of IC 5 (b) also high. Then on receiving the next digit # (corresponding to decimal digit 12), the D flipflop configured around IC5(b) is clocked with the help of Q12 output (at pin 19) of IC3 and in turn IC5(b) is activated and its Q output at pin 2 enables IC4 by taking its pin 15 active low. The next keyed in digit 5 will make the corresponding output (Q5) of IC4 (pin 4) to go high. This positive going pulse can then be used to trigger a CD4013 IC configured as toggle flip-flop (IC6). The gadget to be controlled is connected to the flip-flop via relay driver, optocoupler etc, as required. Receipt of the next input * (corresponding to decimal digit 11) will then make Q11 output (pin 20) of IC3 high to reset IC4 and thereby disable IC4. This will not, however, change the state of the gadget under control. Thus whenever * button on the keypad is pressed (transmitted), all the locations get reset/ deactivated but the existing latched state of the devices (‘on’ or ‘off’) at all the locations remains unaffected. To switch on gadgets at other locations the numbers on the keypad should be pressed (transmitted) as per the sequence mentioned earlier. Now to switch off the gadget, repeat the above switching process, i.e. transmit 3 # 5 * for switching off (in fact, toggling the existing state) device/gadget 5 at location 3. The sequence should be strictly followed, otherwise false switching may occur. The schematic diagram in Fig. 3 shows

The circuit can be built on a veroboard. However, an actual-size, single-sided PCB comprising circuits in Figs 1 and 3, ex-

cept the FM transmitter and receiver modules, is shown in Fig. 2. The component layout is shown in Fig. 4. Circuit of IC6 has been repeated on the PCB to enable control of up to 4 devices. The DTMF generator and FM transmitter should be housed in metal box with the keyboard suitably placed. Be careful to watch the supply voltage of FM receiver module if it shares a common supply with the system. After finishing the construction, switch on the transmitter and connect a small speaker or amplifier to the output of FM receiver. Then press any key on the keyboard and at the same time tune the FM receiver until a clear tone is heard and the ‘signal received’ LED starts glowing. Always tune the FM receiver where there is no signal from any radio centre. If the output of the FM receiver is too low, a lowpower, compact amplifier may have to be used between receiver and decoder. The system is now ready for use. ❑

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

Dilip Paralkar [email protected] The author, Bhaskar Banerjee, replies: IR transmitter and receiver may be used in place of FM. For this, please refer

the wiring for location 3. The circuit in Fig. 3 needs be repeated for each location with only a slight change pertaining to the output pin of IC3, which is to be connected to ‘set’ pin 8 of IC5(a). For locations 1 through 10, IC3 pins 8, 7, 6, 5, 4, 3, 23, 22 and 21 respectively should be connected to pin 8 of IC5(a). If two units are located in close proximity to each other, then a common FM receiver may be used. Please remember that the binary equivalent code for ‘0’ in the keypad equals decimal 10 and as such ‘0’ on the keypad may be marked as ‘10’. For the same reason, Q0 (pin 9) output of IC3 and IC4 should never be used; instead Q10 (pin 21) representing location/device 10 may be used.

Construction and Testing

PARTS LIST Semiconductors: IC1 - UM91215B DTMF dailer IC2 - CM8870P DTMF decoder IC3-IC4 - CD4067 Demultiplexer IC5-IC6 - CD4013 Dual D Flip-Flap D1 - 3.3V, zener diode LED1 - 5mm Red LED Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 150 ohm R2, R6 - 1 kilo-ohm R3, R7-R11 - 10 kilo-ohm R4 - 120 kilo-ohm R5 - 220 kilo-ohm Capacitors: C1 C2, C3 C4

- 100µF, 25V electrolytic - 0.1µF, ceramic disc - 1000µF, 25V electrolytic

Miscellaneous: S1 Xtal-1, Xtal-2 -

On/Off switch Keyboard 3.579542 MHz crystal +9V DC power supply or battery - Tx Antenna - Flexible wires

to the project ‘DTMF Remote Switching Board’ by D. Sinha elsewhere in this volume. To increase the range, two or three IR LEDs may be used in series. Lens/ reflector may also be used. ❑

ELECTRONICS PROJECTS Vol. 20

51

FAST CHARGER FOR INVERTER BATTERIES D. DINESH

N

owadays inverters using tubular or automobile lead-acid batteries have becomes more popular because of their higher Ah (ampere-hour) rating and longer life. However, to recharge these types of batteries, very high charging current is required. Majority of inverter manufacturers use charger transformers capable of charging at the maximum current rating of 10 amperes. In most cities, the electricity board/ authorities do not provide mains supply for even 20 hours in a day. The condition Component / Battery Voltage

Transformer X1 (Sec.) Relay RL1 Resistors (R7, R8) Zeners (D4, D5) Resistor (R6)

is far worse in rural areas. For a fully discharged battery of 150 Ah or higher capacity you may be able to just replenish the charge if you use 20-hour rate (i.e. 1/20th of the Ah capacity of the battery). But for this you must have assured mains supply for 20 hours per day, which is not always possible. Hence 20-hour charging rate is not quite practical, and thus charging at 10-hour rate may be more appropriate to replenish the charge in reasonable time. Batteries need charging in two steps, i.e. float/normal TABLE I mode (10-hour 6V 12V 24V to 20-hour rate) 7.5 15 30 trickle 6V, 100-ohm 12V, 200-ohm 24V, 200-ohm and charging mode. 680-ohm 1k 2.2k 3.3V 9.1V 17V If normal mode * May be test selected between 330-ohm and 2k. is able to charge

Fig. 1: Schematic diagram of fast battery charger

52

ELECTRONICS PROJECTS Vol. 20

the battery fully, fairly quickly, the charger reverts to trickle mode of charging and maintains the battery in fully charged condition by replenishing the lost charge. Over-discharged batteries should not be charged using the normal charging rate. Their output voltage should first be brought up to a safe level using a much lower charging current, and thereafter it could be charged using the normal charging current. The charger should changeover to trickle charging mode when voltage across its cells reaches its maximum permissible value. There are quite a few charging methods used in different chargers, but here a simple constant voltage with sine phase angle control is employed, without sacrificing quality and performance. Battery charger should have requisite built-in protections so that it is not only capable of protecting the battery but is also capable of protecting itself. The charger circuit presented here is meant for charging 24-volt batteries at normal/float rate of 20 amperes (i.e. 10-hour rate for 200Ah capacity batteries). This charger can easily be modified to cover batteries of other voltages and amperehour ratings. The suitable component selection for batteries of other voltages are shown in Table I. This charger incorporates the following protections and indicators: 1. Fuse protection on mains side. 2. Power factor improving capacitor at mains side. 3. Moulded case circuit breaker (MCB) on battery side.

standard phase angle control circuit is used along with diac D7. The triac gate trigger signal is derived from MT2 terminal of the triac, via a variable phase delay network comprising preset VR3, LDR (illuminated by LED3), and combination of resistor R4 and capacitor C2. Capacitor C1 (0.047µF, 400V) decreases hysterisis effect while resistor R5 in combination with capacitor C3 serves as a snubber network which protects the triac. Light output of LED3 is coupled to LDR, Fig. 2: Outline of a modular bridge rectifier which thus controls gate current into the triac according to battery 4. Reverse battery polarity protection/ voltage level. Preset VR3 (470k) indicator. is used to limit the maximum 5. Provision for slow charging of overfiring angle, i.e. the minimum discharged batteries. charging current. 6. Automatic change-over from normal Transistors T1 and T2 and to trickle mode of operation and vice versa. components wired around them Fig. 5: Proposed enclosure and component mounting 7. Charging rate ammeter (optional). are used to control float charging layout plan for the battery charger current in the vicinity of higher Description and lower battery voltage limits. For planatory, a brief explanation of the same example, when the voltage exceeds the is included. Relay RL1 contacts in Fig. 1 Mains AC input to the circuit, as shown higher limit, zener D4 conducts and forare shown in their de-energised state. in Fig. 1, is connected through on/off ward biases transistor T1. As a result colOnce battery is connected to the circuit switch S1 and 3-ampere fuse F1. Howlector of transistor T1 reaches near ground with proper polarity (as shown in the ever, no current can flow through transpotential to cut-off transistor T2, thereby circuit), the bulb will briefly glow (with former X1 unless triac T3 is conducting. swithing off LED3 and thus reducing the low intensity), provided triac T3 is conThus we may say that charging current is conduction period of triac T3 to minimum ducting (under conditions as explained in controlled by triac T3 in series with the (to trickle charge level). And when the preceding paragraph) and relay RL1 will primary of transformer X1. This triac voltage across battery drops below the energise to changeover its contacts such should be mounted on a small heat-sink. threshold value (higher limit), the that battery is directly connected to the To control firing angle of the triac, conduction period of triac inbridge rectifier output. creases and vice vesa. When the battery is connected with When the voltage at wiper reverse polarity, LED1 (red LED) will of preset VR1 is below 17 volts, light up to warn you of wrong connection. transistor T1 is cut off and the With reverse connection of battery, LED3 illumination of LED3 is solely is off and hence triac is also not determined by preset VR2 which conducting, and thus there is no rectifier now controls the current through output. In case of any short across battransistor T2 as well as LED3. tery, 25-ampere MCB will trip and isoAt very low battery voltage vallate the rectifier from the battery. ues, the charging current will Fig. 3: Actual-size single-sided PCB layout for the circuit in Fig. 1 reduce to a value much below Construction and Testing the normal/float current value as the battery now requires to Transformers X1 is a normal step-down be charged at lower charging transformer capable of delivering 20 amcurrent and the same could be peres of secondary current at 30 volts. achieved by adjusting preset One may have additional taps for 32V VR2 and VR3. The LED and and 34V on the secondary side to cater LDR combination should be for low mains voltage. [Note: For those housed in a small sealed enclointerested in winding their own transsure to prevent light from other former, here are the required details: Core: external sources from affecting CRGO No. 7; stack: 2.5 inch or 6.3 cms; the operation of the charger. primary: 368 turns of 19 SWG; secondary Although remainder of the 48 turns for 30V AC, 51.5 turns for 32V circuit appears to be self-exFig. 4: Component layout for the PCB AC and 54.5 turns for 34V AC using ELECTRONICS PROJECTS Vol. 20

53

PARTS LIST Semiconductors: T1, T2 - BC548 npn transistor T3 - BT137 triac D1, D2, D6 - 1N4001 rectifier diode D3 - 1N5401 rectifier diode BR1 - 50A bridge rectifier D4, D5 - 17V,1/2W zener D7 - DB-3 or equivalent diac Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1,R2 - 1-kilo-ohm R3,R9 - 470-ohm R4 - 10-kilo-ohm R5 - 22-ohm, 0.5W R6 - 330-ohm R7, R8 - 2.2-kilo-ohm

Fig. 6: Charging current vs battery terminal voltage for 24V lead-acid battery

54

Capacitors: C1 C2, C3 C4

- 0.047µF, 400V polyester - 0.1µF, 400V polyester - 10µF, 400VAC (paper) (motor start capacitor)

12SWG wire.] Care should be taken while connecting the wires to ensure that all connections are firm. Weaker contacts cause heavy voltage drop and heat dissipation since heavy current flows through them. Bridge rectifier used should be of good quality and capable of delivering at least twice the maximum charging current, and it should be used with adequate heat-sink. Modular bridge rectifiers of 50-ampere current rating available in the market may be used. Outline of a typical bridge rectifier of this type is shown in Fig. 2. Its metallic body serves as heat-sink and the bridge rectifier can be secured to metal chassis with nut and bolt through its centre hole. The bulb having 24V, 3A rating is an automobile bulb used here to limit charging current when relay contacts are open. Capacitor C4 (10µF, 400V AC) is used across mains primary winding, which not only improves power factor but also improves RF suppression. Circuit may be easily assembled on a piece of general-purpose PCB. However, actual-size single-sided PCB layout and its component layout are shown in Figs 3 and 4 respectively. Care should be taken while adjusting 470k preset VR3 as it carries live mains

voltages. Suitable enclosure with mounting layout plan for components is shown in Fig. 5. Mount all hardware one by one. LED holders, SPST switch, ammeter go on front panel, and MCB, fuses, battery terminal and mains tag block on rear panel. Please note that all components in bottom half section of Fig. 1 are mounted on the chassis of the charger as shown in Fig. 5, and hence PCB size is small. Before coupling the LED to LDR in a suitable enclosure, presets VR1 and VR2 are to be adjusted as follows using any external variable DC power supply source without 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 LED3 just begins to light up. 4. Now connect collector of transistor T1 to base of transistor T2 and adjust DC supply to 27 volts. Adjust preset VR1 such that LED begins to just light up. Remove variable DC power supply and connect a fully charged battery across battery terminals. The LED and LDR should be housed in a properly sealed enclosure to avoid light from external sources impinging on the LDR. Connect mains input after keep-

ing preset VR3 (470k) at the high- est resistance position. Adjust it for tric- kle charge level at 28 volts or near about (whatever is the terminal voltage of the fully charged battery). Repeat the settings 4 to 5 times, if necessary. Now this charger is ready for normal operation. A diagram showing charging current vs battery terminal voltage for a typical 24V lead-acid battery is shown in Fig. 6. The dotted lines in figure indicate the minimum and the maximum battery terminal voltages within the usable range (off-charge), while the solid lines indicate the terminal voltage with battery still on float charge. ❑

Readers comments: ❑ Please clarify the following: 1. How is this circuit a constant voltage charger? Can it also be made constant current charger? 2. Why is 24V relay RL1 used? If a deep-discharged battery (17V terminal voltage) is connected, will it not chatter or even fail to operate? 3. What for 24V bulb is used?

Chandrakant R. Joshi Kolhapur The author, D. Dinesh, replies: 1. The charging current is controlled by varying the firing angle of the triac in accordance with the battery’s terminal voltage, keeping the charging voltage constant. Converting the circuit into constantvoltage and constant-current charger is not feasible.

2. Relay RL1 is used for protection of battery as well as charger. If a deep-discharged battery is connected, a limited current flows through 24V, 3A bulb until the relay energises. Once the relay energises, a normal charging current flows through the battery. 3. Use of 24V, 3A bulb is explained above. ❑

ELECTRONICS PROJECTS Vol. 20

Miscellaneous: LED1 LED2 LED3 RL1 F1 X1 -

-

Green LED Yellow LED Red LED Relay 24V, 200-ohm Fuse cartridge, 3A 230V AC primary to 34V, 20A secondary transformer. With tapping for 30 and 32V AC MCB for 25A Bulb 24V, 3A (72W) Light dependant resistor (LDR) Ammeter, 30A FSD Chassis/cabinet

Z-80 BASED DEDICATED PROGRAMMER CUM EMULATOR K. PADMANABHAN & S. ANANTHI

E

very microprocessor or micro conmodating the higher address lines to one can put the contents of one or more troller based project needs an attain increased memory size. earlier EPROMs into one of the faster EPROM (or EEPROM) for its proand denser EPROMs of today. Past techgram memory. Many day-to-day applinology needed 25V for programming, as Description ances like photocopier, film-developing with the 2716 (2k) EPROM, but n ow most machine, printer, etc use EPROMs. PCs A dedicated EPROM programmer-cumEPROMs are programmable at 12.5V. So, also need EPROMs for their motherboard emulator circuit is presented here. It is the risk is less. and various controller cards. Present-day convenient for programming small code The majority of today’s projects use EPROMs have much larger memory. Toapplications by entering data and burnthe 8k or 16k EPROMs, even though the day it is possible to have 1 MB of proing it into the EPROM or EEPROM. The code programmed therein may not exceed grammable memory in a single IC (27800). data can be first entered into the RAM of 2k. These 8k and higher size devices are The full BASIC interpreter of a basic the EPROM programmer and later trans28-pin types, while the 2k (2716) have computer (refer EFY Dec. 1990 issue, ferred to program the EPROM. Additiononly 24 pins. The numbering of the pins reproduced in Electronics Project Vol. 11) ally, there is an application for using this of these devices is shown in Fig. 1, indican go into one EPROM of 16k. unit to emulate an EPROM in the target cating that the extra four pins are accomSoftware for typical projects and robotic kits also need EPROMs to be programmed. The EEPROM (electrically erasable PROM), in addition to this family, can be programmed at any random location and operates on a voltage of only +5 volts. One can electrically erase and reprogram any memory cell in such an EEPROM. The 2864A is a popular 8k device of this type. Earlier machines such as a film-processing machine used to have four EPROMs (2716) of 2k each. Now we can conveniently put all that code in one 2764 EPROM. The flexibility of a copier is an advantage in that Fig. 1: The common pin numbering method followed for accommodating 24-28-pin ICs in 28-pin DIP sockets. ELECTRONICS PROJECTS Vol. 20

55

56

ELECTRONICS PROJECTS Vol. 20

Fig. 2: Schematic diagram of the main board of Z-80 based EPROM programmer

board, whose program is being checked during development stage. This circuit has the following features: 1. It can be used to program the following devices: 2716, 2732, 2764, 27128, 27256 and 2864 EEPROM. 2. It can copy from any of the following EPROMs (source) into any other EPROM (destination): 2716, 2732, 2532, 2764, 27128, 27256. 3. It can emulate an EPROM (a 2k, 2716) in a development board via a DIP jumper. The circuit comprises a hexadecimal keyboard and a 6-digit LED display. The keyboard has 20 keys and a reset key. The 20 keys include 16 keys for hexadecimal data entry and four command keys. A six-digit LED display is provided to dis-

play the address and data, four for the address field and two for the data field— all in hex format. The system uses a Z-80 microprocessor chip. The principle of programming an EPROM using Z-80 is quite simple, and you do not require any additional peripheral chip such as PIA for accessing the EPROM address or data pins. In other words, the EPROM programming socket is like any other RAM chip to the Z-80 microprocessor. The only difference is that the Z-80 is made to wait for the duration of the programming pulse, during which period the address and data lines signals are stable and the programming pulse (width = 50 ms) is applied, which causes the EPROM device to be programmed insitu. The EPROM can also be read after

programming and contents of addressed location can be verified. In fact, the software programming routine checks the programmed data in each location before programming the next location so that spurious programming is avoided. The full software is given for programming or copying from a pre-programmed EPROM. An emulate or program switch S4 (up during program mode and down during emulate mode) puts the Z-80 in hold state during emulation. The contents of a RAM (a 6116), loaded previously with the development system program, are used to transmit the information to the EPROM socket on the development board via a DIP jumper. This DIP jumper plugs on a separate socket in the Z-80 main PC board and it can be unplugged when the system

Fig. 3: Schematic diagram of circuit on auxilary board

ELECTRONICS PROJECTS Vol. 20

57

PARTS LIST

Fig. 4: Arrangement showing interconnections between EPROM programmer and a development board during emulation mode

is not being used as an emulator but only as a programmer.

The Circuit The entire unit consists of two parts. One is the main board comprising the Z-80 microprocessor, the sockets for the following EPROMs: (i) copy master, (ii) the EPROM to be programmed, (iii) the socket for emulator DIP plug (double-ended) and few other ICs/components as shown in Fig. 2. The other board, which is the input/ output (I/O) board, comprises the key switches and the LED displays, etc, as shown in Fig. 3. The two boards are connected together using FRC connectors linked by a ribbon cable. The signals coming out of the Z-80 board are the data bus (D0 to D7), the read (RD) and write (WR) signals and address decoded port select signals (PORT 1 through PORT 3) which are for the keyboard and display ports. The I/O board consists of two numbers of output ports, each made up of a pair of 7475 ICs. The segment driver port is designated as I/O port No. 2 and the digitdriver port as port No.3. The input port, which is acquiring the key-code of the key-pressed, is designated as read port No.1. The two pairs of 7475 output ports are connected to the LED display via segment and digit driver ICs ULN 2003 (IC17) and 74LS245 (IC18) respectively. The segment driver IC17 (ULN2003) sinks the current from the LED segments and its input is the latched set of data values from the output pins of the IC12 and IC13 74LS75. The other 7475 pair, comprising ICs 14 and 15, is used for the digit port. It

58

ELECTRONICS PROJECTS Vol. 20

enables one digit of the LED display to glow at a time in a multiplexed manner. This port drives the digits via 74LS245 IC18 which sources current to all the segments of a common-anode LED display. One of the six displays (DIS1 through DIS6) would be glowing at a time in a multiplexed manner, which is governed by software. The input port is actually part of the key-encoder IC20, the 74C923, which is a 20-key encoder CMOS chip. This IC genTable I Key Hex No. Function Desig. Representation S

10

H

11

L

12

G

13

Store and Increment key: When pressed, stores the data shown in the data field (rightmost two LEDs) into the address (leftmost four LEDs) and increments the address High address set key: Sets the high address (leftmost two LEDs) to the value displayed in data field Low address set key: Sets low address (two middle LEDs) to the value displayed in the data field Go and execute program key: Program is executed from the address displayed in the address field.

Semiconductors: IC1 - Z-80 microprocessor IC2 - 74LS139 dual 1-of-4 decoder IC3 (N1-N6) - 74LS04 hex inverter IC4 - 74LS157 quad 2-input multiplexer IC5 - 74LS121 monostable multivibrator IC6 - 75452 dual high-current NAND gate IC7 - µA723 (T0-5 voltage regulator metal can package) IC8 (N7-N12) - 74LS06 flex inverter buffer/ driver IC9 - 2764 or 2716 8k or 2k EPROM (monitor) IC10 - 6264 8k static RAM IC11 (N13-N16) - 74LS00 quad 2-input NAND gate IC12-IC16 - 74LS75 4-bit bistable latch IC17 - ULN2003 high current/ voltage Darlington drivers IC18 - 74LS245 actual bus transceiver IC19 (N17-N20) - 74LS02 quad 2-input NOR gate IC20 - 74C923 keyboard encoder IC21 - LM7805 or LM340 5-volt regulator T1-T3 - 2N2907 pnp transistor D1, D2 - 1N5401 3-amp rectifier diode D3, D4 - 1N4001 1-amp rectifier diode Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1,R5,R6,R8, R9,R12,R24 - 1.5-kilo-ohm R4,R23 - 470-ohm R2,R3 - 1-kilo-ohm R7 - 330-ohm R10 - 6.8-kilo-ohm R11 - 1.2-kilo-ohm R13 - 10-ohm R14,R15 - 10-kilo-ohm R16 - 3.3-kil-ohm R17-R19,R22 - 4.7-kilo-ohm R20 - 3.3-kilo-ohm R21 - 150-ohm Capacitors: C1,C2,C5,C10 - 0.1µF ceramic disc C3 - 15-60pF ceramic disc C4 - 10µF, 16V electrolytic C6 - 1µF, 16V electrolytic C7 - 470µF, 35V electrolytic C8 - 220µF, 63V electrolytic C9 - 2200µF, 25V electrolytic Miscellaneous: DIS1-DIS6 - LT542 common anode display S1-S3 - SPST on/off switch S4 - DPDT on/off switch S5 - Push-to-on switch S6 - Rotary switch - 16 keyboard switches (N/O) tactile type) - FRC connectors male/female - Ribbon cable - Shorting plugs for FRC connectors, wooden enclosure

erates the key-code of the key pressed. The keys are arranged in a matrix of five rows and four columns. At the intersection of each row and column, a switch is wired. When a switch is closed, the 74C923 encodes the value of the switch and outputs it to the data bus. Also, whenever a

IC Type 2716

2516 2732

Mode READ Write (Prog.)

Pin No. 18 CE 50ms Positive pulse (TTL)

READ Write

2532

READ Write

CE 50ms negative TTL pulse A11 A11

2764

READ Wrtie

27128

TABLE II 20 21 Low 5V High 25V

Low 25V

-1 ---

-2 ---

+1 ---

Same as above A11 -A11 --

---

---

---

---

---

CE Low

(21V for 2732A) Low Low 50ms 25V negative going TTL pulse Low A11 High A11

A12 A12

5V 21V (12.5V or 2764A)

READ Write

CE Low

Low High

A11 A11

A12 A12

5V 12.5V

27256

READ Write

CE Low

A11 A11

A12 A12

5V 12.5V

2864A

READ Write

CE Low

Low High pulse Low High

High 50ms negative going pulse (TTL) High TTL 50ms A14 A14

A11 A11

A12 A12

5V 5V

key is pressed, the data available (DAV), pin13 in this IC, goes high. This active DAV logic-1 state indicates that the key pressed has been encoded and the data is ready after proper debouncing of the pressed key. The IC contains its internal oscillator for which a capacitor is connected on its pin 6 and another capacitor on pin 7 for taking care of key debouncing. The data bus can read the data only when the data is available. The output pins (15 through 19) are floated in tristate condition until the OE pin is brought low. Whenever a key is pressed, the active high DAV signal after inversion by gate N11 is given to the INT (interrupt) pin16 of the Z-80 microprocessor. The Z-80 is interrupted and it goes into an interrupt service routine (ISR). This ISR includes a read PORT 1 (active low) command which is used after combining with I/O address PORT 1 signal (active low) in NOR gate N20 and inverted through gate N12 to enable OE pin14 of IC 74C923. This routine reads the keycode, acquires its value and acts accordingly. The IC 74C923 thus combines a port function along with key encoding logic. Out of the 20 keys of the keyboard 16 keys are used for hex digits 0 through F and the remaining four are the command keys. Only four simple commands are provided, because in this programmer we normally load data into the RAM or any other

High TTL pulse

chip within the address range provided. Therefore these keys are mainly meant for loading of address and data and execution of programs. The designation of the four command keys, along with their hex digit representation and functions, is given in Table I. The high and low addresses are shown on the first four digits (from the left) and data 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 address (20 00 hex) and xx are the content (data) stored at that address. Any hexadecimal key, when pressed, enters that number (0 through F) as the right-most digit. For example, if 3 is pressed, the 6digit display shows: 20 00 x 3 (Note: x in the above examples denotes any random hex digit.) If one keeps the key pressed for too long, the number repeats itself and the display would show: 20 00 33 Similarly, if one presses the S key for too long, the address keeps on incrementing one by one. This is because the software is so written for the interrupt service routine. Reverting to the explanation of the circuit of the main board, it consists of the Z-80 microprocessor with a crystal

clock of 2.5 MHz which is realised by an oscillator configured around a couple of 74LS04 gates (N3 through N5). The Z80’s interrupt pin 16 is used for data entry from the keyboard as mentioned earlier. The non-maskable interrupt NMI (pin 17) is not used and is tied, always high. The BUSREQ or ‘hold’ pin 25 is brought low whenever the switch (program-emulate) is thrown to the emulate position. During the emulate mode, both the data bus and the address bus are tri-stated and float in the Z-80. The 6116 (or 6264) RAM chip, which has its data already loaded therein, is connected to the development board, for which the other end of the DIP jumper plugs into its own EPROM socket. Fig. 4 offers a glimpse of the arrangement showing interconnection between EPROM programmer and a development board during the emulation mode. The Z-80 microprocessor has 16 address lines, out of which 13 address lines (A0 through A12) are used to select blocks of 8k memory each. Address lines A13 and A14 are used in a 74LS139 decoder (IC2) to get four decoded address ranges, as under: 00 00 to 1F FF: This is the first 8k memory address space which is set aside for the monitor EPROM. All this 8k memory space is, however, not used because the monitor and the programming code hardly occupy a few pages (here a page refers to 256 consecutive locations). A 2716 EPROM IC (24-pin) is used here. It will be mapped in the address space of 00 00 to 07 FF. If a 2764 EPROM IC (28-pin) is used as the monitor, it will occupy the entire 8k address space (00 00 to 1F FF). 20 00 to 3F FF: This is the second 8k block of memory space which is set aside for a RAM chip. This socket (for IC10) is also used during the emulation mode as mentioned earlier. Since an emulator does not normally need a program of over 2k, a 6116 RAM chip is enough. However, it would be better to use 6264 (8) RAM. The starting address for whichever chip is employed, would always be 20 00. The usable end-address will differ depending on the RAM chip used. It would be 3F FF with 6264 and 27FF with 6116. 40 00 to 7F FF: This next 8k block of memory is for copy EPROM. Here one would fit a 2716/32/64 in which code to be copied is already burnt in. The address ranges for the above-mentioned EPROMs having 24/28 pins as annotated against each within parenthesis are: 27128 (28-pin): 40 00 to 5F FF (8k) 2764 (28-pin): 40 00 to 5F FF (8k) ELECTRONICS PROJECTS Vol. 20

59

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 in it, one will have to avoid the four pins which are extra, which are on the left extreme (looking from the front) of the socket. Thus, while inserting a 2716 in this socket, one should insert it in such away that pin 1 goes into the pin 3 position. So the socket pin numbers of the 2764 are renumbered, starting from –2, -1, 1 through 12, 13 through 24, +1 and +2 (refer Fig. 1). Thus there should be no confusion during insertion/use of 24- or 28-pin IC in 28-pin DIL (dual-in-line) socket if one renumbers its pins in this format. 80 00 – FF FF: Last 32k of memory space has been set aside for the target EPROM to be inserted in the 28-pin ZIF socket for programming. The programming EPROM could be a 2716/32/64/128/256. While programming, we have to apply a 50ms TTL pulse to the proper programming pin of the EPROM IC being programmed. Also, we have to put the Z-80 in Wait state, so that the address and the data, which are output from the Z-80 microprocessor to the EPROM under programming, remain stable for 50 ms, to ensure that programming of the location takes place properly. At the same time, a high voltage (12.5/ 21V/25V) must be applied to the corresponding VPP pin. Table II shows the pins to which the programming pulse, high voltage VPP, etc are applied to the different EPROMs. The 2532 EPROM from TI is slightly different from the 2732 of Intel and other makes. The 2732A also has a minor difference in that it needs only 21V. The programming action takes place as follows: When the memory block of the programming socket, 80 00 – FF FF, is addressed, the monostable 74LS121 (IC5) is enabled. It produces a 50ms output pulse. This pulse would be used for keeping the Z80 in the Wait condition, whenever one writes data (i.e. programs) into the programming socket. While reading from that socket however, one need not put Z-80 in the Wait state. Therefore one has to distinguish between read operation and write operation for the IC in the programming socket. By the same analogy, the signals going to the programming socket also differ between read and programming operations and vary from one chip to another. That is why it is rather difficult to have the provision for programming several ICs in

60

ELECTRONICS PROJECTS Vol. 20

one programmer. In this circuit, programming of different EPROMs has been made possible through use of small plug-in modules called personality ‘P’ plugs. These plugs are exactly like a 14-pin IC, and plug into a 14-pin DIL socket. If one programs a 2716, he plugs a 2716-P plug, and if one programs a 2732, he plugs a 2732 P-plug, and so on, into the personality socket. These could be fabricated by grinding any failed throw-away 14-pin IC’s top so as to remove the silicon dice and then wiring diodes, jumpers on the top between the pins as shown in Fig. 6. The personality plugs ensure application of proper signals to the pins of the IC being programmed. For example, in a 2716, pin 21 must get a 25V supply, pin 18 should get a 50ms high-going TTL pulse and pin 20 must be logic high. For reading, pin 20 must be low, pin 18 must get chip-enable CE signal while pin 21 must be only at 5V. Thus, when the P-plug is inserted, the 5V supply, the 50ms programming pulse, 21V VPP are passed via the jumper connections on this P-plug to the proper pins of the programming socket. In addition, to change over from the program mode to the read mode, the signals need to be altered. For this, a 4-pole, 2-way changeover switch (quad 2input multiplexer 74LS157 IC4) is utilised. It is changed over from one side to the other between read and programming operations. The four signals selected in each case are shown with a separation ‘/’ in Fig. 2 (at pins 4, 7, 9 and 12 of IC4). The read operation for 2716 requires a low pulse while the programming operation requires a high pulse (50 ms) on its pin 18. So, one pole of the switch (here pin 7 of IC4) changes from CE pulse to the 50 ms high pulse. On a 2732, the programming pulse must be a low-going 50ms pulse, as also for a 2764 or 27128. For reading, 2716 requires zero volt on its

Fig. 5: Schematic diagram of power supply

pin 20, but 5V during programming. Therefore, a 5V/0V signal is also switched by another pole (pin 9) of IC4 (74LS157). The switch is changed-over from one position (read) to another (write) by a command. This command is obtained from one of the decoded input-output ports. Since we have two bits of the digit port 3 free (as only 6 digits are used), the D7 bit of port No. 3 (i.e. Q7) is used for this purpose. If pin 1 of 74157 is high, it selects the switches for programming, and if it is low, it selects the switches for reading. The programming software should make this pin high and throw the switches to the programming side, so that proper programming signals are applied to the programming socket. In addition, the high voltage (12.5V or 21V) supplies need to be switched on only at the time of programming. For this purpose, switching voltage regulator IC µA723 (IC7) is employed. The 723 IC is normally set up to obtain 12.5V or 21V and 25V at output pin 1 with the help of resistor R14 (10k) and other resistor(s) switched in by transistors 2N2907 (T1 through T3). Transistor T1 (when on) provides 12.5V output, while transistors T2 and T3 provide respectively 21V and 25V output 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 9 is normally pulled and kept low, so that no high voltage appears on the programming socket. Only during the programming period, pin 9 is left high and the 12.5V or 21V or 25V are obtainable from pin 1 of IC7 (µA723). EPROM 2732A requires VPP of 21V while 2764 requires 12.5V and 2716 as well as 2732 require 25-volt VPP supply. I/O Port 1 bits D0 through D2 controlled via the software program can be used to control the VPP voltage. Alternatively, 3-way switch S6 can be used to select the VPP voltage. (In the PCB only S6 has been wired.)

Pin 9 of µA723 IC7 cannot be grounded directly and it is therefore brought under software control. The D7 bit (Q7) of port-3 is brought high during programming. The Q7, which then goes low, is connected to IC6 75452 (a high voltage/current NAND inverter pair). This NAND gate makes pin 9 of IC7 low. The Q7 of port-3 makes the input of the 75452 gate low and thereby the output pins 3 and 5 go high, causing pin 9 of IC7 also to go high. This permits the 12.5V or 21V or 25V supplies to be available. Normally, pin 9 is low upon reset, as Q7 goes high upon reset operation and it continues to be high during data loading into RAM or reading operations. So, high voltages are properly switched and applied carefully, i.e. only during programming. Switch S3, which supplies the unregulated 30V to the IC µA723, is switched on only during programming.

Software

Fig. 6: Wiring of personality (P) plugs for different EPROMs

Software for the programmer is simple. The interrupt service routine (ISR) reads the keyboard from port-1 and waits for a certain duration (delay) before taking action on the key pressed. If it is a number (hex.) key, it puts it in the last (rightmost) digit. If one presses 3 and E

one after the other, 3E is entered in the data field. The address starts at the first RAM address (2000H) where 3E gets entered. If one desires to employ this unit as a Z-80 trainer kit, it can be easily done by entering the program in the RAM and executing it with the ‘G ‘ (GO) key. For example, the following program would move 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-2 20 04 3E 01 LDA 01 ;Move 1 to 20 06 D3 03 P: OUT 03 ;digit port-3 20 08 CD 50 04 Call delay ;wait for ;flicker 20 0B CD 50 04 Call delay ;wait for ;flicker 20 0E CD 50 04 Call delay ;wait for ;flicker 20 11 07 RLA ;Rotate left 20 11 C3 06 20 JMP P The keys for incrementing and setting address are the S, H and L keys, while the G key executes the program. The main monitor program simply displays the current address and its data using a multiplexed display, for which a software program is used, commencing at 00 B0. The display stays on, until it is interrupted by pressing any of the keys. Programming software: The EPROM programming program software is also simple (It starts at address: 04 00 hex) since hardware takes care of the 50ms pulse which is required for programming the EPROM. The Z-80’s CPI instruction is used, after setting up the source, destination and number of bytes in register pairs DE, HL and BC respectively. The D7-bit of port-3 (Q7) is initialised to a ‘1’ so that the 74LS157 switches over to programming mode. At the instant of transfer of each byte of data from source to destination, the 50ms pulse is generated and the Z-80 also waits for this 50ms time duration. A comparison is made after every transfer (after switching back the 74LS157 to the read-mode), with the programmed data by reading the EPROM. If data was correctly programmed at that byte location, it proceeds to program the next byte after switching on the 74LS157 to the program mode. When all locations (as many as desired) have been programmed, a flag letter ‘C’ indicating correct programming is displayed. If a byte does not get programmed properly, it is displayed at once, showing ELECTRONICS PROJECTS Vol. 20

61

that particular address and the wrongly programmed data therein, before proceeding to program the next byte. The display showing this information (wrongly programmed data along with address) is live for about 4 seconds, for the user to note the wrong data and its address. Then it proceeds to program the next byte. If there are no more errors, it continues right through until the entire required program has been programmed into the EPROM. Procedure for programming: The addresses of the source, destination and the number of bytes/pages to be programmed should be first entered. For this purpose, the RAM addresses, 2000 through 2005 are used as under. Destination: 20 00 … Low order address and 20 01 … High order address of EPROM socket (destination) corresponding to the EPROM being programmed. Suppose one wants to program only the second half of a 2732 EPROM starting with its page 8 and ending with page F, one enters the starting address 88 00 (please note that starting address of EPROM ZIF socket is 80 00 hex) as follows: 20 00 = 00 20 01 = 88 For a 2764 EPROM there are four parts, with starting addresses as under: 80 00 = First part 88 00 = Second part 90 00 = Third part 98 00 = Fourth part Thus, the starting address of destination (within the allocated address space of 80 00 through FF FF) will vary depending upon which quarter of the 2764 one wants to load a program into. Number of bytes: Having loaded the destination address into RAM locations 20 00 and 20 01, one proceeds to load the number of bytes/pages to be programmed in RAM locations 20 02 and 20 03. For instance, if one wants to copy a full 2716 EPROM, there are eight pages to be copied. So one enters them as under: 20 02 = 00 ;zero bytes and 20 03 = 08 ;eight pages Source: If one wants to copy from RAM (as source), after having loaded the data in it, earlier, the RAM starting address must be entered in locations 20 02 and 20 03. Please note that pages 21 to 26 of RAM address space only are available for storing the data to be transferred to EPROM. The full 8 pages (available) in the 6116 RAM cannot be utilised for load-

62

ELECTRONICS PROJECTS Vol. 20

ing the data (to be programmed) at one time, since we employ its page 20 for loading addresses of destination, source and number of bytes to be programmed and its page number 27 for the stack. If however, 6264 RAM is used in place of 6116 RAM, then we could use address space from 2100 to 3EFF. It is also advisable, while loading from RAM, to program one page at a time. For example, after loading the data to be programmed into page 21 of the RAM one enters the number of bytes to be programmed as under: 20 02 = 00 ; 0 byte 20 03 = 01 ; and one page. Then the source start address for data (2100) will have to be entered in locations 20 04 and 20 05 as under: 20 04 = 00 20 05 = 21 (meaning that data to be copied into EPROM is loaded in twenty first RAM page) If one wants to copy data from the ‘copy EPROM socket’ of Fig. 2, then the source address range available is 40 00 to 7F FF. But if a 2716 is used in that copying socket, the start address would be 48 00 (since pin 21 is to be returned to +5V). Thus source address would be entered as under: 20 04 = 00 20 05 = 48 After entering the source address, destination address and the number of bytes to be programmed and selecting the VPP voltage (after switching on S3) and using either rotary switch S6 or using I/O port1 bits, the program is executed at 04 00 using G-key. For selection of Vpp voltage using software, the following instructions can be suitably added in the EPROM programming software: 3E 01 LDA, # 01 ; 01 for12.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 programming software starting at location 04 00, it transfers a byte from the source to the destination, verifies it and continues until the entire data has been programmed. When the flag letter ‘C’ gets displayed (denoting correct programming), press reset switch and switch off the unit. The EPROM is then removed and used. It takes about 20 seconds for each page to be programmed. If there are many errors during program-

ming, either the IC is loose in its socket or the EPROM is defective. The EPROM can be erased with an ultraviolet light source eraser and tried again.

Construction The power supply circuit as given in Fig. 5 is to be assembled first on a base plate at the back of the unit, which could be a wooden board of about 25 cm x 35 cm. The transformer and the heat sink for 7805 are then to be fitted. A lug board is used for wiring the power supply circuit with diodes, capacitors, etc. A 230V AC primary to 12-0-12V, 2A secondary transformer is used to get the DC supplies. A voltage doubler circuit is used to obtain 30V unregulated output, which goes to the µA723 ICs on the Z-80 board of Fig. 2. Please note that either LM 7805C or 340T in TO3 metal package capable of supplying 1 ampere of current should be used. As the ready-made transformers available in the market are highly over-rated, one may use a transformer with secondary current rating of 3 to 4 amperes to avoid excess voltage drop in the secondary and over-heating. A double-sided PTH glass-epoxy PCB is required for the circuit of Z-80 main board including a major part of the circuit of the auxilary board. This would leave us with only the keyboard which can be assembled on a general-purpose PCB and connected to the main board using FRC 16pin connectors and ribbon cable. The actual-size component-side track layout for the PCB is given in Fig. 7 and solder-side track lay-out is given in Fig. 8. The component lay-out for the PCB is given in Fig. 9. The Z-80 board houses all sockets for programming EPROM, copy EPROM and the emulator DIP plug. The Z-80 main board is mounted on pillar supports in a raised position of about 6.5 cm, above the transformer. Cuts are made against the positions of the sockets to expose them for inserting ICs (the EPROMs for programming and copymaster as well as the DIP jumper). 28-pin zero insertion force (ZIF) sockets could be fitted for these, since their pins are thick, having 1.0 mm holes are made for this programming socket on the board. The PCB containing the keyboard is mounted in a slightly slanted position with respect to the Z-80 main board, so that the keys can be handled conveniently. Sockets are to be used for all ICs in this board as well. The display is

Fig. 7: Component-side track layout

63

ELECTRONICS PROJECTS Vol. 20

64

ELECTRONICS PROJECTS Vol. 20

Fig. 8: Solder-side track layout

Fig. 9: Component layout

ELECTRONICS PROJECTS Vol. 20

65

mounted in a raised position using sockets and that make the display in level with the keyswitch tops, so that while covering up, these can both become exposed by a profile cut on the front panel plate. The switches S1-S6 are mounted on the side. After wiring and interconnection, it is worthwhile to carry out a cold check by using a continuity tester for all lines, particularly the address and data lines to the sockets for EPROM, RAM socket for programming, switches, etc. on the main board and the display/key board. A check could be made of the presence of 12.5/25V/21V voltages on the programming socket, when the programming program at location 04 00 is executed.

velopment board. For example if one is developing an 8035 system board, then the EPROM socket on it is plugged by the other end of the DIP jumper. After resetting the 8035 in that board, the program in the 6116 (or 6264) here would be executed by that 8035. One can check that program for proper functioning. When changes are necessary in the program, the 8035 is reset, and the DIP jumper unplugged. The program/emulate switch is thrown to program position and the RAM reloaded accordingly. Tech Editor’s Note: The EPROM programmer after fabrication at EFY was tested using a short test program as given at the end. We could successfully program an EPROM using the same.

The pulse of 50 ms going to pin 18 (say 2716 P-plug) can be looked on a CRO. For the 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. The personality plugs should thus also be checked. A sample program could be programmed into an IC to verify proper programming. Emulator: This is used to develop a program for a development board. This program should be loaded into the RAM from address 20 00 onwards using the keyboard. Then, the program/emulate switch 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-

Z80 ASSEMBLY LANGUAGE PROGRAM FOR EPROM PROGRAMMER

66

ADDR

OPCODE

0000

C3 50 00

LABLE

MNEMONICS

0050 0052

ED 56 C3 00 02

L1:

IM 1 JP L2

0200 0203 0206 0207 020A 020B 020C 020F 0210

31 FF 27 21 00 20 4E CD B0 00 FB F3 CD B0 00 FB C3 0B 02

L2:

LD SP,27FFH LD HL,2000H LD C,(HL) CALL DISPLAY EI DI CALL DISPLAY EI JP L

0038 0039

F5 C3 AF 01

PUSH AF JP 01AFH

01AF 01B1 01B4 01B5 01B7 01B8 01B9 01BC 01BD 01BE 01BF 01C1 01C2 01C3

DB 01 32 00 27 47 DB 01 D9 08 11 FF 57 1B 7A B3 20 FB D9 08 C3 00 03

IN A,(01) LD (2700H),A LD B,A IN A,(01) EXX EX AF,AF’ LD DE,57FFH DEC DE LD A,D OR E JR NZ,Q EXX EX AF,AF’ JP LX

0300 0303 0305 0307 0309 030A 030B 030C 030D 030E 030F 0311 0312 0313 0314 0316 0318 031A 031B 031C 031D

3A 00 27 E6 1F FE 10 30 0D 47 79 17 17 17 17 E6 F0 B0 4F F1 ED 4D FE 12 20 05 69 4E F1 ED 4D

JP L1

L:

Q:

LX:

A1:

ELECTRONICS PROJECTS Vol. 20

LD A,(2700H) AND 1FH CP 10H JR NC,A1 LD B,A LD A,C RLA RLA RLA RLA AND F0H OR B LD C,A POP AF RETI CP 12H JR NZ,A2 LD L,C LD C,(HL) POP AF RETI

COMMENTS

ADDR

OPCODE

LABLE

MNEMONICS

031F 0321 0323 0324 0325 0326 0328 032A 032C 032D 032E 032F 0330 0332 0334 0336 0338 033A 033C

FE 11 20 05 61 4E F1 ED 4D FE 10 20 06 71 23 4E F1 ED 4D FE 13 20 F8 3E 79 D3 02 D3 03 E9

A2:

CP 11H JR NZ,A3 LD H,C LD C,(HL) POP AF RETI CP 10H JR NZ,A4 LD (HL),C INC HL LD C,(HL) POP AF RETI CP 13H JR NZ,B1 LD A,79H OUT (02),A OUT (03),A JP (HL)

00B0 00B1 00B2 00B3 00B5 00B6

00 F5 7C E6 F0 0F 0F

00B7 00B8 00B9 00BA 00BC 00BE 00C1 00C2 00C4 00C5 00C7 00C9 00CC 00CD 00CF 00D0 00D1 00D2 00D3 00D4 00D6 00D8 00DB 00DC 00DE 00DF 00E1

0F 0F 5F 3E 20 D3 03 CD 10 01 7C E6 0F 5F 3E 10 D3 03 CD 10 01 7D E6 F0 0F 0F 0F 0F 5F 3E 08 D3 03 CD 10 01 7D E6 0F 5F 3E 04 D3 03

A3:

B1: A4:

DISPLAY: NOP PUSH AF LD A,H AND F0H RRCA RRCA RRCA RRCA LD E,A LD A,20H OUT (03),A CALL SEGDISP LD A,H AND 0FH LD E,A LD A,10H OUT (03),A CALL SEGDISP LD A,L AND F0H RRCA RRCA RRCA RRCA LD E,A LD A,08 OUT (03),A CALL SEGDISP LD A,L AND 0FH LD E,A LD A,04H OUT (03),A

COMMENTS

; H is displayed

; L is displayed

ADDR

OPCODE

00E3 00E6 00E7 00E9 00EA 00EB 00EC 00ED 00EE 00F0 00F2 00F5 00F6 00F8 00F9 00FB 00FD 0100 0101 0102

CD 10 01 79 E6 F0 0F 0F 0F 0F 5F 3E 02 D3 03 CD 10 01 79 E6 0F 5F 3E 01 D3 03 CD 10 01 F1 00 C9

LABLE

0110 0112 0114 0115 0116 0117 0119 011C 011D 011F 0120 0121 0122 0124 0125 0127 0128 0129

16 01 3E F0 B3 5F 1A D3 02 CD 20 01 AF D3 02 C9 F5 D5 1E 17 1D 20 FD D1 F1 C9

01F0 01F0 01F1 01F2 01F3 01F4 01F5 01F6 01F7 01F8 01F9 01FA 01FB 01FC 01FD 01FE

3F 06 5B 4F 66 6D 7D 07 7F 67 77 7C 39 5E 79

ADDR

OPCODE

0400 0401 0405 0408 040C 040E 0410 0413 0415 0417 0419 041C 041E 0420 0422

F3 ED 5B 04 20 2A 00 20 ED 4B 02 20 3E 80 D3 03 CD 50 04 ED A0 3E 00 D3 03 EA 0C 04 3E 73 D3 03 D3 02 76

0450 0451 0452 0455 0456

F5 TIMEDELAY: D5 11 FF 02 1B A9: 7A

MNEMONICS

COMMENTS

CALL SEGDISP LD A,C AND F0H RRCA RRCA RRCA RRCA LD E,A LD A,02 OUT (03),A CALL SEGDISP LD A,C AND 0FH LD E,A LD A,01H OUT (03),A CALL SEGDISP POP AF NOP RET SEGDISP: LD D,01H LD A,F0H OR E LD E,A LD A,(DE) OUT (02),A CALL DELAY1 XOR A OUT (02),A RET DELAY1: PUSH AF PUSH DE LD E,17H P: DEC E JR NZ,P POP DE POP AF RET

; show it ; clear it

ORG 01F0H DEFB 3FH DEFB 06H DEFB 5BH DEFB 4FH DEFB 66H DEFB 6DH DEFB 7DH DEFB 07H DEFB 7FH DEFB 67H DEFB 77H DEFB 7CH DEFB 39H DEFB 5EH DEFB 79H

ADDR

OPCODE

01FF

71

LABLE

DEFB 71H

0400 0401

F3 ED 5B 04 20

DI LD DE,(2004H)

0405

2A 00 20

LD HL,(2000H)

0408

ED 4B 02 20

LD BC,(2002H)

040C 040E 0410

3E 80 D3 03 CD 50 04

0413 0414 0415 0416 0418 0419 041A 041C 041F 0422 0424 0426 0428

1A 77 97 D3 03 1A 13 ED A1 C2 2F 04 EA 0C 04 3E 39 D3 03 D3 02 76

042F 0430 0431 0432 0433 0434 0437 0438 043B 043C 043D 043E 043F 0442 0443 0444 0445 0446

F5 2B C5 4E D5 110001 D5 CD B000 D1 1B 7A B3 C2 3804 D1 C1 23 F1 C30C04

0450 0451 0452 0455 0456 0457 0458 045A 045B 045C

F5 TIMEDELAY: D5 11 FF 02 1B A9: 7A B3 20 FB D1 F1 C9 RET

LP:

MNEMONICS

COMMENTS

;DESTINATION POINTER ;SOURCE POINTER ;BYTE-COUNT POINTER

LD A,80H OUT (03),A CALL TIMEDELAY LD A,(DE) LD (HL),A SUB A OUT (03),A LD A,(DE) INC DE CPI JP NZ,ERROR JP PE,LP LD A,39H OUT (03),A OUT (02),A HALT

ERROR:

PUSH AF DEC HL PUSH BC LD C, (HL) PUSH DE LD DE, 0001 PUSH DE CALL DISPLAY POP DE DEC DE 1D A,D OR E JP NZ P2 POP DE POP BC INC HL POP AF JP LP PUSH AF PUSH DE LD DE,02FFH DEC DE LD A,D OR E JR NZ,A9 POP DE POP AF

TEST PROGRAM FOR PROGRAMMING OF EPROM LABLE

LP:

MNEMONICS

ADDR

OPCODE

DI LD DE,(2004H) LD HL,(2000H) LD BC,(2002H) LD A,80H OUT (03),A CALL TIMEDELAY LDI LD A,0H OUT (03),A JP PE,LP LD A,73H OUT (03),A OUT (02),A HALT

0457 0458 045A 045B 045C

B3 20 FB D1 F1 C9

0500 0501 0505 0508 050C 050E 0510 0511 0512 0513 0514 0515 0518 051B

PROGRAM FOR VERIFICATION OF EPROM PROGRAM F3 DI ED 5B 00 20 LD DE,(2000H) 2A 04 20 LD HL,(2004H) ED 4B 02 20 LD BC,(2002H) 3E 00 X: LD A,00H D3 03 OUT (03),A 1A LD A,(DE) BE CP (HL) 23 INC HL 13 INC DE 0B DEC BC C2 30 05 JP NZ,ERROR EA 0C 05 JP PE,X 3E 39 LD A,39H

PUSH AF PUSH DE LD DE,02FFH DEC DE LD A,D

LABLE

MNEMONICS OR E JR NZ,A9 POP DE POP AF RET

ELECTRONICS PROJECTS Vol. 20

67

051D 051F 0521

D3 03 D3 02 76

0530 0531 0532 0533 0536 0537

2B 4E D5 11 FF 0F D5 C5

OUT (03),A OUT (02),A HALT ERROR:

P2:

DEC HL LD C,(HL) PUSH DE LD DE,0FFFH PUSH DE PUSH BC

Readers Comments: ❑ 1. How can a hexdump be programmed? 2. I have not found the contents of the monitor EPROM (2716/64). Does it mean that it could be loaded with the monitor program of the 8088 given in the ‘Learn To Use Microprocessors’ book? 3. Please let me know the steps for loading a 2716 with character generator listing in the article, i.e., how the program is to be written in Z80 assembly language? Praveen Shankar Haridwar The author, Prof. K. Padmanabhan replies: 1. Programming any EPROM means filling its memory locations with code, i.e., numbers. Each cell in the chip is written with a particular code, i.e., a number between 0 and 255 (or 00 to FF in hexadecimal notation). A ‘hexdump’ is just a series of numbers which occupy these cells in the EPROM. In an EPROM programmer, these numbers are entered

68

ELECTRONICS PROJECTS Vol. 20

0538 053B 053C 053D 053E 053F 0540 0542 0543 0544

CD B0 00 C1 D1 1B 7A B3 20 F4 D1 23 C3 0C 05

by keyboard into the RAM of the programmer and then transferred (written) into the EPROM chip. 2. In the Z80 programmer article, there is a program listing given, along with the code (i.e., numbers). These numbers have to be entered into an EPROM fixed in the Z80 programmer board. For this purpose, one has to use another EPROM programmer, as the present Z80 programmer is not yet ready! The program that makes this ‘Z80 Programmer’ work is specific to it and hence only this programmer will work with it. The 8088 monitor program pertains to the 8088 kit only and is totally different. 3. The numbers which go into the character generator 2716 are, as given in the article. Enter these numbers one-byone using the keyboard into the Z80-based programmer unit and then run the program for burning this data into the 2716 EPROM. In other words, use the present Z80-based program unit to burn any EPROM with data. ‘Burning’ means writ-

CALL DISPLAY POP BC POP DE DEC DE LD A,D OR E JR NZ,P2 POP DE NC HL JP X

ing data permanently into an EPROM chip by suitable application of higher voltage pulses in sequence, which is the method for entering data into an EPROM, in a nonvolatile manner. This unit (i.e., the Z80-based programmer) has the needed circuitry for this. Remember again, that as far as the EPROM is concerned, its contents are just numbers in the range 0-255, written in its cells. A 2716 has 2k (2048) cells, a 2764 has 8k (8192) cells, and so on. The Z80 assembly language has no connection with this. The unit uses a Z80 chip and so we have given the operating program for the unit in terms of Z80’s instruction set, in the form of Z80’s assembly language. The character generator codes are just numbers which give the pattern of dots for each and every character—A, B, C, ... etc, while they appear on the CRT screen. These numbers do not have anything to do with the Z80’s instruction sets, or for that matter, any other microprocessor. ❑

8098 DEVELOPMENT BOARD K. PADMANABHAN & S. ANANTHI

A

mongst the 16-bit family of Intel microcontrollers, the 8098 is the one which is more economical and useful for developing a simple system for understanding the architecture and software details of 8x9x family. Housed in a 48-pin DIP package (Fig.1), it has an 8bit external data bus which is convenient for interfacing to the byte-wide memory IC’s data bus. Although it does not possess full features of the main 8x9x fam-

ily, it has all of them at least partially. For example, instead of eight analogue input channels on the main IC, this 48pin version has provision for four. Likewise, the high-speed input and output facilities are also available in a lesser quantity than in the main IC with the grid chip carrier. Though the hardware features are present in slightly reduced proportion in the 48-pin version of 8098, yet all the software features of the main chip are fully supported by this smaller version as well. In order to evaluate and understand the features and various other aspects of the 8x9x family hardware and software, it is essential to have a system board which is operating with the IC. Such systems are not yet readily available in India, though Intel, itself markets a system known as iSBE-96. As per Intel, “It is a tool available to designers for developing systems based on the 8096 microcontroller. It uses the IBM PC to download to the iSBE-96, and is used in typical development environment for de-

signing and proto-typing of the 8x9x products. With its facilities, one can build a prototype of the target product, develop firmware for it, and debug and test its operation prior to the product entering the manufacturing stage.” As the iSBE-96 is both expensive and unobtainable, one Mr Coates developed and published a system board working with a dumb terminal or PC as the host. On this system, programs are developed only at machine-code level, by downloading instructions from the PC, or the dumb terminal, which the system board executes. Even this is not a sufficiently handy system for quick and economical software development on this very complex chip. Therefore, it was decided (by the authors) to develop and present a dedicated, simple but effective system development board/kit around this 8098, to enable all of its software and multi-tasking features to be tested/experimented with and used to develop suitable boards for the needed instrumentation applications.

Fig. 1: Pin configuration of IC 8098 Note: A satisfactory demonstration of the performance of the author’s 8098 prototype kit was witnessed by EFY’s Chennai representative.

Fig. 2: Internal block diagram of 8098

ELECTRONICS PROJECTS Vol. 20

69

18 +5V

4

6

7 2

7

7

70

ELECTRONICS PROJECTS Vol. 20

display for effectively using its software repertoire. Therefore this development board has been designed using a 16-character, single-line alphanumeric display

module LT-111R from Philips. Such displays are now commonly available in our country from multiple sources. As instructions have to be entered for

Fig. 3: Schematic diagram of 8098 development board

+5V 14

33

RD

+5V

14

+5V

14

14

1

+5V

14

3

5

4

+5V +5V

Unlike a simple beginner’s microprocessor kit, such as the 8085 or Z-80 kits with 7-segment and LED displays, this development system needs alphanumeric

Fig. 4: Block diagram of 16-characters x 1-line LCD module

program execution, a hexadecimal keyboard was built into the board, though it would have been equally possible to add an IBM PC compatible keyboard. The instruction set of the 8098 is very complex, with its various multi-operand formats. However, it is not as complex as the 8096 where bit-level addressing modifications into the code are involved. This makes it absolutely impossible to write hand-code. The same is also true of Motorola’s 68000 family. In this respect

one should appreciate the wiz kids of Intel who developed this 8x9x family software. The code is Fig. 5: Dimensional details of a typical 16 character x 1-line LCD module specific for each instruction type and addressing mode. pensive. The authors were, however, able Please refer Tables I through III for its to obtain a cross-assembler from an alinstructions set. ternate source (Pseudo Corp., USA) for Intel sells cross-assembler, working just $50 in order to develop the needed on the PC, which can be used to develop software for the firmware of the developcode for 8098. This is comparatively exment board and its applications that follow. This is the background which led the authors to develop an 8098 TABLE I system of their own. Opcode and State Time Listing

6C 4C 7C 5C

3 4 3 4 4 5 4 5 3 3 4 4

25 26 17 18 29 30 21 22 25 17 29 21

6D 4D 7D 5D

➁ ➁ ➁ ➁ 8C 9C

➁ ➁

28/33 29/34 20/25 21/26 32/37 33/38 24/29 25/30 29/33 21/25 33/37 25/29

6F 4F 7F 5F

➁ ➁ ➁ ➁ 8D 9D

➁ ➁

26 27 17 18 30 31 21 22 26 17 30 21

6E 4E 7E 5E

➁ ➁ ➁ ➁ 8E 9E

➁ ➁

3 4 3 4 4 5 4 5 3 3 4 4

27/32 28/33 19/24 20/25 31/36 32/37 23/28 24/29 28/32 20/24 32/36 24/28

BYTES

4 5 3 4 5 6 4 5 4 3 5 4

STATE➀ TIMES

67 47 77 57 A7 B7 6B 4B 7B 5B AB BB 8B 9B

BYTES

7/12 8/13 7/12 8/13 7/12 7/12 7/12 8/13 7/12 8/13 7/12 7/12 7/12 7/12

3 4 3 4 4 5 4 5 3 3 4 4

4 5 4 5 4 4 4 5 4 5 4 4 4 4

6/11 7/12 6/11 7/12 6/11 6/11 6/11 7/12 6/11 7/12 6/11 6/11 6/11 6/11

5 6 5 6 5 5 5 6 5 6 5 5 5 5

7/12 8/13 7/12 8/13 7/12 7/12 7/12 8/13 7/12 8/13 7/12 7/12 7/12 7/12

27/32 28/33 19/24 20/25 31/36 32/37 23/28 24/29 28/32 20/24 32/36 24/28

5 6 5 6 6 7 6 7 5 5 6 6

28/33 29/34 20/25 21/26 32/37 33/38 24/29 25/30 29/33 21/25 33/37 25/29

4 5 4 5 ➁ 5 ➁ 6 ➁ 5 ➁ 6 8F 4 9F 4 ➁ 5 ➁ 5

BYTES STATE➀ TIMES

2 3 2 3 2 3 2 3 2 2 2 2

ARITHMATIC INSTRUCTIONS 4 5 66 3 6/11 3 5 6 46 4 7/12 4 3 4 76 3 6/11 3 4 5 56 4 7/12 4 4 5 A6 3 6/11 3 3 4 B6 3 6/11 3 4 5 6A 3 6/11 3 5 6 4A 4 7/12 4 3 4 7A 3 6/11 3 4 5 5A 4 7/12 4 4 5 AA 3 6/11 3 3 4 BA 3 6/11 3 4 5 8A 3 6/11 3 3 4 9A 3 6/11 3

STATE➀ TIMES

MULU MULU MULUB MULUB MUL MUL MULB MULB DIVU DIVUB DIV DIVB

4 5 4 5 4 4 4 5 4 5 4 4 4 4

BYTES

65 45 75 55 A5 B5 69 49 79 59 A9 B9 89 99

OPCODE

3 4 3 4 3 3 3 4 3 4 3 3 3 3

STATE➀ TIMES

64 44 74 54 A4 B4 68 48 78 58 A8 B8 88 98

OPCODE

BYTES

2 3 2 3 2 2 2 3 2 3 2 2 2 2

INDEXED¤ SHORT LONG

BYTES STATE TIMES

OPCODE

ADD ADD ADDB ADDB ADDC ADDCB SUB SUB SUBB SUBB SUBC SUBCB CMP CMPB

INDIRECT¤ NORMAL AUTO-INC.

STATE TIMES OPCODE

OPERANDS

IMMEDIATE

MNEMONIC

DIRECT

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 the second byte is even, use indirect or short indexed. If it is odd, use indirect + or long indexed. In all cases the second byte 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.

Description The circuit is described with reference to the schematic diagram of the system board shown in Fig.3. The main IC is the 8098 microcontroller itself whose internal block diagram is shown in Fig.2. On its left, all input-output pins are shown. These include HSI and HSO (HS stands for high speed) pins, the four analogue signal input pins, the transmit and receive pins of its serial interface and the crystal oscillator as well as the reset input pins. Output pins 7 and 8 (HSO0 and HSO1) are provided with high-current drivers (part of IC ULN2003) to enable interfacing to relays etc. The 8098 has a multi-facet reset pin, which requires a careful connection of the power-on reset pulse to itself. Instead of just a simple resistor-capacitor network, as found in most other microprossors, this one has a gate to ensure a sharp reset input. Input must be low for at least 2 state times to reset the chip. The clock is internally generated with the crystal connected between its pins 35 and 36. A 12MHz crystal is the standard one, though lower freELECTRONICS PROJECTS Vol. 20

71

TABLE II Opcode and State Time Listing

PUSH POP PUSHF POPF

1 1 0 0

C8 CC F2 F3

2 2 1 1

8 12 8 9

PUSH POP PUSHF POPF

1 1 0 0

C8 CC F2 F3

2 2 1 1

12 14 12 13

MNECONIC LJMP SJMP BR[ ]

OPCODE E7 20-27Ã E3

C9 –

BYTES 3 2 2

STACK OPERATIONS (external stack) 3 12 CA 2 15/19 2 16/20 – – CE 2 16/20 2 16/20

JUMPS AND CALLS STATES MNEMONIC 8 LCALL 8 SCALL 8 RET TRAPÂ

BYTES STATEÀ TIMES

4 4 4 4 4 4

STATEÀ TIMES

3 3 3 3 3 3

BYTES

A0 B0 C0 C4 BC AC

LOGICAL INSTRUCTIONS 4 5 62 3 6/11 3 7/12 5 6 42 4 7/12 4 8/13 3 4 72 3 6/11 3 7/12 4 5 52 4 7/12 4 8/13 4 5 82 3 6/11 3 7/12 3 4 92 3 6/11 3 7/12 4 5 86 3 6/11 3 7/12 3 4 96 3 6/11 3 7/12 DATA TRANSFER INSTRUCTIONS A1 4 5 A2 3 6/11 3 7/12 B1 3 4 B2 3 6/11 3 7/12 – – – C2 3 7/11 3 8/12 – – – C6 3 7/11 3 8/12 BD 3 4 BE 3 6/11 3 7/12 AD 3 4 AE 3 6/11 3 7/12 STACK OPERATIONS (internal stack) C9 3 8 CA 2 11/15 2 12/16 – – – CE 2 14/18 2 14/18 61 41 71 51 81 91 85 95

INDEXED¤ SHORT LONG OPCODE

2 2 2 2 2 2

STATEÀ TIMES

LD LDB ST STB LDBSE LDBZE

BYTES

4 5 4 5 4 4 4 4

STATEÀ TIMES

3 4 3 4 3 3 3 3

BYTES

60 40 70 50 80 90 84 94

INDIRECT¤ NORMAL AUTO-INC. OPCODE

BYTES

2 3 2 3 2 2 2 2

BYTES STATE TIMES

OPCODE

AND AND ANDB ANDB OR ORB XOR XORB

STATE TIMES OPCODE

OPERANDS

IMMEDIATE

MNEMONIC

DIRECT

63 43 73 53 83 93 87 97

4 5 4 5 4 4 4 4

6/11 7/12 6/11 7/12 6/11 6/11 6/11 6/11

5 6 5 6 5 5 5 5

7/12 8/13 7/12 8/13 7/12 7/12 7/12 7/12

A3 B3 C3 C7 BF AF

4 4 4 4 4 4

6/11 6/11 7/11 7/11 6/11 6/11

5 5 5 5 5 5

7/12 7/12 8/12 8/12 7/12 7/12

CB CF

3 3

11/15 14/18

4 4

12/16 14/18

CB CF

3 3

15/19 16/20

4 4

16/20 16/20

1. 0000H-3FFFH OPCODE EF 28-2FÃ F0 F7

BYTES 3 2 1 1

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

72

ELECTRONICS PROJECTS Vol. 20

2. 4000H-7FFFH

STATES 3. 8000H-BFFFH 4. C000H-FFFFH 13/16Ä The first group is meant for 13/16Ä EPROM area, which contains the moni12/16Ä

Notes:

quencies down to 4MHz could be used. Here an 8MHz crystal has been used. The actual system clock is one-third of the crystal frequency and the state time is thus 325 ns (250 ns with 12MHz crystal). Pins 11 and 37 are the ground or Vss pins while pins 38 and 46 are connected to positive 5 volts or Vcc. The reference voltage for the analogue-to-digital coverter section is applied at pin 45, which is also connected here to +5V. Pin 44 is the analogue ground pin. Though this has continuity with the digital ground or Vss, its track has to be separately brought out for inputting the analogue signals. The various high-speed input-output pins are given below for quick reference. Pin Pin designation/ no. function 3 HSI.0

while analogue channels 4 through 7 are available. Analogue input for channel 4 has been routed through a veryhigh-impedance op-amp CA3130 for use with very-low-level analogue signals. Also, full 8-bit ports are not available; only some bits are available for those ports. As with most Intel processors, the 8-bit data bus is multiplexed with the low order address lines. However, in the 8x9x, there are two versions of the address latch signal; one of them is called ALE and the other is called ADV. A 74LS373 IC is used for segregating and latching A0 through A7 signals from the AD0-AD7. The data bus is buffered using a 74LS245 bidirectional buffer. This is enabled by the RD signal for data flow direction towards the 8098 data bus. A dual 2-line to 4-line decoder IC, 74LS139, is used as address decoder for memory and input-output address range selection. Address lines A14 and A15 are used to select a set of four groups of memory addresses in one of the decoders in the 64k address range as under:

HSI.1 HSI.2 or HSO.4 HSI.3 or HSO.5 HSO.0 HSO.1 HSO.2 HSO.3 Port 2 bit 5 or PWM output Port 0.4 or analogue channel 4 Port 0.5 or analogue channel 5 Port 0.6 or analogue channel 6 Port 0.7 or analogue channel 7 Transmit data or Port 2 bit 1 Receive data or Port 2 bit 0 It may be noted that due to paucity of pins on this 48-pin chip, some pins assume a dual role, controlled by software, while some functions are missing (not available). For example, analogue channels 0 through 3 for analogue input are not available

tor program. The second address group is used for input-output devices, and therefore the ready pin 16 of the 8098 is brought low when this group is selected. This group is further subdivided into four smaller ranges in the second decoder of 74LS139 as under: 1. 4000H-4FFFH

2. 5000H-5FFFH

4 5 6 7 8 9 10 13 43 42 40 41 1 2

Fig. 6: Shows author’s prototype of 8098 development board

contact is debounced and valid code is available at A through D All conditional jumps are 2 byte instructions. They require 8 state times if the jump is taken, 4 if it is not. output pins of the IC. MNEMONIC OPCODE MNEMONIC OPCODE MNEMONIC OPCODE MNEMONIC OPCODE Simultaneously, ‘data JC DB JE DF JGE D6 JGT D2 JNC D3 JNE D7 JLT DE JLE DA available’ information JH D9 JV DD JVT DC JST D8 is output from pin 12 JNH D1 JNV D5 JNVT D4 JNST D0 of the IC. The output JUMP ON BIT CLEAR OR BIT SET data (A through D) and These instructions are 3-byte instructions. They require 9 state times if the jump is taken, 5 if is it is not. ‘data available’ pins are MNECONIC BIT NUMBER interfaced to bits 0 1 2 3 4 5 6 7 D0 through D3 and D7 JBC 30 31 32 33 34 35 36 37 JBS 38 39 3A 3B 3C 3D 3E 3F respectively of the LOOP CONTROL data bus via tri-state DJNZ OPCODE EO. 3 BYTES: 5/9 STATE TIMES (NOT TAKEN/TAKEN) buffer IC 74LS365 SINGLE RESISTOR INSTRUCTIONS for reading by the MNECONIC OPCODE BYTES STATES MNEMONIC OPCODE BYTES STATES microcontroller. There DEC 05 2 4 EXT 06 2 4 is another key called DECB 15 2 4 EXTB 16 2 4 the command key (CK), NEG 03 2 4 NOT 02 2 4 NEGB 13 2 4 NOTB 12 2 4 which is connected to INC 07 2 4 CLR 01 2 4 positive supply through INCB 17 2 4 CLRB 11 2 4 a pull-up resistor. SHIFT INSTRUCTIONS When this key is INSTR WORD INSTR BYTE INSTR DBL WD pressed, D6 bit beMNEMONIC OP B MNEMONIC OP B MNEMONIC OP B STATE TIMES comes low. Thus by SHL 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Æ pressing this key, toSHRA 0A 3 SHRAB 1A 3 SHRAL 0E 3 7 + 1 PER SHIFTÆ gether with the nuSPECIAL CONTROL INSTRUCTIONS meric (hex) keys, we MNEMONIC OPCODE BYTES STATES MNEMONIC OPCODE BYTES STATES get additional set of SETC F9 1 4 D1 FA 1 4 key codes. CLRC F8 1 4 E1 FB 1 4 The monitor softCLRVT FC 1 4 NOP FD 1 4 ware program reads RST FF 1 16 SKIP 00 2 4 the keyboard buffer at NORMALIZE NORML 0F 3 11 + 1 PER SHIFT address 5000H. The Notes: presence of any key-cloÅ 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 time sure is detected by the the program restarts at location 2080H D7 bit going high. The Æ Execution will take at least 8 states, even for 0 shift. command key closure is noted by looking at the 3. 6000H-6FFFH 4. 7000H-7FFFH ohms each. D6 bit status (low or high). The 74LS365 The 8000H and C000H groups are A keyboard encoder of the matrix type buffer is read by the RD signal at its each of 16k. Two 28-pin sockets are prois used for connection to the hexadecimal pin 15. vided for two RAM ICs. These could be keyboard. This is a 74C922 IC having its fixed with 8k static RAM such as the 6264 own scan oscillator. The 16 keys are arThe LCD Display Module or the 32k RAM 62256. One may also use ranged in a 4 x 4 matrix for hex digits 0 a RAM chip in the first socket and an through F. Whenever a key is closed, the The LCD module used in this project is EEROM (such as 2864A) in the second 16-character single-row type. The intersocket. The EEROM will permit permanal block diagram and dimensional detail TABLE IV nent storage of data or code. of a typical 16-character x 1-line LCD modPin Functions of LCD Module An 8-bit data output port using latch ule are given in Figs 4 and 5 respectively. Pin No. Function Level IC 74LS373 is provided to enable outThe display is a dot-matrix of 5 x 8 dots 1 VSS 0V putting of temporary data during pro2 VDD +5V for each character, with the bottom dot 3 VO 0.7V gram development. This port is at the line used for the cursor. The module works 4 RS 0=inst: 1=char address range 4000H-4FFFH. The clock with its own SMD LCD driver and con5 R/W 0 = write: 1 = read 6 E latch on fall for this 74LS373 IC is obtained by the troller LSI having internal memory com7 DB0 Databit 0 combining 4000H chip select signal prising character generator (CG) ROM 8 DB1 Databit 1 with WR signal in a NOR gate of and RAM as well as display data (DD) 9 DB2 Databit 2 10 DB3 Databit 3 IC 74LS02. For indication of the logic RAM. The data can be entered into this 11 DB4 Databit 4 level at the output pins of this 74LS373 module from the 8098 through the data 12 DB5 Databit 5 IC, eight LEDs are fixed on the board 13 DB6 Databit 6 bus. There is a separate instruction set 14 DB7 Databit 7 with current limiting resistors of 220 for the LCD module. Additional Software TABLE III Conditional Jumps

ELECTRONICS PROJECTS Vol. 20

73

play will show (on keying in B first):

TABLE V LCD Module Instruction Set Code Instruction Clear display Home cursor Entry set modes Display control Cursor or Display shift Function set and

80 00 xB

RS 0 0 0

R/W 0 0 0

DB7 0 0 0

DB6 0 0 0

DB5 0 0 0

DB4 0 0 0

DB3 0 0 0

DB2 0 0 1

DB1 0 1 I/D

DB0 1 x S

Comments Clears display and home cursor Returns cursor to home position Selects cursor direction and shift

0

0

0

0

0

0

1

D

C

B

Selects display, cursor and flash modes

0 0

0 0

0 0

0 0

0 1

1 DL

S/G N

R/L F

x x

x x

Moves cursor and shifts display Sets interface mode number of lines

CG RAM address

0

0

0

1

MSB

DD RAM address

0

0

1

Read busy flag and address

0

1

BF

Write data to CG or DD RAM Read data from CG

1

0

ACG

LSB

MSB

ADD

LSB

MSB

AC

LSB

MSB

Meaning of Bit Values BIT I/D S S/G R/L D/L N BF F

1 Increment Enable Display shift Shift to right 8-bit mode 2 lines Busy Not used

0 Decrement Disable Cursor move Shift to left 4-bit mode 1 line Ready 5 x 7 dots

is therefore required to meaningfully write information into the LCD module, i.e. characters, numbers, etc. The data byte is obtained from the character code map. (Refer page 50 of Apr’97 issue of EFY for character code map or construction project named as “microprocessor LCD module” in Electronics Project Vol. 18) The instruction set of LCD module is given in Table V. There are instructions for display setup, cursor positioning, setting the location of the next character, writing the character, reading the DD RAM, shifting the display right or left and even blinking the cursor, etc. For interfacing the LCD module, there is a 14-pin connector on LCD module. The data bus connects to pins 7 through 14 (DB0 through DB7). Pin 2 is connected to 5V and pin 1 is connected to ground. A contrast control potentiometer (10-kilo-

Write data

LSB

ELECTRONICS PROJECTS Vol. 20

80 00 B0

character font Selects CG RAM address Following data is stored in CG RAM Selects DD RAM address Following data stored in DD RAM Reads busy flag Indicates if module ready

Entries roll away to left and enable corrections to be made. To advance to the next address, the Command key and key 8 are pressed. That is, keeping the Command key pressed, numeric key 8 is pressed. The display will then show: 80 01 xx

If in place of Command key and 8 we press Command key and numeric key 7, data B0 is stored against address 8000H before advancing

Writes data into CG or DD RAM

ohm) connects to pin 3 of the module. The pin 4, register select (RS=0 selects instruction register and RS=1 selects data register) is connected to address line A0 to select one of the two internal registers. Pin 5 is the read/write (R/W) signal, obtained by inverting the RD in an inverter. Pin 6 is active high enable (E) signal. The chip select at address 6000H is inverted and connected to pin 6. Some LCDs come with 1 or 2 extra pins (pin nos. 15 and 16) for backplane illumination. In Lampex supplied modules pin 15 is connected to +5V via 33-ohm resistor while in Oriole and Crystlonics supplied modules , it is connected to ground. Pin 16 in Lampex module is grounded while the other two manufacturers do not use the same.

Software The listing of the monitor program is given in the Appendix ‘A’. Provision for entry of programs into the RAM memory, starting at address 8000H or anywhere else, and executing them is made. Upon power on, or pressing the reset switch, the LCD display shows: 80,000 xx

which means that the high address is 80H and the low order address is TABLE VI 00H. xx represents any ranCommand key and numeric key 1 Set high address dom data which may be Command key and numeric key 2 Set low address present in the RAM at adCommand key and numeric key 3 Execute program at dress 8000H. Using the Hex current display address keyboard, data can be entered Command key and numeric key 4 Decrement address Command key and numeric key 7 Store current data and against the displayed adincrement address dress. For example, if B0 is Command key and numeric key 8 Just increment address entered one by one, then dis-

74

and after keying in 0, the display will show:

PARTS LIST Semiconductors: IC1 - 8098, 16-bit Microcontroller IC2, IC7 - 74LS373 octal D-type latch IC3 - 74LS245 octal bus transreceiver IC4 - 2764, 8k byte EPROM IC5 - 6264, 8k byte static RAM IC6 - 74LS139 dual 1-of-4 decoder IC8 - ULN2003 high current drivers IC9 - CA3130 high input impedance op-amp IC10 - 74LS02 quad 2-input NOR gate IC11 - 74LS04 Hex inverter IC12 - 74LS365 Hex buffer driver IC13 - 74C922 keyboard encoder IC14 - 74LS26 positive Nand gate D1 - 0A91 detector diode D2, D3 - 1N4148 switching diode LED1-LED8 - Coloured LED Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1-R9 - 10-kilo-ohm R10 - 33-kilo-ohm R11, R12 - 10-kilo-ohm R13-R20 - 220-ohm R21 - 100-ohm R22 - 39-kilo-ohm R23 - 1-kilo-ohm VR1 - 10-kilo-ohm Capacitors: C1, C2 C3 C4, C5

- 33pF ceramic disc - 4.7µF, 10V electrolytic - 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

Appendix ‘A’ Monitor Program Addr

2000 2000 2002 2002 2004 2004 2006 2006 2008 2008 200A 200A 200C 200C 200E 200E 2018 2018 2019 2080 0018 0042 0043 0044 0045 0046 0048 0052 0054 0056 0058 2080 2080 2084 2088 208B 208F 2093 2096 2099 209C 209F 20A2 20A5 20A8 20AB 20AE 20B1 20B4 20B7 20B9 20BC 20BF 20C1 20C4 20C6 20C9 20CB 20CE 20D0 20D3 20D5 20D8 20DA 20DC 20DE 20E1 20E3 20E6 20E8 20EA 20ED 20EF 20F1

OpCode

Label

Mnemonics/Ass. Directives

; LCD MONITOR PROGRAM USING ; INTEL-8098 MICROCONTROLLER ; ASSEMBLER USED - Pseudosam 96 ; (Cross-Assembler for 8096, 98 and 196kc ; families) by PsedoCorp, USA. ORG h’ 2000 ORG h’ 2000 DBh’00,h’ 81 ; ; ORG h’ 2002 DB h’ 02, h’ 82 ; ORG h’ 2004 DB h’ 04, h’ 83 ; ORG h’ 2006 DB h’ 06, h’ 84 ; ORG h’ 2008 DB h’ 08, h’ 85 ; ORG h’ 200A DB h’ 0A, h’ 86 ; ORG h’ 200C DB h’ OC, h’ 87 ; ORG h’ 200E DB h’ OE, h’ 88 ; ORG h’ 2018 DB h’ 95 ;

0081 0282 0483 0684 0885 0A86 0C87 0E88 95

ORG h’ 2080 EQU SP, h’ 0018 EQU REG42, h’ 0042 EQU REG43, h’ 0043 EQU REG44, h’ 0044 EQU REG45, h’ 0045 EQU REG46, h’ 0046 EQU REG48, h’ 0048 EQU REG52, h’ 0052 EQU REG54, h’ 0054 EQU REG56, h’ 0056 EQU REG58, h’ 0058 A1C00018 A1008042 B24244 A 1026058 A 1006054 B13852 EF5800 B10E52 EF5200 B 10652 EF4C00 B24244 B10152 EF4300 EF6F00 EF4C00 994048 DB08 092C04 904448 27E7 994148 D705 B04344 27DA 994248 D705 B04342 27D0 994448 D704 0542 27C7 994748 D707 C64244 0742 27BB 994248 D70E E342 C65452

Comments

SC2: SC1:

D:

E:

F:

P:

G: CMD:

LD SP, #h’ 00C0 LD REG42, #h’ 8000 LDB REG44, [REG 42] LD REG 58, #h’ 6002 LD REG 54, #h’ 6000 LDB REG 52 #h’ 38 LCALL CMD LDB REG 52, #h’ 0E LCALL CMD LDB REG 52, #h’ 06 LCALL CMD LDB REG 44, [REG 42] LDB REG 52, #h’ 01 LCALL CMD LCALL DISPLAY LCALL KBD CMPB REG48, #h’ 40 JC D SHL 4, 44 ORB REG48, REG 44 SJMP SCI CMPB REG48, #h’ 41 JNE E LDB REG44, REG43 SJMP SC2 CMPB REG48, #h’ 42 JNE F LDB REG42, REG44 SJMP SC2 CMPB REG48, #h’ 44 JNE P DEC REG42 SJMP SC2 CMPB REG48, #h’47 JNE G STB REG44, [REG42] INC REG42 SJMP SC2 CMPB REG48, #h’ 43 JNE K BR [REG42] STB REG52, [REG54]

80 00 B0 TIMER OVERFLOW INTERRUPT VECTOR A/D CONVERSION

HSO EXECUTION HSI . 0 SOFTWARE TIMER SERIAL INPUT/OUTPUT EXT. INTERRUPT CHIP CONFIGRATION BYTE

SET STACK TO INT. “RAM” FIRST “RAM” ADDRESS EXT. GET DATA DATA REGISTER OF “LCD” COMMAND REG. OF “LCD” “LCD” FUNC. SET COMMAND WRITE COMMAND TO “LCD” DISPLAY CONTROL COMMAND

; “LCD” MODE COMMAND ; ; ; ; ; ;

Now we can enter a small sample program as given below: 80 00 A1 80 01 00

HSI DATA AVAILABLE

; STACK POINTER ; ; ; ; ; INTERNAL REGISTERS ; ; ; ; ; ; ; ; ; ; ; ; ;

to the next address location, i.e. 80 01. If now we want to decrement the address, command key and the numeric key 4 are pressed together and the display shows:

GET ADDRESS HIGH IN 44 CLEAR DISPLAY COMMAND TO LCD WRITE ADDR AND DATA IN SCAN AND GET A KEY IS KEYCODE> 48??

; ROTATE NIBBLE LEFT ; AND JOIN WITH NEW HEX ; COMPARE WITH KEY 41 ; SET HIGH ADDRESS ; COMPARE WITH KEY 42 ; SET LOW ADDRESS ; COMPARE WITH KEY 44 ; DECREMENT ADDRESS ; COMPARE WITH KEY 47 ; STORE IN RAM & ; INCREMENT ADDRESS ; COMPARE IF 43 KEY ; JUMP INDIRECT TO ADDR. ; WRITE INTO LCD

LD 80H, 4000H : load register 80 with 4000H : which is LED port address

80 02 40 80 03 80 80 04 B1

LD 70H,#55H

: to output 55 to LED port

80 05 55 80 06 70 80 07 C6

STB 70,(80)

: store contents of 70 into

80 08 80 80 09 70 80 0A 27 80 0B FE

SJMP $

: memory pointed to by 80, 81 : : loop here

In the above program, the addresses 70, 80 are internal RAM locations, called Internal Registers of the 8098. For outputting on the LED port, indirect addressing via contents of RAM locations 80, 81 has been employed. After entry of the above programs from address locations 80 00 through 80 0B, one can execute the program by pressing command key and then key no.3. The display would show: 80 00 B0 G _

which means that the program from start address 8000 H is going on. The interpretation of commands associated with Command key in combination with a numeric key are given in Table VI. Using the above commands it is possible to enter a program, read the entered program or execute a program starting at any address. If an EEPROM is fitted in the spare RAM socket (covering the address range C000H – FFFFH) such as 2864A, it is possible to write or read data to/from the EEPROM in the mentioned address range. It will retain the code even after switch off and thus help in development work. However, for reading stored data we must use Command key and numeric key 8 (refer Table VI) instead of the Command key and numeric key 7, as that would result in alteration of stored data because EEPROMs take time to write the data. Therefore while using EEPROMs, please remember to use: —Command key and numeric key 7 ... to enter fresh byte at current address ELECTRONICS PROJECTS Vol. 20

75

76

Addr

OpCode

Label

20F4

A1FF0556

20F8 20FA 20FC 20FD 2100

0556 D7FC F0 E7B000 A 1005046

2104

A24648

LD REG48, [REG46]

2107

3F48F6

JBS REG48, 7, KBD

210A 210D 2110

EF9300 A24648 3748F4

2113 2116 2119 211C

EF8A00 A24648 3748F1 714F48

21 IF 2120

F0 B04345

2123

180445

SHRB REG45, 4

2126

EF4000

LCALL ASCIIOUT

2129 212C 212F

B04345 710F45 EF3700

LDB REG45, REG 43 ANDB REG45, #h’ 0F LCALL ASCIIOUT

2132 2135

B12045 C65845

LDB REG45, #h’ 20 STB REG45, [REG58]

2138 213B

EF6500 B04245

LCALL DELAY LDB REG45, REG42

213E

180445

SHRB REG45, 4

2141 2144

EF2500 B04245

LCALL ASCIIOUT LDB REG45, REG42

2147 214A 214D 2150 2153 2156

710F45 EF1C00 B12045 C65845 EF4A00 B04445

ANDB REG45, #h’ 0F LCALL ASCIIOUT LDB REG45, #h’ 20 STB REG45, [REG58] LCALL DELAY LDB REG45, REG44

2159

180445

SHRB REG45, 4

215C 215F 2162 2165 2168 2169

EFOA00 B04445 710F45 EF0100 F0 990A45

216C 216E

D305 753045

2171 2173 2176 217A 217C 217E 2184 21A0 21A0 21A4 21A6 21A8 21B0 21B0 21B3 21B5 21B7 21BA 21BA

276B 753045 A1FF0556 0556 D7FC C65845 F0

AGAIN: K: KBD:

LOOP:

Mnemonics/ Ass. Directives

Comments

LD REG56, #h’ 05FF

; FOR DELAY LOOP COUNT

DEC REG56 JNE AGAIN RET LJMP INKEY LD REG46, #h’ 5000

LCALL DELAY LD REG48, [REG46] JBC REG48, 7, LOOP LCALL DELAY LD REG48, [REG46] JBC REG48, 7, LOOP ANDB REG48, #h’ 4F

RET DISPLAY: LDB REG45, REG43

LCALL ASCIIOUT LDB REG45, REG44 ANDB REG45, #h’ 0F LCALL ASCIIOUT RET ASCIIOUT: CMPB REG45, #h’ 0A JNC T ADDB REG45, #h’ 30

T: A1:

A1FF0556 0556 A2: D7FC F0

DELAY:

994848 D702 0742 E7EBFE

INKEY:

P1:

SJMPP ADDB REG45, #h’ 30 LD REG56, #h’ 05FF DEC REG56 JNEA1 STB REG45, [REG58] RET . ORG h’ 21A0 LD REG56, #h’ 05FF DEC REG56 JNE A2 RET . ORG h’21B0 CMPB REG48, #h’ 48 JNEP1 INC REG42 LJMP SC2

ELECTRONICS PROJECTS Vol. 20

; KEYBOARD INPUT ADDR. ; READ FROM KEYBOARD ; LAST LEY RELEASED? ; AWAIT A KEY PRESSING ; READ AGAIN KBD ; CHECK VALID KEY ; MASK KEY CODE WITH 4F ; GET HIGH ADDRESS ; UPPER NIBBLE SHIFTED ; CONVERT ASCII AND ; OUTPUT ; LOW NIBBLE ; CONVERT & LCD OUTPUT ; SPACE TO FOLLOW ; WRITE TO LCD DATA REG. ; FETCH LOW ADDRESS ; PICK UPPER NIBBLE ; & OUTPUT TO LCD ; AGAIN LOW ADDRESS ; GET LOW NIBBLE ; SPACE TO FOLLOW ; GET DATA FIELD ; PICK UPPER NIBBLE ; CONVERT AND OUTPUT ; DATA FIELD AGAIN ; LOW NIBBLE

—Command key and numeric key 8... to read already entered stored data. Some typical software programs worked on the development board which will demonstrate its proper usage: 1. Direct & Immediate register addressing The following instructions are used for loading and storing words. Note that the immediate data 1234 will go into registers such that 34 goes into even address 60 and 12 goes into odd address 61. Code A1 34 12 60 A0 60 50 C0 70 50 27 FE

Label

Here:

Mnemonics LD 60, #1234 LD 50, 60 ST 50,70 SJMP Here

Comments ; Immediate load regrs. 60, 61 ; with 1234 ; Load reg. 60 into reg. 50 ; Store reg. 50 into reg. 70

The following instructions are for loading and storing bytes. Code B1 AA 60 A1 60 50 C4 70 50

Mnemonics LDB 60, 0AAH LDB 50, 60 STB 50 , 70

Comments ; Immediate loading reg. 60 ; Load from reg. 60 into reg. 50 ; Store from reg. 50 into reg. 70

2. Register Indirect addressing Code Label A1 AA 55 50

Mnemonics LD 50, #55AA

A1 50 82 60

LD 60, #8250

C2 60 50

ST 50, (60)

A2 60 70

LD 70, (60)

27 FE

SJMP Here

Comments ; Immediate loading of data ; into 50,51 ; Immediate loading of data ; into 60,61 ; Store from 50,51 into ; address in 8250 & 8251 ; Load contents of 8250,8251 ; into ; registers 70,71

After running the above program at address 8000H, we can reset the system and examine memory: Address 00 70 00 71

Data AA 55

The above are word operating instructions. The following are byte operating instructions: 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

; FIND IS HEX VALUE>A?

C6 60 50

STB 50, (60)

; Store FF into memory

B2 60 70

LDB 70, (60)

; Load from memory into 70

; IF LESS THAN A, ADD 37

27 FE

SJMP Here

; FI HEX 0-9 ADD 30 ; FOR DELAY COUNT

Address 00 70

; WRITE INTO LDC

3. Indirect Addressing with auto increment The following program is for block movement from one memory area to another, in 08 words block. The source address is 8300H, and the destination address is 8400H.

; DELAY COUNT

Code

Label

Upon examining memory after running and resetting:

Code A1 00 84 80 A1 00 83 60 B1 08 50 A2 61 70

Data FF

Label

Read:

Mnemonics LD 80, #8400 LD 60, #8300 LD 50, #08 LD 70, [60]+

Comments ; Destination address in Reg. ; 80 ; Source address ; words in 50 ; Load [60] into 70 and ; increment ; 2 bytes

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. ELECTRONICS PROJECTS Vol. 20

77

Fig. 9: Component layout for the PCB of Figs 7 and 8. C2 81 70

ST 70, [80]+

E0 50 F1

DJNZ 50, Read

27 FE

Here:

; Store from 70, 71 into address ; 8400 and increment ; Decrement word count ; register ; and repeat read & store op.

Mnemonics Comments LD REG 1, #8420H ; Reg1 IS 50 ; Load word into 50,51 A3 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 1 A3 50 05 70 LD REG3, 5 [REG1] ; Load word pointed to ; by Reg1 +5 into Reg. ; 3(70) 27 FE Here: SJMP Here Long Range Indexing: C3 51 00 10 60 ST REG2, 1000H [REG1] ; STORE Contents of ; Register 2 at location ; pointed to by REG1 + 1000H

Label

5. Zero Register Addressing There is a zero register or SRF at 0000H, which always

78

Code Label A1 01 44 44 50

SJMP Here

4. Based or Indexed Addressing mode The 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 A1 20 84 50

contains only a zero. Use of zero register addressing is depicted in the following instruction:

ELECTRONICS PROJECTS Vol. 20

Mnemonics LD REG1 (50), 4444H [0]

Comments ; Load reg. 1 with the contents ; of 4444H+0H

This is just equivalent to a direct or absolute memory addressing. 6. Carry and Borrow in 8098 In 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 VII HSO Command Tag Format

D7 D6 D5 D4 D3 D2 D1 D0 X T D I n n n n Where X = Do not care T = Timer2/Timer1 D = Set/Clear HSO pin if relevant I = Interrupt On/Off nnnn = 0 - 5 = HSO0 - HSO5 nnnn = 6 = HSO0 AND HSO1 nnnn = 7 = HSO2 AND HSO3 nnnn = 8 - B = Software timers 8-B nnnn = E = Reset Timer 2 nnnn = F = Start ADC

; register 50 with value 55 ; If value is greater than 55, ; exit

JC exit

7. Use of Conditional Jump Instructions: JUMP IF CARRY JUMP IF EQUAL JUMP IF BIT SET JUMP IF BIT CLEAR

JC JE JBS JBC

The above are commonly used jump instructions which use short jumps from –127 to +128 only. P2 EQU 10H 8100H 35 10 03

E7 2A 01

JBC, P2, 5, NOTADD

; Port 2 is the SFR at ; 0010H ; If port 2 bit 5 (pin 13) ; is low, then branch ; NOTADD

LJMP ADD1

8240H

ADD1: . . . . .

Here, a long jump is taken to ADD1 if the bit No. 5 is not clear at port 2. Note that the ADD1 is at a distance given by: 8240H – 8106H = 012AH

which is the displacement in the LJMP instruction. A SJMP which can branch between –1023 and +1028 can be employed if the distance is not too far. In the code itself, the page 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 for positive values of offset (refer Table III). 8. Indirect branch instruction A1 00 50 50 E3 50

LD 50, #5000H BR [50]

;Branches to 5000H

The above is a method of branching to the address pointed to by a register (word). Now the branching takes place indirectly through 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 8200H F2 B1 10 80

TIME: PUSHF LDB 80, #10

; Load a register 80 with ; 10 A1 FF FF 90 LOAD: LD 90, #0FFFFH ; Load word FFFF into reg. ; 90 05 90 A: DEC 90 D7 FC JNE A E0 80 F5 DJNZ 80, LOAD ; Decrement and jump to ; LOAD F3 POPF F0 RET

The inner loop uses a word decrement operation for which the DJNZ cannot be employed. It works only up to FF. Like Jump, there are two Call Instuctions: SCALL for short distances -1024 to +1023 LCALL for anywhere in memory (uses 3 bytes of code) 10. Multiply and Divide Instructions There is a three-operand instruction called MUL. It uses two-word registers, multiplies their content and puts the product in another 32-bit register. For example: MUL IREG, WREG1, WREG2

Here let IREG equal 30H, WREG1 equal 40H, and WREG2 equal 50H. The values used are supposed to be two’s complement signed numbers and the result is a two’s complement 32bit number. 8000H

FE 27

4C FE

50 40 SJMP $

30 ;Halt

MUL 30, 40, 50

The MULB instruction multiplies signed bytes. For example: 8000H

FE 5C 50 40 30

MULB 30, 40, 50

This instruction would multiply the two bytes in 40 and 50 and place the word result in 30 and 31 (low order and high order). The MULU instruction is meant to be used for unsigned integers, for word operation and MULUB for byte operation. Divide instructions available are DIV, DIVU (unsigned) for word and byte operations respectively. DIVB is for byte operation (signed) and DIVUB for unsigned division respectively. For example: FE 8C 40 30

DIV IREG, WREG

; Divide 32-bit integer in IREG ; by 16-bit integer in WREG

Here 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) = 02 00 01 . . . is stored in location 40, 41 (00 in 40 and 01 in 41)

Result after program execution is in word at location 30 as 0200H, or 512. Remainder is in word at location 32 as 0040 H or 64 (dec). Some Programs Using High-speed Output: There are six HSO usable pins in the 8098, from HSO.0 to HSO.5. In addition, high-speed output function can also be associated with ‘Software timers’ and ‘starting of A/D conversion’ at a predetermined time. The software timer interrupt can be employed for realising the function of something like a darkroom stop-watch, which can be set to ring at a predetermined time. The following program illustrates this application. It causes the LEDs of port 4000H on the board to flicker at one second intervals. In using HSO functions, the following registers of the SFR are important: MINT ...Mask interrupt register 08H PINT ...Pending inerrupt register 09H HSOCMD ...HSO Command register HSOTIME ...The HSO time from current time Addr. Code Mnemonics Comments 8000H FA DI ; Disable interrupt 8001 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 ELECTRONICS PROJECTS Vol. 20

79

800F 8013 8016

A1 00 40 72 C6 72 74 FB

801A

27 FE

; with a time of 65 ms later LD 72, #4000H; LED Address is 4000h LDB 74, #00 ; 0 is stored in 74H EI ; Enable ; interrupt 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 jump from there to RAM location at 810AH. 810AH 0D 12 15 18 1B 1E

B1 38 06 45 00 80 0A 04 E0 50 09 B0 60 50 95 FF 74 C6 72 74 F0

LDB HSOCMD #38 ; Again replace the command ADD HSOTIM, T1, #8000 ; reload the number DJNZ 50, RET LDB 50, 60 XORB 74, #FF ; Toggle the LEDs STB (72), 74 RET

Upon executing this program, the port LEDs flicker at 1-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 Pulse Width in HSI. As an application of pulse generation using HSO and reading the pulse width using HSI, both input and output units are used. The main program can be any other program (multi-tasking). Addr. 8000 8001 8004 07 08 0B

0E

11 14 17 19 1C 1E 21 23 27 2B 2E HSO

8306 0A

80

Code Label FA B1 08 08 EF 03 03 FB EI B1 01 15

Mnemonics Comments DI ; Disable interrupt LDB MINT, #8 ; HSO alone int. enabled LCALL LDCAM ; CAM LOAD Routine

LDB IOC0.1, #01 ; IOC0 = 15, Bit 0 is 1. ; enables HSI. 0 B1 03 03 LDB HSIMODE, #03 ; 00000011 both edges to ; look in the pulse 36 16 FD JBC 16, 6, $ ; 16 is HSISTAT, bit 6 is ; FIFO full ; wait till 6 edges are ; detected 39 06 05 JBS HSISTAT, 1, P ; Is HSI.0 = 1, then it is ; positive edge A0 04 70 LD 70, HSITIME ; Dummy read to omit the ; negative edge FD FD NOP (2) A0 04 3A P: LD TIHI, HSITIM ; Read time of + edge into ; 3A FD FD NOP (2) A0 04 38 LD TILO, HSITIM ; Time at -ve edge into 38 FD FD NOP (2) 48 3A 38 30 SUB 30, 38, 3A ; Subtract 38-3A TO find ; pulse width A1 00 40 72 LD 72, # 4000H ; Load address C6 72 30 STB 30, 72 ; At 4000H into 72H ; and 27 FE SJMP $ ; Loop here ISR: VECTORS FROM 2006H HSOTIM EQU 15H HSOCMD EQU 06H EF 01 00 LCALL LDCAM F0 RET B1 20 06 LDCAM: LDB HSOCMD #20h

ELECTRONICS PROJECTS Vol. 20

; 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 CONVERSION PROGRAMS There are four channels of analogue input. Each channel gives a 10-bit at a conversion time of 42 microseconds. The range of input voltage is 0 to 5V. The various registers concerning A-D conversion are: A/D A/D A/D

COMMAND RESULT RESULT 02H = Bits 0-2 Bit 3

. . . 02H (WRITE) . . . 02H (READ) . . . 02H (HIGH bits and status information) x|x|x|x|G|2|1|0 : channel number; : 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 not available on the 8098) now. So, enter xxxx1100 on register 02H (AD.command) Result: 03H 02H D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D0 D1 9 8 7 6 5 4 3 2 1 0 x x S 2 1 0 <------- analog digitised value ------>

â <--ch. no--> Status 0 = idle; 1 = busy

A/D program for one channel: 8000H B1 0C 02 FD FD FD 3B O2 FD A1 00 40 70 C6 70 03 27 EE

B: LDB ADCOM #0C ; Start now, ch. 4 NOP NOP NOP $: JBS, 3, 02h, $ LD 70H, #4000H ; Led port addr. in 70H STB 03H, (70) ; Output to LEDs SJMP B ; MS byte only

The above program takes samples and displays the most significant 8 bits of the analogue value on the LED display continuously.

PCB Layout The actual-size component-side and solder-side track layouts for the schematic diagram of Fig. 3, except the LCD and keyboard interfaces, are given in Figs 7 and 8 respectively. The component layout for the PCB is given in Fig. 9. Please note that IC8 (ULN2003) is not used in PCB. If required it may be wired externally from connector. ❏

REMOTE-CONTROLLED AUDIO PROCESSOR USING MICROCONTROLLER VINAY CHADDHA

M

ost hi-fi audio CD systems nowadays are available with remote control. However, no such circuit is available for adding to the AF power amplifiers made as hobby projects. The design of such an add-on circuit along with remote control is presented here. It can be used by hobbyists as an attachment to their audio power amplifiers. This design is based on audio controller TDA7315 from SGS-THOMSON and Motorola microcontroller MC68HC705KJ1. The microcontroller, after programming with the specific software code for the current application, has been renamed GVCAUD-257. Other construction projects by the author using the same series of microcontrollers, which can be referred to for additional details, have been published in EFY in Jun. ’97 (Set-Top Converter) reproduced in Electronics Project Vol. 18 and Caller ID project, elsewhere in this volume. In addition to audio controller and microcontroller the circuit comprises the following standard parts that are used in any normal system: 1. Power supply 2. LED indicator panel to indicate status/keys pressed 3. Relay to switch on/off the supply to the power amplifier or the main unit The following parts are used in remote systems for VCR, TV, etc: 1. Memory (24C02). 2. Remote handset with 12 keys 3. IR receiver for remote operation Functionality of these parts is explained below with reference to Figs 1 and 3.

Description Memory. 24C02 is an I2C bus compatible 2k-bit EEPROM, organised as 256 x 8 bits.

It can retain data for a period of more than ten years, including the current settings of volume, treble, balance, bass, as well as the on/off status of the main amplifier unit or the relay status. The various audio parameters can be stored in just six bytes. Mains power failure is quite common in India. This does not allow the last settings of volume, tone and balance to remain intact. To overcome this the microcontroller unit (MCU) must store all audio settings of the user in memory (EEPROM). The memory ensures that even after a power trip, the MCU will read the latest saved settings from the EEPROM. Using two lines, SCL (serial clock) and SDA (serial data), the microcontroller can read and write six bytes for all the audio parameters. For more details on I2C bus and memory interfacing, please refer to Caller ID construction project, elsewhere in this volume. At power ‘on,’ the last-saved audio settings are read by the MCU. In case memory IC cannot be read by the microcontroller, volume LED will blink three times to indicate the problem. The possible reasons could be either a bad memory IC, or a discontinuity/shorting of its tracks, or improper insertion of the IC in its socket. Under the circumstances, the unit will still work, but it will not remember the last settings and will select the centre values of treble, balance and bass. Volume will be set at 50 per cent of the maximum value and the relay will be off. Loudness and mute will also remain in the off mode. A remote handset can be used to change the settings as desired. Audio controller. TDA7315 is a single-chip I2C bus-compatible audio controller which is used to control all functions

PARTS LIST Semiconductors: IC1 - TDA7315 digitally controlled audio processor IC2 - MC68HC705KJ1CP Motorola microcontroller (GVC-AUD-257) IC3 - 24C02 I2C serial EEPROM IC4 - 7805 fixed regulator +5V IC5 - 7809 fixed regulator +9V IC6 - µPD6121 infrared remote control T1,T2,T3 - BC547 npn transistor T4 - 2SC2001 npn transistor D0-D7 - Red LED D8, D10-D11 - 1N4007 rectifier diode D9 - 8.2V,0.5W zener D12 - IR LED Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1,R2,R15,R16- 10-kilo-ohm R3,R4,R14 - 1-kilo-ohm R0,R5-R9, R12,R13 - 330-ohm R10,R11 - 5.6-kilo-ohm R17 - 2-ohm, 0.5W R18,R19 - 200-kilo-ohm Capacitors: C1 C2-C4,C7, C19,C20 C15,C16,C9, C10,C11,C13 C5,C6 C8 C12,C14 C17,C18 C21,C22 C23

- 10µF, 16V electrolytic - 0.1µF ceramic disc -

0.1µF polyester 33pF ceramic disc 22µF, 25V electrolytic 2.7nF polyster 2.2µF, 16V electrolytic 220pF ceramic disc 10µF, 50V electrolytic

Miscellaneous: RL1 - 12V, 150 ohm, SPST relay OEN Pt. No. 57DP-12-1C6 XTAL - 4MHz quartz crystal Y - 455kHz, ceramic resonator - Battery 1.5V, pencil cell - IR sensor module - Remote control handset, complete with keyboard - Connectors for audio inputoutput and power supply - 12V DC, 250mA battery eliminator

ELECTRONICS PROJECTS Vol. 20

81

Fig. 1: Schematic diagram of remote-controlled audio processor using microcontroller

of the audio amplifier. Stereo audio input from the preamplifier is fed to the IC input. A microcontroller can control volume, treble, balance, bass and loudness. All these parameters are programmed by microcontroller using SCL and SDA lines, which are the same lines as used for the memory IC, as mentioned earlier. The audio controller reference data is given in Table I. To program any of the parameters, the following interface protocol is used for sending the data from the MCU to TDA7315. The interface protocol comprises: • A start condition (S) • A chip address byte (80H) followed

82

ELECTRONICS PROJECTS Vol. 20

weightage of bits representing audio paby an acknowledgement bit (ACK) rameters, are shown in Table III. For • A sequence of data bytes, with each sending the address and complete funcbyte followed by an acknowledge-ment bit tional parameters (six) of Table III, the • A stop condition microcontroller has to send seven bytes of For explanation of start, acknowledgment and stop conditions of I2C TABLE I The Audio Controller Reference protocol, elsewhere in Value this volume. A typical Parameter 6 to 10V DC, 9V typically message format, com- Supply voltage 2 V minimum prising an address byte Max input signal Total harmonic distortion 0.01 % typical, 0.1% maximum and two data bytes, is Signal-to-noise ratio 106 db typical shown in Table II. Channel separation 103 db @ 1 kHz Address byte and Volume control 1.25 db step 0 to –78.75 dB audio parameters of Bass and treble control 2 db step +14 to –14 dB 0 to –38.75 dB TDA7315, showing the Balance control 1.25 db step 100 dB typical coding as well as Mute attenuation

TABLE II MSB …… TDA7315 …… ADDR…… LSB

S 1

0

0

S = start condition

0

0

0

0

MSB ……

0

ACK = acknowledgement

DATA…….

A X X X X X C K P = stop condition

LSB

MSB……

DATA……..

LSB

X X X A X X X X X X X X A P C C K K

X = any hex digit

Fig. 2(b): Software flow chart (contd.)

number adds attenuation of 1.25 dB. Speakercontrol (L) byte. Any number from 128 to 159 (80H to 9FH) can be sent. Minimum attenuation for left channel is at 128(80H).

Fig. 2(a): Software flow chart (contd.)

data as well as start and stop condition bits through I2C bus. The acknowledgment bit, after receipt of every byte, is sent by the slave unit (TDA7315 in this case). Details of each audio control byte are discussed below: Volume-control byte. Any number from 00 to 63 (or 3FH) can be sent (programmed). Minimum attenuation is achieved with 00H. Each increment in

Each increment in number adds attenuation of 1.25 dB. The maximum attenuation is typically 37.5 dB. Speaker-control (R) byte. Any number, from 160 to 191 (0A0H to 0BFH), can be sent. Minimum attenuation for the right channel is 160(0A0H). Each increment in number adds an attenuation of 1.25 dB. The maximum attenuation is typically 37.5 dB. Loudness byte. It has only two possible values. When 64(40H) is sent, it sets the loudness on and when 70(44H) is sent, it sets the loudness off. Bass control byte. Any number, from

TABLE III MSB 1 0 0 0 0 B2 1 0 0 1 0 1 0 1 0 0 1 1 0 1 1 Bx = 10dB steps

0 B1 B1 B1 X 0 1

0 0 B0 A2 B0 A2 B0 A2 X L C3 C2 C3 C2 Ax = 1.25dB steps

LSB 0 0 A1 A0 A1 A0 A1 A0 X X C1 C0 C1 C0 Cx = 2dB steps

FUNCTION TDA7315 Chip address = 80H Volume control byte Speaker control (L) byte Speaker control (R) byte Loudness byte Bass control byte Treble control byte X = Don’t care

ELECTRONICS PROJECTS Vol. 20

83

Fig. 2(c): Software flow chart (continued)

96 to 111 (60H to 6FH), can be sent. This can change the bass range from 14 dB gain to 14dB loss (attenuation). Treble-control byte. Any number, TABLE IV Bass byte 96(60H) 97(61H) 98(62H) 99(63H) 100(64H) 101(65H) 102(66H) 103(67H) 111(6FH) 110(6EH) 109(6DH) 108(6CH) 107(6BH) 106(6AH) 105(69H) 104(68H)

84

Treble byte 112(70H) 113(71H) 114(72H) 115(73H) 116(74H) 117(75H) 118(76H) 119(77H) 127(7FH) 126(7EH) 125(7DH) 124(7CH) 123(7BH) 122(7AH) 121(79H) 120(78H)

Gain(+) /Attn(-) -14 dB -12 dB -10 dB -8 dB -6 dB -4 dB -2 dB 0 dB 0 dB +2 dB +4 dB +6 dB +8 dB +10 dB +12 dB +14 dB

ELECTRONICS PROJECTS Vol. 20

from 112 to 127 (70H to 7FH), can be sent. This can change the treble value from 14 dB gain to 14 dB attenuation. Table IV gives the gain/attenuation for various values of bass and treble bytes. Thus to have volume at 10 dB attenuation with perfectly balanced sound, i.e. both speakers at equal level, loudness on and maximum treble and minimum bass, the message to be sent by the MCU to the TDA7315 on the I2C bus would be as follows: START80-08-80-A0-40-78-60-STOP (Note: Normally, in the I2C interface data changes state only when the SCL signal is low. However, ‘start’ and ‘stop’ are special conditions, which indicate start of I2C activity and end of I2C activity respectively on the bus. In start condition, SDA goes from high to low when SCL is high. In a stop condition, SDA goes from low to high when SCL is high. Refer Apr. ’99 issue of EFY for details.) Microcontroller is programmed to check this IC (TDA7315) at power on. If the microcontroller cannot communicate with it through the I2C bus, it will indicate the error by flashing treble LED three times at power on. In this case audio values cannot be changed as communication between the microcontroller and the audio 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 commands from the remote handset, program audio controllers as per the commands, and update the EEPROM if no new command is given from the handset for six seconds. However, for on/off and mute commands, it will update the EEPROM data immediately. The delay in updating the EEPROM is provided as normally the listener will change the value continuously till he is satisfied. The MCU will, however, not transfer all values (from RAM to EEPROM) as and when these are changed. Only when no key is pressed for six seconds, will the MCU assume that the listener is satisfied and save the audio values in the EEPROM. This 16-pin microcontroller from Motorola (68HC705KJ1), used in this project, has a total of 11 I/O lines/pins. Two pins each are used for power supply and crystal while one pin is used for reset function. Balance lines are available for any programming functions. Out of 11 I/ O lines, eight lines are exclusively used for LED outputs. Relay RL1 used for switching the mains supply to the output power amplifier shares the same line (PA0), which is used for STDBY LED D0 output. Two lines are used for I2C bus which are connected both to the EEPROM as well as the audio controller. One line (IRQ) is connected to the IR sensor output. In fact, this pin serves the dual purpose of being used as an interrupt as well as an input pin whose status can be read by the MCU. The data sent from the remote handset is received at this pin. The microcontroller also checks the functioning of the memory IC ST24C02 and the audio controller IC TDA7315. If it is not able to communicate with these two ICs on the I2C bus, it flashes the volume and treble LEDs respectively to indicate that communication is not possible with the respective ICs. Refer the assembly and testing section for more details. Remote control (Fig. 3). Remote control is based on NEC µPD6121 customised remote transmitter IC. This IC is also used by a number of TV manufacturers. The handset sends data in a specified format whenever any key is pressed on the handset. The MCU reads the data and decides which key has been pressed. In this project, 12 keys have been used: 1. Loudness 2. Treble up 3. Balance right 4. Balance left 5. Bass up 6. Power on/standby

Fig. 2(d): Software flow chart (continued)

7. Audio centre 9. Treble down

8. Bass down 10. Mute

Fig. 3: Schematic diagram of remote control

11. Vol up 12. Vol down Standby, loudness and mute keys are toggle keys, i.e. if you press them once, they will change the current state. For instance, pressing the loudness key when loudness is already ‘on’ will cancel loudness. Volume, treble, balance and bass keys are repeat keys. If you press them once and keep them pressed, the selected function keeps on repeating.

For instance, if you press the vol up key and keep it pressed, the volume will keep on increasing until it is maximum. The audio centre key is the selection key. Pressing it once will cause it to set all audio parameters in centre. Pressing it again will have no further effect. It will not cancel the audio centre mode, unlike the standby, mute or loudness keys. Remote handset circuit diagram is similar to that used for the Set-Top Converter published in Jun. ’97 issue of EFY (reproduced in Electronics Projects Vol. 18). The only difference is that one of the two 200 kilo-ohm resistors is now connected to pin 12 in place of 13 of IC µPD6121. Also, the key names are different and only 12 keys are used instead of 21 in set-top converter. Transmission code. The remote’s transmission code consists of a ‘leader pulse,’ ‘16-bit customer code’ and ‘16-bit data code.’ The carrier frequency with 455kHz ceramic resonator is 38 kHz (1/12 f0, where f0 is resonator’s fundamental frequency). The code used is based on pulse position modulation (PPM). The leader pulse consists of a 9ms carrier waveform (w/f) followed by 4.5ms off period. A ‘logic 0’ consists of 0.56ms of carrier w/f followed by 0.56ms of off period, and a ‘logic 1’ consists of 1.125ms of carrier w/f followed by 1.125ms of off period. Each code byte (starting with LSB) is followed by inverse code byte to give an extremely low-error rate. The customer code (also referred to as custom code) of µPD6121 suffix G-001 can be configured as follows: The first byte (high-order byte) bits are all zeros (00000000) if no diode is placed between K I/O pins and CCS pin (cathode towards CCS). For instance, if a diode is placed across K I/O1 and CCS then the higher order byte will become 01000000 (starting with LSB) or 02H. The low-order byte will be inverse (10111111) of the highorder byte, unless K I/O pins are pulled to Vcc. For instance, if only pin K I/O5 is pulled high then the bit at that position only will not be reversed. Thus the low-order byte will become 10111011 (starting with LSB) or DD (Hex). With the above-mentioned diode and pullup resistor, the 16-bit custom code would be 02DD (Hex). So, you can ELECTRONICS PROJECTS Vol. 20

85

Fig. 4: Actual-size single-sided track layout for the schematic of Fig. 1

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

figure out how the custom code for the present remote control circuit has been arrived at. The key code for each key is annotated on the keys in Fig. 3. Grounding of SEL pin 7 results in bit D7 of key code to be set to 1. Hence, key at intersection of row 0 and column 0 would generate 80H as the key code. Complete remote code table for the present circuit configuration is given in Table V.

86

ELECTRONICS PROJECTS Vol. 20

IR receiver module. This is a 3-pin device incorporating surface mount IC. Two pins are for +5V supply and ground while the third pin is for data output. IR receiver module receives the data sent by remote handset, amplifies, demodulates and converts it to MCU-compatible voltage format and outputs it on its data output pin. The MCU can decode this signal and act as per the key pressed.

Relay. This relay is used to switch off the main power amplifier circuit. Thus, when the unit is switched off from remote, supply to the amplifier circuit is switched off, and this saves electricity. Only the circuit in this construction article remains active and waits for any remote key operation. Relay can be used to control AC supply or DC supply of the amplifier as desired. This choice is left to

TABLE V Remote Code Table Custom code Power (PWR) Mute (MUT) Treble up (TR+) Treble down (TR-) Bass up (B+) Bass down (B-) Volume up (VL +) Volume down (VL -) Balance left (BL) Balance right (BR) Audio centre (AC) Loudness

00 7E 85 8F 88 8B 81 83 93 97 94 90 86 80

the reader assembling the circuit. Relay and standby LED share the same pin from the microcontroller as stated earlier. LED indicator panel. Eight LEDs are used in the circuit. Their functions are: Standby. This LED is on when the unit is in standby mode (power amplifier off). When this LED is on, all other LEDs will be off and all keys, except the standby key, are rejected. Pressing the standby key, in this state, will switch the unit on. Mute. This LED is on when the unit is in the mute mode. Pressing the mute key 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 the unit is in sound mode, i.e. when any key which changes the volume level is pressed (e.g. vol down, treble up/treble down, bass up/bass down, balance up/balance down, loudness and audio centre).

Loudness. This LED is on when the loudness mode is on. Pressing the loudness key will change the state of LED and unit—from loudness on to loudness off or loudness off, to loudness on. Pressing audio centre key will switch off this LED (if on) and set the loudness off. Audio centre. This LED (marked flat) goes on when the audio centre key is pressed. All tone parameters are set at normal, i.e. zero-attenuation for speakers, with bass and treble at 0 dB (no gain/ no attenuation) and loudness is switched off. Mute is cancelled if active. Just flat frequency response. Volume remains undisturbed. Changing treble/balance/bass/ loudness level from the remote controller will switch off this LED. Volume. This LED is on when the vol up/vol down key is pressed. The LED goes off as soon as the key is released. Treble. This LED is on when the treble up/treble down key is pressed. The LED goes 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 balance left or balance right key is pressed. The LED goes off as soon as the key is released. Power supply. The unit requires +5V regulated supply for all three major components—MCU/ EEPROM/IR Sensor. The audio controller requires +9V for the audio amplifier section. Supply design uses

external +12V adaptor and two linear industry-standard regulators, 7805 and 7809. External +12V DC is also used for relay driving. So, make sure that the adaptor is capable of catering for the relay load easily. On full load, its voltage should not drop below +11V DC.

Assembly and Testing Complete circuit comprising the MCU, the memory, the audio controller and the IR receiver, as also the power supply circuit, is shown in Fig. 1. Actual-size, single-sided PCB for the circuit of Fig. 1 is shown in Fig. 4. The component layout for the PCB is shown in Fig. 5. No PCB is shown for remote. However, suitable pre-assembled remote control for the project is proposed to be made available to readers through Kits‘n’Spares outlet. The circuit is very simple, having very few components. Before installing the main ICs for MCU, memory, audio controller in their sockets and soldering the IR receiver module, make sure that supply voltage is correct. All parts, except the audio controller, require +5V as logic supply. The audio controller requires +9V supply for the audio control section. The remote can be operated with two 1.5-volt pencil cells. The unit has built-in diagnostics, which will make the job of testing very easy. Use Table VI to test the unit and identify/rectify faults.

TABLE VI Indication All LEDs blink thrice but remote does not function No LED blinks Vol.LED blinks thrice Treble LED blinks thrice Vol &Treble LED blink thrice

Possible Fault And Remedial Action Micro controller OK. Check infra-red sensor connections or remote handset. Check supply voltage/crystal connection to MCU/pull up resistance and capacitor at reset pin of MCU. Replace 24C02, check supply, SCL/SDA lines to 24C02 Replace 7315, check supply SCL/SDA lines to TDA7315 Check pull up resistance on SDA.Replace 24C02 and TDA7315. Check SCL and SDA lines

For commercial reasons the software for the project, which is intellectual property of the author, is not included. However, logical flow charts of the software are given in Figs 2(a) through 2(d), which are quite self-explanatory. ❑

ware, software, and documentation for developing projects using Motorola MC68HC705KJ1 MCU? Are there any books available on this microcontroller and I2C bus technology? Somnath Bhattacharyya Calcutta ❏ What should be put in place of the sensor module for IR sensing? ❏ Where is the entire assembly of the project to be connected in an audio system (CD system for example)? ❏ How can I get data-sheet of processor

6121 (not available at Internet site of NEC)? Ronak Chokshi Baroda ❏ Is TDA7315, which after programming is renamed as GVC-AUD257, readily available in the market? ❏ Is the remote set with key-pads and cabinet available with Kits‘n’Spares? ❏ What is the change observed when 200k resistance is connected to pin 12 or pin 13 of IC 6121 in remote control? ❏ I think there is no I/O pin free in the

Readers Comments: ❏ Can I use an IR sensor of the type used in Philips CTV in the circuit? ❏ Is it possible to add a key-pad at the processor board, so that it can be operated even without a remote control unit? ❏ Can we have PCB layout of remote transmitter unit? ❏ Could you tell me from where to get ready programmed microcontroller for the circuit? ❏ Could I have addresses of vendors who can supply development tools, hard-

Software flow chart

ELECTRONICS PROJECTS Vol. 20

87

microcontroller. How can functions such as play, stop, skip for CD, and CD/TAPE/ FM be performed? Rajeesh Kr. Verma Meerut Cantt ❏ What is meant by ‘I2C bus’? ❏ Is any buffer required before or after the processor for impedance matching? ❏ Can you suggest similar control for ‘deck front panel?’ ❏ What is the difference between crystal and resonator? ❏ What do you mean by renaming of processor as GVC-AUD257 after programming? A.G. Babu Lakshadweep ❏ Is the audio controller in-built with audio power amplifier? ❏ Are the left and right outputs from audio controller TDA7315 again fed to the power amplifier? Sandeep A. Salunkhe Pune ❏ I feel the IR receiver details are purposely witheld. This amounts to falsely enticing a reader to buy the magazine. Aroon Kakad [email protected] The author, Vinay Chaddha, replies: Mr Bhattacharyya can use IR sensor of Philips TV. But in this circuit it is not possible to add local key-pad. The microcontroller used in this circuit has limited number of I/O pins and memory which are not sufficient for adding local keyboard routines. The complete kit of remote control unit and programmed microcontroller may be procured through Kits‘n’Spares. He can download all relevant data from Websites of Motorola, Philips, and SGS-Thomson. Development kit for microcontroller KJ1 is available through Motorola’s authorised distrbutors. Regarding Mr Chokshi’s queries, sensor module for IR are available from Kits‘n’ Spares as well as local markets in Delhi and Mumbai. These may be available from TV repair workshops in your city also. This system is to be used after pream-

88

ELECTRONICS PROJECTS Vol. 20

Fig. 1 Block schematic and pin configuration of Telefunken IR sensor (Rxr) module

plifier and before power amplifier. In a readymade system, preamplifier outputs are usually marked as line output. 6121’s data-sheets are available with EFY. (The data-sheets comprise 22 pages. These can be provided on payment of Rs 50 by DD (in favour of EFY Enterprises Pvt Ltd) to cover postage and handling charges. —Editor As for Mr Verma’s questions, GVCAUD257 is available with Kits‘n’Spares (as part of kit) and is not available in local market. Remote set is also available from Kits‘n’Spares. 200k resistance is added for generating custom code in remote handset. If custom code is changed by changing resistance positions, the microcontroller will not respond to the remote handset. For additional functions, a different microcontroller with more pins and memory is required. KJ1 version cannot be used for additional functions. Regarding the queries of Mr Babu, some details regarding I2C bus are available in the construction article by the author published in April ’99 issue of EFY or elsewhere in this volume. No special impedance matching is required. Logic tape decks specially designed and manufactured for remote control operations are not easily available in India. However, it is possible to use a different microcontroller with more memory and I/O pins to control it. That is a big project which cannot be handled through these columns.

Crystal is more accurate and expensive compared to resonator which is lowcost and not very reliable or accurate. Renaming of the processor is similar to a blank audio cassette being recorded with songs in your own voice and then putting some specific label to indicate what it contains. Mr Salunkhe may note, there is no in-built power amplifier. Separate power amplifier is required at the output of TDA7315. Regarding Mr Kakad's queries: The description of IR receiver modules have been covered in a number of EFY issues, in detail. Please go through ‘IR Remote Control’ project published in Dec. ’97 (Electronics Projects Vol. 18) and Jun. ’98 (Electronics Projects Vol. 19). These have also been covered in Jun. ’99 circuit idea titled ‘Simple Sensitive Remote Control Tester’ (elsewhere in this volume). Such IR receiver modules manufactured by various firms (Sharp, Sony, Telefunken, etc) are used in most remote TV and VCP/VCR sets and hence are no secret. The pin configuration (positive, ground, and signal terminals) in these modules differ from one manufacturer to the other. The internal block diagram of Telefunken model IR sensor and its pin configuration are given in Fig. 1. One may substitute the IR sensor module with IC µPD1373 (used in conjunction with a photo-diode—refer EFY May’98 or Electronic Project Vol. 19). Also refer the Q/A section following for some more information. —Tech Editor ❏

SOUJUNIOR — A WIRELESS PROGRAMMABLE CONTROL UNIT T. GAUTHAM KUMAR

O

ne of the most exciting and adventurous expeditions of this century was done not by a human being but by a small machine called Soujurner. It was a kind of rover that traversed all the ridges and grooves on a planet whose terrain was unknown to the man of yesteryears. Well, before you begin to think that a science fiction story is going to be told, the author would like to enlighten you about the relevance of Soujurner to this project, Soujunior. The basic technology of Soujurner, as all technicians might know, consists of a receiver unit that receives signals or commands from humans on earth and executes the instructions on the remote planet. It also has an on-board microprocessor which helps it to take decisions on its own, in environments that are alien to human kind. In this project a similar concept is used. Although it would not be as complex as the Rover, it serves its purpose.

Description This project basically consists of the following modules (refer block diagram of Fig. 1). 1. A PC from which information is transmitted to the control unit wirelessly, using either IR or RF beam. 2. An 8085 control unit receives the signals serially and executes the instructions after it receives the execute command from the PC. The microprocessor

Fig. 1: Block diagram of Soujunior

board may be replaced by a conventional 8085 kit, but the port addresses have to be modified in the software accordingly. 3. An IR or a RF link. Here an IR link has been used to reduce the complexity of the project. But with FM transmitters and receivers being easily available in the market, all one has to do is Fig. 2: 8255 control word register to connect the FM transmitter in the final output stage at the respective ends. 8085 microprocessor-based control unit. As we all know, the 8085 microprocessor is intrinsically an 8-bit microprocessor, but it is more than sufficient for real-time applications where ruggedness is a more important parameter than speed and complexity. The device has 40 pins, and there is no need to discuss the significance of each pin on the IC as it is readily available in any microprocessor handbook. But one significant pin which many of us do not use much on the kits is the SID pin 5. It is the serial input data pin that can be used to get data serially into the microprocessor at the desired rate. Fig. 3: PC-transmitter interface There is also a complementary SOD pin 4 (not used here) which is used as serial tion in the software to convert it into an data output pin. The SID line is used by interrupt driven one. using a software instruction called RIM Interfacing of the 8085 to the exterin the 8085 assembly mnemonic. The demo nal world has been done using 8255 chip system here is not an interrupt driven (programmable peripheral interface or one, alPPI) which is present on most of the 8085 though it kits. The 8255 IC consists of 4 ports (port requires A, port B, port C, and a control port or only a register). Ports A through C can be slight configured to operate as either input or modificaoutput ports depending on our requireELECTRONICS PROJECTS Vol. 20

89

ments. This is achieved by writing a control word into the control register. Here, in this project, all the three ports have been configured as output ports as no input data is required to be received via 8255. All the three ports could be used to control external devices or movements. Control word can be formed with the help of Fig. 2. Serial input data is envisaged to be received directly via SID pin of 8085. Fig. 4: Receiver-8085 kit interface All the instructions— TABLE I starting from Key Binary Code Screen Display Decimal Eqlnt. Of Transmitted Binary Values Displayed the initialisa- Preby LEDs At Receiver tion of the 8085, ssed (8085) End on Execution 8255 to acquirAfter Start Bit (1) Sequence to be executed ing of input data a 1010 A 0001 0011 0101 1, 3, 5 (sequentially) from the SID b 0110 B 0010 0100 0110 2, 4, 6 line, storing, ar- c 1110 C 1111 1110 1101 15, 14, 13 1100 D 1100 1011 1010 12, 11, 10 ranging, and in- d 1000 E 0111 1000 1001 7, 8, 9 terpreting of the e x 0100 Executing Instructions !! Not Applicable data—are Press Any Key to continue! stored in the the kit. These can normally be found in EPROM (such as 2764 or 27128) of the the documentation of the kit. 8085 kit as monitor program. The temporary data, which may keep varying, cannot be stored in the EPROM and hence Operation the same is stored in a RAM (such as Following are the memory and input-out62256) chip of the 8085 kit. RAM locaput device addresses (for 8085 control tions have been used to store the data/ unit) used in this project: instructions received via the SID line for Memory Mapped Addresses later execution. The instructions that are EPROM address range : 0000 to 3FFFH received from the central control unit (the RAM address range : 4000 to BFFFH PC in this case) are stored in a queue, Input-output Addresses and when the execute instruction is re8255 port A : - 00H ceived from the PC, the 8085 processor of 8255 port B : - 01H the kit starts execution of the instruc8255 port C : - 02H tions on a FIFX (first in first execute) 8255 control register : - 03H basis. Transmitter interface (Fig. 3). The The 8085 kit also contains necessary transmitter-end hardware used for interaddress selection circuitry to allocate facing to the PC in this project comprises range of addresses for memory devices an IR transmitter. It basically consists of (RAM/EPROM) and input-output devices a 555 IC, which modulates the IR beam (e.g. 8255 and keyboard decoder IC) on

90

ELECTRONICS PROJECTS Vol. 20

at 38 kHz as the IR receiver is sensitive to that frequency. Pin 3 of the parallel port corresponding to data bit D1 of port 378H has been used for outputting the serial data. The speed selected is 100 bps (bit duration of 10 ms), and this can be easily increased with modification in the software part alone. Reset pin 4 of IC 555 has been used to control the 555 output via pin 3 of the parallel port as mentioned already. When reset pin goes high, a 40kHz modulated IR beam is transmitted, while there is no transmission when the reset pin is low. The protocol used for communication consists of a start bit (accomplished through software) followed by four data bits that carry the instruction to the remote receiver. The transmitter (and receiver) end waveforms at various pins of NE555 are shown in Fig. 5. Receiver interface (Fig. 4). The receiver-end hardware interface consists of an IR receiver module followed by a highinput-impedance-emitter-follower circuit to prevent overloading. The output from the emitter-follower is then directly connected to the SID pin of 8085 on the kit. The output of the IR module, when there is no IR beam, is high, and vice versa. The software monitor program in the

The rearranging of the serially acquired data bits is done before it is stored in the RAM as a 4-bit data, i.e. the serial data is converted into parallel data format. Finally, when it receives the 4-bit ‘execute’ instruction, it starts executing the instructions that have previously been stored in the RAM locations—one by one, sequentially. A unique count sequence output is used in the program for each instruction. Identical output sequence corresponding to each instruction (on execution) is

Fig. 5: Waveforms at transmitter and receiver end

PARTS LIST Semiconductors: IC1 - NE555 timer IC2,IC3 - 74LS07 hex buffers/drivers T1 - BC107 npn transistor IR LED1, IR LED2 - SE303A, SE307, or equivalent infrared light emitting diode LED1- LED8 - Red LEDs Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1 - 47-kilo-ohm R2 - 56-kilo-ohm R3 - 22-ohm, 0.5W R4, R6-R13 - 100-ohm R5 - 1-meg-ohm R14-R21 - 330-ohm x 8 SIP resistor network (RNW) Capacitors: C1 C2

- 220pF ceramic - 0.1µF ceramic

Miscellaneous: TSOP 1738 - IR receiver module (38KHz) - Male/female mating connectors for 25-pin ‘D’ of parallel PC port and 8255 O/P port of 8085 kit - 8085 kit with 8255 PPI

Fig. 6: Actual-size, single-side PCB layout for Fig. 3 and 4

control unit could be used even for a more complex process. As 8085 kits including RAM, ROM/ EPROM, and 8255 PPI are economically available in the market.

Software

Fig. 7: Component layout for the PCB

8085 kit continuously scans the SID line. When it detects a low signal it identifies it as the start bit. The first instruction bit is scanned after a delay of 15 ms, i.e. at the middle position of the first data bit. The remaining three data bits are like-wise scanned after 10ms delay so that the scanning is done at the middle position of each bit. An instruction sequence comprising a start bit 1 followed by binary bits 0010, as available on SID pin of 8085, is graphically depicted in Fig. 5. (The logic level of transmitted data is complement of the data at SID pin). It then stores the instruction comprising four bits in sequential RAM addresses.

made available from port A as well as port B of 8255. The outputs PA0 through PA3 (as well as PB0 through PB3) of 8255 have been used here to light LEDs (LED1 to LED4 and LED5 to LED8 respectively). Opencollector hex buffer/driver ICs 74LS07 have been used to augment the output drive capability of 8255 ports. In actual practice an 8085 control unit may not be required. But when the device to be controlled at the receiver end requires some intelligence of its own (such as a robot), a microprocessor board including on-board RAM, ROM, and PPI facilities is essentially required. Such a

The source code for the software at the PC end and at the receiver end is given below. The former software is written in ‘Turbo C’ while the latter software, to be stored in the EPROM of 8085 kit, is written in 8085 Assembly language. The PC-end software is interactive. When you run the program on the PC, it prints the the following message on the computer 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 to be used for different instructions, letter ‘x’ is used for prompting the execution of the previously entered instructions. The binary codes transmitted in response to depression of each of the abovementioned letters on the keyboard, together with messages printed on the screen, are summarised in Table I. The last column indicates the LEDs at output of register A and register B of 8255 at 8085 kit end which will sequentially light up as a result of execution of specific inELECTRONICS PROJECTS Vol. 20

91

structions. The receiver end monitor software starts with initialisation of stack at address 47FFH and configuration of 8255 with control word 80H (all registers in output mode). The RAM location 4900H initialised to 0 is used as a counter for storing the number of instructions received prior to receipt of ‘execute’ command, while the RAM locations starting

4801H are used for storing the actual instructions. The program continuously scans the SID pin for receipt of start bit (causing SID pin to go low). If start bit is received, it scans for the next bit after a delay of 15 ms, and thereafter a delay of 10 ms for the next bit, until all four bits are scanned. The four bits so received are properly arranged and checked to find out if it is

an instruction or execution command. If it is an instruction, the same is stored. All instructions are like-wise stored in sequential RAM locations starting with 4801H. If it is ‘execute’ command, the stored instructions are sequentially executed by branching to specific sub-routine for each instruction. Each specific routine here lights different LEDs as per the last column of Table I.

Transmitter-end ‘C’ Listing #include #include #include #include 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(); } }

Receiver-end 8085 Assembly Language Listing CREG EQU 03H PRTA EQU 00H PRTB EQU 01H PRTC EQU 02H STACKEQU 47FFH ORG JMP ORG

; 8255 Control Reg ; Addr ; 8255 Port Addr ; Stack addr in 62256 ; On Reset

0000H 0060H 0060H ; Initialisation Procedure

INITS: DI ; Disabling Interrupts LXI SP,STACK; Initialising Stack MVI A,80H OUT CREG ; Setting CReg Value

92

ELECTRONICS PROJECTS Vol. 20

LXI H,4900H MVI M,0 LXI H,4801H PUSH H SCAN: RIM ; Scanning for Start Bit ANI 80H JNZ SCAN CALL DELAY1 MVI C,4H MVI B,0H READ: RIM ANI 80H JZ ONE

; Reading Data via SID

ZERO: STC

; When Zero is Received

CMC MOV RAL MOV PUSH CALL POP DCR JNZ JMP ONE: STC MOV RAL MOV PUSH CALL POP

A,B B,A B DELAY B C READ INTERPRET ; When One is Received A,B B,A B DELAY B

DCR JNZ

OUT OUT CALL MVI OUT OUT CALL MVI OUT OUT CALL JMP

C READ

INTERPRET: MOV A,B ;Interpreting Received CPI 0AH ;Data JZ STORE CPI 06H JZ STORE CPI 0EH JZ STORE CPI 0CH JZ STORE CPI 08H JZ STORE CPI 04H JZ EXEC JMP SCAN

EX2:

MVI A,2H ;Exec 2 Seq = 2,4,6 OUT PRTA OUT PRTB CALL DEL2S MVI A,4H OUT PRTA OUT PRTB CALL DEL2S MVI A,6H OUT PRTA OUT PRTB CALL DEL2S JMP SUB

EX3:

MVI A,0FH ;Exec 3 Seq = 15,14,13 OUT PRTA OUT PRTB CALL DEL2S MVI A,0EH OUT PRTA OUT PRTB CALL DEL2S MVI A,0DH OUT PRTA OUT PRTB CALL DEL2S JMP SUB

EX4:

MVI A,0CH ;Exec 4 Seq = 12,11,10 OUT PRTA OUT PRTB CALL DEL2S MVI A,0BH OUT PRTA OUT PRTB CALL DEL2S MVI A,0AH OUT PRTA OUT PRTB CALL DEL2S JMP SUB

EX5:

MVI A,7H ;Exec 5 Seq = 7,8,9 OUT PRTA OUT PRTB CALL DEL2S MVI A,8H

STORE:POP H ;Storing Received Data MOV M,A ;in RAM INX H PUSH H LXI H,4900H INR M JMP SCAN EXEC: LXI H,4900H ; When Execute MOV C,M ; Command is Received LXI H,4801H EXECUTE: MOV A,M PUSH H PUSH B CPI 0AH JZ EX1 CPI 06H JZ EX2 CPI 0EH JZ EX3 CPI 0CH JZ EX4 CPI 08H JZ EX5

; Execution Procedure

SUB: POP B POP H INX H DCR C JNZ EXECUTE MVI A,0H OUT PRTA OUT PRTB ;Resetting O/P and LXI H,4900H ;Memory for new Data MVI M,0 LXI H,4801H PUSH H JMP SCAN EX1: MVI A,1H ;Exec 1 Seq = 1,3,5

Readers Comments: ❑ Please answer the following queries regarding this circuit: 1. Should we cover the receiver module during reception as it receives only in dark? 2. Can we use FM receiver instead of the receiver module? 3. Did LEDs in your transmitter and receiver circuit glow? During our demo, LEDs in the transmitter and receiver did not glow. 4. Using CRO, we confirmed the trans-

PRTA PRTB DEL2S A,3H PRTA PRTB DEL2S A,5H PRTA PRTB DEL2S SUB

mitter circuit to be in working condition. But we don’t know how to check the receiver circuit. 5. We used Microsoft kit and port address 41h for Port A, 42h for Port B, and 43h for Port C. Is there any possibility of error due to this address usage? K.R. Anuradha Through e-mail EFY: IR receiver module receives in daylight too, so it need not be covered. We have used IR receiver module during testing and it worked satisfactorily. FM receiver is not

OUT OUT CALL MVI OUT OUT CALL JMP

PRTA PRTB DEL2S A,9H PRTA PRTB DEL2S SUB

DELAY1: MVI C,7H ;Delay 1 = 15ms DEL1: MVI B,64H DEL2: NOP NOP NOP ANI 3H ORI 4H PUSH B POP B STA 4920H DCR B JNZ DEL2 DCR C JNZ DEL1 RET DELAY:MVI C,4H ;Delay 2 = 10ms DELS1: MVI B,64H DELS2: MVI A,8H NOP NOP ANI 3H ORI 4H PUSH B POP B STA 4920H DCR B JNZ DELS2 DCR C JNZ DELS1 RET DEL2S: MVI C,0B6H ;Delay 3 = 2Secs DEL2S1:MVI B,0FFH DEL2S2: PUSH B POP B STA 4920H STA 4920H PUSH B POP B STA 4920H PUSH B POP B STA 4920H DCR B JNZ DEL2S2 DCR C JNZ DEL2S1 RET END ❑

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 should go ‘low’ when a modulated IR beam falls on it. Please check if you have used correct pin connections in the module and whether the module’s frequency matches with transmitter’s modulating frequency. If you have used a different kit, you have to change the port addresses (together with control word register address) in the ❑ receiver-end program. ELECTRONICS PROJECTS Vol. 20

93

50Hz SINEWAVE INVERTER USING MOSFETs R.V. DHEKALE

A

t present, most uninterruptible power supply (UPS) systems available in the market provide square wave output, which is unsuitable for powering those equipment which have rotating machinery such as induction motors and blowers. Also, for computer systems, which make use of linear power supplies (for maintaining lower noise levels), square wave input results in higher noise level. Sine wave (230V AC at 50 Hz) inverter is the ideal choice for powering devices such as EPABX, cordless phone, medical electronics equipment and even TV, VCR, or computer etc, during mains failure. Circuit of such an inverter, using MOSFETs in the final power amplifier stage, is presented here.

are two basic configurations: high pass and low pass. The low pass type is generally preferred because the feedback network attenuates harmonics of the fundamental frequency, resulting in purer sine wave output. Accordingly, the low frequency model has been adopted here, which has resistors in the series arm and capacitors in the parallel arms. The applicable formulas for the given configuration are: (a) Frequency

where C denotes shunt arm capacitance and R the series arm resistance values. (b) Minimum required current gain = 56 [in common emitter configuration – for sustaining oscillations] In Fig. 2, R = R1 = R2 = R3 = 22 kiloThe Circuit ohm and C=C1=C2=C3=0.47µF provide a An RC coupled oscillator has been chofrequency of approximately 50 Hz. sen for developing the gate drive for the As amplitude of sine wave output from final MOSFET power amplifier circuit (retransistor T1 is quite low, it is amplified fer Fig. 2) as it is inherently stable. There by transistors T2 and T3. The collector load for transistor T3 is a 9-volt transistor radio’s driver transformer. Capacitor C7 (10µF) was test selected for the optimum pulse shape and amplitude (18V peak-to-peak across primary). The value of capacitor C7 would depend upon the driver transFig. 1: Oscilloscope picture of the sine wave output waveform former used, as

94

ELECTRONICS PROJECTS Vol. 20

PARTS LIST Semiconductors: T1,T2,T3 - BC548 npn transistor T4,T5,T6,T7 - BC549 npn transistor T8,T9 - IRF250, n-channel power MOSFET D1,D2 - 1N4007 rectifier diode D3,D4 - 12V, 1W zener diode Resistors (all ¼-watt, ± 5% carbon, unless stated otherwise): R1-R3,R5,R8 - 22-kilo-ohm R4,R12 - 4.7-kilo-ohm R6,R10 - 68-kilo-ohm R7,R23,R24 - 470-ohm R9 - 92-kilo-ohm R11,R19,R20 - 100-ohm R13,R14 - 1-kilo-ohm R15,R17 - 15-kilo-ohm R16,R18 - 1.5-kilo-ohm R21,R22 - 10-kilo-ohm VR1,VR2 - 4.7 kilo-ohm pot Capacitors: C1,C2,C3 - 0.47µ, 25V tantalum C4,C6 - 1µF, 25V electrolytic C5,C8 - 100µF, 16V electrolytic C7 - 10µF, 25V electrolytic C9,C10 - 0.1µF polyster C11,C12 - 47µF, 25V electrolytic C13* - 12 or 16µF, 440V AC, paper C14 - 0.1µF ceramic disc Miscellaneous: X1 - Driver transformer (9V transistor radio type) X2* - 9V-0-9V AC, 16A primary to 200V,0.75A secondary transformer - Battery 12V, 40Ah - Heat sink, mica washers - Multi-strand teflon insulated wire, teflon washers - Heat sink compound

its parameters may differ widely from one manufacturer to the other. With this circuit, a sine wave with a peak amplitude of 6-volt across secondary

Fig. 2: Complete circuit diagram of 50Hz sine wave inverter

volt peak. The 50 Hz sine wave output from transistor amplifiers T4 and T5 are applied to the gates of MOSFETs T8 and T9 (IRF250) via emitter followers (T6 and T7), protective diodes (D1 and D2), current limiting resistors (R23 and R240), and gate protecting zeners (D3 and D4). During each half cycle, only one of the two MOSFETs conducts and drives current through half of the primary windings of output transformer X2 (in opposite directions). Thus alternating current flows through the primary (and so also through secondary) of transformer X2. Potmeters VR1 and VR2 have been provided for varying the base drive for transistors T4 and T5, so as to obtain equal gate drives for MOSFETs T8 and T9 respectively. The value of capacitor C13 across the secondary windings of transformer X2 (shown separately in Fig. 3) is so chosen that it resonates with the secondary inductance at the 50Hz frequency to maintain the output waveform as close to a sine wave as possible. The measured value of secondary inductance across terminals marked 0 and

of driver transformer could be observed during testing of the prototype. Phase splitting (1800) of the output across secondary of driver transformer takes place because of transformer action. The centre tap of secondary winding of transformer X1 is connected to positive rails via 4.7kilo-ohm resistor R12 while the two ends are connected to amplifiers comprising transistors T4 and T5 for raising the level of the input 50Hz signal to around 10-

230V AC is 750 mH and the calculated value of capacitor is 13.5 µF. One could practically use a value of 12 to 16 µF (440V AC rating) to obtain a reasonable sine wave shape. The detailed specifications of the power transformer X2 used during the actual testing of the prototype are as follows: Core material: CRGO Core type: 7EI Tongue width: 5.08 cm Window area: 18.969 sq. cm Stack height: 6.35 cm Primary turns: 15 + 15 (bifiliar) of 12 SWG Sec. turns: 345 + 22.5 + 22.5 One may also use a ready-made transformer with primary voltage specification of 9V AC – 0 – 9V AC (16ampere current rating) and a secondary voltage rating of 200V AC (750mA or higher current rating). The supply for the circuit may be taken from a single 12-volt, 40Ah battery, which is adequate for catering to about 150-watt load for more than two hours in the absence of mains supply. Higher ampere-hour batteries could be used for obtaining longer standby capacity/period. Circuit for float charger is not included as the same can be adopted from several of battery charger circuits published in EFY magazine off and on. Suitable actual-size, single-sided PCB for the circuit of Fig. 2 is given in Fig. 4. The component layout for the PCB is shown in Fig. 5. All components, with the exception of MOSFETs are accommodated on the PCB. The two MOSFETs, are to be mounted on appropriate heat sink. A single heat sink may be used but the MOSFETs may be insulated from the heat sink using mica insulators and

Fig. 3: Transformer X2 details ELECTRONICS PROJECTS Vol. 20

95

Fig. 6: Wiring diagram showing interconnections between different parts of the inverter

Fig. 4: Actual-size single-sided PCB layout for 50Hz sinewave inverter

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

Readers Comments: ❑ The author is requested to clear my following doubts. 1. To drive 600W load, a transformer of 9-0-9V, 50A primary to 230V, 4A secondary rating was used. How is the transformer rating for this load decided? If there is any formula, please mention the same. 2. On what factor does the number of MOSFETs connected in the circuit depend? (e.g. 5+5, 1+1, etc) 3. With 600W load, how long can a fully charged battery work? 4. How can we run 3-phase induction motor using this circuit? V.S. Nara Guldgudd The author, R.V. Dhekale, replies: In reply to Mr Nara’s letter I would

96

ELECTRONICS PROJECTS Vol. 20

like to say: 1. For the inverter a transformer of 90-9V, 50A is used since the supply voltage for the transformer is 12 volts Input Power = 12 x 50 = 600 watts Output Power = 230 x 2.6 = 600 watts Secondary current rating can be considered as 2.6 amp, but sometimes output voltage may rise to 260V. In order to tolerate the additional secondary current, 4 amp rating is considered. 2. For 150 watts, 1+1 IRF250 MOSFETs are required. This means current Id through each MOSFET with supply of 12 volts is:

secured using either teflon screws/nuts or appropriate teflon washers, ensuring that the drain/body is not shorted to the heat sink. Also use heat sink compound between the MOSFET body and mica insulator as well as between mica insulator and the heat sink. Precaution by way of shorting all three terminals of MOSFETs together, using a thin copper strand and soldering them together, may be taken when the item is being handled during assembly. Remove this shorting only after the assembly and complete wiring is over. Fig. 6 shows the wiring diagram of different parts of the inverter. Multistrand teflon insulated wires of suitable current handling capacity should be used for extending the connections from battery as well as transformer X2 to the MOSFET terminals. The PCB (without MOSFETs) should be fully tested before connecting the final gate outputs to the MOSFETs. ❑

i.e. 4+4 MOSFETs are required. Additional 4+4 MOSFETs can be used, since as the number of MOSFETs increases, the heat radiated by the MOSFETs decreases. 3. For 600-watt load, with supply of 12V, the supply current Ip is:

This means a battery of 12V, 105 amp hour can be used for 2 hours. For three-phase motor it is necessary to have three outputs with 120 phase difference between any two outputs. ❑

AN 8085 MICROPROCESSOR KIT FOR INSTRUCTORS K. PADMANABHAN, S. ANANTHI & R.S. SANKARAN

T

he course on microprocessors in most electronic engineering institutions begins with Intel 8085. The main reasons are that it is easy to understand, can be taught at any level—school or college—and covers all the essential features of any general-purpose microprocessor. The blackboard teaching for this microprocessor must be supplemented by both practical training on circuit assembly and testing, as well as simple exercises comprising elementary programs for gaining confidence in the use of 8085 instruction set. Although many commercial trainer kits are available in the market, with each one possessing certain unique features, for the purpose of gaining practical knowledge, one should wire up a circuit board himself. Amongst others, an instructor should invariably do so before embarking on teaching or writing texts for microprocessor training classes. Here is one such kit, which is not only compact but also possesses certain features (needed for teaching purposes), hitherto not available in any of the commercial kits. This kit comprises an on-board LCD display module. It has a 16-character, single-line, alphanumeric display. This module has an integral microcontroller (such as KS0066 LCD driver IC from Samsung), which easily interfaces to the 8085 kit. The module provides character display (with contrast adjustment facility), which is a very useful feature for showing the mnemonics (e.g. MVI A, etc) on its screen. Such display modules are available for about Rs 200. The total cost of components, including LCD modules, is not likely to exceed Rs 1500. Software exercises involving the 8085’s arithmetic and logic instructions can be executed and directly verified through the in-built 8-bit LED port pro-

data, and mnemonics in the format as vided in this kit. This is in addition to depicted in Table II. the LCD display which shows the The second row in the table shows the address and data fields as well as the character slot positions of the LCD modmnemonics. The monitor program of the ule. The third row shows how the high kit has provision for disassembly of inaddress 10H, the low address 00H, and structions, i.e., showing the mnemonic the data 3E at that address are shown of the code at every location. While imtowards the left half (character positions parting training, the instructor first asks 1 to 8), while the mnemonics appear on the trainee to write the codes by referthe right half of the display (character ring to the instruction set, so that he positions 9 to 16). may get familiar with them. SubseThe kit has provision for an EPROM quently, the instructor can check and (a 2716 or a 2764), which is preprogverify if the instructions are as per the rammed with the monitor program firmmnemonics using the disassembler mode ware, given in Appendix ‘A’ as a hex dump. (CRL +D). This occupies pages 0 to 7 only. If one fits The simply hexadecimal keyboard has a EPROM 2764, there is plenty of extra only 16 key switches which make it comspace for the instructor to load teaching pact. All commands are entered through programs for demonstration to students. the extra control (CRL) key. For example, There is an additional socket which CRL key pressed together with numeric can hold a 6264 (8k RAM) or a 2864 (8k key 1 will set the high address. Similarly, RAM) EEPROM. EEPROM 2864 is meant CRL + 2 keys will set the low address, for students to try lengthy programs which while CRL + 3 keys will execute the promight take few days—with the kit being gram at the current address, and so on. turned off in the evening after the practiTable I lists all these command instruccal session. The EEPROM 2864 is protions. Incidentally, the same commands grammed in-situ as one enters data into have been used by the authors in their book ‘Learn to TABLE I Use MicroprocesCommand Key Usage for the LCD 8085 Kit sors,’ with the exKeys Pressed Function ception of the key Sets the high address to the value in the display for disassembly (CRL + 1) (CRL + 2) Sets the low address to the value in the display (CRL + D). (CRL + 3) Executes program at the current address in display The LCD (CRL + 4) Decrements the address by one and shows data there module, which (CRL + 7) Stores the data into the address and increments it Increments address only, does not store data has a single-line, (CRL + 8)* Starts to disassemble from the current address 16-character dis- (CRL + D) play, shows the *Note: CRL + 8 combination is used for disassembly and reading the on-board EEROM which could be programmed on the kit. kit’s address, TABLE II H. Addr. 1 2 1 0

3

L. Addr. 4 5 0 0

6

Data 7 8 3 E

9

10 M

Mnemonics 11 12 13 V I

14 A

15

16

ELECTRONICS PROJECTS Vol. 20

97

the EEPROM (address range 4000-7FFF). A number of programs can be accommodated in one such device and several students can work together on the kit—each with his own individual program. The following key sequence is used for feeding data or program into the EEPROM: 50 00 xx Set the address at 50 high and 00 low xx indicates some random data that might be present there. 50 00 3E To enter code 3E (MVI A), one enters 3 and E . 50 00 3E Now (CRL + 7) keys are pressed. This writes 3 E there. 50 01 xx Thereupon, after writing, the address gets incremented by one and the data (xx) appears.

In this manner one keeps entering data, pressing CRL + 7 keys and continuing till a program is fully fed into the EEPROM. To verify the data programmed into the EEPROM, one should not use the CRL + 7 keys. Instead, use the CRL + 8 keys. When a beginner (student) enters a program (in a general kit), involving jumps and return instructions, he usually makes mistakes which lead to corrupt data being entered at certain locations; this causes frustration and loss of time because the student has to re-key the entire program. This is a common hazard during microprocessor training sessions. But, in this kit, which uses an EEPROM, even if a student makes mistakes while entering, say, the jump and return instructions, no such alteration of entered data takes place because the EEPROM retains the data which cannot be altered during the execution of a program.

Fig. 1: Schematic diagram of 8085 microprocessor kit

Description

98

ELECTRONICS PROJECTS Vol. 20

The complete circuit schematic is shown in Fig. 1. As with every 8085 circuit, there is an address latch 74LS373 (IC2). Using control signal ALE (address latch enable), it segregates and latches the addresses A0 through A7 at its output from the AD0 through AD7 lines from 8085. These address lines (A0 through A7) are routed to all the memory ICs. IC3 is used for storing the monitor program. For IC3 we may either use a 2716 or a 2764 EPROM IC. Either of these ICs can be fitted to the 28pin socket. The 2716 IC is inserted with the right edge aligned to the IC socket. This IC has to be programmed with the hex data given in Appendix ‘A’ using an external EPROM programmer. There is a provision for using either a 6116 RAM or

Fig. 2: Actual-size component-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. This costs just around Rs 150. This is a re-

Fig. 3: Actual-size solder-side track layout for the circuit of Fig. 1

placeable part for the kit and each student can have one for his programs, which he or she fits into the IC5 socket and starts 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-07FF only) 2000 - 3FFF RAM address space (If a 6116 is used, it would use 2000-27FF only) ELECTRONICS PROJECTS Vol. 20

99

PARTS LIST Semiconductors: IC1 - 8085 microprocessor IC2 - 74LS373 octal transparent D latches IC3 - 2716/2764 2K/8k-byte EPROM IC4 - 6116/6264 2K/8k-byte SRAM IC5 - 2864 8k-byte EEPROM IC6 - 74LS139 dual 2-line to 4-line decoders IC7, IC13, IC18 - 74LS00 quad NAND gates IC8 - 74LS02 quad NOR gates IC9, IC10 - 74LS75 4-bit bi-stable latches IC11, IC12 - 74148 8-line to 3-line priority encoder IC14 - 74LS244 octal buffers/drivers IC15 - 5369 clock generator IC16 - CD4518 dual BCD counter IC17 - 7490 decade counter IC19 - 74LS374 octal D flip-flops D1, D2 - 1N4148 switching diode D3-D10 - LED 4mm, red Resistors (all ¼-watt, ± 5% carbon, unless stated otherwise): R1-R5, R7, R9 - 1-kilo-ohm R6, R8 - 1.2-kilo-ohm R10-R17 - 220-ohm VR1 - 10-kilo-ohm pot., linear Capacitors: C1-C3, C5 - 22pF ceramic disc. C4 - 10µF, 10V electrolytic C6 - 0.1µF ceramic disc Miscellaneous: Xtal-1 - Crystal 4 MHz Xtal-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 address space

The LCD module is wired, not as a memory, but as an input-output device. Its port address is C0H. ICs 7 and 8 (74LS00 and 74LS02 respectively) are employed to select this address in combination with the I/O/M signal from 8085. The second half of the decoder IC6 is meant for providing select output signals for the input-output devices. These are as under: Keyboard input address 02 hex 8-bit LED address 04 hex The 8-LED port is energised using the latched outputs of ICs 9 and 10 (74LS75) via current-limiting series resistors of 220 ohms each. A simple circuit, using a pair of 74148 ICs (ICs 11 and 12), and IC 13 (74LS 00), provides the keyboard encoding circuit for

100

ELECTRONICS PROJECTS Vol. 20

16 key switches. For a detailed description of this circuit, refer to a book called ‘Learn to Use Microprocessors’ published by EFY. The keyboard data is read from the input port comprising IC14 (74LS244). The data includes the ‘keypressed’ information (on D7 bit) along with the keycode (D0-D3) and control key information (D6). The keyboard comprises 16 hexadecimal keys (0 to 9 and A to F) and also a separate control key. A Reset key, which is connected to the reset pin 36 of IC 8085, is also fixed on this keyboard. An optional timer circuit is included in the kit. This is meant for exercises based on accurate timings (one or ten seconds), such as generation of interrupts on the kit at precise timing intervals. With interrupt-based programming, one can run another program in the background. (Multi-tasking exercise). IC15 (5369) provides a 60Hz output square wave from a 3.579 MHz crystal and the CD4518 (IC16) divides it by 60 (note the diode feedback) to give 1Hz output. Further Fig. 4: Component layout for the PCB. division by 10 using a 7490 IC enables interrupt at 10-second terrupt RST 7.5. Of course, for using this intervals. The output going to the pin 7 of timed interrupt, the instructor is required 8085 is differentiated by capacitor C6 and to teach the students how to enable the resistor R8 combination to produce a waveRST 7.5 interrupt and write an interruptform with sharp edges which causes indriven program.

A program for a sixteen character message display is given below: Addr. 2000 2002

Code 3E 38 CD 50 20 3E 0E

Label

Mnemonics MVI A 38 CALL COMMAND MVI A 0E

2007 200A 200C 200F 2011 2014 2016 2019

CD 50 20 3E 06 CD 50 00 3E 80 CD 50 20 3E 01 CD 50 20 C3 20 20

2020 2022 2024 2026 2029 202B 202C 202D 202E 2031 2034 2037 2050 2050 2052 2055

3E 80 D3 C0 0E 02 11 00 21 06 10 1A 13 05 CD 80 00 C2 2B xx CD BF 00 76 ORG 2050H COMMAND: D3 C0 CD BF 00 C9

2080 2080 2081 2083 2085 2088 2089 208B

WRITE DATA (DD RAM FILL) F5 WRITE: DB C0 P: E6 80 C2 ,, ,, F1 D3 C1 C9

Comments ; 38 is LCD module function set command ; Turns display on, cursor on ; Replace 0E with 0F for blinking cursor ; or 0C for no cursor

CALL COMMAND MVI A 06 CALL COMMAND MVI A 80 CALL COMMAND MVI A 01 CALL COMMAND JMP A A:

; Shift cursor right ; Address at left end (C0 is for IInd half) ; 01 is for clearing display

MVIA 80 OUT C0 MVI C 02 LXI D 21 00 MVI B 10H LDAX D INX D DCR B CALL WRITE JNZ B CALL delay 10ms HLT

C: B:

; to set to 0 address on LCD ; Write to LCD command register ; for 2 lines each of 8 characters ; point to message table at 2100 ; for 16 characters ; Get first ASCII code from address ; point to next character in RAM ; All 8 characters over? ; Writing data into register

OUT C0 CALL delay 10ms RET

: refer subroutine address given ab

PUSH PSW IN C0 ANI 80 JNZ P POP PSW OUT C1 RET

; read status register of LCD ; check bit D7 ; wait otherwise ; write to DD RAM

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 LCD module’s display. Appendix ‘A’ Hex Dump of 8085 Monitor Program for the Kit Addr.

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

0000 0010 0020 0030 0040 0050 0060 0070 0080 0090 00A0 00B0 00C0 00D0 00E0 00F0 0100 0110 0120 0130 0140 0150 0160

C3 4E FF FF CD F5 3E F0 00 CD 20 00 D5 FE C0 F5 31 79 01 C2 01 DB 59

00 C3 FF FF 50 3E 80 0F CD D0 CD 79 11 0A 06 DB FF 17 69 37 FE 02 01

01 50 FF FF 00 38 CD 0F F0 00 F0 E6 30 D2 06 C0 27 17 C3 01 43 B7 CD

FF 00 FF FF CD CD 48 0F 00 CD 00 0F 09 D8 1A E6 21 17 06 2B C2 FA BF

FF CD FF FF 50 48 00 0F 3E F0 79 CD 1B 00 13 80 00 17 01 C3 70 50 00

FF BF FF FF 01 00 3E CD 20 00 E6 D0 7A F6 CD C2 20 E6 FE 06 01 01 DB

CD 00 FF FF C9 3E 01 D0 CD 7D F0 00 B3 30 F0 F1 4E F0 41 01 3E CD 02

50 D3 FF FF FF 0E CD 00 F0 E6 0F CD C2 C9 00 00 CD B0 C2 FE C1 BF B7

01 C1 FF FF D3 CD 48 CD 00 0F 0F F0 C4 F6 CD F1 40 4F 2E 47 D3 00 F2

C3 CD FF FF C0 48 00 F0 7D CD 0F 00 00 40 BF E6 00 C3 01 C2 C0 DB 59

0A BF FF FF CD 00 3E 00 E6 D0 0F F1 D1 D6 00 7F FE 07 61 41 3E 02 01

01 00

FF C3

FF 06

FF 00

FF FF

BF 3E 80 7C F0 00 CD C9 F1 09 05 D3 40 01 C3 01 47 B7 EE

00 06 D3 E6 0F CD D0 FF C9 C9 C2 C1 D2 FE 06 71 CD 00 C0

C9 CD C0 0F 0F F0 00 FF FF 3E E3 C9 1C 42 01 23 F0 00 E6

FF 48 7C CD 0F 00 CD FF FF C1 00 FF 01 C2 FE C3 00 00 4F

FF 00 E6 D0 0F 3E F0 F5 FF D3 C9 FF 47 25 44 06 E9 F2 C9

ELECTRONICS PROJECTS Vol. 20

101

102

Addr.

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

0170 0180 0190 01A0 01B0 01C0 01D0 01E0 01F0

FE CD 27 FF 01 00 F1 3E 00

48 E9 3C 27 23 79 CD C3 09

CA 01 32 3C 4E E6 BF D3 09

AA 1A FF 32 CD F0 00 C0 E5

01 B7 27 FF 00 0F D3 F1 29

FE FA 13 27 C3 0F C1 C3 C1

4D 8E 1A 1B 7F 0F CD 14 09

C2 01 B7 C3 01 0F BF 00 01

06 CD FA 88 3D CD 00 FF 00

01 DD 9F 01 32 D0 79 FF 02

3E 00 01 00 FF 00 E6 C5 09

00 C3 1B C3 27 F5 0F 06 EB

32 06 C3 00 23 3E CD 00 C1

FF 00 88 17 4E C2 D0 EB C9

27 3A 01 C2 CD D3 00 21 FF

4E FF 3A B9 50 C0 F5 00 FF

0200 0210 021A 0230 0240 0250 0260 0270 0280 0290 02A0 02B0 02C0 02D0 02E0 02F0

4E 20 52 20 20 52 FF 20 52 20 20 52 52 20 52 20

4F 42 20 45 42 20 45 44 20 45 44 20 49 20 20 20

50 49 42 52 44 43 52 49 44 52 44 45 4D 49 48 20

20 4E 20 52 43 20 52 4E 20 52 43 20 20 4E 20 20

20 58 CD 20 58 CD 20 58 CD 20 58 CD 20 58 CD 20

20 20 56 20 20 56 20 20 56 20 20 56 20 20 56 20

CC 42 49 44 42 49 CC 44 49 44 44 49 CC 48 49 44

D8 20 20 41 20 20 D8 20 20 41 20 20 D8 20 20 41

49 49 42 44 49 43 49 49 44 44 49 45 49 49 48 44

20 4E 20 20 4E 20 20 4E 20 20 4E 20 20 4E 20 20

42 52 52 42 52 52 44 52 52 42 52 52 48 52 44 48

20 20 4C 20 20 52 20 20 41 20 20 41 20 20 41 20

53 42 43 4C 43 43 53 44 4C 4C 45 52 D3 48 41 CC

54 20 20 44 20 20 54 20 20 44 20 20 C8 20 20 C8

41 44 20 41 44 20 41 44 20 41 44 20 4C 44 20 4C

58 43 20 58 43 20 58 43 20 58 43 20 44 43 20 44

0300 0310 0320 0330 0340 0350 0360 0370 0380 0390 03A0 03B0 03C0 03D0 03E0 03F0

20 52 53 20 52 20 20 52 4D 42 56 4D 43 56 4D 44

20 20 49 20 20 20 20 20 4F 44 20 4F 44 20 4F 44

44 4C 4D 49 4D 20 44 41 56 4D 42 56 4D 43 56 4D

43 20 20 4E 20 20 43 20 20 4F 4C 20 4F 4C 20 4F

58 CD 20 58 CD 20 58 CD 42 56 4D 43 56 4D 44 56

20 56 20 20 56 20 20 56 42 20 4F 42 20 4F 42 20

48 49 CC 53 49 44 53 49 4D 42 56 4D 43 56 4D 44

20 20 D8 50 20 41 50 20 4F 45 20 4F 45 20 4F 45

49 4C 49 49 4D 44 49 41 56 4D 42 56 4D 43 56 4D

4E 20 20 4E 20 20 4E 20 20 4F 4D 20 4F 4D 20 4F

52 43 53 52 53 53 52 43 42 56 4D 43 56 4D 44 56

20 4D 50 20 54 50 20 4D 43 20 4F 43 20 4F 43 20

4C 41 D3 4D 43 CC 41 43 4D 42 56 4D 43 56 4D 44

20 20 D4 20 20 C4 20 20 4F 48 20 4F 48 20 4F 48

44 20 41 44 20 41 44 20 56 4D 42 56 4D 43 56 4D

43 20 20 43 20 20 43 20 20 4F 41 20 4F 41 20 4F

0400 0410 0420 0430 0440 0450 0460 0470 0480 0490 04A0 04B0 04C0 04D0 04E0 04F0

56 4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 4D 41 56

20 4F 44 20 4F 44 20 4F 44 20 4F 44 20 4F 44 20

44 56 4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 4D 41

4C 20 4F 4C 20 4F 4C 20 4F 4C 20 4F 4C 20 4F 4C

4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 48 41 56 4D

4F 42 20 4F 42 20 4F 42 20 4F 42 20 4C 42 20 4F

56 4D 45 56 4D 48 56 4D 4C 56 4D 4D 54 4D 41 56

20 4F 45 20 4F 45 20 4F 45 20 4F 45 20 4F 45 20

44 56 4D 45 56 4D 48 56 4D 4C 56 4D 20 56 4D 41

4D 20 4F 4D 20 4F 4D 20 4F 4D 20 4F 20 20 4F 4D

4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 4D 41 56 4D

4F 43 20 4F 43 20 4F 43 20 4F 43 20 4F 43 20 4F

56 4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 4D 41 56

20 4F 48 20 4F 48 20 4F 48 20 4F 48 20 4F 48 20

44 56 4D 45 56 4D 48 56 4D 4C 56 4D 4D 56 4D 41

41 20 4F 41 20 4F 41 20 4F 41 20 4F 41 20 4F 41

0500 0510 0520 0530 0540 0550 0560 0570 0580 0590 05A0 05B0 05C0 05D0 05E0 05F0

41 44 44 41 44 43 53 44 42 53 44 42 41 44 41 58

44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20 52

44 41 4C 43 41 4C 42 53 4C 42 53 4C 41 41 4C 41

20 44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20

42 44 41 42 43 41 42 42 53 42 42 53 42 41 41 42

20 20 44 20 20 44 20 20 55 20 20 42 20 20 4E 20

41 45 44 41 45 43 53 45 42 53 45 42 41 45 41 58

44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20 52

44 41 4D 43 41 4D 42 53 4D 42 53 4D 41 41 4D 41

20 44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20

43 44 41 43 43 41 43 42 53 43 42 53 43 41 41 43

20 20 44 20 20 44 20 20 55 20 20 42 20 20 4E 20

41 48 44 41 48 43 53 48 42 53 48 42 41 48 41 58

44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20 52

44 41 41 43 41 41 42 53 41 42 53 41 41 41 41 41

20 44 20 20 44 20 20 55 20 20 42 20 20 4E 20 20

ELECTRONICS PROJECTS Vol. 20

0600 0610 0620 0630 0640 0650 0660 0670 0680 0690 06A0 06B0 06C0

44 41 4F 44 41 43 44 50 52 20 53 52 20

20 20 52 20 20 4D 20 20 4E 20 48 5A 20

58 4C 41 4F 4C 50 43 4C 5A CA 20 20 20

52 20 20 52 20 20 4D 20 20 CD 42 20 20

41 58 42 41 4F 42 50 43 20 50 C1 20 20

20 52 20 20 52 20 20 4D 20 20 44 20 20

45 41 4F 45 41 43 45 50 50 20 49 52 20

20 20 52 20 20 4D 20 20 4F 20 20 45 20

58 4D 41 4F 4D 50 43 4D 50 C3 20 54 C3

52 20 20 52 20 20 4D 20 20 CE 20 20 DA

41 58 43 41 4F 43 50 43 42 5A 52 20 20

20 52 20 20 52 20 20 4D 20 20 53 20 20

48 41 4F 48 41 43 48 50 CA 20 54 CA 20

20 20 52 20 20 4D 20 20 DE 20 20 DA 20

58 41 41 4F 41 50 43 41 5A 50 30 20 C3

52 20 20 52 20 20 4D 20 20 55 20 20 C1

proper accommodation of the complete circuit, including the LCD display module on a single board. The actual-size componentside and solder-side track lay-outs for the circuit of Fig. 1 are given in Figs 2 and 3 respectively. The component lay-out for the PCB is given in Fig. 4.

Using the Disassembler Fig. 5: LCD display showing symbols/graphics

IC18 (74LS00) is used for decoding port address 80H. This additional address can be used for external add-on boards, such as the 8255 board, etc, which the instructor could use suitably for training. Alternatively, there is an additional 8-bit latch provided on the kit, using a 74LS374 (IC19) which can give eight latched outputs. These can be wired to LEDs or other controls, using external hardware, such as stepper motor, etc for exercise purposes. This IC 19 need not be fitted if an external 8255 add-on board is used. The LCD module is fitted on a singleline IC strip base having 16 pins (to cater for 14 as well as 15/16-pin modules). The LCD module has edge fingers with 2.54mm pitch as applicable for DIP ICs. One has to solder berg-pins into the holes on the edge fingers and thereby make the LCD module fit snugly onto the single-line IC strip holder provided on the PCB. The LCD module connections are shown in the circuit diagram. There is a contrast control which is connected to the pin 3 of the module. A 10k potentiometer on board is used for adjusting the contrast. Pins 1 and 2 of the LCD module are for +5V and ground respectively. For more details of the LCD module, readers may refer to the LCD module description in the author’s article ‘8098 Development Board’ published elsewhere in this volume. A double-sided PCB is required for

The kit’s monitor program includes the 8085 disassembler. This enables one to check programs with the mnemonics. The student first enters the code of his program, as usual, by entering them one after another into the memory area. For instance, if he writes his program at address 5000 onwards (into the EEROM for adding two bytes (47 and 28 for instance) as under: 50 00 3E 50 01 47 50 02 C6 50 03 28 50 04 27 50 05 D3 50 06 04 50 07 76 After the entry is over, the address is set back at 5000, and then CRL +D keys are pressed. The display then shows: 50 00 3E MVI A Then CRL + 8 keys are repeatedly pressed to see the disassembled listing as under: 50 00 3E MVI A ; Move into accumulator the 50 01 47 47 ; value 47 50 02 C6 ADI ; Add with immediately ; following value of 50 03 28 28 ; 28 50 04 27 DAA ; Decimal adjust accumulator 50 05 D3 OUT ; Output to 50 06 04 4 ; port address 4 for the 8 single LEDs on kit 50 07 76 HLT ; Halt program.

Upon execution of the program, it is verified on LEDs panel (in BCD format) as: 0 1 1 1 0 1 0 1 .... i.e. 75 In the above program, the instructor

Fig. 6: A prototype kit developed by authors

should ask the student to enter 00 (the NOP or no-operation instruction) at address 5004 and re-execute the program. The display on the 8-LED panel would show: 0 1 1 0 1 1 1 1 ... i.e. 6F He could then proceed to explain the use and working of DAA instruction, etc.

Conclusion A kit with the abovementioned features has been found to be very useful for fresh students to learn about microprocessors. The use of LCD display has its advantages as one could show some simple electrical symbols and graphics, including waveforms, on its display (refer Fig. 5). The following addresses in the firmware EPROM contain several LCD modulebased routines which an instructor or a programmer may make use of. By suitably calling these routines, useful programs can be prepared. Sub-routine Start address Time-delay for 10 ms 00 BF Initialisation of the LCD 00 40 Keyboard input routine 01 50 Write to display and shift (H,L,C) 00 50 Write LCD command register 00 48 Writing to DD RAM of LCD 00 F0 Long-delay routine 00 E8

❑ ELECTRONICS PROJECTS Vol. 20

103

Readers Comments: ❑ I request the author to reply to the following queries: 1. How to write an interrupt driven program while running another program in the background? 2. How to display formulae, waveforms, and electric symbols on the LCD display? 3. For what purpose are SIP1, SIP2, SIP3, and SIGS connectors provided? How can they be interfaced with external hardware? 4. In our lab. we have a kit with a 26pin FRC connector. How can these connectors (SIP1…SIP3), having 8-pins (8 I/O lines), be interfaced with hardware in our lab? 5. What is the port address of IC19 (74LS374), and what will be the port address if we use an external add-on board having an 8255 PPI, and where is this board to be connected? 6. How to add an 8255 in this kit for parallel interfacing, and how can this kit be used in serial I/O mode? 7. In hex dump (Appendix ‘A’), row 0020 and 0030 have some data missing. Please check and confirm their integrity. 8. In which format do we have to write hex dump? You have mentioned that plenty of space is available to load teaching programs if we use 2764 EEPROM. What type of programs can

104

ELECTRONICS PROJECTS Vol. 20

be loaded? 9. Can we display time in this kit by using external hardware (IC 5387) or through a software program? D. Selvaraj Chennai The author K. Padmanabhan replies: 1. This is described at pages 49-50 pages ‘Learning to Use Microprocessor’ (LUM) book published by EFY. You can write a main program. For example, a running display and the interrupt service program can be doing event-counting by looking at the signals on the interrupt pin. 2. The LCD display module has the facility to display some graphic characters which can be user-defined. These are well described in the LCD module's datasheets (available through manufacturers). Since this article was meant for teachers, we did not give everything very elaborately, and just hinted on the possiblities, giving some examples. 3. The various signals pins from the 8085 for external use are: SIG1 - SOD - Serial output data SIG2 - SID - Serial input data SIG3 - READY - Ready input SIG4 - SIG7 - The four interrupt inputs

Regarding usage of SIG and SOD, you may refer LUM Book pages 44-45. The ready 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 extend the memory cycle to a longer time needed for programming an EPROM. For usage of interrupt pins, you may again refer the LUM book. 4. Connector types are immaterial— the connection has to be makde, that is all. For normal use of the kit, these external pins are not connected to anything at all. Simple switches, a slow-going 555 timer working on 5V supply and an LED with series resistor of 220-ohm are all that may be required to demonstrate the functions of SID, interrupt pins, etc by a teacher. 5. The port address of 74LS374 is 80H. You may connect an external 8255 board, such as the one given in Chapter VI of the LUM Book, using the same address 80H line (connected to pin 11 of 74LS374) as chip select input for the 8255. 6. Please refer Chapter VI of LUM book. 7. Missing data is FF only. 8. The collection of codes in sequence is tested program is the hex dump. Any program which you may find useful for teaching, say an 8-bit×8-bit multiplication, a 16-bit by 8-bit division, etc, can be loaded. 9. Please see Appendix ‘A’ in LUM book and alter the display routine for LCD display as suggested in the article. ❑

MULTICHANNEL CODE LOCK SYSTEM VIJAY D. SATHE

T

he circuit presented here is a codebased electronic locking system to control the operation of several appliances. The circuit uses a three-digit decimal coding system for operating any appliance. Thus, for each appliance a unique threedigit code, from numbers 101 to 999, is selected. Although this circuit can be used to control as many as 999 appliances, for the sake of simplicity, the operation of just three appliances is being shown here. Additional appliances, if required, can be wired via the 10-pin connectors provided in the circuit. For the operation of each appliance, a manually-operated appliancespecific toggle switch is turned on prior to the selection of the appliance code. The code selection is done through three push-to-on switches, with each one associated with a specific digit. The selected number is displayed on three 7segment displays for a short duration. On selection of any appliance, the counters and the displays are automatically reset. However, the selected appliance stays on due to latching action of the relay, through a pair of its own contacts. A fresh selection is accompanied by a short-duration musical note. Arrangement for manual resetting of the counters and displays is also included.

The circuit The circuit consists of a 555 timer (IC1) which is wired as an astable multivibrator with 50 per cent duty cycle and a clockperiod of one second. The output of IC1 is used as clock for CD4033 decade counter cum 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, IC3 plus IC6, and IC4 plus IC7, is routed via push-to-on switches S1, S2, and S3 respectively. The three sets (each comprising a CD4033, a CD4017, and a 7digit display) function independently with the reset pin 15 of all CD4017 and CD4033 ICs tied together. On reset, only the Y0 outputs of the ring counter ICs (CD4017) are high, while all other outputs (Y1 through Y9) are low. At this instant, the output of all CD4033 counters would also correspond to zero count and thus the display would show 000. When the first clock pulse is applied to any of the CD4017-CD4033 pairs, the high output of CD4017 shifts from Y0 to Y1. At the same time the count on its paired CD4033 advances from zero to one and the corresponding seven-segment also displays 1. For the second clock pulse, the high level shifts to Y2 output, the count on the paired CD4033 increments by one count, and the corresponding display shows 2. The count can be incremented by a maximum of nine clock cycles when Y9 output goes high and the corresponding display also shows 9. On the next clock (tenth), the Y0 output again goes high and the display also shows 0. Thereafter, the cycle repeats itself. The outputs of ICs CD4017 (IC5 through IC7) are connected to the inputs of three 3-input AND gates N1, N2, and N3 inside IC8 (CD4073). Depending upon the desired code for any given appliance’s operation, one can make corresponding connections from the outputs of CD4017 ICs to the AND gate used for controlling the operation of the specific appliance. For example, if you want code for appliance 1 to be 794, then connect output Y7 of IC5, Y9 of IC6 and Y4 of IC7 to the inputs of AND gate N1. The output of gate N1 is

PARTS LIST Semiconductors: IC1, IC10 - NE555 timer IC2-IC4 - CD4033 decade counter, 7segment decoder and driver IC5-IC7 - CD4017 decade ring counter IC8 - CD4073 triple 3-input AND gate IC9 - ULN2003 high-current Darlington driver IC11 - UM66 musical tone generator T1 - BC548 npn transistor D1-D5 - IN4007 rectifier diode D6 - 3.1V zener diode LED1-LED3 - Green LEDs DIS.1-DIS.3 - LT543, 7-segment common cathode display Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1-R2 - 22-kilo-ohm R3-R23, R26-R28 - 1-kilo-ohm R24 - 100-kilo-ohm R25 - 100-ohm Capacitors: C1 C1 C2, C4, C5 C3

-

Miscellaneous: Xtal S1-S3 S4 S5-S7 RL1-RL3 RL4 -

0.1µF, 10V polyster 33µF, 25V electrolytic 0.01µF ceramic disc 47µF, 25V electrolytic 3.579545 MHz crystal Push-to-on switch SPDT changeover switch Simple on/off switch 6V, 100-ohm DPDT relay 6V, 100-ohm SPDT relay Bergstrip male/female connectors

connected for control of appliance number 1 through high-current Darlington array IC ULN2003 (input pin 2 and output pin 15) to DPDT relay RL1. When relay RL1 energises, assuming switch S5 is in on position, the relay gets latched as it receives the positive supply via the switch and ground via one of its N/O contacts. Thus, once an appliance is operated after its corELECTRONICS PROJECTS Vol. 20

105

Fig. 1: Schematic circuit diagram of a multichannel code lock system

106

ELECTRONICS PROJECTS Vol. 20

responding switch and code have been correctly selected, it can be switched off manually by flipping its corresponding switch (S5, S6, or S7) to off position. Similarly, for control of other appliances, outputs of AND gates N2 and N3 are connected to input pins 3 and 4 of relay driver IC ULN2003, and its output pins 14 and 13 are connected to relays RL2 and RL3 respectively. External free-wheeling diodes are not required across relay coils because they are built within the ULN2003 IC itself. The circuit incorporates automatic reset arrangement. The outputs of all AND gates are connected in a wired-OR fashion to pin 1 of ULN2003 IC by making use of diodes D2 through D4. Thus, when the output of any AND gate goes high, pin number 1 of IC9 also goes high. This causes its pin 16 to go low and energise RL4, which, in turn, causes the positive supply rail to be extended to the common reset line of all counter ICs (IC2 through IC7). Once the counters get reset, the AND gates’ output drops low and RL4 is de-energised. Simultaneously, the display also returns to show 000, since the counters have been reset. Resetting of the counters and display does not, however, affect the operation of any appliance because of the latching action of the relay, as explained above. Also, when the circuit is reset automatically, as explained above, it produces a musical tone for about five seconds to indicate that some appliance has been switched on. As mentioned earlier, pin 16 of ULN2003 goes low momentarily to automatically reset the counters through operation of relay RL4. The high-to-low-going transition at pin 16 of ULN2003 is also passed to trigger pin 2 of timer IC NE555 (IC10) which is configured here

as a five-second monostable flip-flop. The output of IC10 is connected to musical tone generator IC UM66 (IC11), which generates a musical tone for the five-second duration of monostable pulse output. The code is entered using push-to-on

switches S1, S2, and S3. In case wrong code gets entered, you can re-enter the correct code after resetting the circuit manually, by pressing reset switch S4. During manual resetting, the system will not produce any musical note. During re-

set a logic high level is applied to the pin 15 of all counter and counter/seven-segment driver ICs. In normal case these reset pins are at a logic-low state. The circuit shows the connection of three appliances having codes 794, 969, and 337 respectively. To operate the first appliance, reset the counters by pressing switch S4 momentarily. Flip switch S5 to on position. Now press switch S1 so that clock pulses are applied to IC2 and IC5 pair, and they start counting. Release switch S1 as soon as DIS.1 displays digit seven. Similarly, press switches S2 and S3 for second and third digits of the code. The other two devices can also be operated similarly. For control of additional appliances, just add additional AND gates, ULN2003 Darlington arrays, relays, and switches. Do not forget to connect all AND gates’ outputs to pin 1 of IC9 via diodes for automatic resetting operation. The inputs for additional AND gates can be obtained from the outputs of CD4017 ICs terminated on connectors as shown in the schematic diagram of Fig. 1. Since these CMOS devices have a high fan-out capability (about 50 devices), you can connect each output to a large number of AND gates without degrading their performance. Each device is to be allocated a unique code between 001 and 999 (decimal). If you desire to expand the code, you may do so by just adding the sets comprising ICs CD4017, CD4033, and a seven-segment display. The AND gates used should have the same input (or greater) capacity as the number of sets/digits. The actual-size, single-sided PCB layout for the schematic circuit of Fig. 1 is given in Fig. 2. Please note that the PCB does not contain IC8, IC9, and the connected relays/components. These can be assembled on general-purpose PCBs as per the number of appliances to be controlled by the user. The required points have been brought out on Bergstrip connectors. The component layout for PCB is given in Fig. 3. ❑

Readers Comments: ❑ The display runs continuously from 0 to 9, without stopping. I have assembled the circuit on a self-etched PCB. Rakesh P. Patil Thane

The author, Vijay D. Sathe, replies: Mr Patil should check the tracks of the push-to-on switches S1, S2, and S3—they may be shorted. He may remove the 555 circuit from the system and use the cir-

cuit given in Fig. 1 for switching purposes. To enter the code 794, switch S1 should be pressed seven times, S2 nine times, and S3 four times. ❑

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

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

ELECTRONICS PROJECTS Vol. 20

107

AUTOMATIC INDUCTION MOTOR STARTER WITH PROGRAMMABLE TIMER ARTHUR LOUIS

I

nduction motors are popular due to their low-cost, sturdy construction, fast pick-up, low maintenance expenditure and good efficiency. The DOL (direct-on-line) starters and star/delta starters used for starting and running of induction motors provide coarse type of protections against voltage fluctuations and single phasing. Induction motors are very sensitive to low voltage and single phasing during which they draw a heavy current and can burn out unless switched off within few seconds of occurrence of such conditions. This makes the requirement of a sensitive protective device absolutely essential to avoid burning of induction motors under such conditions. The circuit of an automatic starter, incorporating the important features given below, is described here. It is meant to be used in conjunction with a DOL starter. 1. Under-voltage and over-voltage cutout. 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 the motor). 5. Specially suited for remote operation of induction motor. 6. Simple, easy to construct, and lowcost.

would depend on contactor and motor current ratings. The three phases from the DOL starter are extended to the automatic starter circuit of Fig. 2 via points marked R’, Y’, and B’. The other points which are to be extended to Fig. 2 are marked C through F. All the points marked identically in Figs 1 and 2 are to be connected together. Functions of switches and relays. To understand the circuit operation, it is essential to know the effect of switches S1 through S6 and contacts of relays RL1 and RL2 in on and off conditions. These are discussed below. When switches S1 and S2 are off, only manual operation of the DOL starter,

The circuit As the circuit being described is required to be used with a DOL starter, the internal diagram of the same is given in Fig. 1. The three phases (R, Y, and B) entering the starter are passed via fuses F1, F2, and F3. The current rating of the fuses

108

ELECTRONICS PROJECTS Vol. 20

Fig. 1: Internal wiring diagram of a typical DOL starter

without protections offered by the circuit of Fig. 2, is possible. The C and D points are shorted (via switch S1 in off position) whereas E and F points remain open. In this state, relay contacts have no effect on the DOL starter operation. The motor can be switched on by momentary operation of start switch S6 (green button). Please note that red (R) phase is always connected to one side of the EM (electromagnetic) coil of contactor. The blue (B) phase gets extended to the other side of contactor coil through switch S6 (in depressed state), normally made contacts of stop switch S5 (red button) and shorted C and D points (via switch S1 in off position). Once the contactor coil is

Fig. 2: Schematic diagram of automatic induction motor starter

energised, it is latched via its own contact marked ‘5’ and closed dry run points D1 and D2 to provide alternate path for B phase to the contactor coil. All three phases (R, Y, and B) are extended to the induction motor via the closed contacts of the contactor, and the motor runs. When switch S1 is on and switch S2 is off, the red (R) phase connection to transformer X1 is through, while yellow (Y) phase is already connected to bottom end of transformer X2. In this state, sensing circuit and B-Y phase detector circuits of Fig. 2 are effective. If all phases are available and voltages are within proper limits, relay RL1 will get energised (as explained later in the text) to close contacts C and D. However, contacts E and F remain open irrespective of the state of relay RL2 (contacts of relay RL2 come in parallel with the contacts of start switch, provided switch S2 is on). Thus in this condition, although safety circuits are functional, auto starting is not feasible. Manual start button S6 has to be pressed for starting the induction motor. This mode of operation is termed here as mode 1. When switches S1 and S2 are both on, then the sensing circuit (for under/ over voltages and single phasing) as well as auto start circuits are operational. The effect of switch S1 and relay RL1 has already been explained above. Relay RL2, which remains on for a short while (as explained later in the text), along with energisation of relay RL1, acts in the same way as momentary depression of start switch S6 to provide auto start/ restart facility when 3-phase voltages are within limits. ELECTRONICS PROJECTS Vol. 20

109

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

Fig. 4: Component layout for the PCB

This is termed here as mode 2 operation. Switch S3 is used for automatic switching off of the induction motor after it has operated for a preprogrammed period selected with the help of rotary switch S4. During mode 1 (switch 1 on and switch 2 off) operation when switch 3 is on, the induction motor will be switched off when programmed on-time is completed or whenever power fails. However, after power resumes (and if all phase voltages are within limits), the motor can be restarted with the help of start switch manually, provided the programmed period is not over. During mode 2 (both switches S1 and S2 on) operation if switch S3 is on, the motor will keep restarting automatically whenever power resumes

110

ELECTRONICS PROJECTS Vol. 20

(or all 3-phase voltages become alright) until the programmed running period is over. Power supply. The power supply for the schematic circuit of Fig. 2 is derived from R and Y phases, using two mains transformers with primary voltage rating of 230V AC connected in series across it through DPDT slide switch S1. Their secondaries rated at 6V-0-6V AC, 200mA are also connected in series to realise 12V-012V output across rectifier diodes D1 and D2, connected as full-wave rectifiers. The output of rectifier, after some smoothing by capacitor C1, is used for the purpose of sampling of under/over voltage conditions. The output across capacitor C1, after passing through diode D3, is further filtered

by capacitor C3 before regulation by 9volt regulator 7809 (IC1). The regulated output of IC1 regulator is used for powering the entire circuit. No heat sink is required for regulator 7809. Note: When two transformers (X1 and X2) are used in this fashion, the AC output voltage should be checked after connecting the secondaries of both transformers in series. If no voltage is present across anodes of diodes D1 and D2 then either primary or secondary connections need be reversed (but not both). Under/over voltage cutout. This section comprises an 8-pin dual comparator LM393N (IC3) in DIL (dual-in-line) package. The output of the two comparators (at pins 1 and 7) has been combined in a wired-OR fashion . This output is high as long as sampled voltages being monitored are within preset limits. When sampled voltages are out of limits, the wired-OR output goes low. Here IC2(a) is used as over-voltage detector, while IC2(b) is used as undervoltage detector. The 4.2V developed across zener D4 is used as reference voltage for both the comparators. The potmeter VR1 is so adjusted that when the phase-to-phase (R-Y) input voltage across primary of transformer (X1 and X2 combined) is less than a specific desired level (say 350V RMS), the voltage at its wiper contact goes less than 4.2 volts. Thus, the output of comparator IC2(b) and also the wired-OR output goes low, irrespective of output of comparator IC2(a). Similarly, potmeter VR2 is so adjusted that when the voltage between RY phases exceeds certain desired value (say 480V AC RMS), the voltage at its wiper contact goes higher than 4.2 volts, and the output of comparator IC2(a) goes low. Thus, we observe that whenever the R-Y phase-to-phase voltages are beyond acceptable limits, the output of comparator goes low to switch off the motor after a delay of four seconds, as explained in the following section. On/off time delay. The popular NE555 timer is so configured as to provide an on-time delay of 12 seconds after all conditions are suitable (i.e. all 3 phases are present and the phase-to-phase voltages are also within limits). If all conditions are alright (at the time of start— with slide switch S1 in on position), capacitor C4 will be charged via resistors R2 and R4 which would take about 12 seconds to make pin 2 of 555 high, so that its output (at pin 3) goes low to cut off

PARTS LIST Semiconductors: IC1 - 7809 fixed regulator +9 volts IC2 - LM393 voltage comparator IC3 - NE555 timer IC4 - CD4060 14-stage ripple counter/oscillator IC5 - MC2TE opto-coupler T2,T3 - BC547 npn transistor T4,T5,T6 - 2N2222 switching transistor D1-D3,D5-D10, D12-D16 - 1N4007 rectifier diode D4 - 4.2V, 0.5W zener D11 - 27V, 0.5W zener LED1-LED3 - Coloured LED Resistors (all ¼ W, ± 5% carbon, unless stated otherwise): R1,R5,R8-R10,R12 R15,R18,R21 - 1-kilo-ohm R2,R22 - 22-kilo-ohm R3,R7,R19, R20,R25 - 10-kilo-ohm R4 - 47-kilo-ohm R6 - 220-kilo-ohm R11,R14 - 4.7-kilo-ohm R15 - 470-kilo-ohm R16,R17 - 47-kilo-ohm, 1W R22 - 22-kilo-ohm R23 - 1-mega-ohm R24 - 100-kilo-ohm R26 - 22-kilo-ohm, 1W VR1,VR2 - 4.7-kilo-ohm potmeter Capacitors: C1,C8 C2 C3 C4 C5 C6 C7 C9 C10

-

Miscellaneous: LED1 RL1,RL2 S1,S2,S3 X1,X2 S4

-

47µF, 25V electrolytic 1000µF, 25V electrolytic 470µF, 16V electrolytic 100µF, 16V electrolytic 0.01µF ceramic disc 220µF, 16V electrolytic 4.7µF, 63V electrolytic 0.1µF ceramic disc 4.7µF, 25V electrolytic

Yellow LED 9V, 150-ohm, SPST relay Slide switches DPDT 250V primary to 6V-0-6V, 200 mA sec. transformer Battery PP9V Rotary switch single-pole 7-throws DOL starter (refer Fig. 1 for details) Bergstrip connectors-male/ female

transistor T3. As a result, base of transistor T4 gets forward biased via resistor R9 (and R13) to energise relay RL1 to short points C and D (refer Figs 1 and 2) through its contacts, and energise contactor in the DOL starter of Fig. 1 via the start switch (in pressed state) or due to energisation of relay RL2 for short duration with switch S2 on (explanation covered under ‘Auto start unit’ subheading). Thus, motor starts after an ontime delay of 12 seconds. When comparator IC2 senses undervoltage or over-voltage condition, its output goes low and capacitor C4 discharges via resistance R4. This will take about

four seconds before it causes pin 2 of IC3 to go low or its output to go high, which in turn causes de-energisation of relay RL1 to eventually switch off the motor. This is the off-time delay which allows the motor not to switch off if the voltage returns to normal state within this 4second period. If the voltage does not return to normal state within this period then only the motor is switched off. This avoids unnecessary switching off of the motor during momentary voltage fluctuations. Single-phase cutout. When a single phase failure occurs, the motor will continue to run on remaining two phases, drawing heavy load current. This would result in overheating of windings and its eventual burning in a short time if it is not disconnected. The single-phase cutout circuit employed here is very simple and it has the capability to sense all three phases, including low voltage condition of phase B. Sensing of under-voltage and over-voltage condition of R and Y phases is already taking place, as described earlier. Phase failure of R and/or Y phase(s) results in no supply to the circuit and relays RL1 and RL2 will be in de-energised state and the motor is, therefore, switched off. In Y-B single phase detector part of the circuit, the diode D12 in Y phase path rectifies the voltage before potential divider network, comprising resistors R16 and R17, reduces the voltage with respect to phase B. Capacitor C7 smooths the voltage across resistor R17. If this voltage is greater than 27V, zener D11 as well as the diode inside opto-coupler IC4 will conduct. As a result, base of transistor T2 is pulled to ground and it is cut off. This causes the comparator output to be applied to pin 2 of timer NE555 without any change (modification). But in case the B-phase voltage is very low, or if it is missing altogether, transistor T2 will be biased to saturation condition, discharging capacitor C4 via resistor R5. As a result, pin 2 of timer 555 would go low immediately and eventually switches off relay RL1 to cut off the contactor in DOL starter as well as the motor. Auto start unit. The necessity of auto start unit has, of late, increased due to frequent power interruptions, including single phasing. Many auto start units are available in the market. The auto start circuit comprises the circuitry around relays RL1 and RL2 (and their contacts), slide switches S1 and S2, and the DOL starter.

During normal conditions, the output of timer NE555 will initially go high for 12 seconds on resumption of power or when normal state is reached. The capacitor C6 will be charged through resistor R11. However, the base of transistor T5 will be held to ground potential by diode D6, which is forward biased due to the condition of transistor T3. As a result, relay RL2 will be in off state due to non-conduction of transistor T5. When NE555 IC changes its output state from high to low after 12 seconds, diode D6 will be reverse-biased due to the positive voltage at anode of diode D6. Capacitor C6 will get discharged via resistor R11 and transistor T5 will come to conduction state due to the positive voltage at its base. As a result, relay RL2 will get energised. The discharge action of capacitor C6 continues for about two seconds (which is sufficient to bring the electromagnetic relay of DOL starter to on position). Once the starter EM relay energises, it is latched as explained under ‘Functions of relays and switches’ subheading. After two seconds, the base of transistor T5 will fall to ground potential and relay RL2 will be switched off. However, relay RL1 will continue to be on and hold the motor in on state. Timer. The timer is built around 14stage CMOS counter CD 4060 which has an on-chip oscillator. The timing component, comprising resistor R24 and capacitor C8, is selected to get an approximate off-time delay of 20 minutes at Q7, 45 minutes at Q8, 1.5 hours at Q9, 3 hours at Q10, 6 hours at Q11, 12 hours at Q12, and 24 hours at Q13 output. The timer is not affected by power cuts as it is provided with a backup, using a 9V, PP3 battery. The timer function comes into play when switch S3 is flipped to on position. When power fails, transistor T6 will cut off due to absence of any forward bias voltage at its base. This forward biases diode D14, which makes pin 11 of the counter high and the counter suspends further counting. When power resumes, the counter proceeds further and the time count is thus not lost. The same thing occurs when an unhealthy condition of line is detected. Pin 3 of timer 555 goes high and diode D13 causes suspension of counting. When the final count is reached, the corresponding output pin of IC5 goes high. The IC5 output is coupled to pin 11 via diode D12 to suspend the counting. At ELECTRONICS PROJECTS Vol. 20

111

the same time this high output is also connected to the base of transistor T3, which starts conducting and takes the base of transistor T4 to cut-off. As a result relay RL1 de-energises to switch off the motor. To set the counter timing, first set the value of time by rotary switch S4 and then flip switch S3 on to start the timer. To reset the timer push switch S3

112

ELECTRONICS PROJECTS Vol. 20

to off and then switch it on again. LED indicators. LED1, when on, indicates that switch S1 is on and R-Y phase supplies and 9V output from the regulator IC1 are available. LED2, when on, indicates that relay RL1 has energised. LED3 is on when switch S3 is on and 9V supply from IC1 for timer is available. An actual-size, single-sided PCB for the circuit of Fig. 2 is shown in Fig. 3.

The component layout for the PCB is given in Fig. 4. All switches, relays, and transformers are to be mounted externally. As the B-Y phase detector circuit contains high voltages, it is recommended to cut out the phase detector part up to optocoupler from the PCB and install the same externally. Only the output leads from the opto-coupler may be soldered on to the points provided on the PCB. ❑

SECTION B: CIRCUIT IDEAS

TELEPHONE LINE VIGILANT K. UDHAYA KUMARAN (VU3GTH)

H

ere is a telephone line vigilant circuit to guard against misuse of your telephone lines. It monitors telephone lines round-the-clock and provides visual as well as an audio warning (when someone is using your telephone lines) which can be heard anywhere in the house. Another advantage of using this circuit is that one comes to know of the misuse and snapping of the lines (due to any reason) instantaneously, on its occurance. This enables the subscriber to take necessary remedial measures in proper time. Various telephone line conditions and resulting audio-visual indications available from the circuit are summarised in Table I. Even when the subscriber himself is using his telephone (handset off-cradle) while the vigilant circuit is on, the buzzer beeps once every 5 seconds since the vigilant circuit cannot distinguish between self-use of the subscriber lines or its misuse by any unauthorised person. Thus to avoid unnecessary disturbance, it is advisable to install the vigilant unit away from the phone. However, if one wishes to fit the unit near the telephone then switch S1 may be flipped to ‘off’ position to switch off the buzzer. But remember to flip the switch to ‘on’ position while replacing the handset on cradle. Irrespective of telephone line polarity at the input to the circuit, proper DC polarity is maintained across C1 due to bridge rectifier comprising diodes D1 to D4. The DC voltage developed across capacitor

C1 is used to check telephone line condition as per Table I. This circuit draws negligible current from telephone line; thus when it is connected to the telephone line, the normal telephone operation is

TABLE I S. No. Telephone line condition 1. Telephone line disconnected 2. Phone line in use (H/S off-cradle) 3. Phone line not in use (H/S on-cradle)

Green Red LED LED Not Lit Lit Lit Lit

Lit

Line Voltage 0V

9V DC (approx.) Not Lit 48V DC

Audio indication Continuous sound Beep, once every 5-seconds No sound

not affected. The circuit may be divided into two parts. The first part comprises zener D9, transistors T1 to T4 and diode D5. It is used to verify whether telephone line loop is intact or discontinuous. The second part comprising zener D10 and transistors T5 to T10 is used to check whether telephone line is in use (or misuse) or not. The zener diode D9 (3.3V) conducts when phone line loop is intact and not broken. On conduction Zener D9 provides forward bias for transistors T1, T2 and T3 to conduct and reverse bias for T4 to cut off. As a result, green LED lights but no sound ELECTRONICS PROJECTS Vol. 20

115

is heard from the buzzer. When phone line loop is discontinuous, no voltage is available across capacitor C1. Thus zener D9 and transistors T1, T2 and T3 do not conduct while T4 conducts. Now green LED extinguishes and a continuous sound is heard from the buzzer. When telephone line is alright but is not in use, zener D10 conducts as voltage across capacitor C1 is quite high. This

results in conduction of transistors T5 and T6 and cutting off of transistor T7 (as collector of transistor T6 is near ground potential). Thus positive 9V rail is not extended to the following multivibrator circuit built around transistors T8 and T9. Consequently, the red LED is not lit and buzzer does not sound. When phone line is in use, zener D10 does not conduct. As a result, transistors T5 and T6 also do not conduct, while tran-

sistor T7 conducts. Now +9V is extended to multivibrator circuit. This multivibrator is designed such that collector of transistor T9 goes high once every 5 seconds to forward bias transistor T10 and it conducts. Thus at every 5-second interval a beep sound is heard from buzzer. The beep sound interval can be increased or decreased by changing the value of capacitor C3 while the volume can be adjusted with the 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 a room where a television set is operating. I would like the author to modify the circuit by using a transistor amplifier to

increase the output. The base-emitter circuit of the amplifier should replace the buzzer and the collector should be connected to 9V DC supply through the buzzer. Ajay K.S. Bhopal The author K. Udhaya Kumaran

replies: Please recheck your circuit connections. Spurious buzzers produce less sound. Good-quality, continuous-tone buzzers with built-in oscillator produce sufficient sound which overrides all surrounding noise.

HIGH AND LOW VOLTAGE CUTOUT WITH DELAY AND MELODY ARTHUR LOUIS

V

oltage variations and power cuts adversely affect various equip ment such as TVs, VCRs, music systems and refrigerators. This simple circuit will protect the costly equipment from

116

ELECTRONICS PROJECTS Vol. 20

high as well as low voltages and the voltage surges. It also gives a melodious tune when mains power resumes after a break. When mains voltage is normal, the DC voltage at the cathode of zener diode

D4 is less then 5.6V. As a result transistor T1 is in ‘off’ state. The DC voltage at the cathode of zener diode D5 is greater than 5.6V and as a result transistor T2 is in ‘on’ state. Consequently, relay RL1 gets

energised, which is indicated by lighting up of green LED. Under high mains voltage condition, transistor T1 switches to ‘on’ state because the voltage at cathode of zener diode D4 becomes greater than 5.6V. Consequently, transistor T2 switches to ‘off’ state, making the relay to de-energise Under low mains voltage condition, transistor T1 switches to ‘off’ state and as a result transistor T2 also switches to ‘off’ state, making the relay to de-energise. Timer IC 555 in the circuit is configured to operate in a monostable mode. The pulse

width is about 10 seconds with the timing component values used in the circuit. When the power resumes after a break, pin 2 of IC 555 goes low briefly and this triggers it. Its output makes music IC UM66 to operate through transistor T3. Simultaneously, transistor T1 also gets forward biased as the monostable IC1 output is connected to its base via diode D8 and resistor R7. As a result, transistor T1 conducts and biases transistor T2 to cut off. Thus relay RL1 remains de-energised for the duration of mono pulse and the

Readers Comments: I have assembled the circuit and observed that even after setting the low and high voltage presets for 170V and 270V

respectively, the relay starts chattering when the voltage reaches 260V. The same is true for the lower voltage limit also. To overcome the problem I have tried the circuit given in Fig. 1 for upper limit and it works satisfactorily. A similar circuit can also be used for lower cut-off limit. I would, however, like the author to sug- Fig. 2: Modification of melody circuit suggested by the gest suitable changes for proper author reaching the threshold level, please conoperation of the original circuit. nect a capacitor of 470µF, 16V in parallel Mukesh P. Tatiya with relay coil. I also suggest slight modiAhmednagar fication of melody circuit after transistor The author Arthur Louis T3, as shown in Fig. 2, for its proper opreplies: eration. To avoid chattering of relay on

Fig. 1: Suggested circuit for hi/low cut off

load is protected against the voltage surges. To adjust presets VR1 and VR2, you may use a manually variable auto-transformer. Set the output of auto-transformer to 270V AC and connect it to the primary of transformer X1. Adjust preset VR1 such that relay RL1 just de-energises. Next set the output of auto-transformer to 170V AC. Now adjust preset VR2 such that relay RL1 again de-energises. Volume control VR3 may be adjusted for the desired output volume of the tune generated by IC UM66.

RUNNING MESSAGE DISPLAY V. KANNAN

L

ight emitting diodes are advantageous due to their smaller size, low current consumption and catchy colours they emit. Here is a running message display circuit wherein the letters formed by LED arrangement light up progressively. Once all the letters of the message have been lit up, the circuit gets reset. The circuit is built around Johnson decade counter CD4017BC (IC2). One of the IC CD4017BE’s features is its provision of ten fully decoded outputs, making the IC ideal for use in a whole range of

sequencing operations. In the circuit only one of the outputs remains high and the other outputs switch to high state successively on the arrival of each clock pulse. The timer NE555 (IC1) is wired as a 1Hz astable multivibrator which clocks the IC2 for sequencing operations. On reset, output pin 3 goes high and drives transistor T7 to ‘on’ state. The output of transistor T7 is connected to letter ‘W’ of the LED word array (all LEDs of a letter array are connected in parallel) and thus letter ‘W’ is illuminated. On arrival of

first clock pulse, pin 3 goes low and pin 2 goes high. Transistor T6 conducts and letter ‘E’ lights up. The preceding letter ‘W’ also remains lighted because of forward biasing of transistor T7 via diode D21. In a similar fashion, on the arrival of each successive pulse, the other letters of the display are also illuminated and finally the complete word becomes visible. On the following clock pulse, pin 6 goes to logic 1 and resets the circuit, and the sequence repeats itself. The frequency of sequencing operations is controlled with the help of potmeter VR1. ELECTRONICS PROJECTS Vol. 20

117

118

The display can be fixed on a veroboard of suitable size and connected to ground of a common supply (of 6V to 9V) while the anodes of LEDs are to be

connected to emitters of transistors T1 through T7 as shown in the circuit. The above circuit is very versatile and can be wired with a large number of LEDs

to make an LED fashion jewellery of any design. With two circuits connected in a similar manner, multiplexing of LEDs can be done to give a moving display effect.

Readers Comments: ❑ The circuit seems to have been made unnecessarily complicated. All diodes can be eliminated by using 8-bit register IC 74HCT164 in place of decade counter IC 4017. Pradeep G. Alappuzhu ❑ Since the transistors T1 to T7 (2N3053) are not readily available in the market, can we use transistor 2N3055 instead? V. Sundaresh Salem ❑ Although the above-mentioned circuit is functioning well, it can be further simplified by using lesser number of diodes as shown in Fig. 1. Louis Mandya Mandya ❑ What is the maximum number of LEDs that can be used per word? Ajay Gupta Pantnager ❑ Can we increase or decrease the number of characters in the message? Faisel K. Qazi New Mumbai

The author, V. Kannan, replies: In reply to Pradeep’s letter, I would like to say that the idea of using IC 7AHCT164 is good, but the actual circuit was designed using two 4017 ICs to obtain a miltiplexed display. Since the circuit became too complicated, it was redrawn for simplicity keeping the basic idea unchanged—allowing room for multiplexing operations. In reply to Sundaresh, I would like to

say that transistors T1 to T7 (2N3053) have a maximum current-rating of 700mA, whereas transistor 2N3055 has a currentrating of 3A-5A, which is not necessary. If transistor 2N3053 is not available, transistor 2N3447 or any npn transistor of 500mA to 700mA current-rating can be used. Cascading of diodes, as mentioned by Louis Mandya, would have the following effect: base-terminal voltage of each suc-

ELECTRONICS PROJECTS Vol. 20

Fig. 1: Suggested circuit for moving message display

In reply to Ajay Gupta and Faisel K. Qazi I would like to say that the number of LEDs that can be connected in parallel depends upon the current rating of the transistor. This may be calculated as under: Maximum Number of Parallel LEDs=Collector Current Rating of Transistor ÷ Current drawn by One LED

Fig. 2: Cascading of CD4017s

ceeding transistor would be 0.65V less than its predecessor. As a result, the last

few transistors would not be sufficiently forward-baised to conduct properly.

Using a single IC, a maximum of ten characters (and a minimum of one) can be obtained. By cascading two 4017 ICs, we can obtain up to 17 characters. (Note: Outputs 0 and 10 are high even during reset and hence these may not be used.) Tech Editor: The circuit diagram for cascading two CD4017 is shown in Fig. 2.

COLOUR SENSOR TONY GLADVIN GEORGE

C

olour sensor is an interesting project for hobbyists. The circuit can sense eight colours, i.e. blue, green and red (primary colours); magenta, yellow and cyan (secondary colours); and black and white. The circuit is based on the fundamentals of optics and digital electronics. The object whose colour is required to be detected should be placed in front of the system. The light rays reflected from the object will fall on the three convex lenses which are fixed in front of the three LDRs. The convex lenses are used to converge light rays. This helps to increase the sensitivity of LDRs. Blue, green and red glass plates (filters) are fixed in front of LDR1, LDR2 and LDR3 respectively. When reflected light rays from the object fall on the gadget, the coloured filter glass plates determine which of the LDRs would get triggered. The circuit makes use of only ‘AND’ gates and ‘NOT’ gates. When a primary coloured light ray falls on the system, the glass plate corresponding to that primary colour will allow that specific light to pass through. But the other two glass plates will not

13

ELECTRONICS PROJECTS Vol. 20

119

allow any light to pass through. Thus only one LDR will get triggered and the gate output corresponding to that LDR will become logic 1 to indicate which colour it is. Similarly, when a secondary coloured light ray falls on the system, the two primary glass plates corresponding to the mixed colour will allow that light to pass through while the remaining one will not allow any light ray to pass through it. As a result two of the LDRs get triggered

and the gate output corresponding to these will become logic 1 and indicate which colour it is. When all the LDRs get triggered or remain untriggered, you will observe white and black light indications respectively. Following points may be carefully noted: 1. Potmeters VR1, VR2 and VR3 may be used to adjust the sensitivity of the LDRs. 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, behind a lens, and aimed at the object. The coloured glass filter should be fixed in front of the LDR as shown in the figure. Make three of that kind and fix them in a suitable case. Adjustments are critical and the gadget performance would depend upon its proper fabrication and use of correct filters as well as light conditions.

LOW CURRENT, HIGH VOLTAGE POWER SUPPLY NAGESH UPADHYAYA

A

high voltage power supply is a very useful source which can be effectively used in many applications like biasing of gas-discharge tubes and radiation detectors etc. Such a power supply could also be used for protection of property by charging of fences. Here the current requirement is of the order of a few microamps. In such an application, high voltage would essentially exist between a ‘live’ wire and ground. When this ‘live’ wire is touched, the discharge occurs via body resistance and it gives a non-lethal but deterrent shock to an intruder. The circuit is built around a transistorised blocking oscillator. An important element in this circuit is the transformer. It can be fabricated using easily available ferrite core. Two ‘E’ sections of the core are joined face-to-face after the enamelled copper wire wound on former is placed in it. The details of the transformer windings are given in the Table. In this configuration, the primary winding and the feedback winding are arranged such that a sustained oscillations are ensured once the supply is switched on. The waveform’s duty cycle is asymmetrical, but it is not very important in this application. Please note that if the oscillations do not occur at the ‘switch-on’ time, the transformer winding terminals of the feedback or the primary winding (but not both) should be reversed.

120

ELECTRONICS PROJECTS Vol. 20

TABLE Details of the Transformer Windings Windings No. of Standard wire turns gauge (SWG) Primary 50 31 Feedback 12 31 Secondary 1650 41

The primary oscillations amplitude is about 24V(p-p). This gets further amplified due to the large step-up ratio of the transformer and we get about 800V(p-p) across the secondary. A simple series voltage multiplier (known as Cockroft-Walton circuit) is used to boost up this voltage in steps to give a final DC voltage of about 2 kV. The output voltage, however, is not very well regulated. But if there is a con-

stant load, the final voltage can be adjusted by varying the supply voltage. The present configuration gives 2 kV for an input DC voltage of 15 V. Though higher voltages could be achieved by increasing input supply, one word of caution is necessary: that the component ratings have to be kept in mind. If the ratings are exceeded then there will be electrical discharges and breakdowns, which will damage the device.

Readers Comments: ❑ I would like the author to clarify my following doubts: 1. Is the polarity of the output positive or negative? If it is positive, can negative polarity output be obtained, and vice versa? 2. Can higher values of voltage be

obtained (around 8kV to 9kV) by increasing the number (not value) of capacitors and diodes of the series voltage multiplier? The author Nagesh Upadhyaya replies: 1. The polarity of output is positive. It is not possible to get a negative polarity

AUDIO-VISUAL EXTRA RINGER FOR PHONE T.K. HAREENDRAN

M

any a times one needs an extra telephone ringer in an adjoining room to know if there is an incoming call. For example, if the telephone is installed in the drawing room you may need an extra ringer in the bedroom. All that needs to be done is to connect the given circuit in parallel with the existing telephone lines using twin flexible wires. This circuit does not require any external power source for its operation. The section comprising resistor R1 and diodes D5 and LED1 provides a visual indication of the ring. Remaining part of the circuit is the audio ringer based on IC1 (BA8204 or ML8204). This integr- ated circuit, specially designed for telec- om

application as bell sound generator, requires very few external parts. It is readily available in 8-pin mini DIP pack. Resistor R3 is used for bell sensitivity adjustment. The bell frequency is control-

output with this circuit. 2. Higher voltages can be obtained by increasing the number of stages. But after finite number of stages, the current capacity becomes unusable and we have to resort to either increasing the input voltage or the number of turns in the secondary windings of the transformer.

led by resistor R5 and capacitor C4, and the repetition rate is controlled by resistor R4 and capacitor C3. A little experimentation with the various values of the resistors and capacitors may be carried out to obtain desired pleasing tone. Working of the circuit is quite simple. The bell signal, approximately 75V AC, passes through capacitor C1 and resistor R2 and appears across the diode bridge comprising diodes D1 to D4. The rectified DC output is smoothed by capacitor C2. The dual-tone ring signal is output from pin 8 of IC1 and its volume is adjusted by volume control VR1. Thereafter, it is impressed on the piezo-ceramic sound generator.

HANDY ZENER DIODE TESTER K. UDHAYA KUMARAN (VU3GTH)

H

ere is a handy zener diode tester which tests zener diodes with breakdown voltages extending up to 120 volts. The main advantage of this circuit is that it works with a voltage as low as 6V DC and consumes less than 8 mA current. The circuit can be fitted in a 9V battery box. Two-third of the box may be used

for four 1.5V batteries and the remaining one-third is sufficient for accommodating this circuit. In this circuit a commonly available transformer with 230V AC primary to 9-0-9V, 500mA secondary is used in reverse to achieve higher AC voltage across 230V AC terminals. Transistor T1 (BC547) is configured as an oscillator and driver to obtain re-

quired AC voltage across transformer’s 230V AC terminals. This AC voltage is converted to DC by diode D1 and filter capacitor C2 and is used to test the zener diodes. R3 is used as a series current limiting resistor. After assembling the circuit, check DC voltage across points A and B without connecting any zener diode. Now switch ELECTRONICS PROJECTS Vol. 20

121

S1 on. The DC voltage across A-B should vary from 10V to 120V by adjusting potmeter VR1 (10k). If every thing is all right, the circuit is ready for use. For testing a zener diode of unknown value, connect it across points A and B with cathode towards A. Adjust potmeter VR1 so as to obtain the maximum DC voltage across A and B. Note down this zener value corresponding to DC voltage reading on the digital multimeter. When testing zener diode of value less than 3.3V, the meter shows less voltage instead of the actual zener value. However, correct reading is obtained for zener diodes of value above 5.8V with a tolerance of ±10 per cent. In case zener diode shorts, the multimeter shows 0 volts.

AUTOMATIC EMERGENCY LIGHT LOKESH KUMATH

T

he circuit of automatic emergency light presented here has the following features: 1. When the mains supply (230V AC) is available, it charges a 12V battery up to 13.5V and then the battery is disconnected from the charging section. 2. When the battery discharges up to 10.2V, it is disconnected from the load and the charging process is resumed. 3. If the mains voltage is available and there is darkness in the room, load (bulb or tube) is turned on by taking power from the mains; otherwise the battery is connected to the load. 4. When the battery discharges up to 10.2V and if the mains is not yet available, the battery is completely disconnected from the circuit to avoid its further discharge. The mains supply of 230V AC is stepped down to 18V AC (RMS) using a 230V AC primary to 0-18V AC, 2A secondary transformer (X1), generally used in 36cm B&W TVs. Diodes D1 through D4 form bridge rectifier and capacitor C5 filters the voltage, providing about 25V DC at the output. Charging section includes 33-ohm, 10watt resistor R2 which limits the charging current to about 425 mA when bat-

122

ELECTRONICS PROJECTS Vol. 20

tery voltage is about 10.2V, or to 325 mA when battery voltage is about 13.5V. When the battery charges to 13.5V (as set by VR2), zener diode D17 breaks down, thereby triggering triac TR1. Now, since DC is passing through the triac, it remains continuously ‘on’ even if the gate current is reduced to zero (by disconnecting the gate terminal). Once the battery is fully charged, charging section is cutoff from the battery due to energisation of relay RL2. This relay remains ‘on’ even if the power fails because of connection to the battery via diode D10. Switch S4, a normally closed switch, is included to manually restart the charging process if required. Battery disconnect and charging restart section comprises an NE555 timer (IC2) wired as monostable multivibrator. When the battery voltage is above 10.2V (as indicated by red LED D15), zener diode (D16) remains in the breakdown region, making the trigger pin 2 of IC2 high, thereby maintaining output pin 3 in low voltage state.

Thus, relay RL3 is ‘on’ and relay RL4 is ‘off.’ But as soon as the battery voltage falls to about 10.2V (as set by preset VR1), zener diode D16 comes out of conduction, making pin 2 low and pin 3 high to turn ‘on’ relay RL4 and orange LED D13. This also switches off relay RL3 and LED D15. Now, if the mains is available, charging restarts due to de-energisation of relay RL2 because when relay RL4 is ‘on,’ it breaks the circuit of relay RL2 and triac TR1. But if the mains supply is not present, both relays RL3 and RL1 de-energise, disconnecting the battery from the remaining circuit. Thus when battery voltage falls to 10.2 volts, its further discharge is curtailed.

But as soon as the mains supply resumes, it energises relay RL1, thereby connecting the battery again to the circuit. Light sensor section also makes use of a 555 timer IC in the monostable mode. As long as normal light keeps falling on LDR1, its resistance is comparatively low. As a result pin 2 of IC3 is held near Vcc and its output at pin 3 is at low level.

In darkness, LDR resistance is very high, which causes pin 2 of IC3 to fall to near ground potential and thus trigger it. As a consequence, output pin 3 goes high during the monostable pulse period, forward biasing transistor T3 which goes into saturation, energising relay RL5. With auto/bypass switch S2 off (in auto mode), the load gets connected to supply via switch S3. If desired, the load may be switched during the day-time by flipping switch S2 to ‘on’ position (manual). Preset VR3 is the sensitivity control used for setting threshold light level at which the load is to be automatically switched on/off. Capacitors across the relays ensure that there is no chattering of the relays. When the mains is present, diode D8 couples the input voltage to regulator IC1 whereas diode D10 feeds the input voltage to it (from battery) in absense of mains supply. Diode D5 connects the load to the power supply section via resistor R5 when mains is available (diode D18 does not conduct). However, when mains power fails, the situation reverses and diode D18 conducts while diode D5 does not conduct. The load can be any bulb of 12 volts with a maximum current rating of 2 am-

peres (24 watts). Resistor R5 is supposed to drop approximately 12 volts when the load current flows through it during mains availability. Hence power dissipated in it would almost be equal to the load power. It is therefore desirable to replace R5 with a bulb of similar voltage and wattage as the load so that during mains availability we have more (double) light than when the load is fed from the battery. For setting presets VR1 and VR2, just take out diodes D7, D10 and D18 (desolder one end). Connect a variable source of power supply in place of battery. Set preset VR1 so that battery-high LED D15 is just off at 10.2V output from the variable source. Increase the potential of the variable source and observe the shift from LO BAT LED D13 to Hi Batt LED D15. Now make the voltage of the source 13.5V and set preset VR2 so that relay RL2 just energises. Then decrease the voltage slowly and observe that relay RL2 does not de-energise above 10.2V. At 10.2V, LED D15 should be off and relay RL2 should de-energise while LED D13 should light up. Preset VR3 can be adjusted during evening hours so that the load is ‘on’ during the desired light conditions.

ELECTRONICS PROJECTS Vol. 20

123

AUTOMATIC ROOM POWER CONTROL TONY GLADVIN GEORGE

A

n ordinary automatic room power control circuit has only one light sensor. So when a person enters the room it gets one pulse and the lights come ‘on.’ When the person goes out it gets another pulse and the lights go ‘off.’ But what happens when two persons enter the room, one after the other? It gets two pulses and the lights remain in ‘off’ state. The circuit described here overcomes the above-mentioned problem. It has a small memory which enables it to automatically switch ‘on’ and switch ‘off’ the lights in a desired fashion. The circuit uses two LDRs which are placed one after another (separated by a distance of say half a metre) so that they may separately sense a person going into the room or coming out of the room. Outputs of the two LDR sensors, after processing, are used in conjunction with a bicolour LED in such a fashion that when a person gets into the room it emits green light and when a person goes out of the room it emits red light, and vice versa. These outputs are simultaneously applied to two counters. One of the counters will count as +1, +2, +3 etc when persons are coming into the room and the other will count as -1, -2, -3 etc when persons are going out of the room. These counters make use of Johnson decade counter CD4017 ICs. The next stage comprises two logic ICs which can combine the outputs of the two counters and determine if there is any person still left in the room or not. Since in the circuit LDRs have been used, care should be taken to protect them from ambient light. If desired, one may use readily available IR sensor modules to replace the LDRs. The sensors are installed in such a way that when a person enters or leaves the room, he intercepts the light falling on them sequentially— one after the other. When a person enters the room, first he would obstruct the light falling on LDR1, followed by that falling on LDR2. When a person leaves the room it will be the other way round. In the normal case light keeps falling on both the LDRs, and as such their

124

ELECTRONICS PROJECTS Vol. 20

resistance is low (about 5 kilo-ohms). As a result, pin 2 of both timers (IC1 and IC2), which have been configured as monostable flip-flops, are held near the supply voltage (+9V). When the light falling on the LDRs is obstructed, their resistance becomes very high and pin 2 voltages drop to near ground potential, thereby triggering the flip-flops. Capacitors across pin 2 and ground have been added to avoid false triggering due to electrical noise. When a person enters the room, LDR1 is triggered first and it results in triggering of monostable IC1. The short output pulse immediately charges up capacitor C5, forward biasing transistor pair T1-T2. But at this instant the collectors of transistors T1 and T2 are in high impedance state as IC2 pin 3 is at low potential and diode D4 is not conducting. But when the same person passes LDR2, IC2 monostable flip-flop is triggered. Its pin 3 goes high and this potential is coupled to transistor pair T1-

T2 via diode D4. As a result transistor pair T1-T2 conducts because capacitor C5 retains the charge for some time as its discharge time is controlled by resistor R5 (and R7 to an extent). Thus green LED portion of bi-colour LED is lit momentarily. The same output is also coupled to IC3 for which it acts as a clock. With entry of each person IC3 output (high state) keeps advancing. At this stage transistor pair T3-T4 cannot conduct because output pin 3 of IC1 is no longer positive as its output pulse duration is quite short and hence transistor collectors are in high impedance state. When persons leave the room, LDR2 is triggered first, followed by LDR1. Since the bottom half portion of circuit is identical to top half, this time, with the departure of each person, red portion of bicolour LED is lit momentarily and output of IC4 advances in the same fashion as in case 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 (using diodes D5 through D8). The net effect is that when persons are entering, the output of at least one of the AND gates is high, causing transistor T5 to conduct and energise relay RL1. The bulb connected to the supply via N/O contact of relay RL1 also lights up. When persons are leaving the room, and till all the persons who entered the room have left, the wired OR output continues to remain high, i.e. the bulb continues to remains ‘on,’ until all persons who entered the room have left. The maximum number of persons that this circuit can handle is limited to four since on receipt of fifth clock pulse the counters are reset. The capacity of the circuit can be easily extended to handle up to nine persons by removing the connection of pin 1 from reset pin (15) and utilising Q1 to Q9 outputs of CD4017 counters. Additional inverters, AND gates and diodes will, however, be required.

TELECOM HEADSET T.K. HAREENDRAN

A

compact, inexpensive and low component count telecom head-set can be constructed using two readily available transistors and a few other electronic components. This circuit is very useful for hands-free operation of EPABX and pager communication. Since the circuit draws very little current, it is ideal for parallel operation with electronic telephone set. Working of the circuit is simple and straightforward. Resistor R1 and an ordinary neon glow-lamp forms a complete visual ringer circuit. This simple arrangement does not require a DC blocking capacitor because, under idle conditions, the telephone line voltage is insufficient to ionise the neon gas and thus the lamp does not light. Only when the ring signal is being received, it flashes at the ringing rate to indicate an incoming call.

The bridge rectifier using diodes D1 through D4 acts as a polarity guard which protects the electronic circuit from any reversal in the telephone line polarity. Zener diode D5 at the output of this bridge rectifier is used for additional circuit protection.

Section comprising transistor T1, resistors R2, R3 and zener diode D6 forms a constant voltage regulator that provides a low voltage output of about 5 volts. Dial tone and speech signals from exchange are coupled to the audio amplifier stage built around transistor T2 and reELECTRONICS PROJECTS Vol. 20

125

lated parts, i.e. resistors R7, R6 and capacitor C5. Amplified signals from collector of transistor T2 are coupled to dynamic receiver RT-200 (used as earpiece) via capacitor C7. A condenser microphone, connected as shown in the circuit, is used as transmitter. Audio signals developed across the microphone are coupled to the base of transistor T1 via capacitor C3. Resistor R4 determines the DC bias required for the microphone. After amplification by transistor T1, the audio signals are coupled to the telephone lines via the diode bridge.

The whole circuit can be wired on a very small PCB and housed in a medium size headphone, as shown in the illustration. For better results at low line currents, value of resistor R2 may be reduced after testing.

Readers Comments: ❑ I have assembled the above-mentioned circuit and observed that although the circuit is functioning satisfactorily, the volume in the earpiece is quite low. How can we increase the volume? A. Rahman Achlady

The author T.K. Hareendran replies: I have retested my prototype, and I like to say that the output level is not very low as stated by Mr Rehman. I request the reader to check his assembled circuit carefully. A single transistor-based audio amplifier, as in my circuit, is good enough for a telecom

headset. One can, however, increase the output power by further modification. For this, a two-transistor amplifier is used. Please refer my circuit idea ‘Handy Telephone Receiver’ published in April ’98 issue of EFY. (Reproduced in Electronics Projects Vol. 19.)

SMART PHONE LIGHT JAYAN A.R.

T

he circuit shown here is used to switch on a lamp when the telephone rings, provided that the ambient light is insufficient.

126

ELECTRONICS PROJECTS Vol. 20

The circuit can be implemented using just two ICs. A light dependent resistance (LDR), with about 5 kilo-ohms resistance in the ambient light and greather

than 100 kilo-ohms in darkness, is at the heart of the circuit. The circuit is fully isolated from the phone lines and it draws current only

when the phone rings. The lamp can be battery powered to provide light during power failure or load shedding also. The light switches off automatically after a programmable time period. If required, the lamp lighting period can be extended by simply pressing a pushbutton switch (S1). The first part of the circuit functions as a ring detector. When telephone is onhook, around 48V DC is present across the TIP and RING terminals. The diode in the opto-coupler is ‘off’ during this condition and it draws practically no current from the telephone lines. The opto-

coupler also isolates the circuit from the telephone lines. Transistor in the optocoupler is normally ‘off’ and a voltage of +5V is present at the ring indicator line B. When telephone rings, an AC voltage of around 70-80V AC present across the telephone lines turns on the diode inside the opto-coupler (IC2), which in turn switches on transistor inside the optocoupler. The voltage at its collector drops to a low level during ringing to trigger IC3 74LS123(A) monostable flip-flop. The other opto-coupler (IC1) is used to detect the ambient light condition.

When there is sufficient light, LDR has a low resistance of about 5 kilo-ohms and the transistor inside the opto-coupler is in ‘on’ state. When there is insufficient light available, the resistance of LDR increases to a few mega-ohms and the transistor switches to ‘off’ state. Thus the DC voltage present at the collector of transistor of the opto-coupler is normally low and it jumps to 5V when there is no light or insufficient light. The 74LS123 retriggerable monostable multivibrator IC is used to generate a programmable pulse-width. The first monostable 74LS123(A) generates a pulse from the trigger input available during ringing, provided its pin 2 input (marked B) is logic high (i.e. during darkness). It remains high for the programmed duration and switches back to 0V at the end of the pulse period. This high-to-low transition (trailing edge) is used to trigger the second monostable flip-flop 74LS123(B) in the same package. Output of the second monostable is used to control a relay. The lamp being controlled via the N/O contacts of the relay gets switched ‘on.’ The ‘on’ period can be extended by simply pressing pushbutton switch S1. If nobody attends the phone, the light turns off automatically after the specific time period equal to the pulse-width of the second flip-flop. The light sensitivity of LDR can be changed by changing resistance R3 connected at collector of the transistor in light monitor circuit. Similarly, switch-on period of the lamp can be controlled by changing capacitor C3’s value in the second 74123(B) monostable circuit.

AUTO RESET OVER/UNDER VOLTAGE CUT-OUT J. GOPALAKRISHNAN

T

his over/under voltage cut-out will save your costly electrical and electronic appliances from the adverse effects of very high and very low

mains voltages. The circuit features auto reset and utilises easily available components. It makes use of the comparators available

inside 555 timer ICs. Supply is tapped from different points of the power supply circuit for relay and control circuit operation to achieve reliability. ELECTRONICS PROJECTS Vol. 20

127

The circuit utilises comparator 2 for control while comparator 1 output (connected to reset pin R) is kept low by shorting pins 5 and 6 of 555 IC. The positive input pin of comparator 2 is at 1/3rd of Vcc voltage. Thus as long as negative input pin 2 is less positive than 1/3 Vcc, comparator 2 output is high and the internal flip-flop is set, i.e. its Q output (pin 3) is high. At the same time pin 7 is in high impedance state and LED connected to

pin 7 is therefore off. The output (at pin 3) reverses (goes low) when pin 2 is taken more * positive than 1/3 Vcc. At the same time pin 7 goes low (as Q output of internal flipflop is high) and the LED connected to pin 7 is lit. Both timers (IC1 and IC2) are configured to function in the same fashion. Preset VR1 is adjusted for under voltage (say 160 volts) cut-out by observing that LED1 just lights up when mains voltage is slightly greater than 160V AC. At this setting the output at pin 3 of IC1 is low and transistor T1 is in cut-off state. As a result RESET pin 4 of IC2 is held high since it is connected to Vcc via 100 kilo-ohm resistor R4. Preset VR2 is adjusted for over volt-

age (say 270V AC) cut-out by observing that LED2 just extinguishes when the mains voltage is slightly less than 270V AC. With RESET pin 4 of IC2 high, the output pin 3 is also high. As a result transistor T2 conducts and energises relay RL1, connecting load to power supply via its N/O contacts. This is the situation as long as mains voltage is greater than 160V AC but less than 270V AC. When mains voltage goes beyond 270V AC, it causes output pin 3 of IC2 to go low and cut-off transistor T2 and deenergise relay RL1, in spite of RESET pin 4 still being high. When mains voltage goes below 160V AC, IC1’s pin 3 goes high and LED1 is extinguished. The high output at pin 3 results in conduction of transistor T1. As a result collector of transistor T1 as also RESET pin 4 of IC2 are pulled low. Thus output of IC2 goes low and transistor T2 does not conduct. As a result relay RL1 is de-energised, which causes load to be disconnected from the supply. When mains voltage again goes beyond 160V AC (but less than 270V AC) the relay again energises to connect the load to power supply.

CLAP REMOTE S. CHANDRA SEKHAR

A

n infra-red or wireless remote control has the disadvantage that the small, handy, remote (transmitter) is often misplaced. The sound op-

128

ELECTRONICS PROJECTS Vol. 20

erated switch has the advantage that the transmitter is always with you. This project offers a way to control up to four latching switches with two claps of your

hand. These switches may be used to control lights or fans—or anything else that does not produce too loud a sound. To prevent an occasional loud sound

from causing malfunction, the circuit is normally quiescent. The first clap takes it out of standby state and starts a scan of eight panel-mounted LEDs. Each of the four switches are accompanied with two LEDs—one for indicating the ‘on’ and the other for indicating the ‘off’ state. A second clap, while the appropriate LED is lit, activates that function. For example, if you clap while LED10 used in conjunction with Lamp 1 is lit then the lamp turns on. (If it is already on, nothing happens and it remains on.) A condenser microphone, as used in tape recorders, is used here to pick up the sound of the claps. The signal is then amplified and shaped into a pulse by three inverters (N1 through N3) contained in CMOS hex inverter IC CD4069. A clock generator built from two of the inverter gates (N5 and N6) supplies clock pulses to a decade counter CD4017 (IC2).

Eight outputs of this IC drive LEDs (1 through 8). These outputs also go to the J and K inputs of four flip-flops inside two CD4027 ICs (IC3 and IC4). The clock inputs of these flip-flops are connected to the pulse shaped sound signal (available at the output of gate N3). Additional circuitry around the CD4017 counter ensures that it is in the reset state, after reaching count 9, and that the reset is removed when a sound signal is received. Outputs of the four flip-flops are buffered by transistors and fed via LEDs to the gates of four triacs. These triacs switch the mains supply to four loads, usually lamps. If small lamps are to be controlled, these may be directly driven by the transistors. If this circuit is to be active, i.e. scanning all the time, some components around CD4017 IC could be omitted and some connections changed. But then it would no longer be immune to an occasional, spurious loud sound. The condenser microphone usually available in the market has two terminals. It has to be supplied with power for it to function. Any interference on this supply line will be passed on to the output. So the supply for the microphone is smoothed by resistor-capacitor combination of R2, C1 and fed to it via resistor R1. CD4069, a hex unbuffered inverter, contains six similar inverters. When the output and input of such an inverter is bridged by a resistor, it functions as an inverting amplifier. Capacitor C2 couples the signal developed by the microphone to N1 inverter in this IC, which is configured as an amplifier. The output of gate N1 is directly connected to the input of next gate N2. Capacitor C3 couples the output of this inverter to N3 inverter, which is connected as an adjustable level comparator. Inverter N4 is connected as an LED (9) driver to help in setting the sensitivity. Preset VR1 supplies a variable bias to N3. If the wiper of VR1 is set towards the negative supply end, the circuit becomes relatively insensitive (i.e. requires a thunderous clap to operate). As the wiper is turned towards resistor R4, the circuit becomes progressively more sensitive. The sound signal supplied by gate N2 is added to the voltage set by preset VR1 and applied to the input of gate N3. When this voltage crosses half the supply voltage, the output of gate N3 goes ELECTRONICS PROJECTS Vol. 20

129

low. This output is normally high since the input is held low by adjustment of preset VR1. The output of gate N3 is used for two things: First, it releases the reset state of IC2 via diode D1. Second, it feeds the clock inputs to the four flip-flops contained in IC3 and IC4. In the quiescent state, IC2 is reset and its ‘Q0’ output is high. Capacitor C4 is charged positively and it holds this charge due to the connection from R5 to this output (Q0). IC2 is a decade counter with fully decoded outputs. It has ten outputs labelled Q0 to Q9 which go successively high, one at a time, when the clock input is fed with pulses. IC3 and IC4 are dual JK flip-flops. In this circuit they store (latch) the state of the four switches and control the output through transistors and triacs. At the first clap, the output of gate N3 goes low and diode D1 conducts, discharging capacitor C4. The reset input of IC2 goes low, releasing its reset state. All the J and K inputs of the four flip-flops are low and so these do not change state, even though their clock inputs receive pulses. When the reset input of IC2 is low, each clock pulse causes IC2 to advance by one count and its outputs go high successively, lighting up the corresponding LEDs and pulling high the J and K inputs of the four flip-flops, one after the other. Resistor R8 limits the current through LEDs 1 through 8 to about 2 mA. Larger current might cause malfunction due to the outputs of IC2 being pulled down below the logic 1 state input voltage. If a second clap is detected while the J input of a particular flip-flop is high, its Q output will go high, regardless of what state it was in previously. Similarly, if its K input was high, the output will go low.

(If both J and K are high, the output will change state at each clock pulse.) Thus although all flip-flops receive the clap signal at their clock inputs, only the one selected by the active output of IC2 will change state. Resistor R9 and capacitor C6 ensure that the flip-flops start in the off state when power to the circuit is switched on, by providing a positive poweron-reset pulse to the reset input pins when power is applied. The preset input pins are not used and are therefore connected directly to ground. When, after eight clock pulses, output Q8 of IC2 becomes high, diode D2 conducts, charging capacitor C4, thereby resetting IC2 and making its Q0 output high. And there it stays, awaiting the next clap. The four Q outputs of IC3 and IC4 are buffered by npn transistors, fed through current limiting resistors and LEDs (to indicate the on/off state of the loads) to the gates of four triacs. Four lamps operating on the mains may thus be controlled. For demonstrations, it might be better to drive small lamps (drawing less than 100 mA at 12V) directly from the emitters of the transistors. In this case the triacs, LEDs and their associated current limiting resistors may be omitted. It has to be noted that one side of the mains has to be connected to the negative supply line of this circuit when mains loads are to be controlled. This necessitates safe construction of the circuit such that no part of it is liable to be touched. The advantage is that it may be mounted out of reach of curious hands since it does not need to be handled during normal operation. It is advisable to start with the low voltage version and then upgrade to mains operation, once you are sure everything else is working

satisfactorily. CMOS ICs are used in this circuit for implementing the amplifyingand logic functions. Use of a dedicated supply is recommended because the integrated circuits will be damaged if the supply voltage is too high, or is of wrong polarity. An external power supply may get connected up the wrong way around, or be inadvertently set to too high a voltage. Therefore it is a good idea to start by constructing the power supply section and then add the other components of the circuit. If the clock is working, you may turn your attention to the amplifier. LED9 should be off, and should flash when the terminals of capacitor C2 are touched with a wet finger (the classic wet finger test). Preset VR1 may need to be adjusted until LED9 just turns off. The output of gate N2 will be at about half the supply voltage. The output of gate N3 would normally be high. The voltage at the input of gate N3 should vary when preset VR1 is varied. Highefficiency LEDs should preferably be used in this circuit. The microphone has two terminals, one of which is connected to its body. This terminal has to be connected to circuit ground, and the other to the junction of resistor R2 and capacitor C2. These wires are preferably kept short (one or two centimetres) to avoid noise pickup. With the microphone connected, a loud sound (a clap) should result in LED9 blinking. Adjust preset VR1 so that LED9 stays off on the loudest of background noises but starts glowing when you clap. If the clap-to-start feature is not required, it may be disabled by omitting components D1, D2, R5, C4 and connecting a wire link in place of diode D2. Then IC2 will be alive and kicking all the time.

TIME SWITCH AVNISH PUNDIR

T

his circuit is especially designed for those who often need to wake up early in the morning. Ordinary alarms in electronic watches are not loud enough and very often they fail to wake

130

ELECTRONICS PROJECTS Vol. 20

one up. The switch circuit described here will come handy; it can be used to switch on a TV, radio or tape recorder etc, which will not allow even the laziest amongst us to ignore their sound for too long. Be-

sides, this time switch can also be used to switch on/off any other electric or electronic gadget at any time. What you need is a simple analogue electronic clock with alarm facility and a small circuit to im-

plement the time switch. This time switch has two modes. One is ‘time-on’ mode and the other is ‘time-off’ mode. In time-on mode, you set up the alarm in your clock as per normal procedure and at the set time this switch turns on the gadget connected at the output socket-1. In timeoff mode, it turns your gadget off at the set time. The optional output socket-2 is wired in such a way that when you use this socket, the mode changes without having to flip the mode switch (i.e. mode switch can be omitted). Please refer to the back panel diagram of a typical analogue clock and the audio jack, to see how the existing buzzer of the clock is required to be wired to the audio output from the clock. This will ensure that when plug is inserted in the audio jack, the clock’s buzzer will remain off and not consume any power unnecessarily. The audio alarm output from the clock

is coupled to the AF detector built around low-power switching transistor T1. During alarm, the collector of transistor T1 will fluctuate around ground level and Vcc. During absence of audio alarm input, the collector of transistor T1 is held at Vcc potential. The next stage consists of an S-R latch built around NAND gates N1 and N2. Capacitor C2 and resistor R4 are used for power-on-reset. On switching the power supply, gate N2 output will acquire logic 1 and that of gate N1 logic 0 state. This is the initial state, irrespective of the position of mode switch. At the time of alarm, when point A connected to collector of transistor T1 passes through logic 0 state, the output logic state of both the gates will toggle. Assuming that mode switch is flipped

Readers Comments: ❑ In electronic clocks, if we set the alarm to sound, say, 45 minutes after the set time, the alarm will sound after 45 minutes and then stop automatically. However, in your circuit, if the clock continues to be used after the set time, it will toggle when the clock pulses arrive again after the set time.

P. Sasi Kumar Coimbatore The author Avnish Pundir replies: As per your question, the time switch is going to toggle after 45 minutes ‘if the clock pulses arrive again.’ But this cannot happen as the R-S latch is being used in the circuit whose one input is permanently connected to +Vcc and the other

to ‘Off Mode’ position at power-on-reset (when point D is at logic 1), initially diode D1 would be in blocking state and transistor T2 would be forward biased via resistor R5 and diodes D2 and D3. As a result, the relay is in energised state, which makes output power available at output socket-1 and cuts it off from socket2. At alarm time, the audio signal toggles logic output states of both gates N1 and N2. As a result, point D goes to logic 0 state. Diode D1 conducts, taking the voltage at junction of diodes D1 and D2 to near about 1 volt. Diode D3 ensures that its series combination with diode D2 puts them in blocking mode. Capacitor C3 meanwhile discharges via resistor R6 and the voltage at base of transistor T2 approaches towards ground level, cutting off transistor T2 and de-energising relay RL1. Now the power at output socket-1 would be cut off while it becomes available in socket-2. If the above operation is repeated with switch S1 in ‘Mode On’ position, the power would initially be not available in socket1 (but available in socket-2). But after the alarm, the power would become available in socket-1 and not in socket-2.

receives clock signal via the detector. At switching on instant, the flip-flop output at point ‘D’ will be in high state. After first pulse from detector, point D would go low and remain so, irrespective of whether more pulses arrive or not. So, there cannot be any toggling of flip-flop, until and unless there is a power loss or somebody shorts capacitor ‘C2’ momentarily. ELECTRONICS PROJECTS Vol. 20

131

WATER LEVEL INDICATOR WITH ALARM VIJAY D. SATHE

H

ere is a simple, versatile circuit which indicates the level of water in a tank. This circuit produces alarm when water level is below the lowest level L1 and also when water just touches the highest level L12. The circuit is designed to display 12 different levels. However, these display levels can be increased or decreased depending upon the level resolution required. This can be done by increasing or decreasing the number of level detector metal strips (L1 through L12) and their associated components. In the circuit, diodes D1, D2 and D13 form half-wave rectifiers. The rectified output is filtered using capacitors C1 through C3 respectively. Initially, when water level is below strip L1, the mains supply frequency oscillations are not transferred to diode D1. Thus its output is low and LED1 does not glow. Also, since base voltage of transister T1 is low, it is in cut-off state and its collector voltage is high, which enables melody generating IC1 (UM66) and alarm is sounded. When water just touches level detector strip L1, the supply frequency oscillations are transferred to diode D1. It rectifies the supply voltage and a positive DC voltage develops across capacitor C1, which lights up LED1. At the same time base voltage for transistor T1 becomes high, which makes it forward biased and its collector voltage falls to near-ground potential. This disables IC1 (UM66) and alarm is inhibited. Depending upon quantity of water present in the tank, corresponding level indicating LEDs glow. It thus displays intermediate water levels in the tank in bar-graph style. When water in the tank just touches the highest level detector strip L12, the DC voltage is developed across capacitor C2. This enables melody generating IC1 (UM66) and alarm is again sounded.

132

ELECTRONICS PROJECTS Vol. 20

IC CONTROLLED EMERGENCY LIGHT WITH CHARGER A.P.S. DHILLON

T

he circuit shown here is that of the IC controlled emergency light. Its main features are: automatic switching-on of the light on mains failure and battery charger with overcharge protection. When mains is absent, relay RL2 is in de-energised state, feeding battery supply to inverter section via its N/C contacts and switch S1. The inverter section comprises IC2 (NE555) which is used in astable mode to produce sharp pulses at the rate of 50 Hz for driving the MOSFETs. The output of IC3 is fed to gate of MOSFET T4 directly while it is applied to MOSFET T3 gate after inversion by transistor T2. Thus the power amplifier built around MOSFETs T3 and T4 functions in push-pull mode. The output across secondary of transformer X2 can easily drive a 230volt, 20-watt fluorescent tube. In case light is not required to be on during mains failure, simply flip switch S1 to off position. Battery overcharge preventer circuit is built around comparator IC1 (LM308). Its non-inverting pin is held at a reference voltage of ap-

proximately 6.9 volts which is obtained using diode D5 (1N4148) and 6.2-volt zener D6. The inverting pin of IC1 is connected to the positive terminal of battery. Thus when mains supply is present, IC1 comparator output is high, unless battery voltage exceeds 6.9 volts. So transistor T1 is normally forward biased, which energises relay RL1. In this state

the battery remains on charge via N/O contacts of relay RL1 and current limiting resistor R2. When battery voltage exceeds 6.9 volts (overcharged condition), IC1 output goes low and relay RL1 gets de-energised, and thus stops further charging of battery. MOSFETs T3 and T4 may be mounted on suitable heat sinks.

ELECTRONICS PROJECTS Vol. 20

133

WIPER SPEED CONTROLLER PRADEEP G.

A

continuously working wiper in a car may prove to be a nuisance, especially when it is not raining heavily. By using the circuit described here one can vary sweeping rate of the wiper from once a second to once in ten seconds. The circuit comprises two timer NE555 ICs, one CD4017 decade counter, one TIP32 driver transistor, a 2N3055 power transistor (or TIP3055) and a few other discrete components. Timer IC1 is configured as a monostable multivibrator which produces a pulse when one presses switch S1 momentarily. This pulse acts as a clock pulse for the decade counter (IC2) which advances by one count on each successive clock pulse or the push of switch S1. Ten presets (VR1 through VR10), set for different values by trial and error, are used at the ten outputs of IC2. But since only one output of IC2 is high at a time, only one preset (at selected output) effectively comes in series with timing resistors R4 and R5 connected in the circuit of timer IC3, which functions in astable mode. As presets VR1 through VR10 are set for different values, different time periods (or frequencies) for astable multivibrator IC3 can be selected. The output of IC3 is applied to pnp driver transistor T1 (TIP32) for driving the final power transistor T2 (2N3055) which in turn drives the wiper motor at the selected sweep speed. The power supply for the wiper motor as well as the circuit is tapped from the vehicle’s battery itself. The duration of monostable multivibrator IC1 is set for a nearly one second period.

134

ELECTRONICS PROJECTS Vol. 20

CD-ROM DRIVE AS DIGITAL-AUDIO CD-PLAYER M.P. VERMA

A

CD-ROM drive can be used as a stand-alone unit for playing digital audio CDs without interfacing with a computer. The stereo output of CD player available at the audio jack can be amplified using audio input facility which is normally available on a tape-deck/tape-recorder or a stereo amplifier. Audio socket on front/rear of the CD-ROM drive is capable of driving headphones or speakers of less than 500 mW. Proper stereo jacks for interconnection between CD-ROM drive and tape deck are available from computer/tape recorder spares vendors. The principle of operation is illustrated here with the help of block diagram. The 4-pin power supply socket available at the rear of a CD-ROM player is meant for +5V, ground (two middle pins) and +12V inputs. The power supply can be easily derived using a conventional power supply circuit as shown in the figure. If you have an external CD-ROM drive, it can be simply plugged into the

mains since it has self-contained power supply circuit inside. While there may be minor differences amongst the available CD-ROM drives’ external controls, a typical drive’s controls are shown in the figure here. Please ensure that a proper power supply connector available from computer spare parts vendor is used for connection to CD-ROM drive. To identify +5V and +12V pins on the drive connector, please note that in the computer +12V is

routed using a yellow wire and for +5V a red wire is used, while for ground black wires are used with the supply connector. Once the power supply has been connected correctly, you will notice that LED indicator on the drive starts flashing. Now the digital audio CD can be loaded after pushing the eject button. A second push of the same button causes retraction of CD carriage into the drive. One can change the track (song) on the CD using play switch on the CD-ROM drive.

AUTOMATIC DUAL-OUTPUT DISPLAY RAJESH K.P.

T

his circuit lights up ten bulbs sequentially, first in one direction and then in the opposite direction, thus presenting a nice visual effect.

In this circuit, gates N1 and N2 form an oscillator. The output of this oscillator is used as a clock for BCD up/down counter CD4510 (IC2).

Depending on the logic state at its pin 10, the counter counts up or down. During count up operation, pin 7 of IC2 outputs an active low pulse on reaching the ninth ELECTRONICS PROJECTS Vol. 20

135

count. Similarly, during count-down operation, you again get a low-going pulse at pin 7. This terminal count output from pin 7, after inversion by gate N3, is connected to clock pin 14 of decade counter IC3 (CD4017) which is configured here as a toggle flip-flop by returning its Q2 output at pin 4 to reset pin 15. Thus output at pin 3 of IC3 goes to logic 1 and logic 0

state alternately at each terminal count of IC2. Initially, pin 3 (Q0) of IC3 is high and the counter is in count-up state. On reaching ninth count, pin 3 of IC3 goes low and as a result IC2 starts counting down. When the counter reaches 0 count, Q2 output of IC3 momentarily goes high to reset it, thus taking pin 3 to logic 1 state, and the cycle repeats.

The BCD outputs of IC2 are connected to 1-of-10 decoder CD4028 (IC4). During count-up operation of IC2, the outputs of IC4 go logic high sequentially from Q0 to Q9 and thus trigger the triacs and lighting bulbs 1 through 10, one after the other. Thereafter, during count-down operation of IC2, the bulbs light in the reverse order, presenting a wonderful visual effect.

Readers Comments: ❑ Please intimate the changes that need to be incorporated to replace the lamps with LEDs to display a message? J. Chandrasekaran Chennai

The author Rajesh K.P. replies: I would advise the reader to first arrange the letters of the display and then wire the LEDs in series. Many similar circuits have been published in earlier issues of EFY which may also be referred

to. The total number of LEDs that may be used varies directly as the input voltage. Also, connect a 1/2W, 100-ohm resistor in series with the LEDs.

MINIATURE STROBE LIGHT T.K. HAREENDRAN

S

trobe lights are widely used by disco lovers to create wonderful visual effects in disco halls and auditoria. The circuit of a battery operated portable miniature strobe light, which can be constructed using readily available inexpensive components, is described here.

136

ELECTRONICS PROJECTS Vol. 20

For convenience and simplicity, an ordinary neon lamp is used here in place of the conventional Xenon tube. The whole gadget can thus be easily accommodated in a small cabinet, such as a mains adaptor cover, with a suitable reflector for neon lamp to give a proper look. Since current requirement of this circuit is very small, it

may be powered by two medium-size dry cells (3V) or Ni-Cd cells (2.4V). Transistors T1 and T2 in the circuit form a complimentary-pair amplifier. When switch S1 is momentarily depressed, the circuit oscillates because of the positive feedback provided via resistor R2 and capacitor C1 to the base of

transistor T1. The sharp pulses in the secondary windings induce a high voltage in primary windings of transformer X1, which in fact is a line driver transformer (used in reverse) generally used in 36cm TV sets. High voltage pulses induced in primary side are rectified by diode D1 and rapidly charge reservoir capacitor C2 to nearly 300V DC. When switch S1 is released, capacitor C2 holds the voltage level for a finite period while capacitor C3 charges slowly through resistor R3. When voltage across capacitor C3 becomes high enough, neon strikes and the capacitor rapidly discharges through the lamp. When voltage across capacitor C3 falls below the extinguishing potential of neon lamp, it goes off and capacitor C3 starts charging again. This cycle keeps on repeating for a short time, based on the

reservoir capacitor C2’s value. Precautions. The neon lamp flasher section of this circuit carries dangerously high voltages. All precautions should

therefore be taken for protection. Before any repair work, discharge capacitor C2 using a short length of wire with a 100k resistor connected in series.

ELECTRONIC CARD-LOCK SYSTEM VIJAY D. SATHE

T

he circuit presented here can be used as a lock for important electronic/electrical appliances. When card is inserted inside its mechanism, depending upon the position of punched hole on the card, a particular appliance would be switched on. The card is inserted just like a floppy disk inside the disk drive. This card should be rectangular in shape with only one punched hole on it. The circuit uses eight photo-transistors (T1 through T8). When there is no card in the lock, light from incandescent lamp L1 (40-watt, 230V) falls on all the photo- transistor detectors. Transistor T8 is used as enable detector for IC1 (74LS244). When light is incident on it, it conducts and its collector voltage

goes low. This makes transistor T16 to cut-off, and its collector voltage goes high. This logic high on its collector terminal will 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 lock mechanism. This arrangement ensures

ELECTRONICS PROJECTS Vol. 20

137

that only the selected appliance is switched on and prevents false operation of the system. You can make these cards using a black, opaque plastic sheet. A small rectangular notch is made on this card to

138

ELECTRONICS PROJECTS Vol. 20

indicate proper direction for insertion of the card. If an attempt is made to insert the card wrongly, it will not go completely inside the mechanism and the system will not be enabled. When card for any appliance (say ap-

pliance 1) is completely inserted in the mechanism, the light will fall only on photo-transistor T1. So only T1 will be on and other photo-transistors will be in off state. When transistor T1 is on, its collector voltage falls, making transistor

T9 to cut-off. As a result, collector voltage of transistor T9 as also pin 2 of IC1 go logic high. This causes pin 18 (output Q1) also to go high, switching LED1 on. Simultaneously, output Q1 is connected to pin 1 of IC2 (ULN2003) for driving the relay corresponding to appliance 1. Similarly, if card for appliance 2 is inserted, only output pin 16 (Q2) of IC1 will go high-making LED2 on while at the same time energising relay for appliance 2 via ULN2003. The same is true for other cases/appliances also. The time during which card is present inside the mechanism, the system generates musical tone. This is achieved with the help of diodes D1 through D7 which provide a wired-OR connection at their

common-cathode junction. When any of the outputs of IC1 is logic high, the common-cathode junction of diodes D1 through D7 also goes logic high, enabling IC3 (UM66) to generate a musical tone. In this circuit IC1 (74LS244) is used as buffer with Schmitt trigger. All outputs (Q1 through Q7) of this IC are connected to IC2 (ULN2003) which is used as relay driver. IC2 consists of seven highcurrent relay drivers having integral diodes. External free-wheeling diodes are therefore not required. When an input of this IC is made logic high, the corresponding output will go logic low and relay connected to that pin gets energised. This switches on a specific appliance and the corre-

sponding LED. Once a specific card is inserted to switch on a specific relay, that relay gets latched through its second pair of contacts. Thus even when the card is removed, the specific appliance remains on. The same holds true for all other relays/ appliances as well. The only way to deenergise a latched relay after removal of the corresponding card is to switch off the corresponding switch (S1 through S7) which would cut-off the supply to the desired relay. The +5V and +12V supplies can be obtained with conventional arrangement using a step-down transformer followed by rectifier, filter and regulator (using 7805 and 7812 etc).

PC-BASED 7-SEGMENT ROLLING DISPLAY PRASHANT R. DESHMUKH

I

t is very interesting and con venient to be able to control everything while sitting at your PC terminal. Here, a simple hardware circuit and software is used to interface a 7-segment based rolling display. The printer port of a PC provides a set of points with some acting as input lines and some others as output lines. Some lines are open collector type which can be used as input lines. The circuit given here can be used for interfacing with any type of PC’s printer port. The 25-pin parallel port connector at the back of a PC is a combination of three ports. The address varies from 378H-37AH. The 7 lines of port 378H (pins 2 through 8) are used in this circuit to output the code for segment display through IC1. The remaining one line of port 378H (pin 9) and four lines of port 37AH (pins 1, 14, 16, 17) are used to enable the display digits (one a time) through IC2. The bits D0, D1 and D3 of port 37AH connected to pins 1, 14 and ELECTRONICS PROJECTS Vol. 20

139

P R O G R A M /*DISP.C*** PC BASED ROLLING DISPLAY */ /* P.R.DESHMUKH*/ #include #include #include #define PORTA 0x378 #define PORTB 0x37a void main() { int dno[6]={0x0a,0x09,0x0f,0x03,0x80}; /* code for “hallo”*/ int

17 of ‘D’ connector are inverted by the computer before application to the pins while data bit D2 is not inverted. Therefore to get a logic high at any of former three pins, we must send logic 0 output to the corresponding pin of port 37AH. Another important concept illustrated by the project is the time division multiplexing. Note that all the five 7segment displays share a common data bus. The PC places the 7-segment code for the first digit/character on the data bus and enables only the first 7-segment display. After delay of a few milliseconds, the 7-segment code for the digit/ character is replaced by that of the next charter/digit, but this time only second display digit is enabled.

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++) {

After the display of all characters/ digits in this way, the cycle repeats itself over and over again. Because of this repetition at a fairly high rate, there is an illusion that all the digits/characters are continuously being displayed. DISP1 is to be physically placed as the least significant digit. IC1 (74LS244) is an octal buffer which is primarily used to increase the driving capability. It has two groups of four buffers with non-inverted tri-state outputs. The buffer is controlled by two active low enable lines. IC2 (75492) can drive a maximum of six 7-segment displays. (For driving up to seven common-cathode displays one may use ULN2003 described in the previous circuit idea.)

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

The program for rolling display is given in the listing DISP.C above. Whatever the message/characters to be displayed (here five characters have been displayed), these are separated and stored in an array. Then these are decoded. Decoding software is very simple. Just replace the desired character with the binary equivalent of the display code. The display code is a byte that has the appropriate bits turned on. For example, to display character ‘L’, the segments to be turned on are f, e and d. This is equivalent to 111000 binary or 38 hex. Please note that only limited characters can be formed using 7-segment display. Characters such as M, N and K cannot be formed properly.

CONTACTLESS AC MAINS VOLTAGE DETECTOR PRADEEP G.

T

his is a CMOS IC (CD4033) based circuit which can be used to detect presence of AC mains voltage without any electrical contact with the conductor carrying AC current/voltage. Thus it can be used to detect mains AC voltage without removing the insulation from the conductor. Just take it in the vicinity of the conductor and it would detect presence of AC voltage. If AC voltage is not present, the display would randomly show any digit (0 through 9) permanently. If mains supply is available in the conductor, the electric field would be induced into the sensing probe. Since IC used is CMOS type, its

140

ELECTRONICS PROJECTS Vol. 20

input impedance is extremely high and thus the induced voltage is sufficient to clock the counter IC. Thus display count advances rapidly from 0 to 9 and then repeats itself. This is the indication for presence of mains supply. Display stops advancing when the unit is taken away from the mains carrying conductor. For compactness, a 9volt PP3 battery may be used for supply to the gadget.

(

FREQUENCY MEASUREMENTS USING PC PROBIR GOYAL

H

ere is a simple technique for measuring frequencies over quite a wide frequency range and with acceptable accuracy limits using a PC. It follows the basic technique of measuring low frequencies, i.e. at low frequency, period is measured for a complete wave and frequency is calculated from the measured time-period. Cascaded binary counters are used for converting the high-frequency signals into low-frequency signals. The parallel port of a computer is used for data input from binary counters. This data is used for measuring time and calculating the frequency of the signal. The block diagram shows the basic connections of the counters and parallel port pin numbers on 25-pin ‘D’ connector of a PC (control register 379 Hex is used for input). External hardware is used only for converting the higher frequency signals into low frequency signals. Thus, the major role in frequency-measurement is played by the software. The PC generates a time-interrupt at a frequency of 18.21 Hz, i.e. after every 54.92 millisecond. Software uses this time-interrupt as a time-reference. The control register of the PC’s parallel port is read and the data is stored continuously in an array for approximately 54.9 ms using a loop. This stored data is then analysed bit-wise. Initially, the higher-order bit (MSB or the seventhbit) of every array element is scanned for the presence of a complete square wave. If it is found, its time period is measured and if not then the secondhighest order bit (sixth bit) is scanned. This operation is performed till the third bit and if no full square wave is still found, an error message is generated which indicates that either there is an error in reading or the frequency signal is 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 frequency components, its measurement precision in percentage is also calculated and displayed. Number of data taken in 54.9 ms is also displayed. As stated above, the lower starting range is about 19 Hz. Data is read for approximately 54.9 ms. Thus, the lowest possible frequency that can be measured is 1/.0549 Hz. Lower frequency range depends only on the sampling time and is practically fixed at 19 Hz (18.2 Hz, to be precise). Upper frequency range depends on factors such as value of the MOD counter used and the operating frequency range of the counter IC. If MOD-N counter is used (where N is an integer), upper

limit (UL) of frequency is given by UL=19xN5 Hz. Thus for MOD 16 counters UL≈20 MHz, and for MOD 10 counters UL≈1.9 MHz. Care should be taken to ensure that this upper limit is within the operating frequency range of counter IC used. Precision of measurement is a machine-dependent parameter. High-speed machines will have better precision compared to others. Basically, precision depends directly upon the number of data read in a standard time. Precision of measurement varies inversely as the value of MOD counter used. Precision is high when MOD 10 counters are used in place of MOD 16 counters, but this will restrict the upper limit of frequency measurement and vice-versa.

ELECTRONICS PROJECTS Vol. 20

141

PROGRAM IN TURBO C #include

{ ps=data[j] & N;

#include #include

if(ls!=ps) st++; /* finding a complete wave */ if(st>0 && st<4) count++;

#define MOD 16

/* define counter mod used */

if(st==3) break; /* wave found */

#define LPT 0x379/* LPT1 input port address */ void interrupt (*old_clock)();

ls=ps; }

void interrupt new_clock ();

if(st==3) /* calculate frequency of the wave */

static int t; void main()

{mul=1; for(j=3;j
{

/* 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;

P

R G

M A

tm=((count*div)/mul); fq=1/tm; pri=(100.0/count);

O R

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 main

frequency”,pri); gotoxy(15,24); printf(“Samples taken in %0.2f ms = %d “, tick/

old_clock = getvect(0x08);///* capturing time vector */

1000, i);

setvect(0x08,new_clock); /* assigning new time vector */ do

break; }

{ i=0; t=0; clrscr();

if(st<3 && k==3) /* no complete wave was present */

gotoxy(25,1); printf(“FREQUENCY MEASUREMENTS”); gotoxy(23,17); printf(“Press any key to Pause.....”);

{ gotoxy(24,7); printf(“Error in Reading ...!”); } } } t=0; i=0;

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++; }}

getch(); gotoxy(13,21); printf(“ Press E Esc for Exit any other key to continue”);

if(t==8) { div=tick/i;

c=getch();

for(k=7;k>2;k—) /* analyzing each bit of read data */ { N=1; for(j=0;j
}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)(); }

for(j=0;j
TELEPHONE NUMBER DISPLAY BHASKAR BANERJEE

T

he given circuit, when connected in parallel to a telephone, displays the number dialled from the telephone set using the DTMF mode. This circuit can also show the number dialled from the phone of the calling party. This is particularly helpful for receiving any number over the phone lines. The DTMF signal—generated by the phone on dialling a number—is decoded by DTMF decoder CM8870P1 (IC1), which converts the received DTMF signal into

142

ELECTRONICS PROJECTS Vol. 20

its equivalent BCD number that corresponds to the dialled number. This binary number is stored sequentially in 10 latches each time a number is dialled from the phone. The first number is stored in IC5A (1/2 of CD4508) while the second number is stored in IC5B and so on. The binary output from IC1 for digit ‘0’ as decoded by IC1 is 10102 (=1010), and this cannot be displayed by the seven-segment decoder, IC10. Therefore the binary output 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 by gates N13 through N15 (IC11) and N1 (IC12). The storing of numbers in respective latches is done by IC2 (4017). The data valid output from pin 15 of IC1 is used to clock IC2. The ten outputs of IC2 are sequentially connected to the store and clear inputs of all the latches, except the last one, where the clear

input is tied to ground. When an output pin of IC2 is high, the corresponding latch is cleared of previous data and kept ready for storing new data. Then, on clocking IC2, the same pin becomes low and the data present at the inputs of that latch at that instant gets stored and the next latch is cleared and kept ready. The similar input and output pins of all latches are connected together to form two separate input and output buses. There is only one 7-segment decoder/ driver IC10 for all the ten displays. This not only reduces size and cost but reduces power requirement too. The output from a latch is available only when its disable pins (3 and 15) are brought low. This is done by IC3, IC12 and IC13. IC3 is clocked by an astable multivibrator IC4 (555). IC3 also drives the displays by switching corresponding transistors. When a latch is enabled, its corresponding display is turned on and the content of that latch, after decoding by IC10, gets displayed in the corresponding display. For instance, contents of IC5A are displayed on display ‘DIS1,’ that of IC5B on ‘DIS2’ and so on. The system should be connected to the telephone lines via a DPDT switch (not shown) for manual switching, otherwise any circuit capable of sensing handset’s off-hook condition and thereby switching relays, etc. can be used for automatic switching. The powersupply 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 showing a maximum of ten digits, one can reduce the display digits as required. For doing this, connect the reset pin of IC2, say, for a 7-digit display, with S6 output at pin 5. The present circuit can be built on a veroboard and housed in a suitable box. The displays are commoncathode type. To make the system compact, small, 7-segment displays can be used but with some extra cost. Also, different colour displays can be used for the first three or four digits to separate the exchange code/STD code, etc. The circuit can be suitably adopted for calling-line display. Readers Comments: ❑ I would like to have the following doubts clarified: 1. What is the function of external reset switch S2? How it is used?

2. The pin connections of DIS1 to DIS9 are not mentioned properly. How should we connect them? Sunny Hercleas Hyderabad

❑ I have the following queries regarding this circuit: 1. What is meant by DTMF mode? 2. Can the proposed circuit be used in a telephone set that doesn’t have the ELECTRONICS PROJECTS Vol. 20

143

DTMF output, e.g. Priyadarshni set? 3. Can I use an LCD instead of 7segment display? If yes, what are the changes to be made in the circuit? 4. Is it possible to increase the number of 7-segment displays from 10 to 12? If yes, kindly suggest the changes to be made in the circuit. 5. Can the proposed circuit be used with telephone exchanges which have calling line identification (CLI) facility? T. Kartik Madurai The author Bhaskar Banarjee replies: In reply to Sunny Hercleas: When the circuit is switched on, it is automatically reset, it has to be reset manually each time, which is done using switch S2. You may also use a comparator circuit to monitor the line voltage and provide a positive pulse to pin 15 of IC2 each time the handset in lifted. Regarding displays, all the similar pins of the ten displays should be connected together and then the seven common wires connected to the IC10. Also

note that the output of IC1 corresponding to ‘0’ in the telephone is converted to ‘0’ binary by gates P1, P2, P3 and N1 (and not as stated in the text). Though a 5V supply is shown, a better choice would be a 9V supply. In reply to T. Kartik, I would like to thank the reader for showing interest in my circuit idea. Here are the answers to his queries: 1. With modern telephones, we can dial a number in pulse mode or Fig. 1: Cascading for up to 18-digit display in tone mode. In DTMF 3. LCD cannot be used with this cir(dual-tone multi-frequency) mode (tone cuit. It is possible only after considerable mode) of dialling, a particular frequency changes in the present circuit. pair is generated corresponding to the key 4. To increase the display up to 18 pressed instead of pulses in the pulse digits, cascade another 4017 with IC2 as mode of dialling. The generated tones can shown in Fig. 1. be heard in the earphone. 5. This circuit can be used as CLI, but 2. The present circuit cannot be used it is too basic and rather uneconomical with telephones that don’t have tone dialfor such purpose. ling (DTMF) mode.

DIGITAL SWITCHING SYSTEM RAJESH K.P.

T

144

his circuit can control any one out of 16 devices with the help of two push-to-on switches. An up/down

ELECTRONICS PROJECTS Vol. 20

counter acts as a master-controller for the system. A visual indication in the form of LEDs is also available.

IC1 (74LS193) is a presettable up/ down counter. IC2 and IC3 (74LS154) (1 of 16 decoder/demultiplexer) perform dif-

ferent functions, i.e. IC2 is used to indicate the channel number while IC3 switches on the selected channel. Before using the circuit, press switch S1 to reset the circuit. Now the circuit is ready to receive the input clock. By pressing switch S2 once, the counter advances by one count. Thus, each pressing of switch S2 enables the counter to advance

by one count. Likewise, by pressing switch S3 the counter counts downwards. The counter provides BCD output. This BCD output is used as address input for IC2 and IC3 to switch one (desired channel) out of sixteen channels by turning on the appropriate triac and the corresponding LED to indicate the selected channel.

The outputs of IC3 are passed through inverter gates (IC4 through IC6) because IC3 provides negative going pulses while for driving the triacs we need positivegoing pulses. The high output of inverter gates turn on the npn transistors to drive the triacs. Diodes connected in series with triac gates serve to provide unidirectional current for the gate-drive.

40-METRE DIRECT CONVERSION RECEIVER PRADEEP G.

U

sing the circuit of direct-conversion receiver described here, one can listen to amateur radio QSO signals in CW as well as in SSB mode in the 40-metre band. The circuit makes use of three n-channel FETs (BFW10). The first FET (T1) performs the function of ant./ RF amplifier-cum-product detector, while the second and third FETs (T2 and T3) together form a VFO (variable frequency oscillator) whose output is injected

into the gate of first FET (T1) through 10pF capacitor C16. The VFO is tuned to a frequency which differs from the incoming CW signal frequency by about 1 kHz to produce a beat frequency note in the audio range at the output of transformer X1, which is an audio driver transformer of the type used in transistor radios. The audio output from transformer X1 is connected to the input of audio amplifier built around IC1 (TBA820M) via volume

control VR1. An audio output from the AF amplifier is connected to an 8-ohm, 1watt speaker. The receiver can be powered by a 12volt power-supply, capable of sourcing around 250mA current. Audio-output stage can be substituted with a readymade L-plate audio output circuit used in transistor amplifiers, if desired. The necessary data regarding the coils used in the circuit is given in the circuit diagram itself.

ELECTRONICS PROJECTS Vol. 20

145

PRECISION 1HZ CLOCK GENERATOR USING CHIP-ON-BOARD K. UDHAYAKUMARAN, VU3GTH

146

sually the circuits for generation of 1Hz clock for applications in digital clock and counter circuits make use of ICs in conjunction with a crystal and trimmer capacitors, etc. However, similar or better accuracy can be achieved using a chip-on-board (COB) device found inside a digital clock, which is readily available in the market for Rs 15-20. This COB consists of IC, capacitors and quartz crystal, etc which are mounted on its surface. It works on 1.4 volt DC source. This COB can be used to derive 1Hz clock.

U

clock pulse has a very low amplitude of the order of a few milli-volts which cannot be used to drive the digital circuits directly. This low-level voltage is amplified several times by op-amp IC CA3140. The op-amp CA3140 is connected in a non-inverting mode, and its gain is set by resistors R4 and R3. Capacitor C2 reduces the AC gain and unwanted stray pick-up and thus improves stability of the circuit. The input impedance of IC CA3140 is very high and thus there is no drop at

Resistor R1, capacitor C3, diodes D1 and D2 shown in the circuit convert 5V DC into 1.4V DC. A ½Hz clock is available at terminals A and B with a phase difference of 90o. The two outputs, are combined using capacitors C1 and C2 to obtain a complete 1Hz clock. This 1Hz

the input when 1Hz clock signal of low level is connected across its input terminals from the COB. Amplified 1Hz clock pulse is available at its output pin 6, which is further amplified by transistors T1 and T2 to drive the digital clocks and timers.

Readers Comments: ❑ I thought of using these COBs which are easily available as scrap at watch repair shops. Is it possible to use them with some add-on circuitry to

make digital clocks?

ELECTRONICS PROJECTS Vol. 20

R.R. Kodial New Delhi The author K. Udhaya Kumaran replies:

Preset VR1 is offset null control used to adjust proper 1Hz pulse at the output terminal ‘E’. Connect one LED in series with 220-ohm resistor between the terminal ‘E’ and ground and adjust preset VR1 till the LED blinks once every second. When using the COB, affix the same on a general-purpose PCB using rubber based adhesive and solder the terminals neatly using thin single-strand wire. Lab Note: The COBs used in different watches may differ some-what in their configuration. But by trial-anderror one can always find out the appropriate points corresponding to points A, B, C and D. Figure of a second COB used by EFY Lab is shown alongside. The points A and B (on the COB used by us) were observed to have complementary 1Hz outputs and hence anyone (only) could be used as input to opamp CA3140.

You may use an electronic quartz analogue wall clock COB in any circuit without any modification, but both terminals A and B should be used.

ELECTRONIC JAM RAJESH K.P.

T

his jam circuit can be used in quiz contests wherein any participant who presses his button (switch) before the other contestants, gets the first chance to answer a question. The circuit given here permits up to eight contestants with each one allotted a distinct number (1 to 8). The display will show the number of the contestant pressing his button before the others. Simultaneously, a buzzer will also sound. Both, the display as well as the buzzer have to be reset manually using a common reset switch. Initially, when reset switch S9 is momentarily pressed and released, all outputs of 74LS373 (IC1) transparent latch go ‘high’ since all the input data lines are returned to Vcc via resistors R1 through R8. All eight outputs of IC1 are connected to inputs of priority encoder 74LS147 (IC2)

as well as 8-input NAND gate 74LS30 (IC3). The output of IC3 thus becomes logic 0 which, after inversion by NAND gate N2, is applied to latch-enable pin 11 of IC1. With all input pins of IC2 being logic 1, its BCD output is 0000, which is applied to 7-segment decoder/driver 74LS47 (IC6) after inversion by hex inverter gates inside 74LS04 (IC5). Thus, on reset the display shows 0. When any one of the push-to-on switches—S1 through S8—is pressed, the corresponding output line of IC1 is latched at logic 0 level and the display indicates the number associated with the specific pressed switch. At the same time, output pin 8 of IC3 becomes high, which causes outputs of both gates N1 and N2 to go to logic 0 state. Logic 0 output of gate N2 inhibits IC1, and thus pressing

of any other switch S1 through S8 has no effect. Thus, the contestant who presses his switch first, jams the display to show only his number. In the unlikely event of simultaneous pressing (within few nano-seconds difference) of more than one switch, the higher priority number (switch no.) will be displayed. Simultaneously, the logic 0 output of gate N1 drives the buzzer via pnp transistor BC158 (T1). The buzzer as well the display can be reset (to show 0) by momentary pressing of reset switch S9 so that next round may start. Lab Note: The original circuit sent by the author has been modified as it did not jam the display, and a higher number switch (higher priority), even when pressed later, was able to change the displayed number.

ELECTRONICS PROJECTS Vol. 20

147

TINY DEW SENSOR T.K. HAREENDRAN

D

ew (condensed moisture) adversely affects the normal performance of sensitive electronic devices. A low-cost circuit described here can be used to switch off any gadget automatically in case of excessive humidity. At the heart of the circuit is an inexpensive (resistor type) dew sensor element. Although dew sensor elements are widely used in video cassette players and recorders, these may not be easily available in local market. However, the same

can be procured from authorised service centres of reputed companies. The author used the dew sensor for FUNAI VCP model No. V.I.P. 3000A (Part No: 680808-04, reference no. 336) in his prototype. In practice, it is observed that all dew sensors available for video application possess the same electrical characteristics irrespective of their physical shape/ size, and hence are interchangeable and can be used in this project. The circuit is basically a switching type circuit made with the help of a popu-

lar dual op-amp IC LM358N which is configured here as a comparator. (Note that only one half of the IC is used here.) Under normal conditions, resistance of the dew sensor is low (1 kilo-ohm or so) and thus the voltage at its non-inverting terminal (pin 3) is low compared to that at its inverting input (pin 2) terminal. The corresponding output of the comparator (at pin 1) is accordingly low and thus nothing happens in the circuit. When humidity exceeds 80 per cent, the sensor resistance increases rapidly. As a result, the non-inverting pin becomes more positive than the inverting pin. This pushes up the output of IC1 to a high level. As a consequence, the LED inside the opto-coupler is energised. At the same time LED1 provides a visual indication. The opto-coupler can be suitably interfaced to any electronic device for switching purpose. Circuit comprising diode D1, resistors R8 and R6 and capacitor C1 forms a lowvoltage, low-current power supply unit. This simple arrangement obviates the requirement for a bulky and expensive step-down transformer.

ELECTRONIC SCORING GAME SUDHEESH N.

Y

ou can play this game alone or with your friends. The circuit comprises a timer IC, two decade counters and a display driver along with a 7-segment display. The game is simple. As stated above, it is a scoring game and the competitor who scores 100 points rapidly (in short steps) is the winner. For scoring, one has the option of pressing either switch S2 or S3.

148

ELECTRONICS PROJECTS Vol. 20

Switch S2, when pressed, makes the counter count in the forward direction, while switch S3 helps to count downwards. Before starting a fresh game, and for that matter even a fresh move, you must press switch S1 to reset the circuit. Thereafter, press any of the two switches, i.e. S2 or S3. On pressing switch S2 or S3, the counter’s BCD outputs change very rapidly and when you release the switch, the last number remains latched at the output of IC2. The latched BCD number is input to BCD to 7-segment decoder/ driver IC3 which drives a commonanode display DIS1. However, you can read this number only when you press switch S4.

The sequence of operations for playing the game between, say two players ‘X’ and ‘Y’, is summarised below: 1. Player ‘X’ starts by momentary pressing of reset switch S1 followed by pressing and releasing of either switch S2 or S3. Thereafter he presses switch S4 to read the display (score) and notes down this number (say X1) manually. 2. Player ‘Y’ also starts by momentary pressing of switch S1 followed by pressing of switch S2 or S3 and then notes down his score (say Y1), after pressing switch S4, exactly in the same fashion as done by the first player. 3. Player ‘X’ again presses switch S1

and repeats the steps shown in step 1 above and notes down his new score (say, X2). He adds up this score to his previous score. The same procedure is repeated by player ‘Y’ in his turn. 4. The game carries on until the score attained by one of the two players totals up to or exceeds 100, to be declared as the winner. Several players can participate in this game, with each getting a chance to score during his own turn. The circuit may be assembled using a multipurpose board. Fix the display (LEDs and 7-segment display) on top of the cabinet along with the three switches. The supply voltage for the circuit is 5V.

SIMPLE SENSITIVE REMOTE CONTROL TESTER HARISH KUMAR

H

ere is a handy gadget for testing of infrared (IR) based remote control transmitters used for TVs and VCRs etc. The IR signals from a remote control transmitter are sensed by the IR sensor module in the tester and its output at pin 2 goes low. This in turn switches on transistor T1 and causes LED1 to blink. At the same time, the buzzer beeps at the same rate as the incoming signals from the remote control transmitter. The pressing of different buttons on the remote control will result in different pulse rates which would change the rate at which the LED blinks or the buzzer beeps. When no signal is sensed by the sensor module, output pin 2 of the sensor goes high and, as a result, transistor T1 switches off and hence LED1 and buzzer BZ1 go off. This circuit requires 5V regulated power supply which can be obtained from 9V eliminator and connected to the circuit through a jack.

Capacitor C1 smoothes DC input while capacitor C2 suppresses any spikes appearing in the input supply. Proper grounding of the metal case will ensure that the electromagnetic emissions which are produced by tube-lights and electronic ballasts etc (which lie within the bandwidth of receiver circuit)

are effectively grounded and do not interfere with the functioning of the circuit. The proposed layout of the box containing the circuit is shown in the figure. The 9volt DC supply from the eliminator can be fed into the jack using a banana-type plug.

ELECTRONICS PROJECTS Vol. 20

149

ULTRA LOW DROP LINEAR REGULATOR P.S. SINI

T

he circuit is a MOSFET based linear voltage regulator with a voltage drop of as low as 60 mV at 1 ampere. Drop of a fewer millivolts is possible with better MOSFETs having lower RDS(on) resistance. The circuit in Fig. 1 uses 15V-0-15V secondary output from a step-down transformer and employs an n-channel MOSFET IRF540 to get the regulated 12V output from DC input, which could be as low as 12.06V. The gate drive voltage required for the MOSFET is generated using a voltage doubler circuit consisting of diodes D1 and D2 and capacitors C1 and C4. To turn the MOSFET fully on, the gate terminal should be around 10V above the source terminal which is connected to the output here. The voltage doubler feeds this voltage to the gate through resistor R1. Adjustable shunt regulator TL431 (IC2) is used here as an error amplifier, and it dynamically adjusts the gate voltage to maintain the regulation at the output. With adequate heatsink for the MOSFET, the circuit can provide up to 3A

Fig. 1

150

ELECTRONICS PROJECTS Vol. 20

output at slightly elevated minimum voltage drop. Trimpot VR1 in the circuit is used for fine adjustment of the output voltage. Combination of capacitor C5 and resistor R2 provides error-amplifier compensation. The circuit is provided with a short-circuit crow-bar protection to guard the components against overstress during accidental short at the output. This crow-bar protec- Fig. 2 tion will work as follows: Under normal working conditions, the voltage across capacitor C3 will be 6.3V and diode D5 will be in the off state since it will be reverse-biased with the output voltage of 12V. However, during output short-circuit condition, the output will momentarily drop, causing D5 to conduct and the opto-triac MOC3011 (IC1)

will get triggered, pulling down the gate voltage to ground, and thus limiting the output current. The circuit will remain latched 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 when the regulator has to work from a DC rail in place of 15V-0-15V AC supply. The gate voltage here is generated using an LM555 charge pump circuit as follows: When 555 output is low, capacitor C2 will get charged through diode D1 to the input voltage. In the next half cycle, when the 555 output goes high, capacitor C3 will get charged to almost double the input voltage. The rest of the circuit works in a similar fashion as the circuit of Fig. 1. The above circuits will help reduce power-loss by allowing to keep input voltage range to the regulator low during initial design or even in existing circuits. This will keep the output regulated with relatively low input voltage compared to the conventional regulators. The minimum voltage drop can be further reduced using low RDS(on) MOSFETs or by paralleling them.

MAGNETIC PROXIMITY SWITCH T.K. HAREENDRAN

H

ere is an interesting circuit for a magnetic proximity switch which can be used in various applications. The circuit, consists of a reed switch at its heart. When a magnet is brought in the vicinity of the sensor (reed switch), its contacts close to control the rest of the switching circuit. In place of the reed switch, one may, as well, use a general-purpose electromagnetic reed relay (by making use of the reed switch contacts) as the sensor, if required. These tiny reed relays are easily available as they are widely used in telecom products. The reed switch or relay to be used with this circuit should be the ‘normally open’ type. When a magnet is brought/placed in the vicinity of the sensor element for a moment, the contacts of the reed switch close to trigger timer IC1 wired in monostable mode. As

a consequence its output at pin 3 goes high for a short duration and supplies clock to the clock input (pin 3) of IC2 (CD4013—dual D-type flip-flop). LED D2 is used as a response indicator. This CMOS IC2 consists of two independent flip-flops though here only one is

used. Note that the flip-flop is wired in toggle mode with data input (pin 5) connected to the Q (pin 2) output. On receipt of clock pulse, the Q output at pin 1 changes from low to high state and due to this the relay driver transistor T1 gets forward-biased. As a result the relay RL1 is energised.

SIMPLE LOW-COST DIGITAL CODE LOCK A. JEYABAL

M

any digital code lock circuits have been published in this magazine. In those circuits a set of switches (conforming to code) are pressed one by one within the specified time to open the lock. In some other circuits, custom-built ICs are used and positive and negative logic pulses are keyed in sequence as per the code by two switches 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 open the lock, but only two switches at a time. Thus a total of three sets of switches have to be pressed in a particular sequence. (Of these three sets, one set is repeated.) The salient features of this circuit are: 1. Use of 16 switches, which suggests that there is a microprocessor inside.

2. Elimination of power amplifier transistor to energise the relay. 3. Low cost and small PCB size. An essential property of this electronic code lock is that it works in monostable mode, i.e. once triggered, the output becomes high and remains so for a period of time, governed by the timing components, before returing to the quiescent low state. In this circuit, timer IC 555 with 8 pins is used. The IC is inexELECTRONICS PROJECTS Vol. 20

151

pensive and easily available. Its pin 2 is the trigger input pin which, when held below 1/3 of the supply voltage, drives the output to high state. The threshold pin 6, when held higher than 2/3 of the supply voltage, drives the output to low state. By applying a low-going pulse to the reset pin 4, the output at pin 3 can be brought to the quiescent low level. Thus the reset pin 4 should be held high for normal operation of the IC. Three sets of switches SA-SC, S1-S8 and S3-S4 are required to be pressed, in that order, to open the lock. On pressing the switches SA and SC simultaneously, capacitor C3 charges through the potential divider comprising resistors R3 and R4, and on releasing

these two switches, capacitor C3 starts discharging through resistor R4. Capacitor C3 and resistor R4 are so selected that it takes about five seconds to fully discharge C3. Depressing switches S1 and S8 in unison, within five seconds of releasing the switches SA and SC, pulls pin 2 to ground and IC 555 is triggered. The capacitor C1 starts charging through resistor R1. As a result, the output (pin 3) goes high for five seconds (i.e. the charging time T of the capacitor C1 to the threshold voltage, which is calculated by the relation T=1.1 R1 x C1 seconds). Within these five seconds, switches SA and SC are to be pressed momentarily once again, followed by the depression of last

code-switch pair S3-S4. These switches connect the relay to output pin 3 and the relay is energised. The contacts of the relay close and the solenoid pulls in the latch (forming part of a lock) and the lock opens. The remaining switches are connected between reset pin 4 and ground. If any one of these switches is pressed, the IC is reset and the output goes to its quiescent low state. Possibilities of pressing these reset switches are more when a code breaker tries to open the lock. LED D5 indicates the presence of power supply while resistor R5 is a current limiting resistor. The given circuit can be recoded easily by rearranging connections to the switches as desired by the user.

HAND PROXIMITY MUSICAL TONE GENERATOR RISHI KHATRI

T

his circuit generates a musical tone whose pitch varies as the distance of the hand from the sensor varies. It consists of two stages: 1. Hand proximity detector 2. Oscillator and output stage The detector portion consists of a sensor plate (10cm x 10cm) which can be made from an aluminium sheet, or we may use a circular loop (10cm in diameter) made from an insulated copper or aluminium wire. The capacitance between the sensor plate (or loop) and ground

152

ELECTRONICS PROJECTS Vol. 20

through a player’s hand will vary as the hand’s distance varies from the sensor. The sensor plate is connected to an unstable op-amp IC1(a) (1/2 µA747) which oscillates at varying frequency in the neighbourhood of 20 kHz. This frequency lies in the slew rate limited range. Thus output at pin 12 of IC1 is a triangular wave whose peak varies with frequency. This is followed by a peak detector wired around IC1(b).The net output of proximity detector is a voltage whose magnitude depends upon distance of hand from

the sensor. The output of hand proximity detector is fed to IC2(a) which forms a voltage controlled oscillator. The output of oscillator at pin 12 of IC2 is a triangular wave whose frequency lies in the audio range. This output is fed into power stage realised from µA741 (IC3) acting as a voltage amplifier followed by a power stage which uses TIP 122 (npn) and TIP127(pnp) power Darlingtons connected in class AB complementary push-pull configuration. Their output is fed into an 8-

ohm, 4W loudspeaker. The maximum output thus obtained is 3.6W. Log potentiometer VR2 (10 kilo-ohm) can be used to adjust the volume. TIP122 and TIP127 should be mounted on separate heat sinks or on the same heat sink but should be isolated from the heat sink using a mica sheet insulator. Variable resistor VR1 is a 10k linearly variable resistance. Its wiper arm is varied and adjusted until loudspeaker output lies in reasonable frequency range and the sound is pleasant to hear—with your hand and body away from the sensor. Then as the hand is brought near the sensor, the output frequency decreases. Potmeter VR1 should, in fact, be so adjusted that the output becomes zero when the hand is brought extremely close to the sensor (without touching it).

WIRELESS MUSICAL CALLING BELL PRADEEP G.

M

usical and voice-generating electronic calling bells are very popular nowadays. These calling bells use a pair of wires between the switch and bell circuit. The circuit idea described here is for a remote wireless calling bell which can work up to a distance of about 15 metres. For wireless operation, a pair of sealed VHF remote control transmitter and receiver modules have been employed. Transmitter module VG40T is compact, measuring 3.4cm x 2.9cm x 1cm. It

Fig. 1: Transmitter

Fig. 2: Receiver

has three terminals. One lead is connected to a compact 9V PP3 battery and the other is connected to negative terminal of the battery. Central terminal is connected to trigger switch as shown in the diagram. The transmitter’s standby current is only 5 microamperes. Thus a 9V PP3 battery would have a long life when used in this circuit. When micro switch S1 is pressed, a modulated signal is transmitted which has a reception range of about 15 metres (50 feet) from the transmitter module.

Remote control receiver module VG40R is connected in input side of the musical bell as shown in the figure. Dimensions of receiver module are 4.5cm x 2.1cm x 1.3cm. This module is also sealed and has three external terminals. One terminal is positive and the other is negative across which a 3V battery is connected. The third terminal, the trigger terminal, is connected to input of musical circuit as shown in the diagram. Standby current drawn by the receiver module is about 300 microamperes. No PCB is required for the transmitter because transmitter module does not need any external component. Transmitter generates VHF signals of about 300 MHz frequency. PCB of musical section is freely available from the components vendors at a low cost. Modules can be connected to the circuit with a short length of flexible wire. Connect a 9V PP3 battery ELECTRONICS PROJECTS Vol. 20

153

to the transmitter and 3V battery to the receiver. Keep the transmitter at a distance of about 5 metres. Press push switch S1 of transmitter for a moment. The music will be heard from the remote bell. After completing a musical note, it

will automatically stop. Depression of switch S1 on transmitter again will generate the musical tone again. If UM3481/3482 ICs are used in the circuit, 12 different tunes can be heard. If CIC4822 IC is used, then up to 16

tunes can be heard. Transmitter and receiver-sealed modules have no antenna. Without any antenna, a range of up to 15 metres is possible. Range will be higher if the gadget is used in open space.

Readers Comments: ❑ In the call bell circuit, modules VG40T and VG40R have been used. Where can these be procured from? Can an aerial be attached to the circuit to extend the range further?

K. Venugopal Cuddapah The author, Pradeep G. replies: VG40T transmitter and VG40R receiver are scaled modules which have no antenna terminal. Thus no aerial

can be connected to these modules without opening their plastic moulding. These remote control modules are available with leading component suppliers in metro cities, such as Visha Electronics, Mumbai.

SIMPLE TELEPHONE PRIVACY CIRCUIT RAJ K. GORKHALI

W

hen several telephone extensions use one telephone line pair, it becomes possible for another extension user to overhear your conversation. This very simple circuit arrangement prevents that possibility, cutting off all extensions except the one in use, with no discernible effect on performance. As the diagram shows, each handset is connected via a diac. The telephone line voltage is around 48V DC when all handsets are on hook and it drops to 6V to 10V DC when any one of the handsets is lifted. Diacs start to conduct when the applied voltage is above their breakover voltage of ± 25 to 35V DC and continue to conduct when voltage drops to a low level,

ceasing conduction when current is too low to sustain it. Diacs permit the ringing tone to pass, since they conduct both ways as long as peak voltage exceeds their break-over voltage of ± 25V to 35V. If an extension then lifts its handset, breakdown occurs at that diac and the extension is operative since the diac is conducting with 6V now across it and with a current of around 20 mA through the handset. The other diacs cannot break over at this voltage of 6V

to 10V. If two handsets are lifted simultaneously, the one with the diac of lower breakover voltage will be activated. Thus at one time only one of the several extensions become operative.

BIDIRECTIONAL CODE CONVERTER P.R. NARAYANASWAMY

T

here are a number of codes in use in digital systems. One such code is the Gray code. A number in natural binary can be converted to Gray

154

ELECTRONICS PROJECTS Vol. 20

code or vice versa using EXCLUSIVE OR (XOR) gates. Only the modes of connection of the XOR gates differ. This is illustrated in Fig. 1(a). When switches S1(a)

and S1(b) are in position 1, the circuit works as a binary-to-Gray code converter. In position 2 of these switches, it functions as a Gray-to-binary code converter.

The number of switches increases with the increasing value of binary or Gray code input. These switches can be replaced by a 2-line to 1-line multiplexer shown in Fig. 1(b). In Fig. 1(b), when switch S1 is at logic 1, the

upper AND gate is enabled, performing binary-to-Gray code conversion. When switch S1 is flipped to logic 0, the lower AND gate is enabled, performing Grayto-binary code conversion. A complete 6bit code converter using quad 2-line to 1-line multiplexer 74LS157 (IC1) is shown in Fig. 1(c). Data bits

D5-D0 are the input code bits and Y5-Y0 are the output code bits. When switch is in logic 1 position, the output at pins 4, 7, 9 and 12 of 74LS157 correspond to input data bits D4 - D1 respectively, performing binary-to-Gray code conversion. When switch S1 is flipped to logic 0, the outputs at pins 4, 7, 9 and 12 of IC1 correspond to output data bits Y4 - Y1 respectively, performing Gray-to-binary code conversion. Fig. 2 shows a test circuit which the author used for testing of the code converter using software (MICROLOGIC II). For clarity and simplicity in testing the circuit using software MICROLOGIC II, a four-bit input code is used. The data inputs DATA4 to DATA1 are for generating a four-bit input code D3 - D0 ranging from 0 0 0 0 through 1 1 1 1 in ascending order. DATA5 in Fig. 2 simulates the switch S1 in Fig. 1(c). The simulation results obtained are shown in Fig. 3. When data S is at logic 0 (low) position, a Gray code input (Y3-Y0) of 0 1 1 1 results in corresponding binary output (D3-D0) of 0 1 0 1. Similarly, when signal S is at logic 1 (high), a binary input (D3 D0) of 0 1 1 1, results in the corresponding Gray code output (Y3 - Y0) of 0 1 0 0. When signal S was low and also when it was high, all other input codes and the corresponding output codes were verified and found correct. Simulation results indicate that the code converter of Fig. 1(c) performs bi-directional code conversion. The code converter of Fig. 1(c) is thus an ideal proposition. This is an interesting laboratory assignment for undergraduate degree curriculum in Electrical Engineering. ELECTRONICS PROJECTS Vol. 20

155

PRIORITY INDICATOR FOR QUIZ CONTESTS SUSOBHAN DAS

I

n a quiz show, a contestant who presses his button before any other contestant gets the top priority for answering the quiz. Similarly, the priority of the other contestants is decided by the order in which each one presses his/ her answer button. In this circuit, the main role is played by IC3 (74LS89) which is a 64-bit RAM organised as 4-bit x 16-word array. It is used for storing the sequence in which the contestants, during a quiz contest,

156

ELECTRONICS PROJECTS Vol. 20

press their buttons. The present circuit can be used for a maximum of four contestants. The answer button allocated to each contestant is used in conjunction with a non-retriggerable monostable flip-flop 74LS121. These mono flip-flop ICs (IC5 through IC8) function with switches S1 through S4 respectively. IC4, which is again a 74LS121 flip-flop, is used for generating a write pulse (active low) for writing the status (Q output logic level) on

data lines of RAM against the current address (on its address lines A0 through A3). A sixth 74LS121 (IC10) is used for viewing/checking the contestants’ priority for answering the quiz and also for clearing contents of the selected RAM location by writing 0000 against it. For understanding the circuit operation, assume that switch S7 is in normal position, switch S8 is open and counter IC2 (74LS93) is reset (with the help of switch S6) so that all of its output pins

are low. Thus initial address output of IC2 is 0000. This address (0) is also displayed on 7-segment display after decoding by IC1 (74LS47). This is the situation at the start of a fresh quiz. At this stage if any competitor presses his answer button, the concerned 74LS121 generates a single clock pulse at its Q output. This Q output is connected to a specific data line of IC3. Simultaneously Q output of the same 74LS121 IC causes output of IC9 (74LS20) to go high and triggers IC4. The Q output of IC4 is used for writing the data present on data lines at address 0000. The address which was being indicated on the display (0), gets incremented by one at the trailing end of the pulse which becomes available at the output of 74LS20

(IC9) when Q output of any of the four flip-flops (IC5 through IC8) makes a transition from high to low. Now that the address has incremented to 0001 at the output of 74LS93 (IC2), the next depression of an answer button by a competitor has his data (logic 1) written against address 0001. The address line at end of each depression of the switches (S1 through S4) increments by one so as to enable writing of new data at an incremented address. When answering time allotted for a question is over, the person conducting the quiz flips switch S7 to check position and resets counter output to 0000 using reset switch S6. Now the contestant which had pressed his button first would be indicated by lighting of the corresponding lamp (L1

through L4). This happens because only that data output pin (5, 7, 9 or 11) which corresponds to the first depression of an answer button by a specific contestant would go to logic 0 and activate corresponding relay/bulb via its driver transistor (T1 through T4). The address of the concerned contestant is simultaneously displayed on 7-segment display. The address can be incremented by one by a momentary depression of switch S5 to check the next contestant who pressed his answer button next. After the round is over, switch S7 is to be flipped to its normal position. Switch S8, which is optional, can be used for erasing RAM contents against the displayed locations by pressing switch S5 momentarily.

DUAL-CHANNEL DIGITAL VOLUME CONTROL SHEENA K.

T

his circuit could be used for replacing your manual volume control in a stereo amplifier. In this circuit, push-to-on switch S1 controls the forward (volume increase) operation of both channels while a similar switch S2 controls reverse (volume decrease) operation of both channels. Here IC1 timer 555 is configured as an astable flip-flop to provide low-frequency pulses to up/down clock input pins of pre-setable up/down counter 74LS193 (IC2) via push-to-on switches

S1 and S2. To vary the pulse width of pulses from IC1, one may replace timing resistor R1 with a variable resistor. Operation of switch S1 (up) causes the binary output to increment while operation of S2 (down) causes the binary output to decrement. The maximum count being 15 (all outputs logic 1) and minimum count being 0 (all outputs logic 0), it results in maximum and minimum volume respectively. The active high outputs A, B, C and D of the counter are used for controlling

two quad bi-polar analogue switches in each of the two CD4066 ICs (IC3 and IC4). Each of the output bits, when high, short a part of the resistor network comprising series resistors R6 through R9 for one channel and R10 through R13 for the other channel, and thereby control the output of the audio signals being fed to the inputs of stereo amplifier. Push-to-on switch S3 is used for resetting the output of counter to 0000, and thereby turning the volume of both channels to the minimum level.

ELECTRONICS PROJECTS Vol. 20

157

WATER LEVEL CONTROLLER CUM MOTOR PROTECTOR RAMAKRISHNAN K.

N

owadays, usage of overhead tank (OHT) with an electrically operated water pump is a common sight. The pump, being a costly item, should be protected against damage due to high and low voltages. People find it very inconvenient to switch off the pump even when their OHT starts overflowing, specially when they are busy or it is raining. This circuit provides a solution for all such problems. The main features of this circuit are: 1. Low and high voltage cut-off 2. Automatic switching off of motor when overhead tank is full 3. Use of convenient push-to-on buttons for switching on and switching off of motor. The heart of the circuit is IC CD4011, which has four inverter gates. When the circuit gets 12V power supply, capacitor C1 pulls input of N1 low, and this causes the output of N2 to go low. This state is

158

ELECTRONICS PROJECTS Vol. 20

latched by resistor R1 and transistor T1 is biased to cut-off state, and hence both relay RL1 and motor M are in off state. When we push switch S1 momentarily, the input of inverter gate N1 becomes high and output of gate N2 also becomes high. As a result, transistor T1 turns on and both relay RL1 and motor are activated (provided transistors T2 and T3 are forward biased). When water level in OHT touches the sensors, input of N1 become low, which turns relay RL1 off and the motor stops. The motor can be turned off manually also by pushing switch S2 at any time. Transistors T2 and T3 are both forward biased if the line voltage is within certain low and high voltage limits, as explained below. When the voltage level rises above a pre-determined value, input to gate N3 becomes high and its output become low, which turns off transistor T2 and also the relay. When the voltage level drops below

a pre-determined value, output of gate N4 becomes high, which turns off transistor T3 and relay RL1. Thus when the mains AC voltage (or the DC voltage sample derived from mains) is above or below certain limits, which could damage the 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 that when supply voltage goes below 190V, output of N4 goes high. Similarly, for setting the high voltage cut-off, adjust potmeter VR1 in such a way that when supply voltage goes above 250V, output of N3 goes low. The high and low cut-off voltages can be changed according to the requirement for a given motor. Two wires are needed to connect the circuit to the sensors which are fitted in the OHT. Sensors must be fitted as shown in figure. A simple power supply circuit is also shown here. The circuit can be assembled on a general-purpose PCB and housed in an eliminator case which is easily available in the market. Use good-quality insulated wire to connect sensor to the circuit.

UNDER VOLTAGE CUT-OUT AND DELAY FOR REFRIGERATORS S. CHANDRA SEKHAR

T

he circuits previously published, and also those which are used in majority of voltage stabilisers sold in the market, either use too many components to perform what is after all a simple task, or perform this task badly, or both. Some elaborate designs use 555 timers and comparator ICs but the delay is present at the start of each power-up. Other circuits implement the time delay correctly as the minimum time between power off and power on. That is, time delay is not executed if the power failure lasts longer than the set time delay. But then, this type of time delay uses relay contacts for switching the timing capacitor around but the relay contacts designed for high current do not switch low voltages very well. And slight misalignment or wear and tear of the contacts is reflected in erratic timing. The circuit presented here uses the principle of charging a capacitor during the ‘on’ time and discharging it through a resistor during the ‘off’ time. This is implemented electronically, avoiding relay contacts. Consequently, the relay can be a simple ‘normally off’ type. The rest of the circuit, including the voltage sensing part, is the same as that pub-

lished in various circuit ideas and also incorporated in the devices available in the market. This circuit is most economical as both the above-mentioned functions are implemented using only three transistors, and needs only a single contact (N/O type) relay. Since the operating forces are not shared amongst multiple contacts, the relay with a single contact is sturdier than multiple contact types. The time delay is entirely electronic, does not use relay contacts for switching and comes into operation only when needed. When relay RL1 operates, its contacts connect the supply voltage to the compressor in the refrigerator. At the same time, capacitor C2 charges to the supply

voltage through diode D6 and resistor R6. When the supply fails, capacitor C2 discharges through resistors R7 and R8 and the base-emitter junction of transistor T3. If the supply is resumed after the set time delay, capacitor C2 will be completely discharged and transistor T3 would remain cut-off. If the supply resumes before capacitor C2 has been completely discharged, transistor T3 turns on and clamps the base of transistor T2, preventing it from turning on. The emitter current of transistor T3 (about 200 microamperes) is insufficient to actuate the relay. When, after the required delay, transistor T3 turns off, the base of transistor T2 rises to the fraction of the supply voltage set by preset VR1. If this voltage is

ELECTRONICS PROJECTS Vol. 20

159

greater than 7.4 volts (zener voltage + VBE of transistor T2) then transistor T2 turns on, applying forward bias to transistor T1, which drives the relay on. If this voltage falls below 7.4V, transistor T2 will turn off, cutting off the base current of transistor T1 which turns off, causing the relay to de-energise. Preset VR1 is used to adjust the voltage corresponding to the mains voltage, at which this happens. Resistors R3 and R4 introduce positive feedback for a certain amount of hysterisis. This is necessary to prevent

relay chatter because the supply voltage drops as the relay turns on. If overvoltage cut-off is also desired, the required circuitry around transistor T4 may be added. Preset VR2 may be adjusted such that transistor T4 conducts when the mains voltage reaches the overvoltage level. This would cause the collector of transistor T4 (and base of transistor T2) to be clamped to around 6V to cut-off transistors T2 and T1 and relay RL1. The time delay is dependent on

the supply voltage to a certain extent. Connecting a 12V, 250mW zener diode across capacitor C2 will eliminate this dependence. The circuit can be assembled on a general-purpose PCB and conveniently wired into the refrigerator. This has the advantage that the lamp inside the refrigerator is always operational, and that the compressor motor is protected even if the thermostat turns off and on in quick succession.

INFRARED CORDLESS HEADPHONE PRADEEP G.

U

sing this low-cost project one can reproduce audio from TV without disturbing others. It does not use any wire connection between TV and headphones. In place of a pair of wires, it uses invisible infrared light to transmit audio signals from TV to headphones. Without using any lens, a range of up to 6 metres is possible. Range can be extended by using lenses and reflectors with IR sensors comprising transmitter and receiver. IR transmitter uses two-stage tran-

160

ELECTRONICS PROJECTS Vol. 20

sistor amplifier to drive two series-connected IR LEDs. An audio output transformer is used (in reverse) to couple audio output from TV to the IR transmitter. Transistors T1 and T2 amplify the audio signals received from TV through the audio transformer. Lowimpedance output windings (lower gauge or thicker wires) are used for connection to TV side while high-impedance windings are connected to IR transmitter. This IR transmitter can be powered from a 9-volt mains adapter or battery. Red

LED1 in transmitter circuit functions as a zener diode (0.65V) as well as supplyon indicator. IR receiver uses 3-stage transistor amplifier. The first two transistors (T4 and T5) form audio signal amplifier while the third transistor T6 is used to drive a headphone. Adjust potmeter VR2 for max. clarity. Direct photo-transistor towards IR LEDs of transmitter for max. range. A 9volt battery can be used with receiver for portable operation.

Readers Comments: ❑ I have doubt on the audio output transformer, as the rating was not mentioned on it. I used a 6V audio output transformer. Also, the part number of the IR phototransistor in the receiver was not mentioned. Please clear

my doubts. Sukanta Kumar Swain Ganjam, Orissa EFY: You have correctly used the 6V audio output transformer. There are a number of brands available in the market. You can use 2-pin

phototransistors. The part numbers are TS-8, PT-224, and SLT-15 flat head (product brochure is available at ‘www.microimpex.com’ of Mumbai). The pin with a longer lead is normally the collector and the pin with a shorter lead is the emitter.

STABILISER WITH AUTO CUT-OFF ARRANGEMENT S.C. DAS

S

tabilisers incorporating auto cutoff arrangement are manufactured by most of the reputed manufacturers using different methods. The stabiliser circuit presented here makes use of the following major components to provide the auto cut-off facility:

1. One relay with single changeover contacts 2. One relay with two changeover contacts 3. One start push-button, a DPDT changeover 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 and the following sequence of operations is to be performed: Start push-button is momentarily pressed so that the neutral line connec-

ELECTRONICS PROJECTS Vol. 20

161

tion to lower limb of auto-transformer is completed through it while the other limb of auto-transformer is connected to live line through one of the contacts of the DPDT switch. The voltage developed across secondary of transformer X1 is available to the bridge rectifier via one set of normally-closed contacts of relay RL1. As a result relay RL2 gets energised to provide hold-on contacts across start switch S1 to connect neutral line to the neutral point of output socket as well as the lower limb of autotransformer. The live line from the selected (by rotary switch S4) tap of the

auto-transformer is connected to live point of the output socket via contacts of switch S3 and second set of normallyclosed contacts of relay RL1. Note that rotary switch is thrown to up position when mains voltage is higher than the required output voltage and it is flipped to down position when mains voltage is lower than the output voltage. The secondary of transformer X1 is also used to sample the output voltage. When the output voltage exceeds a preset value, dependent upon the threshold value set by preset VR1, transistor T1 conducts and as a result

relay RL1 energises while relay RL2 de-energises, cutting off supply to the auto-transformer as well as the output socket. Now the supply can be resumed only after manual change of voltage tapping using rotary switch S4 and DPDT switch S3, or by varying the threshold voltage level using preset VR1. Start switch is again required to be pressed for getting the output. This arrangement protects the load against mains voltage variations above the preset limit. (Note: Once adjusted, preset VR1 should not be fiddled with, unnecessarily.)

SIMPLE ANALOGUE-TODIGITAL CONVERTER B.P. LADGAONKAR

N

ormally analogue-to-digital converter (ADC) needs interfacing through a microprocessor to convert analogue data into digital format. This requires additional hardware and necessary software, resulting in increased complexity and hence the total cost. The circuit of A-to-D converter shown

162

ELECTRONICS PROJECTS Vol. 20

here is configured around ADC 0808, avoiding the use of a microprocessor. The ADC 0808 is an 8-bit A-to-D converter, having data output lines D0-D7. It works on the principle of successive approximation. It has a total of eight analogue input channels, out of which any one can be selected using address lines A, B and C. Here, in this case, input channel IN0 is selected by grounding A, B and C address lines. Usually the control signals EOC (end of conversion), SC (start conversion), ALE (address latch enable) and OE (output enable) are interfaced by means of a microprocessor. However, the circuit shown here is built to operate in its continuous mode without using any microprocessor. Therefore the input control signals ALE and OE, being active-high, are tied to Vcc (+5 volts). The input control signal SC, being active-low, initiates start of conversion at falling edge of the pulse, whereas the output signal EOC becomes high after completion of conversion

(digitisation). This EOC output is coupled to SC input, where falling edge of EOC output acts as SC input to direct the ADC to start the next conversion. As the conversion starts, EOC signal goes high. At next clock pulse EOC output again goes low, and hence SC is enabled to start the next conversion. Thus, it provides continuous 8-bit digital output corresponding to instantaneous value of analogue input. The maximum level of analogue input voltage should be appropriately scaled down below positive reference (+5V) level. The ADC 0808 IC requires clock signal of typically 550 kHz, which can be easily derived from an astable multivibrator constructed using 7404 inverter gates. In order to visualise the digital output, the row of eight LEDs (LED1 through LED8) have been used, wherein each LED is connected to respective data output lines D0 through D7. Since ADC works in the continuous mode, it displays digital output as soon as analogue input is applied. The decimal equivalent digital output value D for a given analogue input voltage Vin can be calculated from the relationship

SLEEP-SWITCH CUM WAKE-UP TIMER SHEENA K.

H

ere is a sleep-switch circuit that can be easily converted into a wake-up timer. A dual-mode time setting makes the system versatile. The circuit is low-cost and can function as a precise timer. The heartbeat produced by IC1 is a sharp 1Hz square wave signal having a duty cycle of 50 per cent. This is achieved by using a 4.194304MHz crystal in combination with discrete components around it. The 1Hz output of IC1 is connected to IC2 as well as one of the terminals of switch S1. IC2 is configured as divide-by-6 counter while IC3 further divides the output of IC2 by ten to produce one-minute output at its pin 12. This is brought to the second terminal of two-way switch S1 to help select either the ‘minutes’ or the ‘seconds’ mode of operation for IC4. The decade counter IC4 provides bi-

nary output as it counts up the input pulses and IC5 decodes/converts them to 1-of-10 outputs (units). Similarly, the IC6IC7 pair provides tens output since IC6 clock input pin is connected to D output pin of IC4. Rotary switches S2 and S3 can be set to select any time between either 0 to 99 seconds or 0 to 99 minutes, depending upon the position of mode switch S1. Switches S2 and S3 could also be replaced by thumb-wheel type switches or 10-position DIP switches with one of their side terminals shorted together to serve as a pole. Please note that IC5 and IC7 (74145) have active low outputs. The outputs from switches S2 and S3 are input to a two-input OR gate inside IC8 (7432) to obtain active low output on completion of the set time delay to deactivate relay RL1 through relay driver tran-

sistor T1 (normally conducting) when set time is reached. When transistor T1 cuts off, its collector goes high to reset oscillator IC1, and thus count at output of IC4 and IC6 gets locked. For resetting or restarting, the power supply to the circuit should be switched off and then switched on again. The BCD outputs of IC4 and IC6 are converted to seven-segment outputs by IC9 and IC10 to drive the units and tens displays respectively for indicating elapsed time continuously. The relay contacts (normally open and normally closed) can be suitably used to energise or deenergise an alarm after the preset delay. It can thus be used as wake-up alarm or sleep timer. If you want to de-energise the relay, say after 30 minutes, then set switch S1 to minutes mode, S2 to 0 and S3 to 3, and

ELECTRONICS PROJECTS Vol. 20

163

then switch on the supply to the circuit. After 30 minutes the outputs at poles of switches S2 and S3 will go low and so also the output of OR gate (IC8). As a

result, transistor T1 will be cut-off to deenergise the relay. One can easily add 0-99 hours capability by cascading two counters similar

to the minutes counter section comprising IC2 and IC3. Input clock for hours counter would be the minutes clock available at pin 12 of IC3.

CHARGE MONITOR FOR 12V RECHARGEABLE LEAD-ACID BATTERY SIDDHARTH SINGH AND SRINIVAS REDDY PINGLE

A

battery is a vital element of any battery-backed system. In many cases the battery is more expensive than the system it is backing up. Hence we need to adopt all practical measures to conserve battery life. As per manufacturer’s data sheets, a 12V rechargeable lead-acid battery should be operated within 10.1V and 13.8V. When the battery charges higher than 13.8V it is said to be overcharged, and when it discharges below 10.1V it can be deeply discharged. A single event of overcharge or deep discharge can bring down the charge-holding capacity of a battery by

164

ELECTRONICS PROJECTS Vol. 20

15 to 20 per cent. It is therefore necessary for all concerned to monitor the charge level of their batteries continuously. But, in practice, many of the battery users are unable to do so because of non-availability of reasonably-priced monitoring equipment. The circuit idea presented here will fill this void by providing a circuit for monitoring the charge level of lead-acid batteries continuously. The circuit possesses two vital features: • First, it reduces the requirement of human 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 voltage is ranked anywhere between 0 and 10, depending upon its magnitude. The lower reference voltage of 10.1V is ranked ‘0’ and the upper voltage of 13.8V is ranked as ‘10.’ (Outputs 9 and 10 are logically ORed in this circuit.) The calibration procedure of reference voltages is explained later. IC 74LS147 is a decimal-to-BCD priority encoder which converts the output of LM3914 into its BCD complement. The true BCD is obtained by using the hex inverters inside IC 74LS04. This BCD

output is displayed as a decimal digit after conversion using IC5 (74LS247), which is a BCD-to-seven-segment decoder/driver. The seven-segment LED display (LTS-542) is used because it is easy to read compared to a bar graph or, for that matter, an analogue meter. The charge status of the battery can be quickly calculated from the display. For instance, if the display shows 4, it means that the battery is charged to 40 per cent of its maximum value of 13.8V. The use of digital principles enable us to employ a buzzer that sounds whenever there is an overcharge or deep discharge, or there is a need to conserve battery charge. A buzzer is wired in the circuit such that it sounds whenever battery-

charge falls to ten per cent. At this point it is recommended that unnecessary load be switched off and the remaining charge be conserved for more important purposes. Another simple combinational logic circuit can also be designed that will sound the buzzer when the display shows 9. Further charging should be stopped at this point in order to prevent overcharge. The circuit is powered by the battery under test, via a voltage regulator IC. The circuit takes about 100 mA for its operation. For calibrating the upper and lower reference levels, a digital multimeter and a variable regulated power supply source are required. For calibrating the lower reference voltage, follow the steps given:

• Set the output of power supply source to 10.1V. • Connect the power supply source in place of the battery. • Now the display will show some reading. At this point vary preset VR2 until the reading on the display just changes from 1 to 0. The higher reference voltage is calibrated similarly by setting the power supply to 13.8V and varying preset VR1 until reading on the display just changes from 8 to 9. After the calibration is completed, the circuit may be housed in a suitable enclosure. The cost of all the components, including the enclosure, would be around Rs 200.

WINDOW/FENCE CHARGER T.K. HAREENDRAN

C

ircuit of a compact electrified window/fence charger is presented here. The circuit is intended to produce non-lethal mild shock to keep away intruders. It comprises transistors T1 and T2 which form an astable (free-running) multivibrator with the associated resistors and capacitors. The pulse repetition rate is determined by the values of RC time constant. With the component values used, it is about 6 Hz. The pulse spacing can be increased by increasing the values of resistors R3 and R4. A high voltage generator is realised with the help of an ordinary step-down transformer and a medium-power transistor which follows the astable multivibrator. Output of the astable multivibrator, from the collector of transistor T2, is directly connected to the base of switching transistor T3 to generate high-amplitude pulses. LED D1 indicates

the pulse activity. When power is initially applied, capacitor C3 is charged through resistor R6. This RC network is used deliberately to limit the maximum output power applied to the fence/window frame. At the same time, oscillator starts working

and its output triggers switching transistor T3. As a result, capacitor C3 is rapidly discharged via secondary winding of transformer X1. Consequently, a high voltage is induced in the primary of X1. At next pulse, the process repeats itself.

Readers Comments: ❑ The multivibrator stage comprising transistors T1 and T2 works well, but when I connect the base of switching transistor T3 (D313) to the collector of transistor T2, the collector voltage drops to 0.4 volt and and hence it is unable to drive transistor

T3. Kindly suggest the required modifications. J.T. Joglekar Nagpur EFY: We’ve retested the circuit and found that the collector voltage during

conduction of transistor T3 measures 0.8 volt (correct) and the circuit gave 150V (peak) pulses at around 150ms intervals. On reducing the value of resistor R5 from 4.7k to 1k, the pulse amplitude increased to 250V (peak). ELECTRONICS PROJECTS Vol. 20

165

CORDLESS PHONE BACKUP P.V. VINOD KUMAR

166

ormally the base of a cordless phone has an adaptor and the handset has Ni-Cd cells for its operation. The base unit becomes inoperative in case of power failure. Under such conditions, it is better to provide a backup using Ni-Cd cells externally. Here is a simple power supply back-up circuit which can be used with cordless phone SANYO CLT-420 or similar sets. The working is simple. When AC mains is present, Ni-Cd cells are charged through IC LM317L, which is wired as a current source. Also, diode D3 is reversebiased, which keeps Ni-Cd cells isolated from positive rail. When AC mains goes off, the Ni-Cd cells provide supply to the cordless phone base

N

unit through diode D3. A green LED is used to indicate the presence of AC mains. Each Ni-Cd cell costs around Rs 34,

and the cost of the backup unit, including the box and cells, would not exceed Rs 300. Hence the circuit is well worth the investment.

Readers Comments: ❑ The Cordless Phone Backup circuit has no protection circuitry to avoid overcharging of cells. Can an LED be added to indicate supply availability from the backup during a power failure? Please give the details of LM317. Can I use this circuit for a cordless phone which runs on 9V, 800mA? Tribikram Kar 56 APO ❑ My cordless, Sanyo CLT-6700, has a 9V-250mA adapter. Please suggest a modification to this circuit so that I can use it with my cordless phone. The number of cells required, as shown is 1.2V×7 (=8.4V) for a 12V adaptor. Please explain how will it work with 8.4V?

From where can I get the cabinet to house the circuit and the cells? Abhay K. Changedia Pune The author, P.V. Vinod Kumar, replies: I have designed the circuit for a cordless phone that runs on a 12V adaptor. To use my circuit with Sanyo CLT-6700, you will need a new 12V adaptor. Inside the base unit of Sanyo CLT 420 cordless phone there is a 7805 regulator. Hence, giving anything above 8V is sufficient for the base unit to operate. One may use either a 12V adaptor or 8.4V NiCd cells or 6AA cells. Keeping the simplicity and the cost of the circuit in mind. I have compromised on the cell-protection feature.

To improve the Ni-Cd cells’ life, they should be charged and used. Charged cells should not be stored for long periods (even three days). To keep the cells in good condition, they must be discharged—once a month—by shorting them with the parallel combination of two 4.7-ohm, 10W resistors. This should be done periodically to erase the memoryeffect of Ni-Cd cells. You can buy a plastic box from any plastic shop to use it as a cabinet. It is better to make a battery pack rather than using cell holdres. To make one, solder and interconnect cells together to make the pack compact. Fold the cells on a thick paper and tape them. Take out two leads for positive and negative connections.

ELECTRONICS PROJECTS Vol. 20

PC-BASED DICE GAME V. RAJARAMAN

T

he dice has been used to determine one’s fortune from the earliest days of civilisation. It has been used by gamblers, fortune tellers and statisticians alike. Dice made of wood, silver, ivory, etc can be seen in many museums. A hi-tech die can be built around a computer using a handful of LEDs and an IC, as shown in the figure. Seven LEDs are arranged in the shape of the dots on a die. While a real die is a

cube having six faces, this electronic die has a single face, on which the dot pattern would change dynamically. These LEDs are activated using the parallel port of a PC. The interface circuit necessary for this is given in the figure. It comprises seven LEDs connected to buffer/ driver IC 74245 through current-limiting resistors. The buffer helps to protect the computer circuitry in case something goes wrong with this circuit. Whenever a homemade gadget is connected to the PC, it is

a good idea to use a buffer to prevent accidental damage to the PC. Arrange the seven LEDs on a veroboard, or other suitable mounting plate exactly as per pattern shown in the figure. Connect the circuit to parallel port designated LPT1 on the computer. If port LPT2 is to be used, a minor modification is necessary in the software. Just change the 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 interface. Switch on 5V power supply and run the test program. Every time you press a key, LEDs 1 through 7 light up one by one, in the same order. This order is important—otherwise the circuit will work but the dot pattern on the die will not be consistent. Recheck the connections if these appear out of order. Now we are ready to test our fortune. Run the program DICE.C and press any key. With every key-stroke your die will appear to roll. Finally, when it settles down, it displays a random digit, between one and six. Press ESC to terminate the program. The program makes use of the random () function of the compiler to generate the pseudo random number. The computer, using some fixed algorithm, generates this number. In this sense it is not strictly ‘random,’ since a true random number is completely unpredictable, and cannot be generated by any mathematical formula! That is why it is called a pseudo random number. But do not worry, this level of randomness is sufficient for all day-to-day needs. To make it even more random, we have used the randomise () function. This takes a clue from the real-time clock of the computer to initialise or ‘seed’ the random number generator. So we are assured that each time the program is started, we get a different sequence of digits. Note how the bit pattern necessary to light the different combinations of LEDs

is taken from a look-up table. This acts as the translator between random number generator and display. If necessary, similar display unit can be connected to the second parallel port of the computer to simulate throwing of two dice simultaneously. The modification necessary to the program is quite simple, and is left as an exercise for the reader. Good luck! /* TEST.C */ #include #include #include #include #define PORT 0X378 main () { int i; for (i=1; i < 0X7F; i *=2) { printf (“Press any key…\n”)’ outportb (PORT, ~i); getch (); } outportb (PORT, 0XFF); } /* DICE.C */ #include #include #include #include #define PORT 0X378 #define ESC 0X1B int 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); } } /*———————————————————*/ ELECTRONICS PROJECTS Vol. 20

167

TELEREMOTE CONTROL R.G. KALE

H

ere is a teleremote circuit which enables switching ‘on’ and ‘off’ of appliances through telephone lines. It can be used to switch appliances from any distance, overcoming the limited range of infrared and radio remote controls. The circuit can be used to switch up to nine appliances (corresponding to the digits 1 through 9 of the telephone key-pad). The DTMF signals on telephone instrument are used as control signals. The digit ‘0’ in DTMF mode is used to toggle between the appliance mode and normal telephone operation mode. Thus the telephone can be used to switch on or switch off the appliances also while being used for normal conversation. The circuit uses IC KT3170 (DTMF-to-BCD converter), 74154 (4-to-16-line demult-iplexer), and five CD4013 (D flip-flop) ICs. The working of the circuit is as follows. Once a call is established (after hearing ring-back tone), dial ‘0’ in DTMF mode. IC1 decodes this as ‘1010,’ which is further demultiplexed by IC2 as output O10 (at pin 11) of IC2 (74154). The active low output of IC2, after inversion by an inverter gate of IC3 (CD4049), becomes logic 1. This is used to toggle flip-flop-1 (F/F-1) and relay RL1 is energised. Relay RL1 has two changeover contacts, RL1(a) and RL1(b). The energised RL1(a) contacts provide a 220-ohm loop across the telephone line while RL1(b) contacts inject a 10kHz tone on the line, which indicates to the caller that appliance mode has been selected. The 220ohm loop on telephone line disconnects the ringer from the telephone line in the exchange. The line is

168

ELECTRONICS PROJECTS Vol. 20

now connected for appliance mode of operation. If digit ‘0’ is not dialed (in DTMF) after establishing the call, the ring continues and the telephone can be used for normal conversation. After selection of the appliance mode of operation, if digit ‘1’ is dialed, it is decoded by IC1 and its output is ‘0001’. This BCD code is then demultiplexed by 4-to-16-line demultiplexer IC2 whose corresponding

output, after inversion by a CD4049 inverter gate, goes to logic 1 state. This pulse toggles the corresponding flip-flop to alternate state. The flip-flop output is used to drive a relay (RL2) which can switch on or switch off the appliance 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 10kHz tone needs to be removed from the telephone line. To achieve this, digit ‘0’ (in DTMF mode) is dialed again to toggle flipflop-1 to de-energise relay RL1, which terminates the loop on line and the 10kHz tone is also disconnected. The telephone line is thus again set free to receive normal calls. This circuit is to be connected in parallel to the telephone instrument.

Readers Comments: ❏ 1. Can we get some confirmation that the state of the appliance has really toggled? 2. Can we include some electronic security system (such as code lock), so that only the owner can use this facility? 3. Instead of the 10 kHz oscillator used for return tone, can the three-pin melodious IC UM66 be used? 4. In the circuit both TTL and CMOS ICs have been used. As TTL counterparts

for inverters and flip-flops are easily available, I suggest their use. 5. Instead of using separate driving stages for the relays, I suggest the use of cheaply available relay driving IC ULN 2003. K.P. Deshmukh Solapur The author R. G. Kale replies: 1. Relays with two changeovers may be used for getting a confirmation about the state of the appliance. One changeover contact may be used for the appliance and

the other may be used to send a beep tone on the line when the appliance turns on. 2. Readers are welcome to make their own modifications to the circuit—like including code lock. 3. IC UM66 may be used in place of the 10kHz oscillator. 4 & 5. I agree with the suggestions put forward by the reader. Keep the circuit disconnected while making outgoing calls to prevent unwanted switching of the devices.

DISPLAY DIALED TELEPHONE NUMBER USING CALCULATOR SMIT KAPILA

S

ometimes, while dialing a number on the telephone, we may press a wrong key, but by using a simple calculator’s display we can check whether the dialed number is correct or not. This can be done as follows. Disconnect the ribbon cable of the key-pad from rest of the telephone circuitry and insert a series resistance of 27 kiloohm in all ten (nine in some key-pads) wires Fig. 1

of the ribbon cable. Thereafter, connect it back to the telephone circuitry as shown in Fig. 1. The resistors are used to buffer

the telephone circuitry so that it does not affect the working of the calculator—since

Fig. 2

ELECTRONICS PROJECTS Vol. 20

169

telephone is a high voltage device while calculator is a very sensitive device operating with low voltage. Now, take two leads directly from each of the contacts of the keys numbered ‘0’ through ‘9’ of the telephone key-pad PCB and join them to corresponding keys of the calculator.

Two such connections joining keys labeled ‘0’ and ‘1’ on telephone set and calculator are shown in Fig. 2. Other connections may also be made in a similar way for keys ‘2’ through ‘9.’ The advantage of this circuit is that it needs only 9 or 10 resistances and

connecting leads; no other circuit components are required. Care should be taken that leads are not shorted together. After the above-mentioned modification, you will observe that the dialed number gets displayed on the calculator screen.

8253 PROGRAMMABLE INTERVAL TIMER JUNOMON ABRAHAM

T

he circuit presented here is based on the commercially available programmable interval timer/

counter IC 8253. IC 8253 was primarily designed for use as an MCS-80 peripheral, but is now used in conjunction with

TABLE I A1 0 0 1 1

System Addresses A0 Selects 0 Counter 0 1 Counter 1 0 Counter 2 1 Control Word Register

TABLE II(A)

TABLE II(C)

SC-Select Counter (bits D6 and D7) SC1 SC0 Description 0 0 Select Counter 0 0 1 Select Counter 1 1 0 Select Counter 2 1 1 Read Back Command

M-mode bits (D1, D2, and D3) M2 M1 M0 Description 0 0 0 Mode 0: Interrupt on terminal count 0 0 1 Mode 1: Hardware one shot X 1 0 Mode 2: Pulse generator X 1 1 Mode 3: Square wave generator 1 0 0 Mode 4: Software triggered strobe 1 0 1 Mode 5: Hardware triggered strobe

TABLE II D7 SC1

170

D6 SCO

Control Word Byte D5 D4 D3 D2 RW1 RWO M2 M1

ELECTRONICS PROJECTS Vol. 20

It contains three independent 16-bit counters that can operate in any one of the six modes (refer Table II(C)). It can

D1 D0 MO BCD

almost all 8-bit microprocessors. Using this circuit we can study the operation of 8253 IC. A long-time interval timer can also be constructed using this IC.

TABLE III

TABLE II(D) BCD or Binary (bit D0) Value 0 1

Description Binary counter, 16 bits Binary coded decimal counter, 4 decades

operate with clock frequencies ranging from a few hertz to 2 MHz. To initialise the counter, the following sequential steps are necessary: 1. Write a control word into its control word register. The control word decides the selection of a specific counter (number 0 or 1 or 2), its mode of operation, loading sequence of the count, and selection of binary or BCD counting mode. 2. Load the lower order byte of the count word in the counter register. 3. Load the higher order byte of the count word in the counter register. The abovementioned functions are realised in the following manner: 1. Select the control word register using switches S2 and S3 (both ‘on’) because the address of control word register is 11 binary (i.e. A0 = 1, A1 = 1) as given in Table I. 2. Form control word byte of Table II

C4 10µ 1µ 100n 10n 1n

R15 18k 18k 18k 18k 18k

Clock frequency 2.5 Hz 25 Hz 250 Hz 2.5 kHz 25 kHz

using switches S4 to S11. 3. Enter the control word into control word register by depressing S1 momentarily. 4. Select counter 1 using switch S3 (‘on’) . Note that address of counter 1 is 01 binary as per Table II(A). 5. Select lower order byte of count word using switches S4 through S11. 6. Enter the lower order byte of count word into counter 1 by depressing S1 momentarily. 7. Select the higher order byte of count word using switches S4 to S11. 8. Enter the higher order byte of count word into counter 1 by depressing S1. Out of six possible modes of operation, as shown in Table II(C), only four modes 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 count the counter output goes high. Mode 2 (Rate generator). Control word: 74H When a count is loaded, the output stays high until the count reaches ‘1’ and then goes low for one clock period. Mode 3 (Square wave generator). Control word: 76H In this mode input frequency is divided by the count word that is loaded in the 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 the end of the count. Please note that if we want to enter a number into the counter register, that number is first converted to binary format and then loaded into the counter register. Timer 555 is used here in monostable mode for generating write signal. The value of capacitor C5 to be used with timing resistor R15 (18 kilo-ohm) for realising different clock frequencies is given in Table III. The circuit can be easily assembled on a general-purpose PCB.

LOW-COST TRANSISTORISED INTERCOM PRADEEP G.

S

everal intercom circuits have appeared in EFY using integrated circuits. The circuit described here uses three easily available transistors only. Even a beginner can easily assemble it on a piece of veroboard. The circuit comprises a 3-stage resistor-capacitor coupled amplifier. When ring button S2 is pressed, the amplifier circuit formed around transistors T1 and T2 gets converted into an asymmetrical astable multivib-rator generating ring signals. These ring signals are amplified by

transistor T3 to drive the speaker of earpiece. Current consumption of this intercom

is 10 to 15 mA only. Thus a 9-volt PP3 battery would have a long life, when used in this circuit. ELECTRONICS PROJECTS Vol. 20

171

For making a two-way intercom, two identical units, as shown in figure, are required to be used. Output of one amplifier unit goes to speaker of the other unit, and vice versa. For single-battery operation, join corresponding

supply and ground terminals of both the units together. The complete circuit, along with microphone and earpiece etc, can be housed inside the plastic body of a toy cellphone, which is easily available in the market. Suggested cellphone cabinet, with the position of switches, speakers and mike etc is shown.

AUTOMATICALLY CONTROLLED STREET LIGHTS YOGESH PRASAD

T

he circuit given here can be used for automatically switching ‘on’ and switching ‘off’ the streetlights at appropriate time. The circuit uses a light-dependent photo-resistor (LDR) as the sensor whose resistance changes in accordance with the surrounding light’s intensity. The circuit is so adjusted that when it turns dark, the relay is energised and the lights are switched on, and during daylight they go off automatically. The LDR used should have a ‘dark’ resistance of about 15 mega-ohms, which may drop to around 15 kilo-ohms in bright daylight. The LDR is used in conjunction with a comparator (IC LM311). When it gets dark, the voltage across the LDR increases and thus voltage VA>VT (refer circuit), and so the output of the comparator goes high. This in turn for-

172

ELECTRONICS PROJECTS Vol. 20

6

*

* *

ward biases relay driver transistor SL100 and the relay gets energised. As a result the lights are switched on. When there is bright daylight, the VDR resistance drops and VA
shown in Fig. 2, isolation transformer X2, fed by a 555 astable multivibrator, is used to generate isolated DC supply across secondary of transformer X2. The presets VR1 and VR2 are used for calibration. Diode D6 is used to protect the transistor from inductive kick, while diode D5 (Fig. 2) is used as rectifier. After the circuit is assembled, it is required to be calibrated as follows: 1. Adjust the voltage at point VT to about 11.50V by adjusting preset VR1. 2. Now keep the LDR at the dark-

ness level at which you want to switch on the lights. If initially the relay is energised and lights are on, adjust preset VR2 such that they go off. Now trim preset VR2 such that the lights just come on at the same preset level. After the system has been calibrated, the circuit should be so placed that the light from the sources controlled by the circuit do not interfere with the LDR operation. The LDR should be so placed that it is surrounded by the natural light sources.

TIMER FOR STUDENTS K.K. MURTY

T

hese are the days of competitive examinations. Nowadays, students are required to answer a set of objective type of questions in a given time which may extend to 15 minutes, 30 minutes, or one hour. Speed and accuracy win the race. Practice helps in achieving it. Here is a timer that gives an alarm after a preset time of 30 minutes. It also gives out a few beeps at half the selected time period. The timer could be programmed for other periods as well. The

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 a 14-stage divider, wherein the basic oscillator frequency is divided by 16,384. Here the oscillator frequency may be set using potmeter VR1 (in series with resistor R1) and capacitor C1. Potmeter VR1 is adjusted for a time period of 15 minutes at output Q12 (pin 2). The output Q13 (pin 3) will go ‘high’ after 30 minutes. Use a multiturn potmeter for better accuracy. When Q13 goes high, the 3-terminal

piezo-buzzer becomes active and gives out a tone. This buzzer also beeps for a few seconds at half the set time. Transistor T1 prevents further oscillations after the elapsed time. Red LED1 is used as activity indicator. For simplicity, 6-volt supply is chosen for operation of the circuit. To obtain 6V supply one may either use five Ni-Cd cells or four dry cells. A charger circuit is not included here as a host of charger circuits have appeared in EFY on and off. However, you may use a standard bridge

Y1

Y2 Y3

ELECTRONICS PROJECTS Vol. 20

173

rectifier with 7806 as regulator for the power supply and charger. Pressing the reset button momentarily pulls all the internal counters of CD4060 to zero and the timer starts again. The timer is reliable, accurate, and consumes about 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 continuous and intermittent modes, and also with musical notes. However, if you require louder sound, say for a classroom,

then you have an optional 555 circuit wired up as an astable multivibrator. This can be brought into operation by shorting points x-x in the circuit. But then the piezo buzzer needs to be disconnected from the circuit at the points marked Y1, Y2 and Y3.

PROTECTING THREE-PHASE INDUCTION MOTORS ANKUR BAL

D

amage to induction motor is mostly caused by unchecked operation during single-phase failure. In case of a single-phase blackout, the motor continues to run on the remaining two phases, endangering the windings. The given arrangement of three relays, as shown in the figure, disconnects the remaining two phases in the event of a single-phase failure, thus stopping and protecting the motor. One of the three phases may still remain connected to the motor, but that is not much cause for concern because of the absence of a rotating magnetic field in the motor. Three 230-volt relays with single changeover contacts are used in this ar-

rangement. For the purpose of explanation, let us assume that blue (B) phase is missing. Since none of the three relays can energise, none of the phase outputs is available. Now, if yellow (Y) phase is missing, relay RL3 will not energise, and thus yellow and blue phase output will not be available. Similarly, if red (R) phase is missing, relay RL2 will not energise, and thus red and yellow phase outputs will not be available. The motor resumes normal operation automatically as soon as all the three phases are restored. 230-volt AC relays, with appropriate contact ratings, should be selected (depending on motor ratings).

RADIO REMOTE CONTROL PRADEEP G.

T

his Electronic Project volume contains a circuit idea “Wireless Musical Calling Bell” which is uses VG40T and VG40R VHF remote control modules. After its publication many readers wanted to develop remote control switches to control mains load using these compact, sealed VHF remote control modules. A few designs for remote control switches, using VG40T and VG40R remote control pair, are shown here. The miniature transmitter module

174

ELECTRONICS PROJECTS Vol. 20

Fig. 1

shown in Fig. 1, which just measures 34 mm x 29 mm x 10 mm, can be used to operate all remote control receiver-cumswitch combinations described in this project. A compact 9-volt PP3 battery can be used with the transmit-

ter. It can transmit signals up to 15 metres without any aerial. The operating frequency of the transmitter is around 300 MHz. The following circuits, using VG40R 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 period, (c) switch on and switch off a load. To activate a relay momentarily (see Fig. 2), the switch on the transmitter unit

Fig. 2

is pressed, and correspondingly a positive voltage is obtained at output pin of VG40R module. This voltage is used to biasing the relay driver transistor. The relay gets activated by just pressing push-to-on micro switch on the transmitter unit. The relay remains energised as long as the switch remains pressed. When the switch is released, the relay gets deactivated. Any electrical/ electronic load can be connected via N/O contacts of the relay. To activate a relay for a preset period (refer Fig. 3), the switch on the transmitter unit is pressed Fig. 4 momentarily. The transistor gets base bias from VG40R module. As a result the transistor conducts and applies a trigger pulse to IC 555, which is wired as a monostable multivibrator. The relay remains activated for the preset time is determined by the pulse width of the monostable multivibrator. Time delay can be varied from a few seconds to a few minutes by adjusting timing components. To switch on and switch off a load (refer Fig. 4), a 555 IC and a decade coun-

Fig. 3

ter 4017 IC are used. Here the 4017 IC is wired as a flip-flop for toggle action. This is achieved by connecting Q2 output to reset terminal while Q1 output is unused. Q0 output of IC2 is used for energising the relay. The relay is activated and deactivated by pressing the transmitter switch alternately. So, to activate the load, just press the transmitter switch once, momentarily. The relay will remain activated.

To switch off the relay, press the transmitter switch again. This process can be repeated. Time delay of monostable multivibrator is set for about one second. Note: Short length of shielded wire should be used between VG40R receiver module output and the rest of the circuit. The transmitter with 9V battery must be housed inside a nonmetallic (say, plastic) cabinet for maximum range of operation.

SEQUENTIAL CARD SCANNER GIRISH JADHAV

T

his circuit of a sequential card scanner can be used for any type of control application. The card, when inserted into its slot, will get aligned in such a fashion that light from the scanning 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 from the scanner can be used for control applications. The circuit consists of five NE555 timer

IC chips, a CD4017B CMOS decade counter, a CD4043B SR latch, and a few other discrete components. The timer IC1 configured as an astable flip-flop, generates the clock for the CD4017B. An LED is connected at the timer output (pin 3) for ELECTRONICS PROJECTS Vol. 20

175

monitoring the activity. These clock pulses are fed to clock pin 14 of the divide-by-10 Johnson counter CD4017. For the first clock pulse, Q0 output will be high, and for the second clock pulse, Q1 output will be high, and so on. Outputs Q0 through Q3 of CD4017B are used as control signals for quad bilateral switches inside CD4066 (IC3) while Q4 output is used for indication purpose as follows: • When LED6 is ON: It indicates that the scanning is complete. • When LED6 is OFF: It indicates that the scanning process is not completed. To understand the operation of the circuit, assume that the card is in the card slot. Now press the reset button for about a second. During reset all the monostable flip-flops (IC4 through IC7) remain in triggered state and their outputs are high. The outputs of inverters N1 through N4 connected to set pins of CD4043 are at logic 0 while reset pins (3, 7, 11 and 15) are connected to Vcc via a reset switch. As a result, all outputs (A, B, C and D) of CD4043 are 0000 on reset. (Please refer to the truth table of CD4043 in this connection.) On releasing the reset button, further operation takes place as follows: During the first clock pulse, Q0 will be logic high, and this output, when applied as a control signal to E0 pin of the bilateral switch, causes Vcc (6 to 9V DC) to be switched from Y0 to Z0. This will cause LED1 to be lighted. Now, supposing that no cut in the card exists at that position, the LDR resistance will be high and monostable flip-flop IC4 will func-

176

ELECTRONICS PROJECTS Vol. 20

Function Table of CD4043 Inputs Eo Sn Rn L X X H L H H H X H L L Z=high impedence state X=state immaterial L=low level H=high level

tion in retriggerable mode. Its output at pin 3 will remain high or the output of inverter gate N1 will remain low. With reset pins (3, 7, 11 and 15) of all latches of CD4043 are pulled low via 10-kilo-

Output On Z L H Latched

ohm resistor R13; a low level at set pin does not change the output, and thus A output remains low. On the other hand, if there was a hole/cut in the card between LED1 and LDR1, the LDR1 resis-

tance would drop during the pulse through LED1, causing output of IC4 to remain low or that of inverter gate N1 to be high during the pulse period. This would cause output A to remain latched in high state. During second clock pulse, Q1 will be logic high and this output, when applied as a control signal to E1 pin of the bilateral switch, will cause Vcc (6 to 9V DC) to be switched from Y1 to Z1. This will light up LED2. If there is a cut/hole in the card be-

tween LED2 and LDR2, output B will latch to high state, else it will remain low. Similar operation will take place at the third and fourth clock pulses, and the outputs A, B, C and D will correspond to the hole/no-hole state at LED/ LDR position of the card. At fifth clock, IC2 alone is reset, and the above operation keeps repeating without affecting the output as long as card remains in the slot. Potentiometers VR1 through VR4 are used to set proper triggering level at pin 2 of monostables IC4 through IC7.

DIVIDE-BY-N COUNTER USING IC 7442 PRAMOD KUMAR

T

he combination of ICs 7490 and 7447 is normally used as decade counter cum seven-segment decoder/LED display driver. It advances from ‘0’ to ‘9’ after each clock pulse and the count can be displayed on a 7-segment commonanode LED display such as LT542. The count/display repeats itself after every tenth pulse. On several occasions, one needs to reset the counter after n counts. This cannot be accomplished by the above-mentioned pair of ICs 7490 and 7447 alone. A method for tackling the problem with the help of rotary switch S1 and an additional IC 7442 is shown in the circuit. With

this circuit we can realise a divide-by-n counter. Selected output of IC 7442 is used to reset decade counter 7490. In the circuit diagram, timer IC 555 is used in astable mode. Output of this IC is used as clock for IC 7490. The output of IC 7490 is connected to IC 7447 and IC 7442 in the usual manner. Output of 7447 IC is used to drive commonanode LED display LT542. Rotary switch S1 selects one of the ten outputs of IC4 (after inversion by IC5 or IC6 inverter gates). Pole of switch S1 is wired to pins 2 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 of rotary switch should be kept on output Q4 of IC4. The display would advance from 0 to 3. On next clock pulse the Q4 output of IC4 would go high after inversion by IC5 (7404) and reset counter IC 7490 to zero. As a result the display would not be able to show the number 4 for a perceptible period. Hence the maximum number displayed appears to be one less than the selected division factor. Similarly, when we select division-by-2, the counter will show 0 and 1 repetitively.

ELECTRONICS PROJECTS Vol. 20

177

DTMF REMOTE SWITCHING BOARD DHURJATI SINHA

T

he DTMF (dual tone multifrequency) tone generator chip UM95089 generally used in telephony for tone dialing (used here as part of remote IR Fig. 1: Block diagram of DTMF remote switching board transmitter) and DTMF tone decoder (tone to 4-bit binary output) chip CM8870 (used in remote switching board) are at the heart of this circuit. The tone generator chip UM 95089 (IC1) has the capability to generate 16 different pairs of tones with the help of 3.5795MHz quartz crystal, XTL1. A key matrix type switching system has been provided, for selecting a particular frequency pair. The coresponding output available at pin 16 of the IC1. This signal is amplified and used for modulating infrared light with the help of transistor T1 and IR LED1. The infrared signal is detected by the infrared sensor, converted into electrical Fig. 2: IR transmitter

Fig. 3: IR remote switching board

178

ELECTRONICS PROJECTS Vol. 20

signals, and internally amplified in the IR receiver module. This amplified signal is then fed into pin 2 of the DTMF receiver chip CM 8870 (IC2) and the 4-bit binary outputs B0, B1, B2, and B3 are available at pins 11 through 14. The binary signal is further processed by the 4- to 16-line decoder chip IC3 (CD4514B), and one of the pins (Q0 through Q15) goes high for a

specific frequency pair, for the duration, the incoming signal is present. Now these 16 outputs are grouped into eight pairs to control two quad S-R latches inside IC4 and IC5 (CD4043B). The outputs of the latches are used to control the eight relays (RL1 through RL8) via the relay driver transistors, which finally drive the AC loads. Q0 and

all even outputs of IC3 are used to set (switch on), and all odd outputs are used to reset (switch off) the latches and the corresponding relays. One can easily convert this IR-based system to FM-based system by using tone output from IC1 for modulating an FM transmitter, and in Fig. 2, IR receiver module can be replaced by an FM receiver.

Readers Comments: ❑ Please clarify my doubts: 1. Is IC TCM5089 equivalent to IC UM95089 (IC1)? 2. In the transmitter circuit, should any row and column be shorted momentarily, or both be grounded momentarily? How can the working of the transmitter be tested? 3. Can any IR sensor used in TV circuits be substituted in this circuit? 4. The output voltage of the IR sensor is continuously fluctuating between 5.25V and 4.70V. Why? 5. Why are the relays connected to the emitters of transmitters? Can these be connected to the collectors? 6. How can the proper working of the receiver be tested? Nitin S. Dighe Mumbai

are equivalent. 2. Only rows and columns are to be connected. To test the circuit, connect output pin 16 of IC1 through a capacitor to a headphone or an audio amplifier line-in terminal. Press one combination at a time. If DTMF tones are heard, the circuit is working correctly. 3. Any ordinary IR sensor used in TV can be used. To check the working of the sensor, connect an LED temporarily between output and +5V. When transmitter switches are pressed, glowing of the LED indicates the proper working of the sensor. 4. Fluctuation of voltage at various pins is possibly due to stray electric field. As CMOS chips have been used, please shield the circuit. 5. Relays may be connected to the collectors of transistors, as shown in Fig. 1. 6. If IR detection is taking place correctly, connect four LEDs through 560-

ohm resistors at the output of IC2 and press sixteen different rowcolumn combinations of the transmitter circuit, one by one. The output status should change from 0000 to 1111. Next, remove these LEDs and connect sixteen LEDs through 560-ohm resistors at the output of IC3. Press the sixteen com-

The author, Dhurjati Sinha, replies: 1. I am not aware whether both the ICs

Fig. 1: Connection of relays

binations again. All the LEDs should glow one by one. Do not solder these ICs directly; use IC bases.

ELECTRICAL EQUIPMENT CONTROL USING PC P.V. VINOD KUMAR

H

ere is a novel idea for using the printer port of a PC, for control application using software and some interface hardware. The interface circuit along with the given software can be used with the printer port of any PC for controlling up to eight equipment. The interface circuit shown in the figure is drawn

for only one device, being controlled by D0 bit at pin 2 of the 25-pin parallel port. Identical circuits for the remaining data ELECTRONICS PROJECTS Vol. 20

179

bits D1 through D7 (available at pins 3 through 9) have to be similarly wired. The use of opto-coupler ensures complete isolation of the PC from the relay driver circuitry. 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 and left arrow keys. Switching on/off of bits D0-D7 is done by bringing the bar over the appropriate square and then pressing

the ‘Q’ key for ON and ‘W’ key for OFF operation. The monitor will show the status of the relevant switch by indicating ‘1’ for ON and ‘0’ for OFF status of the switch. In addition, the current date and time is also displayed on the screen.

Program Listing in Basic CLS : SCREEN 2 KEY(1) ON: ON KEY(1) GOSUB FINIS KEY(5) ON: ON KEY(5) GOSUB RETIRE KEY(10) ON: ON KEY(10) GOSUB ALLON PORT% = &H378 OUT PORT%, 0 LOCATE 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, B LINE (40, 40)-(600, 180), 1, B LINE (40, 100)-(600, 120), 1, BF LINE (140, 40)-(460, 110), 1, B LOCATE 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 - 12 U$ = 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); KK X$ = INKEY$ X$ = RIGHT$(X$, 1) N = INP(PORT%) IF X$ = “K” THEN J = J - 40 IF X$ = “M” THEN J = J + 40 PSET (J + 105, 85): DRAW “R20U10L20D10R2U10R2D10R2U10R2 D10R2U10R2D10R2U10R2D10R2U10R2D10” FOR T = 1 TO 400: NEXT PRESET (J + 105, 85): DRAW “R20U10L20D10R2U10R2D10R2U10R2 D10R2U10R2D10R2U10R2D10R2U10R2D10” IF J + 105 < 105 THEN J = 0 IF J >= 360 THEN J = 360 IF (J = 40) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB APPLE IF (J = 40) AND (X$ = “W” OR X$ = “w”) THEN GOSUB APPLEOF IF (J = 80) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB BAT IF (J = 80) AND (X$ = “W” OR X$ = “w”) THEN GOSUB BATOF IF (J = 120) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB TALE IF (J = 120) AND (X$ = “W” OR X$ = “w”) THEN GOSUB TALEOF IF (J = 160) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB FLAT IF (J = 160) AND (X$ = “W” OR X$ = “w”) THEN GOSUB FLATOF IF (J = 200) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB FAT

180

ELECTRONICS PROJECTS Vol. 20

IF (J = 200) AND (X$ = “W” OR X$ = “w”) THEN GOSUB FATOF IF (J = 240) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB SILK IF (J = 240) AND (X$ = “W” OR X$ = “w”) THEN GOSUB SILKOF IF (J = 280) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB SEVEN IF (J = 280) AND (X$ = “W” OR X$ = “w”) THEN GOSUB SEVENOF IF (J = 320) AND (X$ = “Q” OR X$ = “q”) THEN GOSUB LAST IF (J = 320) AND (X$ = “W” OR X$ = “w”) THEN GOSUB LASTOF GOTO STAT ‘————ALL THE SUBROUTINES ARE BELOW——— APPLE: SOUND 500, 2 AA = 1 LOCATE 6, 50 Q = 1 OR N OUT PORT%, Q RETURN BAT: SOUND 500, 2 SS = 1 W = 2 OR N OUT PORT%, W RETURN TALE: SOUND 500, 2 DD = 1 Q = 4 OR N OUT PORT%, Q RETURN FLAT: SOUND 500, 2 FF = 1 Q = 8 OR N OUT PORT%, Q RETURN FAT: SOUND 500, 2 GG = 1 Q = 16 OR N OUT PORT%, Q RETURN SILK: SOUND 500, 2 HH = 1 Q = 32 OR N OUT PORT%, Q RETURN SEVEN: SOUND 500, 2 JJ = 1 Q = 64 OR N OUT PORT%, Q RETURN LAST: SOUND 500, 2 KK = 1 Q = 128 OR N OUT PORT%, Q RETURN TALEOF: SOUND 400, 1 IF DD = 0 THEN RETURN DD = 0 IF N = 4 THEN P = 0 IF N < 4 THEN P = N IF N > 4 THEN P = N - 4 OUT PORT%, P RETURN APPLEOF: SOUND 400, 1 IF AA = 0 THEN RETURN AA = 0 IF N = 1 THEN I = 0 IF N > 1 THEN I = N - 1 OUT PORT%, I RETURN BATOF: SOUND 400, 1

IF SS = 0 THEN RETURN SS = 0 IF N = 2 THEN U = 0 IF N > 2 THEN U = N - 2 IF N < 2 THEN U = N OUT PORT%, U RETURN FLATOF: SOUND 400, 1 IF FF = 0 THEN RETURN FF = 0 IF N = 8 THEN E = 0 IF N < 8 THEN E = N IF N > 8 THEN E = N - 8 OUT PORT%, E RETURN FATOF: SOUND 400, 1 IF GG = 0 THEN RETURN GG = 0 IF N = 16 THEN Y = 0 IF N < 16 THEN Y = N IF N > 16 THEN Y = N - 16 OUT PORT%, Y RETURN SILKOF: SOUND 400, 1 IF HH = 0 THEN RETURN HH = 0 IF N = 32 THEN Y = 0 IF N < 32 THEN Y = N IF N > 32 THEN Y = N - 32

OUT PORT%, Y RETURN SEVENOF: SOUND 400, 1 IF JJ = 0 THEN RETURN JJ = 0 IF N = 64 THEN U = 0 IF N < 64 THEN U = N IF N > 64 THEN U = N - 64 OUT PORT%, U RETURN LASTOF: SOUND 400, 1 IF KK = 0 THEN RETURN KK = 0 IF N = 128 THEN Z = 0 IF N < 128 THEN Z = N IF N > 128 THEN Z = N - 128 OUT PORT%, Z RETURN ALLON: SOUND 500, 4 OUT PORT%, 255 AA = 1: SS = 1: DD = 1: FF = 1: GG = 1: HH = 1: JJ = 1: KK = 1 RETURN FINIS: SOUND 400, 2 OUT PORT%, 0 AA = 0: SS = 0: DD = 0: FF = 0: GG = 0: HH = 0: JJ = 0: KK = 0 RETURN RETIRE: OUT PORT%, 0 END

LONG-RANGE FM TRANSMITTER PRADEEP G.

S

everal circuits for constructing FM transmitters have been published in EFY. The power output of most of these circuits were very low because no power amplifier stages were incorporated. The transmitter circuit described here has an extra RF power amplifier stage, after the oscillator stage, to raise the power output to 200-250 milliwatts. With a good matching 50-ohm ground—plane antenna or multi-element Yagi antenna, this transmitter can provide reasonably good signal strength up to a distance of about 2 kilometres. The circuit built around transistor T1 (BF494) is a basic low-power variable-frequency VHF oscillator. A varicap diode circuit is included to change the frequency of the transmitter and to provide frequency modulation by audio signals. The output of the oscillator is about 50 milliwatts. Transistor T2 (2N3866) forms a VHF-class A power amplifier. It boosts the oscillator signals’ power four to five times. Thus, 200-250 milliwatts of power is generated at the collector of transistor T2.

For better results, assemble the circuit on a good-quality glass epoxy board and house the transmitter inside an aluminium case. Shield the oscillator stage using 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 used for the above coils) L3 – 7 turns of 24 SWG wire close wound with 3mm diameter air core. L4 – 7 turns of 24 SWG wire-wound on a ferrite bead (as choke) Potentiometer VR1 is used to set the centre frequency whereas potentiometer VR2 is used for power control. For humfree operation, operate the transmitter on

ELECTRONICS PROJECTS Vol. 20

181

a 12V rechargeable battery pack of 10 x 1.2-volt Ni-Cd cells. Transistor T2 must be mounted on a heat sink. Do not switch on the transmitter without a matching

antenna. Adjust both trimmers (VC1 and VC2) for maximum transmission power. Adjust potentiometer VR1 to set the centre frequency near 100 MHz.

This transmitter should only be used for educational purposes. Regular transmission using such a transmitter without a licence is illegal in India.

Readers Comments: ❑ Without licence, what is the maximum power of FM transmission permissible in India? What are the changes required if the range is to be limited to the permissible power? Can preamplified signal be directly given by replacing the condenser mic? What are the modifications required for stereo transmission? M.P. Murugesan Tuticorin ❑ I would like the author to clarify the following points: 1. Can a local Philips radio be used to receive the FM signals? 2. Is it possible to use an aerial in place of multi-element Yagi antenna, with a 50-ohm, half-watt resistor? 3. Can an RF amplifier (made using transistor BD139) be added to the circuit to increase the power output of the transmitter? Tinkku Bhagalpur ❑ I could not achieve a range of more than 200 metres. Please help me. Deepak Agrawal Raipur The author, Pradeep G. replies: In reply to Murugesan’s letter, I would like to say: This transmitter can be used for education purposes. Transmission in FM broadcast band is not allowed even

signals from the FM transmitter. My prototype was tested using Philips two-band AM/FM pocket radio. The range of the transmitter is 1.5 km with a 70cm telescopic antenna and 3 km with a three-element Yagi antenna. An RF power amplifier using transistor BD139 cannot be used in VHF range. It can be used in HF range only. For VHF amplification, readily available transisFig. 1: VHF amplifier using transistor 2N3553 in class C mode tor 2N3553 can be used in class C mode, as shown in here in Fig. for licensed hams. Allowed VHF trans1. The coil details are as follows: mission frequency is 144 MHz (not 88L1, L2 - 4 turns of 20 SWG wire, close 108 MHz). By adjusting the number of would on 4mm dia air-core turns in the oscillator coil, frequency of L2 - 4 turns of 20 SWG wire, loose transmitter can be increased to 144 MHz wound on 4mm dia air-core (i.e. 2-metre Ham band). To limit the L4 - 3½ turns of 20 SWG wire, close range below half kilometre, avoid ampliwound on 4mm dia air-core fier stage wired around transistor Regarding Mr Agrawal’s letter: 2N3866. Connect the aerial directly to colEFY: For FM band frequencies (near lector terminal of oscillator transistor 100 MHz), you could use a half-wave BF494. dipole with intrinsic impedance of 72 If audio signal from other sources are ohms or a 300-ohm folded dipole with to be fed to the transmitter, eliminate reflectors and directors (as used for TV microphone biasing resistor. This transreception) to achieve higher gain/range. mitter cannot be modified for stereo For directional design use horizontal dibroadcasting, which is much more compole/folded dipole, and for achieving omniplicated. directional characteristics use vertical diIn reply to Tinkku's letter, I would pole/folded dipole. The line of shoot (dilike to say: Any radio receiver covering rection of maximum radiation) is at right FM broadcast band can be used to receive angle to the dipole.

PIEZO BUZZER FINDS MANY APPLICATIONS A. JEYABAL

P

iezo buzzer is a low-cost, low power 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 selfoscillating handy sounder with a variety of sound modes (continuous, intermittent,

182

ELECTRONICS PROJECTS Vol. 20

etc). Many of us think that its application is limited to sophisticated instruments and domestic appliances. However, many lowcost useful devices can be constructed by simply adding a transistor to it. This extra transistor provides the third high-impedance control terminal (base of the

transistor). This transistor acts as an electronic switch. The piezo buzzer described here is of continuous type, and its construction would cost around Rs 20. When applying more than 12V, please confirm its maximum supply voltage rating, as some buzz-

ers have a maximum supply voltage rating of 15V. Table buzzer. Fig. 1 shows the simple buzzer circuit. Connect the buzzer to the battery via push-to-on switch S1. Use a proper battery box or a battery holder. Now it can be used as a simple table buzzer using 6V or 9V power supply, which is quite adequate. Morse code sender. When switch S1 in Fig. 1 is replaced with a Morse key, it immediately becomes a Morse code sender. Press the key and enjoy sending Morse code. Continuity checker. Connect transistor BC547 (T1) and a 68-kilo-ohm resistor (R1) as depicted in Fig. 2. Touch with the testing prods the points between which the continuity is to be checked. If there is a connection between these points, base current flows through resistor R1 and the said points. In turn, the transistor conducts and the current flows through the buzzer and activates it. Using this continuity tester we can also check milky lamps, tubelight filaments, chokes, coils, wires, and transformers for continuity. Continuity checker can also be used as ‘go/no-go’ resistor tester. Touch the terminals of the resistor with prods. If the resistor is open, no sound will be heard. The buzzer sounds for the good one. Resistors of up to 1 meg-ohm can be checked with this device. Diode/LED tester and lead identifier. Touch the prods on the leads of a diode or LED. Interchange the prods and test again. If the buzzer sounds during both the tests, the diode/LED is short. No sound implies the diode/LED is open. If it sounds only during one of the tests, it means the diode/LED is good. For a good diode/LED, the buzzer sounds when the red prod and the black prod are touched to the anode and the cathode of the diode/ LED respectively. Thus we can identify the leads as well. Transistor tester. For testing purposes, the transistor can be considered equivalent to two diodes connected back to back and the common junction is base (refer Fig. 3). Now check the transistor by touching the red and the black prods as per Table I. The table also lists the usability of the transistor from the observations made. Please note that power transistors cannot be checked in this fashion as they are leaky and give wrong results. Capacitor checker. Capacitors of values ranging from 0.01 µF to 100 µF can also be checked with this tester by

placing the prods across the capacitor. A beep sound of a small duration, for lowvalue capacitors, confirms that they are in good condition. Higher-value capacitors, which produce a long beep (gradually decreasing in sound level), are in a good condition. (For a 100µF capacitor, it takes about one minute for the sound to stop.) A non-stop sound means that the capacitor is short and no sound implies it is open. While checking electrolytic capacitors, touch the positive lead of the capacitor with the red prod and the nega-

Fig. 4: Game of steady hands

eter of the zig-zag rod. Connect the prods to the wires A and B. Now try to take out the ring through the zig-zag rod. If the ring touches the rod, the buzzer beeps and the contestant loses the chance and should start from the beginning. After taking out the ring, another contestant may try to put the ring in its initial position, i.e. from top to bottom. Use more than 3V power supply for higher sound output. Water-level monitor. It is a boon for Fig. 1: Simple buzzer circuit an absent-minded person who can now use this circuit to fill his bathtub without wasting water. The buzzer sounds when the tub is full and he can immediately close the tap. For this, connect two metal strips or metal spoons to the prods and hang them over the bathtub such that the tips of the spoons are at Fig. 2: Continuity checker, diode, LED, transistor, and capacitor the required water level (Fig. tester 5). When the water touches the spoons’ base, current flows through transistor T1 (Fig. 2) and the buzzer sounds. Use a 6V or a 9V power supply for (a) (b) rich sound. Fig. 3: Transistor testers Rain alarm. Etch the pattern shown in Fig. 6 on a tive lead with the black prod. For all tests piece of copper-clad board. The pattern is and checks do not use more than 3V not critical but any rain drops that fall power supply to avoid damage to the comanywhere on the board should join the ponents being tested. two tracks. Veroboard can also be used by Game of steady hand. This game properly connecting the appropriate tests one’s steadiness while taking out a tracks. Connect the two ends of the copring through a zig-zag rod without touchper tracks to the prods. Place the board ing the rod with the ring. in a slanting position outside the premises Take a rod of length 40 to 50 cm with where the rain drops can fall on it. When 3mm diameter and bend it in a zig-zag it rains, the rain drops connect the two shape as shown in Fig. 4 and fix it on a tracks to allow the base current to flow wooden block. Take another piece of simiinto transistor T1 and the alarm sounds. lar rod and bend it in the form of a ring at Use a 6V or a higher voltage power supone end. The inner diameter of the ring ply to get high sound levels. should be slightly bigger than the diamHeat sensor. The buzzer can be made ELECTRONICS PROJECTS Vol. 20

183

TABLE I Type of Transistor

Fig. 5: Water level monitor

N P N P N P

Fig. 6: Rain alarm

Fig. 7: Heat sensor

to sound when a preset temperature is reached. Connect a low-resistance thermistor (PTC) between the base and the emitter of transistor T1 with a pair of wires and a 1-kilo-ohm resistor (R2) and a 100-kilo-ohm potentiometer (VR1) to the base and the collector of transistor T1 (Fig. 7). Fix the thermistor on the body of the device or material whose temperature is to be sensed. When the required or maximum permissible temperature is reached, adjust potmeter VR1 (lower the resistance) until the buzzer sounds. The next time the buzzer would automatically sound at this particular temperature. In case the buzzer sounds even when potmeter VR1 is in the highest resistance position, fix a 22k resistor (RT) in parallel with the thermistor and adjust VR1 again. The correct value of RT can be found by

184

ELECTRONICS PROJECTS Vol. 20

Emitter Base

Black Red Black Red

Red Black Red Black Red Black Red Black

Collector

Black Red Black Red -

Observations Faulty Transistor

Good Transistor

No sound (base collector open) Sound (base collector short) No sound (base emitter open) Sound (base emitter short) Sound (base collector short) No sound (base collector open) Sound (base emitter short) No sound (base emitter open)

Sound No sound Sound No sound No sound Sound No sound Sound

trial and error. Light-interrupted alarm/smoke alarm. Any unauthorised entry can be brought to the notice of the user with this light-interrupted alarm shown in Fig. 8. Put LDR (light dependent resistor) R4 inside a plastic tube of 5 to 10cm length and connect the leads of the LDR to the base and the emitter of transistor T1. Fix the tube on one side of the entry and in the axis of the tube fix a 6V or a 12V bulb on the other side of the entry so that light falls on the LDR. Rotate VR1 to the high-resistance position. Obstruct the light falling on the LDR and adjust potentiometer VR1 until Fig. 8: Light interrupter alarm, smoke alarm the buzzer sounds. Now remove the obstruction. If the buzzer still sounds, connect a 10k resistor (RT) in parallel with the LDR and adjust potentiometer VR1 again after obstructing the light. The correct value of RT can be found by trial and error. When the light is obstructed, the LDR’s resistance increases. As the LDR is part of the potential divider, when its voltage-drop increases, it forward-biases Fig. 9: Schematic diagram of all-in-one circuit transistor T1 which begins to conduct and the buzzer sounds. cuit depicted in Fig. 9 and try all the Smoke alarm. Fix a bulb and an LDR alarms. When experimenting with the at the top of the room where the smoke alarms shown in Figs 7 and 8, plug in a may accumulate. When the smoke obshorted plug in SOC1. All the compostructs the light, the resistance of the LDR nents, including batteries (pen torch increases and the buzzer sounds. cells), can be put inside an audiocassette External control. The positive outbox. One can even use a smaller box. put from any device or gadget, suitably The transistor can be directly soldered reduced to 0.6V level, can be connected to the sockets SOC1 and SOC2. Using between the base and the emitter of tranthis device one can assemble many other sistor T1 (SOC 2 in Fig. 9) to sound the gadgets, such as a plant tender, fire alarm. alarm, dead man’s handle, power-on/ All-in-one circuit. A very enthusipower-off alarm, mail announcer, presastic hobbyist will like to do all these sure sensitive alarm, infrared alarm, experiments. He can assemble the cirheadlights on reminder, and many more.

Readers Comments: ❑ Fig. 8 has certain problems. The buzzer produces sound even after connecting 10k resistor (RT) in parallel to the LDR and adjusting potentiometer VR1.

A. Jacab Lalrinahhana Aizawl The author, A. Jeyabal replies: It seems the reader used a power supply of more than 6V. He should reduce the value of RT to 2k. The resistance of LDR

and the intensity of light should also be taken into account. The value of RT should be found by trial and error and VR1 adjusted. If the buzzer still sounds, the transistor must be shorting and hence needs to be replaced.

POWER SUPPLY CIRCUITS FOR HAMS N. S. HARISANKAR – VU3NSH

L

ots of power supply circuits have been printed by different magazines. Here is a simple homebrew, high-current power supply unit (PSU). The speciality of this PSU is very good performance despite the minimum use of components. The PSU delivers 12V output at 12A. At input a noise suppressor is added. The ready-made noise suppressors like ‘Schaffner’ NOFU1211, Switzerland, or equivalent are easily available in the market. Seriespass transistor T1 2N6320 or 2N 6321 is used for this circuit. (During testing at EFY lab, BD 249 transistor with current rating of 25A was substituted.) It is a high-current, high-voltage transistor with power dissipation rating of 300W. The components comprising 14V zener D2, resistors R2, R3, and SCR T2 (BT151 used at EFY during testing) form the crowbar protection circuit to short-circuit the input AC voltage and blow fuse F1 in case the output voltage crosses 14V DC level. Use a heat sink with adequate heat dissipation capability along with a cooling fan for transistor T1. However, a small heat sink is adequate for regulator IC 7812. The diode across the output is for reverse polarity protection. All components are available in the market. You may use a mains step-down transformer with 0-20V AC, 15A secondary rating for the circuit. The SCR should be of 18A, 200V type. Ferrite beads (FB) at base and output terminals avoid RF interference. Use a 16A, 200V PIV (peak inverse voltage rating) bridge rectifier, followed by a 15,000µF, 60V-rated capacitor for rectification and filtering. One can use this power supply circuit for high-current applications like HF and VHF mobile stations. If current require-

ment is more, say around 19-20A, then some minor changes are necessary in the current rating of transformer and bridge rectifier, etc. One can also substitute transistor T1 with two 2N3773 transistors (in parallel). Noise filter circuit to be used between the 230V AC mains and the transformer input is shown in Fig. 2. However, you may also use readymade ELCOM noise filter for the purpose. This PSU is easy to assemble, RF immune, and overvoltage/ reverse-polarity protected. General-purpose. This is a generalpurpose power supply for your shack, which can be used for QRP transceiver operation, testing of QRP RF amplifiers, and VFO or other general-purpose applications like 2m/70cm handheld rigs. There is no need for external components other than two capacitors and one diode. The

power supply gives 12V ± 0.25V DC at 1.5A max. The IC SI-3120CA is a 5-pin, hybrid dropper-type regulator with a maximum input voltage (VIN) of 35V and power dissipation (PD) of 18 watts. The IC has a number of internal protections, including overvoltage, overcurrent, and overheat protections. Specified VIN range is 13V to 30V. Its ripple rejection factor is 54dB. Further, there is no need for external protections like crowbar. Use of heat sink for the IC is recommended. You may use it with a mains stepdown transformer of 0-22V AC, 2A secondary rating. Diode 1N4007 is a reverse polarity protection diode. Discrete PSU For QRO (Fig. 3). This PSU design is meant for QRO transceivers (50W) and RF linear amplifiers, etc. IC LM396 is a high-current voltage

Fig. 1: Economical high current power supply unit

ELECTRONICS PROJECTS Vol. 20

185

Fig. 2: General-purpose power supply unit

This IC does not depend on external capacitors for frequency stabilisation. Internal structure of the IC combines high-power discrete transistor technology with modern monolithic linear IC processing. This combination yields a highperformance, singlechip regulator capable of supplying 10 amperes of current.

Fig. 3: Discrete power supply unit for QRO

regulator meant for providing an adjustable output votage of 1.25V to 15V at current up to 10A. Its power dissipation (PD) is 70W. For setting output voltage, only two external resistors are needed.

Maximum input voltage rating is 20V and ripple rejection is 74 dB. The output voltage is decided by resistors R1 and R2. Vout = 1.25 (R1+R2/R1)

Transistor T1 is used for current boosting. In this circuit the power dissipation (PD) of the IC is limited to 50W. So, we need an outboard transistor for current boosting. In this circuit the current boosting transistor used is TIP36C, and its PD is 90W. A current-sensing resistor (R5) of 0.15 ohm is used. When the current is less than 4A, the voltage across R5 is less than 0.6V and the transistor is in off state. The voltage regulation works as before. LM396 holds the output voltage constant and the load current passes through LM396. When the load current is greater than 4A, then the voltage across R5 is greater than 0.6V and the transistor turns on. The outboard transistor will supply extra load current of more than 4A. It is a beautiful circuit because the transistor current adjusts to the value of the excess load current. The current through LM396 is slightly more than 4A. The outboard transistor handles the rest of the current. Crowbar protection is added against high-voltage DC output. LED1 at VIN terminal is a normal voltage indicator. If it goes off, it means that VIN is very low. Capacitor between Adj. terminal of the regulator and the ground increases ripple rejection. Lab note: The protection diodes prevent the high-value capacitors, at the output stage of the regulator, from discharging via the low-current points into the regulator and damaging it.

CYCLIC ON AND OFF TIMER FOR COOLER PUMP PRATAP CHANDRA SAHU

M

any of us use cooler pumps during summer. An air-cooler unit, in addition to the fan motor, uses a 35- to 50-watt pump motor. The pump runs continuously and unnecessarily wastes power. The pump motor can, in fact, be switched off for some time once the pads are wet—save power and also prolong the life of the motor. The given circuit is a cyclic on-and-off timer which helps to achieve this objective. The circuit is simply an extended ver-

186

ELECTRONICS PROJECTS Vol. 20

sion of 555-based astable multivibrator with a long time-period. The length of ontime is a multiple of the period of 555 output and the number of used CD4017 outputs being connected together in wiredOR fashion, using diodes. The off-time period is a multiple of the period of 555 and the number of unused outputs of CD4017. The circuit thus increases the on and off time of the 555 waveform with the help of 4017 counter. The 4017 output being programmable, can be used to get different

duty-cycles of the overall on-off period, as desired. It is recommended to set the ontime for three-four minutes and the offtime for seven-eight minutes as it suits most coolers. When there is inadequate water in the tank, the pump is automatically switched off. This is achieved by pulling the reset and inhibit pins of 4017 to supply voltage. Taking these pins towards ground potential (while the tank water level is sufficient) through the water in-

side the tank, ensures that CD4017 is active. In the absence of water between sensor pins, the circuit is both inhibited and reset. Other uses of the circuit include on-and-off timer for the exhaust fan. It can also be used where asymmetric waveform of very long time-period is required for timer applications.

SELF-SWITCHING POWER SUPPLY ANAND S. TAMBOLI

O

ne of the main features of the regulated power supply circuit being presented is that though fixed-voltage regulator LM7805 is used in the circuit, its output voltage is variable. This is achieved by connecting a potentiometer between common terminal of regulator IC and ground. For every 100-ohm increment in the in-circuit value of 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 across diodes D1 and D2). Another important feature of the supply is that it switches itself off when no load is connected across its output terminals. This is achieved with the help of transistors T1 and T2, diodes D1 and D2, and capacitor C2. When a load is connected at the output, potential drop across diodes D1 and D2 (approximately 1.3V) is sufficient for transistors T2 and T1 to conduct. As a result, the relay gets energised and remains in that state as long as the load remains connected. At the same time, capacitor C2 gets charged to around 7-8 volt potential through transistor T2. But when the load is disconnected, transistor T2 is cut off. However, capacitor C2 is still charged and it starts discharging through base of transistor T1. After some time (which is basically determined by value of C2), relay RL1 is

de-energised, which switches off the mains input to primary of transformer X1. To resume the power again, switch S1 should be pressed momentarily. Higher the value of capacitor C2, more will be the delay in switching off the power supply on disconnection of the load, and vice versa. Though in the prototype a transformer with a secondary voltage of 12V-0V, 250mA was used, it can

nevertheless be changed as per user’s requirement (up to 30V maximum and 1-ampere current rating). For drawing more than 300mA current, the regulator IC must be fitted with a small heat sink over a mica insulator. When the transformer’s secondary voltage increases beyond 12 volts (RMS), potentiometer VR1 must be redimensioned. Also, the relay voltage rating should be redetermined.

ELECTRONICS PROJECTS Vol. 20

187

Electronics Projects - Volume 20.pdf

Page 3 of 200. Electronics Projects. Vol. 20. Page 3 of 200. Electronics Projects - Volume 20.pdf. Electronics Projects - Volume 20.pdf. Open. Extract. Open with.

20MB Sizes 60 Downloads 1152 Views

Recommend Documents

Electronics Projects - Volume 26.pdf
Page 3 of 216. Electronics Projects. Vol. 26. Page 3 of 216. Electronics Projects - Volume 26.pdf. Electronics Projects - Volume 26.pdf. Open. Extract. Open with.

Electronics Projects - Volume 25.pdf
Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Electronics Projects - Volume 25.pdf. El

Electronics Projects - Volume 25.pdf
Page 3 of 210. Electronics Projects. Vol. 25. Page 3 of 210. Electronics Projects - Volume 25.pdf. Electronics Projects - Volume 25.pdf. Open. Extract. Open with.

Electronics Projects - Volume 24.pdf
them have their own interpretation or personal insights based. from the accomplished task. • Facilitate student-to-student interactions and process learners. understanding. Whoops! There was a problem loading this page. Retrying... Electronics Proj

Electronics Projects - Volume 21.pdf
Loading… Displaying Electronics Projects - Volume 21.pdf. Electronics Projects - Volume 21.pdf. Electronics Projects - Volume 21.pdf. Open. Extract. Open with.

Electronics Projects - Volume 24.pdf
Page 3 of 219. Electronics Projects. Vol. 24. Page 3 of 219. Electronics Projects - Volume 24.pdf. Electronics Projects - Volume 24.pdf. Open. Extract. Open with.

MATLAB Projects - IEEE Projects
... Human Action Recognition with Multimodal Feature Selection and Fusion. ... Medical Image Segmentation by Combining Graph Cuts and Oriented Active.

MATLAB Projects - IEEE Projects
(IEEE 2013). 2. Tracking Human with Multi-channel Interacting Multiple Models (IEEE 2013). ... MATLAB based INTELLIGIENT TRANSPORTATION. 1. CoSLAM: ...

Digital Logic Design electronics books,electronics engineering.pdf ...
Digital Logic Design electronics books,electronics engineering.pdf. Digital Logic Design electronics books,electronics engineering.pdf. Open. Extract. Open with.

KCE Electronics
Feb 14, 2018 - Room 1907-1909 Tower A , N o. 100 Zunyi Road,. Shanghai, PRC 200051. Shenzhen. Room 24D1, 24/F, A Unit, Zhen Ye Building, 2014 ...

KCE Electronics
Feb 15, 2018 - appreciation against the US dollar could hurt gross m argin by 1.5% . ...... the Office of the Securities and Exchange Commission, is made in ...

KCE Electronics
Apr 30, 2018 - Pre-tax profit. 450 ... Current Taxation. (7) ..... China. Shanghai Room 1507, Park Place, 1601 Nanjing West Road, Jingan District, Shanghai,.