Electronics projects. Volume 18. 81-88152-13-7

1,891 328 40MB

English Pages 205 [199] Year 2002

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Electronics projects. Volume 18.
 81-88152-13-7

  • Author / Uploaded
  • coll.

Citation preview

Electronics Projects Vol. 18

ELECTRONICS PROJECTS VOL.18

EFY ISO 900 1:2000 CERTIFIED

SINCERELY YOURS

EFY Enterprises Pvt Ltd D-87/1 Okhla Industria l Area, Phase-1 New Delhi 110020

© EFY Enterprises Pvt Ltd. First Published in this Edition, July 2002 Reprint: August 2003 Reprint: May 2005

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

Published by Ramesh Chopra for EFY Enterprises Pvt Ltd, D-87/1, Okhla Industrial Area, Phase-1, New Delhi 110020. Typeset at EFY Enterprises Pvt Ltd and Printed at Nutech Photolithographers, B-38, Okhla Industrial Area, Phase-1, New Delhi 110020

FOREWORD This volume of Electronics Projects is the twenty second in the series published by EFY Enterprises Pvt Ltd. It is a compilation of 24 construction projects and 67 circuit ideas published in 'Electronics For You' magazine during 199 7. In keeping with the past trend, all relevant modifications, corrections and additions sent by the readers and authors have been incorporated in the articles. Queries from readers along with the replies from authors/ EFY have also been published towa rds the end of relevant articles. It is a sincere endeavour on our part to make each project as error~free and comprehensive as possible. However, EFY cannot resume any responsibility 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.

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) CONSTR UCTION PRO.fECTS l. E lectron ics Projects, Vol. l: A compilation of selected construction projecis and circuit ideas publi shed in Electronics For You magaz ines during 1979 and 1980. 2. E lectron ics Projects, Vol. 2 to 19 (E nglish versio n): Yearly compilations (1981 to1998) of interesting and useful construction projects and circuit ideas published in Electronics Fo r You. 3. E lectron ics Projects, Vol. 20, 21 a nd 22 (wi th CD): Yearly com pilations ( 1999 to 2001). 4. E lect ron ics Projects, Vol. 16 (~~ : Yearly compilations {1995) of interesting and useful construction projects and circui t ideas published in Electronics For You. (B) OTHER BOOKS l. Learn to Use Microprocessors (with floppy): By K. Padmanabhan and S. Ananthi (fourth enlarged edition). An EFY pnblication with floppy disk. Extremely useful for the study of 8-bit processors at min imum expense. 2. ABC of Amateu r Radio and C itizen Band: Authored by Rajesh Verma, VU2RVM, it deals exhaustively w ith the s ubject- g iving a lot of practical information, besides theory. 3. Batteries: By D.Venkatasubbiah. Describes the ins and outs of almost all types of batteries used in electronic appliances. (C) DIRECTO RIES l. EFY Annual Guide: Includes Directory of Indian manufacturing and d istributing units, Buyers' Guide and Index of Brand Names, plus lots of other useful information. 2. 'i.t. ' Directory: First comprehensive di rectory on IT industry covering hardware, software, telecom, dotcom and training institues. 3. Technica l Educational Directory: Incl udes course-wise and state/city-wise listings of technical ed ucational institutes in India, besides the alphabetical main directory offering all the relevant information about them.

Rs 110 Rs 11 0 (each) Rs 140 (each) Rs 95

Rs 180 Rs 75 Rs 60

Rs 300 (with CD) Rs 250 (wit h CD) Rs 100

(D) MAGAZINES l . Electron ics For You (EFY): In regular publication since 1969, EFY is the nat ural choice for the enti re Rs 60 (with CD) Rs 35 (withou t CD) electronics fraternity, be it the busi nessmen, industry professionals or hobbyists. From m icrocontrollers to DVD players, from PCB designing software to UPS system s, all are covered every month in EFY. 2. Li nux For Yo u (LFV): Asia's firs t magazine on Linux. Completely dedicated to the Open Source community. Rs 100 (with CD) Regular columns by Open Source evangelists. With col umns foc used for newbies, power users and developers, LFY is re ligiously read by IT implementers and CXOs every month. 3. 'i.t.' (Info r mation Technology): A monthly magazine for 'Techies' and those who want to be. Its reade rs have Rs30 two things in co mmon- a background related to TT and the thirst to know more. Topics covered boast technical depth and aim to assist in better usage of JT in organisations. Rs 50 4. Facts For You: A monthly magazine on business and economic affairs. It aims to update the top decis ion makers on key industry trends through its regular assortment of Markel Surveys and other important information. 5. ePowe r: Published every alternate month fo r the electroni c-power industry, primarily consists o f all electronic Rs 50 power-supply equipment, and their related components and services. A must read for those in th is industry and those catering to it. Rs 20 6. BcneflT: A technology magazine fo r businessmen explaining how they can benefit from .IT.

D D

D

Kindly note that these prices can change wit/rout any notice. Registered Post or Courier Delivery for Books and CDs: Rs 40 for.first copy, and Rs I 5 for every additional copy of any book or directory. Add Rs 501- on a11 outside De/Iii cheque. Important: The prices mentioned here are the current prices at the time ofp 11blicatio11 ; please reconfirm 1he p rices before placing orde1; or be prepared to pay th e difference- ifany Payment should be sent strictly in advance by demand draft/money order/postal order i11fi1vour of EFY associates Kits'n 'Spares.

Electronics For You (with CD) Electronics For You (without CD)

500 335

920 630

1,290 880

1,800 1,260

Information Technology

300 725

575 1,395

810 1,950

1,255 3,000

180 400

360

Facts For You

540 1,000

900 1,600

BeneflT

190

Linux For You (with CD) ePower (bi-monthly)

700 360

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

CONTENTS Section A: Construction PmJects

1.

Capture Analogue Signals on Your PC Using Printer Port ......................................... 3

2

Automatic Voltage Stabiliser Using Auto-Transformer .............................................. 9

3.

Digital Code Lock ....................................................................................................... 12

4.

Manual EPROM Programmer Cum Verifier ................................................................. 16

5.

20-Metre CW/SSB Receiver-I ..................................................................................... ::!>

6.

PC Based Function Generator .................................................................................... 23

1;

Microprocessor-LCD Module Interface ..................................................................... Zl

8.

20-Metre CW/SSB Receiver-II .................................................................................... 33

9.

Moving Message Display Using 8085 Microprocessor .................\.. ........................ 3'J

10.

Solidstate Synchroniser .............................................................................................. ~

11.

Set-top Converter ....................................................................................................... 51

12

Electronics Housie Player ........................................................................................... 00

13.

Dl'MF Remote Monitoring System ........- .................................................................. M

14.

Digitally Controlled Variable Power Supply ............................................................... 72

15.

Multichannel Monitoring System .............................................................................. 76

16.

Telephone Call Meter ................................................................................................. 82

17.

IBM PC Compatible Timer Input-Output Card ........................................................... 86

18.

Power Supply With Logic and Battery Backup .......................................................... 91

19.

Versatile Digital Frequency Counter Cum Clock ............... " ....................................... 95

20.

Bank Token Number CMOS Display ........................................................................... 102

21.

Simple Relay and Sensor Interface For PC ................................................................. 106

22. 23.

Emergency Light Using Compact Auorcscent Lamp ................................................. 110

24.

Arithmetic Logic Unit IJernonsuation Board .............................................................. 118

Infrared Remote Control ............................................................................................. 114

Ses!llgp B: Clroiit Ideas 1.

Automatic Temperature Controlled Fan ..................................................................... 125

2

Electronic Room Thennoineter ................................................................................... 126

3.

SimpJe Neon Flasher ................................................................................................... 1:26

4.

Wide Range Square Wave Generator ......................................................................... 127

5.

Infrared Proximity Sensor ........................................................................................... 127

6.

Parallel Telephone with Auto Secrecy ........................................................................ 128

7.

FET and MOSFET Tester ........................................................................................... 129

8.

Infrared Intruder Alarm ............................................................................................... 130

9.

Programmable Switching System ............................................................................... 130

10.

Simple Water Level Indicator ..................................................................................... 131

11.

Progranunable Timer ................................................................................................... 132

12.

Mains Operated Long Interval Timer ......................................................................... 133

13.

Inexpensive Single-Chip VCO .................................................................................... 134

14.

Mini Hi-Fi FM Transmitter ......................................................................................... 135

15.

Stereo Tape Recording Unit ....................................................................................... 135

16.

Inexpensive LCD Checker ........................................................................................... 137

17.

Resistance-Capacitance Frequency Meter ................................................................. 138

18.

Generating Sine Waves from Square Waves .............................................................. 139

19.

Audio-Visual Tester cum Signal Injector .................................................................... 141

20.

Logic Hi-Lo Indicator ................................................................................................. 141

21.

On-Line Telephone Amplifier ..................................................................................... 142

22.

lHz Clock Indicator .................................................................................................... 142

23.

Electronic Number Lock .............................................................................................. 143

24.

Inexpensive Capacitance Meter ................................................................................. 143

25.

Sensitive Relay Driver ................................................................................................ 144

26.

Musical Hold-on for Telephone ................................................................................. 145

27.

Programmable Timer ................................................................................................... 146

28.

Expandable Sequential Switching Circuit ................................................................... 146

29.

Week Long Timer for Digital Clocks ........................................................................... 148

30.

A Novel Touch Sensitive Toggle Switch ................................................................... 149

31.

Caretaker for your Maintenance-Free Battery ............................................................ 150

32.

Remote Musical Bell .... ...... ..... .......................... ... ........... ........ ............... ............ .... .... . 153

33.

Audio Signal Injector and Tracer ............................................................................... 153

34.

Preamplifier for Magnetic Pho no Cartridge ................................................................ 154

35.

Automatic Temperature Controlled Digital Fan Regulator ......................................... 154

36.

Tremolo Unit for Electric Guitar .................................................................................. 156

37.

Generating Three Tones from a Digital IC .................................................................. 156

38.

Your Own CD Player ................................................................................................... 157

39.

Simple Telephone Tester ............................................................................................. 158

40.

Generating Negative Supply from Positive Supply .................................................... 158

41.

Low Cost Audio Light Modulator ....................................... ....................................... 159

42.

Single IC Based Optical Toggle Switch ...................................................................... 100

43.

A Low Distortion Audio Preamplifier ................................................................ ......... JOO

44.

VHF Audio Video Transmitter ....................... ~ ............................................................ 161

45.

Double Output Current from Dual Op-Amp .............................. ................................. 162

46.

Full wave Phase Controller ................................................... ....................................... 163

47.

Digital Volume Control ................................................................................................ 163

48.

Fancy Christmas Lights .............................................................................................. 165

49.

A Battery Ope raced Electronic Load ............................................................ .............. 166

50.

Simple IF Signal Generator ......................................................................................... 166

51.

One Pulse Per Minute Generator ................................................................................ 167

52.

PC Based Digital Clock ............................................................................................... 167

53.

Powerful AM Radio Transmitter ................................................................................ 169

54.

Low-Cost Electronic Lock ........................................................................................... 170

55.

Programmable 8-Digit Code Lock ............................................................................... 171

56.

Preamplifier for FM Band ............................................................................................ 172

57.

Sound Controlled Flip-Flop ........................................................................................ 172

58.

Add Auto-Start to Generators .................................................................................... 173

59.

Tacho for Microprocessor Based Drives .............. .... ................................................. 174

00.

Off-Line Telephone Tester ... ....................................................................................... 176

61.

Ultrasonic Switch ....................................................................................................... in

62.

Adjustable Dancing Lights ........................................................................................ 178

63.

Versatile Variable Duration Digital Timer .................................................................... 179

64.

Solidstate Relay with Under/Over Voltage Protection ................................................ 180

65.

Hi-Fi Intercom .................................................................................................... .. ....... 182

66.

Programmable Musical Bell ........................................................................................ 183

67.

Divide by 'N' Counter Using IC 4033 .......................................................................... 184

SECTION A: CONSTRUCTION PROJECTS

CAPTURE ANALOGUE SIGNALS ON YOUR PC USING PRINTER PORT S. RAJ ENDRAN AND P. SWAMINATHAN

T

he personal computer lives in the digital world and dea ls with digi tal data. To look at what is ha ppening in the real wor ld, we use oscilloscopes and view the ana logue signa ls. If an analogue signal interface is provided

for a PC, it enhances the power by which we can understand our analogue signals and their occu rrance. To feed the analogue signal, we need the ana logue-to-digita I converter as the interface. They generally take the shape ----------::--:-::---;:::==::::::;------1 1 of an add-on card 5 + v Ri or PCB which pl ugs 10K into one of the va20 19 D7 11 11 osc can t slots inside R2 the 'motherboard ' L 5K D6 VIN 10 12 6 of the PC. 1 In this article, 01 (0-5V) D5 • 1 12 13 5 .1V a simple externa l • • C2 ZENER •• 150p add-on ca rd with a 04 13 • • 14 25-pin 'D' connec8 •• IC1 03 t or. which conve17 15 ADC nient ly plugs into 0804 7 D2 the printer po rt 16 16 RD 2 connector of a PC D1 at its back, makes 14 17 WR 1~ 25 3 matters simp le DO 25 PIN 'D' 18 enough to handle. VREF CONNECTOR Without opening QC 15 5 the box of the PC, TO 25 PIN anytime an ana'O' CONNECTOR logue signal is to be GND 25 + - - . . . - - - + - - - - - - 4........-+--+----J viewed, captured @ and printed out, 3 ----------' t he connector is fit2 -----------~ ted on to the ·use OF TRIGGER FOR pri nt er port and 16 RECORDING TRANSIENTS one could go ahead 9 0 - - -,-1 TRIGGER' 1 using the PC and OUT its power for signal All ~ N/C display and analySV, 1000 RELAY IC2 (A)=ULN2003 o----0 N/O sis. pr inter The port of a PC is re' - - - - - - - - - - - - - - - - - - - - - - - ' ally meant only for hand ling the Fig. 1: Interface circuit for capturing analogue signals on PC using printer port. printer. It provides

PARTS LIST Sem iconductiors. IC1

- ADC 0804 (analogue to digita l converter) IC2(A) - U LN 2003 (optional) D1 - 5.1V zener diode (400 mW)

Resistors: (all 1/4 watt± 5% rrbon) R1 R2

- 10-kilo ohm - 1.5-ki lo ohm

Capacitors: C1 C2

- 0.1 µF ceramic disc - 1SOpF ceramic disc

V 1H

n

Miscellanious: -

25 pin 'D' connector Berg strip (18 pins) -1 Flat cable (20 way) - 0.5 meter SV, 100-ohm relay 3mm plugs and sockets - 5

a set of ports, with some lines for on ly outpu t and some lines for only input. There are some open co ll ecto r lines which can be used for input. This rather messy mixture of port capabilities have remained with us right from the days of the first PC up to t he latest series of computers. Thus the circuit given here is usefu l for inte rfacing with any type of PC having a spare Centronics printer port. The PC and its operating system are meant for handling three printer ports wh ich can resi de on t he pc simultaneously. These prin ter ports have specific I/O base addresses. Ea ch one of these base addresses has three consecut ive addresses and ports namely: 1. 03BC - 03BD, 03BE (all hex) .. For LPT-1 . 2.0378-0379,037A (a ll hex) .. For LPT-2. 3.0278-0279,027A(a11 hex).. For LPT-3. The port with base address 3BC is usual ly fixed on the disp la y adapt er

Bit No. Pin No. Name Polarity

D7 11

D6 10

DS 12

D4 13

Busy

Ack +

P. End +

Sel +

Signal demils for (Base+ 1) Port Bit No. Pin No. Name Polarity

D7

D6

DS

D4 IRQRQ

Signal derails for (Base+2) Port

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

Fig. 3: Components layout for the PCB shown in Fig. 2.

cards. The other two addresses are found on the standard IIO cards such as the II O card for PC or serial/parallel cum game port ca rd for At. In these cards jumper are used to select one of the three port addresses given above, along with their associated interrupts. For our purpose we need not worry about any of these since all we need is a printer port with its usual 25-pin D connector at the back side of the PC. The first address (03BC, 378 or 278) is actua lly the output data port which conveys the 8-bit information for printing by the printer. These lines are meant for output only. However, by reading at this address, one can read what has been previously output at this port. This port can not be used as input port. The second address (03BD, 379 or 279) comprises an input only port with 5 lines used as follow: A full input port with 8 bits is not available at this address itself. The polarity of the signal at pin 11 is inverted and read. Therefore, while reading the data via this input port one has to invert the 07 bit to fix its correct value. The third address (03BE, 037A or

027A) accesses the third combined input Ooutput port. The output has open collector devices, which means that one can input data to these pins, after making "the outputs high. Some of these bits have inverted polarity as shown below: There are only four useful input pins. These are used by the printer port to initialise and strobe the data to print. Three of these bits have inverted data and hence, while reading the four bits D0-03, correction has to be done by inverting the three bits DO, D1 and D3. D4 bit is used for requesting an interrupt by the printer while acknowledging data, but this has to be ignored in our circuit. Because these pins are open collector ones, we have to keep the pins at high level ordina ri ly, thereby permitting an input to pull it low if it wants to send in a low bit data. The D4 output has to be kept low to avoid an interrupt. Thus, we have to first outp ut 00000100 or 04 hex to this port (03BE, 37A or 27A, as the case may be) to enable these four pins (D0-03) of this port as input pins.

Circuit descriplion Though the above description of the printer port (which was given for the sake of completeness) looks messy, the circuit itself is extremely simple and compact for any one to build and use. We use both the input ports 3BD and 3BE {or their counterparts in LPT2,3, whichever available). We use pins 11, 10, 12 and I3 of port 380 to connect to the ADC' s D7-D4 pins. Then, the port 3BE is used to connect D3-00 pins of the ADC to pins 17,16,14 and 1 of the same D connector. Thus, in all, we are able to read the 8 bits of the digital data from the A-D converter via the printer port. Pin 5- of the ADC, which indicates end-of- conversion(meaning that the ana logue input at the curre nt instant has been converted into digital value), is read via pin 15 of D connector at bit

D3 15

D2

D1

DO 03 of port

380. The ADC chosen is the economical D3 D2 D1 DO not- t oo-fas t 17 16 14 1. device, the Slctin !nit AutFd St National + 0804. which can convert in 120 microseconds. Using this IC we can take up to 8000 samples in one second, which means that if we desire to represent one cycle of a sine wave by say 20 points, then we could use it up to 400 Hz. For higher frequencies we have to use an A- O converter with low conversion period. Only then the plot of the waveform will be clear enough. ICl (ADC0804) works with an interna l clock, for which resistor R1 (10-kilo ohm} and capacitor C2 (150 pF} are provided on pins 4 and 19 of the IC for clock generation. The conversion is initiated by writing a logic 0 at its pin 3. After a time delay greater than the conversion time, the digital data will be ready for the analogue signal at its input pin 6. The reference voltage is the 5V supply itself. Hence, input signal can vary from 0 to +SV. This range is converted as the digital value 0 to 255. To read this converted val ue, the read pin 2 is brought low and then the digi tised data is readable by the PC. The program in the PC does the job of starting conversion, waiting for over 120 microseconds and then reading both ports 3BD and 3BE. The former provides 4 bits and the latter another 4 bits of digital data. Those bits which give inverted bit values have to be corrected by an exclusive-OR instruction that changes 1 bit to 0, and vice-versa. Then the two 4-bit values are combined to get the single byte, as required. Err +

Program for data acquisition and plotting. The program, written in IBM PC assembly language, is listed. This can be assembled using MASM and LINK programs available from IBM. The final program ADCKP.EXE will be direct ly executable. After connecting the board with its flat cable to the printer port D connector, the SV and ground are to be given from the PC's own SV and ground lines,

ADCKP.ASM program listing ;ADC and screen display program thro' Printer port. org OOOOh portA equ D378h ;These are the printer ports on the pc on which portB equ 0379h ;this program has been run/tested. portC equ 037ah; These may have to be changed according to PC data segment ms1 db 'give no. of samples', 10, 13,'$' buf1 db 06 nchar db 0 char db 07 dup(?) ten dw OOOah samples dw 1 dup(?) mes1 db 'data acquisition is going on-please wait',10, 13.'$' mes2 db 'data acquisition completed', 10, 13,' mes3 db 10, 13.'contents of the kbd ilp buffer','$' nam_buf db 20h; name buffer gets fi lled with 20h to enable ; max 32 characters entry of a name nam_len db? ;next byte is going to be filled by DOS of actual ; entries of character for the name keyed in. fil_nam db 20h; here 20h reserved for fi lename f_prompt db 10, 13, "Enter Fi le Name: ","$" hand le dw? o_err db 10, 13,'cannot open file.',10, 13,'$" c_err db 10,13,'cannot create fi le ',10,13,'$' w_err db 10, 13,'cannot write into file.', 10,13,'$' f_err db 10,13, 'disk full , no memory space',10,13,'$' s_end db 10,13, 'file storage completed', 10, 13,'$' va luel db 16000 dup(99); buffer for data storage count dw (?); counter used in the 'show' routine countl dw (?) data ends pad segment stack dw SO dup(?) TOS label word pad ends code segment assume cs:code,ds:data,ss:pad ;display macro display macro string mov dx,offset string; display the string on screen mov ah,09h ; interrupt funct ion to write on screen int 21 h endm start: mov ax.data ; Intia lises data segment mov ds,ax mov ax,pad ; lntialises stack segment mov ss,ax mov sp, TOS mov dx,portA ; Clear D7 bit of portA to mov al,7fh ; give low level on the trigger pin out dx,al nop nap lea dx,ms1 ; Displays the message of give no. of mov ah,09h ; samp les on the screen. No.9 of Int21 h ; is for screen display int 21h lea dx,buf1 ; Key pressed value is displayed and

mov ah,Oah int 21h lea dx,mes1 mov ah,09h int 21h lea si,buf1 mov cx,OOOOh

a1:

a2:

ax1:

setgr:

Pl:

P2:

P3:

; also stored in buf1 memory location ; (ie the number of sample value) ; to show that data acquisition is going on

; SI register points to the buf1 ; location where the no. of samples is ; stored as ASCII value ;ASCII to HEX converter routine

mov al,[si+2] and al,Ofh cmp al,Odh ; Checks for return key (ASCII code for ; return key is OD) je a2 mov ah, OOh add ex.ax ; ex register contains the first value mov al,(si+3) cmp al,Odh je a2 mov al,Oah ; multiplies ex reg. value by no. 10 mul ex ; and the multiplied value is ; stored in ex register mov ex.ax inc si ; Takes the next va lue and repeats jmp a1 ;till return key is pressed mov bx.ex ; Converted hex value is stored in BX mov count1,cx push bx ;adc program lea di, value 1 ; Value 1 mem locations is used to mov ex, bx ; Store uired data form l/P Port push ex ; Cx reg. contains the va lue of no. of sample call datacq ; call the data acquisition program mov [di],e1 ; Acquired data is stored in memory buffer ; memory is incremented for next value inc di pop ex ; collects the data as many times loop ax1 ; as no. of samples lea si,value 1 mov ah,OOh ; Set graphic mode for mov a1,06h mov bh,OOh mov b1,00h int 10h ; **push ex (deleted) mov dx,00 ; To draw line on X axis mov cx,00 ; from 0 to 195 at X=635 at Y=O call plot inc ex cmp ex, 635 jbe pl ; To draw line on Y axis call plot inc dx ; from Oto 195 at X=635 cmp dx, 195 jbe p2 mov cx,00 call plot inc ex ; To draw line on Y axis cmp ex, 635 ; at x=O

l~!~li?•lllSi~it•IJ~l-1 1 5

P4:

PS:

P5:

PB: P7:

p9: P10:

show:

s:

s1:

next:

ax3:

jbe P3 mav cx,00 mav dx,00 call plot ; To draw li ne on X axis inc dx ; at centre of the window cmp dx, 195 ; (at Y=99) jbe p4 mav dx,99 call plot inc ex cmp cx,535 ; To draw line on X axis jbe pS ; at X=315 (at centre) mav dx,00 mov cx,315 call plot inc dx cmp dx, 195 jbe p5 mov cx,1 5 mov dx,95 ; To draw grids on X axis ; 1S**(pixels) spacings are given call plot inc dx ; between grids cmp dx,103 jbe P7 add ex, 15 cmp cx,630 jbe pB mov dx, 10 mov cx,312 ; To draw grid on Y axis ; 1O**(pixels) spacings are given between call plot ; grids on Y axis inc ex cmp ex, 320 jbe p10 add dx,10 cmp dx,198 jbe p9 pop bx mov count,534; maximum 535 points can be shown mov dh,00 ; on X axis in 540 X 200 gra phics mov ex, 10 mav dl,[si] ; take the acquired data from memory cmp di, [si+1] ; the next data point also (to draw line segment) ; if the next point is above, go to ax3 jb ax3 ; **(original line "jnb ax3" changed) ; draw line between the points if the next call plot ; value is greater than previous va lue inc di cmp di, 199 ; if the data is> 199, skip that value ; since screen height has only 200 lines jnb next cmp dl,[si+1] jb s1 inc si inc ex dee count jnz s jmp exit call plot dee dI cmp di, OOh je next

; take next immediate data point ; count is location contains one screen of samples ; repeat point plotting until over for t his screen ; to draw line between two points if the next ; value is< previous one

6 ll::ll#IJl;t•lll[f.ilij#{ell#IJl.1

plot

r: exit:

el: clear:

e2:

file:

cmp dl,[si+1J jnb ax3 jmp next mov ax,OC01h ; function request OCh in AH and 01 in AL cmp dx,199 ; in INT 10 is for writing a dot jnb r ; row and column values in CX,DX inc dx dee dx js r int 10h ret mov ah, OBh int 21h cmp al,46h ; To save the data in file press F key je file cmp al,Odh ; exit to DOS if return key is pressed je e2 mov ax, 0600h ; if not. clears screen mov bh, ooh mov ex, OOOOh mov dx, 184fh int 10h jmp setgr ; draw next set of 640 points mov ah,00 ; **(5 Lines added) To return to original text mode mov al, 07h ; ** before returning to DOS. mov bh,00 ; **(check your orig. text mode using msd command under DOS) mov bh,00 mov bl.DO int 10h mov al, OOh ; Program code to return to DOS mov ah,4ch int 21 h display t_prompt; show what name to be entered for file lea dx,nam_buf mov ah,Oah int 21h xor bx,bx mov bl,nam_len mov fi l_nam[bx],Oh lea dx,fil_nam mov ah,3ch mov ex.Oh ; file saving program using DOS int 21 h int 21h jc o_error mov hand le.ax mov ah.40h mov bx.handle mov di,64000 mov cx,64000 mov dx,seg value 1 mov ds,dx mov dx,offset va lue 1 int 21 h jc w_error ; show up if file cannot be saved, as errors cmp ax.di jne f_error mov bx.handle mov ah,3eh

int 21 h jc c_error display s_end jmp exit o_error display o_err jmp exit c_error display c_err jmp exit w_error: display w_err jmp exit f_error display f_err jmp exit ; Data acquisition program datacq proc near mov dx, portC mov al,04h ; to enable the open collector output out dx,al mov dx,portA ; to make write pin low mov al.253 out dx,al nap ;** nap added for increasing duration nap ; of write/read pu lse to ADC nap nap mov al,254 ; to make write pin hi and read pin low

out dx,al nap nap nap nap mov dx,portB

mov cx,0800h ; give delay before reading data q1

datacq

loop q1 in al,dx and al,OfOh mov cl.al mov dx.portC in al.dx and al,Ofh or al.cl xor al,8bh mov cl,a l mov al,200 sub al,cl mov cl,al ret endp code ends end start

; read the data ; mask the higher order four bits ; store it cl register ; read the other four bits thro' ; the port 3beh ; mask the lsb four bits ; take the msb values for cl reg. ; invert the polarity

; cl reg. contains the acquired data ;data acquisition program ends here

which are general ly avai lable on the SM PS of the PC as plug outlets. Alternatively, an external SV supply can also be given. The program first asks fo r the number of data points to be taken. One may enter a va lue up to 16,000, depending on the requirement. It takes around 4-5 seconds to acquire that many samples. It displays the data much like a storage scope, in steps of 600 points in each successive screen. Pressing any key shows the next 600 points plotted, and so on. Pressing the Enter key takes you back to DOS.The amplitude of the fu ll screen covers from O to 200 only, because the norma l di splay mode of the PC has on ly 200 horizontal pixel lines. Since 255 means 5 volts, the screen scale is 0-4V only, with 20 grids spaced 10 pixels apart on the vertical axis. While observi ng AC waveforms, it is necessary to provide a shifting DC volt· age, so that the waveform swings from O to SV and does not go negative. The ze· ner diode at input pin 6 of the ADC will take care of this in any case. The time-base of the display is to be known for reckoning the timings in any waveform. There are 600 points hori· zontally on the screen, A small graduation is made at every 15th point. To take 15 samples, it takes about two mi lliseconds. This can be changed, if need be, by

n

~

(\

A

,

fl

(\

~

~

~

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I ~

I

I

I

I I I

I

I

I

I

I I

I

I

I

I I I

I

I

I

I I I

I

~ v v J

J

v v

v

I

I

v v J

Fig. 4: On-screen primout for 1he sine wa~e captured during the resting.

changing the counter CX from 0800 hex to a different va lue in line MOVCX, 0800h, under Data acquisition program on page 86 of the assembly listing. The waveform which is seen can be immediately printed on dot matrix printer for taking a hard copy. There may usual ly be an additional printer port on a PC. If not, the D connector of the ADC is removed and the printer cable

connector fitted in its place without switching off the PC. For this, the DOS Graphics.com program must have been run before running this ADCKP. EXE. After acquir ing the data. t he waveform seen on the screen can be copied by the printer by pressing t he Shift and Print Screen keys together. Fig. 4 shows a sample sine waveform from a function generator as captured via the printer port.

It is possible to capture transient signals also. For this, the trigger out pin 9 gives a positive signal. This can be used to operate the event causing the transient signal, such as closing of a relay contact. If IC ULN 2003 is used as in Fig.1, it can serve to operate a contact that causes the transie nt event. One may observe the in-rush current of a power transformer, the response to step input

of op-amp filters, bird sou nds through mike and amplifier, and so on. The transient wave-form subsequent to the contact closure are recorded and displayed.

Readers Comments:

2. At label s, modify the program as und er: s: mov dl,[si] add dl,shift_cnt mov a1 ,[si+1] add al ,shift_cnt cmp dl,al e1 : cmp al ,Odh ;check for return key

0 The software deta ils provided by the

author along with supplementary assembly language listing are given below: The acquired data samples are stored in a buffer memory space. The acquired data from the stored buffer is taken point by point. At label 's' this enters register di. The next po int is also taken and compared with this point to decide and draw a line joining the two points either upwards or downwards. If the waveform is to be shifted, then the data taken from the buffer must be offset by adding a shift count value to it. This can be done by keyboard control. If '+' key is pressed, the offset is incremented by 1 point upwards and if '-' key is pressed, the offset is decremented by one point downwards. Thus t he waveform can be shifted by using '+' and '-' keys. If 'enter' key is pressed, the program returns to DOS. Any other key will display next set of 600 points. This software works on CGA mode only, so that even a simple PC wi ll work with this program. The existing ADCKP.ASM program is to be modified at th e fol lowing locations so that screen may be shifted upwards or downwards, as desired. 1. In the beginning, after line nchar db O shift_cnt db (0); this new I ine is added to ; provide a memory ; location for graph shifting, Rest as before .......

PCB and components A small PCB layout for the ADC ci rcuit is given in Fig.2 while the component layout for the PCB is shown in Fig.3.

je e2

cmp al. "+"key ;check for+ key jne e11 Pluskey: inc shift_cnt :if + key, increment :shift count value jmp clear e11 cmp al,"-" : check for - key jmp clear Minuskey: dee shift_cnt ; if - key pressed. ;decrement the above Clear: mov ax,0600h .......rest as before......." Technical Editor O I request the author to clear some doubts: 1. It has been stated that the norm a I display of PC has only 200 horizonta l pixel Iin es but the resolution of norm a I screen is 640 x 480. 2. It is difficu lt to follow the software since no flowchart is provided. 3. Can we test the hardware using 'Debug'? 4. With the help of D/A converter can we record and reproduce speech at least up to 400 Hz? 5. Can we interface this card to I/O card so that software part becomes easy? 6. Can we wr ite the software in a high level language ('C' or 'C++') for programm ing?

The flat cable from the 25-pin male D connector is terminated on the series of Bergstrips pins from which the connection are given to the IC on the PCB Note: Certain additions and changes were effected in the ADCKP.ASM program for viewing the waveforms on a PC A T-386 system at EFY. These are indicated by double astrick mark (**) in the program. 0

S. Ananthanarayanan Co imbatore The author S. Rajendran and P. Swamfnathan clarify: 1. The display refers to CGA mode

(640 x 200) which is suitable for any ordinary PC. The program can be converted to work with EGA mode also. In that case one can get max. 255 ordinate points instead of 200 because 8-bit ADC is used in the given circuit. 2. Capturing the data (via datacq subroutine) and then 'showing' and repeating it t ill the number of points of data are over is just what the flow-chart would compri se. 'Plot' is another subroutine to plot a point and join it to successive points by a line. 3. One can test the hardware by just using 'Datacq' program only in 'DEBUG'. The RETURN statement should then be repalced by INT 3. 4. Yes, we can record and reproduce speech at least up to 400 HZ Using D/A converter. 5. Since printer port provides the 1/0 facility as demonstrated in the article, no 1/0 card is necessary. In case you do not use the printer port but use a separate 1/0 card, in that case you may note the following two things (a) change the port addresses A, B and C: (b) the listing under label 'Q1 ' part of Datacq is not necessary. 6. Yes, we can write the software in high level language. However, the speed wiII be affected.

AUTOMATIC VOLTAGE STABILISER USING AUTO-TRANSFORMER ARUN P. HE BBALKAR

T

his automatic vo ltage stabi liser circuit uses only four ICs and has the following features: 1. Low-cost 2. Over vo ltage and under voltage protection. 3. Slow turn-on. 4. Voltage boosting even at low input voltage of 161 volts.

Circuit The transformer XI shown in Figs 1 and 2 has altogether five windings. Windings N1,N2 and N3 take part in the voltage stabi Iisation process whereas windings N4 and NS are used to derive the DC voltage for the control circuitry. Relay RL 1 is connected at the input

side of t he transformer whereas relay RL2 is connected at the output side. Relay RL3 is used for over voltage and under voltage protection and also for achieving slow turn on. Relays RL1, RL2 and RL3 are driven by transistors T1, T2 and T3 respectively. Diodes D1 and D2 along with windings N4 and NS comprise the fu ll-wave centre-tapped rectifier and provide the unregulated DC voltage (filtered by capacitor Cl) to IC7812. The unregulated DC voltage is also applied to preset VR1. The voltage available at the variable terminal of this preset (VR1) is used as sensing voltage by the comparators A, B and C. The 12 volts output avai lable at the output termina l of IC4 is further filtered

TAB LE I 161-184 184-210 210-240 240-274

1 1 0 0

210-240 210-240 210-240 210-240

0

1 0

1

15.3-17.5 17.5-20.0 15.3-17.5 17.5-20.0

PARTS LIST Semiconductors: IC1

1(2

- LM339 quad comparator CD4093 NAND gate

IC3

LM555 timer

IC4

7812 12V DC regulator IN4007 rectifier diode IN4001 rectifier diode

D1,D2 D3-D5

LED1, LED2 T1 -T3

Red LEDs SK100 pnp t ra nsistor

Resistors (All 14-watt ±5% carbon, unless stated otherwise}: R1, R4, R15 R2, R3, R9, R10, R16 RS, R18 R6, R7

RB R11-R14 R17 R19 R20-R22 VR1-VR4

270 ohm

3.3-kilo ohm 10-kilo ohm 100-ki lo ohm 10-Mega ohm 1-Mega ohm 4.7-kilo ohm 82-ki lo ohm 1-kilo ohm 10-kilo ohm l inear preset

Capacitors: C1

C2 C3 C4

cs

100µF, SOV electrolytic 0.1µF ceramic disc 22µF, 16V electrolytic 1000µ F, 16V electrolytic 0.01 µF ceramic disc

Miscellaneous: RL 1-RL3

X1 S1

X1

7

8

+IN A--1--~ ~--+- -IND 7 LM339 GND _ _ _ _ c _o4_09 _ 3_ __

Fig. 1: Winding details of iransformer Xi and pin layout of !Cs LM339 and CD4093

12V, 100-ohm SPST re lay with contact rating= SA See t ext 2-way centre-off switch (SA) Heatsink for IC 7812 300V AC vol t meter

by C4 which is then used to power the control circuitry. When relay RL 1 is in off position,

windings N1, N2, N3 are connected across the input supply in se ries. This mode is th e bucking mo de of t he stabiliser. Only windi ng N3 gets connected across supply when RL1 is in on position. and this mode of operation is known as boosting mode. Relay RL2 is further used for bucking or boosting at the output side of the transformer (load side). RL2 in off position provides boosting and, RL2 in on position provides bucking. The positions of these two relays (RL 1 and RL2) depend on the input voltage as shown in Table 1. Power to the load is conveyed only when relay RL3 is on. This relay is controlled by transistor T3 and comparator D. The voltage at pin 9 of IC1 (NI input of comparator D) is around 2/3rd of DC supply vol tage, i.e. (2/3) x 12 = 8 volts. Thus output of compa rator D wi ll go low (OV) only if voltage at its inverting input exceeds 8 volts. This voltage equa Is the voltage across capacitor C3. When the voltage stabiliser is switched on, the voltage across C3 starts ris ing as the capacitor C3 charges through res istors R1 9 and R20. After approximately 1.5 minutes, this voltage exceeds 8 volts, thereby switching on transistor T3 and energising relay RL3. These initial switching surges are not allowed to pass on to the load. Comparator A is a non-inverting comparator with hysteresis provided by resistors RS and R8. The voltage at inverting input of comp arater A is fixed at 8.4V wi th the help of preset VR2 . This output of comparator A, which is also connected to the inputs of NAN D ga tes E and G. goes hi gh when V1 exceeds 8.4V or, in other words, when input voltage exceeds 210V. Comparator B is an i nvert ing comparator with hyste rsis provided by resistors R11. R12 and R6. V1 is applied to the inverting input and the voltage at the non-inverting input is fixed to 6.4V with the help of preset VR3. Thus output of comparator B wi ll go high (+12V) when the input supply voltage goes below 210V AC. This output (p in 2 of IC1) is con nected to the inputs of NAND gates F and H. IC3 (LM555) is used as RS flip flop. Pin 4 of IC3 is used to reset the flip-flop and pi n 2 is used to set the flip-flop. When pin 2 of IC3 is driven low, output at its pin 3 goes high. Now if pin 4 is driven low, the output at pin 3 also goes

+

g,M

I

;~

:TI.--e---.---1...-------1 14 1·

1 .. ,

7 R10 :~ 100K

IC2 4017

C11 0.01µ

15

R

...-.--r------,

+9V ...~

BAT. -

--I :1---1.....------;-,

IC7 (R2) = 4078

Is

14 / \ 7

r---

r-1 :t--t---1'-~ - -

R2

ST I

ss.,L

2

R11

100K

I - .....I...-......,.,.......... r-vr---..

, r-~r.......~_.,,....

C10 0.1µ

08

T

Sl · S1 1 = PUSH TO·ON·SWITCH c 1 . ca= 0.01µ Al · RB= 100K

C9 0.01µ

~o ~

CORRECT SEQUENCE

14

3

4

5

9

-

10

11

...

,A

12

~~

5

-

sl B

sI

A2 .1

IC3 CD4081 A3

10

12 13 1

4

A4'

11

7

1-s-

eI a.::..:+--.i------+---+----+--t---+---t----t---r---if'-"-1

4

A6 ' - -....-----,

s-

-

91

IC4 CD4081

A7' ..I

10

12-

13 1 AS ' 7 ~0~3::..+--.i------.i----+---+---ll---+---t----t--r---ir11 8

15

R

14

11

14 2 3 4 5 9 1C11 12

T

' 14

R1 t1

-------1 ~-

-I ~S11

IC6 (R1)

RESET

=CD4078

Fig. J: Circuit diagram for the digital code lock.

Cons1ruction The actual-size PCB l ayout fo r the circuit shown in Fig. 1 is given in Fig.2,while t he components layout for

the same is shown in Fig.3. All the eleven push-to-on switches can be suitably mounted on the box containing the PCB. The output points for correct as well as incorrect sequence are

available. Correct sequence output can be used for opera ting a lock- release mechanism while incorrect sequence output can be used for interfacing to any warn ing device. Circui ts for the same ELECTRONICS PROJECTS Vol. 18

13

code switches as well as count the number of times a user attempts the code. D

R eaders Comments: D I would like to know whether it is possible to operate relays using correct and wrong sequences I would like the author to clarify the following: 1. What exactly the outputs of 'CORRECT' and 'WRONG' sequences? 2. How is it possible to set a code with any number of digits repeated as mentioned under subheading 'permutations' ? Amit Narang Chandigarh

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

The author Girish H. Pundlik replies: It is certainly possible to operate relays using the correct and wrong signals of the lock. CMOS devices being low power devices, it is a bit difficult to drive large amplification of the signal. For small relays, you can use the circuit shown in Fig. +9V

1.

II

RL1

2~6n

RELAY

T1 BC157

= Fig. I: Circuit showing operation of small relay

For larger relays, two trans istors are necessary to provide the operating current, as shown in Fig. 2. In reply to the next queries raised by Mr. Amit Narangh The outputs of +9V

Fig. 3: Component layout for the PCB shown in Fig. 2.

are not included in this construction project. The circuit should be powered from a 9-volt battery since the circuit uses all CMOS ICs and the power consumption is quite low.

Permutations The code lock provides 10 P8 (1814400) 14

ELECTRONICS PROJECTS Vo . 18

permutations when no digit is repeated. By repeating t hese digits, this number can go up to 108-1, i.e. 99999999 possible permutations. Although the programming method used here is qui te crude (j ust to reduce the cost), the circuit functions quite reliably. It could be further refi ned using a microprocessor based circuit which may display the depr essed

R2 1K

RL1

2~6n

11 RELAY

Fig. 2: Circuit showing operation of large relay.

TOS3 TO S7

00 01 02 03

TOS1

IC1 CD4017

04 05

TOS9

06

TO N2 & N1 (AFTER

08

09

INVERTION VIA N3)

-TOS6 l TOSO DUM MY

-

rose

-

TOSO

KEYS

Fig. 3; Code lock circuit using repeated digits.

gates Nl and N2 are actually active low. Both the outputs, i.e. 'CORRECT' and 'WRONG' are normally high, because pin 9 of IC2 controls the inputs to both NAND gates (Nl and N2) which indicate the completion of code. The other inputs to the gates (Nl and N2) are true and complement of the output at pin9 of ICl. The correct and wrong outputs are la-

belled as CORRECT SEQUENCE and WRONG SEQUENCE respectively as given in Fig. 3 of the article. To set a code with repeated digits, one can use OR gates shown in Fig. 3. to enable a key (corresponding to the number repeated) and in turn validating the AND gate as shown in the article. This would however make the circuit complicated. The position of the digits in the code depends on the output of ICl. Thus any digit which is repeated will not allow much change in the code structure, because some other digit would be repeated at the same position.

ELECTRONICS PROJECTS Vol. 18

15

MANUAL EPROM PROGRAMMER CUM VERIFIER NARESH TYAGI fter going through the construcion project Moving Message Dislay published in August 1996

issue of EFY, a number of readers stated that they do not have access to any microprocessor based EPROM programmer

for programming EPROM2732 used in the project. Although manual programming of I

OllO

:j 0-0

°'),

0-0

°)

0..0

"""b

0-0

0

Put switch 82 to 'on' position and turn switch 81 to position 1. Reset counter (IC2) by momentarily connecting its reset pin 11 to +5V using switch 84 (position 2). At this stage address selected is 000 Hex, and hence none of the LEDs (LEDl to LED12) connected to output pins of IC2 via 470-ohm resistors should glow. Now each momentary depression of switch 83 will advance the counter (EPROM address) by one count. The selected binary address can be read from the LEDs itself (led 'on' indicates

logic 1 and LED 'off' logic 0 state.) The data byte to be programmed is set by the eight dip switches and can be directly read using LEDs numbered 13 to 20 (for bits DO to D7). The exact steps to be followed for programming the EPROM are given below sequentially: 1. Ensure that switches 81 to 85 as well as dip switches are either in off position or position 1. 2. Reset counter IC2 by momentarily putting S4 to position 2 (and then back

to position 1). This causes address 000 Hex to be selected (LEDs 1 to 12 all off). 3. Ensure that switch 85's position 2 has been connected to specified VPP voltage (+ 12.7 or 25.3 volts) via switch 86 in the power supply. (Generally the specified programming voltage is mentioned on the EPROM IC itself; it is below 25V. For 27C32 IC it is 12.7 volts.) Turn 85 to position 2. 4. Switch 82 on. 5. Initially address 000 Hex is selected as mentioned in step 2. If address ELECTRONICS PROJECTS Vol. 18

17

other than 000 Hex is required, advance PARTS LIST the counter by momentarily depressing - LM555 timer ICl Capacitors: 83 a number of times, till desired adIC2 - CD4040 12-bit binary counter Cl - O. lµF ceramic disc - 27C32 EPROM (for C2 IC3 - lOnF ceramic c:tisc dress is selected (as indicated by LEDs programming) - lOOOµF, 50V electrolytic C3 1 to 12). - 7824, 24V DC regulator C4-C7 IC4 - lOOn ceramic 6. Switch off S2. IC5 - 7812, 12V DC regulator - lOOµF , 25V electrolytic CB 7. Select desired data byte using dip IC6 - 7805, 5V DC regulator switches 1 to 8. (Selected byte can be Dl ,D2 - 1N4007 rectifier diode Miscellaneous: - 1N4148 silicon switching c:tiode Xl - 230V AC primary to 24V-0D3-D5 read from LEDs 13 to 20.) LED124V, 500mA sec. trans8. Put Sl to position 2. LED20 - Red LEDs former 9. Depress S3 once momentarily. - 8PDT switch Sl,84-86 (This lodges the selected data byte at - 8PST on/off switch Resistors (all 1 I,-watt, ± 5% carbon, unless 82 stated otherwise): - Push-to-on switch 83 selected address location.) - Dip switch 8 way Rl-R20 - 470 ohm 10. Put Sl back to position 1. R21 - 470 kilo ohm - Zif sockets 28/24 pin (for 11. Repeat steps 4 through 10 for EPROM) R22 - 10 kilo ohm programming the next data byte. Steps to be followed for ,--~~~~~.......,,,~~~~~~~~~~~~~~~~~~~~:;;;;;;-~~~....... reading (verifying) the data 0 stored at various EPROM locations are given below se- ., ~.so_. quentially: 4700 1. Remove VPP voltage and • '"' connect VPP pin of EPROM to 470n ground by putting S5 to position 1 (ground, i.e. output en- 4Z.,.~1!....­ abled). 2. Put all dip switches to . , 4~?..0 • off position. 3. Put Sl to position 1 ~ (ground, i.e. chip selected). 4 700 4. Reset counter IC2 by mo- ~ mentarily switching S4 to posi- .__wv-.-tion 2 (and back to position 1). This selects address 000 Hex as indicated by LEDs 1 to 12 (all off). At this stage data byte lodged at address location 000 Hex of EPROM can be read directly from LEDs 13 to 20 (for bits DO to D7). 5. Put switch S2 on. 6. Advance the-address by one cou nt by depressing 83 once momentarily and read the data at next location ;as done

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-

=..,

a

J

and D4) in common lead provides about 25.3 volts at its output. This voltage is further stabilised to about 12.7 volts and 5 volts using res (7812) with one diode 18

ELECTRONICS PROJECTS Vo . 18

Precautions The steps given for programming should be scrupulously followed as wrong data lodged in any EPROM

location cannot be easily erased. One has to use EPROM eraser and reprogram the whole data all over again. For reading (verification) of programmed data, the only precaution required is to remove VrP voltage from Vrr pin using switch 85 (position 1). While handling CMOS EPROM IC's the normal precautions against statics have to be taken by storing the IC in a tin foil or in an antistatic bag and grounding all pins before and after inIJ sertion into the socket.

Readers Comments 0 What does the author mean by ZIF socket and DIP switch, and how are they used? Rajeev Anand Kanpur 0 I could not follow how the DIP switches setting is done for entering a specific

data. Rafique Islam Narsingdi, Bangladesh

The author Naresh Tyagi Comments: ZIF stands for Zero Insertion Force. The ZIF socket and DIP (dual-inline pin) switches are available with computer hardware vendors. One can

use 24- pin IC 2732 from IC base. Ensure that the pins do not bend or break. One can use eight toggle switches in place of eight DIP switches. Using a DIP switch is very simple. The 'off' (logic 1) and 'on' (logic 0) positions are clearly marked on the switch.

0

ELECTRONICS PROJECTS Vol. 18

19

20-METIE CW/SSB RECEIVER PAIT I V. VENKATARAMANA, VU2VVR

Home made receivers are easv to maintain and service as compared to commercial one's, because the designer knows the circuit lavout and how each stage runclions.However. the greatest advantage is the knowledge aperson gains while construcHng ii.

W

hilesome enterprising amateurs have aimed at achieving the ultimate performance using sophisticated de signs, some others work with simple receivers of the dir ect-con version type. Here, we have adopted a compromise ap proach.

9MHz XTLFILTER

LOCAL

9 MHz

(VFO)

(BFO)

osc.

osc.

5.000 TO 5.350 MHz

8.9985MHz0

09.0015MHz

ILSB

uss I Fig. I: Block diagram for the CW/SSB receiver.

FL1

FROMAGC X3 VR1 1K (LIN.)

T2 3N200

I

C9 180p

C5 0.0 111

TO IF AMP.

D2 X1 D1

I

R6 27K

ca 0.01µ C3 0.0111

RB R7 150Q

D1 = D2=1 N4148 C7 C4 0.01µ

150fl

C10 0 .01µ

FROM VFO

+12V

= Fig. 2: Circuit diagram for RF amplifier and mixer.

In the design of receiver described below MOSFETs and ICs have been used 20

ELECTRONICS PROJECTS Vo . 18

I to

obtain the desired performance. A large portion of the receiver gain has

I been realised at audio frequencies. As a result the output signal is quite free from

TECHNICAL SPECIFICATION Frequency range - 14.000 to 14.350 MHz Circuit type Intermediate frequency Sensitivity Auclio output Power supply Dimensions Weight Accessories

- Single conversion super-het. -9MHz

- Better than 1 µV for CW/ SSB. - 400mW into 8-ohm speaker - 12V DC, 1-amp. - 25x25x10 ems. - 2kg. - Headphones(optionai) - Powerchords - Wire antenna (optional)

ohm speaker. The sensitivity is better than lµV in CW as well as SSB mades.The set utilises single-conversion super-heterodyne principle. During SSB reception, both lower and upper side bands are obtainable by the use of crystal filler. CW operation is possible using beat frequency oscillator (BF O)

C13 390p G C12 100p

L1 3. 4~1H

D3 1N4152

R11 47K

VC2 22p

C1 1 22p

COIL

VC1 2X

470p C14

Fig. 3 : Circuit diagram for the local oscillator (VFO) .

=

C29 FROM MIXER

C22 10p

C23

VC3 22p

and power socket provision have been made on the rear panel.

Block diagram The RFsignals (14 to 14.5 MHz ) picked up by the antenna are fed to RF amplifier which provides a gain of 10 dB. Signals from local oscillator stage, which is tunable fro m 5 to 5.5 MHz with an amplitude of 3 to 3.5 volts (peak-topeak), are fed to mixer R17 as one input, while the 1000 other input is the am+12V plified RF signal. The output of the mixer is IF (9 MHz) which is fed to a 9MHz crystal filter for SSB reception. This signal is amplified by two identical IF stages using MC1590 ICs and fed to product de tector stage. The other input to product detector is from crystal oscillator which is tuned to 8.9985 MHz or 9.0015 MHz. for LSB and USB operation r es pect ive ly. The TO PRODUCT output of product detector is DETECTOR audio signal which is amplifi ed by LM380 audio amplifier. The output of LM380 is fed to 0.5-watt, 8-ohm loudspeaker. C35 Detailed stage-wise de0.1~· scription is given below with reference to the schematic diagrams.

RF amplifier and mixer In the first RF amplifier stage (refer Fig. 2) dual gate +12V MOSFET3N200 h as been used for amplification of the '---------------------------------------~ input signal received by the Fig.4: Circuit diagram for the IF amplifier. antenna. Practically, 3N200 provides 10 dB gain. Bobbin spurious noise and the receiver exhibits which is tunable up to l.5kHz away from type antenna coupling transformer has adequate sensitivity, selectivity and sta- the IF. been used. The output of the RF amplibility. The IF frequency is 9 MHz. The re- fier stage is coupled to the mixer stage ceiver is a table-top model with a weight (which al so u ses 3N200(MOSFET) of around 2 kgs. It can be operated from through transformer of l.9µH value Specifications a 12V DC power supply with a current In turn t he mixer is coupled to the The r eceiver operates in t he fre- rating of one ampere. Power supply pro- 9MHz crystal filt er through l.74µH quency band of 14 to 14.350 MHz in CW tection using a' shunt diode, has been transformer. The mixer is also fed with and SSE modes. The output power is incorporated. On the front panel we have the local oscillator signal which varies around 400 mW which is fed into an 8- on/off switch while antenna connection from 5 to 5.5 MHz. ELECTRONICS PROJECTS Vol. 18

21

R34 8200

R39 1.SK

R43

470 +12V

C44 0.1fl

R33 1K

R40 2.7K

R41 10K

R42 2.7K

+

C48

6Bp 100V

R35 470

AGC OUT

12

10

IC3

C46 O.lft

MC1496P

St---+---' TO AUDIO AMPLIFIER

........,_---- Wl\) W O~w

N

+ a:

N>W

Capacitors: Cl, C2

Nt'-z Cl ~w

N

C3

220µF, 25V electrolytic 47µF , 25V electrolytic

M iscellanious:

RLl Sl Xl,X2 X3

,.._ x

"'" ow

~ "'" zw -w II en

:;!

+

II

"'9~.

ox

Fig. 4: Circuit diagram for the solid state for the synchroniser.

though they may be equal in magnitude (which is determined by the field excitation). This phase difference between the two machines will be continuously changing due to difference in their frequencies. This difference in frequency causes the resultant voltage also to change accordingly. This is analogous to the 48

ELECTRONICS PROJECTS Vo . 18

change of beats produced when two different sources of nearly the same frequency are sounded together. Fig. 2 depicts this condition typically. The resultant voltage thus fluctuates between the maximum and the minimum values, which in turn causes the current to alternate between the minimum and

9V, 200-ohm SPOT relay SPST switch See text 230V AC primary to 0-9, 0-9V, 250mA sec. trans former

the maximum values. Due to this change in current, lamps 11 and 12 begin to flicker at a frequency (f2-fl), that is the lamps dark out and glow up alternately. The dark condition indicates that the two voltages Vl and V2 are exactly in opposite phase with each other relative to the local circuit, resulting in no current through the lamps. Synchronisation is done at the middle of the dark period, and the technique is referred to as 'dark lamp' method. Another revision of this technique is known as 'bright lamp ' method. In this the lamps 11 and 12 are connected as shown in the Fig. 3. Here the lamps will glow the brightest when the two voltages are in phase with the bus-bar voltage because then the voltage across them is twice the voltage of each machine. This technique was adopted due to the fact that lamps are much more sensitive to changes in voltage at their maximum brightness than when they are dark. Hence a sharper and a much more accurate synchronisation is obtained. A major drawback or flaw of these

techniques is that they are suitable only for alternator frequencies of less than 50 Hz, because it is only at these frequencies that we get sufficient time CV 10 sec.) for the human eye to perceive. However for machines with much higher frequencies of the order of 400 Hz, an automated synchronising unit is absolutely essential. The circuit diagram shown in Fig. 4 offers a completely automated and a solid state solution.

sistors T3 and T4 is also included. Transisto r T4 drives relay RLl which in turn activates a contactor to connect the incoming machine to the bus-bars after

Description

p r o p e r

• TO

0

X2

synchronisation. As long as the The circuit essentially consists of a instantaneous differential amplifier comprising tran- values of the sistors Tl and T2 to which the two out- two voltages O 0 put voltage samples from the genera- are not in ~:..._~~~~~~~~~~~~~~~~---'======-~~_J tors are applied. These voltages are fed proper phase Fig. 6: Components layout for the PCB shown in Fig .5. to the base of transistors via sequence with each other, the differen- periods, which in any case occurs only transform ers Xl and X2. The use of tial amplifier ge nerates and delivers when the RPM of the two generators is transformers Xl and X2 is based on the pulses to the switching circuit. The widt h identical, does the switching amplifier assumption that the alternators are of these pulses is directly proportional trigger transistor T4 to activate relay (usually) provided with 10-volt tap to the phase difference between t he two RLl. This relay in turn activates the winding for external use. However, in input voltages Vl and V2. These pulses external contactor, thus successfully. absence of such an arrangement, a are shaped into square waves by clip- connecting the incoming machine onto suitable step-down transformer (230 ping the input signals using the zener the bus-bars. The other secondary (N3) volts primary to about 2.5 volts second- diodes(Ol 7 and D18). Also the output of transformer X3 along with the diode ary) may be con nected across alternator pulses of the differential amplifier are bridge comprising diodes D7 to DlO and outputs. The network comprising positive or negative depending on the capacitor C2 provides the necessary resistors Rl, R2, R6, RS, diodes Dl, D2, phase position of the two input voltages rectified voltage to the switching amplizeners Dl 7 and D1 8 perform the Vl and V2. These are therefore rectified fier circuitry. Switch Sl is included rect ification and the stabilisi ng by the diode bridge comprising diodes to facilitate override feature. functions. Transformer X3 supplies the Dll-D14 before being fed to the switchFurther, in place of the switching necessary voltage to the differential ing amplifier. Capacitor C3 has been in- amplifier, a measuring instrument can eluded at the also be employed which must be input of the connected across the output of the diode switching am- bridge formed by diodes Dll to D14, plifier to avoid directly without the filter network. This fast response measuring instrument would then give of the ampli- an indication which is proportional to fier afte r a the phase angle between the two voltages single zero Vl and V2 because the width of the crossing of the pulses generated by the differential ph ase differ- amplifier cor responds to the phase ence. Transis- difference. tor T4 and diode 021 along Precautions with relay RLl remain turned Before attemptin g the off until and synchronisation, it is to be ensured that unless the t he supply voltage to transformer X3 is p h a s e 200V, the sense voltage of lOV is availcoincidence is able to transformers XI and X2, and the achieved by fre quency of system as well as the Fig. 5: Actual-size PCB layout for the circuit shown in Fig. 4. the switching incoming alternator lies between 50 Hz amplifier pair after rectification and amplifier in conjunction with the differ- and 750 Hz. filtering by t he diode bridge comprising ential amplifier pair. The circuit must be rigidly enclosed Only if the phase sequences of both in a suitable enclosure and must be diodes 03 to 06 and capacitor Cl. A switching circuit comprising tran- the machines are coincident for several firmly positioned, while extreme care ELECTRONICS PROJECTS Vo l. 18

49

needs to be taken during connection with the bus-bars. The contactor ratings must be appropriately chosen to suit the ratings of the machine. The override switch SI must not be activated while the synchroniser is at work and, in case the Reader's Comments:

I want the author to clarify that in the switching circuit how does the transistor T4 Trigger, through at the time of synchronisation the output voltage of differential amplifier is zero?

so

ELECTRONICS PROJECTS Vo . 18

override is desired, extreme care must be taken to ensure that the incoming machine has been manually synchronised to the bus-bar. The winding details for the transformers XI and X2 are :

Primary =640 turns of 0.2mm enamelled copper wire Secondary = 130turns of 0.35mm enamelled copper wire Core = EI, alternate stacking.

A.P. Shardul Jalgaon

conducts via the bias network. When the differential amplifier gives an output, Transistor T3 conducts and Transistor T4 goes into cut-off state. Hence, relay RLl activates and deactivates accordingly. 0

The author R. Sumanth replies:

When the output of differential amplifier is zero, transistor T3 remains in cut off state and transistor T4

0

SET-TOP CONVERTER VINAY CHADDHA

T

here exists a mismatch between imposed with regard to usage of frequenProblem of cableTV channels not TV transmitted signals and cable cies or channels for CATV. Using cable being tunable in normal TV TV relayed frequencies. A major- transmission, two additional bands (one ity of the TV sets sold in India are meant between VHF I and VHF III and anOut of 106 possible channels, the 49 only for TV reception from TV towers.As other between VHF III and UHF) on channels in UHF band are not being used per the frequency chart and standards frequencies reserved for other areas can commercially in India. That leaves us adopted by the Indian government, only be utilised. Thus a total of 106 channels with 57 channels which can be used for three channels in VHF I, eight channels can be used for cable transmission as commercial cable TV transmission. in VHF III and 49 channels in UHF per the government's approved standOut of these 57 channels, only 11 band can be used for TV signals. The ards. channels, (practically around 15) can be other channels and frequencies are reSince it is difficult and expensive to viewed on conventional TVs. Even when served for purposes such as FM radio, use UHF band frequencies for cable some TVs offered 30 or 60 memories, cellular phones, police, military, air traf- transmission, usually around 50 chan- these could not be utilised to tune all fic control, and pagers etc. nels only are transmitted through cable the channels offered by cable TV operain most parts of India. Transmission tors due to limitations of the tuners. The Accordingly the TVs sold till recently above 50 channels requires major invest- extra memories are in fact meant for in our country had tuners which could ment by cable operators. use in conjunction with UHF band frereceive only 11 channels in VHF band and 49 chan--··--·------·----------··--·--·----·--------- - -·-·-··--------------------··--------------------·-·----------- --------.. nels in UHF .. .. band. A few : 1ST MIXER 2ND MIXER : FIXED : 47MHz-550MHz 612.75MHz 668MHz a ddit ional 1111' OSCILLAINPUT 1ST 1ST IF 9RF INPUT )I FILTER IF AMP BPF TOR channels are possible due 55.25MHz=CH.3 (2ND IF) to margins added in tuner design. A total of eight or 12 memory locations 128 TUNER PRE SCALER available for storing tuning informaCHANNEL DISPLAY PSC VT +33V tion can be MAI NS l/P POWER t - - - - +12V used for the 230V AC SUPPLY t - - - - +SV 50Hz 5.27MHz purpose. 1---GND PSC .. ... . .. With the SPST PLL RELAY introduction RELAY TO TV CONTROLS of cable TV SCLK: PROG the scenario MICRO· DIVIDER REMOTE has drastiMAINS INPUT CONTROLLER HAND SET c a 1 l y = changed, since little restriction is Fig. l: Block diagram of set-!Op converter.

.

88

t---

C LIVE ~E

ELECTRONICS PROJECTS Vol. 18

51

"",...,

R19-R26 330QX 8

~ !'-:> ~

~

L

0 ~~·

.'+l Vlnt.

27

to'.~WIAr-- dp

1

9f (Pt;;i-J'>./\N\;--- e

U~v .., w

.., ~ 0 lllW

c::

~~

[]. ...

8

g ,_

.

~~yp

g?i.,,

.,

~ ~~

-CJ

< c

II 0 ., 0

0

.

)-

n 0

;i

S@@ S~?

:3

/

S:ll

~r-1 .>.

6

~L!1i~

c;

0

q

I XTL n

1'

Fig. 3 Actual-size component track layout for the circuit of Fig. 1

tion of base address are illustrated in Table IL The register/port-wise addresses relative to the base address for the card are given in Table III. The basic clock for t imer is generated by 4MHz crystal oscillator formed with inverter gates Nl and N2 functioning in linear mode while gate N3 raises

-----;:11--

!NJ

~~

0-0

£:ll

Fig. 3 Component layout for the PCB ofFig. 2 and 3.

the output to TIL level. If desired, the 4MHz crystal may be replaced wit h a crystal of up to 8MHz frequency without any changes in the oscillator section. The output of crystal oscillator is divided further by dual counter IC9 (7418393) with both its sections cascaded ogether to increase the range of frequencies generated by it. Six of the counter

outputs have been brought to a 12-pin connecter CN3 to allow selection of any three of t he six frequencies by use of jumpers. The selected frequencies including XTAL frequency (4MHz) are terminated on pins marked FO, Fl, F2 and F3 of 16-pin FRC connecter CNl as well, to provide a wide choice of frequencies for operation of the three timers of t ime ELECTRONICS PROJECTS Vol. 18

89

PARTS LIST Semiconductors: !Cl - 74LS244 octal buffer/line driver IC2 - 74LS245 octal bus transreceiver IC3, IC4 - 8255-5 programmable peripheral interface IC5 - 8254 time interval counter IC6(Nl-N6) - 47LS04 hex inverter IC? - 74LS85 4-bit magnitude comparator IC8 - 74LS138 1of8 decoder! demultiplexer IC9 - 74LS393 dual modulo-16 counter IC10(Al-A3) - 74LSOO quad 2-input NAND gate Resistors (all 1 I 4 watt, ±+carbon unless stated otherwise) Rl - 220-kilo-ohm - 560-ohm R2 - 220-ohm R3 - 1.8-kilo-ohm R4 RNW-1 - 4.7-kilo-ohm 6-pin SIP resistor network Capacitors: Cl -ClO

Cll

- O.l µF ceramic disc - lOµF, 16V tantalum

Miscellaneous: XTL-1 - Crystal 4MHz

CNl CN2 CN3 DIP SW-1

90

- Connector 16-pin FRC, male - Connector 50-pin FRC, male - Connector 12-pin FRC, male - DIP switch 6 sections · IC base 40-pin (2 Nos.) - IC base 24-pin (1 No )

ELECTRONICS PROJECTS Vo . 18

interval counter IC4 (8254), using either jumpers for connection to clock pins of the three timers or extending all pins through use of FRC connector and ribbon cable for appropriate utilisation externally. It is not intended to cover the programming aspects of either the 8255-5 PPl or 8254 TIC for which many excellent books, including the 'Microprocessor s And Interfacing by Douglas V. Hall, are easily available. It would suffice to say that 8255-5 PPI with a total of 24 If 0 ports is capable of being operated in three modes which offer differ ent type and number of configurations/facilities including single-bit setJ reset and interrupt control features. Various modes and configurations are selectable by initialising the control port by outputting appropriate control byte. Mode 0 (basic input/output) is the most common and simple mode of its operation with the following characteristics. 1. Sixteen different combinations of inputJoutput ports are possible. 2. Two 8-bit and two 4-bit ports are feasible. 3. Any of the port mentioned above can be input or output . 4. Output ports are latched wh ile input ports are not latched. Similarly, 8254 TIC is capable of operation in six different modes, with facility to configure each of its three counters in the same or different modes

which are again selected by outputting to its control port appropriate control word. The facilities provided by 8254 include binary and BCD counting and status read operation on-the-fly, i.e. without interrupting its counting operation. Further, the 8254 version is capable of operation up to 8MHz. Amongst t he functions which can be implemented with 8254 are: 1. Real time clock. 2. Event counter. 3. Programmable rate generator, 4. One shot generator. 5. Square wave generator. 6. Binary rate multiplier. 7. Motor controller. 8. Waveform generator. The circuit is designed for doublesided PCB. The actual-size solder-side and component-side track layouts are given in Figs 2 and 3, respectively while the component layout for the same is

given in Fig 4. It is desirable to mount 8255-5 and 8254 (lC3 through IC5) on the IC sockets for easy repl acement, if required. Ot her ICs must be tested beforehand and properly soldered. All flux must be thoroughly cleaned with alcohol using a lint-free muslin cloth b efore putting the card to use. And, finally, be careful not to bend the IC pins during insertion in the IC sockets. 0

POWER SUPPLY WITH LOGIC AND BATIERY BACK-UP NAGESH UPADHYAYA

H

ere is a power supply circuit to supply regulated 12 volts devel oped from the mains supply or a back-up battery to fixed type of loads. The circuit is designed with the following features : 1. When mains is available, the mains regulated power is supplied to the load via resistor Rl and diode D6 , Simultaneously, the battery gets charged via di-

ode D5, resistor R2 and N/C contact RLI/ 1 of relay RLl. Resistor R5 limits the charging current to about 300 mA (as specified for the specific maintenance free battery used). Diode D5 isolates the battery from ICl and charger circuit to avoid its discharge when mains goes off. 2. When mains is not available or when mains supply fails, the load is smoothly shifted to the battery via RL2/

2 (N/C) contact of relay RL2 and diode D7.

3. If battery voltage rises to about 13.5 volts (indicating overcharged condition), the charging is cut off. 4. If at any time the battery voltage falls below 10.2 volts (indicating discharged condition), battery supply to the load is cut off. This particular circuit is designed for

RL 1, RL2 = 12V, 2000 DPDT RELAY

15V R1

2

D6 1N4007

GND C1 470µ 25V

Xl 230V AC PRIMARY D1-D4=1N4007 TO 0·18V, 1A SEC ~-------t,_..___ TRANSFORMER

R1 5 1.2K

C2 0.1p

R12

D7 1N4007

R16 ~

12V,200mA

~ SIMULATED LOAD, 60fl5W

39(l

_..._ ___......._-+---t-----+------u

D5 1N4007

ca+ LED 3 ORANGE (BAT.LOW) ~-----