Sie sind auf Seite 1von 200

Electronics Projects

Vol. 23
© EFY Enterprises Pvt Ltd. 2000
First Published in this Edition, April 2007

All rights reserved. No part of this book may be reproduced in any


form without the written permission of the publishers.

ISBN 81-88152-18-8

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
ELECTRONICS
PROJECTS
VOL. 23

EFY Enterprises Pvt Ltd


D-87/1 Okhla Industrial Area, Phase-1
New Delhi 110020
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 Rs 120
published in Electronics For You magazines between 1979 and 1980.
2. Electronics Projects, Vol. 2 to 19 (English version): Yearly compilations (1981 to 1998) of Rs 120 (each)
interesting and useful construction projects and circuit ideas published in Electronics For You.
3. Electronics Projects, Vol. 20, 21, 22 and 23 (with CD): Yearly compilations (1999 to 2002). Rs 150 (each)
4. Electronics Projects, Vol. 16 (fgUnh laLdj.k): Yearly compilations (1995) of interesting and
useful construction projects and circuit ideas published in Electronics For You. Rs 95
(B) OTHER BOOKS
1. Learn to Use Microprocessors (with floppy): By K. Padmanabhan and S. Ananthi (fourth enlarged edition). Rs 180
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 Rs 75
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 Rs 60
in electronic appliances.
(C) DIRECTORIES
1. EFY Annual Guide: Includes Directory of Indian manufacturing and distributing units, Buyers’ Guide and Rs 300 (with CD)
Index of Brand Names, plus lots of other useful information.
2. ‘i.t.’ Directory: First comprehensive directory on IT industry covering hardware, software, telecom, Rs 250 (with CD)
dotcom and training institutes.
3. Technical Educational Directory: Includes course-wise and state/city-wise listings of technical educational Rs 100
institutes in India, besides the alphabetical main directory offering all the relevant information about them.
(D) MAGAZINES
1. Electronics For You (EFY): In regular publication since 1969, EFY is the natural choice for the entire Rs 60 (with CD)
electronics fraternity, be it the businessmen, industry professionals or hobbyists. From microcontrollers to Rs 35 (without CD)
DVD players, from PCB designing software to UPS systems, all are covered every month in EFY.
2. Linux For You (LFY): Asia’s first magazine on Linux. Completely dedicated to the Open Source community. Rs 100 (with CD)
Regular columns by Open Source evangelists. With columns focused for newbies, power users and developers,
LFY is religiously read by IT implementers and CXOs every month.
3. ‘i.t.’ (Information Technology): A monthly magazine for ‘Techies’ and those who want to be. Its readers have Rs 30
two things in common—a background related to IT and the thirst to know more. Topics covered boast technical
depth and aim to assist in better usage of IT in organisations.
4. Facts For You: A monthly magazine on business and economic affairs. It aims to update the top decision makers Rs 50
on key industry trends through its regular assortment of Market Surveys and other important information.
5. ePower: A bi-monthly magazine for the electronic power industry, primarily consists of all electronic power-supply Rs 50
equipment, and their related components and services. A must read for those in this industry and those catering to it.
6. BenefIT: A technology magazine for businessmen explaining how they can benefit from IT. Rs 20
7. 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. Rs 50

Magazines 1 Year 2 Years 3 Years 5 Years


★ Kindly note that these prices can change without any notice. (Monthly) Rs Rs Rs Rs
★ Registered Post or Courier Delivery for Books and CDs: Electronics For You (with CD) 500 920 1,290 1,800
Rs 40 for first copy and Rs 15 for every additional copy of
any book or directory. Electronics For You (without CD) 335 630 880 1,260
Add Rs 50/- on an outside Delhi cheque. Information Technology 300 575 810 1,255
Important: The prices mentioned here are the current prices at Linux For You (with CD) 725 1,395 1,950 3,000
the time of publication; please reconfirm the prices before plac-
ing order, or be prepared to pay the difference—if any. ePower (bi-monthly) 180 360 540 900
★ Payment should be sent strictly in advance by demand draft/money Facts For You 400 700 1,000 1,600
order/postal order in favour of EFY associates Kits‘n’Spares.
BenefIT 190 360 — —
Electronics Bazaar 350 — — —

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

Kits‘n’Spares EFY Enterprises Pvt Ltd Paramount Book Agency


D-88/5, Okhla Industrial Area, D-87/1 Okhla Industrial Area, Phase-1 Arch No. 30 (West Approach)
Phase-1, New Delhi 110020 New Delhi 110020 Mahalaxmi, Mumbai 400034
Phone: 26371661, 26371662 Phone: 26810601-03 Phone: (022) 24925651, 24927383
E-mail: kits@efyindia.com Fax: (011) 26817563, 26812312 Fax: 24950392
Website: www.kitsnspares.com E-mail: info@efyindia.com E-mail: circulations@ibhworld.com
FOREWORD
This volume of Electronics Projects is the twenty third in the
series published by EFY Enterprises Pvt Ltd. It is a compilation
of 23 construction projects and 61 circuit ideas published in
‘Electronics For You’ magazine during 2002.

We are also including a CD with this volume, which not only con-
tains the datasheets of major components used in construction proj-
ects but also the software source code and related files pertaining to
various projects. This will enable a reader to copy these files
directly to his PC and compile/run the program as necessary, with-
out having to prepare them again using the keyboard. In addition,
the CD carries useful software, tutorials and other goodies (refer
‘contents’ in CD).

In keeping with the past trend, all 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 towards 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 responsi-
bility 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. Eprom Contolled Lighting Effect generator................................................................ 3


2. A Versatile Programmable Timer . .............................................................................. 6
3. Two Wire Remote Contolled Unit............................................................................... 9
4. Make Your Own Automobile Stereo............................................................................ 14
5. Simple Digital Clock with Hourly Music.................................................................... 19
6. Make Your own Eprom Eraser with Electronic Timer............................................... 22
7. Multipurpose Absorption Rate Meter for Fabrics........................................................ 26
8. Digital Flow Meter...................................................................................................... 30
9. Z-80 based Auto-ranging LCD Capacitance Meter..................................................... 34
10. Voice Recording and Playback.................................................................................... 44
11. PC Based Dial Clock with Timer................................................................................. 51
12. Electronic Century Calander........................................................................................ 57
13. Electronic Roulette Wheel........................................................................................... 61
14. Number Guessing Game.............................................................................................. 65
15. Picburner:The Programmer for PIC16X8X Microcontroller...................................... 69
16. Interactive Gal Programmer for Beginners.................................................................. 75
17. #95 Debarring Facility for Your Telephone................................................................. 82
18. Microcontroller Based Access Control System........................................................... 86
19. Versatile Programmable Star Display.......................................................................... 96
20. Multichannel Access Control System.......................................................................... 104
21. Microcontroller Based Annunciator System................................................................ 109
22. Intelligent Emmergency Light .................................................................................... 115
23. Truth table Evaluator and Karnaugh Map Plotter........................................................ 120

Section B: Circuit Ideas:

1. Parallel Telephones with Auto Secrecy And Intercom Facility................................... 127


2. Hardware Solution for Two Simultaneous Linear Equations...................................... 129
3. Low power Broadcast Transmitter............................................................................... 130
4. Laser Torch Based Vioce Transmitter and Receiver.................................................... 131
5. Mobile Phone Battery Charger.................................................................................... 132
6. Digital Dice-cum-alpha Display Tosser....................................................................... 133
7. Shortwave Transmitter................................................................................................. 134
8. Fan Speed Control by Clapping................................................................................... 135
9. FM Booster.................................................................................................................. 136
10. Hex-To-Analogue Converter....................................................................................... 137
11. Three-Phase Star-Delta Motor Starter......................................................................... 138
12. Multitester With Audio-Visual Indication.................................................................... 139
13. IR Remote Switch........................................................................................................ 140
14. Ding-Dong Bell........................................................................................................... 141
15. 5.5MHz/10.7MHz IF-FM Signal Generator................................................................ 142
16. Doctor’s Switch........................................................................................................... 142
17. Remote Control Using AC Mains................................................................................ 143
18. High-Power Telephone Extra Ringer........................................................................... 145
19. Music-On-Hold For Telephones.................................................................................. 145
20. Solidstate Switch for DC-Operated Gadgets............................................................... 146
21. Infrared Car Parking Guard......................................................................................... 147
22. FM Band Receiver ...................................................................................................... 148
23. 8085 Kit-Based Relay Control..................................................................................... 149
24. Security Alarm For Motor Bikes................................................................................. 151
25. Mains-Operated Christmas Star................................................................................... 151
26. Single-Plate Touch Switch........................................................................................... 152
27. Dual-speed Fan Driver for Heat-Sink.......................................................................... 152
28. Crystal-Controlled Time Base Generator.................................................................... 153
29. 40-metre CW Transmitter............................................................................................ 154
30. Temperature-Controlled Ni-Cd Battery Charger......................................................... 154
31. Measuring Rigs and Add-Ons For Radio Amateurs.................................................... 156
32. Exclusive-OR Gate Applications................................................................................. 157
33. Wireless Stepper Motor Control.................................................................................. 158
34. Contactless Ringer For Telephones............................................................................. 160
35. Mains Manager............................................................................................................ 160
36. LED-cum-diode Tester................................................................................................. 161
37. Measurement of Transistor hFE ................................................................................... 162
38. Infrared Toy Car Motor Controller.............................................................................. 163
39. Low-cost Battery Charger with high-/low-voltage Cut-off......................................... 164
40. Electronic Guard for Blind.......................................................................................... 165
41. 20M, 4W QRP Transmitter.......................................................................................... 166
42. Priority Indicator For Quiz Contests............................................................................ 167
43. Infrared Remote Control Tester................................................................................... 168
44. Low-cost Cordless FM Microphone............................................................................ 169
45. AC Line Detector......................................................................................................... 169
46. Multi-pattern Running Lights...................................................................................... 170
47. Home Appliance Protector........................................................................................... 171
48. RMS-TO-DC Converter.............................................................................................. 172
49. Cell Phone Call Indicator............................................................................................. 173
50. Keyhole Finder............................................................................................................ 173
51. Remote-Controlled Fan Regulator............................................................................... 174
52. Using Single Telephone on Two Telephone Lines....................................................... 175
53. Digital Clock with Hour Alarm................................................................................... 176
54. Automated Traffic Signal Controller........................................................................... 177
55. Flashing Beacon........................................................................................................... 180
56. Knock Alarm................................................................................................................ 181
57. Crystal-Controlled VFO for 40m Amateur Radio....................................................... 182
58. PC-Based Oscilloscope................................................................................................ 182
59. Intruder Radio Alert System........................................................................................ 185
60. Automatic Porch Light with Melody........................................................................... 187
61. Melody Generator........................................................................................................ 187

SECTION A :
CONSTRUCTION PROJECTS
EPROM-Controlled
Lighting Effect Generator
sunil P.B.

N
owadays various types of light can be used to generate a number of light binary counter CD4040 (IC2) that gener-
ing effect generators are avail effects with different speeds as well as ates/supplies sequential addresses for the
able in the market, but these colours under software control. EPROMs. The output of IC2 increments
produce only two or three effects. In or- The circuit is built around two by one at every clock pulse.
der to achieve a large number of effects, EPROMs (IC3 and IC4) that hold the In order to get 16-bit data outputs
you need to use a microprocessor-based programs for creating different light with 4kB addresses/locations, the address
circuit, which is quite complex and costly. effects. NAND gates N1 and N2 of IC1 lines of both EPROMs are connected in
The EPROM-based circuit presented here (CD4093) produce clock pulses for 12-bit parallel. Fourteen (out of sixteen) data

Fig. 1: EPROM-controlled lighting effect generator circuit

ELECTRONICS PROJECTS Vol. 23 3


lines of EPROMs, after passing through
two pairs of tri-state buffers (74HC244),
are connected to the positive terminals of
common-cathode bi-colour LEDs. Tri-state
buffers are used to produce the colour
changing effect.
To get three colours, common-cathode
bicolour LEDs are used. If only one buffer
pair is selected, the LEDs glow in one
colour only (say, red or green). If both
pairs are selected, the LEDs glow in a
combination of both red and green colours
(amber).
The selection of buffers for colours is
quite simple. When a buffer’s enable input
(pins 1 and 19) is low the buffer is selected,
and when the enable input is high the
buffer is in high-impedance state.
For selecting the buffers, data outputs
BD6 and BD7 of EPROM-B are used. The
same outputs are also used for resetting
the circuit. If both BD6 and BD7 outputs
are high, the AND gate (formed by NAND
gates N3 and N4) gives a high output that
resets the binary counter; thereafter the
operation is repeated.
To write the program, take the glowing
LEDs as binary ‘1’ and non-glowing LEDs Fig. 2: Actual-size, single-side PCB layout

Table I Parts List


An Example Program for Running Light Effect Semiconductors:
AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 BD0 BD1 BD2 BD3 BD4 BD5 BD6 BD7 IC1 - CD4093
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 IC2 - CD4040
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 IC3,IC4 - 2732 EPROM
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 IC5-IC8 - 74HC244 tri-state buffer
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 LED1-LED14 - Common-cathode bicolour
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 LED
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 Resistors (all ¼-watt, ±5% carbon, unless
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 stated otherwise):
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 R1 - 15-kilo-ohm
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 R2-R29 - 470-ohm
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 Capacitors:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 C1 - 2.2µF, 10V electrolytic
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 C2 - 1000µF, 250V electrolytic

Table II as binary ‘0’. Then change these binary and BD0 through BD7 are the outputs of
Addr. Data Data digits into hexadecimal numbers. At the EPROM-B. BD6 and BD7 outputs control
(hex) EPROM-A EPROM-B time of programming, keep the address the colour effect. LEDs give either of the
(hex) (hex) lines of both the EPROMs identical. two colours depending on the low BD6 or
000 80 01 Table I shows a program example low BD7 output. If both BD6 and BD7 out-
001 40 01 for the running light effect. Here AD0 puts are low, LEDs gives a combinational
002 20 01 through AD7 are the outputs of EPROM-A effect of both colours. If both BD6 and
003 10 01
004 08 01
005 04 01 Table III
006 02 01 AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 BD0 BD1 BD2 BD3 BD4 BD5 BD6 BD7
007 01 01
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
008 00 81
009 00 41 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
00A 00 21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
00B 00 11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1
00C 00 09 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1
00D 00 05 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1

4 ELECTRONICS PROJECTS Vol. 23


BD7 are high, the operation of the circuit
is reset/repeated.
Sequential rows in Table I represent
the sequential EPROM addresses, while
sequential binary data lines AD0 through
BD5 indicate whether the individual LEDs
(LED1 through LED14) are on (logic 1) or
off (logic 0). Data bits BD6 and BD7 deter-
mine which buffer pair (IC5-IC6 or IC7-
IC8) is on (logic 0 at their enable pins).
The light effect shown in Table I can
be converted to its hex equivalent and the
same, along with the EPROM addresses
also in hex, are shown in Table II.
If the master frequency is 1 Hz, there
will be one effect per second. If the same
data is written again into the next loca-
tion, the speed reduces. So three times
repetition of the same data at identical lo-
cation, as depicted in Table III, will reduce
the speed to 1 effect over 3 seconds.
In this way the desired speed can be
easily programmed for any effect without
disturbing the master frequency set up by
resistor-capacitor combination VR1-C1.
In all cases, for entering the code, identi-
cal address should be taken for both the
EPROMs. We can reset the circuit from
any location (address). If one wants to Fig. 3: Component layout
reset the circuit from location 150H, one
should enter:
Address BD6 BD7 Table IV
150H 1 1 or XX CX——> Re- AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 BD0 BD1 BD2 BD3 BD4 BD5 BD6 BD7
set 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0
(Note. In this case, data lines AD0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0
through BD5 are ‘don’t care’ or not rel- 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0
evant.) 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0
You can vary the effect speed as
well as the effect if either the alternate speed. A single-sided, actual-size PCB pat-
location becomes zero or the effect is Writing 1 against BD6 and BD7 tern for the EPROM-controlled lighting
repeating in the adjacent location. With (both) of the program results into reset- effect generator circuit is shown in Fig. 2
the sequence as shown in Table IV, you ting and repetition of the complete light- and its component layout in Fig. 3.
can get the dancing effect with a varying ing effect. ❏

Readers’ comments: Hyderabad the output lighting effects. The glowing


Q1. I have following queries: The author, Sunil P.B., replies: LEDs should be taken as binary 1 and
1. How to arrange the output LEDs to A1. With this circuit, it is not possible non glowing LEDs should be taken as
display name, address, location etc? to display the name of a person, loca- binary 0.
2. Can I use EPROM IC27512 to dis- tion and address. The output LEDs can One can use EPROM 27512 instead of
play the names and addresses of about be displayed in different lighting modes 2732 to get more locations (effects), but it
50 persons? under necessary software programs writ- will require some modification in the ad-
D. Sudesh Kumar ten in binary form that corresponds to dress generation circuits.

ELECTRONICS PROJECTS Vol. 23 5


A Versatile
Programmable Timer
R.G. Thiagaraj Kumar and S. Ramasamy

T
his cost-effective programmable set, the whole operation repeats.
Parts List
timer is useful for both industrial In this circuit, no costly magnitude
Semiconductors:
and domestic applications where comparator ICs and/or multiplexers have
precise timing control is required. It is been used. You may also add a display IC1, IC2 - CD4511 7-segment decoder/
latch/driver
designed to provide individually program- unit to show the elapsed time in the cur- IC3, IC4 - CD4518 dual snyhronous
mable ‘on’ and ‘off’ timings of 0-99 seconds rent cycle. up-counter
or 0-99 minutes. The timer can be started IC5 - NE555 timer
IC6 - CD4053 tripple 2-channel
from ‘on’ cycle or from ‘off’ cycle, and also
programmed for single delay or repeat The circuit IC7
analogue multiplexer
- CD4011 quad 2-input
cycle operations. The clock circuit comprises timer NE555 NAND gate
(IC5) wired in astable multivibrator mode. T1-T3 - BC547 npn transistor
T4 - BC557 pnp transistor
Preset VR1 is adjusted to about 1.5 kilo-
Block diagram ohm to get a clock frequency of 1 Hz by
D1-D20
LED1
- 1N4007 rectifier diode
- Red LED
The clock and divider circuits provide ac- using 1% tolerance carbon film resistors DIS1, DIS2 - LT543 common-cathode
curate 1Hz clock (one pulse per second) and tantalum capacitor. (An accuracy 7-segment display
and 0.1Hz outputs (one pulse per minute) of about 1 per cent was achieved in the Resistors (all ¼-watt, ±1% MFR, unless
stated otherwise):
to choose the desired time delays in sec- prototype.) R1-R14 - 470-ohm
onds and minutes, respectively. The de- This 1Hz clock is connected to range R15-R23 - 10-kilo-ohm
sired on-time and off-time delay intervals switch S2 (point S) for choosing the time R24-R27 - 4.7-kilo-ohm
are set with the help of two separate sets delay in seconds and also to the divide- R28, R29 - 47-kilo-ohm
R30 - 100-kilo-ohm
of two thumbwheel switches. by-60 unit formed by dual decade counter VR1 - 10-kilo-ohm potmeter
One of the two set delay intervals, CD4518 (IC4). The output from IC4, which Capacitors:
depending on the start mode (initially on/ gives one pulse per minute, is connected C1 - 10µF, 25V tantalum
off), is selected and compared with the to point ‘M’ of switch S2 for choosing the C2-C4 - 0.01µF ceramic disk
counter output. When the set value and time delay in minutes. LED1 in the front Miscellaneous:
the counter output match, an output is panel blinks to provide a visual indication TWS1-TWS4 - Thumbwheel switch
S1 - DPDT switch
produced, which is used to momentarily of the progress of the time toward the set S2-S5 - SPDT switch
reset the counters. The other set of thum- value. S6, S7 - Push-to-on switch
bwheel switches is activated through the Preset VR1 (10 kilo-ohm) is used to RL1 - 12V, 200-ohm, 1 c/o reed
relay contacts. trim the output frequency of the timer to relay
RL2 - 12V, 200-ohm, 2 c/o relay
At the elapse of the set time, the exactly 1 Hz, while IC4 (CD4518) is used Pz - Piezobuzzer
control logic verifies the operation mode to divide the input 1Hz clock by 60 to L1, L2 - NE2 neon bulb (with built-
control to determine further operation. If provide an output of one pulse per minute in resistor)
‘single cycle’ mode has been set, the opera- using the reset signal generated by block- - Plug 3-pin
- Top 3-pin
tion stops. If ‘repeat cycle’ mode has been ing diodes D17 and D18 in conjunction
with transistor T4.
Only at the count of 60 (one-second
pulses), both pins 12 and 13 go high to cut
off transistor T4. As a result, the collector
of transistor T4 and reset pins 7 and 15 of
IC4 are pulled high via resistor R16 to re-
set the counter, which thus repeats count-
ing to provide sharp pulses at 60-second
(one-minute) intervals at point ‘M’ of
switch S2. These pulses per minute are
used as clock signal for the subsequent
counter stage formed by another dual
synchronous decimal up-counter CD4518
(IC3) that is used to count the incoming
Fig. 1: Block diagram of the programmable timer clock pulses from the clock stage.

6 ELECTRONICS PROJECTS Vol. 23


Fig. 2: The programmable timer circuit

An optional 7-segment display unit thumbwheel switch set matches the isolation of the high-power (mains voltage)
based on two CD4511 (IC1 and IC2) is con- counter output, a logic ‘high’ state is circuit and the logic control circuit. You
nected to this counter’s outputs to display established at the common terminal of may use a small on-board (PCB mount
the elapsed time during the current cycle. the switches. This high signal is used to type) relay (RL1) for logic control and a
Thumbwheel switch sets TWS1-TWS2 change the state of the output through heavy-duty relay (RL2) for load operation
and TWS3-TWS4 are used to set the time the RS flip-flop formed by CD4011 (IC7). control.
interval in the ‘normally on’ and ‘normally Simultaneously, relay RL1 is activated An optional buzzer circuit, as shown in
off’ modes, respectively, of relays RL1 and or deactivated, which results in the gen- Fig. 2, can be employed to raise an audible
RL2. eration and application of a short reset alarm whenever the load circuit is on. The
At any given instant, the common pulse to the counter and selection of the entire circuit can be operated from a 12V,
terminal of one of the two switch sets is other set of thumbwheel switches. The 1A DC adaptor.
connected to +12V supply through relay operation continues if the ‘repeat’ mode An actual-size, single-side PCB for the
RL2 contacts via a 10-kilo-ohm resistor, has been selected through switch S4 in circuit is shown in Fig. 3 and its compo-
depending on the operational mode. The position ‘A’. The ‘single cycle’ mode is se- nent layout in Fig. 4.
8, 4, 2, 1 outputs of these thumbwheel lected via switch S4 in position ‘B’.
switches are connected via diodes D1 Relays RL1 and RL2 are activated
through D8 and D9 through D16 to the by the flip-flop output simultaneously. Operation
binary outputs of IC3. These relays, with associated relay driver The unit has to be set in the following
When the set value of the active transistors, are used to provide complete sequence for use:

ELECTRONICS PROJECTS Vol. 23 7


(a) Continuous ‘on’ or ‘off’ mode thumbwheel switches (TWS1 through 6. Switch on S3 if an audible alarm is
1. Initially set switch S1 to ‘stop’. TWS4). required during ‘on’ intervals.
2. Select repeat mode using switch S4 5. If the operation has to commence 7. Now start the timer by flipping
in position 1. with the off interval, momentarily press switch S1 to ‘start’.
3. Set the desired range in seconds/ switch S7 (reset). If the operation has to (b) Single ‘on’ or ‘off’ operation
minutes using switch S2. commence with ‘on’ interval, momentarily mode
4. Set the ‘on’ and ‘off’ time inter- press switch S6 (set) and set S4 to position 1. Initially set switch S1 to stop.
vals (delays) using the corresponding ‘A’ (for both these conditions). 2. Select ‘single cycle’ mode using
switch S4 in position
‘B’.
3. Set the desired
range in seconds/min-
utes using switch S2.
4. Set ‘on’ and ‘off’
time intervals (de-
lays) using the corre-
sponding thumbwheel
switches (TWS1
through TWS4).
5. If the desired
operation has to com-
mence with the de-
layed ‘on’ (initial ‘off’)
interval, momentarily
press switch S6 (Re-
set) and put switch
S5 to position ‘A’. If
the operation has to
commence as delayed
off (initial on), momen-
tarily press switch S7
(Set) and put switch S5
to position B.
Fig. 3: Actual-size single-side PCB layout for the circuit 6. Switch on S3
if an audible alarm
is required during on
intervals.
7. Now start the
timer by flipping
switch S1 to start.
To achieve a high-
er accuracy, you may
employ IC CD4060
in place of NE555
for clock generation,
because CD4060 can
employ an external
crystal (for better ac-
curacy and stability)
in its oscillator circuit
and has a chain of 14
binary counter/divider
stages. A 32.768kHz
crystal provides an ac-
curate 2Hz clock out-
put at pin 3 of CD4060,
which can be divided
by 2 in a subsequent
counter stage to get
1Hz clock. ❏
Fig. 4: Component layout

8 ELECTRONICS PROJECTS Vol. 23


two-wire Remote
Control Unit
Naveen Thariyan

T
his 2-wire remote unit can con tinguish between long and short pulses. the rectified output developed from the
trol up to six appliances from one Long pulses are used to switch on the AC mains using step-down transformer
master unit. It is economically appliances, while short pulses are used X1, followed by a bridge rectifier and
built using commonly available discrete to switch off the same appliances. The smoothing capacitor C1. Timer IC1 is
ICs. master and slave units are connected us- wired as an astable multivibrator with
The appliances can be switched on ing the common negative line of the mas- a measured time-period of 850 ms (‘on’
or off selectively by using the corre- ter unit to the mains neutral line of the period of 100 ms and ‘off’ period of 750
sponding switches (S1 through S6) and slave unit, and pulsewidth-modulated ms), with component values as shown
then pressing ‘start’ button S7. Within output from the master unit to the signal in Fig. 1.
about five seconds, all the slave units input line of the slave unit. Waveform 1 in Fig. 3 shows IC1’s
are switched on/off as per the selection output. Diode D5 is used to limit the
made at the master unit. ‘on’ period of IC1. Reset pin 4 of IC1 is
The switching on/off function is Description controlled by the latch circuit comprising
achieved by using pulsewidth modulation Master control unit (Fig. 1). This unit NAND gates N1 through N3. Since N3
at the master control unit and suitable comprises six ICs (including a 5V regu- output normally goes low on switching on
decoding logic at the slave unit to dis- lator). IC 7805 (IC6) is used to stabilise of the master control unit, IC1 is initially

Fig. 1: Master control unit

ELECTRONICS PROJECTS Vol. 23 9


Fig. 2: Slave unit

inactive (inhibited). 6 of gate N3 is low. Thus green LED1 is age at its reset pins 2 and 3. IC1 is also
The latch output at pin 3 of gate N2 on, while red LED2 is off. Binary counter reset due to logic ‘0’ voltage at its reset
is initially high, while the output at pin 7493 (IC3) is reset due to logic ‘1’ volt- pin 4.
IC3 is a 4-stage binary coun-
ter with three flip-flops forming a
3-bit binary counter. The remain-
ing flip-flop can be used inde-
pendently, and it is triggered at
the trailing edge of the last count
of the 3-bit counter stage, which
makes pin 12 (Q0) go high for
a brief period. The counter flip-
flops in IC3 advance on negative-
going transitions of the clock. To
synchronise the circuit operation,
the clock input to IC3 is inverted
by NAND gate N4.
To activate oscillator IC1 and
counter IC3, momentarily press
‘start’ switch S7, which causes
the latch outputs to be reversed.
Green LED1 goes off, while red
LED2 goes on.
Q3 output of IC3 remains low
for the first four clocks. It goes
high at the fifth clock pulse and
low at the end of eighth clock
pulse, triggering the single flip-
flop in IC3. As a result, pin 12 of
IC3 goes high to reset the latch
to its initial state, inhibiting IC1
and IC3. It stays in this state
until ‘start’ switch S7 is again
pressed to repeat the cycle.
The binary outputs of IC3 are
connected to the address inputs
of 8-bit data selector/multiplexer
Fig. 3: Output waveforms corresponding to on/off positions of switches

10 ELECTRONICS PROJECTS Vol. 23


ing transistor T1 in series with re-
sistor R5. When pin 6 is at low level
(corresponding to the device ‘on’),
transistor T1 does not conduct and
as such R6 is not shunted by R5. As
a result, when negative-going edge
of oscillator IC1 triggers pin 2 of
mono IC5, it gives a long pulse of
approximately 650 ms. If pin 6 of
IC4 is at high level (corresponding
to the device ‘off’), the transistor
conducts and R5 shunts R6 to give
approximately 100ms output pulse.
In Fig. 3, waveforms 2 and 3 depict the
outputs with all device switches in ‘on’ and
‘off’ state, respectively. In practice, some
switches may be ‘off’ while others may be
‘on’. Hence the output pulsewidths will be
a mixture of the two types of pulses. These
pulses are used synchronously to switch on
or switch off the corresponding devices by
the slave unit.
Slave units (Fig. 2). All slave units
Fig. 4: Actual-size, single-side PCB layout for the circuit in Fig. 1 and part of Fig. 2 are built around CD4017 (IC7). IC7’s out-
puts P1 through P6 correspond to switches
S1 through S6 in the master control unit,
and are used to control individual appli-
ances. The circuit shown within dotted
lines in Fig. 2 is required to be repeated
for each of the six appliances.
The power supply for each slave unit is
derived from the mains itself, using resis-
tor R17, diode R10, zener ZD1, and capaci-
tors C15 and C16. The supply for IC7 can
be taken from any one of the six circuits
within dotted lines, ensuring that the neu-
tral supply for each slave unit is common
for all appliances. Also, make sure that
live and neutral leads of slaves are never
interchanged, to avoid short-circuiting of
neutral and live wires connected to differ-
ent appliances.
Each slave unit is capable of driving
about 1kW load. For higher loads (up
to 2 kW), you may replace triac BT136
with BT138. The wiring from AC supply
through the load and the triac should meet
current rating of the load.
The master control unit’s outputs cor-
Fig. 5: Component layout for the PCB of Fig. 4 responding to data I1 through I7 of IC4
(74151) appear sequentially at output
IC 74151 (IC4). IC4’s output at pin 6 is in +5V position (to turn the appliance pin 3 of monostable IC5. These outputs
the complement of data selected as per on) or in 0V position (to turn the appli- are connected to the junction of diode D7,
the binary address, which moves from 0 ance off). When a switch is in +5V or clock pin 14 of IC7, and capacitor C11 in
through 7 (000 through 111 binary) when 0V position, the output of IC4 is low or the slave unit.
start switch S7 is pressed. high, respectively, for one cycle-duration Initially, with 0V input, transistor T2
Data input pins 4 and 3 (I0 and I1) of the clock (850 ms) corresponding to is in cut-off state and as such pin 15 of
are not used due to certain reasons (ex- the address selected through address IC7 is reset because of the high voltage
plained later). The data at other input pins of IC4. available via resistor R11. P1 output at
pins can be selected with the help of Output pin 6 of IC4 is used for modu- pin 3 is high in reset condition. However,
switches S1 through S6 that are either lating the output of monostable IC5, us- when the first positive-going pulse ar-

ELECTRONICS PROJECTS Vol. 23 11


Parts List
Semiconductors:
IC1 - NE555 timer
IC5, IC8 - 7555 timer
IC2 - 7400
IC3 - 7493
IC4 - 74151
IC6 - 7805, +5V regulator
IC7 - 4017 decade counter
IC9, IC10 - CD4011
TRIAC1 - BT136
T1 - BC107 npn transistor
T2 - BC548 npn transistor
D1-D6 - 1N4001 rectifier diode
D7-D10 - 1N4007 rectifier diode
ZD1 - 5.1V, 250mW zener diode
LED1 - Green LED
LED2 - Red LED
Resistors (all ¼-watt, ±1% MFR, unless
Fig. 6: Actual-size, single-side PCB layout for the circuit (within dotted lines) in Fig. 2
stated otherwise):
R1 - 2.2-kilo-ohm
R2 - 22-kilo-ohm
R3, R7, R11,
R18, R12, R14 - 10-kilo-ohm
R4, R10 - 1-kilo-ohm
R5 - 5.6-kilo-ohm
R6, R13 - 47-kilo-ohm
R8, R9, R16 - 470-ohm
R15 - 4.7-kilo-ohm
R17 - 12-kilo-ohm, 10-watt wire-
wound
R19 - 33-kilo-ohm
Capacitors:
C1 - 470µF, 16V electrolytic
C2, C15 - 0.22µF polyster
C3 - 47µF, 16V electrolytic
C4, C6, C13 - 0.01µF ceramic disk
C5, C9 - 10µF, 16V electrolytic
C7, C12 - 0.1µF ceramic disk
C8 - 100µF, 16V electrolytic
Fig. 7: Component layout for the PCB of Fig. 6 C10 - 0.15µF polyster
C11 - 6.8µF, 16V electrolytic
C14 - 22µF, 16V electrolytic
rives via diode D7, 100µF capacitor C8 to data input I2 and so on, in the master C16 - 220µF, 16V electrolytic
starts charging slowly and as such the control unit. Miscellaneous:
first clock pulse goes waste (as IC7 is As soon as the pulse corresponding X1 - 230V AC primary to
0-7.5V,
still reset). to switch S1 arrives at the slave unit, P1 250mA secondary trans-
Only the pulses corresponding to output of IC7 falls and high shifts to the former
data input I2 and subsequent data in- next output P2. Output P2 will fall when S1-S6 - Single-pole, 2-way switch
the pulse corresponding to switch S2 (in (SPDT)
puts are able to clock IC7. This is why S7 - Push-to-on switch
the master unit’s switch S1 pole corre- the master unit) arrives. Fig. 3 shows con-
sponding to appliance No. 1 is connected nection of appliance No. 2 to the circuit sequentially arriving at the input of ca-
within dotted line. (Only outputs P1, P2, pacitor C11 are differentiated by C11-R12
and P3 corresponding to switches S1, S2, combination and only the trailing-edge
Table I part of the input pulses produces a 100ms
Switch Master IC7 Final
and S3, respectively, are shown in Fig. 3.
(S1-S6) control falling (at pin The pulsewidths of outputs P2 through wide output pulse at pin 11 of gate D.
10
position pulsewidth output of gate P6 equal oscillator IC1’s clock period of Thus a wide input pulse (corresponding to
G)
850 ms.) ‘on’ position of a switch) produces a long
S1=On 650 ms P1 H Once P2 falls, it triggers monostable delayed 100ms pulse, while a short input
S1=Off 100 ms P1 L IC8. The trailing-edge output of IC8 pulse (corresponding to ‘off’ position of
S2=On 650 ms P2 H
is used to trigger another monostable the same switch) produces a less delayed
S2=Off 100 ms P2 L
S3=On 650 ms P3 H formed by NAND gates A and B followed 100ms pulse.
S3=Off 100 ms P3 L by gate C (used only as an inverter). Fig. 3 shows these pulses for only
S4=On 650 ms P4 H Both the monostables are adjusted to the appliance controlled by switch S2
S4=Off 100 ms P4 L (output P2 in the slave unit); the pulses
S5=On 650 ms P5 H
produce about 400ms wide pulses that
S5=Off 100 ms P5 L are shown as Mono 1 and Mono 2 out- corresponding to switches other than S2
S6=On 650 ms P6 H puts in Fig. 3. don’t affect the operation of the specific
S6=Off 100 ms P6 L The pulsewidth-modulated pulses slave unit, since these delayed pulses at

12 ELECTRONICS PROJECTS Vol. 23


the output of gate D are NANDed in triggers the triac to activate the load, state of respective appliances.
gates E and F with Mono 1 and Mono 2 while a low output cuts off the triac and The actual-size, single-side PCBs for the
monostable outputs, which are uniquely the connected load. The outputs from the master control unit in Fig. 1 (including part of
positioned for each output (P1 through master control unit and respective slave the slave circuit that is outside the dotted lines
P6) from IC7. units for switches S1 through S6 posi-
in Fig. 2) and the slave unit (within dotted
The final latch is formed by NAND tions are shown in Table I.
gates G and H. Output at pin 10 of gate Depression of ‘start’ switch a second lines in Fig. 2) are shown in Figs 4 and 6, with
G goes high/low for on/off position of time, without changing the position of the component layouts in Figs 5 and 7, respec-
switch S2. The high output of gate G switches S1 through S6, doesn’t alter the tively. ❏

ELECTRONICS PROJECTS Vol. 23 13


Make Your own
Automobile Stereo
Turjasu Pyne

A
utomobile stereos have become is stepped down/regulated by 5V regula- ics Projects Vol. 20) issue used Sony’s CX-
quite common nowadays. The au- tors (7805). A1019S FM front-end chip and TEA1330
tomobile stereo circuit described The preamplifier and FM radio stereo decoder. The circuit published in
here is free from the complexities of com- (Fig. 2). This contains the cassette deck’s Sept. ’95 issue of EFY uses TEA5591A
mercially available automobile stereos magnetic head, 2-channel preamplifier for FM front-end chip. The audio output
and uses easily available ICs and other car stereos (IC LA3161), power supply, available from the chip’s pin 11 can be fed
components. It comprises preamplifier and other discrete components as well as to the stereo decoder in a similar manner
and FM radio, audio power amplifier, and 3-pin connector con1 for connecting stereo to obtain stereo output.)
power supply sections. output from FM receiver. The FM receiv- Preamplifier LA3161 (IC3) is com-
The block diagram of the automobile er is wired around a single FM receiver monly available for automobile stereo ap-
stereo system is shown in Fig. 1. The front-end chip (Sony’s CXA1019S, Philips’ plication and provides excellent signal-to-
output from the stereo play head is ampli- TEA5591, etc) followed by an FM stereo noise ratio. Pin configuration and internal
fied by LA3161 preamplifier and brought decoder chip (TEA1330 or TA7343). You functional block diagram of LA3161 are
to 6-pin dual-in-line (DIL) switch, which may use any one of
selects between the deck or FM receiver the FM receiver cir- Table I
and connects the left and right outputs to cuits published earlier LA3161 Pin Configuration
power amplifier stages (one each for left in Jan. ’99 (or Elec- Pin No. Signal RACV
and right channels) built around LA4440 tronics Projects Vol.
1 Input from audio head for right channel 0.6
ICs in bridge configuration. 20) and Sept. ’95 (or 2 Negative feedback to right channel 0.6
The left- and right-channel outputs Electronics Projects 3 Output of right channel to audio amplifier 2.1
from the power amplifiers are connected Vol. 16) issues of EFY 4 Positive supply voltage 4.0
to woofer-tweeter combinations via or purchase a ready- 5 Ground 0.0
6 Output of left channel to audio amplifier 2.1
crossover networks. Power supply for the made FM plate from 7 Negative feedback to left channel 0.6
power amplifier is directly taken from the the market. (The FM 8 Input from audio head for left channel 0.6
automobile’s battery, while the battery receiver published in Note. RACV stands for the RMS voltages measured in AC range
supply for preamplifier and FM sections Jan. ’99 (or Electron-

shown in Fig. 3. The


play-head output is
connected to pin 1
(for one channel) and
pin 8 (for the other
channel) through
capacitors C3 and
C4, which block the
DC and pass audio
signal into the IC.
Capacitors C1 and
C2 are used for noise
suppression.
Pins 2 and 7 are
the negative feed-
back pins connected
to the corresponding
audio output pins 3
and 6 through the
Fig. 1: Block diagram of the automobile stereo system

14 ELECTRONICS PROJECTS Vol. 23


avoid any ground
loop noise and/or
hum noise.)
A separate
5V regulator
7805 (IC2) is
used for supply-
ing power to the
FM circuit via
connector Con.
3. A heat-sink is
required for the
regulator ICs
(IC1 and IC2).
The 12V sup-
ply for the deck
motor is wired
via the mechani-
cally operated
leaf-spring type
switch (in the
deck’s mecha-
nism).
The power
amplifier sec-
tion (Fig. 4).
This section
uses two com-
monly available
Fig. 2: Front-end schematic including preamplifer, FM receiver connections, and power supply arrangement LA4440 ICs that
have widespread
feedback networks. Negative feedback It is filtered using 4700µF capacitors C14 audio applications, as these can deliver
pins 2 and 7 are also connected to the through C16 to keep the voltage ripple-free. up to 40W PMPO at the highest power-
ground through a 150-ohm resistor and a The filtered supply is routed to the power consumption level. Both LA4440 ICs are
33µF capacitor each. The outputs from the amplifier section, with a part of it used configured for bridge operation. Pin con-
preamplifier are available at pins 3 and for developing low voltage (5 volts) for the figuration and internal functional block
6 of LA3161 for left and right channels preamplifier and FM receiver. diagram of LA4440 IC are shown in Fig.
respectively. The positive power supply to pream- 5. The pin-wise signal details of LA4440
Preamplifier ICs are extremely deli- plifier IC LA3161 is provided from +5V IC are described in Table II.
cate. So, while soldering IC LA3161 to the regulator IC1 at pin 4, while pin 5 is (EFY Lab note. The output of LA4440
PCB, avoid excessive heating of the pins. grounded. (The effective ground track is typically 6-watt rms per channel in dual-
To avoid any chances of thermal runaway resistance between the audio power IC channel configuration. It can be boosted to
during soldering, hold the IC on the PCB ground and the preamplifier IC ground 19-watt rms in bridge configuration used
using long-nose pliers that would act as a should not be greater than 3 ohms, to here. The PMPO is not a reliable method
temporary heat-sink. (Note. of specifying the power
No heat-sinks are needed output.)
Table II
for IC LA3161 during actual The recommended
operation). Pinout signal LA4440 Pin-Out Signal Details supply for the IC is 13.2
details of LA3161 are given Pin No. Signal RACV volts, with the imped-
in Table I. 1 Negative feedback -1 for the IC 1.3 ance of the speaker
In place of LA3161, 2 Volume input pin for operation of the left channel 0.0 lying between 4 and
3 Preamplifier ground/chassis earth 0.0
you may also use substi- 8 ohms for the bridge
4 Audio muting facility, pin needs positive voltage —
tutes LA3160, M5152L, or 5 Decoupling capacitor 13.4 configuration. Apart
KA6625S. (For IC KA6625S, 6 Volume input pin for operation of the right channel 0.0 from its own heat-sink
pin 9 needs to be bent up 7 Negative feedback –2 for the IC 1.3 (included at posterior),
before insertion into the 8 Power amplifier ground pin - right 0.0 LA4440 requires an
9 Bootstrap operation for right channel 12.21
PCB.) 10 Audio signal for speaker-right 6.8 additional heat-sink of
Power supply (refer 11 Power supply to the IC for driving the IC within 12-14 volt 13.51 400 grams to prevent
Fig. 2). The 12V supply from 12 Audio signal for speaker-left 6.8 overheating of the IC
the automobile battery is ter- 13 Boostrap operation for left channel 12.21 and thermal runaway.
14 Audio grounding or ground pin for normal operation-left 0.0
minated at connector Con. 2. The ripple-free supply

ELECTRONICS PROJECTS Vol. 23 15


is applied to the IC at vent any motorboating type sound at
pin 11. Pins 3, 6, 8 and the output. Pins 5 and 7 are grounded
14 are grounded with the through the capacitance network. Pins
ground track to avoid any 9 and 13 are the bootstrap pins for the
kind of noise and ground corresponding channels, which are con-
loop. nected to the audio driver signal output
Pin 2 has been used pins 10 and 12.
for the input to the IC. In The audio signal from the preampli-
place of pin 2, you may fier or FM radio is amplified by the power
also use pin 6 to accept amplifier and fed to the speakers (woofer
the audio signal from the and tweeter arrangement) via a crossover
preamplifier stage. If pin network. Typically, the voltage gain of
6 is used, pin 2 must be LA4440 is 51.5 dB. Volume controls (VR1
grounded for optimum op- for the left channel and VR2 for the right
eration of the IC and vice channel) for obtaining the required audio
versa. The IC’s output output from the power amplifier are shown
for driving the speaker is in Fig. 2. Digital volume controls are not
taken from pins 10 and used for the circuit, as these are compli-
12 (as the load is bridged cated to build and may cause distortion
between these two output of sound output. The click noises during
pins). switchover disturb the listener. Pin 1
Fig. 3: Pin configuration of LA3161 and its internal functional An R-C network is is bridged with pins 10 and 9 through a
block diagram attached to each of the resistor-capacitor network.
speaker outputs to pre- The IC must be provided with a
thermal back-
up (400 gm
to 2300 gm of
heat-sink) that
dissipates the
generated heat
during opera-
tion. Note that
the entire set-
up gets heated
due to the auto-
mobile engine’s
heat.
(EFY Lab
note. A typical
two-way cross-
over network
giving a roll-
off attenuation
of 12 dB per
octave is used
for connecting
the woofer and
tweeter, assum-
ing a cross-over
frequency of
about 900 Hz.
A low-pass LC
filter is used
for the woofer,
while a high-
pass LC filter
is used for the
tweeter. The
inductor and
capacitor val-
Fig. 4: Power amplifier ues can be cal-

16 ELECTRONICS PROJECTS Vol. 23


Parts List
Semiconductors:
IC1, IC2 - 7805C, +5V regulator
IC3 - LA3161 preamplifier
IC4, IC5 - LA4440 power amplifier
D1 - 1N4007 rectifier diode
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1 - 1-kilo-ohm
R2, R5, R9, R14 - 10-kilo-ohm
R3, R6 - 150-ohm
R4, R7 - 100-kilo-ohm
R8, R10, R13,
R15 - 56-ohm
R11, R12, R16,
R17 - 2.2-ohm, ½-watt
VR1, VR2, VR3 - 100-kilo-ohm potmeter
Capacitors:
C1, C2 - 3.3kpF ceramic disk
C3, C4 - 10µF, 25V electrolytic
C5, C17 - 1000µF, 16V electrolytic
C6, C7 - 10nF, ceramic disk
C8, C9, C12,
C13, C18, C28 - 2.2µF, 16V electrolytic
C10, C11 - 33µF, 16V electrolytic
C14, C15, C16 - 4700µF, 25V electrolytic
C19, C20, C21, C22,
C24, C29, C30,
C31, C32, C34 - 100µF, 25V electrolytic
C23, C25, C33,
C35 - 0.1µF ceramic disk
C26, C27, C36,
C37 - 33µF, 25V electrolytic
Inductors:
L1, L2, L3, L4 - 1mH (145T, 32SWG on
10mm ferrite core)
Miscellaneous:
Fig. 5: Pin configuration of LA4440 and its internal functional block diagram - One common heat-sink for
LA4440
- Heat-sink for regulators IC1
Table III and IC2
S1 - Selector switch, 6-pin DIL
Troubleshooting connector
Symptom Possible Faults and Cure CON1, CON2 - 3-pin self-locking PCB
connector (male and fe-
1. Set dead, no audio output Check the battery terminal voltage, LM7805 input/ male)
from power amplifier output, LA4440, speakers, power track of PCB for cuts/ CON3 - 2-pin self-locking PCB
shortings. Check wires and coils for continuity, check connector (male and fe-
volume control terminals (for short/open), check play- male)
head terminals for damage or open/short. - FM receiver kit
2. AF power amplifier alright, Check record/play head in your deck mechanism and - Cassette deck mechanism
but no sound output from replace the same if it is not working properly. Check according to cabinet with
LA3161 preamplifier LA3161; replace it if required. Check track of stereo play and record
preamplifier section. Check the output from LM7805C heads (300-ohm) and
Motor - 12 volts
(+5 volts) to LA3161. Check 100-kilo-ohm resistors
- 2-core shielded wire for
between pins 2 and 3 as well as pins 7 and 8. volume controls
3(i) No FM signal present Check your FM (or FM/AM) kit by following the manual - One 3-wire shielded cable
provided with it. for stereo-head output
(ii) No audio output from Usually, the fault lies with FM receiver. Replace FM Loudspeakers:
the FM section receiver chip. LS1, LS3 - 4-ohm, 40W (tweeter)
LS2, LS4 - 4-ohm, 60W (woofer)
(iii) Output from the FM section If audio output from the FM section is absent even, - 12V car battery
is not heard at the speakers; though the FM kit is alright, check your mono-to-stereo
FM kit checked Ok demodulator chip. Also check FM-/tape-selector switch
S1. Check IC2 (LM7805C) regulator output. Testing. After assembling the pream-
plifier and power amplifier sections on
the PCB, connect the audio source (like
culated using the relationships crossover frequency in Hz.) pocket radio or CD-ROM drive head-
L=L1 =L2=L3=L4= henry and An actual-size, single-side PCB pat- phone’s output) to the input of preampli-
C=C26=C27=C36=C37= farad, tern for the circuits in Figs 2 and 4 is fier through a potentiometer. Adjust the
respectively, where RL is the woofer/ shown in Fig. 6 and the component layout potentiometer for audio output and turn
tweeter impedance in ohms and FC is the in Fig. 7. on the input source. A loud amplified

ELECTRONICS PROJECTS Vol. 23 17


sound of the input audio is heard from
the speakers.
The output may be a bit distorted,
depending upon the input source (better
with FM audio/CD audio signal). To trou-
bleshoot the problems associated with the
operation, refer Table III for diagnosis and
correction.
When all the sections of the circuit
have been wired and tested, proceed for
adjustments and optimisation as follows:
1. Place/fix the entire kit into a suit-
able cabinet containing the deck mecha-
nism, volume controls, and the required
peripherals. Connect the audio-head to the
input of the preamplifier.
2. The supply to the cassette motor
must be provided from the battery. Recti-
fier diode D1 (1N4007) is connected across
the terminals of the motor to eliminate any
back emf produced by the motor. Ensure
that this diode is connected in reverse
biased condition, as shown in Fig. 2.
3. The antenna of the FM receiver sec-
tion must never be placed in direct contact
with the metallic body of the car. On the
contrary, it must be insulated from the
same. Usually, commonly available col-
lapsible whip antennae are suitable.
4. The FM receiver kit has to be
Fig. 6: Actual-size, single-side PCB layout for automobile stereo circuit
connected to the circuit as follows: Con-
nect the power supply wires of FM to
the outputs (+5 volts and ground) of the
LM7805C via connector Con. 3. Feed the
audio output of the FM kit (stereo) directly
into the power amplifier (not through the
preamplifier IC) via connector Con. 1, so
that it is directly connected to the power
amplifier through tape-/radio-selector
switch S1 (2-pole, 2-way). The switch has
to be mounted on the cabinet.
5. After all other sections are com-
pleted and adjusted for optimum perform-
ance, adjust the FM receiver kit. There
are normally two adjustments required.
First, adjust the preset placed next to the
mono-to-stereo converter IC (TA7343A,
KA6225S, TEA1331, KIA6224SA, etc).
When the FM stereo LED glows, the kit
provides FM stereo sound. Second, adjust
the trimmers of the FM receiver sec-
tion (TEA5591, CXA1019S, CXA1191M,
CXA1111S, etc) for clear reception. This
adjustment is not required if a variable
1/2J Gang capacitor for external tunning
(via knob) is used in the FM kit. This
gang capacitor has to be perfectly fitted
on the cabinet for external adjustments
and control.
Take care that the FM receiver power
Fig. 7: Component layout for the PCB supply doesn’t exceed 9 volts. ❏

18 ELECTRONICS PROJECTS Vol. 23


Simple Digital Clock
with Hourly Music
Sunil P.B.

T
his 12-hour digital clock with digital clock with hourly music and AM/ Hz) output at pin 1 of NAND gate N2.
hourly music and AM/PM display PM display. The heart of the circuit is a This pulse is applied to clock input pin 1
can be easily constructed using precision 1-minute master oscillator sec- of decade counter-cum-7-segment decoder/
readily available discrete chips. In some tion that is built around 14-stage counter/ driver CD4033 (IC1) and also the reset
of the circuits earlier published in EFY, divider/oscillator CD4060, 12-stage binary pins of CD4060 and CD4040 ICs.
12:00 hour was displayed as 00:00 hour. counter CD4040, and 4-input AND gate Two CD4033 ICs (IC1 and IC2) are
The presented circuit overcomes this 1/2 CD4082 (N2). cascaded to get unit’s and ten’s digits of
drawback. The clock accuracy is dependent on the minute display. After counting 59, the
1-minute master oscillator CD4060 that next leading edge of the clock pulse resets
divides the crystal frequency by 16,384 to IC2 (CD4033).
The circuit get 2Hz output, which is further divided The resetting of IC2 after the count
Fig. 1 shows the circuit diagram of the by 120 to get 1 pulse per minute (0.016 of 59 is achieved by using AND gates N4

Fig. 1: The circuit of digital clock with hourly music

ELECTRONICS PROJECTS Vol. 23 19


Decoded Segment Outputs of ICD4033
Count Segment outputs Carry
a b c d e f g Co
0 1 1 1 1 1 1 0 1
1 0 1 1 0 0 0 0 1
2 1 1 0 1 1 0 1 1
3 1 1 1 1 0 0 1 1
4 0 1 1 0 0 1 1 1
5 1 0 1 1 0 1 1 0
6 1 0 1 1 1 1 1 0
7 1 1 1 0 0 0 0 0
8 1 1 1 1 1 1 1 0
9 1 1 1 1 0 1 1 0

Parts List
Semiconductors:
IC1, IC2 - CD4033 decade counter/
7-segment decoder
IC3 - CD4510 BCD up-/down-
counter
IC4 - CD4027 dual J-K flip-flop
IC5 - CD4543 BCD-to-7-segment
latch/decode/driver
IC6 - CD4040 12-bit binary coun-
ter
IC7 - CD4060 14-stage counter/
driver/oscillator
IC8 - NE555 timer
IC9 - CD4082 dual 4-input AND
gate
IC10 - CD4081 quad 2-input AND
gate
IC11 - UM66 melody generator
DIS1-DIS4 - LT543 common-cathode
Fig. 2: Actual-size, single-side PCB layout of the digital clock 7-segment display
T1, T2 - BC548 npn transistor
ZD1 - 3.3V, 0.5-watt zener
D1-D3 - 1N4001 rectifier diode
LED1 - Green LED
LED2-LED4 - Red LED
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1, R2 - 680-ohm
R3-R24 - 470-ohm
R25 - 10-kilo-ohm
R26, R28, R32 - 1-kilo-ohm
R27 - 680-kilo-ohm
R29 - 3.3-mega-ohm
R30 - 4.7-kilo-ohm
R31 - 220-ohm
Capacitors:
C1 - 470µF, 25V electrolytic
C2 - 10µF, 25V electrolytic
C3 - 0.01µF ceramic disk
Miscellaneous:
XTAL - 32.768kHz quartz crystal
S1, S2 - Push-to-on switch
LS1 - 4-ohm, 0.5W loudspeaker

and N5 as follows: Table I shows that at


the count of 6, the e, f, and g segment
decoded outputs of CD4033 go to logic 1
state. (Earlier, these outputs never went
to logic 1 state simultaneously). After the
count of 59 (when ten’s digit goes to 6),
this condition is ANDed by AND gates
N4 and N5.
The output at pin 4 of AND gate N4 is
Fig. 3: Component layout for the PCB used to reset IC2 and clock IC3 (CD4510);

20 ELECTRONICS PROJECTS Vol. 23


IC3 is used for generation of unit’s digit of clock displays 1:00. output is low. Thus AM LED1 (green)
hour’s display. IC3 is a presettable binary is on. After twelve hours, the first clock
up-/down-counter that is used here as an pulse turns Q2 high and its compliment
up-counter. Parallel input P1 is connected Additional features Q2 goes low. As a result, the PM LED
to +5V (logic 1), while P2 through P4 are Hourly music. After every hour, the glows.
grounded. output of AND gate N4 momentarily Again after twelve hours, N3 output
After ninth count, IC3 produces a goes high. This results in conduction of goes high and gives another clock pulse
carry output in the next clock pulse that transistor T2 for a brief period, making to the flip-flop. Now Q2 goes low and its
acts as the clock input for the first JK flip- its collector to fall and thus trigger the complement Q2 becomes high. Thus AM
flop inside CD4027 (IC4). Q1 output of the monostable multivibrator built around LED glows.
flip-flop is used to generate ten’s digit of NE555 (IC8). Push-to-on switches S1 and S2 are
the hours display. The monostable’s output activates used to manually set ‘hours’ and ‘min-
To display 1:00 after 12:59, 4-input melody generator UM66 (IC11) for the utes’, respectively. The 2Hz clock from
AND gate N1 is used. After 12:59, the duration of its pulse-width (about 8-10 sec- the output of IC7 is used to advance the
output of AND gate N1 momentarily onds, determined by timing components set of hour’s counters (IC3 and IC4) or the
goes high, which is applied to both the R27 and C2) and the preprogrammed minute’s counters (IC1 and IC2) depend-
parallel-enable (PE) input of CD4510 and musical note is played for 8-10 seconds. ing upon the pressing of hour’s set switch
the reset input of CD4027. As a result, You may use any other musical module S1 or minute’s set switch S2.
the counter starts counting from the also for this purpose. An actual-size, single-side PCB for the
preset data (1). AM-PM indication. The second flip- digital clock circuit is shown in Fig. 2, with
Due to resetting of the flip-flop at flop inside CD4027 (IC4) is used for AM its component layout in Fig. 3.
the same time, Q1 output goes low and PM indications. After every twelve Precautions. 1. Make all connections
and hence the ten’s digit is turned off. hours, AND gate N3 goes high to give a correctly as per the circuit diagram.
Now only the unit’s digit of the hours clock pulse to this flip-flop. 2. Use sockets for the ICs.
display is displayed. Thus after 12:59, the Initially, Q2 output is high, while Q2 ❏

Readers’ comments: causes of these problems and tell me how pulses when pressing switch S1 or S2.
Q1. I have assembled the PCB of the to rectify them. Is there any fault with the This problem can be eliminated by adding
project and found the following prob- circuit and its PCB? a 10-kilo-ohm resistor between pin 3 of
lems: Mukul Behari Roy IC7 and ground.
1. After ninth count, IC1/DIS-1 doesn’t Kolkata 3. In the prototype made by me,
go forward for the next digit, i.e. tenth The author, Sunil P.B., replies: transistor T1 didn’t heat up. The same
digit (9 – 0). A1. 1. If IC1 doesn’t count further, the is being used with a large display in my
2. Switches for the minute/hour set- only possible reason may be the faulty home as a wall clock. Check whether
ting are not working properly. The digits chip. After ninth count, IC1 gives a clock transistor T1 is short or open. Add a
jump at their own and cannot be stopped pulse to IC2 for counting the ten’s digit. 1000µF, 16V capacitor in parallel with
at the desired time. Check whether the IC and its connections 470µF capacitor and two 0.1µF capaci-
3. When the circuit is switched on, are correct. tors in parallel with 470µF capacitor.
transistor T1 slowly heats up and ulti- 2. Digits jump on pressing switch S1 Also check whether your power supply is
mately gets damaged. Please explain the or S2 due to the production of multiple generating pure DC.

ELECTRONICS PROJECTS Vol. 23 21


Make Your Own
EPROM Eraser with
Electronic timer
K.C. Bhasin

M
ost EPROMs with a quartz crys- If the EPROM window is placed at electrons to jump the silicon dioxide bar-
tal/mica erase window can be about 2.5 cm from 253.7nm UV source, rier between the channel region and the
erased using an ultraviolet (UV) where the intensity is, say, 12 mW/cm2, floating gate.
light source. The UV lamp used for this the exposure time for erasure of the During programming, the select gate
purpose has a short wavelength of about EPROM will be between 10 and 40 (maxi- is given a positive bias, which helps at-
2537 Å (253.7 nm). mum) minutes. tract these electrons to the floating gate
An integrated dosage (incident UV Erasing an EPROM. When we erase electrode. Because the floating gate is
power intensity on the EPROM x expo- an EPROM, we make the data stored in surrounded by silicon dioxide, the in-
sure time) of 10 W-sec/cm2 is needed to it to be logic 1 (all bits). EPROMs use a jected charge is effectively trapped. The
erase most EPROMs. In practice, a much floating-gate technology, in which the specific memory cell with trapped charge
larger exposure time (up to four times the basic memory cell is a metal-oxide semi- causes the cell transistor to be biased ‘on’,
integrated dosage) is given to ensure that conductor (MOS) transistor having two whereas the cells without trapped charge
the EPROM behaves erased at extremes gate electrodes separated by a layer of are biased ‘off’. Blank EPROMs have
of temperature and voltages. silicon dioxide. The lower gate electrode, no trapped charge and each cell stores
Although an EPROM can be erased named floating gate, is surrounded by the logic 1.
using direct sunlight (having a low UV oxide layer. The electrons on the floating gate
content), however, it would require about A charge can be placed on the float- absorb photons from the ultraviolet light
a week’s exposure time, which is rather ing gate by applying the programming source and acquire enough energy to re-
long. To avoid unintentional erasure of voltage (Vpp) between the drain and the verse the programming process and return
programmed EPROMs in normal light, gate electrode. This causes a high electric to the substrate.
an opaque label is recommended to cover field to be developed in the channel region Warning! Shortwave ultraviolet
their quartz crystal/mica window. of the transistor, which, in turn causes light is very dangerous and can cause

Fig. 1: Circuit diagram of EPR0M eraser with electronic timer

22 ELECTRONICS PROJECTS Vol. 23


permanent damage to one’s eyes and skin.
Hence ultraviolet light sources must be
fully screened when ‘on’. The author (and
EFY) doesn’t take any responsibility if any
damage results from not heeding to this
warning. Alternatively, you may purchase
a readymade eraser from one of the score
of manufacturers/their authorised dealers
who adhere to all the safety norms.

Description
The EPROM erasure circuit mainly com-
prises the timer, ultraviolet tube, starter,
and choke.
Timer. The circuit shown in Fig. 1 ‘Eye’ brand ultraviolet germicidal lamps
uses an electronic timer. In place of the
electronic timer you may use a mechani- line. The 254nm wavelength is highly le- (Laxman Sylvania make) and a tubelight
cal timer with up to 1-hour (60-minute) thal to virus, bacteria, and mould pores. starter. Both these items are easily avail-
delay. On completion of the preset delay, Some UV tubes use tungsten coil fila- able from most electrical goods dealers.
the mechanical timer may sound an alarm ments, while some costlier tubes use large Electronic Timer. Fig. 1 shows a
and/or provide a visual indication. Thus cylindrical cold cathodes that instantly simple timer circuit built around 14-stage
if you intend to use a mechanical timer, start operating and are not affected by ripple counter/divider-cum-oscillator IC
ignore the entire circuit of the electronic frequent switching on/off, as is the case CD4060. It is operated on the same mains
timer—from step-down transformer X1 to with the tungsten filament tubes. supply (after it is stepped down by trans-
relay RL1, and: Table below shows some ultraviolet former X1) that is used for energisation of
(a) substitute the relay contact termi- lamps (Eye brand or equivalents) that the ultraviolet tube.
nals (N/O and P) with similar terminals can be used in this EPROM eraser. The The stepped-down AC voltage is recti-
on the mechanical timer; glass is clear, so the filament can be seen fied by bridge rectifier and its output is
(b) remove the wire link between directly. The length varies from 15 to 25 smoothed by capacitors C1 and C2 before
points A and B and insert microswitch cm, depending on the rating. regulation by 3-pin regulator 7812 (IC1).
(S4) normally open terminals across points Note. During testing in EFY lab, we The regulated 12V is used for the timer
A and B. used G6T5 UV tube that is available from circuit including the relay.
The mechanically operated micros- Peri Com Group, Bangalore. You may also Capacitor C4 and resistor R1 form
witch closes when the lid of the box/en- use Philips’ 6W TUV tube. the power-on-reset circuit for timer IC
closure containing the ultraviolet source Ballast and starter. The ultraviolet CD4060. The timer can also be manually
is fully shut. lamps mentioned in Table can be used reset using push switch S2.
Ultraviolet lamp. A good many in conjunction with a tubelight ballast/ Since very precise timing is not es-
firms manufacture UV lamps for use as choke with wattage matching that of the sential for the timer circuit in this ap-
germicidal lamps. Usually, these lamps UV tube. One can, however, use a read- plication, the oscillator circuit is realised
are shortwave low-pressure mercury va- ily available tubelight choke of higher using resistors R2 and R3, preset VR1,
pour tubes that emit ultraviolet energy at wattage. We have satisfactorily tested and capacitor C5. Only the last three out-
254nm (nanometre) mercury resonance the circuit using a readymade 20W choke puts (Q11, Q12, and Q13) giving delay of

Type Nominal Bulb Base Overall Diameter Approx. Tube Ultraviolet Ultraviolet Rated Av. Auxiliary
Watts Designation Length (mm) (mm) Amperes (A) Output Total Micro Watts Life (hrs) (Ballast,
Watts at 1 meter (I) Starter, socket
G30T8 30 T8 Medium 893 25 0.340 8.3 85 7500
Bipin
G15T8 15 T-8 Medium 436 25 0.300 3.6 38 7500 15W fluore-
Bipin scent lamp
G10T8 10 T-8 Medium 330 25 0.230 1.7 17.5 7500 10W fluore-
Bipin scent lamp
G8T5 8 T-5 Miniature 287 15 0.170 1.6 17 5000 8W fluore-
Bipin scent lamp
G6T5 6 T5 Miniature 210 15 0.147 1.0 22 5000 6W fluore-
Bipin scent lamp
G4T5 4 T-5 Miniature 134 15 0.125 0.5 5.4 5000 4W fluore-
scent lamp
G4S11 3.5 S-11 Inter 54 35 0.350 0.1 1 5000 Starterless
G4T4/1 4 T-4 Radio Contact 122 13.5 0.080 0.7 7.5 5000 U-type

ELECTRONICS PROJECTS Vol. 23 23


Parts List
Semiconductors:
IC1 - 7812, +12V regulator
IC2 - CD4060 14-stage counter/
driver/oscillator
T1, T3 - BC548 npn transistor
T2 - SL100 npn transistor
D1-D6 - 1N4007 rectifier diode
LED1 - Red LED
LED2 - Green LED
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1, R7 - 22-kilo-ohm
R2 - 47-kilo-ohm
R3 - 1-mega-ohm
R4 - 10-kilo-ohm
R5 - 4.7-kilo-ohm
R6 - 100-ohm
R8, R9 - 1-kilo-ohm
VR1 - 100-kilo-ohm preset
Capacitors:
C1 - 470µF, 35V electrolytic
C2, C3 - 0.22µF polyester
C4 - 4.7µF, 25V electrolytic
C5 - 1µF, 25V electrolytic
Miscellaneous:
RL1 - 12V, 250-ohm, 1 c/o relay
Fig. 3: Actual-size PCB for electronic timer Fig. 4: Component layout for the PCB S1 - On/off switch
S2 - Push-to-on switch
10 minutes, 20 minutes, and 40 minutes, Energisation of the relay is possible only S3 - Single-pole, 3-way rotary
switch
respectively, are used. if the EPROM door is properly shut.
S4 - Microswitch
The required delay is selected using (Note. Microswitch S4 is to be mount- - 230V AC, 20W choke
rotary switch S3. At the end of the selected ed in such a place in the eraser box that - Starter for 230V tubelight
delay, the pole of the rotary switch goes its stopper, mounted on the lid of the box - Neon indicator with inbuilt
resistor
high to take pin 11 of CD4060 high. This (as shown in the mechanical drawing of a
- G6T5 Ultraviolet tube
results into locking of the counter and it typical eraser box, in Fig. 2), pushes the
stops advancing further. plunger of the microswitch only when the
Once counter IC2 is reset, its output lid is properly shut. This will ensure that delay period is over. On completion of
pins go low. As a result, transistor T1 is UV lamp is energised only when the box is the delay period, the pole of the rotary
cut off and transistor T2 gets forward bi- properly shut, and the ultraviolet emission switch goes high to freeze the counter.
ased via resistors R5 and R6 to energise does not cause any harm to the operator. Simultaneously, transistor T1 starts
relay RL1, which is connected as its col- The relay can be energised only on closure conducting and its collector gets pulled
lector load. LED1 (red) glows to indicate of microswitch S4.) toward ground. As a result, transistor T2
that the eraser is in energised state. Once the relay energises, the mains is cut off to de-energise relay RL1, which
supply becomes de-activates the ultraviolet tube. Also,
available to red LED1 goes off.
the ultraviolet The feeble current drawn via resistor
tube through R8, LED1, and resistor R7 is amplified by
the choke and transitor T3 to light up green LED2. The
starter arrange- glowing of LED2 indicates that the erasure/
ment and it gets exposure period of the EPROM is over.
activated. As Adjustment. To obtain approximate
transistor T2 is 10-min delay at pin 1 of counter CD4060,
fully conduct- you may temporarily connect an LED at
ing, its collector pin 6 (Q6 output) through 1-kilo-ohm re-
is near ground sistor to ground and ensure that it glows
potential, which after about 19 seconds (after pressing
keeps transistor reset switch S2 momentarily) by adjust-
T3 cut off. Thus ing preset VR1. A 19-second delay period
green LED2 is at Q6 would mean a 568-second (roughly
off. nine-and-a half minutes) delay at Q11
The ultra- output pin. Thus you don’t even need an
violet tube re- oscilloscope to do the calibration—a wrist-
mains ‘on’ un- watch with seconds needle is good enough
Fig. 2: Typical enclosure for EPROM eraser til the selected for the purpose.

24 ELECTRONICS PROJECTS Vol. 23


Enclosure. A metal enclosure is most Suitably mount the transformer, starter erasure, should be about 2 to 2.5 cm from
suited. Use L-shaped sheet-metal brackets (on its base), relay, switches, and neon and the UV tube surface.
for mounting the UV tube. Attach 3mm LED indicators on the cabinet. The timer can be easily built on a
thick ebonite sheet pieces with holes (for The PCB containing the timer circuit general-purpose PCB. However, an actu-
passing the tube pins) to the brackets as should be suitably screened and accom- al-size, single-side PCB for the same is
shown in Fig. 2. The wires going to the modated inside the enclosure. The base, shown in Fig. 3 and the component layout
pins must be firmly soldered to the pins. where the EPROMs are to be placed for in Fig. 4. ❏

ELECTRONICS PROJECTS Vol. 23 25


MULTIPURPOSE ABSORPTION
RATE METER FOR FABRICS
JYOTI M. NATH,
BHAMA IYER AND
P.G. PATIL

A
n ideal garment should remove strips. The test is carried out under the
excess liquid sweat and provide standard atmospheric conditions of 27°C Parts List
comfort to the wearer. Fabrics temperature and 65 per cent humidity. Semiconductors:
with high liquid absorption and trans- As the water rise in fabric strips is not IC1, IC2 - TL084 quad JFET input
quad operational ampifier
port ability provide substantial comfort. easily detectable by eyes, there is always IC3 - NE555 timer
In textile and paper industries as well the possibility of erroneous result while IC4 - CD4093 quad 2-input
as related quality-testing laboratories, using the capillary travel method. NAND gate Schmitt
water absorbency tests are essentially Fabrics have negligible electrical IC5 - 7404 hex inverter
IC6 - 74C926 4-digit counter/
performed. conductivity. Water, being an excellent 7- segment display driver
In the conventional capillary travel conductor of electricity, enhances the T1-T4 - BEL188 pnp transistor
method, to determine the absorption conductivity of fabric after moisture T5-T10 - BC547 npn transistor
rate of a material, sample strips of the absorption. The multipurpose absorp- ZD1, ZD2 - 5.1V, 0.5W zener diode
LED1 - Yellow LED
material are suspended in water, with tion rate meter (MARM) described here LED2 - Red LED
a weight tied at the bottom of each strip works on electrical resistance principle to LED3 - Green LED
to keep the specimen straight (Fig. 1). measure the absorption rates of different DIS1-DIS4 - LT543 common-cathode
Then the rise of water level in the strips, types of fabrics (cotton, jute, wool, rayon, 7-segment display
in ten minute period, is recorded using a polyester, etc) and towel samples. It can Resistors (all ¼-watt, ±5% carbon, unless
stopwatch. Coloured water can be used stated otherwise):
also make accurate measurements for R1, R8 - 1-mega-ohm, 0.5-watt
to clearly see the water rise in fabric yarns, writing and computer papers, and R2, R9 - 6.2-kilo-ohm, 0.5-watt
R3, R10 - 220-kilo-ohm, 0.5-watt
R4, R6, R11,
R13, R22, R24 - 10-kilo-ohm
R5, R7, R12,
R14, R28 - 2.2-kilo-ohm
R15, R16, R17,
R18 - 47-ohm
R19, R20 - 1-kilo-ohm
R21, R23 - 330-ohm
R25 - 8.2-kilo-ohm
R26 - 22-kilo-ohm
R27 - 100-ohm
R29, R30, R31 - 56-kilo-ohm
R32-R35 - 3.3-kilo-ohm
R36-R43 - 220-ohm
VR1, VR3 - 1-mega-ohm potmeter
VR2, VR4 - 10-kilo-ohm preset
VR5 - 1-mega-ohm preset
VR6 - 50-kilo-ohm preset
Capacitors:
C1, C2 - 10nF ceramic disk
C3 - 10µF, 16V electrolytic
C4 - 0.1µF ceramic disk
C5 - 22nF ceramic disk
Miscellaneous:
S1 - Push-to-on switch
Sensor - Stainless steel needle-like
electrode
Fig. 1: Suspension of sample strip and its connection to the instrument via needle sensors

26 ELECTRONICS PROJECTS Vol. 23


even commercial absorbents. The meter
records the vertical wicking height of the
Design and working water and activate the instrument.
The sensors are so mounted that
test sample, thereby automatically dis- The circuit consists of two identical cir- these can be moved and fixed at any
playing its absorption rate in seconds for cuits, each comprising a resistive Wheat- point on a vertical stand with the help
1cm wicking height. stone bridge as shown in Fig. 2. One of a screw mechanism as shown in Fig.
This absorption rate meter is highly of the arms of each of the Wheatstone 1. The set distance between the sensors
sensitive and can start or stop measure- bridges is formed by a specific length can be read on the scale mounted on the
ment even if one of the fibres absorbs of fibre under test, which is connected stand. Orthophosphoric acid is used to
moisture at a faster rate and activate to the circuit using needle-like sensors. make solder joints between stainless
‘start’ and ‘stop’ sensors. It doesn’t require The sensors fabricated from grade SS-304 steel sensors and conducting part of the
continuous monitoring. stainless steel sense the conductivity of flexible feed wires.

R6
10k

T1-T4 = BEL188 / BC548


IC1(A1-A4) = TL084
IC2(A5-A8) = TL084
IC4(N1-N4) = CD4093
IC5 (N5-N6) = 7404
IC6
74C926

RESET

RED
STOP

Fig. 2: Schematic diagram of absorption rate meter

ELECTRONICS PROJECTS Vol. 23 27


Circuit description
The outputs of the two Wheat-
stone bridges are amplified by
high-input impedance transis-
torised differential amplifier
stages built around transistor
pairs T1-T2 and T3-T4. The
output from the emitter of
each transistor is buffered by
op-amp buffers A1 and A2, and
A5 and A6, before application
to differential amplifiers A3
and A7. The outputs from op-
amps A3 and A7 are further
buffered by op-amps A4 and
A8, respectively, before appli-
cation to the counter and the
display circuit.
Potentiometers VR1
through VR4 are used during
calibration/adjustment. These
are so adjusted that when the
common and start sensors are
in contact (through absorbed
water), point P goes low, while
point Q goes high. This causes
start LED1 to glow, while stop
LED2 goes off. Likewise, when
Fig. 3: Actual-size, single-side PCB for absorption rate meter all the three sensors are in
contact, point Q should go low,
while point P should go high.
This would cause stop LED2
to glow and start LED1 to go
off. Thus the adjustment of
potmeters VR1 through VR4
can be done by looking at the
LEDs’ status.
When point P goes from
high to low, the output of gate
N5 goes high to light up yellow
start LED1. The differentiated
output of gate N5 causes the
collector of transistor T5 and
pin 1 of NAND gate N1 to go
low momentarily. This causes
the output at pin 3 of gate N1
to be latched high. (NAND
gates N1 and N2 constitute
a NAND latch.) The latch
output enables NAND gate
N4 and takes LE pin 5 of IC6
(74C926) high. A high at pin
5 represents a flow-through
condition for 74C926, while a
low at pin 5 results in latching
of the current count.
Now 1Hz clock generated
by timer NE555 (configured
as an astable multivibrator) is
Fig. 4: Component layout for the PCB able to pass through gates N3

28 ELECTRONICS PROJECTS Vol. 23


Fig. 6: Pin configuration of ICs used in Fig. 2

to be inhibited, i.e. it stops passing the the fabric strip.


clock. LE pin 5 of 74C926 also goes low to Now the lower end of the strip is
latch the current count. Thus this count dipped in water. The instrument is
becomes stable in display DIS1-DIS4 to switched on and its reset button is pressed
represent the time (in seconds) taken by to bring the display to all zeros.
water to travel 1 cm from electrode B to The fabric strip starts wicking up
electrode A through capillary effect. water and as soon as water level reaches
Fig. 5: Photograph of author's prototype A single-side, actual-size PCB for the sensor B, LED1 (start) glows to indicate
circuit in Fig. 2 and its component layout the start of counting. When water level
and N4. The clock activity is indicated by are shown in Figs 3 and 4, respectively. reaches sensor A, LED2 (stop) glows to
green LED3. This clock is applied to pin 12 indicate the completion of counting. The
of 74C926 and its associated display keeps number of 1 second pulses counted is
advancing with each clock pulse. Measurement displayed, which is equivalent to the time
When Q point goes from high to low For making measurement, one of the taken by water to rise from point B to
state, stop LED2 (red) glows. At the same prepared sample strips is mounted on point A in fabric strip. The four-digit dis-
time, the collector of transistor T6 mo- the stand as shown in Fig. 1. Sensors A play thus shows the absorption rate of the
mentarily goes low to reset latch pin 3 of and B are fixed 1 cm apart. Sensors C is fabric. The counter and display circuitry is
NAND gate N3 low. This causes gate N4 fixed 2.5 cm away from the lower end of shown in Fig. 2. ❏

ELECTRONICS PROJECTS Vol. 23 29


Digital Flow Meter
Suresh S. Balpande

H
ere is a simple circuit to measure But in this procedure, there are and 3 are connected to positive supply via
the discharge rate of conducting chances of errors. The circuit described pullup resistors R2 and R1, respectively.
as well as non-conducting liquids. here eliminates errors and has the follow- When the liquid level touches sensor 2
Using this meter, one can determine the ing features: and/or sensor 3, circled points 2 and/or 3
total consumption and total requirement • Automatically senses the level and are pulled low towards ground potential.
of liquids in industries, water plants, generates trigger pulses for counting of You may use small spherical stain-
etc. The instrument is user-friendly and the elapsed time period, thereby providing less steel probes as sensors and screw the
can be operated even by non-technical you a basis for calculation of the discharge wires coming from the circuit to them. To
persons. It can also be used along with rate of liquids (conducting as well as non- avoid oxidation or sulphation of the naked
commonly available 8-digit calculator as conducting). portion, cover the joints using araldite or
a simple digital stopwatch to count up to • Includes the circuit for digital dis- any other suitable epoxy compound. For
99,999,999 seconds. play of the elapsed time using calculator as long life and protection against weather,
In manual method of measuring the well as a 7-segment display (optional). use teflon-insulated multistrand wires.
discharge rate of a given liquid, you need For proper support of the wires along
to observe the rise of liquid in the glass with the probes, a PVC support rod may
tube. As soon as the liquid reaches a Description be used for tying the wires to PVC rod to
fixed point in the tube, you press ‘start’ As shown in Fig. 1, the circuit can be keep them in their proper position.
button on the stopwatch. After the liquid divided into four blocks, namely, sensor, The sensor section for non-con-
reaches another fixed point, you need logic controller, pulse generator (with ducting liquids. For non-conducting
to press ‘stop’ button on the stopwatch. 1-second period), and switching module. liquids, floats with integral rigid vertical
The observed time and level are used to The sensor section for conducting members are used to operate micro limit
calculate the discharge rate and quantity liquids. Fig. 2 shows sensors for conduct- switches. As the liquid level rises, the float
of liquid: ing liquids. Sensor 1 is permanently con- moves upwards to close N/O contact with
Discharge or flow rate = volume/time nected to circuit ground, while sensors 2 the pole, thereby grounding it. Circled
points 1, 2, and 3 in the sensor sections
for conducing and non-conducting liquids
are analogous, hence these are identically
connected to similar points in Fig. 2.
The logic control section. This sec-
tion comprises a quad two-input NOR
gate (ICCD4001). When the liquid level is
Fig. 1: Diagram of digital flow meter
so low that both sensors 2 and 3 are out

Fig. 2: Schematic diagram of digital flow meter using calculator

30 ELECTRONICS PROJECTS Vol. 23


N2 would change to logic 1 state because Parts List
both of its inputs are at logic 0. This logic Semiconductors:
1 output after inversion to logic 0 level is
IC1 - CD4001, quad 2-input NOR
applied to pin 12 of NOR gate N4. As both gate
the inputs to NOR gate N4 are at logic 0, IC2 - NE555 timer
its output would be logic 1, which initiates IC3 - MCT2E optocoupler
the operation of the pulse generator. IC4 - 7805 regulator
LED1 - Green LED
When the liquid level further rises to LED2 - Red LED
touch sensor 3 (or close micro limit switch D1-D4 - 1N4001 rectifier
S1 in Fig. 3), the output of NOR gate N1 Resistors (all ¼-watt, ±5% carbon, unless
becomes logic 1 and the output of NOR gate stated otherwise):
N2 continues to remain logic 1. The output R1-R2 - 470-kilo-ohm
R3 - 820-ohm
of NOR gate N2 is inverted by NOR gate R4 - 270-kilo-ohm
N3 to become logic 0. Thus pin 13 of final R5 - 100-kilo-ohm
NOR gate N4 is at logic 1, while pin 12 is R6-R7 - 470-ohm
at logic 0. The resultant output of NOR VR1 - 100-kilo-ohm (preset)
gate N4 is logic 0, which terminates the Capacitors:
Fig. 3: Use of float-operated microswitches C1 - 2.2µF, 16V electrolytic
operation of the pulse generator. C2 - 0.01µF
as sensors for non-conducting liquids In this way, the pulse generator can C3 - 1000µF, 25V electrolytic
be automatically controlled as per our C4 - 100µF, 25V electrolytic
of the liquid, the voltage at input pin 1 of requirement. Reset pin 4 of timer NE555, Miscellaneous:
NOR gate N1 and that at pin 5 of NOR which is normally connected to positive S1, S2 - Micro limit switch (long
gate N2 becomes logic 1, while their other arm)
rails, has been used here to control its
- Calculator with a hard PCB
input terminals (pins 2 and 6, respective- operation. so that soldering can be done,
ly) are at logic 0 (connected to grounded Pulse generator. Timer IC 555 is e.g. Casio
sensor point 1). So the output pins of NOR used to generate pulses with pulse recur- - Connecting wires
gates 1 and 2 are at logic 0. - IC bases
rence frequency (PRF) of 1 Hz (period =
- Small-size heat-sink for
The output of NOR gate N1 (logic 0) 1 second). The frequency/period of the 7805
is directly connected to pin 13 of NOR astable depends on the value of timing X1 - 230V AC primary to 0-7.5V,
gate N4, while the output of NOR gate components R4, VR1, R5, and C1, and the 500mA secondary trans-
N2 is connected to pin 12 of NOR gate N4 former
same can be varied using preset VR1. The
after inversion by gate N3. As a result, timer is wired to operate in free running Parts list for optional circuit
the output of NOR gate N4 is logic 0. This Semiconductors:
mode under the control of the logic level
IC1 - 74C926 4-digit counter cum
final output of the logic control unit keeps at its reset pin 4 (determined by the logic 7-segment driver
the pulse generator formed by timer IC2 control section). DIS1-DIS4 - LT543 common-cathode
in reset state. The switching section. The switch- display
When the liquid level rises to touch T1-T4 - SL100 npn transistor
ing module is used to make and break
sensor 2 (or the float in Fig. 3 closes N/O switch contacts at 1Hz rate, using the Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
contact of micro limit switch S2), the output of timer IC2. This function is analo- R1-R7 - 56-ohm
output of NOR gate N1 would remain gous to pressing/releasing of a push-to-on R8-R11 - 1-kilo-ohm
unaltered, while the output of NOR gate switch once a second. Instead of pressing R12, R13 - 100-kilo-ohm

Fig. 4: Display unit (optional) using T-segment display

ELECTRONICS PROJECTS Vol. 23 31


1-second period, before starting the op-
eration we have to press ‘1’ followed by
‘+’, ‘+’, and ‘=’ buttons. Subsequently, ‘=’
button is automatically operated through
the optocoupler and digit ‘1’ gets added to
the sum for every operation of ‘=’ button.
Thus at the end of operation, the elapsed
time (in seconds) would be equal to the
displayed reading minus 1, since 1 itself
is the initial reading.
Display unit using 7-segment
Fig. 5: Power supply unit LEDs. This circuit (Fig. 4) can be option-
ally used in place of calculator’s LCD
‘=’ button of the calculator, an optocou- coupler conducts. During negative/rest and to interface with timer IC2 output.
pler is used for making/breaking contact period of the timer output, the switch The display is built around IC 74C926
between two points of ‘=’ button. will be open (in high-impedance state). that comprises a 4-digit counter and
Whenever the output of timer IC2 Display unit using calculator. driver for 7-segment displays. Its inbuilt
goes high, the LED inside the optocou- It displays the time using calculator. multiplexing circuitry with four multi-
pler conducts. Now, if the leads soldered When using a calculator, to add the same plexed outputs has its own free running
to the two terminals of ‘=’ on the calcula- number to a given number repeatedly, oscillator and does not require any ex-
tor PCB are connected to the collector we press the given number followed by ‘+’ ternal clock pulse. The IC has an input
(pin 5) and the emitter (pin 4) of the in- button two times and ‘=’ button. protection circuitry consisting of a series
built transistor of the optocoupler (with Thereafter, if we press ‘=’ button, the resistor and a diode connected to the
relatively more positive lead connected base number will
to the collector and the other one to the keep getting added
emitter), the collector will get pulled to itself (second de-
towards the emitter, thereby producing pression onwards)
an effect equivalent to the closure of a repeatedly. Here, to
switch while the diode inside the opto- count pulses with

Fig. 8: PCB layout for display

Fig. 6: Actual-size, single-side PCB for circuits in Figs 2 and 5

Fig. 7: Component layout for the PCB Fig. 9: Component layout for the PCB

32 ELECTRONICS PROJECTS Vol. 23


ground, and works on 3V-6V supply. tor ICs. • Dip sensors in the liquid and wait
Power supply (Fig. 5). The power 4. Check the PCB for dry joints and until both the sensors are fully in liquid or
supply circuit consists of stepdown trans- solder splashes between tracks before con- green LED stops glowing. When the count-
former X1 followed by a bridge rectifier necting the power supply transformer. ing is going on, green LED will glow and
and 1000µF filter capacitor. Regulator 5. After measurement, remove all the after some time it will go off, indicating
IC 7805 is used to supply regulated sensing leads from the liquid to avoid cor- the completion of the operation.
voltage to the sensing section plus logic rosion of leads. • Observe the reading in seconds on
control unit and pulse generator section, the calculator’s display panel.
respectively. Testing, adjustment, and • Now calculate the discharge rate (Q)
using the following relationship:
precautions Q = AH\(T–1) per second where A is
Construction As a flowmeter area (fixed, L x B), H the height (fixed, 10
1. The entire circuit can be fabricated on • First of all, adjust the frequency of the cm), and T the time (the output of calcula-
a veroboard. However, an actual-size, pulse generator to 1 Hz, or the pulse period tor in seconds).
single-side PCB layout for the circuit in to 1 second, by varying preset VR1. As a stopwatch
Figs 2 and 5 is shown in Fig. 6, with com- • Adjust sensors 2 and 3 10cm apart on • Press digit 1 followed by ‘+’ two
ponent layout in Fig. 7. Similarly the PCB a PVC rod (refer Fig. 2) and sensor 1 just times and ‘=’.
and component layouts of the display unit below sensor 2. • Short points 1 and 2 to start count-
using 7-segment display (Fig. 4) are shown • Measure the tank area (length x ing.
in Figs 8 and 9. breadth). • Short points 1, 2, and 3 to stop
2. For easy replacement of ICs and • Then press digit ‘1’ followed by ‘+’ counting.
fault finding, use IC sockets. two times and ‘=’ button on the calcula- • Elapsed time = Time displayed on
3. Use heat-sinks for both the regula- tor. the calculator–1 (in seconds). ❏

ELECTRONICS PROJECTS Vol. 23 33


Z-80 Based Auto-Ranging
LCD Capacitance Meter
K. Padmanabhan and S. Ananthi

W
hile the basic principle for ca- If R = 10k, C = 0.1442x10–3 t
pacitance measurement of a ca- Different values of R can be used to
pacitor remains unchanged, the make the value of t large enough for the
display interface (or more appropriately measurement to be accurate. Lower values
the human interface), however, has un- of C will need a large resistance, while
dergone a major change. Hitherto used higher values of C will require a compara-
7-segment LED displays were capable tively low resistance.
of showing figures and only a limited The microprocessor measures time
number of characters and hence they t through a timing and counting loop.
were not quite satisfactory. On the other If time t is found to be small, the next
hand, the use of CRT monitor is quite higher value of resistor is switched on and
unwieldy and hence unsuitable. the measurement is redone. This feature
Today’s instruments need a smart makes the capacitance meter to be an
human interface for user-friendliness. auto-ranging one. Fig. 1: Capacitor charging principle
The recent advent of LCD alphanumeric A discharge switch across the capaci-
display modules has ushered in a new era tor is also required so that on changing for each counting loop, gives time t in
of smart display instruments. The auto- the range (switching on higher-value Equation (1).
ranging capacitance meter described here, charging resistor R), the capacitor is If the time to charge the capacitor to
also makes use of an LCD module. discharged prior to switching on of the threshold value of CMOS gate is found to
capacitor for recharging through the be too short, the next higher charging re-
changed value of resistor R. This will sistor (100 kilo-ohms) is selected by closing
Principle be an addition to the scheme shown in switch B after discharging the capacitor by
Fig. 1 shows the basic circuit for ca- Fig. 1. closing switch D, and the above sequence
pacitance measurement. A CMOS FET The part of circuit in extreme right of is repeated.
switch IC (CD4066) is used to switch a Fig. 2 (delimited by vertical dotted line) If the charging time is still found to be
voltage for charging the unknown capaci- is the capacitance measurment section. too short, the next higher charging resis-
tor through resistor R. As the voltage Flags 0 through 2 are used for switching tor (1 mega-ohm) is selected by closing
rises exponentially and its value reaches control functions. Flag bits 0 and 1 control switch C after discharging the capacitor
above the threshold of the CMOS gate the selection of switches A, B, and C for via switch D and the sequence is repeated.
(50 per cent of the applied voltage, i.e. charging of capacitor (under test) through Table I summarises the control functions
Vcc), the output of the gate transits from different value of resistors, while flag bit of flags and switches.
logic ‘low’ to logic ‘high’ state. Voltage 2 controls the discharge of capacitor via Logic gates within CD4081 and
Vc across capacitor C (farads) charging switch D. The flags are output data bits CD4069 CMOS ICs are used to control the
exponentially through resistor R (ohms) D0 through D2 of output port 1 from the four switches of CD4066 IC for charging
at any time t (seconds), after application microprocessor. The sense input is D1 (through different resistors) and discharg-
of the voltage, is given by the following data bit of input port 1. ing of the capacitor.
relationship: The program first discharges the ca-
Vc=Vcc(1-e(–t/CR)) pacitor by closing switch D. Then it closes
On substituting Vcc = 5 volts, we switch A, whereupon the capacitor starts Interfacing LCD
get, charging up through a 10-kilo-ohm resis- Most LCD modules follow the same
Vc = 5 – 5e(–t/CR) ....... (1) tor. Simultaneously, a software counter standard format, have the same 14-pin
But since the threshold voltage of a is started. interface, and therefore are compatible
CMOS gate is half of the supply voltage, The program reads the sense bit in a and interchangeable. These have an on-
e(–t/CR) = 2.5/5 = 0.5 loop. When the sense bit goes high, the board controller (such as HD44780) that
t/CR = 0.6931 counter stops. The accumulated count, is capable of controlling any display size
CR = 1.442t multiplied by the time in microseconds up to two lines with 40 characters per

34 ELECTRONICS PROJECTS Vol. 23


ELECTRONICS PROJECTS Vol. 23
35
Fig. 2: Z-80-based auto-ranging capacitance meter with LCD
Parts List
Semiconductors:
IC1 - Z-80 microproecessor
IC2 - 2764 8k x 8-bit EPROM
IC3 - 6616A 2k x 8-bit RAM
IC4, IC5 - 74LS138 decoder/demulti-
plexer
IC6 - 7404 hex inverter
IC7 - CD4069 hex inverter
IC8 - 7402 Quad 2-input
NOR gate
IC9 - 74LS126 Quad bus buffer
IC10 - CD4081 Quad 2-input
AND gate
IC11 - CD4066 Quad analogue
switch
IC12 - 7475 4-bit bistable latch
Fig. 3: Interface diagram between Z80 µP and LCD module Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1 - 10-kilo-ohm
line. Commonly available display size changed. R2 - 100-kilo-ohm
formats include 16x1, 16x2, 20x2, 24x2, LCD modules recognise the standard R3 - 1-mega-ohm
and 40x2. Thus one can change the size ASCII code (as shown in Table II) for R5 - 270-ohm
of display by simply plugging in a larger letters (upper and lower case), numbers, R4, R8, R9 - 1.5-kilo-ohm
R6, R7 - 1.2-kilo-ohm
module. No other hardware modifications and a variety of symbols (such as ? , \ $ R10 - 1-kilo-ohm
are required, and only the software driv- % | / # to name a few). These support 192 Capacitors:
ers specific to the application are to be alphanumeric characters and 32 special C1 - 10µF, 16V electrolytic
symbols, and allow one to customise C2, C3 - 22pF ceramic disk
Table I up to eight user-defined characters Miscellaneous:
of one’s own. Xtal - 2MHz crystal
Flag 2 Flag 1 Flag 0 Closed switch Resistor
LCD modules are dot-matrix S1, S2 - Push-to-on switch
1 0 0 None — LCD module - 16-character x 1 row
1 0 1 A 10 kilo-ohms type displays that have each char-
1 1 0 B 100 kilo-ohms acter formed from a 5-dot wide (5x10 font). The font is selected by issuing
1 1 1 C 1 mega-ohm and 7-dot high block (5x7 font), or a control command.
0 0 0 D Discharge
a 5-dot wide and 10-dot high block There is also a cursor line under each
character. The 5x10 font is better
suited for certain lower-case let-
ters whose descenders go below
the line that the letters are writ-
ten on, such as g, y, and p. The
5x10 matrix font, however, limits
the display to one line regardless
of whether the LCD module is a
one-line or two-line display.
LCD modules support a va-
riety of features to suit almost
every application. Some of the
features are:
• Display on/off. The user
can turn the display on/off from
the host processor.
• Cursor on/off. The user
may select to display the cursor
or suppress it.
• Cursor blink. The user
may select between a steady cur-
sor and a blinking cursor. The
character above the cursor also
blinks.
• Scroll left/right. Scrolls the
data on the display.
• Return home. Returns the
display to the original position (if
Fig. 4: Actual-size solder-side track layout of capacitance meter PCB

36 ELECTRONICS PROJECTS Vol. 23


it had been previously scrolled).

Microprocessor inter-
face for
LCD unit
The LCD module incorporates a
character-generator ROM that
produces 160 different 5x7 dot-
matrix character patterns. It
also has a character-generator
RAM (64 bytes), through which
the user may define up to eight
additional 5x7 dot-matrix char-
acter patterns, as required by the
application.
To display a character, posi-
tional data is sent via the data
bus from the microprocessor to
the LCD module, where it is writ-
ten into the instruction register.
A character code is then sent and
written into the data register of
the LCD module.
The module displays the
corresponding pattern in the
Fig. 5: Component-side track layout of capacitance meter PCB
specified position. It can either
increment or decrement the dis-
play position automatically after
each character entry, so only suc-
cessive character codes need to be
entered to display a continuous
character string. The display/
cursor shift instruction provides
for display shift either from left
to right or right to left.
The display data RAM (DD
RAM) and the character-gen-
erator RAM (CG RAM) may be
used as general-purpose data
areas. The module may be oper-
ated with either dual 4-bit or
single 8-bit microprocessors. It
can operate from a logic supply
as low as 5 volts, which makes it
ideal for use with CMOS micro-
processors.
The features of an LCD mod-
ule are summarised below:
• Can be interfaced with
4-bit/8-bit microprocessors.
• 80x8-bit display data RAM
(80 characters).
• Character generator
ROM—eight different user- Fig. 6: Component layout for the PCB
programmed 5x7 dot-matrix
patterns. microprocessor. off, cursor on/off, blink cursor, cursor
• Display data RAM and character • Numerous instructions such as shift, and display shift.
generator RAM can be accessed by the clear display, cursor home, display on/ • Built-in power-on reset.

ELECTRONICS PROJECTS Vol. 23 37


Table II circuitry, 8kB EPROM IC 2764 contain- (of which only two are used in this cir-
ing a suitable monitor program of the cuit) as under:
auto-ranging capacitance measurement 0000 to 1FFFh - EPROM chip-select
software along with LCD driver program. (2764)
The circuit also contains a 2kB 6116 2000h to 3FFFh - RAM chip-select for
RAM, an I/O address decoder 74LS138 6116 (only 2k used out of 8k)
(IC5), memory address decoder 74LS138 that is, 2000h to 27FFh is used for 6116
(IC4), and the required logic generation RAM. For 6264 8k RAM, it would be pos-
circuitry. sible to use the full address range of the
For capacitance measurement, I/O chip-select signal coming out from the
chip-select signals are generated as shown 74138 decoder IC4.
in Fig. 2. A single 74126 IC is used for the Another 74138 (IC5) decoder is used
input port. Only one of the four bus buff- in this circuit so as to generate I/O chip-
ers inside 74126 IC is used for sensing the select signals for the LCD module, sense
CMOS gate (C4)
output passed
via inverter
gates N10 and
N11. The output
port uses 7475
IC for latching
D0 through D2
bits, which are
used as flags 0
• Built-in oscillator. through 2 for the
Fig. 3 shows the connections of LCD switching sec-
module to the Z-80 processor. The con- tion for range
nections to the LCD module from the selection and ca-
microprocessor are as under: pacitor charge/
(a) Data lines D0-D7 (pins 7 discharge func-
through 14) tions as dis-
(b) Chip-select signal (active-high cussed earlier.
pin 5) The Z-80
(c) Read-write signal (R/W) (pin 5: uses a 2MHz
read = logic 1, write = logic 0) crystal clock
(d) A0 line to register-select (RS) pin that is obtained
4 (data reg.= logic 1, instruction reg.= from an oscil-
logic 0). lator wired
(e) +5V power supply and ground around a couple
(f) Contrast control pin 3; a 10k po- of 7404 gates as
tential is connected as shown in Fig. 2 for shown in Fig. 2,
adjusting the contrast of the LCD. since the Z-80
The LCD module operates on 5 volts doesn’t have a
at a supply current of only 2 mA. Units built-in clock
having an LED for backlighting (such as circuitry. It
LT111R) require an additional 35-40 mA. has 16 address
The access or enable cycle of the control- lines, of which
ler in the LCD module for data transfer A0 through
is typically 1 microsecond and hence the A12 are used
signals from the microprocessor can be for selecting
directly interfaced. Data bus D0 through blocks of 8k
D7, address line A0, a read/write signal, memory each.
and an enable signal complete the connec- Address lines
tions from the microprocessor. A13 through
A15 are used
together with
The circuit MREQ signals
Fig. 2 shows the circuit of a typical mi- in decoder
croprocessor unit designed and tested for 74138 to get
auto-ranging capacitance measurement. eight decoded
It includes Z-80 microprocessor, clock address ranges Main flow-chart

38 ELECTRONICS PROJECTS Vol. 23


appendix ‘a’

Addr. Code Label Mnemonics Comments Addr. Code Label Mnemonics Comments
0000 ORG 0000H 00CA D1 POP DE
0000 ED 56 IM 1 00CB F1 POP AF
0002 31 FF 27 LD SP,27FFH 00CC C9 RET
0005 FB P0: EI 00D0 ORG 00D0H
0006 21 90 00 LD HL,C_MESG 00D0 3A FF 20 DELAY1: LD A,(20FFH)
0009 CD ED 04 CALL LOGO 00D3 3C INC A
000C C3 05 00 JP P0 00D4 32 FF 20 LD (20FFH),A
0038 ORG 0038H 00D7 CD BF 00 CALL DELAY
0038 CD D0 05 CALL C_MEASURE 00DA C9 RET
003B C9 RET 00E0 ORG 00E0H
003C 00E0 C5 DELLONG: PUSH BC
0050 ORG 0050H 00E1 06 0A LD B,10
0050 D3 C0 COMMAND: OUT (C0H),A ;Write an LCD Command 00E3 CD BF 00 L0: CALL DELAY
;Code 00E6 05 DEC B
0052 CD BF 00 CALL DELAY 00E7 C2 E3 00 JP NZ,L0
0055 C9 RET 00EA C1 POP BC
0080 ORG 0080H 00EB C9 RET
0080 F5 DRAM: PUSH AF ;Write a data into LCD 00F0 ORG 00F0H
;address 00F0 3E 01 CLEAR: LD A,01H ;To clear LCD.
0081 DB C0 INI: IN A,(C0H) ;Status read LCD 00F2 CD 50 00 CALL COMMAND
0083 E6 80 AND 80H ;D7 bit cheek 00F5 C9 RET
0085 C2 81 00 JP NZ,INI ;Wait for busy LCD 0100 ORG 0100H
0088 F1 POP AF 0100 3E 38 ROLLMD: LD A,38H ;For 1 row type LCD
0089 D3 C1 OUT (C1H),A ;Out to LCD write 0102 CD 50 00 CALL COMMAND
;register 0105 3E 0E LD A,0EH
008B CD BF 00 CALL DELAY ;10ms 0107 CD 50 00 CALL COMMAND
008E C9 RET 010A 3E 06 LD A,06H
0090 ORG 0090H 010C CD 50 00 CALL COMMAND
0090 43 C_MESG:DB 43H ;”Conect the Capacitor & 010F 3E 80 LD A,80H
;Press the Button” 0111 CD 50 00 CALL COMMAND
;Message. 0114 3E 01 LD A,01H
0091 6F DB 6FH 0116 CD 50 00 CALL COMMAND
0092 6E DB 6EH 0119 C3 20 01 JP WW
0093 65 DB 65H 0120 ORG 0120H
0094 63 DB 63H 0120 3E 80 WW: LD A,80H ;Address of 1st character
0095 74 DB 74H in LCD
0096 20 DB 20H 0122 CD 50 00 CALL COMMAND
0097 74 DB 74H 0125 0E 02 LD C,02H
0098 68 DB 68H 0127 11 00 22 LD DE,2200H ;Display area buffer
0099 65 DB 65H 012A 06 10 LD B,10H ;16 Character
009A 20 DB 20H 012C 1A ZZ: LD A,(DE) ;Take character Code
009B 43 DB 43H 012D 13 INC DE
009C 61 DB 61H 012E 05 DEC B ;Cheek for all 16
009D 70 DB 70H ;characters
009E 61 DB 61H 012F CD 80 00 CALL DRAM ;Write character data into
009F 63 DB 63H ;LCD
00A0 69 DB 69H 0132 C2 2C 01 JP NZ,ZZ
00A1 74 DB 74H 0135 CD BF 00 CALL DELAY ;10ms
00A2 6F DB 6FH 0138 C3 80 01 JP YY
00A3 72 DB 72H 0180 ORG 0180H
00A4 20 DB 20H 0180 3E 90 YY: LD A,90H ;Point to end of display
00A5 26 DB 26H ;RAM address into LCD
00A6 20 DB 20H 0182 CD 50 00 CALL COMMAND
00A7 50 DB 50H 0185 3E 07 LD A,07H ;Shift left Code for LCD
00A8 72 DB 72H 0187 CD 50 00 CALL COMMAND
00A9 65 DB 65H 018A 1A DP: LD A,(DE)
00AA 73 DB 73H 018B FE FF CP FFH ;End of message
00AB 73 DB 73H 018D CA CF 01 JP Z,ZERO
00AC 20 DB 20H 0190 CD 80 00 CALL DRAM ;Write & shift left
00AD 74 DB 74H 0193 CD D0 00 CALL DELAY1
00AE 68 DB 68H 0196 CD BF 00 CALL DELAY
00AF 65 DB 65H 0199 13 INC DE
00B0 20 DB 20H 019A CD E0 00 CALL DELLONG ;Delay for shifting display
00B1 42 DB 42H 019D C3 8A 01 JP DP
00B2 75 DB 75H 01CF ORG 01CFH
00B3 74 DB 74H 01CF C9 ZERO: RET
00B4 74 DB 74H 0200 ORG 0200H ;Range routine to
00B5 6F DB 6FH ;Capacitor
00B6 6E DB 6EH 0200 06 05 RANGE_C: LD B,05 ;Flag bits vary from 5
00BF ORG 00BFH ;to 7
00BF F5 DELAY: PUSH AF ;10ms OR more 0202 97 P1: SUB A ;To first discharge the
00C0 D5 PUSH DE ;capacitor
00C1 11 90 0F LD DE,0F90H ;Delay time period.
0203 D3 01 OUT (01),A ;Output 0 to port 01
00C4 1B C4: DEC DE
00C5 7A LD A,D 0205 CD BF 02 CALL Delay ;Wait 100ms
00C6 B3 OR E 0208 78 LD A,B ;Get flag byte
00C7 C2 C4 00 JP NZ,C4 0209 D3 01 OUT (01),A ;Output to meter circuit
020B 11 00 00 LD DE,0000H ;Count=0 to start

ELECTRONICS PROJECTS Vol. 23 39


Addr. Code Label Mnemonics Comments Addr. Code Label Mnemonics Comments
020E 13 Still: INC DE ;Increment it 0318 06 06 LD B,06H
020F DB 01 IN A,(01) ;Read the sense flag port 031A 21 F0 21 LD HL,21F0H ;Contents of 21f0,21f1
0211 E6 02 AND 02H ;Mask the sense bit ;multiplied by 22 and
0213 CA 0E 02 JP Z,Still ;If not charge, count still ;result in 21f6
0216 CD 60 02 CALL CHECK ;Check if time too short 031D 1A P000: LD A,(DE)
;to charge capacitor 031E 8E ADC A,(HL)
0219 D2 26 02 JP NC,Further ;If not short, process it 031F 27 DAA
021C 04 INC B ;Try next range 0320 12 LD (DE),A
021D 78 LD A,B ;Get old flag bit value 0321 23 INC HL
021E FE 08 CP 08H ;Find if last range 0322 13 INC DE
0220 C2 02 02 JP NZ,P1 ;If not go to repeat 0323 05 DEC B
;messges 0324 C2 1D 03 JP NZ,P000
0223 C3 40 04 JP UR ;Jump underrange 0327 3E 00 LD A,00H
0226 CD 80 02 Further: CALL BINBCD ;Call to convert time 0329 17 RLA
;count to BCD form 032A 12 LD (DE),A
0229 C9 RET 032B 0D DEC C
0260 ORG 0260H 032C C2 15 03 JP NZ,Q
0260 7A CHECK: LD A,D ;Pick high byte 032F C1 POP BC
0261 B7 OR A ;If high byte not equal to 0330 D1 POP DE
;zero 0331 E1 POP HL
0262 C2 69 02 JP NZ,NO_CHECK ;no further check 0332 C9 RET
0265 7B LD A,E ;Pick low byte 0350 ORG 0350H ;Convert the result &
0266 D6 09 SUB 09H ;to check if<10. ;store in ASCII numerals
0268 D8 RET C 0350 05 CONV_ASCII: DEC B ;Fix dec. point accg. to
0269 37 NO_CHECK: SCF ;range
026A 3F CCF 0351 11 F0 21 LD DE,21F0H
026B C9 RET 0354 21 F6 21 LD HL,21F6H
0280 ORG 0280H 0357 7E P: LD A,(HL) ;Get byte
0280 21 00 00 BINBCD: LD HL,0000H 0358 E6 0F AND 0FH ;Sparate digits
0283 22 F0 21 LD (21F0H),HL 035A C6 30 ADD A,30H ;first one convert to
0286 22 F2 21 LD (21F2H),HL ;Clear Dec. NO. ;ASCII
0289 7B BT1: LD A,E ;Check if DE is 0 035C 12 LD (DE),A ;Save it
028A B2 OR D 035D 05 DEC B ;B has range factor NO.
028B C8 RET Z 035E CC 80 03 CALL Z,FIXDP ;Fix dec. point if B=0
028C 1B DEC DE ;Decrement NO. 0361 7E LD A,(HL) ;Get byte
028D 21 F0 21 LD HL,21F0H 0362 E6 F0 AND F0H
0290 CD 96 02 CALL INCD 0364 1F RRA ;Next digit
0293 C3 89 02 JP BT1 0365 1F RRA
0296 7E INCD: LD A,(HL) ;Routine decrement 0366 1F RRA
;decimal NO. 0367 1F RRA
0297 37 SCF 0368 E6 0F AND 0FH
0298 3F CCF 036A C6 30 ADD A,30H ;Convert to ASCII
0299 C6 01 ADD A,01 036C 13 INC DE
029B 27 DAA 036D 12 LD (DE),A
029C 77 LD (HL),A 036E 05 DEC B ;One digit over
029D DA A1 02 JP C,INC 036F CC 80 03 CALL Z,FIXDP ;Fix dec. point accg. to
02A0 C9 RET ;the range factor
02A1 23 INC: INC HL 0372 13 INC DE
02A2 C3 96 02 JP INCD 0373 23 INC HL
02BF ORG 02BFH 0374 7D LD A,L
02BF F5 Delay: PUSH AF 0375 FE FB CP FBH ;Last byte of result
02C0 D5 PUSH DE 0377 C2 57 03 JP NZ,P
02C1 11 40 00 LD DE,40H 037A C9 RET
02C4 CD BF 00 LP: CALL DELAY 0380 ORG 0380H
02C7 1B DEC DE 0380 3E 2E FIXDP: LD A,2EH ;ASCII Code to dec.point
02C8 7A LD A,D 0382 13 INC DE
02C9 B3 OR E 0383 12 LD (DE),A
02CA C2 C4 02 JP NZ,LP 0384 C9 RET
02CD D1 POP DE 0385 ORG 0385H ;Thise routine fills the
02CE F1 POP AF ;display area 2108 with
02CF C9 RET ;value of capacitor
0300 ORG 0300H ;Scale factor multiply ;including dec.point
;routine 0385 06 00 FILLDISP: LD B,00H
;Thise routine multiplies 0387 11 08 21 LD DE,2108H
;the count 038A 21 F9 21 LD HL,21F9H
0300 E5 SCALE: PUSH HL ;by 22 as per equation 038D 0E 00 LD C,00H ;Skip flag set to zero
;(5.1) 038F 7E P11: LD A,(HL)
0301 D5 PUSH DE 0390 FE 30 CP 30H ;Check if leading zero
0302 C5 PUSH BC 0392 CA C0 03 JP Z,SKIP_TEST
0303 21 00 00 LD HL,0000H 0395 0E FF NO_SKIP: LD C,FFH ;If not aleading 0,C=FF
0306 22 F4 21 LD (21F4H),HL 0397 7E LD A,(HL)
0309 22 F6 21 LD (21F6H),HL 0398 12 LD (DE),A
030C 22 F8 21 LD (21F8H),HL 0399 13 INC DE
030F 22 FA 21 LD (21FAH),HL 039A 2B SKIP2: DEC HL
0312 AF XOR A ;Hex of 22 039B FE 2E CP 2EH
0313 0E 16 LD C,16H 039D CC C8 03 CALL Z,TWO_MORE ;After 2 dec. point
0315 11 F6 21 Q: LD DE,21F6H 03A0 05 DEC B

40 ELECTRONICS PROJECTS Vol. 23


Addr. Code Label Mnemonics Comments Addr. Code Label Mnemonics Comments
03A1 C2 8F 03 JP NZ,P11 04C0 79 K1: LD A,C
03A4 C9 RET 04C1 B7 OR A
03A5 04C2 CA B5 04 JP Z,K3
03C0 ORG 03C0H 04C5 C3 B0 04 JP K4
03C0 79 SKIP_TEST: LD A,C 04C8 06 03 K2: LD B,03
03C1 B7 OR A JP Z,SKIP2 04CA C9 RET
03C5 C3 95 03 JP NO_SKIP 04CB
03C8 06 03 TWO_MORE: LD B,03H ;B register tells NO.of 04ED ORG 04EDH
;further places 04ED 11 00 22 LOGO: LD DE,2200H ;Location of buffer
03CA C9 RET ;memory
0440 ORG 0440H 04F0 7E A11: LD A,(HL) ;Read & Transfer to
0440 11 60 04 UR: LD DE,MESSAGEUR ;buffer area for display
0443 21 00 22 LD HL,2200H ;Table of characters for 04F1 12 LD (DE),A
;moving message display 04F2 13 INC DE
0446 1A M1: LD A,(DE) 04F3 23 INC HL
0447 77 LD (HL),A 04F4 7B LD A,E
0448 23 INC HL 04F5 FE 28 CP 28H
0449 13 INC DE 04F7 C2 F0 04 JP NZ,A11
044A 7D LD A,L 04FA CD 00 01 CALL ROLLMD ;Shows LOGO message
044B FE 22 CP 22H ;Lenth of message under 04FD C1 POP BC
;range 04FE C7 RST 00H ;Re_start
044D C2 46 04 JP NZ,M1 0500 ORG 0500H ;Subroutine finds the dec.
0450 CD 00 01 CALL ROLLMD ;point
0453 C7 RST 00H 0500 0E 00 FIX_SHIFT: LD C,00H
0460 ORG 0460H 0502 21 F9 21 LD HL,21F9H
0460 43 MESSAGEUR: DB 43H ;”Capacitor open or value 0505 7E B0: LD A,(HL) ;Point to result area
;too low.” 0506 FE 30 CP 30H
0461 61 DB 61H 0508 CA 2A 05 JP Z,A1
0462 70 DB 70H 050B FE 2E CP 2EH ;Is it dec. point.
0463 61 DB 61H 050D CA 34 05 JP Z,B1
0464 63 DB 63H 0510 79 LD A,C
0465 69 DB 69H 0511 E6 7F AND 7FH
0466 74 DB 74H 0513 FE 05 CP 5H ;= or > 5 zeros after
0467 6F DB 6FH ;dec. point
0468 72 DB 72H 0515 D2 1E 05 JP NC,KK1
0469 20 DB 20H 0518 FE 02 CP 2H ;= or > 2 zero after dec.
046A 6F DB 6FH ;point.
046B 70 DB 70H 051A D2 24 05 JP NC,KK2
046C 65 DB 65H 051D C9 RET
046D 6E DB 6EH 051E 0E 06 KK1: LD C,6H
046E 20 DB 20H 0520 CD 40 05 CALL MOVEDP
046F 6F DB 6FH 0523 C9 RET
0470 72 DB 72H 0524 0E 03 KK2: LD C,3H
0471 20 DB 20H 0526 CD 40 05 CALL MOVEDP
0472 76 DB 76H 0529 C9 RET
0473 61 DB 61H 052A 2B A1: DEC HL
0474 6C DB 6CH 052B 79 LD A,C
0475 75 DB 75H 052C 17 RLA
0476 65 DB 65H 052D D2 05 05 JP NC,B0
0477 20 DB 20H 0530 0C INC C ;Flag is on.
0478 74 DB 74H 0531 C3 05 05 JP B0
0479 6F DB 6FH 0534 2B B1: DEC HL
047A 6F DB 6FH 0535 3E 80 LD A,80H ;80 means Set flag (Dec.
047B 20 DB 20H ;point found).
047C 6C DB 6CH 0537 B1 OR C
047D 6F DB 6FH 0538 4F LD C,A
047E 77 DB 77H 0539 C3 05 05 JP B0
047F 2E DB 2EH 0540 ORG 0540H ;C Register contain NO.
0480 FF DB FFH ;of shifts.
04A0 ORG 04A0H 0540 C5 MOVEDP: PUSH BC
04A0 06 00 VALUETRANS: LD B,00H 0541 21 F9 21 LD HL,21F9H
04A2 11 08 21 LD DE,2108H 0544 7E P10: LD A,(HL)
04A5 21 F9 21 LD HL,21F9H 0545 2B DEC HL
04A8 0E 00 LD C,00H 0546 FE 2E CP 2EH
04AA 7E K0: LD A,(HL) 0548 C2 44 05 JP NZ,P10
04AB FE 30 CP 30H 054B 7E C1: LD A,(HL) ;Take dec. NO.
04AD CA C0 04 JP Z,K1 054C 23 INC HL
04B0 0E FF K4: LD C,FFH 054D 77 LD (HL),A ;put on previous place
04B2 7E LD A,(HL) 054E 2B DEC HL
04B3 12 LD (DE),A 054F 2B DEC HL ;point to least significant
04B4 13 INC DE ;NO.
04B5 2B K3: DEC HL 0550 0D DEC C
04B6 FE 2D CP 2DH 0551 C2 4B 05 JP NZ,C1 ;NO of dec. shifts over
04B8 CC C8 04 CALL Z,K2 0554 23 INC HL ;point previous location
04BB 05 DEC B 0555 3E 2E LD A,2EH ;put a dec. point there
04BC C2 AA 04 JP NZ,K0 0557 77 LD (HL),A
04BF C9 RET 0558 C1 POP BC

ELECTRONICS PROJECTS Vol. 23 41


Addr. Code Label Mnemonics Comments 05D3 CD 00 02 CALL RANGE_C ;To measure capacitance
0559 C9 RET 05D6 CD 00 03 CALL SCALE ;To scale the value
0560 ORG 0560H 05D9 CD 50 03 CALL CONV_ASCII ;To convert to ASCII
0560 79 MESG_TRAN: LD A,C 05DC CD 00 05 CALL FIX_SHIFT
0561 FE 06 CP 06H ;Check if 6 dec.places 05DF CD 60 05 CALL MESG_TRAN
;shifted then 05E2 CD A0 04 CALL VALUETRANS
0563 CA 79 05 JP Z,pF ;write pF. 05E5 CD 00 06 CALL LCD_DPLAY
0566 FE 03 CP 3 05E8 76 HALT
0568 CA 72 05 JP Z,nF ;check if 3 dec. place 05E9
;shifted then write nF. 0600 ORG 0600H
056B 21 A0 05 mF: LD HL,mF_MESSAGE 0600 3E 38 LCD_DPLAY: LD A,38H ;LCD Intialise
056E CD 90 05 CALL TRANSFER ;To transfer message. 0602 CD 50 00 CALL COMMAND ;Write LCD com.register
0571 C9 RET 0605 3E 0E LD A,0EH
0572 21 B0 05 nF: LD HL,nF_MESSAGE 0607 CD 50 00 CALL COMMAND
0575 CD 90 05 CALL TRANSFER 060A 3E 06 LD A,06H
0578 C9 RET 060C CD 50 00 CALL COMMAND
0579 21 C0 05 pF: LD HL,pF_MESSAGE 060F 3E 80 LD A,80H ;Frist character’s address
057C CD 90 05 CALL TRANSFER ;set
057F C9 RET 0611 CD 50 00 CALL COMMAND
0590 ORG 0590H 0614 3E 01 LD A,01H ;clear LCD
0590 11 00 21 TRANSFER: LD DE,2100H ;To LCD display area 0616 CD 50 00 CALL COMMAND
0593 7E MORE: LD A,(HL) ;Get the NO. 0619 3E 80 LD A,80H ;Address set, repeat
0594 12 LD (DE),A 061B CD 50 00 CALL COMMAND
0595 13 INC DE 061E 0E 02 LD C,02H
0596 23 INC HL 0620 11 00 21 LD DE,2100H
0597 7B LD A,E 0623 06 10 LD B,10H ;for 16 character,single
0598 FE 08 CP 08H ;For 8 characters ;Row
059A C2 93 05 JP NZ,MORE 0625 1A MR: LD A,(DE) ;Take character
059D C9 RET 0626 13 INC DE
05A0 ORG 05A0H 0627 05 DEC B ;All 16 over
05A0 43 mF_MESSAGE: DB 43H ;Cap.uF= 0628 CD 80 00 CALL DRAM
05A1 61 DB 61H 062B C2 25 06 JP NZ,MR ;Repeat for more
05A2 70 DB 70H 062E CD BF 00 CALL DELAY ;Wait 10ms
05A3 2E DB 2EH 0631 C9 RET
05A4 20 DB 20H 0632 END
05A5 75 DB 75H *********** S Y M B O L I C R E F E R E N C E T A B L E ************
05A6 46 DB 46H A1 052A A11 04F0 B0 0505 B1 0534
05A7 3D DB 3DH BINBCD 0280 BT1 0289 C1 054B C4 00C4
05B0 ORG 05B0H CHECK 0260 CLEAR 00F0 COMMAND 0050 CONV_ASCII
05B0 43 nF_MESSAGE: DB 43H ;Cap.nF= 0350
05B1 61 DB 61H C_MEASURE 05D0 C_MESG 0090 DELAY 00BF DELAY1 00D0
05B2 70 DB 70H DELLONG 00E0 DP 018A DRAM 0080 Delay 02BF
05B3 2E DB 2EH FILLDISP 0385 FIXDP 0380 FIX_SHIFT 0500 Further 0226
05B4 20 DB 20H INC 02A1 INCD 0296 INI 0081 K0 04AA
05B5 6E DB 6EH K1 04C0 K2 04C8 K3 04B5 K4 04B0
05B6 46 DB 46H KK1 051E KK2 0524 L0 00E3 LCD_
05B7 3D DB 3DH DPLAY 0600
05C0 ORG 05C0H LOGO 04ED LP 02C4 M1 0446 MESG_
05C0 43 pF_MESSAGE: DB 43H TRAN 0560
05C1 61 DB 61H ;Cap.pF= MESSAGEUR 0460 MORE 0593 MOVEDP 0540 MR 0625
05C2 70 DB 70H NO_CHECK 0269 NO_SKIP0395 P 0357 P0 0005
05C3 2E DB 2EH P000 031D P1 0202 P10 0544 P11 038F
05C4 20 DB 20H Q 0315 RANGE_C0200 ROLLMD 0100 SCALE 0300
05C5 70 DB 70H SKIP2 039A SKIP_ 03C0 Still 020E TRAN- 0590
05C6 46 DB 46H TEST SFER
05C7 3D DB 3DH TWO_MORE 03C8 UR 0440 VALUE- 04A0 WW 0120
;OVERALL TRANS
;CAPACITANCE METER YY 0180 ZERO 01CF ZZ 012C mF 056B
;ROUTINE mF_MESSAGE 05A0 nF 0572 nF_MESSAGE 05B0 pF 0579
05D0 ORG 05D0H ;Overall Capacitance pF_MESSAGE 05C0
;Meter Routine.
05D0 CD F0 00 C_MEASURE: CALL CLEAR ;To Clear.
Addr. Code Label Mnemonics Comments

port, and flag generation circuit. I/O discussed earlier. For output port (port 1), as to make a compact assembly. Actual-
decoding is done here by lower address D0 through D2 bits are used for outputting size PCB track layouts of the solder and
lines A0, A1, and A7 together with the flags 0 through 2, which are intended for component sides are shown in Figs 4 and
IORQ signal as shown in Fig. 2. Port 1 charge/discharge and switching functions 5, respectively. Fig. 6 shows the compo-
signal is combined with Rd* and WR* for capacitance measurement. nent layout including the position of the
signals of the processor, so as to generate LCD module.
the logic for Port 1 read and Port 1 write The unit, after assembly, can be tested
signals for ICs 74126 (input port) and 7475 Construction with the software program given in the
(output port), respectively. For input port, The LCD capacitance meter is built using listing of Appendix ‘A’, which is to be burnt
bit 1 of port 1 is used as the sense bit for a double-sided PCB. The LCD module is into a 2764 EPROM. It draws 0.1-amp
the capacitance measurement module as fixed over the ICs in a lifted fashion, so current at 5 volts from a battery back-up.

42 ELECTRONICS PROJECTS Vol. 23


If CMOS Z-80 chip is used, is rendered automatically.
the current requirement The flow-charts for the main
will be reduced to less than program and important
120 mA, making battery subroutines are given in the
operation feasible for long boxes.
durations. Once time t for charging
is found using equation (1),
the program divides it by the
Software for the chosen resistance value and
multiplies by the scale fac-
interface tor, giving the capacitance
The software for inter- value. The capacitance value
facing between the LCD may be in µF or pF and is
module and microprocessor accordingly indicated by the
Z-80 is relatively simple. display.
It basically performs con- The number of counts
trol (display on/off, cursor multiplied by 22 is converted
blink/no blink, etc) and to BCD and stored in the
data operations. Control memory. Then this is divided
operations set up display by the value of R, by just
features, while data opera- inserting a decimal point at
tions write the actual data the proper place. This is be-
to be displayed to the LCD cause all the three resistors
module. Minimum func- used via switches A, B, and
tions that the software C are exact multiples of 10.
driver must perform are: The BCD digits are re-
For instruction write written in ASCII form by
operation: expanding each byte into
• Set up DB0 through two ASCII numbers. The
DB7 data bits for the de- result is saved in the buffer
sired control code for display. Then parameter
• Set up R/W line to µF or nF, etc, together with
logic zero message ‘capacitor=’, is also
• Set RS line to logic 1 Flow chart for fix-shift and MOVEDP subroutines stored in the buffer space.
• Strobe the enable line The display buffer is 16
For data write operation: INA, 01 Input from port 1 bytes long, of which the first eight bytes
• Set up DB0 through DB7 data bits AND 02 Mask the sense flag bit are for message, the last two are for µF
JPZ, P1 If the sense flag is not high,
for the desired character and nF indication, and the rest six bytes
loop back to Still:
• Set up R/W line to logic 0 (DE register contains the for a decimal point—to indicate the value
• Set RS line to logic 1 count value) of the measured capacitance. The decimal
• Strobe the enable line The four instructions in the loop are is put three and six places to the right
The user may also read data and con- INC DE, INA 02, AND 02, and JPZ. The when the value of C is indicated in nF
trol signals from the LCD module. Control timings for these instructions are 6, 11, and pF, respectively.
read and data read drivers are similar to 4, and 10 clock cycles, totalling 31 clock If the result contains more than two
write drivers, except that R/W line is set cycles. For 2MHz Z-80 clock, this equals to zeros after the decimal point and doesn’t
to logic 1. 31x0.5 = 15.5 µs. Hence the scaling factor contain any integer other than the frac-
in Equation (1) is 15.5x1.144 = 22. tional value, the decimal point is shifted
For small-value capacitors, the resis- by three or six places. The display is ac-
Capacitor find program: tor switched by switch A may charge the cordingly changed to nF or pF.
LDA 00 Let A=0 initially capacitor quickly and therefore the count The monitor program listing is given
Out 01 To discharge C by closing
value may be low, leading to an inaccu- in Appendix ‘A’.
switch D
Call delay Wait 100 ms for discharge rate measurement. If the count value is EFY lab note. Useful literature on
LDA 05 To switch A-on less than 10, the program causes closing Hitachi 44780 LCD controller and its in-
Out 01 Make the counter as zero of switch B; capacitor C (under test) is terfacing aspects are included in CD.
LDA (DE)
discharged by closing switch D before ❏
Still: INC DE Increment counter
switch B. In this way, the range selection

ELECTRONICS PROJECTS Vol. 23 43


Voice Recording and
Playback
BASED ON INFORMATION STORAGE DE-
VICES INC. AND ELETECH ELECTRONICS
APPLICATION NOTES

A
number of semiconductor solution for short-duration messages
manufacturers market digital without using any external memory. The Parts List (Fig. 2)
voice processing chips with dif- VP-1000A chip uses an external memory Semiconductors:
ferent features and coding techniques that can be extended to virtually no limit IC1 - ISD1420 Single-chip voice
record/playback device
for speech compression and processing. by using an external counter.
LED1 - Red LED
Advanced chips such as Texas Instru- These devices find applications in
Resistors (all ¼-watt, ±5% carbon, unless
ments’ TMS320C31 can be used with voice memo recorders, sound effect gen- stated otherwise):
various voice-processing algorithms erators, and announcers for consumer, R1, R9 - 1 kilo-ohm
including code-excited linear prediction industrial, security, and telecommunica- R2 - 5.1 kilo-ohm
(CELP), adaptive differential pulse code tion products. R3, R4 - 10 kilo-ohm
R5 - 470 kilo-ohm
modulation (ADPCM), A law (speci- R6-R8 - 100 kilo-ohm
fied by CCIT), µ law (specified by Bell
Telephone), and vector sum-excited ISD1400 based device Capacitors:
C1 - 220 µF, 16V electrolytic
linear prediction (VSELP, a voice coding The IC ISD1400 provides a high-quality, C2-C5 - 0.1µF ceramic disk
standard for US digital cellular com- single-chip record/play solution for short C6 - 4.7µF, 16V electrolytic
C7 - 0.001µF ceramic disk
munications). messages. The internal functional
Miscellaneous:
We have chosen two economical dig- diagram of an ISD1400 series chip is S1-S3 - Push-to-on tactile switch
ital voice-processing ICs: the ISD1400 shown in Fig. 1. The chip comprises a - 8-ohm, 500mW speaker
series chip from Information Storage De- mic amplifier, 5- pole antialiasing filter, - Electret or condensor mic
vices Inc. (now part of Winbond Electronic internal clock and timing circuitry, 128k - 5V, 250mA supply source
Corp., USA) and the VP-1000 chip from cell NVRAM for message storage, 5-pole
Eletech, Taiwan. The ISD1400 series IC active smoothing filter, and audio power power conditioning and control circuitry.
provides a single-chip record/playback amplifier, besides address buffers and A unique thing about the ISD1400 is
that speech samples are stored without
digitisation and compression, unlike the
other chips. This direct analogue storage
provides for a very true and natural sound
reproduction of voice, music, and other
tones. Pin functions of IC ISD1400 are
given below.
Voltage inputs VccA (pin 16), VccD
(pin 28). Analogue and digital circuits in
the chip use separate power lines (VccA
and VccD). These two should be tied to-
gether close to the IC.
Ground inputs VssA (pin 13), VssD
(pin 12). These are analogue and digital
grounds which must be tied together close
to the device.
Record (REC, pin 27). This is the
active-low record signal. The device
records whenever this pin is taken low,
Fig. 1: Fundamental block diagram of ISD1400 series chip i.e. for the duration of the recording this

44 ELECTRONICS PROJECTS Vol. 23


crophone should be AC coupled
to pin 17 via a series capacitor.
The capacitor value, together
with the internal 10-kilo-ohm
resistor on this pin, determines
the low-frequency cutoff for the
series passband.
Microphone ref (MIC
REF, pin 18).This is the in-
verting input to the microphone
preamplifier. It provides a
noisecancelling common-mode
rejection input to the IC when
connected differentially to a
microphone.
Automatic gain control
(AGC, pin 19). The AGC dy-
namically adjusts the gain of
Fig. 2: Single-chip record/playback circuit using ISD1420 chip the preamplifier to compensate
pin takes precedence over playback. If low-going transition is detected on this for the input levels ranging from whisper
REC pin is taken low during a playback pin, a playback cycle begins, which to loud sound, enabling their recording
cycle, the playback immediately ceases continues until an EOM is encountered with minimal distortion. The ‘attack’
and recording begins. A record cycle is or the end of memory space is reached. time is determined by the time constant
completed when either REC pin is pulled Upon completion of the playback cycle, of a 5-kilo-ohm internal resistor and an
high or the memory space is filled. An end the device powers down automatically external capacitor (C6) in parallel with
of message marker (EOM) is internally into standby mode. 470 kilo-ohm resistor R5 as shown in the
recorded, enabling a subsequent playback Taking this pin high during a play- schematic diagram of Fig. 2.
cycle to terminate appropriately. back cycle will not terminate the current Analogue output (ANA OUT, pin
Playback (PLAYE, pin 24). When a playback cycle. 21). This pin provides the preamplifier
P l a y b a c k output to the user. The gain of the pream-
(PLAYL, pin 23). plifier is determined by the voltage level
This is a level-activat- at AGC pin.
ed input pin. When it Analogue input (ANA IN, pin 20).
transits from high to This pin transfers input signal to the
low, a playback cycle chip for recording. The ANA OUT pin
is initiated. Playback should be connected to it via an external
continues until the pin capacitor. If desired, the input derived
is pulled high or an from a source other than a microphone
EOM is detected or the can be capacitively coupled to ANA IN
end of memory space is pin directly.
reached. External clock input (EXCLOCK,
Record LED (RE- pin 26). The internal clock circuitry has
CLED, pin 25). This ±5% tolerance over the industrial tem-
pin is low during a perature and voltage range. If a higher
Fig. 3: Actual-size, single-side PCB for the circuit in Fig. 2 record cycle and can be precision is required, the device can be
used to drive an LED to clocked through EXCLOCK pin. The
indicate that a record required clock frequency is 1024 kHz for
cycle is in progress. It ISD1416 to provide 8 kHz sampling rate
momentarily pulses and 819.2 kHz for ISD1420 to provide
low when an EOM is 6.4kHz sampling rate. If EXCLOCK is not
encountered in a play- used, this pin should be grounded.
back cycle. Speaker outputs (SP+, pin 14; SP-,
Microphone input pin 15). These pins provide direct drive
(MIC, pin 17). Pin 17 for a loudspeaker with impedance as low
is used for connecting as 16 ohms. A single output may be used,
a microphone to the but for direct-driven loudspeakers the
in-built preamplifier. two opposite-polarity outputs provide an
An AGC circuit controls improvement in output power of up to four
the gain of this pream- times over a single-ended connection.
plifier from –15 to 24 Further, a speaker coupling capacitor
Fig. 4: Component layout for the PCB in Fig. 3 dB. The external mi- is not required. However, a single-ended

ELECTRONICS PROJECTS Vol. 23 45


Table I held high. This operational mode remains Pulling the PLAYL signal pin low and
Pin Functions of SRAM effective until the next low-going signal holding it in this position initiates a
Pin Function appears at these control pins. At this playback cycle from the beginning of the
CS1, CS2 Chip-select inputs point, the current address/mode levels are message space. If recording has filled
OE Output-enable input sampled and executed. the message space, the entire message is
WE Write-enable input played. When the device reaches the EOM
I/O1–I/O8 Data inputs/outputs marker, it automatically powers down. A
A0–A16 Address inputs Operation subsequent falling edge on PLAYL initi-
Vcc Power
Vss Ground 1. Record a message, filling the ad- ates a new play cycle from the starting
dress space. Pulling the REC signal address.
connection will require an AC coupling pin low initiates a record cycle from the (b) Level-activated playback (trun-
capacitor between SP pin and the speaker. beginning of the message space. If REC cated). If the PLAYL pin is pulled high
During the recording mode, speaker out- is held low, the recording continues un- any time during the playback cycle, the
puts are in high-impedance state. til the message space is filled. Once the device stops playing and enters the pow-
Address inputs A0-A7 (pins 1 message space is filled, recording ceases. erdown mode. A subsequent falling edge
through 6, pin 9, pin 10). Address inputs The device will automatically power down on PLAYL initiates a new play cycle from
have two functions depending upon the after the REC pin is pulled high. the start address.
level of two MSBs of the address. If either
of the two MSBs (A6 and A7) is low, the Table II
inputs are all interpreted as address bits Functional Truth Table of K6T1008C2E SRAM
and are used as the start address for the CS1 CS2 OE WE I/O Mode Power
current record or playback cycle. Address H X1) X1) X1) High-Z Deselected Standby
inputs are latched by the falling edge of X1) L X1) X1) High-Z Deselected Standby
PLAYE, PLAYL, or REC. L H H H High-Z Output disabled Active
If both the MSBs (A6 and A7) are high, L H L H Dout Read Active
L H X1) L Din Write Active
the remaining address bits A0 through A5
Note: X means don’t care; must be in high or low states.
are interpreted as mode bits. This implies
that direct address (explained above) and
the operational modes cannot be used 2. Edge-activated playback. Mo- 4. Record (interrupting playback).
simultaneously. mentarily pulling the PLAYE signal pin As mentioned earlier, the REC signal pin
Note that all operations begin at ad- low initiates a playback cycle from the takes precedence over other operations. A
dress 0, which is the beginning of the beginning of the message space. The lowgoing transition on REC pin initiates
address space. Also, when the device is rising edge of PLAYE has no effect on a new record operation from the beginning
changed from record to playback mode, operation. If a recording has filled the of the start address, regardless of the cur-
the address pointer is reset to 0. However, message space, the entire message is rent operation in progress.
when the device is changed from playback played. When the device reaches the 5. Record a message, partially fill-
to record mode, the address pointer is not EOM marker, it automatically powers ing the address space. A record opera-
reset to 0. down. A subsequent falling edge on tion needs not to fill the entire message
An operational mode is executed when PLAYE initiates a new play cycle from space.
any of the control inputs PLAYE, PLAYL, the start address. Taking the REC signal pin high before
and REC goes low while the two MSBs are 3. (a) Level-activated playback. filling the complete message space causes
the recording to stop and an EOM to be
placed. The device powers down automati-
cally.
6. Play back a message, partially
filling the address space. Pulling the
PLAYE or PLAYL signal low initiates a
playback cycle that is completed when an
EOM is encountered. The playback ceases
and the device powers down.
Basically, the system can be configured
using a mic, a speaker, three pushbuttons,
and a handful of other passive compo-
nents as shown in Fig. 2. The actual-size,
single-side PCB for the circuit in Fig. 2 is
shown in Fig. 3 and its component layout
is shown in Fig. 4.
ISD1400 denotes the series, while
ISD1416 and ISD1420 denote message
storage lengths of 16 and 20 seconds,
Fig. 5: Internal functional diagram of VP-1000A respectively, in the 1400 series. ICs with

46 ELECTRONICS PROJECTS Vol. 23


message storage capacity up to 16 minutes stored. Parts List (Fig. 7)
are also manufactured by ISD and are The internal functional block diagram Semiconductors:
available with Formox Semiconductors, of VP-1000A is shown in Fig. 5. Functional
IC1 - VP-1000A digital voice
Mumbai. description of its pins is given below: processor
A0-A14 (pins 10 through 3, 37, 36, IC2 - K6T1008C2E 128k x 8-bit
33, 35, 2, 38, and 39). These are output CMOS SRAM
VP-1000A based device address bus pins. IC3 - CD4040 12-bit binary coun-
ter
We’ve used the voice processor IC VP- ANG & ANG (pins 25 and 23). These IC4, - LM358 dual op-amp
1000A in conjunction with low-power are differential analogue audio output IC6 - LM386 low-power audio
1MB (128k x 8-bit) CMOS static RAM signal pins. amplifier
K6T1008C2E from Samsung Electronics C1, R1 (pins 14 and 15). These are D1-D3 - 1N4148 switching diode
to realise a single-message record-andplay input pins for the internal RC oscillator. Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
application. The VP-1000A employs the If an external clock is used, it must be R1, R2 - 3.3-kilo-ohm
continuous variable slope delta (CVSD) connected to pin 14 and its frequency R3 - 470-kilo-ohm
modulation technique for speech process- should be at least double the sampling R4, R16, R17,
ing. rate. R20, R15 - 47-kilo-ohm
R5 - 330-kilo-ohm
This circuit can be modified for CLK DRV (pin 19). It provides a R6 - 1-kilo-ohm
multiple-message playback using a square wave of the same frequency as the R7 - 4.7-kilo-ohm
preprogrammed EPROM or ROM. sampling rate when the chip is in record R8 - 560-kilo-ohm
The 32k x 8 direct memory addressing or play mode. (The frequency will be lower R9, R10,
R12, R23 - 10-kilo-ohm
capability is expandable by using an when the chip is in idle mode.) R11 - 270-ohm
external counter. Sampling rate can be COMPDATA (pin 18). This is the R13, R18 - 27-kilo-ohm
varied from 24 kbps to 128 kbps. For input pin for feedback from the external R14, R19 - 100-kilo-ohm
playback-only applications using ROM comparator output. R21, R22 - 33-kilo-ohm
VR1, VR2 - 50-kilo-ohm preset
or EPROM, the sound must be digitised D0-D7 (pins 11 through 13 and VR3 - 50-kilo-ohm potmeter
using an external voice development pins 27 through 31). These are input/ Capacitors:
system, such as VP-880 manufactured output data bus pins. C1 - 0.01µF ceramic disk
by the same firm. ENV (pin 22). This input pin is to C2 - 2.2µF ceramic disk
An external counter such as CD4040 be connected to the external integrator C3, C10, C11 - 1µF, 16V electrolytic
C4 - 47µF, 16V electrolytic
can be easily added to extend memory output. C5 - 33nF ceramic disk
addressing to virtually any limit. There- INT (pin 21). This output pin is to C6 - 0.5nF ceramic disk
fore very long messages can be easily be connected to the external integrator to C7 - 47nF ceramic disk
C8, C9,
C15, C18 - 10µF, 16V electrolytic
C12, C13, C16 - 4.7nF ceramic disk
C14 - 0.1µF ceramic disk
C17 - 220µF, 16V electrolytic
Miscellaneous:
S1, S2 - Push-to-on switch
LS1 - 8-ohm, 500mW speaker
Mic - Condensor mic

produce envelop waveform.


GND (pin 20). This is the ground
pin.
PLAY (pin 17). This is an active-low
input pin. When the chip is idle, but not
under reset, pulsing this pin will put the
chip in the play mode.
READ (pin 32). This active-low out-
put pin indicates that the chip is in the
play mode and is usually used to enable
memory output.
RECORD (pin 34). This is an ac-
tivelow input pin. When the chip is idle,
but not under reset, pulsing this pin will
put the chip in the record mode.
RESET (pin 16). This active-high
input pin is level-sensitive and resets the
chip back to idle mode.
R/W (pin 1). This active-low output
Fig. 6: Fundamental block diagram of SRAM K6T1008 C2E pin generates a pulse each time the clock

ELECTRONICS PROJECTS Vol. 23 47


the external K6T-
1008C2E SRAM.
Memory address
expansion. The VP-
1000A’s internal 15-bit
address counter cov-
ers up to 32k x 8 or
256-kbit memory space,
which is expanded by
using line A14 as clock
input to the counter
formed by CD4040
(IC3) in Fig. 7.
The first counter
output becomes A15,
the second output A16,
and so on. This is be-
cause the VP-1000A,
once started, doesn’t
stop recording or play-
ing until it is reset. Thus
the VP-1000A can access
an unlimited memory
space. When the inter-
nal counter reaches the
maximum count, it sim-
ply overflows and starts
from ‘0’ again.
However, here we
are using 1M SRAM (ad-
dress lines A0 through
A16 only) and as such
Q3 (equivalent to ad-
dress line A17) output
of counter CD4040 is
used for resetting both
the VP-1000A as well as
counter CD4040 itself
through diode D1.
Reset considera-
tion. Reset pin 16 of
the VP-1000A should
be never left floating.
A 0.01µF capacitor has
been added so that the
VP-1000A gets a reset
pulse on power-up.
Fig. 7: Single-message record/playback circuit using VP-1000A Record-and-play-
back circuit. This
counts to 8 and is usually used as a write retention current. The output is circuit uses two dual-LM1458 op-amps
strobe for the SRAM. It is active only in tristate and TTL-compatible. The that operate on a split supply. The
record mode. internal functional block diagram negative DC voltage is developed by
TD, TD (pins 26 and 24, respective- of the K6T1008C2E SRAM is shown rectifying clock output (CLK DRV) at
ly). These output pins for signal modula- in Fig. 6. Pin functions of the SRAM pin 19 of the VP-1000A using diodes
tion are useful only in record mode. are summarised in Table I and its D2 and D3 and capacitors C9 and C18.
VDD (pin 40). This is the input pin truth table is shown in Table II. This negative voltage is applied to pin
for supply voltage. 4 of LM1458 ICs.
The 128k x 8-bit low-power CMOS During recording mode (selected by
static RAM K6T1008C2E supports a low The circuit momentary depression of record switch
data retention voltage of 2 volts (min) for Fig. 7 shows the circuit for recording S1), the condensor mic output is ampli-
battery back-up operation with a low data and playback of a single message using fied by op-amp N2. The output from

48 ELECTRONICS PROJECTS Vol. 23


provide better sound quality, but at the
expense of lower voice storage time for a
given SRAM. Presets VR1 and VR2 may
be adjusted for the best speech quality.
An actual-size, single-side PCB for the
circuit in Fig. 7 is shown in Fig. 8 and its
component layout in Fig. 9.
Modifications for single-message
playback only. To use the circuit shown
in Fig. 7 for playing a prerecorded mes-
sage, you need to:
• Leave pin 1 (R/W*) of the VP-1000A
open and connect pin 24 (OE*) of SRAM
(IC2) to ground.
• Disconnect R18, R19, R13, R14, C10,
and C11.
• Ground pin 18 (comp) of the VP-
1000A.
• Remove IC4 and its circuitry com-
prising VR2, R4 through R12, mic, C4
through C7, and C18.
• Disconnect record pushbutton S1.
In place of SRAM you may use an
EPROM in this circuit.
Requirements for multiple-mes-
sage playback, sequential control.
For such a circuit, a higher-capacity
EPROM/SRAM of, say, 8M (1024k x
8-bit) is used. An 8M EPROM will have
Fig. 8: Actual-size, single-side PCB for the circuit in Fig. 7
address lines A0 through A19. Address

opamp N2 is applied to the non-inverting


pin of opamp N1. An internal modulating
voltage developed across pins 24 and 26
of the VP-1000A (during record mode
only) is amplified by opamp N3 and ap-
plied to the inverting pin of opamp N1.
The output of op-amp N1, which can be
varied with the help of preset VR2, is
applied to comparator pin 18 for suitable
processing and storage into the SRAM in
digital format.
In play mode (selected by momen-
tary depression of play switch S2), the
digital data from SRAM is converted
into analogue form and output across
pins 23 and 25 of the VP-1000A. This
output, after suitable amplification and
filtering by opamp stages N3 and N4, is
used to drive a lowpower AF amplifier
stage built around LM386 IC. Volume
adjusting potmeter VR3 and gain adjust-
ing preset VR4 determine the final audio
output level.
Preset VR1 determines the clock
frequency for the voice processor. The
sampling frequency is half of the clock
frequency. The minimum sampling fre-
quency chosen should be twice the speech
bandwidth (20–3400 Hz) or roughly 8
kHz. A higher sampling frequency will Fig. 9: Component layout for the PCB in Fig. 8

ELECTRONICS PROJECTS Vol. 23 49


single-message playback, except for the
reset scheme adapted for the VP-1000A
and CD4040 ICs (refer Fig. 10). The first
depression of play switch will activate the
first segment. The next depression will
activate the next segment, and so on.
One can also use a 48-pin DIP IC
VP-1410 (from the same manufacturer),
which has an in-built playback capabil-
ity for up to 10 messages and 16 address
lines. However, it doesn’t have the on-chip
recording facility.
Caution. For commercial uses, the
circuit in Fig. 7 would need further
improvement since the quality of repro-
Fig. 10: Reset pin wiring for multiple-message replay duced sound recorded via the condenser
mic may not be commercially accept-
lines A0 through A14 of the EPROM are respectively. able.
to be connected to the identical address The 8M EPROM can be divided into EFY lab note. The details of
output lines from the VP-1000A as before, 32 equal segments of 256 kbits (or 32 kB) ISD1400 and datasheets of VP-1000A
while address lines A15 through A19 are each. One message is to be stored in each as well as VP-1410A, including their
to be connected to CD4040’s out-puts of these segments of 256 kbits or smaller. application circuits in .PDF format, is
Q1 through Q5, i.e pins 9, 7, 5, 4, and 3, Rest of the circuit is analogous to that of included in the CD. ❏

Readers’ comments some ‘Q’ factors, etc. such as Motorola 56300 in conjunction
Q1. Thanks for the wonderful Voice Re- M. Shaharyar with MATLAB and GUI interface are
cording and Replay circuit. Ranchi used. If you are interested in a ready-
Kindly clarify whether I can use the A1. EFY: The various sound effects that made board for the mentioned sound
same ICs for audio effect generators, you have mentioned require a great deal effects and much more, then Creative’s
such as Digital Reverb, Echo, Chorus, of additional circuitry and an R&D effort PCI-compliant Sound Blaster Audio
Phaser, and Phlenger circuits. These over a long period, if we have to adopt Card Model CT4830 may prove to be
circuits require continuous record and ISD1400 series voice processor ICs for of great help. For its data sheet you
play, user-controlled record and play speed these sound effects. Generally, for elabo- may visit www.soundblaster.com or
(the Clock), user-controlled feedback, and rate sound effect generation, DSP ICs www.eax.creative.com.

50 ELECTRONICS PROJECTS Vol. 23


PC-Based Dial Clock
With Timer
VIJAYA KUMAR P.

I PC’s parallel port


nterfacing electronic hardware Table I shows pin details, including
projects with a PC and running the their traditional and present usage, of the
application using software is a real The PC’s parallel port (LPT port) is used standard parallel port (SPP).
fun. Here is a PC-based dial clock with to output the display code and necessary The base address of the first parallel
timer that displays time on an LED dial control signals for the dial clock. It is port (LPT1) is 0378 (hex) or 888 (decimal).
made up of 73 LEDs. terminated into a 25-pin ‘D’ type female The data port of the parallel port can be
In this dial clock each minute is dis- connector at the back of your PC. The accessed by its base address, i.e. 0378
played by a separate minute LED. Simi- IBM PC usually comes with one or two (hex) or 888 (decimal). The status port
larly, each hour is displayed by the corre- LPT ports. can be accessed using base address+1,
sponding hour bicolour LED. An LED at the Each parallel port is actually made up i.e. 0379 in hex (or 889 in decimal). The
centre of the dial forms blinking ‘seconds’ of three ports, namely, data port, status control port can be accessed using base
LED, which will be ‘on’ during every even port, and control port. address+2, i.e. 037A in hex (or 890 in
second. The colour of the hour-indicating Pins 2 through 9 form the 8-bit data decimal).
bicolour LED becomes green during AM port. This is a purely write-only port that A similar procedure can be followed for
hours and red during PM hours. can be used only to output data. LPT2, whose base address is 0278 in hex.
The timer built into the clock uses the Pins 1, 14, 16, and 17 form the control In the present application we require only
PC’s time interrupt to provide an accurate port. This port has read/write capability, to output data, and since status port is a
time delay. It can be set by specifying the which means it can be used both to out- read-only port, the same is not used.
required time delay in terms of hours, put some data to the external hardware
minutes, and seconds via the software. or to input some data from the external
Once the timer is set, it starts counting hardware. Hardware interface circuit
down. As soon as the count becomes 0, the Pins 15, 13, 12, 10, 11 together form As shown in Fig. 1, the hardware in-
relay gets energised. The relay contacts the status port. This is a read-only port, terface circuit comprises 4-to-16 line
can be used to switch an equipment on/off which means it can be used only to read decoder 74LS154, octal tristate buffer
after the required time delay. data from the external hardware. 74LS244, a few LEDs, a transistor, and

Table I
Parallel-Port Pin Details
Pin number Traditionnal use Port name Read/Write Port address Port bill Hardware Present use
inverted ?
2-5 Data out Data port W Base D0-D3 No To output hour & mintue data
6-9 Data out W Base D4-D7 No To multiplex minute LEDs
1 Strobe Control port R/W Base+2 C0 Yes To make bicolour hour LEDs
green during AM
14 Auto feed R/W Base+2 C1 Yes To make bicolour hour LEDs
red during PM
16 Initialise R/W Base+2 C2 No To make seconds LED on/off
for each second
17 Select input R/W Base+2 C3 Yes To control the relay
15 Error Status port R Base+1 S3 No Not used
13 Select R Base+1 S4 No Not used
12 Paper end R Base+1 S5 No Not used
10 ACK R Base+1 S6 No Not used
11 Busy R Base+1 S7 Yes Not used
18-25 Ground — — — — — Ground

ELECTRONICS PROJECTS Vol. 23 51


52
ELECTRONICS PROJECTS Vol. 23
Fig. 1: Interface circuit for dial clock
gate of tristate buffer 74LS244 dress inputs A, B, C, and D of IC1.
(IC2), only when C0 bit of the con- LED61 is a blinking seconds LED that
trol port is made high. is connected to C2 bit of the control port
Similarly, the anodes of all red through current-limiting resistor R6. C3
LEDs inside the bicolour LEDs are bit of the control port is connected to the
made common and get the positive base of transistor T1 through resistor R1
supply through current-limiting for relay control.
resistor R7 via a non-inverting gate The octal tristate buffer 74LS244 (IC2)
of tristate buffer 74LS244 (IC2), is used in the circuit to protect the parallel
only when C1 bit of the control port port from damage due to wrong connections
is made high. in the LED dial clock. Also, each buffer
The 60 minute LEDs are di- inside the IC 74LS244 can sink/source the
vided into four groups of 15 LEDs. current needed by the LEDs.
The cathodes of 15 LEDs of each The IC 74LS244 comprises eight non-
group are connected to Q0 through inverting tristate gates and is provided
Fig. 2: LED layout pattern (scale 3:1) for dial clock Q14 outputs of IC1 as shown in with two separate active-low enable pins
some passive components. Fig. 1. The anodes of 15 LEDs (pins 1 and 19). Each of these enable
The dial clock employs a single IC of each group are tied together and are pins is connected to four non-inverting
74LS154 to display both minutes and connected to data pins D4 through D7 tristate gates. Until the active-low pins
hours on the LED dial, using the time- through current-limiting resistors R1, R2, are enabled, the output remains in high-
division multiplexing technique. The
74LS154 is a 24-pin IC with pin 12 as the
ground and pin 24 as the supply (Vcc) pin.
The details of remaining 22 pins are given
in Table II.
It is clear from the truth table that
the IC 74LS154 has only 16 active-low
outputs. One of these outputs can be made
low by making active-low enable pins G1
and G2 low and by placing a 4-bit binary
address on the IC’s address inputs A, B,
C, and D.
In the circuit, twelve bicolour LEDs
are used as hour-indicating LEDs. (A
bicolour LED is built with a green LED Fig. 3: Power supply for dial clock
and a red LED and has two individual
anodes and a common cathode.) The cath- R3, and R4, respectively, via four separate impedance state. Therefore in this circuit
odes of hour LEDs are connected to Q2 tristate buffer gates of IC2. enable pins are kept permanently enabled
through Q13 active-low outputs of decoder The values selected for resistors R2 by connecting them to the ground.
74LS154 (IC1). through R8 are quite low, since the dis-
The anodes of all green LEDs inside play used here is a dynamic display. Data
the bicolour LEDs are made common and output lines D0 through D3 are used to Software
get the positive supply through current- output both the hour data and the minute The software program for this dial clock
limiting resistor R8 via a non-inverting data, and hence serve as address for ad- hardware interface is written in C lan-
guage using Turbo C compiler. It uses
the gettime() function to read the current
Table II
74LS154 Pin Details time from the system clock. The gettime()
Pin name Pin nos Pin description Comments function stores the current time in terms
G1*,G2* 18, 19 Enable inputs (active-low) Both should be low
of hours, minutes, and seconds as mem-
A,B,C & D 23 to 20 Address input (active-high) 4-bit binary address bers of the time structure now in 24-hour
Q0*- Q15* 1-11, 13-17 Outputs (active-low) Only the addressed output basis.
will go low (if G1*, G2* are low) Let us see how a real-time hour is
displayed on the twelve bicolour ‘hour’
LEDs. Since the hour stored in the time
Table III
Minutes range Logic states of the points Value of minute variable written
structure is in 24-hour format, it is first
into D0 to D3 data bits of the data ports converted into 12-hour format by the soft-
W X Y Z ware program and stored in a variable hr.
0 to 14 High Low Low Low Mn=min The value of this variable hr is written in
15 to 29 Low High Low Low m=15 - min the form of a 4-bit binary number (a nib-
30 to 44 Low Low High Low mn=30 - min ble) into data pins D0 through D3 of the
45 to 59 Low Low Low High mn=45 - min data port using the outportb() function.

ELECTRONICS PROJECTS Vol. 23 53


This serves as the address Parts List
input to the 4-to-16 line Semiconductors:
decoder 74LS154 IC1 and
IC1 - 74LS154 1-of-16 decoder/
gets decoded by the decoder demultiplexer
IC, taking the corresponding IC2 - 74LS244 octal buffer/line
output to active-low state driver
from initial high. IC3 - 7805 +5V regulator
T1 - BC547 npn transistor
In the program, am and D1-D3 - 1N4007 rectifier diode
pm variables are used to Resistors (all ¼-watt, ±5% carbon, unless
control C0 and C1 bits (pins stated otherwise):
1 and 14) of the control R1 - 1-kilo-ohm
port. R2-R5 - 100-ohm
R6-R8 - 47-ohm
Since C0 and C1 bits
Capacitors:
of the parallel port are in- C1 - 470µF, 25V electrolytic
verted, during AM C0 bit C2 - 0.1µF ceramic disc
is made high, keeping C1 Miscellaneous:
bit low, by assigning am=0 X1 - 230V AC primary to 12V-
and pm=2 via the software 0-12V, 500mA secondary
transformer
program. As a result, the
RL1 - Relay 12V, 300-ohm, 1 c/o
green LED inside the hour- S1 - On/off switch
indicating bicolour LED gets
positive supply and emits
green light. The address inputs to 74LS154 de-
Similarly, during PM coder are obtained using the statements
C1 is made high, keeping mn=min, mn=min–15, mn=min–30, and
C0 low, by assigning am=1, mn=min–45 during the minutes ranging
pm=0. As a result, the hour- from 15 to 29, 30 to 44, 45 to 59, respec-
indicating bicolour LED tively, by the software program. This is
emits red light. well explained in Table III.
Fig. 4: Actual-size, single-side PCB for interface circuit When hour is displayed Table III shows the states of points
of dial clock
on the LED dial, minute W, X, Y, and Z and the value of minute
LEDs remain in ‘off’ condi- written into data bits D0 through D3 as
tion, as D4 through D7 bits of address inputs to decoder IC1 74LS154,
the data port are held low by for different minute ranges. When min-
the software program. utes are displayed, C0 and C1 bits of the
While displaying minute, control port are held low by the software
real minutes cannot be di- program, so hour LEDs will remain off
rectly written into data out- during this period.
put lines D0 through D3, as The hour and minute displays are
the value of minute may vary made to switch automatically by the
from 0 to 59 and the address software program, with a small time
input to 4-to-16 line decoder delay of 1 millisecond inserted between
is limited to 15. them. Since the time delay is very small,
As the total number of the switching action between the hour
minutes in one hour is 60, and minute displays is very fast, and
all the 60 minute LEDs can both hour and minute LEDs appear to
be arranged in four groups be continuously glowing. The circuit
of 15 LEDs. The anodes of consumes very low power, since only one
these four groups are made decoder IC is used and only one LED is
common at W, X, Y, and Z ‘on’ at a time.
points, respectively, as shown The ‘seconds’ blinking LED is con-
in Fig. 1. This again forms a nected to C2 bit of the control port. The
multiplexed display in which variable sc is used to control C2 bit of the
the first group of LEDs gets control port in the software program. The
positive supply only dur- statement sc=(sec%2)x4, whose value be-
ing minutes 0 through 14. comes 4 for every even second and 0 for
Similarly, second, third, and every odd second, is used in the program
fourth groups will get positive to make C2 bit of the control port high
supply only during minutes for every even second and low for every
15 through 29, 30 through 44, odd second. This will make the ‘seconds’
Fig. 5: Component layout for the PCB 45 through 59, respectively. blinking LED ‘on’ for every even second

54 ELECTRONICS PROJECTS Vol. 23


Source Program
#include <dos.h> { }
#include <conio.h> mn=min; }
#include <math.h> } gotoxy(27,22);
#define PORT 0x0378 /*Base address of if(min>=15&&min<30) textcolor(7);
LPT1*/ { mn=min-15; cprintf(“Seconds remaining : “);
/*Use 0x0278 for LPT2 } textcolor(14);
*/ if(min>=30&&min<45) cprintf(“ %010lu” ,s_tim-count);
void settimer(int*,long*); {mn =min-30; ctr[0]=am;
void alarm(void); } ctr[1]=pm;
void interrupt (*old_timer)(); if(min>=45) ctr[2]=sc;
void interrupt new_timer(); {mn =min-45;
static long TICK; } for(i=0;i<3;i++)
sc=(sec%2)*4; /* making seconds LED ON/OFF {
/* main functions starts from here */ for one seconds */ ctrl+=ctr[i];
void main() if(tmr==0) }
{ { ctrlp=ctrl+tmr;
int hour,min,sec,ch=0;/* variable declara- strcpy(srly,” ON”); outportb(PORT+2,ctrlp); /*outputs data
tions */ } to control port*/
int hr,mn,sc=0,am,pm,tim_ else outportb(PORT,hr); /*outputs current
on=0,tmr=8,mul,i=0,j=0; { hour to data port*/
int ctr[3],ctrl=0,ctrlp=0; strcpy(srly,”OFF”); delay(1);
char srly[3],str[3]; } ctrlp=tmr+3;/* disable hour LEDs */
long s_tim=0,count=0; gotoxy(20 outportb(PORT+2,ctrlp);
struct time now; ,2); outportb(PORT,mn+16*mul);/*outputs
textcolor(11); current minute to data port*/
old_timer= getvect(0x08);/* Capturing time cprintf(“**** PC BASED DIALCLOCK WITH delay(1);
vector */ TIMER ****”); ctrl=0;
setvect(0x08,new_timer); /*Asigning new time gotoxy(60,24); }while(ch!=27);
vector */ textcolor(14); setvect(0x08,old_timer);/*assigning origi-
clrscr(); cprintf(“By VIJAYA KUMAR.P”); nal time interrupt */
do gotoxy(26,12); outportb(PORT,0); /*makes all the pins
{ textcolor(12); of data port low */
ch=0; cprintf(“Current time is:”); outportb(PORT+2,11);/*makes all the
_setcursortype(_NOCURSOR); textcolor(14); pins of control port low */
if(bioskey(1)) cprintf(“ %02d:%02d:%02d “ ,hr,min,sec); textcolor(7);
{ textcolor(10+j); _setcursortype(_NORMALCURSOR);
ch=getch(); cprintf(“%s” ,str); clrscr();
ch=toupper(ch); gotoxy(35,6); exit(0);
} textcolor(10); } /* main function end */
cprintf(“S”);
/* To get the current time and store it in a textcolor(7); /* function to change timer settings */
time structure */ cprintf(“et Timer.\n”); void settimer(int *ptim_on,long *ps_tim)
gotoxy(35,8); {
gettime(&now); textcolor(14); char numstr[10];
hour=now.ti_hour; cprintf(“Esc”); long ho,mn,sc;
min=now.ti_min; textcolor(7); clrscr();
sec=now.ti_sec; cprintf(“ to Exit.\n”); _setcursortype(_NORMALCURSOR);
gotoxy(25,8); gotoxy(18,16); cprintf(“Enter Hour”);
textcolor(13); gets(numstr);
/* To convert time from 24 hour format to 12 cprintf(“————————Timer Sta- ho=atol(numstr);
hour format tus———”); cprintf(“Enter minute”);
& to change the colour of hour & minute gotoxy(34,18); gets(numstr);
indicating LEDs textcolor(7); mn=atol(numstr);
to green during am & to red during pm */ cprintf(“Relay is “); cprintf(“Enter seconds”);
textcolor(12); gets(numstr);
if(hour>=12) cprintf(“%s”, srly); sc=atol(numstr);
{ pm=0; gotoxy(18,20); *ps_tim=ho*3600+mn*60+sc;
am=1; textcolor(7); *ptim_on=1;
j=2; cprintf(“Timer Current Settings in seconds : TICK=0;/* initialising TICK with zero */
strcpy(str,”:PM”); %010lu “,s_tim); clrscr();
hr=hour-12; }
} if(ch==83) /* to make sound when timer has stopped
if(hour<12) { tmr=8; counting */
{am=0; settimer(&tim_on ,&s_tim ); void alarm(void)
pm=2; } {
j=0; int i;
strcpy(str,”:AM”); if(tim_on==1) for(i=0;i<50;i++)
hr=hour; { count=TICK/18.21;/* coverting Ticks into {
} seconds */ sound(1000+i*10);
if(hr==0) if(s_tim==count) delay(10);
{ { nosound();
hr=12; tmr=0; }
} ctrlp = tmr+3; }
/* To display minutes in multiplexed dis- outportb(PORT+2,ctrlp); /* our new ISR for timer */
play*/ tim_on=0; void interrupt new_timer()
i=min/15; count=0; { TICK++;
mul=pow(2,i); s_tim=0; (*old_timer)();
if(min<15) alarm(); }

ELECTRONICS PROJECTS Vol. 23 55


and ‘off’ for every odd second. and its value is returned into the vari-
Timer. The timer uses the PC’s time able s_time in the main program using Operation
interrupt to produce an accurate time de- the pointer. When the program is run after compilation,
lay. The time interrupt occurs 18.21 times At the same time, the TICK is initial- the software displays current time both on
per second, i.e. 18.21 ticks per second. ised with a value of 0. The value of the the LED dial and the monitor screen. The
When the timer ticks, BIOS interrupt 8 variable TICK will get incremented by 1 timer settings can be changed by pressing
will occur and the original timer-interrupt each time interrupt 8 occurs. This value is the ‘S’ key. On pressing the ‘S’ key, the pro-
service routine (ISR) in the ROM-BIOS converted into seconds by the statement gram prompts you to enter hours, followed
will get called. 'count=TICK/18.21'. The value of remain- by minutes and seconds.
We can define a new time-interrupt ing seconds will be shown on the monitor The timer can be set to any desired delay
service routine (ISR) and replace the original screen by the statement printf (“%010lu”, by entering the time delay in terms of hours,
time-interrupt service routine with it. In s_tim-count). minutes, and seconds. For example, if you
the software program, old_timer = getvect As soon as the count becomes equal want to set the timer for 1 hour, 30 minutes,
(0x08) is used to capture the PC’s time- to s_tim, C3 bit of the control port goes and 25 seconds, you can input 1 hour, 30 min-
vector. The new interrupt service is assigned high. Since C3 bit of the control port is utes, and 25 seconds or 0 hours, 90 minutes,
using setvect (0x08,new_timer). Whenever connected to the base of transistor T1 and 25 seconds or 0 hour, 0 minute, 5425
interrupt 8 occurs, i.e. the timer ticks, the through a non-inverting tristate buffer seconds. All the three inputs are valid.
time-interrupt service new_timer () gets and current-limiting resistor R1, transis- As soon as the last variable (the number
called and provides the required service. tor T1 gets forward biased to energise of seconds) is entered, the remaining seconds
Since the time-interrupt service routine the relay. and the current timer settings are shown on
contains the statement TICK++, the value The relay contacts can be connected as the monitor screen. The countdown process
of variable TICK gets incremented by 1 each a switch to turn on/off the gadget after the will continue until the number of remaining
time interrupt 8 occurs. required time delay. The relay will remain seconds becomes equal to zero. As soon as the
The timer can be set to any desired ‘on’ until the timer is made to reset with counting stops, the relay will get energised
delay in terms of hours, minutes, and new time settings. and the PC’s speaker sounds to indicate that
seconds. As soon as the last variable (the An actual-size, single-side PCB for the the set time delay has elapsed. The on/off
number of seconds) is entered, the timer interface circuit (Fig. 1) including power relay status is also shown on the monitor
settings are converted into seconds by the supply circuit is shown in Fig. 4 with its screen. The program can be terminated by
statement *ps_tim=ho*3600+mn*60+sc; component layout in Fig. 5. pressing Esc key. ❏

56 ELECTRONICS PROJECTS Vol. 23


Electronic Century
Calender
A.K. Paul

I
n order to know the day of birth,
important national/international
days of historical importance,
and so on, we need to go through the
calander of that specific year, which is
usually unavailable. It is then that we
feel the need for a calander that could
tell the day on any date of any month
of any year.
Here is an electronic century ca-
lander that facilitates easy reading of
the day on any date of any month of any
year. It can be easily fabricated using
the following low-cost, readily available
components:
• A thin wooden board having dimen-
sions of 44x35x0.4 cm
• 75 brass screws (4mm dia.) with
nuts and washers Fig. 1: Layout diagram for the electronic calender
• 49 green/red LEDs
• Thin plastic-coated or insulated TABLE I TABLE II TABLE III
copper wire
SA S M T W TH F F SA S M T W TH S M T W TH F SA
• Two 1.5V dry cells S M T TH F
W SA SA S M T W TH F M T W TH F SA S
M T W TH F SA S S M T W TH F SA T W TH F SA S M

Layout T W TH F SA S M M T W TH F SA S W TH F SA S M T
W TH F SA S M T T W TH F SA S M TH F SA S M T W
Suitably mark the wooden board for dif-
TH F SA S M T W W TH F SA S M T F SA S M T W TH
ferent items following the guidelines for
F SA S M T W TH TH F SA S M T W SA S M T W TH F
each specific section in Fig. 1 as given
below: Overlays for section 4 of Fig. 1
1. Section 1 pertains to years in any
century. A century starts with 0th year
Table IV
and ends with 99th year. Each row, except Groups of Centuries and Corresponding Point Pairs For Jumpering
the fourth row, comprises 28 years (00
Gp 1 Point Gp 2 Point Gp 3 Point Gp 4 Point
through 27 in row 1, 28 through 55 in row Cen- pairs Cen- pairs Cen- pairs Cen- pairs
2, 56 through 83 in row 3, and 84 through turies turies turies turies
99 in row 4). 00+ [A + K] 200+ [A + L] 300+ [A + P] 400+ [A + Q],
On a 42x8cm paper sheet, make 112 100+ [B + Q] 600+ [B + K] 700+ [B + O] 800+ [B + P]
1.5x2cm boxes and write figures 0 through 500+ [C + P] 1000+ [C +Q] 1100+ [C + N] 1200+ [C + O]
99 within these boxes as per section 1 of 900+ [D + O] 1400+ [D + P] 1500+ [D + M] 1600+ [D + N]
Fig. 1. Now paste this paper on the wooden 1300+ [E + M] 1800+ [E + N] 1900+ [E + K] 2000+ [E + L]
board with glue, leaving a margin of about 1700+ [F + L] 2200+ [F + M] 2300+ [F + Q] 2400+ [F + K]
1 cm on the top and sides of the board. 2100+ [G + N] 2600+ [G + O] 2700+ [G + L] 2800+ [G + M]
Make two 4mm dia. holes, with a 2500+ and so on and so on and so on
vertical centre-to-centre distance of 1 cm, and so on
under each of the 28 columns. Insert a Note. Only one applicable point of section 1 for a specific year of a century group is to be shorted
screw along with a washer from the top to its corresponding point of section 4.

ELECTRONICS PROJECTS Vol. 23 57


side in each hole and secure it with
nut from the bottom side.
2. Section 2 pertains to the
months. In order to account for the
leap year months, two additional
rows (one for January and the other
for Feburary month of the leap year)
have been added. On a 6x21cm
sheet, make 14 boxes of 6x1.5 cm
for writing the months as shown in
section 2 of Fig. 1. Paste the sheet
leaving a margin of 2 cm from sec-
tion 1 and 1 cm from the left. Make
two holes of 4mm dia. against each
month following the guidelines
depicted for section 1 and insert a
screw along with a washer in each
hole and secure it with a nut from
bottom side.
3. Section 3 shows a date cal-
ender with dates 1 through 31
(maximum) for any month. It has
been made on a 10x14cm sheet. The
dimensions of each box for the date
can be taken as 2x2 cm. Suitably
paste the sheet, leaving a gap of 16
cm from the right for accommodating
section 4.
4. Section 4 with 49 boxes is
the most important section. Each
box of this section has an LED.
Each column of Tables I through
III represents the seven days of a
week of a specific month of a specific
year during a century. Any one of
the three sheets shown as Tables I
through III is used as an overlay to
cover 49 boxes of section 4 as per the
following details:
(a) Table I is to be used for cen-
Fig. 2: Wiring for the circuit turies 00+, 100+, 500+, 900+, 1300+,
1700+, 2100+, 2500+, and so on.
(b) Table II is to be used for centuries
200+, 600+, 1000+, 1400+, 1800+, 2200+,
2600+, and so on.
(c) Table III is to be used for centuries
300+, 400+, 700+, 800+, 1100+, 1200+,
1500+, 1600+, 1900+, 2000+, 2300+, and
so on.
After completion of wiring and place-
ment of jumpers (explained later), only
one out of 49 LEDs will get selected for
a specific month of a specific year of a
specific century. The column in which the
lighted LED falls will represent the days
of the week to be taken into account for
the said month.

Wiring
Fig. 3: Links/connections for the example of August 15, 1947 The LEDs in boxes of section 4 are

58 ELECTRONICS PROJECTS Vol. 23


Fig. 4: An actual-size, single-side PCB for the calender circuit

represented by small triangles. The ver- Similarly, the inner screws of sec- corresponding point (K, or L, or..., Q)
tex point represents the cathode and the tion 2 have been shorted together and as applicable for the specific group of
base of the triangle represents the anode. connected to the negative terminal of centuries as per Table IV. An example
The cathodes of all the LEDs in each 3V battery. This completes the wiring of given later will clarify this further.
row have to be shorted (at the back side the board. The above connections will extend the
of the board) and then connected to the positive terminal of the battery to anodes
outer screws of section 2 against certain of some of the LEDs of section 4 via point
months as shown in Fig. 2. The anodes Jumpering procedure K, or L, or..., Q from the corresponding
of the LEDs of all the boxes have been Select one of the three overlays (Tables point A, or B, or..., G of section 1 of Fig. 1
connected in a specific fashion and finally I through III) to place over the LEDs as applicable.
terminated on seven screws annotated in section 4 as per guidelines given for Now short the two screws against the
with letters K through Q. section 4. selected month. This will result in the
The outer 28 screws of section 1 have Now mark the year box (in the se- negative supply from the battery being
been wired together in a specific manner lected century) in section 1 of Fig. 1, extended to the cathodes of LEDs of one
and finally terminated on seven screws an- and short the two screws under that of the seven rows of section 4. Since the
notated with letters A through G. The in- column using a jumper. Determine anode of only one LED of that row gets
ner screws of section 1 have been shorted the column (A, or B, or..., G) in which the positive supply via one of the points
together and connected to the positive that box falls. Now extend the marked K, or L, or..., Q as mentioned before, only
terminal of a 3V battery. point (A, or B, or..., G) further to the one LED out of 49 LEDs of section 4 will

ELECTRONICS PROJECTS Vol. 23 59


Fig. 5: Component layout and top screen for the PCB

glow. The complete column of the overlay 2. In section 1, spot the year 47 and against date 15 (of section 3) from the
(depicting seven days of a week) in which short (using jumper) the two screws under active weekday column. It is found to be
the illuminated LED falls becomes ap- the box containing ‘47’. This point happens Friday (F).
plicable for the selected month. For any to be ‘C’. EFY Lab note. For those who wish to
particular date (in section 3 of Fig. 1) of 3. Now from Table IV we find that use a PCB rather than the wooden board
the selected month, we can read the cor- century 1900+ falls in Group 3 and thus suggested by the author, an actual-size
responding day from the active column of point ‘C’ (of section 1) needs to be joined to PCB measuring 17.5×15.5 cm is shown
the overlay. point ‘N’ of section 4. The same has been in Fig. 4. The component layout and
shown in Fig. 3. top screen are shown in Fig. 5. Please
4. Now short the two screws against connect the anodes of all the 49 LEDs
Worked example the month of August in section 2. You to appropriate pads provided on the
To find out the day on August 15, 1947 will observe that LED41 in box W66 (re- tracks emanating from screw terminals
proceed as follows: fer Fig. 2) under the letter ‘W’ (Wednes- K through Q using jumper wires. Use
1. For 1947, the overlay corresponding day) of the second last column of the of 2mm dia brass screws is suggested to
to 1900+ century i.e. Table III is applicable overlay starts glowing, which indicates avoid shorting of tracks running closeby.
as overlay for section 4, hence the same that the second last column is applicable All jumpers may be connected from
has been selected and placed over the for the month of August of the year 47 of track side.
LEDs of section 4. 19th century. Now simply read the day ❏

60 ELECTRONICS PROJECTS Vol. 23


Electronic Roulette
wheel
A. Jeyabal

R
oulette is a French word meaning LEDs arranged in a circular fashion.
Parts List
‘small wheel’. It is a game of For digital display, the pulses from
Semiconductors:
chance that is much popular in block 1 are counted in block 4. Block 5
casinos and exhibitions. Most casinos have comprises 7-segment LED display to show IC1 - CD4093 quad Schmitt trig-
ger 2-input NAND gate
electromechanical type roulettes. Here’s the counted pulses digitally. IC2, IC3 - CD4017 decade counter
an electronic roulette wheel that has been IC4, IC5 - CD4033 decade counter/
made using readily available ICs. decoder/7-segment display
The wheel used in a roulette has The circuit driver
D1, D2 - 1N4148 switching diode
various numbered slots. In the electro- Decaying frequency oscillator. There are LED1-LED16 - LED (eight red and eight
mechanical type roullete when the wheel two decaying frequency oscillators built green)
is spun, a small ball starts rolling along around Schmitt trigger 2-input NAND DIS1, DIS2 - LT543 7-segment common-
the inner circumference of the wheel. The gates N1 and N2, respectively (see Fig. 2). cathode display
wheel comes to halt slowly and the ball For the sake of explanation, let us consider Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
falls in any one of the slots on the wheel. the oscillator built around NAND gate N2. R1, R2 - 1-mega-ohm
The winner is one who has placed his bet Presume that diode D2 is shorted and re- R3 - 560-kilo-ohm
for that specific slot number. In the elec- sistor R3 is removed. The input of the gate R4 - 470-kilo-ohm
tronic version, the LEDs take on the role has two distinct high- and low-voltage trip R5 - 1-kilo-ohm (see text)
R6, R8 - 330-ohm
of the ball and give the illusion of a rolling points (like timer IC 555). R7 - 100-kilo-ohm
ball, while the digital section shows the Also, suppose that capacitor C3 is in Capacitors:
winning number digitally. the discharged condition and the input C1 - 4.7µF, 16V electrolytic
(pins 5 and 6) is low and the output C2 - 0.1µF ceramic disk
(pin 4) is high. Now capacitor C3 starts C3 - 0.01µF ceramic disk
Block diagram charging through resistor R4 and when Miscellaneous:
Fig. 1 shows the block diagram of the the voltage across capacitor C3 crosses S1 - Push-to-on switch
S2 - SPST switch
roulette wheel comprising digital and the upper trip point, the input (pins 5 - 4x1.15V pen torch cells
conventional sections. Block 1 generates and 6) goes high and the output (pin 4)
oscillations with decaying frequency, turns low. place from capacitor C1. A momentary
which is necessary for emulating the Capacitor C3 starts discharging depression of spin switch S1 causes ca-
conventional roulette wheel game. In through resistor R4. When the voltage pacitor C1 to charge fully. Now capacitor
block 2, the pulses received from block across capacitor C3 goes below the lower C3 charges by taking energy from capaci-
1 are counted, decoded, and output se- trip point, the input pins are at low level tor C1 through resistors R3 and R4, and
quentially through 16 output pins. These and the output (pin 4) goes high. discharges through resistor R4 and diode
outputs are used in block 3 to light up the Again, C3 starts charging and the D2.
cycle repeats. As capacitor C3 As the energy is taken from capacitor
charges from the same voltage C1 during charging of capacitor C3 and
level (from output pin 4) during also during discharging (output pin 4 low)
‘on’ time, the duration of high through R3, the voltage level in capacitor
level is the same for every cycle C1 is slowly decreasing. As a consequence,
and there is no change in the the charging time (‘on’ time) of capacitor
frequency. C3 to reach the high trip point keeps in-
Now suppose that diode D2 creasing from cycle to cycle. The oscillator
and resistor R3 are included in frequency decays slowly until the voltage
the circuit. Charging of capacitor level in capacitor C1 goes below the up-
C3 from input pin 4 is blocked by per trip-point voltage of gate N2 and it
Fig. 1: Block diagram of electronic roulette wheel diode D2 and thus charging takes is therefore unable to charge capacitor

ELECTRONICS PROJECTS Vol. 23 61


Fig. 2: Schematic diagram of electronic roulette wheel

C3 to the upper trip point. As a result, no connected to 16 LEDs (LED1 through Presume that Q9 output (pin 11) of
further oscillations are obtained. LED16) as shown in Fig. 2. IC3 is high and its further counting is
To have a more realistic effect Let us recall the functioning of the inhibited. At this stage, IC2 is counting.
of the roulette wheel, another decaying IC CD4017 wherein Q1 through Q8 out- When Q7 output (pin 6) of IC2 goes high,
frequency oscillator comprising NAND puts are initially at low state. On each it resets IC3 and Q0 output (pin 3) of IC3
gate N1, resistors R1 and R2, capaci- positive-going clock pulse, these Q outputs goes high.
tor C2, and diode D1 is employed. It is sequentially (one at a time) go high, and On receiving the next pulse, Q8 output
similar to the former oscillator but when clock-enable (CE) pin 13 is held (pin 9) of IC2 goes high. Though IC3 re-
has a slightly lower frequency and high, further counting is inhibited and the ceives the same clock pulse, its Q1 output
slightly longer decaying time. The output output that was high at that instant stays will not turn high as IC3 was in reset state
(pin 4) of the former oscillator is connect- high. Reset pin 15 overrides all functions at the time of receiving clock pulse.
ed to the input (pin 2) of this oscillator and when this pin is high, it resets the For the next clock pulse, Q9 output
to get ANDed output pulses at pin 3 counter to take its Q0 output (not used in (pin 11) of IC2 goes high and it inhibits
of gate N1. These pulses are used by this circuit) high. Therefore, for normal counting in IC2. At the same time, Q1
IC2 and IC3 to light up the LEDs. The working, reset and CE pins must be in output (pin 2) of IC3 turns high and
former oscillator also controls the second low state. counting takes place in IC3. When Q7
oscillator. In our circuit, IC2 must be inhibited output (pin 6) of IC3 goes high, it resets
Sequential output counter. To switch on its last count and further counting IC2. And this process continues. (For
the LEDs on sequentially, two decade should be done by IC3. Likewise, IC3 more information, refer the article ‘Mul-
counter CD4017 ICs (IC2 and IC3) are must be disabled on its last count and IC2 tisequential Output Circuits’ published
used. Each of these ICs has ten outputs, should start counting. Therefore CE pin 13 in Nov.'92 issue of EFY or Electronics
out of which eight outputs (Q1 through is connected to Q9 output (pin 11) in each Projects Vol. 13.)
Q8) are used. Thus we have 16 outputs of the two ICs. The value of current-limiting resistor

62 ELECTRONICS PROJECTS Vol. 23


Fig. 3: Actual-size, single-side PCB layout for electronic Fig. 4: Component layout for the PCB
roulette wheel

R5 should not be reduced to increase resetting the ICs.


the brightness of the LEDs. The reason If the value of R5 is reduced, reset Construction
is that for resetting the CMOS CD4017 pin 15 will receive less than half of the An actual-size, single-side PCB layout for
ICs, a voltage greater than half of the supply voltage and the circuit will not the electronic roulette circuit is shown
supply voltage must be applied to reset work. For an attractive and colourful in Fig. 3 with its component layout in
pin 15. The Q outputs have some inter- display, use high-brilliance red and green Fig. 4. For roulette wheel, arrange the
nal resistance and the potential divider LEDs. LEDs in a 5cm dia. circle with an equal
comprising this internal resistance and Counter, decoder, driver, and dis- gap between adjacent LEDs and number
voltage drop at LED7/LED15 and resis- play. Two decade counter/decoder-cum- the LEDs from 1 to 16 arbitrarily. Fig.
tor R5 gives the required voltage for 7-segment common-cathode LED driver 5 shows the proposed front-panel layout
CD4033 ICs (IC4 and IC5) are cas- for the game.
caded to count the decaying frequency
pulses. These count up to 99, reset to
zero, and then count up to 99, and so on. How to play
The final count at which the counters stop Slide switch S2 to ‘on’ position to power
TENS UNITS
further counting depends on the decay- the circuit. Initially you may find that
ing oscillator’s output slowly coming to instead of one LED, two LEDs are lit.
8 1 6 a halt. This is because on initial power-on, one of
14 12 Two 7-segment, common-cathode the Q outputs of IC CD4017 goes high at
4 9 LEDs (LT543) are connected to the random. On pressing spin switch S1 and
15 2 counters for readout. To reduce the com- releasing it, only one LED will glow.
11 13 ponent count, only one current-limitting Ask your game partners to place their
3 5 resistor (R6, R8) is connected to the cath- bets and odds. Momentarily press spin
7
16 10 ode of each display (DIS1, DIS2). In order switch S1. The ‘ball’ rolls for about 12
to increase the brightness, you can reduce seconds, completing about 25 rounds, and
POWER SPIN the value of R6 and R8. then slowly comes to halt in any one of the
LT pin 14 of IC4 and IC5 are grounded ‘slots’. The person who placed bet on that
OFF ON PUSH BUTTON
through 100-kilo-ohm resistor R7. If TP slot number is the winner. Wait for five
GREEN LED RED LED (test point) is held high, the display would seconds before declaring the winner, as
Fig. 5: The proposed front-panel layout of show ‘88’. Thus we can check the service- the ball may take its final position quite
electronic roulette wheel ability of the display. slowly. ❏

ELECTRONICS PROJECTS Vol. 23 63


Readers’ comments the load from the battery when mains the set voltage of 10.5V.
Q1. I have the following queries: power is available. It enables automatic
1. What is the role of relay RL1? I switching on of the load (emergency lamps, Q2. Please suggest modifications to
understand that it is meant for adjust- inverters, etc) in the case of power failure. the same for:
ment of the initial charging voltage. 2. The load refers to anything that is 1. Use with a 6V,10Ah battery
But does it have any role in cutting off to be operated by the battery. 2. High-voltage cut-off only
the voltage after charging voltage is 3. Switch S1 is just an ‘on’\‘off’ switch 3. Automatic switching of the circuit to
reached? for the load. It plays no role in cut-off trickle charging mode when it reaches the
2. What is load? Is it a bulb/circuitry action. fully charged state
or just meant for indicating that the 4. The circuit doesn’t cut off the charg- Vijayan Thekkeveedu
charging is over? er unit from the mains. The high-voltage Nileshwar, Kerala
3. What is the function of switch S1? I cut-off action of the unit is inherent in the The author Vinod C.M. replies:
understand that it is meant to switch on/ sense that the battery can’t get charged A2. 1. Adjust the output voltage of 317T
off the load. But does it have any effect on above the regulated charging voltage (here to around 7 volts to charge the 6V,10Ah
the cut-off function as noticed by me? 12.5V) set by preset VR1, so charging battery.
4. Does auto cut-off mean that the volt- stops at exactly 12.5V. 2. If only a high-voltage cut-off is re-
age/current supply is totally disconnected 5. For low-voltage cut-off adjustment, quired, you need not use transistor SL100,
from the battery? discharge the battery by connecting the the voltage comparator (which drives
5. How the low-voltage potentiometer required load and adjust preset VR2 such SL100) and the relay.
is to be adjusted? that relay RL2 gets de-energised at the 3. When the battery voltage reaches
Manish S. Poudwal required low voltage, say, 10.5V. (It may near the preset voltage (7 volts), the
Mumbai take some time for the battery terminal charging current becomes negligible, so
The author, Vinod C.M., replies: voltage to drop to 10.5V. ) The contacts of a separate circuitry for trickle charging
A1. 1. Relay RL1 is meant to disconnect relay RL2 disconnect the load at exactly is not required.

64 ELECTRONICS PROJECTS Vol. 23


Number guessing game A. Jeyabal

H
ere is an interesting number number was greater than that held by
Parts List
guessing game in which the the other counter, and vice versa. If both
Semiconductors:
player has to find out a two-digit the counters cross 99 at the same instant,
IC1 CD4093 quad Schmitt 2-in-
hidden number. The number entered by the manually entered number is equal to
put NAND gate
the player is compared with the hidden the hidden number. Since each counter IC2-IC5 - CD4017 decade counter
number. The corresponding LED an- gets exactly 100 clock pulses, the respec- IC6, IC7 - CD4033 decade counter/
notated as ‘high’, ‘low’, or ‘win’ (correct) tive counters retain the previously held 7-segment display driver
IC8, IC9 - CD4001 quad 2-input NOR
glows to indicate that the entered number number at the end of counting.
gate
is higher, lower, or equal to the hidden DIS1, DIS2 - LT543 7-segment common-
number. The player can make another cathode display
guess in case his first guess is wrong. The Block diagram D1-D5 IN4148 switching diode
LED1-LED3 LEDs (yellow, red, and
maximum number of trials can be fixed by Fig. 1 shows the block diagram of the
green)
the game organiser. number guessing game.
Resistors (all ¼-watt, ±5% carbon, unless
The circuit uses easily available ICs Block 1 generates high-frequency stated otherwise):
and doesn’t require a magnitude compara- pulses. These pulses are used to set a R1, R3, R4, R5,
tor IC to compare the hidden number with random number in the 2-digit counter in R8, R10, R12,
the guessed number. block 4 when ‘set’ switch is momentarily R13, R15, R16 - 100-kilo-ohm
R2 - 2-mega-ohm
depressed. R6 - 470-kilo-ohm
Block 2 contains a low-frequency R7, R9 - 330-ohm
The principle oscillator whose output is individually R11, R14 - 470-ohm
A two-digit random number is hidden in connected to unit’s and ten’s counters- Capacitors:
a two-digit counter that counts 0 through cum-displays of block 5 via push switches C1, C4, C6, C7,
C8, C9, C10 - 0.001µF ceramic disk
99. The player makes a guess about the marked ‘select units’ and ‘select tens’, C2 - 0.44µF ceramic disk
hidden number and enters the guessed respectively. Thus a 2-digit number is en- C3, C5 - 0.01µF ceramic disk
two-digit number in another 2-digit coun- tered by the player in the counter in block Miscellaneous:
ter that also counts 0 through 99. 5 with the help of select switches meant S1-S4 - Push-to-on switch
After this, a total of 100 pulses are ap- for units and tens digits. The display S5 - Slide switch
4x1.5V pen torch cells or 9V
plied to both the counters simultaneously. shows the entered number comprising compact battery
The counters start counting up from the units and tens.
hidden and manually entered number Momentary depression of ‘test’ switch ter, trial number counter and display,
onwards, respectively. The counter which near block 3 causes generation of 100 100-pulse output circuit, and decoder and
crosses 99 first determines that its held pulses, which are fed to both the counters status display.
simultaneously. Block 6 compris- High-frequency oscillator. Sch-
ing three set/reset flip-flops (SRFF) mitt trigger 2-input NAND gate N1 (¼
detects which counter (random of CD4093), along with resistor R1 and
hidden number or trial number) capacitor C1, produces high-frequency
crossed 99 first, or whether both of pulses. Gate N1 has a lower trip point
the counters crossed 99 simulta- (LTP) and an upper trip point (UTP).
neously. The result is accordingly Presume that input pins 1 and 2 are
displayed by any of the ‘high’, ‘low’, initially low, output pin 3 is high, and ca-
and ‘win’ LEDs. pacitor C1 is in discharged condition. Now
The output terminals of all the C1 charges through resistor R1 and when
four switches are also connected the voltage across capacitor C1 reaches
to block 6 to keep the LEDs off the UTP, the output of N1 goes low and
during the entry of random and capacitor C1 starts discharging through
trial numbers as well as during resistor R1. When the voltage across the
testing. capacitor goes below the LTP, the output
turns high to again charge the capacitor
and the cycle repeats. The frequency of
The circuit oscillation is about 27 kHz.
Fig. 2 shows the number guessing Low-frequency oscillator. The low-
circuit that comprises a high- frequency oscillator comprises NAND
frequency oscillator, low-frequency gate N2, resistor R2, and capacitor C2
Fig. 1: Block diagram of number guessing game oscillator, random number coun- (comprising two 0.22µF ceramic disk ca-

ELECTRONICS PROJECTS Vol. 23 65


Fig. 2: Schematic diagram of number guessing game

66 ELECTRONICS PROJECTS Vol. 23


pacitors in parallel). It generates two
pulses per second and works just like
the high-frequency oscillator.
Random number counter. Two
CD4017 decade counters (IC4 and IC5)
form the random number counter for
storing the 2-digit random number.
Carryout (CO) pin 12 of IC4 is connected
to clock input pin 14 of IC5 to cascade
the two ICs.
The random number counter can
be advanced in two ways: (i) by keeping
clock input pin 14 high and applying
negative-going clock pulses to clock-
enable pin 13, and (ii) by keeping CE pin
low and applying positive-going clock
pulses to CL pin. The first method is
used during manual setting, while the
second method is used when comparing
the numbers.
On momentary depression of ran-
dom number switch S1, the pulses from
output pin 3 of NAND gate N1 (forming
the high-frequency oscillator) advance
the random number counter on the
negative transition of the pulses. As
a result, a 2-digit random number is
stored in this counter.
Fig. 3: Actual-size, single-side PCB layout for number guessing game Trial number counter and dis-
play. To store the 2-digit trial number,
two cascaded decade counter-cum-
display driver CD4033 ICs (IC6 and
IC7) are used. The stored number is
displayed by two 7-segment common-
cathode LT543 displays (DIS1 and
DIS2). IC6 and IC7 are cascaded similar
to IC4 and IC5, and their CE pins 2 are
used to advance the counters manually
with the help of ‘select units’ and ‘select
tens’ switches S2 and S4, respectively.
(A single switch will take a long time to
enter the desired number. Therefore two
separate switches are used for units and
tens digits, respectively.)
Capacitors C3 and C5 prevent the
contact bounces of switches S2 and S4.
On depression of switch S2 or switch S4,
the pulses from pin 4 of NAND gate N2
advance the respective counter (units
or tens) on the negative transition of
the pulses.
The display reads 0 through 9, and
repeats from 0 again. The ripple blank-
ing input (pin 3) of IC7 (tens digit) is
grounded to inhibit DIS2 from showing
zero. Only two current-limiting resis-
tors R7 and R9 are connected to DIS1
and DIS2, respectively, to reduce the
component count.
100-pulse output circuit. A to-
Fig. 4: Component layout for the PCB tal of 100 pulses must be output on

ELECTRONICS PROJECTS Vol. 23 67


diodes D1 and D2 goes high to inhibit 100th pulse.
NAND gate N3 until test switch S3 is Case II: When the entered trial
pressed again. This permits manual set- number is less than the hidden ran-
ting of numbers in the random number dom number. In this case, conditions are
counter and the trial number counter. just the reverse of Case I. Output pin 5
The random number counter and the trial of IC7 goes high after CO pin 12 of IC5.
number counter retain their previously Output pin 3 of gate G5 goes high finally
stored number as they have passed one to light the green LED designated ‘low’.
round of 100 clock pulses. Case III: During the subsequent
Decoder and status display. Three entries of trial numbers. Gate G7 is set
set-reset flip-flops (SRFF) comprising (high) to put off LED2 and LED3.
gates G2 and G3, G5 and G6, and G7 and Case IV: When the entered number
G8 are realised using two quad 2-input equals the hidden number. CO pins 12
NOR gate CD4001 ICs (IC8 and IC9). Both of IC5 and IC7 turn high in unison. As
the inputs of all the SRFFs are held low input pins 12 and 13 of NAND gate N4
through resistors. receive high-going pulses simultaneously,
When any of the two NOR gates of its output pin 11 goes low and, in turn,
any SRFF pair receives a high-going trig- output pin 11 of NOR gate G4 goes high,
ger, its output goes low (reset), while the which triggers gate G3. Output pin 10 of
Fig. 5: The proposed front-panel layout of output of the other gate turns high (set), gate G3 turns low to illuminate yellow
number guessing game and vice versa. ‘Win’ LED.
Further high triggering of any of At the same time, output pin 4 of
momentary depression of test switch the inputs has no effect. Both the inputs gate G2 goes high to trigger gate G8. The
S3. For this, IC2 and IC3 (CD4017) are should not be triggered (high) simultane- high output (pin 10) of gate G7 blocks
cascaded to count 100 pulses. Resistor ously, because the output state will be LED2 and LED3. Thus only yellow
R5 and diodes D1 and D2 function like undeterminate. LED1 will glow. Diodes D3, D4, and D5
an AND gate. When random number set switch S1 is isolate switches S1, S2, and S4 from each
Presume that Q9 outputs of IC2 and momentarily pressed, a high-level pulse is other.
IC3 are high. Thus the junction of resistor applied to the inputs of gates G2 and G8,
R5 and diodes D1 and D2 is at high level. and the outputs of gates G3 (pin 10) and
As the input (pins 1 and 2) of NOR gate G7 (pin 10) go high. As LED6, LED7, and Construction
G1 is connected to this junction, its output LED8 don’t get a forward bias, none of the An actual-size, solder-side PCB layout
pin 3, which is connected to CL pin 14 of LEDs will glow. for the number guessing game circuit is
IC2, goes low to inhibit the counter. At the On momentary depression of test shown in Fig. 3 with its component lay-
same time, NAND gate N3 is disabled and switch S3, output pin 3 of gate G1 goes out in Fig. 4. Fig. 5 shows the proposed
it allows no clock pulses from its output high to produce a sharp positive-going front-panel layout of the enclosure for
pin 10. pulse at the output of the differentiator the circuit.
When switch S3 is momentarily de- circuit comprising resistor R15 and capaci- This game circuit consumes only a few
pressed, capacitor C4 grounds the junction tor C9, which triggers gate G7. This resets milliamperes of current and can operate
of resistor R5 and diodes D1 and D2, and gate G7 and its output pin 10 turns low to off four 1.5V pen torch cells or a compact
hence the input to NOR gate G1 turns low. illuminate diodes D7 and D8. 9V battery.
The high output of NOR gate G1 enables
gate N3 and counter IC2. NAND gate N3
allows high-frequency pulses produced
Possible cases and Operation
by NAND gate N1 and the counter ad- their results 1. Slide switch S5 to ‘on’ position. This
vances. Case I: When the entered trial number causes any of the LEDs to glow.
Now Q9 outputs of IC2 and IC3 go low is greater than the hidden random 2. Momentarily press random number
and diodes D1 and D2 ground the input number. When 100 pulses are applied set switch S1 to hide a random number.
of gate G1, which advances the counter by depression of test switch S3 to the Now no LED will glow.
further. counters, CO pin 5 of IC7 (trial number 3. Enter the unit digit of your trial
The high-frequency clock pulses from counter) goes high first while crossing 99, number by depressing units select switch
the output of NAND gate N3 also go to the which triggers gate G6 and its output pin S2. When the desired unit number is dis-
random number counter (comprising IC4 4 turns low. Simultaneously, output pin 3 played, release the switch immediately.
and IC5) and the trial number counter of gate G5 goes high. The ‘low’ LED glows Likewise, enter the tens digit of your trial
(comprising IC6 and IC7). So all the three for too brief a period to be perceptible. number using tens select switch S4.
counters formed by IC2-IC3, IC4-IC5, and Soon thereafter CO pin 12 of IC5 (ran- 4. Now momentarily depress test
IC6-IC7 count simultaneously. dom number counter) goes high to trigger switch S3. The LEDs will indicate the re-
When the 100th pulse reaches the gate G5 and its output pin 3 turns low. sult. If the entered number is not the hid-
counter formed by IC2 and IC3, Q9 out- Simultaneously, output pin 4 of gate G6 den number, enter another trial number
puts of IC2 and IC3 turn high and diodes turns high to light red LED designated followed by depression of switch S3 to see
D1 and D2 are blocked. The junction of ‘high’, which remains lit even after the the result of the trial. ❏

68 ELECTRONICS PROJECTS Vol. 23


PICburner: The
Programmer for PIC16x8x
Microcontrollers
Ravi Pailoor

B
efore explaining the actual • Free assembler, linker, simulator,
programmer for programming of and compiler.
Flash-based microcontrollers
PIC16F83, PIC16C84, PIC16F84, and
PIC16F84A, let’s briefly introduce you The PIC16F84A
to PIC microcontrollers in general and The PIC16F84 is a CMOS-based, fully
PIC16F84A in particular. static microcontroller—you can stop
PIC stands for the peripheral interface and restart the clock from where you
controller made by Microchip Technology stopped it. The program memory being
Inc. Its general features include: Flash-based, the PIC16F84A can be pro-
• Harvard architecture with separate grammed/reprogrammed within a minute.
program and data memories and buses. It can be programmed in-circuit, so you
• Pipelined architecture overlapping don’t even have to remove the device from
‘fetch’ and ‘execute’ cycles, which makes your circuit to update your code.
single-cycle execution possible. The RISC instruction set consists of 35
• 0.21µs execution time for most in- instructions, most of which take a single
structions at 4 MHz. cycle. Jump and call take two cycles. The
• Reduced Instruction Set Computing instructions contain 14 bits (comprising an
(RISC); 33 to 75 instructions depending opcode and one or more operands specify-
on the core. ing operation of the instruction) but the
• Chips with 8 to 84 pins. data is always 8-bit wide.
• Power-on reset and brownout pro- Program memory. Fig. 1 shows
tection. program memory. The 16F84A has 1024
• External/internal interrupt sources words of Flash-based program memory
and programmable timers. ranging from addresses 0x000 through
• Code protection. 0x3FF, where 0x denotes hex. It has a
13-bit program counter that is capable
of addressing 8k program memory loca-
tions (0x0000 to 0x1FFF), out of which
only 1k (0x000 to 0x3FF) is physically
implemented, with upper three bits of
the program counter ignored. On reset,
the program counter is loaded with 0x000
and the instruction at 0x000 is picked up
for execution.
There is only one interrupt vector at Fig. 2: Data memory
address 0x004. The priority of interrupt
servicing is decided by the user code. RAM. Device control registers are called
Data memory. Fig. 2 shows data special function registers (SFRs) and
memory. 68 bytes/registers are used to data storage registers are called general-
control the device as well as store data, purpose registers (GPRs).
eliminating separate load and store in- The 16F84A has two banks (Bank 0
Fig. 1: Program memory structions. The data storage space is called and Bank 1) containing SFRs and one

ELECTRONICS PROJECTS Vol. 23 69


input (MCLR,
which must be
kept high for the
chip to work),
and connecting
a crystal (osc1/
clkin and osc2/
clkout).
Pins RA4
and RB0 can be
used as normal
input or output
pins, but these
pins also have
special functions:
pin RA4 works as
an input pin for
the on-chip timer/
counter and pin
RB0 works as an
external interrupt
input pin. When
these special func-
tions are not used,
pins RA4 and RB0
can be used like
any other digital
I/O pin. Pin RA4
is an open drain
output pin: Port
B pins can be pro-
grammed to have
Fig. 3: Circuit diagram of the PICburner programmer
internal weak
bank containing GPRs. The first twelve pull-ups (relative-
locations of Bank 0 and Bank 1 are SFRs ly high resistors to the Vcc). As each pin
Parts List
and the rest 116 bytes are GPRs (user can sink or source 25 mA, it can drive the
Semiconductors:
RAM). All the SFRs and GPRs can be corresponding LED directly. Pins RB6 and
U1 (IC1) - 7805 +5V regulator
U2 (IC2) - 7812 +12V regulator accessed by the instructions. Note. Access- RB7 are used to serially load the code into
U3 (IC3) - 7407 hex buffer driver ing GPRs while in Bank 1 will access the the chip while programming.
Q1(T1), GPRs in Bank 0. The oscillator. The controller can
Q2(T2) - BC557 pnp transistors
D1-D3 - LEDs (yellow, red, and Data EEPROM. The 64-byte data be configured to operate from a resistor-
green) EEPROM has addresses 0x00 through capacitor combination (RC mode) or a
D4-D7 - 1N4007 rectifier diodes 0x3F. It can be programmed and read by ceramic resonator or a crystal (up to 200
D8, D9 - 1N4148 switching diode kHz in LP mode, up to 4 MHz in XT mode,
both the programmer and the code. The
Resistors (all ¼-watt, ±5% carbon, unless and up to 10 MHz in HS mode), depending
stated otherwise): data EEPROM is non-volatile and retains
R1, R5-R8, the programmed data while powered on the application and the required timing
R11, R12 - 10-kilo-ohm down. Four SFRs (EECON1, EECON2, accuracy. By using a crystal and a pair of
R2, R4 - 4.7-kilo-ohm EEDATA, and EEADR) are used to read/ capacitors instead, the chip can be run at
R3, R9, R10 - 1-kilo-ohm
write data to this memory, with EEDATA up to 10MHz (2.5 million instructions per
Capacitors:
C1-C3 - 0.1µF ceramic disk holding the 8-bit data and EEADR holding second) clock.
C4 - 10µF, 16V electrolytic the EEPROM address. The PIC16F84A functions only when
C5 - 1000µF, 25V electrolytic Pin-out. The PIC16F84 is an a crystal, along with two small capacitors,
Miscellaneous: 18-pin IC. Its 13 pins (RA0 through is connected to it. Most often a 4MHz
J1 - 20-pin ZIF socket crystal and two 22pF capacitors are
J2 - 6-way male connector
RA4, RB0 through RB7) are digital I/O
J3 - DC jack 2-pin male pins, which can be freely used by the used. A major advantage of the PIC16F84
J4 - DC jack 2-pin female program. The software can configure controller is the requirement of only a
J5 - 6-way female connector a pin as an input or an output pin, few external components for a fully op-
P1 - 25-pin 'D' type male connec-
tor and this configuration can be changed erational circuit. Enabling the power-up
X1 - 230V AC primary to 0-16V, during the execution of the program. timer eliminates the need for an external
150mA secondary trans- The other five pins are used for ground reset circuit.
former Instruction set. With only 35 in-
(GND), power (VCC=2–5 volts), reset

70 ELECTRONICS PROJECTS Vol. 23


(IDE) is available for free Vcc (=5 volts) to the IC, and transistor Q2
on Microchip’s Website. and its associated circuits switch Vpp (=13
MPLAB has a built-in edi- volts) to the IC. Open-collector buffers are
tor, assembler, and simula- used to drive the transistors since the volt-
tor. It can carry out 99 per ages go above TTL level.
cent of the code simulation/ Programming lines. The PICmi-
debugging. The balance 1 cro needs a clock line and a data line to
per cent is the real-time program. The clock and data lines are
operation. (EFY Lab note. directly controlled from the PC via the
MPLAB-IDE and MPASM open-collector buffers.
from Microchip Technol- Testing the circuit. After assem-
ogy, along with relevant bling the circuit, check the voltage levels.
files, are included in the The voltage across capacitor C5 should
CD.) be minimum 15 volts. The voltage at the
collector of T2 and ground should be 13.2
volts, and the voltage at the collector of T1
PICburner and ground should be 5 volts.
Screenshot 1
The author has been us- Using the PICPROG2 software (ex-
ing PIC microcontrollers for over seven plained later in the article), toggle Vcc
years. The available programmers such and Vpp lines and check whether they are
as PICstart 16B1, PICstart+, and Pro- switching properly. Also toggle the output
moteII from Microchip are not affordable and verify that the input follows the out-
by ordinary electronic enthusiasts or en- put in the hardware setting menu.
gineering students. The author’s search LED indicators are used to debug the
for freeware on the Internet culminated hardware. The green LED shows that the
Screenshot 2 into Nigel Goodwin’s copyright software PICburner is powered. The orange LED
PICPROG2. Mr Goodwin has permitted shows application of 5 volts to the PIC-
free distribution of his micro. The red LED shows application of
software subject to the the programming voltage of 13.5 volts to
condition that it is used the PICmicro.
for non-commercial pur- 25-pin printer port interface. In-
poses only. The hardware terfacing from the PC’s parallel port is
for PICburner has been done via a 6-core cable, which is wired
designed by the
author himself. Table-1
The PICPROG2 has Pin No. Designation Usage
the following features: Pin 2 D0 Data out
• An easy Windows Pin 3 D1 Clock
Pin 4 D2 Vcc control
interface. Pin 5 D3 Vpp control
Screenshot 3 • Support for the older Pin 10 ACK Data in
PIC16C84. Pin 18 GND Ground
• Support for the latest PIC16F84,
PIC16F84A, and PIC16F83. as under:
• Hardware debugging. A jack is used to provide 16V AC pow-
• Simple and easy-to-use software; er input from the step-down transformer.
the online help solves most problems. The PICburner has on-board rectifier,
The hardware. Fig. 3 shows the filter, and regulator to provide 5 volts and
circuit diagram of the PICburner pro- 13.5 volts to the PICmicro through the
Screenshot 4 grammer. programming circuit as stated earlier.
structions to learn, Power supply. The 16V AC from the Connecting the PICburner. Con-
and each instruction transformer is rectified by diodes D4, D5, nect one end of the 25-pin ‘D’ type male
word being 14-bit D6, and D7 and filtered by capacitors C5 connector (wired as per the connections
Screenshot 5 and C1. The filtered DC voltage is fed to mentioned in Table-1) to the PC’s parallel
long, up to 1k in-
structions can be 12V regulator IC2 (U2). The ground pin port and the other end to the program-
programmed into the chip. The instruc- of IC2 (U2) is lifted up by diodes D8 and mer. Connect the power supply jack to
tions are classified into byte-oriented, D9 by 1.2 volts, providing 13 volts as the the programmer. The green LED glows to
bit-oriented, and literal and control in- programming voltage (Vpp). Regulator indicate that the power supply is okay.
structions. The destination of the result of IC1 (U1) provides 5 volts as the supply The PICburner circuit is assembled
operation is under user control. voltage (Vcc) for the PICmicro. on a double-sided plated-through-hole
Development software. The MPLAB The supply switching circuit. Tran- (PTH) PCB. The actual-size solder-side
integrated development environment sistor Q1 and its associated circuits switch and component-side track layouts of the

ELECTRONICS PROJECTS Vol. 23 71


been provided on the PCB for bled.
mounting the ZIF socket. Further
The PICPROG2 control information
software. The PICPROG2.EXE on using the
is a 16-bit Windows program for Fig. 7: 20-pin ZIF socket software and
programming the Microchip’s programming
Flash series 16x8x microcontrol- of the PICmicro is available in ‘Help’ menu
lers. This software is simple and of the PICPROG2 software.
easy to use, and its online ‘help’ A practical demo circuit and pro-
solves most problems. Install gramming example. The PIC16F84A
the above-mentioned software needs only a crystal with two capacitors,
from the CD or floppy onto the while a 10 kilo-ohm resistor keeps the
hard disk. MCLR pin high. Use of a decoupling ca-
Placement of devices for pacitor on the Vcc pin is recommended.
programming. The 18-pin This capacitor should be as near to the
PICmicro 16F84 or 16F84A is PIC16F84 Vcc pin as possible.
Fig. 4: Actual-size, solder-side PCB layout for the placed in the 20-pin ZIF socket Fig. 8 shows an LED connected to pin
PICburner programmer circuit right-justified (refer Fig. 7). RB0 of port B and a switch connected to
Configuration of the PIC- pin RA4 of port A. A 330-ohm resistor (R3)
PROG2. After executing the file is used to limit the LED current and a 10k
PICPROG2.EXE, screenshot resistor (R2) is used to pull up the switch.
1 becomes visible on the PC Pin RB0 is configured as the output and
screen. pin RA4 is configured as the input.
Read PIC, Write PIC, Verify, The source program Blink.asm for
and Erase buttons are disabled if the above circuit is written using 16F84
the software is unable to find the instruction set and assembler directives.
hardware. It enables the circuit to light up the LED
If ‘Port’ at the bottom of at the press of a switch.
screenshot 1 shows ‘none’, the
parallel port is not selected. To
select a valid parallel port, go Programming
to ‘Options’ menu and click on The MPLAB-IDE (integrated development
‘Hardware’ (shown in screen- environment) supports code development.
shot 2). The source code (Blink.asm) can be de-
Now screenshot 3 appears. veloped with the built-in editor. It can
Ensure that the options under also be written using any text editor and
Fig. 5: Actual-size, component-side PCB layout for relevant columns are selected assembled using MPASM or MPASMWIN
the PICburner programmer circuit as follows: to generate Intel hex code for loading into
• D2 and Invert under Vdd the PICburner programmer.
• D3 and Invert under Vpp The Intel hex code for the Blink.asm
• D0 under Output source file is as follows:
• D1 under Clock
• ACK under Input Blink.hex
• Parallel port address of
your PC=$378 under Port
To test whether a valid par-
allel port has been selected, tog-
gle button on screen Vdd from
‘off’ to ‘on’ and vice versa. The
orange LED on the programmer
should accordingly light up and
go off.
Close the window after the
selections. Now click on ‘Find
Port’ in ‘Options’ menu bar (refer
Fig. 6: Component layout for the PCBs of Figs 4 and 5 screenshot-4). If a valid paral-
lel port is available, the valid
PCB are shown in Figs 4 and 5, respective- port address will be automati-
ly, with its component layout (silk-side) in cally displayed against ‘Port’, as shown in
Fig. 6. Note. Pins 1 and 20 of ZIF socket screenshot-5. Read PIC, Write PIC, Verify,
have been cut and only 18 PTH holes have and Erase menu items will be found ena- Fig. 8: Schematic diagram of blinking circuit

72 ELECTRONICS PROJECTS Vol. 23


:1000000013288316FF308500FE3086008312860198 by clicking the ‘WRITE PIC’ button, if 2. ASM2200.ZIP containing MPASM
:100010000800FA308C00FA308D0064008D0B- enabled. (Note. The 18-pin PIC16F84 is files.
0D283A
:100020008C0B0B28080001206400051A1428061404
to be inserted right justified, as shown 3. WPIC16.ZIP containing PICPROG2
:060030000920061014284F in Fig. 7.) files.
:00000001FF Once programmed, you can remove 4. Blink.ZIP containing files pertain-
the PIC16F84 device and put it in the ing to the blinking LED circuit.
blinking LED circuit to test whether it 5. MPASM_UG.PDF containing
The Intel hex code for the Blink.asm is functioning: on momentary depression MPASM user guide.
program is loaded via the File menu of the push switch, the LED must blink 6. PIC16F84A.PDF containing data for
option after executing the PICburner for a while. the PIC16F84A device
program PICPROG2.EXE. The loaded EFY. The following files relevant Caution. Please ensure that PIC mi-
Intel hex file (Blink.hex) appears in to this article shall be included in the crocontroller is not kept in the ZIF socket
the buffer window (refer screenshot–2) PICburner folder in CD: while powering up or powering down the
and the code can be programmed into 1. M57000ful.ZIP containing MPLAB- programmer to avoid damage to the mi-
the PIC16F84A device in ZIF socket IDE files crocontroller.

Blink.asm
Blink.asm ENDC DECFSZ TEMP1,F
;———————————————————— GOTO LOOP1
; Date : 19th July 2002 ;———————————————————
; Project : LED Blink ; Program starts DECFSZ TEMP,F
; Frequency : 4 MHz ORG 0x000 GOTO LOOP2
; Device used : 16F84A ;———————————————————
; Oscillator : XT RETURN
; Watchdog : ON RESET GOTO START
; Device ID : ;————————————————-——— ;———————————————————
; Checksum : ; This routine will initialise the I/O ports START CALL INITIALISE
; Customer : EFY
; Copyright : e-CHIP INFOTEK (P) INITIALISE BSF STATUS,5 WAIT CLRWDT
LTD. ; select bank 1 BTFSC PORTA,4
; Designed by : Ravi Pailoor ; wait for switch to go low
; Comments : MOVLW B’11111111' GOTO WAIT
;———————————————————— ; all lines of PORT A as
LIST P = 16F84A ; telling the inputs BSF PORTB,0
assembler the MOVWF TRISA ; switch on the LED
microcontroller is 16F84A MOVLW B’11111110'
errorlevel 2 ; RB0 as output, rest as CALL DELAY
;——————————————————— inputs
STATUS EQU 03h MOVWF TRISB BCF PORTB,0
PORTA EQU 05h ; switch off the LED
; address of PORT A in SFR BCF STATUS,5
PORTB EQU 06h ; select bank 0 GOTO WAIT
; address of PORT B in SFR ; wait for the next switch
CLRF PORTB press
TRISA EQU 85h
; address of direction control register for RETURN ;———————————————————
PORT A END
; in Bank 1 SFR ;——————————————————— ; end of user code
TRISB EQU 86h ; This routine will give a delay of approximately ;———————————————————-
; address of direction control register for 250 mS ❑
PORT B
; in Bank 1 SFR DELAY MOVLW .250
MOVWF TEMP
;-———————————————————
CBLOCK 0Ch LOOP2 MOVLW .250 All diagrams and information provided in
; GPR start address MOVWF TEMP1 this article are included in the CD by courtsey
TEMP
TEMP1 LOOP1 CLRWDT of Microchip Technology Inc.

Readers’ comments is, so we can correct the same. in place of pins 4, 5, 12, 13 and 14 of
Q1. We’ve prepared a PICburner program- Antony Dias PIC16X8X, respectively. Will it work? If
mer as per the article. When we connected Through e-mail yes, which software I will have to use for
it to the parallel port of PC, the port was Q2. I have constructed the PICburner burning PIC16F73.
identified by the software. With PIC16F84 project. It seems that there was some er- Also suggest me an easy-to-program,
placed in the circuit, the reading and eras- ror in the software as it did not detect the cheap and readily-available microcontrol-
ing functions are also taking place. How- port after ‘Find Port’ option was selected. ler for industrial automation.
ever, when WritePIC was pressed (with Please help. Naresh Kinger
a Hex file loaded in buffer), the message P. Ramesh Kumar Through e-mail
we got was: Through e-mail The author Ravi Pailoor replies:
Writing program memory & dialog Q3. I want to make PICburner for A1. When the programmer circuit is con-
box “Program Verify failed in line 0 & PIC16F73 using the ‘PICburner: Program- nected to the parallel port of PC by Mr
Programming Aborted “”!!. mer for PIC16X8X’ circuit by making use Dias, the port is being identified by the
Kindly let us know where the problem of pins 1, 8, 27, 28 and 20 of PIC16F73 programmer correctly. Normally, the

ELECTRONICS PROJECTS Vol. 23 73


message “Program Verify failed in line 0 sure that the parallel port is working. To a PICmicro depends on the application.
& Programming Aborted” appears if the check the parallel port, he may refer to a However, he may use a 16F87x series IC
programming voltage falls below 13.5V small program (including its hardware) (28- or 40-pin) for industrial applications.
while programming the chip. Sometimes, in the project ‘PC-Based Token Number The 87x series ICs have more features
the problem may be with the parallel port Display’ published in Oct. ’95 issue and than F7x series ICs. The architectures of
of the PC. The readers may contact me reprinted in ‘Electronics Projects Vol.16’. all the PICmicro ICs are the same. So if
through e-mail at chiptech@vsnl.com for A3. The hardware modifications you learn the programming of a PICmicro,
any further guidance, if required. suggested by Mr Kinger will do. He can it will be the same for other ICs with only
A2. If Mr Ramesh Kumar has obtained download the latest 32-bit software from difference being in the on-chip peripherals.
screenshots 3 and 4 on his computer’s ‘www.winpicprog.co.uk’ and visit ‘www. PICmicro is available for Rs 33 (for 8-pin
screen correctly, the problem is in his port winpicprog.co.uk/supported.htm’ for the 12C508) to Rs 600 (for 40-pin 18F458). A
connection. He should check the parallel- supported IC list. 40-pin 16F877 costs around Rs 250. These
port D connection wires for continuity and As regards the microcontroller, it is a devices are available from Silicon Aids,
open/short circuit. Also, he should make bit difficult to suggest since the choice of Mumbai.

74 ELECTRONICS PROJECTS Vol. 23


INTERACTIVE GAL
PROGRAMMER FOR BEGINNERS
JUNOMON ABRAHAM

G
eneric array logic (GAL) is a fam-
ily of programmable logic devices.
Almost any logic circuit can be
programmed into these chips. A simple IC
of this type is the GAL16V8.
Here we’ve described a simple GAL
programmer for electronics hobbyists and
professionals who are in the beginning
stage of GAL programming and learn-
ing. GALs are available from various
manufacturers but Lattice Semiconduc-
tor’s GALs are good due to company’s
good technical support and availability
of information from the company’s Web-
site ‘www.latticesemi.com’. For this pro-
grammer we’ve used Lattice ispDesign
EXPERT software tool for the design and
analysis of programmable logic devices.
You can get it free for trial from the
Website of Lattice Semiconductor. (EFY. Fig. 2: Logical diagram of GAL device’s output logic macrocell

In-flux Technology (S) (E2CMOS) cell at each cross-point, rather


Pte Ltd in Bangalore than a fuse as in a programmable array
and Delhi is Indian logic (PAL) device.
representative of Lat- Each column is connected to the
tice. For any help, the input of an AND gate and each row is
firm can be approached connected to an input variable or its
in Delhi via e-mail ad- complement. Any combination of input
dress: iftdelhi@vsnl. variables or complements can be applied
net)
Parts List
Semiconductors:
Introduction to IC1, IC2 - 74LS244 octal buffer
the GAL16V8 IC3
IC4
- 7812 12V regulator
- 7805 5V regulator
Lattice Semiconductor T1 - BC547 npn transistor
Company introduced the D1-D4 - 1N4007 rectifier diode
GAL16V8 in the mid Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
1980s. Fig. 1 shows the R1, R2 - 2.2-kilo-ohm
functional block diagram R3-R5 - 10-kilo-ohm
of the GAL16V8. The R6-R11 - 3.3-kilo-ohm
GAL16V8 has a fixed OR R12 - 4.7-kilo-ohm
array and a program- Capacitors:
C1 - 1000µF, 25V electrolytic
mable AND array. The C2-C5 - 0.1µF ceramic disk
re-programmable array is
Miscellaneous:
essentially a grid of con- X1 - 230V AC primary to 0-15V,
ductors forming rows and 150mA secondary trans-
columns with an electri- former
Fig. 1: Functional block diagram of the GAL16V8 cally erasable CMOS - 25-pin D connector

ELECTRONICS PROJECTS Vol. 23 75


that in- etc) as well as registered logic functions
cludes OR (counters, shift registers, etc) on the same
gates and chip.
flip-flops. PAL replacement. Each of the
Apart GAL16V8 and the GAL20V8 can directly
from this, replace over 20 of the common PAL pro-
some mem- grammable logic devices. This means you
ory bits are need to stock only two GAL types to handle
allotted for your programmable logic device needs.
configur- Space savings. Each GAL typically
ing the de- replaces two to four standard TTL chips,
vice modes. saving a large amount of board space.
Fig. 3: An example logic circuit (Note. De- Speed. GALs are fast devices with
tailed in- propagation delay as low as 7 nanoseconds
to an AND gate to get the desired product formation (ns). Typical GALs have a propagation
by programming each E2CMOS cell to about the GAL is available in 16V8 da- delay of only 15 ns and hence are faster
either ‘on’ or ‘off’ state. A cell that is ‘on’ tasheet, which is included in the CD.) than standard 7400 or 74LS series logic
effectively connects the corresponding row devices.
and column, and a cell that is ‘off’ discon- Reprogrammability. Programmable
nects the corresponding row and column. Benefits of using GAL GALs allow correction of design errors
The cells can be electrically erased and GALs offer the following benefits to hard- and make board layout easier. These can
reprogrammed. ware designers: be reprogrammed up to a hundred times.
The GAL has the programmable Flexibility. GALs are very flexible Erasing and programming take only a
logic and 16 OLMCs (output logic macro devices and can implement both combina- few seconds.
cells, refer Fig. 2 for its logic diagram) tional logic functions (AND, OR, NAND, Secrecy. Since the logic is configured

Fig. 4: Schematic circuit of GAL programmer

76 ELECTRONICS PROJECTS Vol. 23


through programming, secrecy of the cir- tronic Device Engineering
cuit is possible. Council, which is now known
Cost. ICs GAL16V8 and GAL20V8, as Solid State Technology
with standard speeds of 25 ns and 15 ns, Association). The box shows
respectively, cost only a few rupees even the listing of a JEDEC file
when purchased in small quantities. prepared for the example
logic circuit shown in Fig.
3. The logic circuit can be
GAL-based logic design designed and converted into
Depending upon the logic circuit design, JEDEC file with the help of
the memory cells have to be programmed, Lattice ispDesign EXPERT
i.e. the logic circuit is entered into the development software. (Hints
GAL as a bitstream or fuse map. given in box.)
The standard fuse map is in JEDEC The steps for GAL-based
format. (JEDEC stands for Joint Elec- logic design are as follows:
1. Prepare the required
logic diagram.
JEDEC File Contents of the Logic 2. Convert the
Circuit in Fig. 3 logic diagram to the
bitstream that is ac-
ispDesignEXPERT 8.3 Lattice Semiconductor Corp.
ceptable by the GAL
JEDEC file for: P16V8AS V9.0
Created on: Tue Dec 18 23:08:07 2001 internal memory.
This can be achieved
logic.bls by using Lattice isp-
* Design EXPERT tool,
QP20* QF2194* QV0* which allows you to
X0*
design the logic as a
NOTE Table of pin names and numbers*
NOTE PINS A:4 B:1 Q:16 C:2 D:3* schematic diagram
L0000 Indicating the memory cell ad- or using any pro-
dress 00000000000000000000000000000000 gramming language
ADD 22 ROWS OF 32 ZEROS EACH HERE such as VHDL and
00000000000000000000000000000000 ABEL. The result is
10100111111111111111111111111111 a JEDEC file (fuse
11011111101111111111111111111111
00000000000000000000000000000000
map). Detailed in-
ADD 36 ROWS OF 32 ZEROS EACH HERE formation about how
00000000000000000000000000000000* to create the JEDEC
L2048 file is given in ‘Tuto-
00010000* rial’ section of the
L2056 Lattice ispDesign
0 ADD 62 MORE ZEROZ HERE 0*
EXPERT develop- Fig. 5: Flowchart for writing/erasing the GAL16V8
L2120
0* ment tool.
L2121 3. Transfer the programming voltage of usually
0* fuse map bits to proper locations 12 volts to EDIT pin (see Fig. 4). Thus
L2122 of GAL memory cells. the programming source signals (from
0* 4. Now GAL is ready for cus- the PC’s parallel port in this case) should
L2123
tom use. be connected only when the GAL is in
0*
L2124 program mode. This control function is
0* GAL programmer achieved via 74LS244 tristate buffers.
Programming is done using the PC’s
L2125
0* circuit parallel port. The circuit consists of two
L2126 Fig. 4 shows the GAL program- tristate octal buffer ICs and the program-
0* mer circuit. When the GAL is ming voltage is 12 volts. (The program-
L2127
in normal mode, some of its ming voltage is different for different GAL
0*
L2128 pins act as inputs and rest of ICs. This information can be obtained
1 ADD 62 MORE ONES HERE 1* the pins act as outputs. When from the GAL itself.) The programming
L2192 the GAL enters the program- voltage is developed using a 12V regula-
1* ming mode, the states of the tor IC 7812.
L2193 pins may change, i.e. some When the GAL enters the program
0*
outputs may change to inputs mode (via the PC’s parallel port), the
C0FD9*
F78D and vice versa. Programming parallel port pins will get connected to the
mode is invoked by applying GAL through the buffers. At this stage,

ELECTRONICS PROJECTS Vol. 23 77


Screenshot: ispDesign EXPERT IDE showing the setting of JEDEC file properties to
Full JEDEC, which is needed for our programmer
Fig. 6: Flowchart for reading the GAL16V8
rial data input), and is latched by STB User-friendly interfaces have been used in
the buffers change from high-impedance (active-low) signal. Note that all the opera- most of the modules.
state to active state by auto line feed (pin tions (program, verify, erase, etc) should The program is tested using a Pentium
14) signal of the parallel port. P/V (1/0) de- be performed only when the programming III PC. For use with other PCs, some tim-
termines the program or verify mode. voltage is applied to EDIT pin. ing constants may need to be changed
Pins RA5 through RA0 select the rows The flowcharts for programming (writ- depending upon their processor speed.
of the GAL memory. The column data is ing/erasing) and reading of GAL16V8 are This has been suitably indicated in the
transferred to or from the GAL (in pro shown in Figs 5 and 6, respectively. software listing.
gram/verify mode) in serial fashion by Fuse map. The arrangement of mem- The JEDEC file obtained from the de-
signals SCLK (serial clock) and SDIN (se- ory cells or fuses inside the GAL16V8D, sign should be in the Full JEDEC format
with only the commonly required rows, (not the Brief JEDEC or the Hex JEDEC
is shown in Table I. Physi- format) since our software processes
Table I cal orientations of these only the Full JEDEC format. This can
Row Address of the Fuses fuses are obtained from the be achieved by setting the ‘Properties’ to
internal logic diagram of ‘Full JEDEC’ while creating JEDEC file by
0 0,32,64, ………..2016
the GAL. the ispDesign EXPERT (refer screenshot
1 1,33,65,………...2017
2 2,34,66,………...2018 An actual-size, single- above).
3 3,35,67,………...2019 side PCB for the GAL pro- This programmer is checked for Lat-
. ……………. grammer is shown in Fig. 7 tice’s GAL16V8D and guaranteed for
. ……………. with its component layout 16V8A/B/C/D/Z/ZD series ICs that differ
. …………….
31 31,63,95,………2047 in Fig. 8. from GAL16V8 in terms of programming
algorithm. You can try the programmer for
32 2056,2057,2058,2059,…………..2119 (64-bit user any programmable device by understand-
electronic signature) Software ing the basics of programming.
54 When we write 1 to this row, the erase operation
Since the arrangements Instead of ZIF socket, you can use the
will take place
58 64-bit manufacturer signature of memory cells inside the ordinary IC socket, which is economical.
GAL and the JEDEC files Take care while making the connections
60 2048,2049,2050,2051,2193,2120,2121,2122,2123,2128, are not the same, we need to for the parallel port of the PC, especially
2129,2130,2131,2132,2133,2134,2135,2136,2137,2138, rearrange the JEDEC file to the programming voltage control connec-
2139,2140,2141,2142,2143,2144,2145,2146,2147,2148,
2149,2150,2151,2152,2153,2154,2155,2156,2157,2158, a format that is acceptable tions, as these may damage the mother-
2159,2160,2161,2162,2163,2164,2165,2166,2167,2168, by the GAL. The software board circuitry.
2169,2170,2171,2172,2173,2174,2175,2176,2177,2178, for transferring JEDEC file EFY Lab note. Source code, execut-
2179,2180,2181,2182,2183,2184,2185,2186,2187,2188, to the GAL is written in C able file, GAL16V8 datasheet, and ad-
2189,2190,2191,2124,2125,2126,2127,2192,2052,2053,
language. It is self-explana- ditional tutorial/useful material for GAL
2054,2055 (82 configuration bits)
tory and easy to understand. devices is included in the CD. ❏

78 ELECTRONICS PROJECTS Vol. 23


Hints for using schematic tools from
within ispDesignEXPERT software for
drawing logic circuit and obtaining its
JEDEC file
The ispDesignEXPERT software provided by Lattice
Semiconductor can be interactively installed using
the installation instructions (being included in the
CD).
Once the software has been installed, it can be
run by clicking on Windows’ ‘Start’ button and select-
ing ‘Programs’, ‘Lattice semiconductor’, and finally
‘ispDesignEXPERT’. ispDesignEXPERT Project Navi-
gator screen as shown in the screenshot appears.
Under ‘File’ menu open a new project, name it,
and save it as schematic ‘Type’ in any directory of
your choice. Now open this project using File menu.
Now click on menu item ‘Window’ and select
‘Schematic Editor’. The Schematic Editor opens up
to present a sheet for drawing the schematic. The
sheet can be expanded or contracted as desired by
using the zoom-in and zoom-out options from within
‘View’ menu.
Again, in View menu select ‘Drawing Toolbar’. A
small screen captioned ‘Drawing’ with various tools
appears. You can take the mouse cursor to different
tools to find out each tool’s name/purpose and also go
through ‘Help’ menu topics relating to Schematic Edi-
tor for their detailed usage. Now, if you click on ‘Add
symbol’ tool, a small window with ‘Symbol Libraries’
appears. This can be used for selecting various logic
Fig. 7: Actual-size, single-side PCB for GAL programmer gates and placing them in your sheet. Similarly, other
tools can be used to connect and label the gates as
well as nets and input/output terminals to realise the
desired schematic.
Once the logic circuit is completed, it can be saved
in a file name of your choice with .Sch extension. After
saving the schematic, close the Schematic Editor to
come back to ‘ISP Design Expert Project Navigator’
screen again.
Select ‘ISPLSIS256VE-165LF256’ listed under
‘Sources in Project’ window and double click on ‘Open’
button. A ‘Device Selector’ screen appears, wherein
you should select ‘GAL16LV8C’ device. Click on ‘Ok’
and ‘Yes’.
Now click on ‘Source’ menu toolbar and select ‘Im-
port’ option. Browse to get the .Sch file saved earlier
and open it. The saved file with .Sch extension will
appear in the ‘Sources in Project’ window.
Click on the saved .Sch file and select ‘Compile
Schematic’ option from ‘Processes for Current
Source’. Then click on ‘Start’ button for its compi-
lation. After compilation is over, proceed to select
‘GAL16LV8C10LJ’ from ‘Source in Project’ window
and then click on ‘JEDEC File’ option under ‘Proc-
esses for Current Source’. Click ‘Properties’ and
double click on ‘Brief JEDEC’ (toggle) to get ‘Full
JEDEC’ on the screen. Close the Properties window,
click on ‘Start’ button under ‘Processes for Current
Source.’ After successful conversion to JEDEC for-
mat, the contents of this JEDEC file can be seen by
pressing ‘View’ button under ‘Processes for Current
Source’ and the same can be saved (from within
the new window appearing via its File option) with
extension .JED.
Fig. 8: Component layout for the PCB

ELECTRONICS PROJECTS Vol. 23 79


Gal_pro.c

/* This program is intended for the GAL16V8A/ banner(); progress...............”);


B/C/D/Z/ZD series textattr(0x0e); textattr(0x8e);
gotoxy(20,12);cputs(“What you want to do with if(verify()==0)
it is tested for GAL16V8D and will work suc- this programmer”); { textattr(0x8C);
cessfully for the above mentioned devices*/ textattr(0x0a); cputs(“\rError..Entered file is not equal
gotoxy(33,15);cputs(“P”); to GAL data - press any key to continue”);
#include<stdio.h> gotoxy(33,16);cputs(“V”); getch();
#include<dos.h> gotoxy(33,17);cputs(“E”); goto start;
#include<conio.h> gotoxy(33,18);cputs(“Q”); }
#include<string.h> textattr(0x06); textattr(0x8A);
#define PORT 0x378 /*here you can change gotoxy(34,15);cputs(“rogram”); printf(“\rVerify Success..Entered file is equal
the LPT address if required*/ gotoxy(34,16);cputs(“erify”); to GAL data- press any key to continue”);
#define SDOUT 6 /* LPT port bit assign- gotoxy(34,17);cputs(“rase”); getch();
ment*/ gotoxy(34,18);cputs(“uit”); goto start;
#define SDIN 7 gotoxy(25,20);cputs(“Enter your choice”);
#define SCLK 6 top:
#define STB 0 switch(getch()) /********************verify mode
#define VPP 1 { case ‘P’:goto program; ends********************/
#define P_V 2 case ‘p’:goto program; /********************erase Mode
#define ERASE_T 100 /*Erase pulse time,this case ‘V’:goto verify; starts*******************/
may change depending upon the type of GAL & case ‘v’:goto verify; erase:
computer processor speed*/ case ‘E’:goto erase; clrscr();
#define PROG_T 80 /*Programing pulse case ‘e’:goto erase; textattr(0x8d);
time,this may change depending upon the type of case ‘Q’:exit(1); banner();
GAL & computer processor speed*/ case ‘q’:exit(1); textattr(0x03);
#define DL_CONST 400 /*Serial clock time default: goto top; gotoxy(2,10);cputs(“**********************”);
constant,this also may change as stated above*/ } gotoxy(25,11);cputs(“Now we are in Erase
/******************program mode starts**** Mode”);
void banner(); /*function declaration*/ ****************************/ gotoxy(2,12);cputs(“**********************”);
void setbit(int,int); program: for(i=0;i<=2193;i++)
void clearbit(int,int); clrscr(); fuse[i]=’1';
char input(int,int); textattr(0x8A);
void newline(); banner(); arrange();
void clock(); textattr(0x03); erase();
int load(); gotoxy(2,10);cputs(“**********************”);
void arrange(); gotoxy(25,11);cputs(“Now we are in Program cputs(“\r\nWait Erasing progress...............”);
void erase(); Mode”); textattr(0x8e);
int verify(); gotoxy(2,12);cputs(“**********************”); if(verify()==0)
void program(); if((i=load())==0) goto program; { textattr(0x8C);
else if(i==1) goto start; cputs(“\rError..GAL is not errased cor-
FILE *fp; cputs(“\r\nWait programming rectly - press any key to continue”);
char c,msg[10],fuse[3000], /*fuse is used to progress...............”); getch();
store the fuse map getting from JEDEC file*/ erase(); goto start;
pgm_file[61][83],fname[11]; program(); }
/*pgm_file is for arranging the JEDEC format to a textattr(0x8e); textattr(0x8A);
format that is acceptable by the GAL16V8A/B/C/D/Z/ if(verify()==0) cputs(“\rErased Successfully... - press any key
ZD*/ { textattr(0x8C); to continue”);
int raw,i,j,k; cputs(“\rError in programming - press getch();
any key to continue”); goto start;
/*sequence of bit addresses for 16v8A/B/C/D/Z/ getch();
ZD Configuration register*/ goto start; }
int pattern[82]={ 2048,2049,2050,2051,2193,2 }
120,2121,2122,2123,2128, textattr(0x8A); /****************************function listing
2129,2130,2131,2132,213 printf(“\rProgramming Success... press any starts********************/
3,2134,2135,2136,2137,2138, key to continue”);
2139,2140,2141,2142,214 getch(); /************************displaying ban-
3,2144,2145,2146,2147,2148, goto start; ner*********************/
2149,2150,2151,2152,215 /********************programm mode void banner()
3,2154,2155,2156,2157,2158, ends***************/ {
2159,2160,2161,2162,216 /**********************verify mode
3,2164,2165,2166,2167,2168, starts**************/ gotoxy(2,4);cputs(“**********************”);
2169,2170,2171,2172,217 verify: gotoxy(15,5);cputs(“Welcome to Interactive
3,2174,2175,2176,2177,2178, clrscr(); GAL programmer for Beginner’s”);
2179,2180,2181,2182,218 textattr(0x8E); gotoxy(28,7);cputs(“by Junomon Abraham”);
3,2184,2185,2186,2187,2188, banner(); gotoxy(2,8);cputs(“**********************”);
2189,2190,2191,2124,212 textattr(0x02); }
5,2126,2127,2192,2052,2053, gotoxy(2,10);cputs(“**********************”);
2054,2055 }; gotoxy(25,11);cputs(“Now we are in Verify /*****************load data from JEDEC file
main() Mode”); to an array********/
{ gotoxy(2,12);cputs(“**********************”); int load()
start: if((i=load())==0) goto verify; {
clrscr(); else if(i==1) goto start; gotoxy(20,14);cputs(“Enter ‘Q’ or ‘q’ to Quit
textattr(0x89); cputs(“\r\nWait Verifying the program”);

80 ELECTRONICS PROJECTS Vol. 23


gotoxy(20,15);cputs(“Enter ‘B’ or ‘b’ to Go clearbit(PORT+2,VPP); clock();
back”); setbit(PORT+2,P_V); }
outportb(PORT,54); }
textattr(0x05); setbit(PORT+2,VPP); outportb(PORT,60);
gotoxy(10,17);cputs(“Enter the JEDEC(.jed) delay(1); delay(1);
file name: “); setbit(PORT+2,STB);
textattr(0x01); setbit(PORT,SDIN); delay(1);
gotoxy(10,19);cputs(“JEDEC(.jed) file cotains clock(); clearbit(PORT+2,STB);
the fuse map for the GAL”); delay(1);
gotoxy(12,20);cputs(“It can be created by Lat- setbit(PORT+2,STB); for(i=0;i<82;i++)
tice ‘ispDesign EXPERT’”); delay(100); {
gotoxy(43,17); clearbit(PORT+2,STB); if(input(PORT+1,SDOUT)!=pgm_file[60]
gets(fname); delay(1); [i]) return(0);
if(strcmpi(fname,”q”)==0) exit(1); outportb(PORT+2,0x00); clock();
else if(strcmpi(fname,”b”)==0) return(1); outportb(PORT,0x00); }
} outportb(PORT+2,0x00);
fp=fopen(fname,”r”); outportb(PORT,0x00);
if(fp==NULL) /**********************program rou- return(1);
{ printf(“\n\n\n\n unable to open the tine*************/ }
file, Press any key to continue”); void program()
getch(); return(0); { /**********generate a clock pulse to the SCLK
} int temp1; pin of GAL**************/
clearbit(PORT+2,VPP); void clock()
while((fgets(msg,6,fp))!=NULL) setbit(PORT+2,P_V); {
{ setbit(PORT+2,VPP); long int delay1;
if(strncmp(msg,”L0000",5)==0) delay(1); setbit(PORT,SCLK);
break; printf(“\n”); for(delay1=0;delay1<DL_
} for(raw=0;raw<=32;raw++) CONST;delay1++);/*for generating small delay*/
i=0; { outportb(PORT,raw);delay(1); clearbit(PORT,SCLK);
while((c=getc(fp))!=EOF) printf(“>>”); for(delay1=0;delay1<DL_
{ for(i=0;i<64;i++) CONST;delay1++);/*for generating small delay*/
if((c==’0')||(c==’1')) { }
{ fuse[i]=c;i++; } if(pgm_file[raw][i]==’1') temp1=0x80;
else newline(); else temp1=0x00; /************set a bit of LPT port regis-
} outportb(PORT,raw|temp1); ters********************/
clock();
arrange(); } void setbit(int address,int bit)
textattr(0x06); setbit(PORT+2,STB); {
printf(“\nSuccessfully loaded the file delay(PROG_T); int temp,byte=01;
%s”,fname); clearbit(PORT+2,STB); byte=byte<<bit;
} delay(1); temp=inportb(address);
} outportb(address,temp|byte);
/******rearranging the fuse map that is ob- }
tained from JEDEC file**********************/ outportb(PORT,60);delay(1);
void arrange() for(i=0;i<82;i++) /************clear a bit of LPT port regis-
{ { ters*****************/
for(j=0;j<=31;j++) if(pgm_file[60][i]==’1') temp1=0x80; void clearbit(int address,int bit)
{ else temp1=0x00; {
for(i=j,k=0;i<=2047;i=i+32,k++) outportb(PORT,60|temp1); int temp,byte=01;
pgm_file[j][k]=fuse[i]; clock(); byte=0xff^(byte<<bit);
} }
setbit(PORT+2,STB); temp=inportb(address);
for(i=2056,k=0;i<=2119;i++,k++) delay(PROG_T); outportb(address,temp&byte);
{ clearbit(PORT+2,STB); }
pgm_file[32][k]=fuse[i]; delay(1);
} gotoxy(2,23); /*************read a bit from
} LPT********************/
printf(“\n\n\n”);
for(i=0;i<=81;i++) /***************verify rou- char input(int address,int bit)
{ tine****************************/ {
pgm_file[60][i]=fuse[pattern[i]]; int verify() int temp,value;
} { char c;
clearbit(PORT+2,P_V); temp=inportb(address);
} setbit(PORT+2,VPP); value=(temp>>bit);
delay(1); value=value&0x01;
/*****************skip to next line in the for(raw=0;raw<=32;raw++) if(value==0x01) return(‘1’);
JEDEC file***************/ { return(‘0’);
void newline() outportb(PORT,raw); }
{ delay(1); /*********************function listing
int i; setbit(PORT+2,STB); ends****************/ ❑
while(c!=’\n’) delay(1);
c=getc(fp); clearbit(PORT+2,STB);
} delay(1); EFY Note. If you’re interested in the
/********************Erase rou- for(i=0;i<64;i++)
software, you may contact the Indian
tine**********************/ {
void erase() if(input(PORT+1,SDOUT)!=pgm_file[raw][i]) re- representative of Lattice Semiconductor
{ turn(0); at iftdelhi@vsnl.com

ELECTRONICS PROJECTS Vol. 23 81


#95 Debarring Facility
For Your Telephone
Parmar Latesh B.

T
elephone is no more an item of • The circuit doesn’t employ any mi- result, relay RL1 remains de-energised
luxury but a basic necessity of croprocessor, and is based on easily avail- and the telephone instrument works nor-
life. In certain regions, the gov- able discrete components and ICs. mally. When switch S1 is closed, the #95
ernment of India made areas falling So an average electronic enthusiast debarring circuit gets activated.
within 200 km accessible through local can easily understand and build it. The circuit operation is based on the
telephones by dialing the local telephone • The on-hook and off-hook status of following logic:
number after dialing 95. However, the the telephone is indicated by LEDs. 1. When the initial two digits of a
pulse rate for areas accessible through • External power supply is needed for dialed DTMF number correspond to 9
95 dialling is 30 seconds (one pulse per circuit operation. followed by 5, the telephone line is discon-
30 seconds) as against the pulse rate of nected from the telephone instrument for
180 seconds applicable for normal local a period of 10 seconds. (The disconnection
calls. It means a call of 3-minute dura- The logic period can be varied.)
tion to these areas is six times costlier Fig. 1 shows the block diagram of the 2. If 9 followed by 5 are not the initial
than a local call. To avoid misuse of your #95 debarring facility, which may be but subsequent sequential digits of a di-
telephone instrument by unauthorised pursued for understanding the overall aled number, the circuit doesn’t take any
persons for the areas accessible through operation. cognizance of the same. Also, the circuit
dialing number 95, we present here a The circuit shown in Fig. 2 shows the doesn’t bother about combinations other
#95 debarring circuit with the following actual wiring/connections. The incom- than 95.
features: ing telephone line is connected to the 3. During on-hook condition, the tel-
• This circuit is meant only for tel- telephone instrument via the normally ephone line’s DC voltage component is
ephones using the DTMF dialing mode. closed contacts of a relay and hence to greater than 12 volts (usually, 48 to 52V
• The circuit can be activated or de- inhibit operation of the #95 debarring DC), and during off-hook condition the line
activated simply by operating a hidden circuit, one can just switch off the supply voltage drops below 12V DC.
‘on’/‘off’ switch. to the circuit by opening switch S1. As a

The circuit
The circuit (see Fig.
2) comprises a cradle
on-hook/off-hook in-
dicator, #95 detector,
and power supply.
Cradle on-hook/
off-hook indicator.
Cradle on-hook/off-
hook status is detect-
ed via polarity-guard
bridge circuit compris-
ing diodes D1 through
D4.
When the hand-
set is on the cradle,
telephone line voltage
exceeds 12 volts to
cause breakdown of
12V zener diode ZD1.
Fig. 1: Block diagram of #95 debarring facility for telephones The in-built LED of

82 ELECTRONICS PROJECTS Vol. 23


ELECTRONICS PROJECTS Vol. 23
Fig. 2: The #95 debarring circuit for telephones

83
operation is reversed. Thus red
LED (LED1) glows, while the
green LED (LED2) is off.
A connection from the col-
lector of transistor T1 via diode
D5 is taken to reset pin 15 of
counter CD4017 (IC6) to en-
sure that IC6 remains reset as
long as the telephone handset
remains in on-hook condition.
You’ll get a clear idea of its full
function after going through the
#95 detector circuit described
below.
#95 detector. To dial any
number, the telephone hand-
set is lifted and the desired
number is dialed in DTMF
(tone dialing) mode. The dialed
digits are received/detected by
IC MT8870 or KT3170 (IC1)
that is connected to the tel-
ephone lines via the normally
closed contacts of relay RL1.
In case the first two digits of
the dialed number are found
to be 9 followed by 5, the relay
Fig. 3: Actual-size, single-side PCB for #95 debarring circuit energises for about 10 seconds
to disconnect the telephone
instrument from the lines, else
the circuit remains inactive to
allow you to establish contact
with the dialed number.
The detection process.
Each of the dialed digits ap-
pears at the output of IC1 in
binary format, and the same is
connected in parallel to:
• 4-bit latch IC3(a) (1/2
CD4508) for holding number 9
(decimal),
• 4-bit latch IC3(b) (1/2
CD4508) for holding number 5
(decimal), and
• 1-of-10 decoder CD4028
(IC2) for decoding number 9.
Assume that on lifting the
handset, the first dialed digit
is ‘9’. The binary equivalent
output of ‘9’ from IC1 appears
at the inputs of IC3(a), IC3(b),
and IC2 as mentioned earlier.
Here, IC2 is a BCD-to-deci-
mal decoder that generates a
strobe signal at its Q9 output
Fig. 4: Component layout for the PCB (pin 5) corresponding to digit
9 for latching IC3(a). The Q9 output is
optocoupler MCT2E conducts to pull its tor red LED (LED1) goes off and on-cradle differentiated by C4-R6 combination
collector towards ground and thus transis- indicator green LED (LED2) glows. and is applied to strobe pin 2 of IC3(a)
tor T1 is cut off and transistor T2 gets for- During off-hook condition, the line to latch the binary equivalent of ‘9’ at
ward biased. As a result, off-cradle indica- voltage drops below 12 volts and the above its output.

84 ELECTRONICS PROJECTS Vol. 23


Parts List is made available from IC2 for any other freezes and does not advance further,
Semiconductors:
digit. The high output at pin 3 of IC4 is unless the IC is reset again by plac-
used for enabling latch IC3(b) via NAND ing back the handset on the cradle
IC1 - MT8870 or KT3170 DTMF
receiver gate N1 and comparator IC5 for detect- and dialing afresh. Q3 output is also
IC2 - CD4028 BCD-to-decimal ing the next dialed digit. connected to pin 3 of IC3(a) (latch for
decoder IC5 is wired to give a high output digit 9) to disable it on the third dialed
IC3 - CD4508 dual 4-bit latch only for the input corresponding to digit digit onwards. Hence the circuit cannot
IC4, IC5 - CD4585 4-bit magnitude
comparator 5. Thus only if the first two dialed digits detect any subsequent ‘9 followed by 5’
IC6 - CD4017 decade counter are 9 followed by 5, the output of IC5 at in the middle of dialing sequence. Thus
IC7 - NE555 timer its pin 3 will be high. This high output the monostable will be triggered only if
IC8 - CD4011 quad 2-input is differentiated by combination C9-R9 the first two digits of a dialing sequence
NAND Gate
IC9 - 7805 5V regulator and applied to one of the inputs (pin 9) happen to be 95.
IC10 - MCT2E optocoupler of NAND gate N2, while the other input Once triggered, the output of IC7 lasts
D1-D11 - 1N4007 rectifier diode of NAND gate N2 is connected to dif- for the time duration determined by the
ZD1 - 12V, 500mW zener ferentiated output Q2 (pin 4) of counter combination of a 1-mega-ohm resistor
LED1 - Red LED
LED2 - Green LED CD4017 (IC6). (R8) and a 10µF capacitor (C7), which
Resistors (all ¼-watt, ±5% carbon, unless Decade counter IC6 makes sure that is approximately 10 seconds. (This time
stated otherwise): the circuit acts only for the first two digits duration can be changed by changing the
R1-R3 - 100-kilo-ohm and bypasses locking when 95 occurs in values of resistor R8 and capacitor C7, if
R4 - 27-kilo-ohm the middle of the dialing. This function is desired.) The output of IC7 activates relay
R5 - 330-kilo-ohm
R6, R7, R9, described below. RL1 (5V, two changeover, PCB mounting
R10, R12 - 10-kilo-ohm When the handset is on the cradle, reed relay) via transistor T3 to disconnect
R8 - 1-mega-ohm IC6 remains reset as the high output the telephone instrument from telephone
R11 - 18-kilo-ohm from the collector of transistor T1 is con- lines if someone tries to dial any number
R13, R15, R16- 1.2-kilo-ohm
R14 - 22-kilo-ohm nected to its reset pin 15 via diode D5 as beginning with 95.
R17 - 8.2-kilo-ohm mentioned earlier. Once the handset is The output of IC7 is also connected to
R18 - 56-kilo-ohm lifted up its cradle, IC6 is enabled and reset pin 15 of IC6 via diode D6 to keep
Capacitors: for each valid DTMF dialed digit, the the counter in reset state for the duration
C1-C2 - 0.1µF polyester delayed steering output (Std) from pin of the mono pulse. In that case, a second
C3-C5,C8-C10- 0.1µF ceramic disk
C6 - 100µF, 25V
15 of IC1 connected to counter clock pin number can be dialed after the 10-second
C7 - 10µF, 16V 14 of IC6 advances its count by 1. On the mono pulse-period even without placing
Miscellaneous: second dialed digit, its output Q2 (pin 4) the handset again on the cradle.
RL1 - 5V, 100-ohm, 2C/O reed goes high to apply a differentiated pulse Construction. A conventional power
relay (PLA make) to pin 8 of NAND gate N2. Thus if 9 and 5 supply circuit with 5V regulator is used to
are the first two dialed digits, a high pulse power the circuit. Optionally, an external
The latched output from IC3(a) is con- is synchronously available at both pins supply capable of supporting 250mA cur-
nected to IC CD4585 (IC4), a 4-bit magni- of NAND gate N2 to trigger a 10-second rent at 5 volts may be used.
tude comparator that is wired to compare monostable (IC7) wired around timer An actual-size, single-side PCB for the
the 4-bit input with digit 9. The output of NE555. In any other case the monostable circuit is shown in Fig. 3 and its compo-
IC4 at pin 3 goes high when its input cor- will not be triggered. nent layout in Fig. 4.
responds to digit 9. Even when the second Now when a third digit is dialed, Q3 EFY Lab note. The original circuit
digit is dialed, the outputs of latch IC3(a) output (pin 7) of IC6 goes high. Since this has been extensively modified to achieve
as well as IC4 don’t change, as no strobe pin is strapped to pin 13, the counter a stable operation. ❏

Readers’ comments est in my circuit. As regards the problem it for failure and, if required, replace
Q1. I have assembled circuit and found in the circuit, I suggest him to check with a new IC.
that it does not work with the number ’95,’ IC1 and IC2—both these ICs are main If the problem still persists, use pin
though it works with the combination ‘X5,’ components of the circuit. The number 6 (Q5) of IC2 to latch the dialled number
where ‘X’ can be any number between 0 ‘9’ is either not detected or there may be 5 separately in conjunction with the RC
and 9. I have used Toshiba’s IC 4028 in- a problem in the magnitude comparator. differentiator circuit consisting of ca-
stead of CD4028. Please help. For this, check the proper logic level at pacitor C4 (0.1µ) and resistor R6 (10k).
Soumya Kanti Dhara the inputs of IC4 (B0, B1, B2 and B3). It For this, connect pin 6 to STB pin14 of
Midnapore, West Bengal should be 1001, respectively, for the com- IC3 (b).
The author Parmar Latesh B replies: parison of the dialled number 9. IC1 is I’ll suggest the use of CD4028 only as
A1. I thank Mr Kanti for showing inter- prone to damage during testing, so check I am not aware of IC 4028.

ELECTRONICS PROJECTS Vol. 23 85


Microcontroller-Based
Access Control System
Vinay Chaddha

S
ecurity is a prime concern in our and if the entered password is wrong it
Parts List
day-to-day life. Everyone wants to gives a longer beep of one second.
Semiconductors:
be as much secure as possible. An The system uses a compact circuitry
IC1(U1) - MC68HC705KJ1
access-control system forms a vital link built around Motorola’s MC68HC705KJ1 microcontroller
in a security chain. The microprocessor- microcontroller and a non-volatile I2C IC2 (U2) - ST24C02 I2C EEPROM
based digital lock presented here is an EEPROM (ST24C02) capable of retaining IC3 (MN1) - MN1280 reset stabiliser
access-control system that allows only the password data for over ten years. IC4 (Reg1) - 7805 +5V regulator
T1, T2 - BC547 npn transistor
authorised persons to access a restricted The user can modify the password as (Q1, Q2)
area. well as relay-activation time duration for D1, D2 - 1N4007 rectifier diode
door entry. This version of software ena- LED1 - Red LED
bles use of the unit even without the I2C Resistors (all ¼-watt, ±5% carbon, unless
System overview EEPROM. (However, without EEPROM, stated otherwise):
R1-R6 - 10-kilo-ohm
The block diagram of the access-control the password and relay-activation time R7-R9 - 1-kilo-ohm
system is shown in Fig. 1. The system duration will be reset to default values on Capacitors:
comprises a small electronic unit with a interruption of the power supply.) C1, C2 - 33pF ceramic disk
numeric keypad, which is fixed outside C3, C4,
C6, C7 - 0.1µF ceramic disk
the entry door to control a solenoid-op-
erated lock. When an authorised person Hardware details C5
Miscellaneous:
- 10µF, 10V electrolytic

enters a predetermined number (pass- Fig. 2 shows the access control circuit. Its Xtal (Y1) - 4MHz quartz crystal
word) via the keypad, the relay operates main components are a microcontroller, PZ1 (BZ1) - Ceramic piezo buzzer
Con1 - Power-supply connector
for a limited time to unlatch the solenoid- I2C memory, power supply, keypad, relay, Con2 - 2-pin male/female Berg
operated lock so the door can be pushed/ and buzzer. connectors
pulled open. At the end of preset delay, Microcontroller. The 16-pin MC68H- - 7-pin male/female Berg
the relay de-energises and the door gets C705KJ1 microcontroller from Motorola connectors
SW1-SW12 - Tactile keyboard switch
locked again. If the entered password is has the following features: RL1 (RLY1) - 1C/O, 12V, 250-ohm
correct the unit gives three small beeps, • Eleven bidirectional input/output miniature relay
(I/O) pins
• 1240 bytes of data lines) for communication with
OTPROM program I 2C EEPROM.
memory I2C memory. A two-wire serial EEP-
• 64 bytes of ROM (ST24C02) is used in the circuit
user RAM to retain the password and the relay-
• 15-stage activation time duration data. Data stored
multiple-function remains in the memory even after power
timer failure, as the memory ensures reading
Out of eleven of the latest saved settings by the micro-
I/O pins, seven controller.
lines have been This I 2C bus-compatible 2048-bit
used for the key- (2-kbit) EEPROM is organised as 256×8
board, one for the bits. It can retain data for more than ten
buzzer, one for years. Using just two lines (SCL and SDA)
relay operation, of the memory, the microcontroller can
and two (SCL and read and write the bytes corresponding to
SDA, i.e. serial the data required to be stored.
Fig. 1: Block diagram of the access-control system clock and serial (Note. For details of the

86 ELECTRONICS PROJECTS Vol. 23


Fig. 2: Schematic diagram of the access-control system
voltage regulator 7805. Diode D1 is used
in series with 12V input to avoid damage
to the unit in case reverse voltage is ap-
plied by mistake.
Keypad. A 12-key numeric keypad
for password entry is connected to the
microcontroller. The keypad is also used
for modifying the default password as
well as relay-activation time period. To
economise on the use of I/O pins, we use
only seven pins for scanning and sensing
twelve keys.
The keypad is arranged in a 3x4 ma-
trix. There are four scan lines/pins, which
are set in output mode, and three sense
keys, which are used as input lines to the
microcontroller.
At 5ms interval, the microcontroller
sets one of the four scan lines as low and
other three scan lines as high, and then
checks for the status of sense lines one by
one. If any of the sense lines is found low,
Fig. 3: Flow-chart for changing the pass- Fig. 4: Flow-chart for changing the relay-
word activation duration it means that a key at the intersection
of a specific scan line and sense line has
microcontroller and programming of tional data on Motorola microcontrollers, been pressed.
I 2C EEPROM, you may refer to the refer to CD. The information pertaining to Similarly, after 5 ms, the next scan
article ‘Caller ID Unit Using Microcon- I2C EEPROM is available on STMicroelec- line is made low and remaining three
troller’ published in April ’99 issue of tronics’ Website.) scan lines are taken high, and again all
EFY and the article ‘Remote-controlled Power supply. The power supply unit three sense lines are checked for low
Audio Processor Using Microcontroller’ provides a constant 5V supply to the entire level. This way the microcontroller can
published in Sep. ’99 issue of EFY also unit. This is a conventional circuit using check whether any of the twelve keys is
in Electronics Projects Vol. 20. For addi- external 12V DC adaptor and fixed 3-pin pressed.

ELECTRONICS PROJECTS Vol. 23 87


The buzzer gives • Check 5 volts at pin 6 of the MCU
a small beep (IC1) and pin 8 of the memory (IC2) with
whenever a key respect to ground pin 7 of IC1 and pin 4
is pressed. In the of IC2.
case of a wrong • Check relay operation by shorting
password entry pin 9 of the MCU socket to 5 volts using
the buzzer gives a a small wire. Normally, the relay would
long beep, and in remain off. However, when pin 9 of the
the case of a right MCU socket is connected to 5V, the relay
password entry it should energise.
gives three short • Check buzzer operation by shorting
beeps. The buzzer pin 8 of the MCU socket to 5 volts using a
also gives short small piece of wire. Normally, the buzzer
beeps as long as would be off. As soon as you short pin 8 of
the relay remains the MCU socket to +5V, the buzzer will
energised. produce a continuous beep sound.
Fig. 5: Actual-size, single-side PCB for the access-control system • Physically check that only the ca-
without keypad (Main PCB) pacitors of 27 to 33 pF are connected to
Operation crystal pins 2 and 3 of the MCU. For a
The complete design is based on two higher-value capacitor, the crystal will
parameters: the password and the relay- not work.
activation time duration. Both these pa-
rameters can be changed without making
any change in the hardware. The user Operation
can change these parameters any number Switch off the supply and insert only
of times using the keypad. The flow- the microcontroller. Ensure correct
charts for chang-
ing the password
and relay-activation
time duration are
shown in Figs 3 and
4, respectively.

Fig. 6: Actual-size, single-side PCB for Testing


the keypad
Actual-size, single-
Due to the high speed of the micro- side PCBs for the
controller, status of different keys is access control sys-
checked in less than 100 ms and a key- tem (without key-
press is detected and identified. As the pad) and that of the
keys are pressed manually by the user, keypad are shown
this delay of 100 ms is not noticeable. in Figs 5 and 6,
The net result is that we save on I/O respectively, with
pins of the microcontroller by sacrificing their component Fig. 7: Component layout for the PCB in Fig. 5
almost nothing. layouts in Figs 7
Relay. A single-pole double-throw and 8, respectively. During assembly
(SPDT) relay is connected to pin 9 of the ensure proper mating of Con 3 (female)
microcontroller through a driver tran- on main PCB with SIP-7 (male) connec-
sistor. The relay requires 12 volts at a tor mounted on trackside of keypad PCB.
current of around 50 mA, which cannot After assembling the unit, check various
be provided by the microcontroller. So points without inserting the programmed
the driver transistor is added. The relay microcontroller and memory ICs as fol-
is used to operate the external solenoid lows:
forming part of a locking device or for • Connect the external power source (a
operating any other electrical device. DC adaptor capable of delivering 200 mA
Normally, the relay remains off. As soon at 12V DC), ensuring correct polarity.
as pin 9 of the microcontroller goes high, • Check input and output voltages of
the relay operates. regulator 7805. Ensure that the input volt-
Buzzer. The buzzer is connected to age is 8-12V DC from an external source.
pin 8 of the microcontroller. It beeps The output at pin 3 of the 7805 should be Fig. 8: Component layout for the PCB
to indicate key and password entry. 5 volts. in Fig. 6

88 ELECTRONICS PROJECTS Vol. 23


and the relay time. Check the operation
with new password and relay activation
period. Since there is no memory, the new
password and relay time entered will be
lost as soon as you switch off the unit.
The next time you switch on the unit,
the password is again set to 1111 and
the relay time to 10 seconds as default
parameters.
Now insert the memory IC and change
the password and the relay-activation time
duration. On changing the same, the new
password and changed relay-activation
time are saved in the memory, which will
be recalled at the next power-on. (Note. In
case you have forgotten the changed pass-
word, you cannot operate the unit unless
you install a new/blank memory.)
Caution. Take care while connecting
and using the live 220V wires.

The software
For software development the author has
Fig. 9(a): Flow-chart for the access-control system, continued in Figs 9(b) and 9(c)
taken the help of Understanding Small
direction and Microcontrollers, MC68HC705KJ1 Tech-
correct inser- nical Data book, and In-Circuit Simulator
tion of all the User’s Manual. The development tools
pins. Switch used include WinIDE software for KJ1
on the unit. (including editor, assembler, simulator
On entering and programmer), in-circuit simulator
1111 (default (referred to as JICS board), and IBM PC
password) with Windows OS and CD drive.
through the DOS-based programs can also be
keypad, the used for software development. So if you
relay will are comfortable with DOS or have an old
operate for computer with limited hard disk capacity,
around 10 you will still face no difficulty.
seconds (de- (Note. The books (in pdf format) and
fault time WinIDE software are available free of
duration). cost on Motorola’s Website and have been
Each key- reproduced by courtesy of Motorola in
press gives the CD. The mentioned CD also contains
a short beep. DOS-based programs. The JICS board
The buzzer may be bought from Motorola’s authorised
will also distributors.)
beep for 10 Program development steps. You can
seconds when write the software by using the following
the relay is steps:
‘on’. On en- 1. Read and understand the
tering some microcontroller’s operation and in-
other code, structions as well as the operation of
say, 9999, WinIDE software. (The help option of
the relay the software will clear most of your
should not doubts.) You should also have a clear
operate and knowledge of the logic sequence of
the buzzer the end-product operation. For this,
should give a you can make a flow-chart. (Flow-
long beep. chart for this access control system
Change is shown in Figs 9(a)-(c). The cor-
Fig. 9(b): Flow-chart for the access-control system, continued from Fig. 9(a) the password responding software source code is

ELECTRONICS PROJECTS Vol. 23 89


Fig. 9(c): Flow-chart for the access-control system, continued from Fig. 9(b)

given at the end of this article.) You can also choose options within the writing the software. So look for faults
2. Convert the flow-charts to source dialogue box to generate listing file with in your logic/code and rectify them. You
program in Assembly language making extension .LST and .MAP file for source- should be able to simulate complete
use of the instruction set of the microcon- level debugging. Thus if your source pro- functions without using the actual mi-
troller and assembler directives. You can gram was titled ‘main.asm’, you will get crocontroller chip.
use any text editor for writing the same main.s19, main.lst, and main.map files 5. Now, program the microcontroller
or use the text editor of the Integrated after successful assembly. with the developed and tested software.
Development Environment (IDE), which 4. Simulate your program using the After programming the microcontroller,
also includes assembler, simulator, and WinIDE software, JICS board, and the insert it into the circuit and check all
programming software. The Assembly- target board (the PCB with keyboard, functions again.
level program is to be saved in a file with memory, buzzer, etc). JICS board is con-
.asm extension. nected to the computer through serial port
3. Assemble the source code, i.e. (9-pin/25-pin) of the computer. The target Possible modifications
convert the source code (file with exten- board is connected to JICS board through The circuit can be modified to have more
sion .ASM) into object code (machine a 16-pin DIP header cable. than one password, advanced functions
language) using assembler/compiler tab During simulation you may find that like real-time clock, computer connectiv-
of environmental setting in WinIDE. The the program is not behaving properly. ity via serial/parallel port to log data, and
object code will be in S19 format, i.e. the Assuming that your hardware is okay, interfacing to a bar code reader instead
object code file will have extension .S19. the most probable reason is an error in of keypad for opening the lock. These

90 ELECTRONICS PROJECTS Vol. 23


additions may entail using a different hardware configuration while writing a pin 9 of the microcontroller. If the MN1280
microcontroller with more memory and fresh program. is not available, you can use only the RC
I/O pins, but using essentially the same Note. The MN1280 is attached to reset circuit. ❏

Main.asm
;;**************************************** ;; goto read def val ;***************************** ACTKBD *****
***** beq read_defval *************************************
;;PROJECT :- ACCESS CONTROL (GEN- inc e_add ;; increment e_add ;; set key press timeout to 10 seconds
ERAL) inc mem_ptr ;; increment ptr act_kbd: lda #10t ; set key press
;;VERSION :- 01 lda mem_ptr timeout = 10secs
;;STARTING DATE :- 09-10-2k day - monday cmp #max_iic_bytes ;; is all 3 bytes read sta kbd_timeout
;;IC :- KJ1 bne read_nxt_val ;; if no goto read_mem_
; ; H A R D W A R E : - 1 2 val lda kbd_pos ; read kbd pos
KEYS\1LED\1HOOTER\1MEMORY bra main_loop ;; if yes goto main_loop
;;HARDWARE REC. :- 06-10-2k ;*************************** KEY PROGRAM
;;FEATURES :- ENTER PASSWORD TO read_defval: jsr read_def_val OK PRESSED ****************************
OPEN DOOR act_kbd1: cmp #k_pgm_ok ; is pgm
;***************************************** ;;************************* MAIN LOOP ***** ok key pressed
**** *********************************** bne act_kbd2 ; if no goto act_kbd2
org 0c0h ;; after every one tick over call sense_kbd jsr chk_po_status ; if yes call chk_po_sta-
$setnot testing ;; after every half second over call chk_set_beep tus
$include "stdj1.asm" ;; after every second check kbd_timeout\en- bra ret_actkbd ; goto ret_actkbd
$include "ports.asm" try_time_out
$include "variable.asm" main_loop: brclr one_tick,tim_status,main_ ;; program here checks for po_password\po_en-
loop try_time flag
key_word equ 14h bclr one_tick,tim_status ;; if po_password\po_entry_time flag = 1 and if
key_word1 equ 28h jsr kbd_sense some other key press
second_last_kw equ 5h ;; accept pgm_ok_key then goto wrong entry
last_key_word equ 7h chk_hs_over brclr half_sec,tim_status,chk_1_ ;; else goto chk_pgm_key
sec act_kbd2 brclr po_password,entry_
et_buff db 2 bclr half_sec,tim_status status,chk4poet
jsr chk_set_beep jmp wrong_entry
org 300h
chk_1_sec brclr one_sec,tim_status,ret_act- chk4poet: brclr po_entry_time,entry_
$include "iic.asm" 1sec status,chk_pgm_key
$include "macro.asm" bclr one_sec,tim_status jmp wrong_entry
$include "readkbd2.asm"
;; program comes here after every second over ;*************************** KEY PROGRAM
start: rsp ; ************************ DECREMENT KBD PRESSED *****************************
TIMEOUT ******************************* chk_pgm_key: cmp #k_program ; is
;***************************** INITIALISE a1s_tstkbd tst kbd_timeout ; if pgm_ok key press
PORT ******************************** timeout = 0 then bne act_kbd3 ; if no goto act_kbd3
beq tst_eto ; goto check for entry bset pgm_mode,status ; if yes set flag of
init_port ddra ;; initialise port a time pgm_mode
init_port porta dec kbd_timeout ; else decrement kbd clr buff_pointer ; clear all pointers
time clr entry_status ; clear entry status
init_port ddrb ;; initialise port b tst kbd_timeout ; again chk kbd clr kbd_timeout
init_port portb timeout bra ret_actkbd ; give beep while returning
bne tst_eto ; if # 0 goto tst_eto
;************************** CLEAR MEMORY\ jsr wrong_entry ; give wrong entry ;************************** OTHER KEY
INITIALISE TIMER ************************ signal PRESSED *********************************
********** ;; check for password code
clear_mem ;; clear Ram ;************************* DECREMENT EN- ;; first chk for buff pointer is buffer pointer > 3 if
TRY TIME ****************************** yes then goto is_it_mode
init_timer ;; initialise timer ;; check for entry time = 00 ;; else take first digit pressed in kbd_buff,second
tst_eto: tst entry_time_out ; if timeout digit in kbd_buff+1
chk_mem ;; check EEPROM = 00 then ;; third digit in kbd_buff+2 & fourth digit in
beq ret_act1sec ; ret_act1sec kbd_buff+3
;; if bad_mem flag = 1 then goto read_defval dec entry_time_out ; else decrement
;; if bad_mem flag = 0 then read values from timeout act_kbd3 ldx buff_pointer ;; is all 4 digit
eeprom tst entry_time_out ; again chk entry password enters
time cpx #3
brset bad_mem,status,read_defval bne ret_act1sec ; if # zero goto ret_act- bhi is_it_mode ;; if yes then goto is_it_
1sec mode
;; program comes here when bad_mem flag = 00 bclr led_arm,led_port ; else ON led arm lda kbd_pos ;; else store kbd_pos in
;; at power on e_add & mem_ptr = 00 kbd_buff+ptr
;;************************* READ VALUES ret_act1sec sta kbd_buff,x
FROM EEPROM ************************** inc buff_pointer ;; increment pointer
;; read 2 byte password/entry time from EEP- ; *********************** CHECK FOR KEY ** lda buff_pointer ;; is it 4th digit to be en-
ROM ************************************* tered
read_mem_val clr mem_ptr ; if new key found flag set then goto act kbd else cmp #4 ;; if no then return
clr e_add goto main_loop bne ret_actkbd
read_nxt_val: jsr get_eeprom_info ;; read chkbd brclr new_key_found,status,ret_
from eeprom chkbd ; if new key found then set ;; program comes here when all 4 keys entered
lda e_dat ;; save read value in e_dat bclr new_key_found,status ; flag ;; check for valid code
ldx mem_ptr ;; set index reg as pointer jsr act_kbd ; call actkbd ;; if not valid code then give long beep and clear
sta password,x ;; save read value in ret_chkbd jmp main_loop ; buff_pointer\kbd_timeout
cmp #0ffh ;; if value read from EEPROM else goto main loop ;; and return
is ff then ;; else clear sys_arm flag and give accp beep

ELECTRONICS PROJECTS Vol. 23 91


jsr pack_buff ; call pack buffer cmp #01 ; is key 1 press bne ret_actkbd
bne chk2 ; if # goto chk2 bset po_password,entry_status ; else set
;; check for 4 key press set_entry_time bset es_entry_time,entry_sta- po_password flag
;; if it is equals to password then tus ; set flag of es_entry_time bra ret_actkbd ; return
;; return bra ret_actkbd ; return
;; if it is not equals to password then goto wrong entry_table db
entry chk2: cmp #02 ; is key 2 5t,2,4,6,8,10t,12t,14t,16t,18t
lda kbd_buff press
cmp password bne chk3 ; if # goto chk3 ;; program comes here when pgm_ok key press
bne chk4master_kw set_new_password bset es_password,entry_sta- ;; chck is po_entry_time flag = 1
lda kbd_buff+1 tus ; else set flag of es_password ;; if yes then
cmp password+1 bra ret_actkbd ; return ;; set last key press as pointer
bne chk4master_kw ;; take corresponding entry time from entry
chk3: table
;; PROGRAM COMES HERE WHEN 4 DIGIT ;;************************* WRONG ENTRY ** ;; and save in entry_time
CORRECT PASSWORD IS ENTERED *************************************** ;; goto com_po_ret
brset pgm_mode,status,ret_actkbd wrong_entry jsr long_beep ; give chk_po_status: brclr po_entry_time,entry_
bset led_arm,led_port ; off led long beep status,chk4popassword
arm jmp entry_over ; goto entry bclr po_entry_time,entry_status
lda entry_time ; set entry_time_out over jsr pack_et_buff
sta entry_time_out ; bra com_po_ret
jmp entry_over ; call entry_over
;; program comes here when buffer pointer is ;; program comes here when po_entry_time = 0
;; here program checks for master key word >4 ;; program here checks for po_password
;; if key sequence entered is equals to first 4 chk4parameters: ;; if po_password = 1 then
mater key word then cpx #05 ; if buff_pointer > 5 then ;; call pack_buff
;; e_key_word flag is set bne more_parameters ; goto more_pa- ;; store change password in password vari-
;; else rameters able
;; long beep is heard as wrong entry inc buff_pointer ; else increment ;; store in eeprom
pointer ;; call entry_over
chk4master_kw: ;; give acc_beep
lda kbd_buff brclr es_key_word,entry_ ;; return
cmp #key_word ;; 14 status,c4p1 chk4popassword
bne wrong_entry lda kbd_pos brclr po_password,entry_
lda kbd_buff+1 cmp #last_key_word ; last digit status,chk4more
cmp #key_word1 ;; 28 for master key word is 7 bclr po_password,entry_status
bne wrong_entry bne wrong_entry upd_password jsr pack_buff ; call
bset es_key_word,entry_status jmp master_reset_eeprom pack_buff
bra ret_actkbd lda kbd_buff ; save kbd_buff in
c4p1: sta password ; password
;; program comes here when unit is in program- ;; program comes here when buff_pointer = 6 lda kbd_buff+1 ; save kbd_buff+1 in
ming mode and 4 digit password enters ;; check is it es_entry_time = 1 sta password+1 ; password+1
;; if 4 digit entered # password then goto wrong ;; if yes then store key press in last_key _val
entry ;; set flag of po_entry_time com_po_ret jsr store_memory ; save
;; else return ;; return changed parameter in eeprom
xxxx: lda kbd_buff ; compare ;; if no then goto chk4es_pw jsr entry_over ; call entry over
kbd_buff with brclr es_entry_time,entry_ jsr acc_beep ; give acceptance beep
cmp password ; password status,chk4es_pw jmp ret_actkbd1 ; return
bne wrong_entry ; if # goto wrong entry lda kbd_pos
lda kbd_buff+1 ; if = compare kbd_buff+1 sta et_buff chk4more bra wrong_entry ; else
with jmp ret_actkbd give long beep
cmp password+1 ; password+1
bne wrong_entry ; if # goto wrong ;; program comes here when buff_pointer = 6 and
entry es_entry_time = 0 ;; SUBROUTINES :-
ret_actkbd jmp quick_beep ; give ;; check es_password flag ;;****************
small beep after every ;; if flag set then
; key press ;; save key press in kbd_buff
ret_actkbd1: rts ; return ;; else goto wrong entry
more_parameters: ;**************************** ACCEPTANCE
brclr es_entry_time,entry_ BEEP ********************************
is_it_mode: cpx #04 ; is buffer status,chk4es_pw ;; give beep thrice
pointer = 4 bset po_entry_time,entry_status acc_beep jsr short_beep
bne chk4parameters ; if # goto chk4pa- lda kbd_pos jsr short_delay
rameters sta et_buff+1 jsr short_delay
inc buff_pointer ; else increment tst et_buff jsr short_beep
pointer bne ret_actkbd jsr short_delay
tst et_buff+1 jsr short_delay
brclr es_key_word,entry_status,iim1 bne ret_actkbd jmp short_beep
;; program comes here when key word entry is jmp wrong_entry
checked ;**************************** ENTRY OVER *
;; check is 5th key press = 8 then return chk4es_pw: brclr es_password,entry_ *************************************
;; else status,wrong_entry ;; clear pointer\timeout\entry_status\pgm_
;; goot wrong key and give long beep lda buff_pointer ; subtract mode flag
lda kbd_pos buff_pointer with 6 entry_over: bclr pgm_mode,status
cmp #second_last_kw ;; next sub #6 clr buff_pointer
digit is 5 tax ; set subtracted val as pointer clr kbd_timeout
bne wrong_entry lda kbd_pos ; read kbd_pos clr entry_status
jmp ret_actkbd sta kbd_buff,x ; save in kbd_buff+ptr rts
iim1: inc buff_pointer ; increment pointer
;; key 1 is for entry time lda buff_pointer ; if pointer = 10 ; *************************** SHORT DELAY
;; key 2 for password change cmp #10t ; if no then ************************************
lda kbd_pos ; read kbd_pos return short_delay lda running_ticks
add #beep_time

92 ELECTRONICS PROJECTS Vol. 23


sta delay_temp pack_buff lda kbd_buff half sec
sd_wait lda delay_temp lsla bset one_sec,tim_status ;; set flag of
cmp running_ticks lsla one sec
bne sd_wait lsla
rts lsla ; clr running_ticks
ora kbd_buff+1 clr ticks ;; clear ticks
;***************************** LONG ENTRY sta kbd_buff dummy:
************************************ lda kbd_buff+2 ret_timint: rti
;; give this beep when wrong entry lsla
;; giva a long beep for around 1 sec lsla ;; start beep when entry or exit time is not zero
;; stay here till 1 second is over lsla chk_set_beep tst entry_time_out
long_beep lda #ticks_1_sec lsla beq ret_csb
sta buzzer_time_out ora kbd_buff+3 jsr short_beep
bclr buzzer,buzzer_port sta kbd_buff+1 ret_csb rts
lb_wait: bsr delay rts
bsr toggle_buzzer_pin ;; master key word received
tst buzzer_time_out ;**************************** STORE MEMO- ;; if key entered in following sequence then reset
bne lb_wait RY *********************************** EEPROm to default settings
bset buzzer,buzzer_port ;; store 2byte password in eeprom ;; Key word is 142587
rts store_memory: brset bad_mem,status,ret_sm ;; default setting is that password entry will
clr e_add ;; clear e_add change to 1111
;**************************** SHORT BEEP clr mem_ptr ;; clear mem_ptr master_reset_eeprom:
************************************** nxt_data: bsr read_def_val
;; this routine is called from accp_beep and when ;; read data from RAM location jsr acc_beep ; give accept-
ance beep
entry time # 0 ;; and store it in memory jsr entry_over
;; and after every key press ldx mem_ptr ;; set index register as ptr bra store_memory
;; beep for small time lda password,x ;; read upper byte of pass-
;; set buzzer_time_out = beep_time word read_def_val clrx
;; wait untill buzzer time out # 00 sta e_dat ;; save in e_dat rdv_loop: lda def_table,x
quick_beep: jsr set_eeprom_info ;; tx to eeprom sta password,x
incx
short_beep lda #beep_time inc e_add ;; increment address cpx #max_iic_bytes
sta buzzer_time_out inc mem_ptr ;; increment pointer bne rdv_loop
bclr buzzer,buzzer_port lda mem_ptr ;; is all 3 bytes written rts
sb_wait: bsr delay cmp #max_iic_bytes ;; if not goto nxt_data ;; here program pack entry time from et_buff\
bsr toggle_buzzer_pin bne nxt_data ;; else return et_buff+1
tst buzzer_time_out ret_sm: rts ;; first byte is in et_buff
bne sb_wait ;;************************* TIMINT ********* ;; second byte is in et_buff+1
bset buzzer,buzzer_port *********************************** ;; output to entry_time var
rts timint: lda #def_timer ;; set tscr
= 14h ;; for decimal selection multiply first number by
10t and then add with next number
;;************************* TOGGLE BUZZER sta tscr
PIN ******************************** bset one_tick,tim_status ;; set flag for pack_et_buff: lda et_buff
;; if buzzer time out # 00 then toggle buzzer pin 0ne tick over ldx #10t
mul
toggle_buzzer_pin: inc ticks ;; increment ticks add et_buff+1
brset buzzer,buzzer_port,reset_buzz- inc running_ticks sta entry_time
rts
er ;; if buzzer time out is not zero
bset buzzer,buzzer_port ;; then decrement buzzer timeout ;;*************************** DEFAULT TA-
bra ret_tbp ;; interrupt comes here afetr every 8.2msec BLE ***********************************
def_table db 11h ; password ;; change
reset_buzzer: bclr buzzer,buzzer_port defult password from 1234 to 1111
ret_tbp: rts tst buzzer_time_out db 11h ; password+1
beq chk_half_sec db 10t ; entry time
dec buzzer_time_out
;; ************************ DELAY FOR HALF org 7cdh
MSEC ******************************* chk_half_sec: lda ticks ;; compare jmp start
ticks with
;; this delay is approximately = 499usec cmp #ticks_in_hsec ;; ticks in half sec org 7f1h
;; 2+4+[(5+4+3)83]= 10998cycles bne chk4secover ;; if # goto chk4se- db 20h
;; 998/.5 = 499usec = .5msec cover org 7f8h
bset half_sec,tim_status ;; set flag of fdb timint
delay: lda #83t half sec over
sta temp org 7fah
chk4secover lda ticks ;; compare fdb dummy
wait_0: dec temp ticks with
tst temp org 7fch
cmp #ticks_1_sec ;; ticks in one fdb dummy
bne wait_0 second org 7feh
rts bne ret_timint ;; if # then return fdb start
;***************************** PACK BUFFER bset half_sec,tim_status ;; set flag of
************************************

Iic.asm
;; IIC_TX ldx #8 ; count of 8 bits bclr sda,iicont ; leave sda high by mak-
;; function : transfer 5 bytes from iic_buff to bit_iic: rola ; shift msb to ing it input
iic bus carry bsr delay_small
;; input : iic_buff bcc sda_low ; if no carry(msb low) bsr delay_small
;; output : to iic sda_high: bset sda,iicport ; carry bset scl,iicport
;; variables: rega, regx set msb high bsr delay_small
;; constants: scl bra pulse_scl clc ; normal - clear carry
;; sda sda_low: bclr sda,iicport brclr sda,iicport,byte_over ;error if ackn
;; iicport pulse_scl: bsr delay_small ; delay not rcvd
;; iicont bset scl,iicport ; set scl high sec ; error - set carry
bsr delay_small byte_over: bclr scl,iicport ; set scl
bclr scl,iicport ; then scl is set low low
;; input in a register ; bsr delay_small bsr delay_small
byte_iic: bset sda,iicont ; set sda decx ; is count over bsr delay_small
as output port bne bit_iic ; no next bit bclr sda,iicport ;

ELECTRONICS PROJECTS Vol. 23 93


rts ; leave with sda as input ;; fisrt sda is cleared the scl is set high ;; output : iic_status
;; then make sda high keeping scl high ;; variables : rega,regx
delay_small: nop ;; on return scl is high and sda is also high ;; constants : scl,sda,iicport,iicont
nop iic_rx:
nop gen_stop: bclr sda,iicport restart_rx:
nop bset sda,iicont ; set sda as output
nop jsr delay_small bsr gen_start
nop bset scl,iicport lda #0a0h
rts bsr delay_small dev_addr: jsr byte_iic ; sda
bset sda,iicport ; leave with sda is input on return
set_eeprom_info and bcs restart_rx
iic_tx: rts ; scl high and output lda e_add
;; generate start condition jsr byte_iic ; second
;; first set sda then scl then make sda low while gen_start: bset sda,iicont ; sda as byte as mem add
scl is high o/p bcs restart_rx
;; on return sda is low and scl is low bset sda,iicport ; and high bsr gen_start
lda #0a1h
;; variables : iic_counter,iic_buff(six bytes) bsr delay_small jsr byte_iic ; sda is input
bset scl,iicport ; scl also high on return
restart_tx: bsr delay_small read_iicbyte: ldx #8
read_iicbit: bset scl,iicport ; set
bsr gen_start bclr sda,iicport scl high
; jsr delay_small ; delay
lda #0a0h bsr delay_small ; bclr scl,iicport ; and again
bsr byte_iic bclr scl,iicport low
bcs restart_tx ; restart if rts brset sda,iicport,iic_1 ; read data bit
carry set iic_0 clc
lda e_add get_eeprom_info bra read_iic
bsr byte_iic ;; iic_rx iic_1 sec
read_iic rola
bcs restart_tx ;; generate start byte jsr delay_small ; delay
lda e_dat ;; transfer address byte with bit 0 set to 1 bclr scl,iicport ; and again
bsr byte_iic ;; if memory write e_add also low
bcs restart_tx ;; read one byte decx
;; and save in iic_status bne read_iicbit
;; generate stop condition ;; generate stop byte sta e_dat
;; sda is set as output and low ;; input : iicbuff (one byte- address of iic) bra gen_stop

stdj1.asm
porta equ 00h pdra equ 10h iscr equ 0ah
portb equ 01h pdrb equ 11h copr equ 7f0h
ddra equ 04h tscr equ 08h
ddrb equ 05h tcr equ 09h

variable.asm
last_key_val db 00 key_alarm equ 6
entry_status db 00 bad_mem equ 5 kbd_pos db 00
es_password equ 1 sys_arm equ 4 last_key db 00
es_entry_time equ 2 pgm_mode equ 3 same_key db 00
po_entry_time equ 3
po_password equ 4 password db 00,00 ;; stored in def_timer equ 14h
es_key_word equ 5 eeprom
entry_time db 00 ;; stored in tim_status db 00
temp db 00 eeprom one_tick equ 7
active_scan db 00 half_sec equ 6
kbd_temp db 00 buzzer_time_out db 00 one_sec equ 5
delay_temp db 00 beep_time equ 10t one_min equ 4
running_ticks db 00
mem_ptr db 00 entry_time_out db 00 mins db 00
hooter_time equ 2 ticks_1_sec equ 122t
kbd_timeout db 00 hooter_alarm_tout db 00 ticks_in_hsec equ 61t
buff_pointer db 00 ticks db 00
kbd_buff db 00,00,00,00 e_add db 00 max_iic_bytes equ 3
e_dat db 00
status db 00 iic_buff db 00 key_scan_cntr db 00
new_key_found equ 7

readkbd2.asm
scan_table: db 0eh,0dh,0bh,07h bil key_found lda key_port ;compare
key_scan_port equ porta ora #40h key_port with kbd table
cmp #70h and #0fh ; remove un-
;; sense2 line is at irq bne key_found ; no some used line
key pressed ora kbd_temp
kbd_sense bra no_key_found ; yes no clrx
sense_line lda key_port ;read key pressed
key port try_nxt_code cmp kbd_table,x
and #30h key_found sta kbd_temp beq key_matched ;if equal goto key

94 ELECTRONICS PROJECTS Vol. 23


matched clr same_key ;; code1 pin
incx ;else increment index bra kbs_over ;;scan0 bit pa0 ; 16
register ;;scan1 bit pa1 ; 15
cmpx #max_keys ;compare it with ret_kbs lda kbd_pos ;load ;;scan2 bit pa2 ; 14
maximum keys kbd pos ;;scan3 bit pa3 ; 13
bne try_nxt_code ;if not equal goto try cmp #0fh ; ;;sense0 bit pa4 ; 12
nxt code bne kbs_over ; ;;sense1 bit pa5 ; 11
;;sense2 bit irq
no_key_found ldx #0fh ; change_sense inc key_scan_cntr
key_matched txa ;load ac- lda key_scan_cntr ;; code 0 13-irq (pa3-pa5)
cumulator with 'X' cmp #04 ;; code 1 16-12 (pa0-pa4)
cmp kbd_pos ;compare it with kbd blo cs1 ;; code 2 16-11 (pa0-pa5)
pos clr key_scan_cntr
beq ret_kbs ;if equal return ;; code 3 16-irq (pa0-irq)
cmp last_key ;compare it with last cs1: lda key_scan_port ;; code 4 15-12 (pa1-pa4)
;; code 5 15-11 (pa1-pa5)
key and #0f0h
bne new_key ;if equal return sta key_scan_port ; reset all ;; code 6 15-irq (pa1-irq)
inc same_key ;else goto new key & scan lines to zero on ports ;; code 7 14-12 (pa2-pa4)
inc same ;; code 8 14-11 (pa2-pa5)
lda same_key ;for max debounce ldx key_scan_cntr ; output scan
load same key table to scan port one by one ;; code 9 14-irq (pa2-irq)
;; code 10 13-12 (pa3-pa4) ;; key program
cmp #max_debounce ;compare it with lda scan_table,x
4 ora key_scan_port ;; code 12 13-11 (pa3-irq) ;; key program ok
bne ret_kbs ;if not equal goto ret sta key_scan_port
kbs ret_sense_line kbd_table db 057h ;; code for 00
upd_key lda last_key ;load kbs_over rts db 06eh ;; code for 01
last key db 05eh ;; code for 02
db 03eh ;; code for 03
sta kbd_pos ;store it at kbd pos max_keys equ 12t db 06dh ;; code for 04
cmp #0fh ;is it key release db 05dh ;; code for 05
beq ret_kbs ;yes-do not set flag $if testing db 03dh ;; code for 06
bset new_key_found,status ;set bit of new max_debounce equ 1 db 06bh ;; code for 07
key found in $elseif db 05bh ;; code for 08
db 03bh ;; code for 09
bra ret_kbs ;status and goto ret max_debounce equ 3t
db 067h ;; code for pgm key
kbs $endif
db 037h ;; code for pgm ok key
new_key sta last_key

ports.asm
k_program equ 10t and led scan3 equ 3 ; 13
k_pgm_ok equ 11t ;; at power on system armed led sense0 equ 4 ; 12
def_ddrb equ 0ch ;; x x x x sda sense1 equ 5 ; 11
scl equ 2 scl x x ;;sense2 equ irq ; irq
sda equ 3 def_portb equ 00
iicport equ portb led_port equ porta
iicont equ ddrb key_port equ porta led_arm equ 6
;; 7 6 5 4 3 2 1 0 toggle_led equ 40h
def_ddra equ 0cfh ;; hoot led sen1 sen0 scan0 equ 0 ; 16
scan3 scan2 scan1 scan0 scan1 equ 1 ; 15 buzzer_port equ porta
def_porta equ 080h ;; active low hooter scan2 equ 2 ; 14 buzzer equ 7

macro.asm
$macro chk_mem sta tscr
bclr bad_mem,status ;; clear flag ;; clear memory from 0c0h cli ;enable interrupt
bad_mem $macro clear_mem $macroend
jsr gen_start ;; call gen_start ldx #0c0h ;clear memory ;; intialise porta , portb
lda #0a0h ;; send device add = next_mm clr ,x $macro init_port port
0a0h incx lda #def_%1
jsr byte_iic ;; to memory bne next_mm sta %1
bcc cm_over ;; of carry clear then $macroend $macroend
return
bset bad_mem,status ;; if carry set then
set flag ;; intialise timer EFY note. All relevant files are in-
cm_over ;; bad mem $macro init_timer cluded in CD. ❏
$macroend lda #def_timer

Readers’ comments books or sites covering the subject. of our knowledge. However, it won’t be
Q1. We want to use Intel 8051 Puneet much difficult to follow the flow diagrams
microcontroller in place of MC68H- Through e-mail and existing program to rewrite using
C705KJ1 system as it is easily avail- The author Vinay Chadha replies: 89C51.
able. Please give us the information It is not possible to convert KJ1 pro- The advantages of using KJ1 are that
regarding this conversion (MC68H- gram into 89C51 directly and no book it is much smaller in size, costs less, and
C705KJ1 into 8051) or suggest some covering the subject is available to the best consumes lower current than 89C51.

ELECTRONICS PROJECTS Vol. 23 95


Versatile PROGRAMMABLE
STAR DISPLAY
JUNOMON ABRAHAM

M
ost of the display circuits avail- • 2 kB of reprogrammable Flash
Parts List
able in the market are not pro- memory (endurance : 1000 write/erase
Semiconductors:
grammable. Here’s a versatile cycles)
IC1 - 7805 5V regulator
star display that provides digital control • 128 x 8-bit internal RAM IC2 - AT89C2051 microcontroller
of all the functions interactively and can • Two 16-bit timers/counters T1-T11 - BC547 npn transistors
be programmed for any desired display • Six interrupt sources LED1-LED11 - LED
sequence. It is built around Atmel’s • Programmable serial UART TR1-TR11 - BT136 triac
Flash-based powerful microcontroller • 15 programmable I/O lines Resistors (all ¼-watt, ±5% carbon, unless
89C2051. (Note. The complete datasheet of At- stated otherwise):
R1-R16 - 10-kilo-ohm
mel 89C2051 microcontroller is included R17-R27 - 150-ohm
in the CD.)
The circuit The microcontroller 89C2051 here uses
Capacitors:
C1 - 0.1µF ceramic disk
Fig. 1 shows the circuit of programmable clock frequency of 11.059 MHz. (You can C2 - 4.7µF, 10V electrolytic
star display. also use a 12MHz or nearer-value crystal C3, C4 - 22pF ceramic disk
Microcontroller 89C2051. This micro- instead.) The power-on reset function is Miscellaneous:
B1-B11 - 60W bulb/lamp
controller is compatible with the MCS-51 achieved by the combination of capacitor S1-S4 - Tactile switch
family. Its pin configuration is shown in C2 and resistor R5. J1 - 20-pin ZIF socket
Fig. 2. The main features of the microcon- Out of the 15 I/O lines, four lines (P3.2/ XTAL - 11.059MHz crystal
troller are: INT0, P3.3/ INT1, P3.5, and P3.7) are used oscillator

as input lines. Hence, only


eleven lines are available as
outputs lines. A 10-kilo-ohm
pull-up resistor is used at
each input/output pin. Each
output is connected to a tran-
sistor driver circuit for driv-
ing the corresponding triac,
which, in turn, switches the
mains supply to the light
load (up to 400 watt load can
be safely switched through
triac BT136).
Four external controls
have been provided via
pushbutton switches S1
through S4. These switches
are labeled as Increment
(+), Decrement (–), Effects,
and Page, respectively. INT1
and INT0 respond to Incre-
ment (+) and Decrement (–)
switches respectively, while
input pins P3.7 and P3.5
respond to Effects and Page
Fig. 1: The circuit diagram of programmable star display switches, respectively.

96 ELECTRONICS PROJECTS Vol. 23


spectively, the speed of the display (while comments, is given at the end of this ar-
pushswitches S3 and S4 are held in open ticle. The output sequences are obtained
condition). from a look-up table (LUT). Each entry
2. Different display sequences that are is output one by one with some specified
stored in different pages of the memory delay in between the consecutive outputs.
beforehand are accessed by holding Page This delay can be externally controlled
button down and using (+) and (–) buttons by pushbuttons (+) and (–) or by the com-
for incrementing and decrementing the mands in the look-up table. Pushbuttons
page numbers. (+) and (–) invoke the interrupt service
3. Different lighting effects are in- subroutines corresponding to INT1 and
voked by holding Effects button down and INT0, respectively.
using (+) or (–) buttons for changing the The commands for display sequences
effects. The available effects are blink and are stored in different pages of the memo-
reverse. Reverse complements the current ry. Each page can be accessed by holding
output states, i.e. ‘on’ state bulbs will be Page button down and using either (+) or
off, and vice versa. (–) button.
4. For interrupting (stopping) the The look-up table for setting up a
Fig. 2: Pin configuration of AT89C2051 output sequence, hold both Effects and versatile display is prepared as follows:
microcontroller Page buttons down and use (+) or (–) A total of nine commands are used. All
Construction buttons. commands are 16-bit wide. Thus two
memory locations are needed per com-
An actual-size, single-side PCB for the mand. Out of 16 bits, the three most
circuit is shown in Fig. 3 with its com- The firmware significant bits (MSBs) are used for
ponent layout in Fig. 4. However, this The source code for the programmable Opcode and the remaining 13 bits are
programmable star display circuit can star display circuit, along with suitable used for storing the variables for that
also be assembled
on any general- Table I
purpose PCB.
General Arrangement of Command Bits
The micro-
controller should D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
be fixed in an IC C3 C2 C1 C0 V11 V10 V9 V8 V7 V6 V5 V4 V3 V2 V1 V0
socket and the reg- C3, C2, C1, C0=Command V11 - V0=Variables for the command
ulator IC should
be provided with Table II
a heat-sink. For Output States
triacs a heat-sink
is necessary when D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 X Q10 Q9 Q8 Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0
the connected load
per triac exceeds Q10 - Q0=States at the outputs
60 watt. X=Don’t care
Caution. Blink
Since switching
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
is accomplished
0 0 0 1 X X X x x x x x x x x B
by triacs, don’t
touch the circuit B=1 for blink and 0 for no blink
parts while AC x=Don’t care
supply is plugged Speed
in. Further en- D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
s u r e t h a t L i v e 0 0 1 0 X X X x S7 S6 S5 S4 S3 S2 S1 S0
and Neutral lines
S7 - S0=Speed data
are not inter-
x=Don’t care
changed
Delay
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Operating 0 0 1 1 X X X x W7 W6 W5 W4 W3 W2 W1 W0
procedure W7 - W0=Delay units
1. Pushswitches Label
S1 (+) and S2 (–) D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
are used for in- 0 1 0 0 X X X x L7 L6 L5 L4 L3 L2 L1 L0
crementing and
decrementing, re- L7 - L0=Label

ELECTRONICS PROJECTS Vol. 23 97


Table II Blink. Using
this command the
Loop
blinking effect can
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 be enabled or disa-
0 1 0 1 N3 N2 N1 N0 L7 L6 L5 L4 L3 L2 L1 L0 bled.
N3 - N0=The number of times the loop should execute Speed. Using this
L7 - L0=Label indicating the end of the block command it is pos-
sible to change
Call
the speed in the
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 sequence coding
0 1 1 0 X x X x L7 L6 L5 L4 L3 L2 L1 L0 itself.
L7-L0=Label for the called subroutine Delay. It in-
serts a specified
Return
delay between
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 consecutive out-
0 1 1 1 X x x x x x x x x x x x put states. (Here
the delay per unit
Reset is 100 ms.)
D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 Label. This
1 1 1 1 X x X x x x x x x x x x command specifies
a label for Loop
command. It doesn’t
make any changes to
the outputs, but acts as
an associated command
for Loop.
Loop. This command
is used to execute a block
of display (output) states
for a specified number
of times. The end of the
loop is specified by the
label (L7-L0). When Loop
command is executed, the
statements following this
command are executed
up to the label specified
in the command, for N
(N3-N0) times. This com-
mand reduces the burden
of writing repeated com-
mands.
Call. This command
calls a subroutine.
Return. This com-
mand returns the control
to the main program from
where it was called.
Reset. This command
resets the execution point
to the beginning of the
Fig. 3: Actual-size, single-side PCB for the programmable star display page.
The coding of com-
Opcode. The general format of com- Output states. This command speci- mands to get a display sequence is shown
mands is shown in Table I, while the bit fies the states at the eleven outputs. Bits as a look-up table in the Assembly listing
mapping of each command, along with a indicated in this command correspond to itself. This Assembly program allows a
brief explanation, is shown in Table II. the outputs indicated in the schematic maximum of five nestings for Loop and
For understanding their usage you may diagram of Fig. 2. For any output to be ac- Call commands. Here, four pages of dis-
keep one of the four pages of the look-up tive, the corresponding bits in the output play are listed. One can go up to ten pages
tables (towards the end of Assembly level should be logic 1. Each output state is to by specifying the total number of pages
program) in front of you. be listed one by one. against NOOFPAGE in the constant dec-

98 ELECTRONICS PROJECTS Vol. 23


file STAR.HEX is gen-
erated by the assem-
bler program and con-
tains the program code
in Intel’s hex format.
Similarly, the file STAR.
LST is generated by the
assembler program for
documentation purposes.
It contains memory loca-
tions, hex code, mne-
monics, and comments
(descriptions).
(Note. The program
can be simulated by run-
ning a suitable software
simulator program, for
example, SIM31 by SPJ
Systems, Pune.)
The programming of
AT89C2051 was done at
EFY using the Topview
programmer from Front-
line Electronics, Salem,
Tamil Nadu. This device
programmer is reason-
ably priced and can be
used to program all the
Atmel’s 89CXXX family
Fig. 4: Component layout for the PCB in Fig. 3 devices using the stand-
ard PC. The program-
larations in the Assembly language listing ing function. This control accesses files of ming starts by loading
(NOOFPAGE EQU; the total number of the same name that are included with the the Intel hex/binary files into the device
pages you have). MetaLink 8051 cross-assembler distribu- programmer interactively.
tion diskette. When a $MOD control is The programmer hardware comes
Program compilation and used in a source program, it is important along with installation software. Once
that the specific $MOD file be available to the installation is done, select ‘Atmel
programming hints by EFY the cross-assembler. (Note. This file, along Flash programmer’ and then click on ‘ok’.
The Assembly level program (source with cross-assembler and its manual, will Select ‘load file/Flash buffer’ from ‘file’
program) is written using instruction be included in the next month’s EFY-CD.) menu. Load the STAR.HEX file into it.
set mnemonics of Atmel’s AT89C2051 The source program STAR.ASM has been Once the file is loaded, follow the in-
microcontroller and assembler directives compiled using ASM51 cross-assembler. structions given in the user’s manual or
with the help of any text editor available On running the ASM51.EXE, you ‘help’ menu. From ‘device’ menu, select
in DOS or Windows operating system. are asked to enter the source drive Selection/89C2051/Parallel. From ‘set-
By using ‘save as’ command from ‘file’ where the .ASM file is located and tings’ menu, select the serial COM port,
menu, the source program is saved under also the name of the source file. After either COM1 or COM2, as appropriate.
a proper file name with the extension giving the names of the appropriate (The COM port is used to connect the
.ASM. In this project, STAR.ASM is the drive and the source file, press ‘enter’ programmer to the PC.)
source file. to start compilation. The result of the Before programming, check and
The program listing starts with compiled program is shown as ‘Assem- verify the loaded program with the
$MOD52, which is an assembler control bly Complete, 0 Errors Found’ after help of STAR.LST file to ensure that the
that recognises predefined special func- all errors are successfully resolved. correct hex code has been loaded into
tion register symbols in the source pro- Now, close this screen and go to the the buffer. After verification, choose
gram. This saves the user from having directory of the source file. You will the auto-programming mode from
to define all the registers in the source observe that two new files are cre- ‘settings’ menu to program the micro-
program. $NOMOD disables the recognis- ated: STAR.HEX and STAR.LST. The controller chip.

ELECTRONICS PROJECTS Vol. 23 99


star.asm

Star.Asm: Assembly Level Listing MAIN1: ;initialisations FOLLOW20: LCALL LOOPING


EXIT1: POP TIMES
$Mod52 MOV SPEEDREG,#11 POP END_DPL
;********CONSTANT DECLARATIONS******** ;default speed POP END_DPH
MOV SPEED1,#11 POP STA_DPL
COUNT EQU 08h MOV TEMP_SP,#00 POP STA_DPH
COUNT1 EQU 09h MOV P3,#0FFh RET
COUNT2 EQU 0Ah CLR REVERSE
SPEEDREG EQU 0Bh ;initially no Reverse action ;********LOOPING********
SPEED1 EQU 0Ch CLR GBLBLINK ;ini- ;Execute the commands inside the LOOP com-
LABELREG EQU 0Dh tially no Blink mand
STA_DPH EQU 0Eh MOV PAGE,#01
STA_DPL EQU 0Fh SETB IT0 LOOPING:
END_DPH EQU 10h ;edge triggering for INT0 MOV DPH,STA_DPH
END_DPL EQU 11h SETB IT1 MOV DPL,STA_DPL
TIMES EQU 12h ;edge triggering for INT1 UP1: LCALL COM-
TEMP_SP EQU 13h MOV IE,#85h MON
PAGE EQU 14h ;enable INT0 & INT1 INC DPTR
TEMP_P1 EQU 15h MOV A,DPH
TEMP_P3 EQU 20h MAIN: CLR BLINKREG CJNE A , E N D _
STATUS EQU 22h CLR STOP DPH,UP1
TEMP3_0 BIT 00h MOV SP,#24h MOV A,DPL
TEMP3_1 BIT 01h ;initialize stack pointer CJNE A , E N D _
TEMP3_2 BIT 02h DPL,UP1
STATE BIT 09h ;selecting the page address DJNZ
ERROR BIT 0Ah MOV R0,PAGE TIMES,LOOPING
GBLBLINK BIT 0Bh CJNE INC DPTR
STOP BIT 0Ch R0,#01,NEXTPG1 RET
REVERSE BIT 0Dh MOV DPTR,#PAGE1
PLUS BIT 0Eh SJMP NEXT1 ;********FINDING THE LABEL********
BLINKREG BIT 10h NEXTPG1: C J N E ;returns loop count (number of times the loop
NOOFPAGE EQU 0 4 h R0,#02,NEXTPG2 should execute) in TIMES
;number of pages using, this may change as your wish MOV DPTR,#PAGE2 ;returns starting address of the loop in STA_DPH
SP_MIN EQU 03h SJMP NEXT1 & STA_DPL
SP_MAX EQU 40h NEXTPG2: C J N E ;returns ending address of the loop in END_DPH
R0,#03,NEXTPG3 & END_DPL
;********PROGRAM STARTS HERE******** MOV DPTR,#PAGE3 ;ERROR bit will set on error
SJMP NEXT1 ;LOOP COUNT equals zero (obtained from the
LJMP MAIN1 NEXTPG3: C J N E command)-
ORG 0003h ;INT0 VECTOR R0,#04,NEXTPG4 ;and zero loop size are considered to be error
LJMP PLUS1 MOV DPTR,#PAGE4
ORG 0013h ;INT1 VECTOR SJMP NEXT1 FINDLABL: DEC DPL
LJMP MINUS NEXTPG4: C J N E MOV A,DPL
R0,#05,NEXTPG5 CJNE
;********ISS OF INT0******** MOV DPTR,#PAGE5 A,#0FFh,FOLLOW22
;checking the valid key press of Decrement but- SJMP NEXT1 DEC DPH
ton NEXTPG5: C J N E
R0,#06,NEXTPG6 FOLLOW22: CLR A
PLUS1: LCALL DEBOUNCE MOV DPTR,#PAGE6 MOVC A,@A+DPTR
SJMP NEXT1 ANL A,#0Fh
JNB P3.2,FOLLOW41 NEXTPG6: C J N E CJNE A,#00,DOWN3
RETI R0,#07,NEXTPG7 SJMP ERROR1
FOLLOW41: SETB PLUS MOV DPTR,#PAGE7
JNB P3.2,$ SJMP NEXT1 DOWN3: MOV
LCALL DEBOUNCE NEXTPG7: C J N E TIMES,A ;getting the loop count (number of
JNB P3.2,FOLLOW41 R0,#08,NEXTPG8 ;times the loop should execute)
LJMP KEY_READ MOV DPTR,#PAGE8 INC DPTR
SJMP NEXT1 CLR A
;********ISS OF INT1******** NEXTPG8: C J N E MOVC A,@A+DPTR
;checking the valid key press of Increment button R0,#09,NEXTPG9 MOV LABELREG,A
MOV DPTR,#PAGE9 INC DPTR
MINUS: LCALL DEBOUNCE SJMP NEXT1 MOV STA_DPH,DPH
JNB P3.3,FOLLOW42 NEXTPG9: MOV DPTR,#PAGE10 ;getting the starting address of the loop
RETI MOV STA_DPL,DPL
FOLLOW42: CLR PLUS ;execute the commands in the page SETB ERROR
JNB P3.3,$ AGAIN2:
LCALL DEBOUNCE NEXT1: LCALL CALL_LB: CLR A
JNB P3.3,FOLLOW42 COMMON MOVC A,@A+DPTR
LJMP KEY_READ INC DPTR ANL A,#0F0h
LJMP NEXT1 CJNE A,#40h,DOWN2
;********SWITCH CONTACT DEBOUNCE DE- MOV END_DPH,DPH
LAY******** ;********FOR LOOP1******** ;getting the ending address of the loop
;this delay allows the key debounce to settle ;LOOP command processing MOV END_DPL,DPL
INC DPTR
DEBOUNCE: FORLOOP1: CLR A
MOV R6,#15h PUSH STA_DPH MOVC A,@A+DPTR
LOOPP2: MOV PUSH STA_DPL CJNE
R7,#0FFh PUSH END_DPH A,LABELREG,DOWN2A
DJNZ R7,$ PUSH END_DPL
DJNZ R6,LOOPP2 PUSH TIMES RET
RET
LCALL FINDLABL DOWN2: INC
;********MAIN ROUTINE STARTS JNB ERROR,FOLLOW20 DPTR
HERE******** SJMP EXIT1 DOWN2A: INC
DPTR

100 ELECTRONICS PROJECTS Vol. 23


CLR ERROR COUNT,#32h P1,A
MOV A,DPH MOV C,GBLBLINK MOV TEMP_P1,A
CJNE ORL C,BLINKREG
A,#08h,AGAIN2 JNC LOOP1 LCALL DELAY1SE
ERROR1: SETB MOV COUNT,#30h RET
ERROR CPL STATE
RET JNB DECIDE: INC
STATE,FOLLOW5 DPTR
;********CALL SUBROUTINE******** MOV P1,#00 CJNE
;execute the commands in the subroutine CLR P3.0 A,#20h,NEXT10 ;CHECKING FOR 'SPEED'
;first it has to save the current informations CLR P3.1 COMMAND
that are all CLR P3.4 CLR A
;needed when returns from the subroutine SJMP LOOP1 MOVC A,@A+DPTR
;first it has to find the starting of suroutine MOV TEMP_SP,A
block FOLLOW5: MOV P1,TEMP_P1 ADD A,SPEED1
;then execute the commands upto a return com- MOV C,TEMP3_0 MOV SPEEDREG,A
mand MOV P3.0,C ;reload the SPEEDREG with new value
MOV C,TEMP3_1 RET
CALLSUB: MOV P3.1,C
PUSH DPH MOV C,TEMP3_2 NEXT10: CJNE
PUSH DPL MOV P3.4,C A,#10h,NEXT11 ;CHECKING FOR 'BLINK'
PUSH STA_DPH COMMAND
PUSH STA_DPL LOOP1: MOV CLR A
PUSH END_DPH COUNT1,#0F7h MOVC A,@A+DPTR
PUSH END_DPL DJNZ COUNT1,$ MOV C,ACC.0
PUSH TIMES DJNZ COUNT,LOOP1 MOV BLINKREG,C
PUSH TEMP_SP DJNZ RET
PUSH STATUS COUNT2,LOOP2
CLR A MOV P1,TEMP_P1 NEXT11: CJNE
MOVC A,@A+DPTR MOV C,TEMP3_0 A,#30h,NEXT12 ;CHECKING FOR 'DELAY'
MOV LABELREG,A MOV P3.0,C COMMAND
MOV C,TEMP3_1 CLR A
;finding the subroutine block MOV P3.1,C MOVC A,@A+DPTR
MOV DPTR,#PAGE1 MOV C,TEMP3_2 CJNE A,#00,LOOP12
CLR ERROR MOV P3.4,C ;IF DELAY SPECIFIED IN THE INSTRUCTION IS
LCALL CALL_LB = 0,
JNB JB
ERROR,FOLLOW27 STOP,DELAY1SE ;NO NEED TO EXECUTE THE DELAY
SJMP EXIT2 RET RET
LOOP12: MOV
FOLLOW27: MOV DPH,END_ ;********COMMON ROUTINE******** COUNT1,#190 ;DELAY 100mSEC
DPH ;this routine execute the commands sequen- LOOP12A: MOV
MOV DPL,END_DPL cially COUNT,#0FFh
INC DPTR ;the commands are decoded by analizing the DJNZ
INC DPTR 4MSBs of the command COUNT,$
UP1A: CLR A ;note the respective commands for the bit ori- DJNZ
MOVC A,@A+DPTR entation COUNT1,LOOP12A
ANL A,#0F0h DJNZ
CJNE COMMON: ACC,LOOP12
A,#70h,FOLLOW28 CLR A RET
SJMP EXIT2 MOVC A,@A+DPTR ;now total time passed is=100mSec x value
;GETTING THE EVEN POSITION LOOKUP DATA of ACC
;execute the commands inside the subroutine ANL A,#0F0h
NEXT12: CJNE
FOLLOW28: LCALL CJNE A,#00,DECIDE A,#0F0h,NEXT13 ;CHECKING FOR 'RESET'
COMMON ;IF THE FIRST 4 BITS ARE NOT ZERO, THEN IT COMMAND
INC DPTR ;INDICATES A SPECIAL LJMP MAIN
SJMP UP1A COMMAND
NEXT13: CJNE
;reteiving the last states CLR A A,#50h,NEXT14A ;CHECKING FOR 'LOOP'
EXIT2: POP STATUS MOVC A,@A+DPTR COMMAND
POP TEMP_SP ;OUTPUT THE BITS D10 TO D0 (GETTING FROM LCALL FORLOOP1
POP TIMES RET
POP END_DPL ;2 LOCATIONS) TO THE PORTS
POP END_DPH NEXT14A: CJNE
POP STA_DPL ;IF THE REVERSE IS ENABLED (BY A,#60h,NEXT14 ;CHECKING FOR 'CALL'
POP STA_DPH THE EXTERNAL COMMAND
POP DPL ;CONTROL) COMPLEMENT LCALL CALLSUB
POP DPH THE RESPECTIVE RET
MOV A,TEMP_SP
ADD A,SPEED1 ;DATA BEFORE OUTPUTTING NEXT14: RET
MOV SPEEDREG,A JNB
RET REVERSE,FOLLOW26 ;********READING KEY DATA********
CPL A ;this routine read the state of 'Effect' & 'Page'
;********DELAY ROUTINE******** FOLLOW26: MOV C,ACC.0 button
;this routine provides the delay between states MOV P3.0,C ;accordingly activate/deactivate different effects
according to the speed MOV C,ACC.1 ;and change some parameters(such as speed,
;set either by command or external control MOV P3.1,C page etc.)
;if Blink effect is active (either by commands or MOV C,ACC.2 ;in response to the strocks of Increment and
external control) do blinking MOV P3.4,C Decrement button
;if stop action is done by external control wait in MOV TEMP_P3,A ;if both 'Effect' & 'Page'buttons are open ,then
this routine itself speed will change in response to (+)&(-) button
INC DPTR ;if only 'Page' button is pressed down then,page
DELAY1SE: CLR A changes in response to (+)&(-) buttons
CLR STATE MOVC A,@A+DPTR ;if only 'Effect' button is pressed down then,
MOV JNB different effects(Blink&Reverse) can be activate/
COUNT2,SPEEDREG REVERSE,FOLLOW37 deactivate by (+)&(-) buttons
CPL A ;if both 'Effect'&'Page' buttons are pressed down
LOOP2: MOV FOLLOW37: MOV then,you can interrupt(stop) the display output

ELECTRONICS PROJECTS Vol. 23 101


sequence DB 00010000b,00000001B
PAGE1: ;THIS IS A NORMAL PAGE ;BLINK
KEY_READ: (WITHOUT ANY SPEED COMMAND OR BLINK) DB 00000000b,00000001b
MOV A,P3 DB 01010011B,00000001B ;DISPLAY DATA
ANL A,#0A0h ;LOOP 3 TIMES THE BLOCK UP TO LABEL 1 DB 00000000b,00000010b
CJNE DB 00000100b,00000000b DB 00000000B,00000100B
A,#0A0h,NEXT3 ;DISPLAY DATA DB 00000000B,00001000B
JB PLUS,NEXT2 DB 00000010B,00000000B DB 00000000B,00010000B
MOV A,SPEED1 DB 00000001B,00000000B DB 00000000b,00100000b
CJNE A , # S P _ DB 00000000B,10000000B DB 00000000b,01000000b
MIN,$+3 DB 00000000b,01000000b DB 00000000b,10000000b
JNC FOLLOW1 DB 00000000b,00100000b DB 00000001b,00000000b
LJMP RELEASE DB 00000000b,00010000b DB 00000010b,00000000b
FOLLOW1: DEC SPEED1 DB 00000000b,00001000b DB 00000100b,00000000b
TOP5: MOV A,TEMP_SP DB 00000000b,00000100b DB 01000000B,00000101B
ADD A,SPEED1 DB 00000000b,00000010b ;LABEL 5
MOV SPEEDREG,A DB 00000000b,00000001b
LJMP RELEASE DB 01000000B,00000001B DB 01010011B,00000110B
;LABEL 1 ;LOOP 3 TIMES THE BLOCK UP TO LABEL 6
NEXT2: MOV A,SPEED1 DB 01010100B,00000010B DB 00100000B,00010100B
CJNE A,SP_MAX,$+3 ;LOOP 4 TIMES THE BLOCK UP TO LABEL 2 ;SPEED IS 20
JC FOLLOW1A DB 00000000b,00000001b DB 00010000b,00000000B ;NO
LJMP RELEASE DB 00000000b,00000010b BLINK
FOLLOW1A: INC SPEED1 DB 00000000B,00000100B DB 00000100b,00000001b
SJMP TOP5 DB 00000000B,00001000B ;DISPLAY DATA
DB 00000000B,00010000B DB 00000010B,00000010B
NEXT3: CJNE A,#20h,NEXT4 DB 00000000b,00100000b DB 00000001B,00000100B
JB PLUS,ALT1 DB 00000000b,01000000b DB 00000000B,10001000B
CPL GBLBLINK DB 00000000b,10000000b DB 00000000b,01010000b
SJMP RELEASE DB 00000001b,00000000b DB 00000000b,00100000b
DB 00000010b,00000000b DB 01000000B,00000110B
ALT1: CPL REVERSE DB 00000100b,00000000b ;LABEL 6
SJMP RELEASE DB 01000000B,00000010B
;LABEL 2 DB 11110000b,00000000b
NEXT4: C J N E DB 01010100B,00000011B ;RESET, STARTS FROM BEGINNING
A,#80h,NEXT4A ;LOOP 4 TIMES THE BLOCK UP TO LABEL 3
MOV A,PAGE DB 00000100b,00000000b ********PAGE-3 DISPLAY DATA********
JB PLUS,ALT2 ;DISPLAY DATA
CJNE A,#01,ALT3 DB 00000110B,00000000B PAGE3:;showing nested LOOP
SJMP RELEASE DB 00000111B,00000000B
ALT3: DEC PAGE DB 00000111B,10000000B DB 00100000B,00000000B
SJMP DOWN40 DB 00000111b,11000000b ;SPEED IS 0
DB 00000111b,11100000b DB 00010000b,00000000B ;NO
ALT2: CJNE DB 00000111b,11110000b BLINK
A,#NOOFPAGE,ALT4 DB 00000111b,11111000b DB 01010011B,00000111B
SJMP RELEASE DB 00000111b,11111100b ;LOOP 3 TIMES THE BLOCK UP TO LABEL 7
ALT4: INC PAGE DB 00000111b,11111110b DB 01010010B,00001000B
DOWN40: MOV R0,SP DB 00000111b,11111111b ;LOOP 2 TIMES THE BLOCK UP TO LABEL 8
MOV DPTR,#MAIN DB 01000000B,00000011B DB 00000100b,00000000b
MOV @R0,DPH ;LABEL 3 DB 00000110B,00000000B
DEC R0 DB 00000111B,00000000B
MOV @R0,DPL DB 01010010B,00000100B DB 00000111B,10000000B
CLR IE0 ;LOOP 2 TIMES THE BLOCK UP TO LABEL 4 DB 00000111B,11000000B
CLR IE1 DB 00000111B,11100000B
RETI DB 00000100b,00000001b DB 00000111B,11110000B
;DISPLAY DATA DB 00000111B,11111000B
NEXT4A: JB PLUS,ALT5 DB 00000010B,00000010B DB 00000111B,11111100B
CPL STOP DB 00000001B,00000100B DB 00000111B,11111110B
SJMP RELEASE DB 00000000B,10001000B DB 00000111B,11111111B
ALT5: CPL STOP DB 00000000b,01010000b DB 00000111b,11111111B
DB 00000000b,00100000b DB 00000111B,11111110B
RELEASE: RETI DB 01000000B,00000100B DB 00000111B,11111100B
;LABEL 4 DB 00000111B,11111000B
DB 00000111B,11110000B
;********LOOKUP TABLE******** DB 11110000b,00000000b DB 00000111B,11100000B
;While peparing this lookup table following points ;RESET, STARTS FROM BEGINNING DB 00000111B,11000000B
should be noted DB 00000111B,10000000B
;you can have maximum of 10 pages (the size of ;********PAGE-2 DISPLAY DATA******** DB 00000111B,00000000B
the pages are limited by the memory capacity(2KB) DB 00000110B,00000000B
of 89C2051) PAGE2: ;CUSTOM PAGE (WITH DB 00000100B,00000000B
;you have to specify the total number of pages THE USE OF BLINK AND SPEED COMMANDS) DB 00000000B,00000000B
that you are using DB 01010100B,00000101B DB 01000000B,00001000B
;in the initial constant declaration,ie. NOOF- ;LOOP 4 TIMES THE BLOCK UP TO LABEL 5 ;LABEL 8
PAGE EQU ??(number of pages you are DB 00100000B,00000000B DB 00010000b,00000001B
using) ;SPEED IS 0 ;BLINK
;maximum of 5 nesting is allowed for CALL & DB 00010000b,00000000B ;NO DB 01000000B,00000111B
LOOP commands BLINK ;LABEL 7
;you can have any number of CALL& LOOP com- DB 00000100b,00000000b
mands in a page ;DISPLAY DATA DB 11110000b,00000000b ;RESET, STARTS
;all commands are 16-bit long DB 00000010B,00000000B FROM BEGINNING
;the labels for CALL & LOOP commands should DB 00000001B,00000000B
not be same DB 00000000B,10000000B ;********PAGE-4 DISPLAY DATA********
;don't use same labels multiple times(even in DB 00000000b,01000000b
different pages also) DB 00000000b,00100000b PAGE4:
;output status (speed&blink) will be automati- DB 00000000b,00010000b DB 00100000B,00000000B
cally preserved when using a CALL command DB 00000000b,00001000b ;SPEED IS 0
;before proceeding you have to reffer the syntax DB 00000000b,00000100b DB 01100000B,00001001B ;Call
of all the commands DB 00000000b,00000010b subroutine with label 9
; DB 00000000b,00000001b DB 00100000B,00110000B

102 ELECTRONICS PROJECTS Vol. 23


;SPEED IS 48 DB 01110000B,00000000B DB 01110000B,00000000B ;Return
DB 01100000B,00001010B ;Return
;Call subroutine with label 10 DB DB 01000000B,00001010B ;********PAGE-5 DISPLAY DATA********
00100000B,00010000B ;SPEED IS 16 ;subroutine with Label 10
DB 00110000B,01100000B DB 01010100B,00001011B PAGE5: ;YOU CAN ADD MORE DISPLAY
;DELAY (96D[01100000B]x100ASec = 9.6Sec) ;LOOP 4 TIMES THE BLOCK UP TO LABEL11 PAGES HERE ONWARDS
DB 00010000b,00000001B
;BLINK DB 00000100b,00000000b ;********PAGE-6 DISPLAY DATA********
DB 01100000B,00001001B ;Call ;DISPLAY DATA
subroutine with label 9 DB 00000110B,00000000B PAGE6:
DB 11110000b,00000000b DB 00000111B,00000000B
;RESET, STARTS FROM BEGINNING DB 00000111B,10000000B ;********PAGE-7 DISPLAY DATA********
DB 00000111b,11000000b
DB 01000000B,00001001B DB 00000111b,11100000b PAGE7:
;Subroutine with label 9 DB 00000111b,11110000b
DB 00000100b,00000001b DB 00000111b,11111000b ;********PAGE-8 DISPLAY DATA********
;DISPLAY DATA DB 00000111b,11111100b
DB 00000010B,00000010B DB 00000111b,11111110b PAGE8:
DB 00000001B,00000100B DB 00000111b,11111111b
DB 00000000B,10001000B DB 01000000B,00001011B END
DB 00000000b,01010000b ;LABEL 11 ❏
DB 00000000b,00100000b

ELECTRONICS PROJECTS Vol. 23 103


MULTICHANNEL ACCESS
CONTROL SYSTEM
Sunil P.B.

H
ere we present a multichannel pad comprising keys 0 through 9 is used
Parts List
access control system, also for entering the decimal digits, which
known as digital code lock, to pre- are decoded to their binary equivalents Semiconductors:
vent the use of equipment by unauthorised by decoder IC1. The binary outputs of IC1 - 74C922 16-key encoder
IC2 (B1, B2) - 74LS244 octal buffer
persons. The circuit uses discrete TTL and IC1 are connected to the locking section IC3-IC6 - CD4015 dual 4-bit static
CMOS ICs. For accessing any device you via buffer B1 (half of IC2), the unlocking shift register
need to enter a 4-digit code via a keypad. section via buffer B2 (second half of IC2), IC7 - CD4017 decade counter
The circuit will check the code entered and a quad analogue switch (IC8). IC8 - CD4066 quad analogue
switch
via the keypad against a preprogrammed To enter the 4-digit locking code, first IC9, IC10 - 74LS688 8-bit comparators
locking code. Only if both these codes press program switch S11. After enter- IC11 - CD4028 1-of-ten decoder
match, you will be able to gain access to ing the four digits sequentially, switch IC12-IC15 - CD4013 dual ‘D’ flip-flop
the devices connected through the circuit. S11 is required to be pressed again. IC16 (N1, N2) - CD4073 3-input AND gate
IC17 (N3, N4) - CD4001 Quad 2-input
If the entered code is incorrect, access to This depression of switch S11 enables NOR gate
the devices is denied. You can control up the locking code section (comprising IC3 T1 - BC547 npn transistor
to eight separate devices using only one and IC4) and inhibits the unlocking sec- T2-T9 - SL100 npn transistor
code. tion (comprising IC5 and IC6). Another D1-D10 - 1N4001 rectifier diode
LED1 - Green LED
depression toggles/restores the initial LED2 - Red LED
condition in which the locking section
System overview remains inhibited and the unlocking
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
For understanding the overall function- section is enabled. R1, R2, R7,
ing, refer to the block diagram of the The 4-digit locking and unlocking R16 - 4.7-kilo-ohm
R3 - 2.7-kilo-ohm
multichannel access control system codes (converted to 16 binary bits) are R4-R6 - 1-kilo-ohm
shown in Fig. 1. A 10-digit decimal key- available at the output of the respective R8-R15 - 220-ohm
Capacitors:
C1, C2 - 0.1µF ceramic disk
C3 - 4.7µF, 10V electrolytic
Miscellaneous:
RL1-RL8 - 12V, 200W, 1C/O relay
S1-S14 - Push-to-on tactile switch
PZ1 - Piezobuzzer
B1 - 4.5V battery
- 5V, 1A regulated power
supply

sections. These two 16-bit numbers are


compared in a code comparator built
around IC9 and IC10. If the locking and
unlocking numbers match, the quad
analogue switch IC (IC8) is enabled,
while the clock gating circuit is inhib-
ited to freeze the locking and unlocking
sections (and their outputs) until one of
these is reset using switch S12 or S13,
respectively.
Thus once a match is found between
Fig. 1: Block diagram of the multichannel access control system locking and unlocking numbers, any

104 ELECTRONICS PROJECTS Vol. 23


Fig. 2: Circuit diagram of the multichannel access control system

further key depression results in the bi- flip-flop, which, in turn, toggles the state responding output pins of IC11. Thus
nary equivalent number at the output of of the relay driven by its output. Ad- switches corresponding to digits 1 through
IC1 to act as an address input for decoder dresses corresponding to keypad switches 8, when depressed, toggle the relay state
IC11. The output corresponding to the ad- for digits 0 and 9 have not been used for (from energised to de-energised and vice
dress input goes high to toggle a specific device addressing by not using the cor- versa) of the corresponding devices.

ELECTRONICS PROJECTS Vol. 23 105


Fig. 3: Actual-size, single-side PCB for the multichannel access control system

Fig. 4: Component layout for the PCB

106 ELECTRONICS PROJECTS Vol. 23


Table - 1 : Sequential Outputs of Shift Registers for Keyed Digits 4567
Outputs QD3 QC3 QB3 QA3 QD2 QC2 QB2 QA2 QD1 QC1 QB1 QA1 QD0 QC0 QB0 QA0
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
5 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1
6 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0
7 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1

Sequential depression of the same section through buffer B1. The func- the unlocking section, as stated earlier.
keypad switch will not alter the state tion of gates N1 and N2 is to allow The unit is now ready to accept the un-
of the corresponding relay. Thus if you the clock pulses (D AV output of IC1) to locking code, and if a valid code is entered
have erroneously changed the relay reach only the selected section (lock- via the keypad, the switching section is
state of a specific device, depress a ing or unlocking). activated.
dummy number (0 or 9) before keying For storing and shifting the entered digits The code comparator section.
the same number again. Switch S14 dual 4-bit static shift registers (four CD4015 For comparing the locking code
is used to reset all devices simultane- ICs) have been used. The entered digits are with the unlocking code a code
ously. shifted from right to left as in calculators. If comparator is needed. Two 8-bit
you desire to see the entered digits (binary magnitude comparator 74LS688
equivalents), connect LEDs at the output of ICs (IC9 and IC10) are cascaded
The circuit shift registers. Shifting and storing for the to form a 16-bit comparator here.
Fig. 2 shows the circuit diagram of the locking section is done using IC3 and IC4, The output of comparator 74LS688
multichannel access control system. while the similar function for the unlocking is active-low (normally high). The
Keypad interface. The 10-digit key- section is achieved using IC5 and IC6. two comparators have been used in
pad is wired to row and column inputs of Assume that we have enabled the conjunction with NOR gate N3 to get a
IC 74C922 (IC1), which is a 16-key en- locking section using program switch high output when the correct unlocking
coder IC with on-chip clock and debounce S11. Now on pressing reset switch S12, code is entered. This high output of
circuitry. The binary equivalent of the last the outputs of IC3 and IC4 of the locking NOR gate N3 enables quad bilateral
key depressed is available at its output. section are made low. When we press electronic switches inside CD4066 (IC8)
The data available pin (DAV) of IC1 goes any digit on the keypad, the 4-bit binary and the complement of NOR gate N3
to high level when a valid keypad entry data is loaded into the shift registers obtained from NOR gate N4 inhibits
is made and returns to low level when and the same appears at the first output AND gates N1 and N2, so no clock
the depressed key is released. The DAV of all the four shift registers. When the pulse is available for the shift registers
output is used as clock for the locking and next key on the keypad is depressed, of locking as well as unlocking sections
unlocking sections via 3-input AND gates the previously loaded data is shifted and the existing outputs of all shift
N1 and N2, respectively. The DAV output into the next output of each of the registers are frozen. In this condition
is also used to sound piezobuzzer PZ1 via four registers and the new data the keyboard has no effect on the
transistor T1 on entry of each digit via appears at the first output. On the locking and the unlocking sections. Now
the keypad. next (third) key depression, the second the keyboard data is routed through
Locking and unlocking sections. output data is shifted into the third bilateral switches of IC8.
The outputs of IC1 are buffered by two output and the first output data is The device/relay switching section.
sections of an octal tristate buffer 74LS244 shifted into the second output, while the The binary data corresponding to each
(IC2) before connecting the same to newly entered data appears at the first keypad entry is routed via switches of IC8
the locking and unlocking sections. IC output of the registers. Again on the next to the input of 1-of-10 decoder CD4028
74LS244 comprises two separately con- (fourth) key depression, the previously (IC11) to act as its address input. Q0 and
trollable 4-bit buffers designated as B1 loaded third output data shifts to the Q9 outputs of IC11 have not been used, as
and B2 in Fig. 2. For enabling the buffers, fourth output, the second output data stated earlier. The outputs corresponding
counter CD4017 (IC7) configured as a bist- shifts to the third output, first output to keyed digits 1 through 8 cause outputs
able flip-flop is used. Normally, the circuit data shifts to the second output, and Q1 through Q8 of IC11 to go high. Four
is initialised for accepting the unlocking the newly entered data appears at the dual-D CD4013 flip-flops (IC12 through
code since Q0 output of IC7 is initially first output. For example, if the entered IC15) are used as bistable switches at
high (which disables buffer B1) and Q1 locking code is 4567, we shall find outputs Q0 through Q8 of IC11 to hold
output is low (which enables buffer B2). that QA0 to QD0 is the nibble for units the relays in ‘on’ or ‘off’ states. The out-
When we depress program button place, QA1 to QD1 is the nibble for puts of IC11 are used as the clock pulses
S11 to enter the 4-digit locking code, tens place, QA2 to QD2 is the nibble for the corresponding flip-flops. Only the
Q1 output of IC7 goes high and Q0 for hundreds place, and QA3 to QD3 is keys for digits 1 through 8 are used for
output goes low. As a result, gate N1 the nibble for thousands place (refer the controlling the relays and other keys have
is enabled and gate N2 is disabled. table-1). no effect on the relay switching section.
Simultaneously, buffer B1 is enabled After entering the 4-digit locking Reset switch S14 connected to reset pins
and buffer B2 is disabled. The key- code, depress program switch S11 again of all the ‘D’ flip-flops can be used to reset
board data is now routed to the locking to inhibit the locking section and enable all the devices/relays together.

ELECTRONICS PROJECTS Vol. 23 107


supply rated at 5V, 1A. For unlocking the device
Construction • Enter the same four digits (4567) of
An actual-size, single-side PCB for the the locking code via the keypad. To indi-
multichannel access control system is Procedure cate the matching, LED2 glows and the
shown in Fig. 3 with its component lay- The procedure for entering the locking and device is unlocked. Locking and unlocking
out in Fig. 4. The PCB accommodates unlocking codes, and device switching is sections are inhibited and bilateral switch
IC1 through IC11 only. IC12 through summarised below: IC11 is enabled.
IC15 need to be wired separately as For entering the locking code For device/relay switching
per individual requirements on a • Reset the locking section using reset • Press the key on the keypad
general-purpose PCB. Relevant outputs switch S12. corresponding to the desired device
for the same are terminated on con- • Press program switch S11. LED1 number
nectors. 16-bit outputs of IC3+IC4 and should glow. Now enter the 4-digit lock- • The corresponding relay should
IC5+IC6 and inputs for IC9+IC10 may ing code, say, 4567, via the keypad one energise (or de-energise if previously
be interconnected using ribbon cables by one. energised).
with Berg stick connectors. The circuit • Press program switch S11 again. • Press S14 and observe that all relays
operates off an external regulated power are de-activated. ❏

108 ELECTRONICS PROJECTS Vol. 23


MICROCONTROLLER-BASED
ANNUNCIAToR SYSTEM
D. Nedumaran

T
oday, all instrumentation systems 1. A set of inputs (16 or 8 depending
pertaining to industrial process upon the requirement) to be scanned and Parts List
control as well as domestic applica- controlled. The inputs include contact Semiconductors:
tions, like elevator control and centralised switches, relays, etc. IC1 - 80C31 microcontroller
IC2, IC4 - 74373 octal latch
air-conditioning control, involve some 2. Input buffers and/or isolating de- IC3 - 2764/27128/27256 EPROM
type of automatic fault-finding facility. vices to interface the actual inputs to the IC5 - ULN2803 octal buffer/
This facility detects the faulty condition microcontroller. driver
of the system and draws the attention of 3. A microprocessor/microcontroller IC6 - 7402 quad NOR gate
IC7, IC8 - CD40106 hex Schmidt trig-
the operator towards it, enabling him to to look after the entire fault-finding ger inverter
take suitable remedial action to ensure process, such as reading the inputs, T1 - CL100 npn transistor
the proper operation of the system. interpreting the faults, outputting the LED1-LED8 - Red LED
One such method is annuciation in corresponding fault condition with audi- Resistors (all ¼-watt, ±5% carbon, unless
which activation of a visual or a mechani- ble alarm, and self-testing of the system stated otherwise):
R1-R11 - 4.7-kilo-ohm
cal indicator (called annunciator) takes itself to ensure the overall functioning
R12 - 10-kilo-ohm
place when a remote switch or device of the system. R13 - 6.8-kilo-ohm
has been activated as a result of fault 4. Ouput indication devices such R14-R21 - 1.8-kilo-ohm
in certain part of the system. An audio LEDs, relays, and audible alarm along Capacitors:
alarm may also be associated with an- with their interfacing devices (like C1 - 10µF, 10V electrolytic
nunciators. latches). C2, C3 - 22pF ceramic disk
C4-C11 - 0.1µF ceramic disk
Here we present a microcontroller-
Miscellaneous:
based annunciator system that detects
up to eight different faulty conditions and Circuit description S1-S3
XTAL
- Push- to-on switch
- 12MHz crystal
informs the operator about them. It is as- Fig. 1 shows the circuit diagram of the PZ1 - Piezobuzzer
sumed that each faulty condition results annunciator built around an 80C31 micro- LINK.1-LINK.8 - Interlock/relay contact
jumper
in closing of one of the eight interlock links controller. Since the 80C31 (IC1) doesn’t
(designated as LINK.1 through LINK.8 have a program memory, an EPROM is
in Fig. 1). Eight flashing light-emitting used to store the firmware of the system. 14, and 15, respectively, through three
diodes (LEDs), corresponding to each of Octal 3-state latch IC 74373 (IC2) is used inverter buffer gates (CD40106).
the eight links, have been used as annun- for low-order address (A0–A7) decoding. Each output of the system is connected
ciators. Each annunciation also results You may use any one of 2764, 27128, to the respective LED through latch 74373
in an audible alarm. Here only the faults and 27256 EPROMs (IC3) by setting (IC4) and Darlington transistor driver
persisting for more than 20 milliseconds jumpers Jl and J2 as per details shown ULN2803 (IC5). The address-decoding
are considered as critical and faults per- in Table I. logic for the output is performed by two
sisting for less than 20 milliseconds are The combination of resistor R13 OR gates (7402) using address signal A15
rejected. and capacitor C1 provides the neces- and write signal WR of the 80C31. Here
Basic requirements of an annunci- sary slow-rising power-on-reset signal the address assigned to the LED output
ator circuit. An annunciator circuit con- to the microcontroller’s reset input pin port is 8XXXh, where X means ‘don’t care’.
sists of the following basic components: 9. The eight inputs (links’ status) to be The buzzer for generating the audible
scanned are connected to the eight input alarm is connected to P3.0 (pin 10) of
Table I pins (P1.0 through P1.7) of port 1 of the IC1 through inverter gate N14 and npn
Jumper Setting Details microcontroller via eight CMOS invert- transistor driver CL100. The system clock
Device J1 position J2 position ers (CD40106). Three additional inputs is generated using the 12MHz crystal con-
(P3.3 through P3.5) of port 3, which are nected across oscillator pins 18 and 19 of
2764 Open +5V (right)
controlled by switches marked TEST (S1), the microcontroller.
27128 Closed +5V (right)
ACCEPT (S2), and CLEAR (S3), are in- In this design the four ports available
27256 Closed A14 (left)
terfaced to the controller’s input pins 13, in the 8031 microcontroller are configured

ELECTRONICS PROJECTS Vol. 23 109


Fig. 1: The circuit diagram of the annunciator built around an 80C31 microcontroller

as below: memory and outputting the input condi- input links.


Port 0: For outputting the 8-bit low- tions read by the microcontroller. Port 2: For outputting the 8-bit high-
order address and data to the program Port 1: For reading the status of eight order address.

110 ELECTRONICS PROJECTS Vol. 23


Fig. 2: Actual-size, component-side PCB layout for the 80C31 microcontroller-based annunciator

Fig. 3: Actual-size, solder-side PCB layout for the 80C31 microcontroller-based annunciator

ELECTRONICS PROJECTS Vol. 23 111


Fig. 4: Component layout for the PCB
Port 3: Pin 3.0 is used to enable the
audio output. Pins P3.3, P3.4, and P3.5
are used to read inputs TEST, ACCEPT,
and CLEAR, respectively, and P3.6 (WR
signal) is used for address decoding of the
output port (LEDs). The remaining pins in
this remain unused.
PSEN is used for reading the external
program memory, while ALE is used for
latching the low-order address bits in
IC2.
Actual-size, component-side and
solder-side PCB layouts of the annun-
ciator circuit are shown in Figs 2 and 3,
respectively. The component layout (silk
screen) for the PCB is shown in Fig. 4.
One terminal of the eight input links is
connected to GND pin of connector CON2
and the other terminal of the links is
connected to the respective input pin of
connector CON2. Similarly, one terminal
of control pushbuttons TEST, ACCEPT,
and CLEAR is connected to the respective
input pin of the connector (CON1) and
the other terminals of these pushbuttons
are shorted and connected to GND. The
5V power supply input (via 4.7-kilo-ohm
pull-up resistors) and GND are connected
to respective pins of connectors CON1 and
connector CON3.
Fig. 5: Flow-chart for the 80C31-based annunciator firmware To interface this circuit with the ac-

112 ELECTRONICS PROJECTS Vol. 23


assembly language listing of annunciator firmware
Addr. Opcode Label Mnemonics Comments 0084 4B ORL A,R3 ;combine with already found
ORG 0000H ;intialise the reset vector fault
0000 020010 LJMP INT ;jump to the actual program 0085 EB MOV A,R3 ;load aready found fault
;address#30h 0003 22 0086 4C ORL A,R4 ;combine with new fault
RET at 0087 F0 MOVX @DPTR,A ;o/p at led port
ORG 0010H ;define the actual program 0088 C2B0 CLR P3.0 ;enable sound
0010 758130 INT: MOV SP,#30H ;preset the stack pointer 008A 1200E5 LCALL DELAY ;delay for blink and beep
0013 D2B0 SETB P3.0 ;disable sound 008D E4 CLR A ;data for led off
0015 7B00 MOV R3,#00H ;clear register 008E 4B ORL A,R3 ;combine with already found
0017 7C00 MOV R4,#00H ;clear register fault
0019 E4 CLR A ;clear accn 008F F0 MOVX @DPTR,A ;o/p at led port
001A 908000 START: MOV DPTR,#8000H 0090 D2B0 SETB P3.0 ;disable sound
;data ptr. is assinged with 0092 1200E5 LCALL DELAY ;delay for blink and beep
;led port add 0095 D2B4 CHKACP1:SETB P3.4 ;set to read accept i//p
001D F0 MOVX @DPTR,A ;disable all leds 0097 A2B4 MOV C,P3.4 ;read accept i/p
001E D2B3 SETB P3.3 ;set the i/p to read 0099 401B JC CHKCLR1 ;check for accept i/p
0020 A2B3 MOV C,P3.3 ;read the test i/p 009B D2B3 CT2: SETB P3.3 ;set to read accept i/p
0022 400A JC TEST ;check for test i/p 009D A2B3 MOV C,P3.3 ;read test i/p
0024 7590FF MOV P1,#0FFH ;set port1 to read the i/p fault 009F 4002 JC TEST2 ;check the test i/p
0027 E590 MOV A,P1 ;read the i/p fault 00A1 80D2 SJMP ACCEPT ;jump to accept routine
0029 B40013 CJNE A,#00H,SCAN ;check for fault 00A3 74FF TEST2:MOV A,#00FFH ;data to lit leds
002C 80E2 SJMP INT ;jump to intial 00A5 F0 MOVX @DPTR,A ;o/p at led port
002E 74FF TEST: MOV A,#0FFH ;load the data to lit all leds 00A6 C2B0 CLR P3.0 ;enable sound
0030 F0 MOVX @DPTR,A ;o/p at led port 00A8 1200E5 LCALL DELAY ;delAY for blink and beep
0031 C2B0 CLR P3.0 ;enable sound 00AB E4 CLR A ;data to off led
0033 1200E5 LCALL DELAY ;delay for blink and beep 00AC EB MOV A,R3 ;combine with already found
0036 E4 CLR A ;load the data to putoff all leds fault
0037 F0 MOVX @DPTR,A ;o/p at led port 00AD 4C ORL A,R4 ;combine with new fault
0038 D2B0 SETB P3.0 ;disable sound 00AE F0 MOVX @DPTR,A ;o/p at led port
003A 1200E5 LCALL DELAY ;delay for blink and beep 00AF D2B0 SETB P3.0 ;disable sound
003D 80DB SJMP START ;jump to start 00B1 1200E5 LCALL DELAY ;delay for blink and beep
003F 7590FF SCAN: MOV P1,#0FFH ;set port to read fault 00B4 80BF SJMP ACCEPT ;jump to accept routine
0042 E590 MOV A,P1 ;read the fault 00B6 EB CHKCLR1:MOV A,R3 ;load the already found fault
0044 FB MOV R3,A ;save for future use 00B7 4C ORL A,R4 ;combine with new fault
0045 60C9 JZ INT ;check for fault 00B8 FB MOV R3,A ;save for future use
0047 EB SHOW: MOV A,R3 ;load detected fault 00B9 EB CHKCLR2:MOV A,R3 ;load already found fault
0048 F0 MOVX @DPTR,A ;o/p at led port 00BA F0 MOVX @DPTR,A ;o/p at led port
0049 C2B0 CLR P3.0 ;enable sound 00BB D2B0 SETB P3.0 ;disable sound
004B 1200E5 LCALL DELAY ;delay for blink and beep 00BD D2B5 SETB P3.5 ;set to read clear i/p
004E E4 CLR A ;data for led off 00BF A2B5 MOV C,P3.5 ;read clear i/p
004F F0 MOVX @DPTR,A ;o/p at led port 00C1 401B JC CLEAR ;check for clear i/p
0050 D2B0 SETB P3.0 ;disable sound 00C3 D2B3 CT3: SETB P3.3 ;set to read test i/p
0052 1200E5 LCALL DELAY ;delay for blink and beep 00C5 A2B3 MOV C,P3.3 ;read test i/p
0055 D2B4 CHKACP: SETB P3.4 ;set to read accept i/p 00C7 4002 JC TEST3 ;check for test i/p
0057 A2B4 MOV C,P3.4 ;read accept i/p 00C9 80AA SJMP ACCEPT ;jump to accept routine
0059 401A JC ACCEPT ;check for accept i/p 00CB 74FF TEST3:MOV A,#00FFH ;data to lit leds
005B D2B3 CT1: SETB P3.3 ;set to read test i/p 00CD F0 MOVX @DPTR,A ;o/p at led port
005D A2B3 MOV C,P3.3 ;read test i/p 00CE C2B0 CLR P3.0 ;enable sound
005F 4002 JC TEST1 ;check for test i/p 00D0 1200E5 LCALL DELAY ;delay for blink and beep
0061 80DC SJMP SCAN ;jump for scan routine 00D3 E4 CLR A ;data led off
0063 74FF TEST1: MOV A,#00FFH ;data for led lit 00D4 4B ORL A,R3 ;combine with fault found
0065 F0 MOVX @DPTR,A ;o/p at led port 00D5 F0 MOVX @DPTR,A ;o/p at led port
0066 C2B0 CLR P3.0 ;enable sound 00D6 D2B0 SETB P3.0 ;disable sound
0068 1200E5 LCALL DELAY ;delay for blink and beep 00D8 1200E5 LCALL DELAY ;delay for blink and beep
006B E4 CLR A ;data for led off 00DB 020075 LJMP ACCEPT ;jump to accept routine
006C 4B ORL A,R3 ;combine with already found 00DE E4 CLEAR: CLR A ;data to led off
fault 00DF F0 MOVX @DPTR,A ;o/p at led port
006D F0 MOVX @DPTR,A ;o/p at led port 00E0 D2B0 SETB P3.0 ;disable sound
006E D2B0 SETB P3.0 ;disable sound 00E2 020010 LJMP INT ;jump to intial routine
0070 1200E5 LCALL DELAY ;delay for blink and beep 00E5 7DFF DELAY: MOV R5,#00FFH ;count for delay
0073 80CA SJMP SCAN ;jump to scan routine 00E7 7EFF D1: MOV R6,#00FFH ;count for delay
0075 7590FF ACCEPT: MOV P1,#0FFH ;set to read i/p fault 00E9 DEFE D2: DJNZ R6,D2 ;decrement count
0078 E590 MOV A,P1 ;read the fault 00EB DDFA DJNZ R5,D1 ;decrement count
007A 4B ORL A,R3 ;combine with already found 00ED 22 RET ;return from delay routine
fault SYMBOL TABLE :
007B 6B XRL A,R3 ;set flag to find new faults INT 0010 START 001A TEST 002E SCAN 003F SHOW 0047 CHKACP
007C 603B JZ CHKCLR2 ;there is no new faut,check for 0055 CT1 005B TEST1 0063
clear i/p ACCEPT 0075 CHKACP1 0095 CT2 009B TEST2 00A3
007E 7590FF MOV P1,#0FFH ;set to read i/p CHKCLR1 00B6 CHKCLR2 00B9 CT3 00C3 TEST3 00CB
0081 E590 MOV A,P1 ;read i/p CLEAR 00DE DELAY 00E5 D1 00E7 D2 00E9
0083 FC MOV R4,A ;save for future use No errors detected.

tual control circuit of systems like eleva- power supply of the actual system that using the 8031 cross assembler. It com-
tor control or centralised air-conditioner requires detection/indication of faults. prises the following routines:
control, GND and signal inputs of the 1. Self-test routine. To check the
eight links are removed and substituted reliable working of the system. Whenever
with corresponding relay contacts of the Firmware TEST button is pressed, all the LEDs
actual system. The relays operate off the The firmware of the system is developed must blink with a beep sound.

ELECTRONICS PROJECTS Vol. 23 113


2. Scanning routine. To check for for the faulty inputs as well as the TEST and FAULT input button depressions.
faulty conditions. In case a fault is found input. If the program finds TEST input If another fault comes at this stage, the
(link closed), the corresponding output button pressed, all the eight fault-indi- corresponding LED blinks with audible
LED blinks with an audible sound. cating LEDs blink with audible sound. sound and the LEDs corresponding to the
3. Accept routine. To accept the Otherwise, the program continues looping already accepted faults glow continuously.
faulty conditions. Whenever a fault is in the scanning routine. If TEST input comes at this phase, all the
found, this routine checks and accepts the If some fault occurs (resulting in clos- LEDs blink with audible sound and the
faulty condition. The continuous glowing ing of a link) during the scanning mode, LEDs corresponding to the already ac-
of the LED corresponding to the fault the corresponding LED in the output port cepted faults glow continuously. If CLEAR
found but no corresponding sound from (8000H) blinks with audible sound. input button is pressed, it clears all the
the buzzer indicates that the given fault Now the program in a loop looks for output LEDs and disables the audible
has been noted for action. another fault or ACCEPT input or TEST sound. The program once again enters
4. Clear routine. To clear/reset the input. If another fault occurs, the same the START mode, where it looks for fresh
accepted fault conditions after rectifying routine is repeated. If TEST input button faults and TEST inputs.
the faults. Whenever the clear button is is pressed, all LEDs in the output port In this circuit, as faulty conditions are
pressed, the controller resets all the fault blink, except those corresponding to the simulated by closing of the eight links,
conditions accepted earlier, and once again fault found earlier. The LEDs correspond- the links for the accepted faults must
goes back to the scanning mode. ing to the fault found earlier glow continu- be removed before pressing the CLEAR
The entire program is written in As- ously with the audible sound. However, pushbutton. Otherwise, the program will
sembly language and its corresponding if ACCEPT input is pressed, the output once again detect the same fault because
Hex code is dumped in the EPROM. LEDs corresponding to the faulty (AC- the links are still simulating the same
Fig. 5 shows flow-chart of the pro- CEPTed) inputs continuously glow with faulty conditions.
gram. After resetting the system, the no sound. EFY. All relevent software files includ-
firmware clears all the outputs including Now the program enters the final ing datasheet of 80C31 are included in
the audible alarm sound. Then it scans phase, where it checks for CLEAR, TEST, CD. ❏

Readers’ comments debounce time at all, and the same is P. Prasad Babu
Q1. The ‘Microcontroller-Based Annun- supposed to be taken care of by the in- Through e-mail
ciation System’ is an incomplete project terlock control circuitry in a system. The The author D. Nedumaran replies:
because: annunciation system presented by the A2: In the case of an elevator system,
1. The text refers to a 20ms debounce author comes into play when a link has the door switch should be connected in
on the fault inputs, which is not imple- been closed due to a fault. (The link is ex- the links position in the input side of
mented in the hardware or the software. pected to close when a fault has persisted the controller. The door opened or closed
2. The LED output is not latched for for more than 20 milliseconds.) condition should be informed to the user
the faults reported. If link 1 opens, the 2. An LED for the reported fault stops in the same manner as the link open/close
LED will blink, but if link 1 is closed, the blinking once the fault is accepted but it condition is announced in my project.
LED stops blinking. The fault reported still remains on. Hence, it remains latched Likewise, the different relays, which
(status) must not change even if the fault until cleared. indicate the working or power-on condition
condition normalises before the operator 3. The LED output of a reported (de- of the compressor, fan, and other accesso-
accepts it. tected) fault is not cleared automatically ries in the central air-conditioning system
3. The LED output of an accepted fault on detection of a new fault. can be intimated/announced to the user.
is cleared when a new fault is reported The same annunciator circuit can be
and accepted. For all accepted faults, the Q2. The construction project ‘Microcon- employed to scan any input condition from
LED must remain on until ‘Clear’ button troller-Based Annunciator’ published in any system that gives +5V and GND for
is pressed by the operator. Dec. 2002 was interesting indeed. What ‘on’ and ‘off’ conditions, respectively.
Srikanth Kamath T. are the different faulty conditions that
Panther Electronics, Mangalore occur during the operation of an elevator
The author T.K. Hareendran replies: system and central AC system, and how
A1 : 1. The project does not talk of any we can detect them?

114 ELECTRONICS PROJECTS Vol. 23


INTELLIGENT EMERGENCY
LIGHT
A. SARAVANAN and S. SIVA SELVAN

M
ost of the automatic emergency room becomes dark. In this situation,
Parts List
lights available in the market there is an actual need for light and this
Semiconductors:
light up whenever there is a emergency light turns on.
IC1 - LM339 quad comparator with
power cut. These don’t take into account Also, the circuit uses a constant volt- open-collector outputs
whether there is an actual need for the age charger and a low-battery protection T1, T2, T4,
light or not. Further, most of them don’t circuit in order to protect the battery from T5, T6 - BC547 npn transistor
T3, T8 - MJE3055 npn power transis-
incorporate constant voltage charging and over charging and deep discharging and
tor
low-battery protection circuitry, which thereby increases the life of the battery. T7 - BC187 npn transistor/
results in shorter battery life due to over BC637/BC639
charging and deep discharging. BR1 - 2amp bridge rectifier or
Here is an intelligent emergency Block diagram 4×1N5402 rectifier diodes
LED1 - Green LED
light circuit that overcomes all the above The block diagram of the intelligent ZD1 - 6V, ½-watt zener diode
problems. It senses the light intensity in emergency circuit is shown in Fig. 1. The ZD2 - 2.7V, ½-watt zener diode
a room to determine the actual need for battery charger section receives mains D1 – D9 - 1N4148 diode
LED2 - Red LED
light and lights up only if required. It is AC input and charges a 12V battery with
Resistors (all ¼-watt, ±5% carbon, unless
designed to remain off during power cuts constant voltage. The battery supplies the stated otherwise):
in daytime and after the room lights have power required by the inverter section. R1, R3, R4, R8,
been switched off at night. However, dur- The output of the inverter drives the load R11, R13, R14,
R24, R27 - 1-kilo-ohm
ing evening hours, when the room needs (tubes). R2, R30 - 220-ohm, 1-watt
to be illuminated by electric lamps, the The low-battery protection section con- R5, R6, R10,
circuit switches on the emergency light in tinuously senses the terminal voltage of R12, R15, R16,
the event of a power cut. the battery and when the battery voltage R19, R22, R23
R25, R31 - 10-kilo-ohm
This circuit intelligently senses the falls below 10.8 volts, it gets latched and R9, R21 - 100-kilo-ohm
light intensity of the room before power gives a stop signal to the inverter section, R17 - 2.2-kilo-ohm
cut and after a power cut. During evening thereby stopping the inverter. R18 - 22-kilo-ohm
hours, the room being illuminated by The mains sensor section senses R28 - 470-ohm
R29 - 4.7-kilo-ohm
electric lamps, the light intensity is more whether the input AC mains is present or VR1, VR3 - 10-kilo-ohm preset
before power cut. When there is a power not. When the AC input is present, it gives VR2 - 100-kilo-ohm preset
cut, all the electric lamps go off and the a stop signal to the inverter section, resets Capacitors:
C1 - 1000µF, 35V electrolytic
C2, C10 - 1µF, 25V electrolytic
C3 - 100µF, 25V electrolytic
C4, C5, C7-C9 - 10µF, 25V electrolytic
C6 - 0.1µF ceramic disk
C11 - 0.047µF, 100V polyester
Miscellaneous:
X1 - 230V AC primary to 0-15V
AC, 1-amp secondary trans-
former
X2 - 12V, 20/40-watt inverter
transformer
S1-S3 - On/off switch
LDR - 5mm highly sensitive light-
dependent resistor
- IC socket
- Heat-sinks for T3, T8
- Mica washers
- 12V/10AH sealed lead-acid
battery
- 20/40-watt fluorescent tube
Fig. 1: Block diagram of intelligent emergency light

ELECTRONICS PROJECTS Vol. 23 115


When there is a pow-
er cut, the intelligent
switching circuit deter-
mines whether there is
an actual need for lights
or not, by sensing the
light intensity before
power cut and the light
intensity after power
cut. Then it sends an
appropriate signal to
the inverter section. The
inverter section converts
12V DC into 180V AC to
drive the load (tubes).

Circuit
description
The intelligent emer-
gency light circuit
shown in Fig. 2 com-
prises battery charger,
mains sensor, intel-
ligent switching, low-
battery protection, and
inverter sections. The
circuit uses a quad op-
amp with open-collec-
tor outputs (LM339).
The pin configuration
of LM339 is shown in
Fig. 2.
The battery
charger section. The
input AC mains sup-
ply is stepped down
by transformer X1 to
deliver a secondary
supply of 0-15V AC at
1 amp. A bridge recti-
fier rectifies the output
of the transformer.
Capacitor C1 acts as
a filter to eliminate
ripples. It provides
unregulated DC output
voltage.
The unregulat-
ed DC voltage is
fed to an adjust-
able voltage regu-
lator circuit com-
Fig. 2: Circuit diagram of the intelligent emergency light prising transistors
T1, T2, and T3. By adjusting VR1,
the low-battery protection circuit, and electrical signal. This electrical signal is the output voltage of this regula -
disables the intelligent switching section. wave-shaped by a Schmitt trigger circuit tor can be adjusted to deliver an
A light-dependent resistor (LDR) is wired using op-amp. output of 13.5 volts. The output of
used as a light transducer, which con- The absence of disable signal from the the regulator is used to charge a
verts light intensity into a proportional mains sensor section initiates a power cut. 12V lead-acid battery.
The mains sensor section. The un-

116 ELECTRONICS PROJECTS Vol. 23


cut, the electric lamps go off and the room
becomes dark. The disable signal from the
mains sensor section disappears. The out-
put of op-amp A goes low, which forces the
inverting input of op-amp B to go low to
about 1 volt. But the non-inverting input
is held at 10 volts by capacitor C5 and thus
the output of op-amp B goes high.
The positive feedback through resis-
tor R10 and diode D2 keeps the potential
of the non-inverting input at 10 volts.
At the same time, transistor T5 is being
saturated by the output of op-amp B; it
maintains the inverting input at 1 volt.
Thus diode D2, resistor R10, and transis-
Fig. 3: Functional block diagram of the intelligent switching section
tor T5, along with its components, form a
regulated DC voltage from the battery circuit forces the output of op-amp B to latch circuit and op-amp B gets latched
charger section gives a stop signal to the go low through diode D5, irrespective of with its high output. The stop signal from
inverter section through resistor R27 and its inputs. Thus the mains sensor circuit the intelligent switching section goes low,
diode D9. This unregulated DC voltage is disables the functioning of the intelligent which switches on the inverter section.
inverted by op-amp C. switching section. This circuit is immune to malfunction-
The output of op-amp C will be high As soon as there is a power failure, ing due to sensing of the light intensity of
when there is a power cut, and it will be the output of mains sensor becomes high, the emergency light itself. Once op-amp
low when AC mains supply is available. which reverse biases diode D5 and thus B is latched, it will remains in its high
This resets the low-battery protection the intelligent switching section gets state, irrespective of the output of op-amp
circuit through diode D6 and disables the enabled or activated. The functioning of A. This is achieved by latching both the
intelligent switching section through diode this section is analysed below for various inverting and non-inverting inputs of
D5 when the output is low. conditions. op-amp B. Thus the LDR can be placed
The intelligent switching section. (a) Power cuts during daytime. During anywhere in the emergency light cabinet.
For clear understanding, the functional daytime, when the room is well illuminat- You can also place the LDR near the
block diagram of this section is shown in ed by sunlight, the output of op-amp A is fluorescent tube of emergency light. The
Fig. 3. This section is wired around op- high before power cut and also after power entire intelligent switching function can
amps A and B. An LDR is used to sense cut. From the circuit you can understand be disabled by opening switch S3, thereby
the light intensity in the room. When the that the non-inverting input is held at 10 making it possible to use this as a normal
room is well illuminated, it offers a low volts and the inverting input is held at 12 emergency light.
resistance. During darkness, the LDR of- volts by resistor R15. Thus the output of The low-battery protection section.
fers a very high resistance. op-amp B is low. A 12V lead-acid battery should not be
Op-amp A is wired as an inverting A transistor inverter wired using discharged below 10.8 volts. Otherwise,
Schmitt trigger. The potential at the transistor T4 inverts it and gives a high the life of the battery gets reduced drasti-
inverting input of op-amp A is low when output, which is applied to the inverter cally. In order to protect the battery from
light falls on the LDR. Thus the output of section as a stop signal. Thus the emer- deep discharging, the inverter should be
op-amp A goes high, which indicates that gency light remains in off state during switched off when the terminal voltage
the room is well illuminated. When the power cuts in daytime. of the battery falls below 10.8 volts. The
intensity of the room light falls below a (b) Power cuts after lights have been low-battery protection circuit wired with
predetermined level (set by preset VR2), switched off at night. During power cuts op-amp D senses the terminal voltage of
the output of op-amp A goes low, which late at night, the room being dark both the battery and switches off the inverter
indicates that the room is dark. before power cut and after power cut, section when it falls below 10.8 volts.
When the output of op-amp A is high, the output of op-amp A is low in both the As the load is removed, the battery
i.e. the room is illuminated, it charges ca- conditions. Hence there is no charge across gradually regains its terminal voltage
pacitor C5 through diode D1 to a potential capacitor C5 and the potential at the non- to 12 volts. The circuit should have im-
of 10 volts approximately. Resistor R9 is inverting input of the op-amp is zero. The munity to this regained terminal volt-
used as a leakage resistor to discharge potential at the inverting input is around age and therefore positive feedback has
capacitor C5. Components D1, C5, and R9 1 volt. The output of op-amp B is low and been provided to the non-inverting in-
form a sample and hold circuit, which can hence the stop signal is high. Thus the put of op-amp D through diode D7 and
hold the non-inverting input of op-amp B emergency light remains in off state dur- resistor R23. Once the terminal volt-
as high for about 10 seconds. ing power cuts at late night. age falls below 10.8 volts, the circuit
When the room becomes dark, the (c) Power cuts during evening hours. gets latched with high output. Op-amp
output of op-amp A becomes low, which During evening hours, the room being D can be automatically reset by the
forces the inverting input of op-amp B to illuminated by electric lamps, the output mains sensor section when the power
go low through diode D3. As long as the of op-amp A is high and it charges the ca- resumes. Thus this section protects the
AC mains is present, the mains sensor pacitor to 10 volts. When there is a power battery from deep discharging.

ELECTRONICS PROJECTS Vol. 23 117


The inverter section. The inverter
circuit converts 12V DC into 180V AC
to drive fluorescent tubes. It consists of
transformer X2 and the components as-
sociated with transistors T7 and T8. The
inverter is wired as a Hartely oscillator
with transformer X2, transistor T8, resis-
tor R30, and capacitor C11.
You can also use any other type of
inverter circuit or a readymade inverter
circuit available in the market for this
purpose.
Transistor T7 acts as an electronic
switch for the inverter. When transistor
T7 receives a high stop signal from one or
more of the sections, it gets saturated and
bypasses the base current of transistor T8,
thereby switching off the inverter. When
it receives no stop signal from any of the
sections, the transistor T7 behaves as an Fig. 4: Actual-size, single-side PCB layout for the intelligent emergency light
open circuit and the inverter functions
normally.
Construction. The intelligent emer-
gency light circuit can be constructed on
a 2.5mm IC type general-purpose printed
circuit board (PCB) or a single-side PCB.
Fig. 4 shows the actual-size, single-side
PCB layout for intelligent emergency
light with its component layout in Fig. 5.
Carefully solder all the components and
use sockets for IC LM339. After construc-
tion, check the circuit thoroughly for short
circuits, breaks, and open circuits on the
PCB.
Mount proper heat-sink for power
transistors T3 and T8. Enclose the
circuit board, power transformer, and
other circuit components in a suitable
box. Use a wire with a core of 1 mm2
or more for the battery. The length of
the wire should be as small as possible. Fig. 5: Component layout for the PCB
Mount the LEDs and LDR on the front
panel with suitable holders. Mount the and reconnect the battery in its place. sity both from electric lamps and sunlight
switches suitably. 5. Position the instrument such that (natural light).
the LDR faces towards the centre of the Notes. 1. The same circuit with a 6V
room. The calibration is to be carried out battery and 6V inverter circuit works
Calibration at around 6 pm or you can stimulate the satisfactorily above a battery potential of
The calibration procedure of the circuit is lighting conditions at 6 pm by closing the 5 volts. The charger section should be de-
as follows: doors and windows. signed to deliver a constant output voltage
1. Disconnect the battery from its 6. Connect a voltmeter to the output of of 6.8 volts and the low-battery protection
place and connect a voltmeter (preferably op-amp A. Adjust preset VR2 suitably to circuit has to be set at 5.4 volts.
digital multimeter) across capacitor C3. read high (around 10 volts) in the voltme- 2. The IC LM339 is a quad op-amp/
2. Switch on S1 and adjust preset VR1 ter. Without disturbing the light rays that comparator that can work with a single
to read 10.8 volts in the voltmeter. fall on the LDR, gradually adjust preset supply potential from 2 volts to 36 volts
3. Rotate wiper arm of preset VR3 VR2 until the reading in the voltmeter and it has open-collector outputs. Don’t
completely towards positive of the bat- falls low to around 1 volt. try to substitute this IC with any other
tery. Switch on S2 and adjust preset VR3 7. Switch on S3 and check the instru- quad op-amp (like LM324). This intel-
gradually until the low-battery LED2 ment for proper functioning. Now the ligent emergency light can be operated
turns on. emergency light is ready for use. as a normal emergency light with switch
4. Adjust preset VR1 to read 13.5 volts Caution. Install the inverter such S3 open.
in the voltmeter. Disconnect the voltmeter that the LDR receives normal light inten- ❏

118 ELECTRONICS PROJECTS Vol. 23


Readers’ comments charging. A 12-volt lead-acid battery can 2. Resistor R2: 150-ohm, 1 watt
Q. In the first paragraph in Intelligent be charged to a maximum potential of 14 3. Zener diode ZD1: 2.7V, ½-watt zener
Emergency Light circuit in Dec. ‘02 volts. In this circuit, the voltage regulator The remaining components in the bat-
edition overcharging protection was is wired using transistors T1, T2, and T3, tery charger section remain the same. If you
mentioned. Please explain overcharge and their associated components provide want to operate the entire circuit with 6-volt
protection and recommend any circuit a potential of 13.5 volts. The battery will battery, you have to design an inverter sec-
for overcharge protection of 6V battery not get charged beyond this potential tion for 6-volt operation. Or you can try the
(SMF). What changes are to be done (13.5V). This circuit is sufficient to prevent same circuit by substituting R30 with vari-
for 6V battery operation in the above- overcharging, and hence I am not recom- ous values of resistors between 180-ohm and
mentioned circuit? mending any other circuit. 100-ohm rated 1 watt.
Pranab Kumar Roy The same circuit can be used to charge
Chandrapur a 6-volt, 10AH battery with following
The author A. Saravanan replies : modifications:
A. The overcharging of battery is pre- 1. Transformer X1: 230V AC primary
vented by the use of constant voltage and 0-9V, 1A secondary

ELECTRONICS PROJECTS Vol. 23 119


TRUTH TABLE EVALUATOR AND
KARNAUGH MAP PLOTTER
Somnath Chakrabarti

W
ith this circuit you can evalu- cally generated and inserted into the inputs of
Parts List
ate the truth table as well as the logic circuit, and the corresponding outputs
plot Karnaugh (K) map of any are evaluated. Semiconductors:
Boolean function. The circuit comprises Boolean function generation. The IC1 - NE555 timer
IC2 - SN7493 divide-by-16 coun-
Table I ter
IC3 - HD74LS151P multiplexer
Arrangement of Min Terms IC4 - 74LS04 hex inverter
BCD I0 I1 I3 I2 I6 I7 I5 I4 IC5 - DM74LS154N 1-of-16
A decoder/demultiplexer
D1 - 1N4148 switching diode
000 001 011 010 110 111 101 100 LED1-LED4,
0 m0 m1 m3 m2 m6 m7 m5 m4 LED6-LED21 - Red LED
1 m8 m9 m11 m10 m14 m15 m13 m12 LED5 - Green LED
Notes. 1. A represents the MSB, while BCD represent the lower digits (with D as the LSB). Resistors (all ¼-watt, ±5% carbon, unless
2. I0 through I7 are the inputs for IC3. stated otherwise):
R1-R6 - 330-ohm
R7, R8 - 100-kilo-ohm
Table II
Capacitors:
Example Truth Table For Function F(A,B,C,D) timer NE555 (IC1) in Fig. 1 is C1 - 100µF, 16V electrolytic
used in astable mode to generate
A B C D F(A, B, C, D) C2 - 0.001µF ceramic disk
clock pulses. Time period T of C3 - 0.01µF ceramic disk
0 0 0 0 1 the astable is determined by the
0 0 0 1 1 Miscellaneous:
following relationship: SA, SB, SC - Triple-pole double-throw
0 0 1 0 1 T=(RA+RB) x C ln2 (TPDT) switch
0 0 1 1 1 where RA=RB = R7 = R8 =
0 1 0 0 0 100k and C=C1=100 µF in posi- Realisation of the truth table. The
0 1 0 1 0 tion 1 of switch SA. procedure for realising the truth table is
0 1 1 0 0 Hence, T=14 seconds. as follows:
0 1 1 1 1 The clock pulses are fed to 1. First, make a table for min terms
1 0 0 0 1 a modulus-16 binary counter m0 through m15 as shown in Table I.
1 0 0 1 1 built around SN7493 (IC2). The 2. Next, keeping aside the variable
1 0 1 0 1 outputs from pins 11, 8, 9, and A output of IC2, connect B, C, and D
1 0 1 1 1 12 of IC2 provide bits A, B, C, outputs of IC2 to select inputs S2
1 1 0 0 0 and D, respectively. (pin 9), S1 (pin 10), and S0 (pin 11),
1 1 0 1 1 A multiplexer is a good respectively, of IC3. (Note that S2
1 1 1 0 0 choice to generate any arbitrary has the highest priority and S0 the
1 1 1 1 0
Boolean function. To generate a lowest.) Now in Table I, encircle the
4-variable Boolean function, we min terms (mi) for which the given
two sections, namely, truth-table evalua- require an 8-of-l multiplexer. We employ function F becomes 1 and apply the
tor and K-map plotter of function F. HD74LS151P (IC3) for this purpose. following rules:
Table III
Truth-table evaluator Realisation of the Truth Table for the Given Example
We first consider four-variable function F(A, B, BCD I0 I1 I3 I2 I6 I7 I5 I4
A
C, D), where A represents the most significant
bit (MSB) and D the least significant bit (LSB). 000 001 011 010 110 111 101 100
For truth-table evaluation, combinations of bits 0 m0 m1 m3 m2 m6 m7 m5 m4
ABCD from 0000 through 1111 are automati- 1 m8 m9 m11 m10 m14 m15 m13 m12

120 ELECTRONICS PROJECTS Vol. 23


121
ELECTRONICS PROJECTS Vol. 23
Fig. 1: The circuit of truth table evaluator-cum-Karnaugh map plotter
To understand how the circuit func-
Plotting the K-map of func- Table V
tions, consult logic table (Table IV) of Alternate Form for Table III
tion F DM74LS154N.
Here, l-of-16 demultiplexer DM74L- In Table IV, ‘d’ stands
S154N (IC5) is employed to realise the for data. Depending on the
circuit. Inputs A, B, C, and D obtained bit combinations of select
from IC2 are also routed to select pins word S3 S2 S1 S0, only a
S3 (pin 20), S2 (pin 21), S1 (pin 22), particular output (Yi) as-
and S0 (pin 23) of IC5. Strobe pin 19 of sumes the value of data ‘d’
IC5 is permanently tied to ground. Data and all the other Y outputs
input pin 18 is routed to pin 6 of IC3, remain in logic 1 state.
which gives F output. Output pins Y0 Thus if S3 S2 S1 S0 is 0101,
(pin 1), Y1 (pin 2), Y2 (pin 3), Y3 (pin Y5 output is selected, which
4), Y4 (pin 5), Y5 (pin 6), Y6 (pin 7), y7 will be 0 if d is 0 and 1 if d
(pin 8), Y8 (pin 9), Y9 (pin 10), Y10 (pin is 1. In this circuit, d=F.
11), Y11 (pin 13), Y12 (pin 14), Y13 (pin Thus when F is 0, d is 1 and
15), y14 (pin 16), and Y15 (pin 17) are vice versa.
connected to the cathodes of 16 LEDs When ABCD is 0000,
directly. These LEDs are labeled m0 i.e. S3 S2 S1 S0 is 0000,
through m15, respectively. The LEDs are Y0 is selected. Since in this
arranged in the form of a 4x4 matrix, as case the value of function F
required in a K map. The anodes of all is 1 (refer Table II), d=F=0.
the 16 LEDs are tied to the pole of SPDT So only Y0 is 0 and all other
switch SC via a 330-ohm resistor R6. Y outputs are 1. Conse- 0100, Y4 is selected. In this case, F is 0,
To view the K map, keep the poles quently, only m0 LED lights up and other which means d=F=1. Therefore Y4 is l. Con-
of all the three SPDT switches in posi- LEDs remain off. sequently, m4 will also remain off along with
tion 2. When combination ABCD becomes other 15 LEDs.
In this way all the 16 LEDs turn on/off
one after another according to the nature of
the function.
As the value of capacitor C2 in the cir-
cuit is 0.001 µF, the value of T is 0.00014,
i.e. the frequency equals 7.22 kHz. So due
to persistence of vision, you will observe
a steady display of the K map. Here, the
pattern will look like letter ‘Z’.
In function F(B, C, D), B is the MSB.
To view the truth table and K-map of this
3-variable function, make the following
minor changes:
1. Disconnect A from both IC3 and
IC5.
2. In IC3, make S2=0 (ground) and keep
S1=C and S0=D as before.
3. In IC5, make S3=0 and keep S2=B,
S1=C, and S0=D as before.
4. Make a table similar to Table I and
realise the required function F with the
multiplexer, by applying the four rules men-
tioned earlier.
You can now view the K map on the top
two rows of the LED matrix.
An actual-size, single-side PCB for
the circuit of truth table evaluator-cum-
Karnaugh map plotter is shown in Fig.
2 with component layout in Fig. 3. The
LED layout in Fig. 3 resembles that of
the schematic diagram in Fig. 1 as well as
Table V.

Fig. 3: Component layout for the PCB

ELECTRONICS PROJECTS Vol. 23 123


SECTION B :
CIRCUIT IDEAS
SECTION A :
CONSTRUCTION PROJECTS
Parallel Telephones With auto
secrecy and Intercom facility
pratap chandra sahu

T
his circuit can be used to connect marked telephone line is connected to in- the NAND gates are low and hence the
any one of four telephones to the dividual telephones via the N/C (normally corresponding Darlington coupled relay
telephone line with auto privacy. connected) contacts of their corresponding drivers are cut off.
When all the telephone handsets are in relays. When the handset of any telephone is
on-cradle position, the current through Initially, when the handsets of all the lifted, the corresponding optocoupler tran-
the optocoupler LEDs is inadequate to telephones are on the cradles, none of the sistor is switched on and its emitter goes
activate their inbuilt transistors. How- optocouplers conduct adequately and as high. This high output is inverted to low
ever, the ring signal passes to all the such the emitters of inbuilt transistors of state and applied to the inputs of all the
four telephones in parallel, since the ‘+’ all optocouplers are at low level. The tran- NAND gates, except the one correspond-
marked telephone line is connected to the sistor outputs available at the emitters ing to the lifted handset; for example, the
telephone instruments through combina- are inverted to logic 1 state and applied output of inverter N1 is not connected to
tion of inbuilt LEDs of optocouplers in to all the inputs of 4-input NAND gates NAND gate N5.
parallel with reverse diodes, while the ‘–’ N5 through N8. Thus the outputs of all Thus the relay corresponding to the

Fig. 1: Schematic diagram of four parallel telephones with auto secrecy


ELECTRONICS PROJECTS Vol. 23 127
Fig. 2: 4-position intercom circuit position comprises a preamplifier and
low-power amplifier set, three push-
to-on switches (one each for com-
municating with the remaining three
positions), SPDT (listen/speak) switch,
and dynamic 8-ohm, 1W speaker. The
speaker serves as speaker in ‘listen’
position and as mic in ‘speak’ position.
The 12V, 200mA regulated supply is
common for all positions. You can use
6-core telephone cable to wire the in-
tercom circuit.
For talking from one position to
the other position, put the talk/listen
switch to ‘talk’ position, push the switch
corresponding to the called party
position, and then speak into the loud-
Fig. 3: Audio amplifier circuit for intercom speaker. For listening, keep the talk/
listen switch in ‘listen’ position.
lifted handset remains de-energised and ensures complete secrecy as only the per- You may use a readymade audio
the telephone line remains connected to it son who first lifted the handset remains amplifier and preamplifier combination
via its de-energised N/O contacts. But the connected to the common telephone line, or 6V/12V tape cassette amplifier. The
outputs of all the remaining NAND gates while the line is disconnected from the connections are to be made as per Fig.
go high to switch on the corresponding remaining telephones. 2. Fig. 3 shows the circuit of audio am-
relays via their relay driver Darlington Fig. 2 shows the 4-position intercom plifier comprising preamplifier LM387
transistor pairs, which, in turn, discon- circuit that enables you to divert the call and power amplifier LM386 used dur-
nect the remaining three telephones. This to the concerned person. Each intercom
ing the testing phase at EFY Lab.

Readers’ comments The author, Pratap Chandra Sahu,


Q1. Please provide an alternative for replies:
MCT2E and intercom facility through A1. The in-built LED and transistor of
the phones themselves without using MCT2E can be replaced by a 5mm red
additional intercom. I think the 9-line LED and an LDR, respectively, as shown
telephone sharer circuit published in in Fig. 1.
Fig. 1: Replacement of optocoupler with
EFY’s Feb. ’01 issue could be of some help The use of parallel telephones as in-
LED-LDR combination
in this case. tercom is complicated, as it needs a 4-line
A.N. Babu exchange. I am working on an 8-16 line shall try to make this intercom unit for
Rajahmundry, Andhra Pradesh intercom using pushbutton telephones and use in parallel.

128 ELECTRONICS PROJECTS Vol. 23


Hardware Solution for Two
Simultaneous Linear Equations
somnath chakrabarti

T
his circuit can be used to solve input a sawtooth 7404 (IC2) is used
two simultaneous linear equations wave having a low frequen- to invert the square -
using operational amplifiers, view cy (around 250 Hz). wave output of IC1.
the graphs of resulting straight lines on a The outputs of the two Thus we get two non-
CRO, and find the solution point. amplifiers are multiplexed overlapping comple-
Let the equations of two straight lines with the help of quad bilateral mentary clocks that
be: analogue switches S1 and S2 are fed to control
x = y ... (1) built around CD4066 (IC5); S1 pins 13 and 5 of the
x/5 + y/5 = 1 ... (2) and S2 act as complementary respective analogue
The above equations are simulated us- switches, i.e. when one switch Fig. 2: CRO display for switches S1 and S2
ing operational amplifiers (µA741) as shown turns on as its control pin goes Example 1 having terminals 1
in Fig. 1. The first op-amp (IC3) is used as a high (logic 1), the other switch and 2, and 3 and 4,
non-inverting amplifier with unity gain and turns off as its control pin goes respectively.
simulates Equation (1). The second op-amp low (logic 0), and vice versa. Fig. 2 shows the ob-
(IC4) functions as an adder and simulates The output of the first op-amp served pattern on the
Equation (2). is coupled to pin 1 of IC5 and first quadrant of the CRO
The input to the first amplifier is a that of the second op-amp to screen. The solution point
unipolar sawtooth wave that runs from its pin 4. The pole of the two has coordinates (2.5, 2.5),
0 to 5 volts. The output of this amplifier complimentary switches is as claimed by Eqns (1) and
is fed to one of the inputs of the adder returned to channel 2 of the (2). To get an enlarged
whose other input is tied to –5 volts. CRO. view, the origin may be
(In place of the sawtooth wave, a half T i m e r N E 5 5 5 ( I C 1 ) Fig. 3: CRO display for shifted to (–2, –2) using
sine wave with 5V peak value will also functions as an astable Example 2
position controls of the
suffice.) multivibrator and generates a CRO, keeping vertical sensitivity of both
The CRO is used as the x-y plotter. To square wave having duty cycle the channels at 1 volt/division.
view y versus x, we require a dual-chan- close to 50 per cent and fre- Unlike a computer program where you
nel CRO. To channel 1 of the CRO we quency of 1 kHz. Hex inverter could change the input variables and expect
the solution to come out automatically,
you’ve to change the circuit parameters to
solve another set of simultaneous linear
equations.
For example, consider the following set
of equations:
x = y ... (3)
x +2y = 5 ... (4)
To solve the above equations, change
resistor R3 in Fig. 1 from 10 kilo-ohms
to 20 kilo-ohms and the voltage applied
to resistor R4 from regulated –5 volts to
regulated –2.5 volts. The solution point
for this set of equations is (1.66*,1.66*),
where * denotes recurring. The correspond-
ing display on the CRT screen is shown
in Fig. 3.
Fig. 1: Schematic circuit

ELECTRONICS PROJECTS Vol. 23 129


Readers’ comments to change the circuit parameters. Please (viz, R3, R4, R5, and Vref) to generate dif-
Q1. Please advise how we can solve other note: ferent equations, provided you obey the
simultaneous equations as well. Therefore 1. I have restricted the use of ana- following restrictions:
kindly provide us relationship between the logue switches (CD4066) only to transmit (a) You must not drive the op-amp into
value of resistor R3 and negative supply positive voltages. Note clearly that I men- saturation region.
voltage applied to IC4 so we can use these tioned use of unipolar sawtooth wave that (b) You must set circuit parameters
combinations to solve other differential varies from 0 to 5 volts (or half sinusoidal such that intersections of the two lines
equations. of peak value 5V). This means that x vari- (i.e. the solution point) lies in the first
Jagdish able is restricted in the domain [0,5] quadrant.
Through email 2. One equation, namely, y = x is kept (c) Most importantly, for all values of
The author, Prof. Somnath Chakra- fixed and the other is expressed in the form x in the range [0,5], y must remain ever
barti, replies: x/a + y/b = 1. IC4 (µA741) acts as an adder positive and less than 5. This is at once
A1. The basic theme of the circuit is to and generates the latter equation as evident, since the analogue signal you
simulate two linear equations using op- y = - [ x..R5 /R3 + Vref R5 / R4] want to transmit through the switches
amp and then to display them on a double- where Vref is the voltage(regulated) ap- (CD4066) must always be less than the
channel CRO by multiplexing. So, if you plied to R4. voltage at pin 14 (+5V) and greater than
want to change the equations, you have 3. Thus you can vary the parameters the voltage at pin 7 (0V).

Low-Power Broadcast
Transmitter
d. prabakaran

T
his 0.5-watt AM broadcast band comprising variable capacitor VC1 and creased from 12 volts to 24 volts. Transis-
transmitter can radiate AF modu inductor L1 is tuned to the crystal’s fre- tor T1 (BD139) needs to be provided with
lated signals up to 3 km radius. quency by adjusting VC1. a suitable heat sink to withstand higher
By using properly matched antennae like For simplicity, a single stage is used heat dissipation.
half-wave dipole, the coverage may be for power amplification and modulation. Audio signals are coupled to the car-
increased to even 10 kilometres. The crystal oscillator itself operates in rier oscillator via one of the two secondar-
The circuit uses a quartz crystal for class-C
a stable and highly accurate frequency. mode to
Quartz crystals typically have a quality obtain a
factor (Q) of about 100,000 and provide high ef-
roughly a thousand times greater fre- ficiency.
quency stability than the conventional LC To obtain
tank circuits. higher
The circuit is designed for 6MHz power, the
broadcast band operation and can be used operating
for other frequencies as well by simply voltage
changing the crystal. The tank circuit can be in-

Specifications of 0.5W AM transmitter


Frequency - 6000 kHz
Power output (approx.) - 250 watts at 12V DC
DC power input - At 12 volts, DC power
input=VI=12 volts x
50 mA= 600 mW
- At 24 volts, DC power
input=VI=24 volts x
70 mA=1680 mW
Modulation - AM (transformer coupled)
Oscillator - Crystal-controlled,
class-C operation
Audio input - From any audio source like
tape-recorders, audio CD
players, audio amplifiers, etc.

130 ELECTRONICS PROJECTS Vol. 23


ies of modulation transformer X1. (X1 is tion of AF and RF circuits for satisfactory Coil details are shown in the cir-
the driver transformer used in the push- impedance matching. Coil L2 and variable cuit diagram. Shortwave oscillator coil
pull audio output stage of transistor radio capacitor VC2 form the antenna loading L1 avoids complex coil winding. Both
receivers.) The high-impedance primary network to match a random-length wire variable capacitors VC1 and VC2 are
stage of X1 is connected to the collector antenna with the transmitter and enable half sections of easily available 2J Gang
of transistor T1. This enables DC isola- smooth RF energy transfer. condenser.

Laser Torch-based Voice


Transmitter and Receiver
pradeep g.

U
sing this circuit you can commu- light from a laser torch is used as the 500 metres. The phototransistor of the
nicate with your neighbours carrier in the circuit. The laser torch can receiver must be accurately oriented to-
wirelessly. Instead of RF signals, transmit light up to a distance of about wards the laser beam from the torch. If
there is any obstruction in the path of the
laser beam, no sound will be heard from
the receiver.
The transmitter circuit (Fig. 1) com-
prises condenser microphone transistor
amplifier BC548 (T1) followed by an
op-amp stage built around µA741
(IC1). The gain of the op-amp can be
controlled with the help of 1-mega-ohm
potmeter VR1. The AF output from IC1
is coupled to the base of transistor BD139
(T2), which, in turn, modulates the
laser beam.
The transmitter uses 9V power
supply. However, the 3-volt laser torch
(after removal of its battery) can be
directly connected to the circuit—with
the body of the torch connected to the
emitter of BD139 and the spring-loaded
lead protruding from inside the torch to
circuit ground.
The receiver circuit (Fig. 2) uses an
npn phototransistor as the light sensor
that is followed by a two-stage transis-
tor preamplifier and LM386-based au-
dio power amplifier. The receiver does
not need any complicated alignment.
Just keep the phototransistor oriented
towards the remote transmitter’s laser
point and adjust the volume control for
a clear sound.
To avoid 50Hz hum noise in the
speaker, keep the phototransistor away
from AC light sources such as bulbs. The
reflected sunlight, however, does not cause
any problem. But the sensor should not
directly face the sun.

ELECTRONICS PROJECTS Vol. 23 131


Readers’ comments Saumen A.D.S to IR modules.
Q1. Please clarify: (1) How can I Kolkata 2. This project cannot be used to listen
use infrared sensor module like The author, Pradeep G., replies: TV sound. It transmits high-intensity
TSOP1736/1738 in place of a phototran- A1. 1. This project is used to receive modu- laser beam that is harmful to human eye.
sistor? (2) If I want to connect a trans- lated visible light. Therefore, IR sensor For the mentioned application (by the
mitter of a circuit with a TV headphone module cannot be used here. Since they reader) low-power IR transmitter should
socket in place of condensor microphone respond only to a particular frequency, be used.
then what should I do? (3) How can I use while phototransistor can sense light 3. In place of LM386-based amplifier,
another power amplifier such as TDA810 modulated by any frequency. It costs any general-purpose audio amplifier can
in place of LM386? less and is freely available as compared be used.

Mobile Phone
Battery Charger
t.k. hareendran

M
obile phone chargers available instance, from a vehicle battery) can also ground rail of IC1 raises the output voltage
in the market are quite expen be used to energise the charger, where to 7.8V DC. LED1 also serves as a power
sive. The circuit presented resistor R4, after polarity protection diode indicator for the external DC supply.
here comes as a low-cost alternative to D5, limits the input current to a safe value. After constructing the circuit on a
charge mobile telephones/battery packs The 3-terminal positive voltage regulator veroboard, enclose it in a suitable cabi-
with a rating of 7.2 volts, such as Nokia LM7806 (IC1) provides a constant voltage net. A small heat sink is recommended
6110/6150. output of 7.8V DC since LED1 connected for IC1.
The 220-240V AC mains supply is between the common terminal (pin 2) and
downconverted to 9V AC by transformer
X1. The transformer output is rectified
by diodes D1 through D4 wired in bridge
configuration and the positive DC supply
is directly connected to the charger’s out-
put contact, while the negative terminal
is connected through current limiting
resistor R2.
LED2 works as a power indicator with
resistor R1 serving as the current limiter
and LED3 indicates the charging status.
During the charging period, about 3 volts
drop occurs across resistor R2, which
turns on LED3 through resistor R3.
An external DC supply source (for

Readers’ comments quest users to carefully read the technical


R1
Q1. Please provide different voltages for specifications of their cell phones/battery
different mobile phones. What changes packs and carry out the necessary output C1 150Ω TO 3.6V
DC 12V/ (1W)
are to be made in the circuit for my phone voltage (and current) modifications as 0.5 AMP 0.01µF
25V
Ni-Cd
BATTERY
INPUT
operating on a 3.6V battery? required.
A.N. Babu For 3.6V battery charging, major
Rajahmundry, Andhra Pradesh changes are required in the whole circuit.
Fig. 1: 3.6V battery charger
The author, T. K. Hareendran, replies: A circuit for the same is shown in Fig. 1 to
A1. This circuit was a basic one, so I re- help you out.

132 ELECTRONICS PROJECTS Vol. 23


Digital Die-Cum-Alpha Display
Tosser
a. jeyabal

I
n some indoor games we require a When the clock pulses are applied to
Decoded Segment Outputs of IC CD4033
die to decide the number of steps to IC2 via switch S1, it should count 1 through
Count a b c d e f g Co
go forward or a coin to take an arbi- 0 1 1 1 1 1 1 0 1 6 only. So we have to reset it on the seventh
trary decision between the two options 1 0 1 1 0 0 0 0 1 count. In the conventional circuit the seven-
available. Here we present a digital die- 2 1 1 0 1 1 0 1 1 segment outputs are decoded using gates.
cum-alpha display tosser circuit with the 3 1 1 1 1 0 0 1 1
4 0 1 1 0 0 1 1 1
Here we’ve used the pulse method in order
following salient features: to reduce the total cost of the unit. On ap-
5 1 0 1 1 0 1 1 0
• Choice of NAND, NOR, or Schmitt 6 1 0 1 1 1 1 1 0 plying a positive going pulse to reset pin 15
trigger NAND gate ICs for oscillator 7 1 1 1 0 0 0 0 0 of IC2 on the seventh count, the counter is
• Low component count 8 1 1 1 1 1 1 1 0 reset to zero.
• Use of passive components for re- 9 1 1 1 1 0 1 1 0
The table shows the decoded segment
setting outputs of IC2. On the seventh count,
• Alpha display for tosser relationship: the segment b output (pin 12) goes from
• Choice of 6V or 9V power supply F = 0.45/R1C1 low to high. All other segment outputs
• Low power consumption where F is in hertz, R1 in ohms, and C1 go high for other numbers. The segment
The circuit comprises three sections, in farads. b output is connected to the differentia-
namely, oscillator, counter, and display. For digital display of numbers 1 tor circuit comprising capacitor C2 and
NAND gates N1 and N2 and their through 6, we use decade counter/ resistor R4. So on the seventh count, a
associated components form the oscilla- decoder/7-segment LED driver CD4033 sharp high-going pulse is produced that
tor with its output at pin 4 of gate N2. (IC2) and common-cathode 7-segment resets counter IC2 to zero. Capacitor C2
The oscillator frequency is given by the display LT543. discharges quickly through resistor R3
connected across it, during the low
state of segment b.
Still there is a problem. The coun-
ter must be reset to ‘1’ and not ‘0’ for
our die. After resetting, the counter
has to advance by one count, which
can be done in two ways: (i) by apply-
ing a high-going clock pulse to clock
input pin 1, keeping counter-enable
pin 2 low, or (ii) by keeping clock
input pin 1 high and inputting the
low-going clock pulse to clock-enable
pin 2.
During resetting, the second
method is employed. When the clock
input goes high, the counter advanc-
es. If the number to be displayed is
‘7’, the differentiator circuit produces
a sharp high-going pulse and resets
the counter. As clock enable pin 2 is
also connected to the differentiator
circuit, during the low-going transi-
tion of the sharp pulse, the counter
advances once again and resets to ‘1’.
All this happens at a very fast rate.

ELECTRONICS PROJECTS Vol. 23 133


In order to play the game using this is required. Here we’ve used 4-pole, versa and thus avoids short circuit.
die tosser circuit, press switch S1. The two-way switch S2 that is easily avail- The clock pulses are applied to the
display shows ‘8’ as the numbers are able and costs lesser. For alpha tosser tosser circuit at pins 12 and 13. During
changing very fast. Now on releasing S1, display, this switch is to be flipped to the high state of the pulse, point ‘a’ is
any one of numbers ‘1’ through ‘6’ is shown position 2. high and points ‘b’ and ‘c’ are low and
on the display. This indicates the number To keep segments e, f, and g always lit, high, respectively. If the clock pulse
of steps to go forward. lamp test pin 14 of IC2 is held high by pole is taken out at this instant, gates N4
In alpha display tosser circuit, lower- C of switch S2. This pin overrides all func- and N3 will retain their output states.
case letters ‘h’ and ‘t’ are chosen for head tions and lights up all segments. However, Because the output of N3 is high, it
and tail display. In both the letters ‘h’ and diodes D1 and D2 ground segments a and maintains the input of N4 to the high
‘t’, segments a and b are always off and b through resistor R5 to put them off. As state and thereby the outputs are stable
segments e, f, and g are always on. So to a result, only segments e, f, and g glow in that states.
display ‘h’ and ‘t’ it is enough to light up continuously. During the low state of the clock pulse,
segments c and d, respectively. The circuit NAND gates N3 and N4 of IC1 are points ‘a’, ‘b’, and ‘c’ are at low, high, and
constraints are: used as a tosser (refer the figure). The low levels, respectively. So at any time,
• It must have two outputs that com- output of gate N4 (pin 11) is connected one output is high and the other is low.
plement each other. to the input of gate N3, while the output When point ‘b’ is high the display shows
• When clock pulses are applied, the of gate N3 (pin 10) is connected to the ‘h,’ and when point ‘c’ is high the display
output level should be changing. input of gate N4 through l00-kilo-ohm shows ‘t’.
• On the release of push switch S1, resistor R2. To toss, keep switch S2 in position 2
the output should be stable, i.e. one out- Resistor R2 retains the input of N4 and press switch S1. On releasing switch
put is logic 1 and the other logic 0, or vice at the same state as it existed before the S1, the display shows ‘h’ or ‘t’.
versa. removal of clock pulses. It also limits the You may use four AA3 type pen torch
To interface the tosser circuit with current flowing from the input of gate N4 cells for 6V operation or a 9V compact bat-
the display, a 7-pole, two-way switch to the output of gate N3 (pin 10) and vice tery for 9V operation.

Shortwave Transmitter
D. Prabakaran

T
his transmitter circuit operates in The circuit consists of a mic ampli- bias, while resistor R9 is used for sta-
shortwave HF band (6 MHz to 15 fier, a variable frequency oscillator, and bility. Feedback is provided by 150pF
MHz), and can be used for short- modulation amplifier stages. Transistor capacitor C11 to sustain oscillations.
range communication and for educational T1 (BF195) is used as a simple RF oscilla- The primary of shortwave oscillator coil
purposes. tor. Resistors R6 and R7 determine base and variable condenser VC1 (365pF,

134 ELECTRONICS PROJECTS Vol. 23


1/2J gang) form the frequency determin- (T2) for RF modulation. regulation of the supply voltage. A 9V
ing network. IC BEL1895 is a monolithic audio regulated power supply is required. RF
By varying the coil inductance or power amplifier designed for sensitive output to the aerial contains harmonics,
the capacitance of gang condenser, the AM radio applications. It can deliver 1W because transistor T2 doesn’t have tuned
frequency of oscillation can be changed. power to 4 ohms at 9V power supply, with coil in its collector circuit. However, for
The carrier RF signal from the oscilla- low distortion and noise characteristics. short-range communication, this does
tor is inductively coupled through the Since the amplifier’s voltage gain is of the not create any problem. The harmonic
secondary of transformer X1 to the next order of 600, the signal from condenser content of the output may be reduced
RF amplifier-cum-modulation stage built mic can be directly connected to its input by means of a high-Q L-C filter or
around transistor T2 that is operated in without any amplification. resonant L-C traps tuned to each of the
class ‘A’ mode. Audio signal from the audio The transmitter’s stability is gov- prominent harmonics. The power output
amplifier built around IC BEL1895 is cou- erned by the quality of the tuned circuit of this transmitter is about 100 mil-
pled to the emitter of transistor 2N2222 components as well as the degree of liwatts.

Fan Speed Control by clapping


Jaydip appasaheb dhole

T
he sound produced by clap is from transistor T1 is applied to trigger pin from the mic, it goes into conduction.
sensed by the condenser mic and 2 of timer IC NE555 that is configured as As a result, its collector drops to trigger
amplified by transistor T1. The a monostable multibrator (time constant monostable IC1. The pulse at output pin
sensitivity of the mic is adjusted by vary- T = 1.1 RC = 0.5 second). 3 of IC 555 is used as a clock for all the
ing 47-kilo-ohm preset VR1. The output When the transistor receives input 7474 dual ‘D’ flip-flops (IC2 through IC4)
configured as a ring
counter.
When the power
is initially switched
on, only the first flip-
flop is set and others
are reset (cleared).
On receipt of the first
clock pulse, logic ‘1’ Q
output of the first flip-
flop gets shifted to the
second flip-flop. Thus
for each clock pulse
(for each clap), logic 1
output keeps shifting
in a ring fashion.
Q outputs of all
the six flip-flops are
connected to the cor-
responding relay
units. For simplicity,
only one relay unit
is shown in the fig-
ure, where Q output
applied to the base
of Darlington pair of
transistors TA and
TB drives the relay
coil connected to the
collector of transistor
Fig. 1 TB. Initially, at power

ELECTRONICS PROJECTS Vol. 23 135


on, the first relay is con- Clap Relay No. Fan
nected between the com- No. (energised) speed
mon and off position of 0 1 Off
the fan. The table shows 1 2 1 (low speed)
the relay position and 2 3 2
fan speed. 3 4 3
Initially the fan is in 4 5 4
5 6 On (max. speed)
off state. With first clap,
the output is shifted to the 5th clap, the fan is at maximum speed.
the second flip-flop and For the 6th clap, the first flip-flop is set and
relay 2 is energised. As the fan is again at off position. The sequence
a result, fan moves at is repeated after every 6th clap. When the
a low speed. Fan speed mains fails and later resumes, the fan is in
increases for the next off state.
clap when the 3rd flip- (EFY Lab note. RL1 doesn’t serve
flop is set, i.e. 3rd relay is any purpose and hence it can be done
Fig. 2 energised. Similarly, for away with, as is clear from Fig. 2.)

Readers’ comments distance by placing a transistor amplifier Electronics Projects Vol. 22).
Q1. I have converted the circuit to a clap to increase the gain? If this regulator is converted into a
switch by using two 7474 ICs and feed- P. Brahmanandam clap switch, use only a single flip-flop
ing Q2 output to D1 input of the first IC. Brahimpal from IC2 (7474) and connect Q1 (pin 6) to
After 10 to 15 claps, this circuit doesn’t The author, Jaydip A. Dhole, replies: D input (pin 2) and take the output from
respond any further, why? The circuit A1. First of all, check all the connections. Q1 (pin 5) as shown in Fig. 1 here. This
works up to a metre only. How can I Then check the working of the monostable works as a toggle flip-flop and the device
increase the range and the sensitivity multivibrator (IC 555) by connecting an alternately turns ‘on’ and ‘off’. Connect
of the circuit? I varied the 47k preset, LED via a 330-ohm series resistor at pin 3 the power-on-reset signal to reset pin 1,
but the circuit didn’t respond when the of the IC 555. It should work satisfactorily so the device is in ‘off’ state at power-on. It
distance was increased. Also the clap- up to 2 metres. To increase the range, refer appears that you’ve connected Q2 output
ping needs to be done very strongly and the article ‘Ultra-Sensitive Solidstate Clap to D1 input, which becomes a 2-bit ring
very near to the mic. Can I increase the Switch’ published in May 2001 issue (or counter.

FM Booster
Pradeep G.

H
ere is a low-cost circuit of an FM
booster that can be used to listen
to programmes from distant FM
stations clearly. The circuit comprises
a common-emitter tuned RF preampli-
fier wired around VHF/UHF transistor
2SC2570. (Only C2570 is annotated on the
transistor body.)
Assemble the circuit on a good-quality
PCB (preferably, glass-epoxy). Adjust
input/output trimmers (VC1/VC2) for
maximum gain.
Input coil L1 consists of four turns of
20SWG enamelled copper wire (slightly
space wound) over 5mm diameter former.
It is tapped at the first turn from ground
lead side. Coil L2 is similar to L1, but has
only three turns. Pin configuration of tran-
sistor 2SC2570 is shown in the figure.

136 ELECTRONICS PROJECTS Vol. 23


Hex-To-Analogue Converter
Rajesh K.P. Nair

T
his hex-to-analogue converter finds (logic 1) or 0V (logic 0).
application in instrumentation. The binary outputs are
The inputs are taken from a hex connected to a standard
keypad as shown in Fig. 1. You can also R-2R digital-to-analogue
use pushbutton tactile switches instead converter ladder resis-
of keypad switches. The keypad is wired tor network comprising
such that it produces active-low binary resistors R1 through
code at the output terminal of four 8-in- R10. The output of
put 74LS30 NAND gates (IC1 through the ladder network is
IC4). an analogue voltage
The active-low outputs of IC1 through Fig. 1 proportional to the bi-
IC4 are inverted by hex inverter 7404 nary input, which, in
(IC5). The four non-inverted outputs from marked Q0(LSB) through Q3(MSB) rep- turn, is equal to the depressed hex
IC1 through IC4 and four inverted outputs resent the binary number corresponding digit key. Use 1% tolerance metal film
from IC5 are applied to the control pins of to the hex digit key depressed on the resistors (mfR) for ladder network and
two CD4066 quad bidirectional analogue keypad. regulated power supply for the circuit.
switches (IC6 and IC7). The outputs The binary output bits are either +5V This will enhance performance of the
circuit.
The analogue
equivalent volt-
age is applied to
LM301 high-per-
formance op-amp.
The gain is ad-
justed using preset
VR1 such that it
works in the linear
region. Preset VR2
is adjusted to get
0V output when
both input pins 2
and 3 are shorted
together.
(EFY Lab
note. Gain con-
trol preset VR1 was
adjusted to get an
output voltage
reading of 315 mV
with hex switch 1
(LSB) depressed.
The outputs meas-
ured for depression
of digits 3, 7, and F
on the keypad were
found to be 998
mV, 2.378 volts,
and 5.12 volts, re-
spectively, showing
a fairly linear out-
put proportional to
the depressed hex
key value.)

Fig. 2

ELECTRONICS PROJECTS Vol. 23 137


Three-Phase Star-Delta
Motor Starter
m.k. Chandra Mouleeswaran

T
he starting current drawn by a 3- sented here has all the desired features rents for energising the coils of relays RL1,
phase motor connected in star con and protections. RL2, and RL3 (in appropriate sequence).
figuration is one-third of the cur- Since interlocking AC contactors are We have used here 2-way changeover
rent drawn by the motor with windings in used in the circuit, single-phasing preven- switches for S4 (delta), push-to-off switch-
delta configuration. Once the speed of the tion is easily realised. These contactors es for S1 (stop), and push-to-on switches
motor builds up while running in star con- also have the under-voltage tripping fea- for S2 (start) and S3 (star).
figuration, adequate back emf is available ture, because an under-voltage will not be AC voltmeter M1 and a 230V bulb (for
to restrict the current to a safe value, even able to energise the contactors. visual indication) are provided for check-
when the configuration is changed from Separate push switches S1 through ing the voltage of individual phases using
star to delta. The same principle is used S4 are provided for stop, start, star, and 3-way rotary switch S5. For simplicity,
in star-delta starters. The simple 3-phase delta connections of the starter. These four over-voltage protection task is entrusted
star-delta pushbutton motor starter pre- switches are operated with very low cur- to wire-link fuses F1 through F3 (on

138 ELECTRONICS PROJECTS Vol. 23


porcelein carriers), as over-voltage will
Table I
cause over-current through the motor
Circuit Operation
and the fuses would burn to protect the
motor. Stop Start Star Delta RL1 RL2 RL3 Motor
(S1) (S2) (S3) (S4) Status
The connection of 3-phase motor coils
L1, L2, and L3 to the terminal block TB2 X Push X X Energised De-energised De-energised Off@
is also shown in the schematic diagram.
X X Push X Energised Energised De-energised On
Assume that initially the motor is in (Star)
off state and all the switches are in normal X X X Push Energised De-energised Energised On
position, as shown in the figure. Now on (Delta)
pressing start switch S2, R phase is ap- Push X X X De-energised De-energised De-energised Off
plied to one end of contactor RL1 through
Notes: 1. ‘X’ denotes no operation of switches. 2. @ = Motor coils ‘live’ one-end only
normally closed contacts of off switch
S1, while the other ends of all relays are
returned to neutral/ground terminal E of the motor in star configuration. On press- tion. When switch S4 is pressed, contactor
the mains supply. ing star switch S3, switched Y phase is RL2 de-energises, followed immediately
As a result, contactor RL1 energises applied to contactor RL2 via the closed by energisation of contactor RL3, which
and extends the 3-phase supply to ter- contacts of delta switch S4. Energisation connets the 3-phase motor coils (L1, L2
minals A1, B1, and C1 of terminal block of contactor RL2 results in shorting of the and L3) in delta configuration and the
TB2. However, the motor doesn’t run other ends of 3-phase motor coils L1, L2, motor starts running at full speed. Please
since the circuit for the motor coils is still and L3 through fuses F4 through F6, to note that Y phase has been extended via
incomplete. connect them in star configuration. The auxilliary switched contacts of contactors
Simultaneously, switched R phase motor thus starts running in Star con- RL1 and RL3 to hold contactor RL3 in en-
gets connected to contactor RL1 coil via off figuration. ergised state once switch S4 is released.
switch S1 to keep it energised. Therefore Once the motor has picked up speed, To switch off the motor at any stage,
releasing start switch S2 has no effect. you may press switch S4 to change over just press stop switch S4, which causes de-
Now you can press star switch to run the operation of motor in delta configura- energisation of all the contactors.

Multitester With
Audio-Visual Indication
D. Mohan Kumar

T
his simple and economical current flows through the LED and the of transistor T1 depends on the current
multitester works on 3V pen buzzer to activate them. The base biasing flowing through resistor R1, which, in
torch cells. It is useful for check-
ing the continuity between two points Component Visual indication Audio indication
and also the condition of electronic com-
ponents like resistors, capacitors, diodes, Good Bad Good Bad
photodiodes, and transistors, which are Resistor LED on LED off Buzzer sounds No sound
indicated visually as well as through Disc capacitor Single flash No flash Click sound No sound
audio. Electrolytic LED lights and Continuous light Audio tone Continuous tone
The circuit utilises two silicon tran- capacitor gradually goes gradually goes off
sistors BC547 and BC557 and a few pas- off when red when red probe is
sive components. Transistors T1 and T2 probe is connected connected to
to negative and negative and black
form a complementary pair. The black black to positive to positive
probe of the tester is connected to the
Diode/ LED on when LED on when Audio tone when Continuous audio
base of T1 through R1. The red probe is LED/ red probe is probes are red probe is tone when probes
connected to the emitter of T2 and the Photo diode connected to reversed connected to are reversed
positive supply. anode and anode and black
When the probes are shorted, transis- black to cathode. No audio when to cathode.
LED off when probe reversed
tors T1 and T2 conduct due to the forward
probes reversed
biasing of transistor T1. As a result the

ELECTRONICS PROJECTS Vol. 23 139


turn, depends on that works on 3V-12V DC and a bright
the condition of the LED are used for audio and visual indica-
component under tion, respectively. Small probes or mini
test. crocodile clips are used for checking.
Assemble the With this tester, resistors from 1 ohm
circuit on a common to 12 kilo-ohm and capacitors from 0.0001
PCB or vero board to 1000 µF can be tested. The table shows
and enclose it in a the testing procedure for various compo-
small plastic case. nents. LED for visual indication should
A small piezobuzzer be a bright transparent one.

Readers’ comments be enclosed in a matchbox-sized case of the circuit.


Q1. I have the following queries regarding if a miniature buzzer with oscillator is 2. The testing procedure for transis-
this circuit: used. tors is similar to their testing using a
1. Is there any way to check resistors 1.The circuit is based on forward bi- multimeter. Connect red probe to the
above 12k with some modifications? asing of transistor T1 due to the current base of the transistor and touch the col-
2. What is the testing procedure for flowing through the component under test. lector and the emitter (one at a time)
transistors? If a resistor above 12k is tested, the cur- with black probe. The buzzer sounds
Arun Kumar M. rent through R1 will decrease and it will if the transistor is good. Reverse the
Thiruvananthapuram not be sufficient for biasing T1. You can probes, and if the transistor is good, the
The author, D. Mohan Kumar, replies: modify the circuit by increasing the sup- buzzer remains silent. If the transistor is
A1. The circuit operates on two 1.5V ply voltage to 6 volts for testing resistors shorted or open, the buzzer will sound in
button cells, so the whole circuit can above 12k, but it will change the nature both the testing conditions.

IR Remote Switch
K.S. Sankar

I
magine the convenience of selecting remotely switch on/off any electrical device IR IC receiver (Siemens SFH-506-38 or
TV channels using your remote and through a relay using the normal TV/VCR/ equivalent) that can detect 38kHz burst
then pointing the same remote to VCP/VCD remote control unit. It works up frequency generated by a TV remote.
your switchboard to switch on/off the fan to a distance of about 10 metres. The output pin of IR sensor goes low
or the tubelight. Here is a simple circuit to The circuit is built around a 3-pin when it detects IR light, triggering the
monostable (1-sec-
ond) built around
timer NE555. The
output of the mono
toggles the J-K flip
flop, whose Q out-
put drives the relay
through SL100 npn
transistor (T1).
LED2, LED3,
and LED4 are used
to display the sta-
tus of each output
stage during circuit
operation. Back-
EMF diode D1 is
used for protection.
Transistor T1 is
configured as an
open-collector out-
put device to drive

140 ELECTRONICS PROJECTS Vol. 23


the relay rated at 9V-12V DC. and false triggering. Capacitor C3 and flip-flop from getting retriggered within one
The circuit draws the power from volt- resistor R3 also avoid false triggering of second. To activate any other 12V logic
age regulator 7805. Capacitor C5 is soldered monostable NE555. The monostable acts device, use the output across the relay
close to the IR sensor’s pins to avoid noise as a 1-second hysterisis unit to restrict the coil terminals.

Readers’ comments
tion, it is found that the
Q1. When power is switched on the timer
3-pin IR receiver normally
automatically gets triggered and the relay
generates a negative pulse
energises. This occurs when the power is
only for a fraction of a
switched on again after it is switched off.
second.
How can I overcome this problem?
The point between re-
Gorrepatti Raja Sekhar
sistors R1 and R4 reaches
Through e-mail
about 2.4V on a 5V supply,
Q2. When we press the electric board
which enables the transis-
switches to turn on/off the fan, tubelight,
tor and the timer. Resistor
etc in the same room in which this circuit
R1 reduces the current
is connected, false switching occurs in the
and charging rate of the
circuit. Please suggest me some solution.
capacitor wired in parallel
Samir Kulkarni
across resistor R4 (100k).
Through e-mail 555 slow-start circuit in astable or monostable mode This takes approx. two
In answer to both questions, the au-
seconds for the values given. On removal
thor, K.S. Sankar, replies: avoid false triggering in monostable mode
of the power supply, the capacitor finds
Most 555 timer circuits configured in mon- when the IR receiver is used at its input.
the shortest path to discharge through the
ostable mode for long time periods suffer Pin 4 (reset) of IC 555 is held low by
diode (1N4148) and resistor R2 (10k) and
from false triggering during power-on. a 10k resistor instead of connecting it to
get ready for another slow power-on mode.
This is not a problem with 555 but it is Vcc. The IC can be enabled only if pin 4
This concept is called a slow charge-and-
caused by the sensor used in the circuit, is held high. This is achieved by using
quick discharge network. This makes the
which in most cases generates a short a small timing circuit and npn transis-
circuit more sturdy against heavy power
negative pulse that is sufficient to trigger tor 2N2222. If the base voltage of the
fluctuations.
the monostable. If the output of 555 is transistor is more than 0.6V, it conducts
The capacitor value can be changed to
used to control a relay for switching on to provide Vcc to pin 4 to enable IC 555.
provide the amount of delay required in
high-voltage electrical devices, this may Now 555 is ready to accept a low pulse at
the circuit. Resistor R2 for discharge may
prove to be an expensive affair. its trigger pin 2.
be unnecessary in most circuits, since any
Normally, the output of any 3-pin IR The time delay designed here is about
load in the supply line can act as a quick
receiver goes low momentarily on power- two seconds. This is more than sufficient
discharge route. Even a power-on LED in
on. The figure shown here can be used to to avoid any false triggering. On observa-
the circuit is sufficient.

Ding-Dong Bell
Praveen Shanker

T
his simple and cost-effective door a speaker directly, as
bell circuit is based on IC 8021-2 this puts strain on the
from Formox Semiconductors device. Therefore a
(Website address: fortech@mantramail. complementary-pair,
com). It is an 8-pin DIP IC whose only two-transistor ampli-
four pins, as shown in the circuit, have fier is used to am-
been used. plify the sound to a fair
The IC has an in-built circuitry to level of audiblity. You
produce ding-dong sound each time its may either use a piezo
pin 3 is pulled low. The sound is stored tweeter or an 8-ohm,
in the IC as bits, as in a ROM. The sound 500mW speaker at the
output from the IC can’t however drive output.
During the standby

ELECTRONICS PROJECTS Vol. 23 141


period, the IC consumes nominal current switch S2 is pressed, ding dong sound is sound is still being produed, it has no ef-
of a few microamperes only. Therefore produced twice. If you try to press switch fect whatever and the two ding-dong bell
switch S1 may be kept closed. Each time S2 a second time when the first ding dong sounds will be invariably produced.

5.5MHz/10.7MHz IF-FM
Signal Generator
D. Prabakaran

T
his 5.5MHz/10.7MHz IF-FM sig diodes are specially manufactured to been used as L1 here) in conjunction with
nal generator is useful for align exploit this effect, but even the ordinary ½ 2J gang capacitor.
ment of FM radio receivers and TV 1N4001 silicon diode can be used for the The oscillator’s centre frequency can
sound IF circuit. It consists of the follow- same purpose. be changed by simply varying the capaci-
ing: Capacitor C2 and varicap diode D1 tance of diode D1 using potmeter VR1, as
1. A 5.5/10.7MHz RF oscillator based are wired in series, with C2 providing the stated earlier. Similarly, the oscillator
on readily available ceramic filter necessary DC isolation between transis- frequency can be modulated around its
2. AF signal generator comprising tor T1 and diode D1. This combination is centre value by feeding an external AF
NE555 timer IC effectively wired across transistor T1’s signal from NE555 (used as AF signal
The RF oscillator built around tran- tuned circuit. The tuned circuit is formed generator) to the R4-VR1 junction via
sistor T1 (BEL187) can be tuned using using the readily-available shortwave capacitor C4, as shown in the figure, to
potentiometer VR1 in conjunction with oscillator coil (whose primary winding has provide FM signal.
reverse-biased sili-
con diode D1 that
serves as an in-
expensive varicap
diode or voltage-
variable capacitor.
It is a simple fact
that when a silicon
diode is reverse bi-
ased it exhibits a
capacitance that
varies inversely as
the applied voltage,
i.e. the capacitance
is higher when the
voltage is low, and
vice-versa. Varicap

Doctor’s Switch
Praveen Kumar

T
his circuit is meant for use in taneously with the calling bell sound. bulb glows along with the sound of the
conjuction with the calling bells to When the calling bell switch is pressed calling bell. During the day time, only the
switch on an assciated bulb simul- during the night time, the associated calling bell is activated, i.e. the bulb does

142 ELECTRONICS PROJECTS Vol. 23


ance. So when bell switch S1 is
pressed, transistor T1 is cut off
and the filtered positive volt-
age charges up capacitor C2 via
resistors R1 and R3 and di-
ode D3 to provide a constant
forward bias to trigger the
triac and light up bulb L1.
Zener ZD1 limits the voltage
across capacitor C2 at a
suitable value. Thus both
the bulb and the calling
bell are activated at the same
Fig. 1
time.
not glow. Fig. 2 shows an alternative circuit that
In the circuit shown in Fig. can be connected across points A and B
1, when switch S1 of the call- of Fig. 1 to energise the bulb L2 via relay
ing bell is pressed, transformer RL1 (driven by relay driver switching
X1 also gets the supply. The transistor T2). During day time, LDR2
recitified, filtered output is fed resistance is low and thus most of the base
to the collector of transistor T1 current finds an alternative easy path via
via resistor R1. In day time, LDR2 and transistor T2 remains cut off.
LDR has a low resistance, so While during darkness, LDR2 behaves
the transistor turns on and almost as an open circuit, and the cur-
its collecter is pulled towards rent via preset VR1 and resistors R4 and
ground rail. As the triac re- R5 flows into the transistor’s base. As a
mains inactive, only the sound result, the transistor conducts to energise
of the calling bell is heard. the relay and the bulb connected across
In darkness (night time), its N/O contacts. The adjustment of preset
Fig. 2 LDR has a very high resist- VR1 is critical.

Remote Control Using AC Mains


Arthur louis

H
ere is a remote control circuit R1+R2 that filters out 50kHz signals, as it offers
that uses the AC mains line as a D= ×100 a low impedance at resonance frequency
R1+2R2
medium between the transmitter of 50 kHz and blocks 50Hz line frequency
and the receiver. It overcomes the draw- The timer output drives transistor T1 signals by offering a very high imped-
backs of line of sight, obstacles, and short through resistor R3. Coupling capacitor ance at off resonance frequency of 50 Hz.
range, which are usually inherent in IR C4 is charged and discharged continu- The resonant frequency of L1-C10 series
and radio remote control systems. ously at the rate of 50 kHz through resis- combination is:
The transmitter (Fig. 1) built around tor R4 and transistor T1. This generates 1
555 timer IC is powered by step-down a 50kHz wave that is superimposed upon fr=
transformer X1. Timer 555 is wired the AC mains through coupling capacitor 2π √l1c10
as an astable multivibrator that gener- C4. The 50kHz pulse train travels along where L1 is the inductor value in
ates 50kHz signals. The output frequency the mains line to reach the remote-end henry and C10 is the capacitor value in
(fo) is given by the following relation- receiver. farad.
ship: The receiver (Fig. 2) comprises a The next stage built around IC 741
1.45 detector circuit that detects the presence acts as an active narrow-bandpass filter
fo=
(R1+2R2) C2 of 50kHz signals on the AC mains line. that amplifies 50kHz signals and attenu-
Capacitor C10, along with inductor L1, ates
The % duty cycle (D) is: forms the passive series resonant circuit all other frequencies. The bandpass

ELECTRONICS PROJECTS Vol. 23 143


sensitivity and the noise immunity.
For testing and adjustment, switch on
the transmitter and the receiver circuits
by plugging them into the mains. Set
preset VR2 to touch the upper end to get
maximum sensitivity. Now vary preset
VR1 slowly to energise the relay. VR1 is
set to cover the short-term variation of
transmitter and receiver frequencies. If
the receiver LED connected across the
relay glows without the transmitter being
on, adjust VR1 such that it doesn’t glow
without switching on of the transmitter.
This remote control system has a good
range because it uses the rigid mains con-
ductors that have a very low signal loss
due to their large diameter. The range
of remote lays within the secondary of
Fig. 1: Transmitter distribution transformer (HV to LV step-
down transformer in the sub-station).
The remote system can
be used between two
rooms in the same build-
ing or anywhere within
a multistory building to
control mains-operated
equipment via the relay.
The relay contacts cur-
rent rating should match
the current rating of the
load being controlled.
Be careful of the
mains voltage while
testing and install-
ing the circuit. Con-
nect neutral to the
circuit ground to
avoid accidental con-
tact with the live
wire. Use of plastic
Fig. 2: Receiver cabinet for housing
the circuit is recommeded.
gain of this stage is 16. To find out the bandwidth, to match the transmitter You may use more than one
values of passive components R6 through frequency. The value of resistor R10 is transmitter-receiver pair in the same
R10, C6, and C7, use the following rela- chosen such that it makes the voltage location by changing the operating
tionships: at the non-inverting terminal equal to frequency of the transmitter and the
half of the supply voltage. (R8 = 100 kilo- receiver. In order to change the op-
ohms and R10 = (100x82)/(100+82) = 47 erating frequency of the transmitter
kilo-ohms) and the receiver as desired, change
The op-amp is used here with single the timing component values using
supply rail. Capacitor C8 filters the signal the relationships mentioned above.
output of op-amp and diode D6 rectifies Even if the operating frequency of the
where quality factor Q = 6 (the it. The rectified pulsating voltage is fed to transmitter-receiver pair is changed, It
higher the value of Q, the narrower the transistor T2, which charges capacitor C9 should be ensured that the duty cycle
bandwidth allowed by the filter), centre through resistor R12. of 555 in the transmitter is kept near
frequency fc = 50 kHz, and total bandpass Thus transistor T3 is driven with a 50 per cent.
gain AF = 16. constant DC voltage at its base that is (EFY lab note. The circuit works
For design simplification, choose adjusted by preset VR2 to operate relay satisfactorily only if both the transmitter
C6 = C7. The value of R7 includes VR1. RL1. Preset VR2 also acts as a bleeder to and the receiver circuits are plugged into
(VR1 is used to slightly vary the 50kHz discharge capacitor C9. VR1 is adjusted for the same phase, not into different phases
centre frequency without changing the a proper compromise between the receiver of a three-phase system.)

144 ELECTRONICS PROJECTS Vol. 23


High-Power
Telephone Extra Ringer
T.K. Hareendran

T
his easy-to-construct high-power tor T1. The result is a high-power audio the telephone input terminal is used
telephone extra ringer is useful for and visual ring indication, good enough to for circuit protection only. Neon lamp
industrial areas where it is difficult draw the attention of the telephone user. L1 and resistor R1 are used to provide
to hear telephone ring signals due to noisy The whole circuit can be wired on a visual indication for the telephone bell,
background. general-purpose PCB. A plastic enclosure which may prove useful in the case of
The 110-240V input AC mains volt- is recommended, as most components are power failure. Capacitor-resistor com-
age applied to the circuit is converted to directly connected to the high-voltage bination C5-R7 across MT2 and MT1
a low DC voltage (9 volts) and current mains supply. terminals of the triac form the usual
(about 40 mA) by resistors R5 and R6, and The metal-oxide varistor (MOV) in snubber network.
capacitor C4. Diodes
D2 through D5 act as
bridge rectifiers and C3
is the filter capacitor.
The use of zener diode
ZD1 is crucial for volt-
age regulation.
Whenever an in-
coming ring signal is
detected by capacitor
C1, resistor R2, and
optocoupler IC1, the
optocoupler’s transistor
starts conducting in
synchronism with the
ring signal and controls
the switching of triac
with the help of transis-

Music-On-Hold For Telephones


Sibin K. Zachariah

H
ere is a simple circuit for you return, you can simply pick up the the receiver (handset), it drops to about
music-on-hold with automatic handset again and continue with the 9 volts. The minimum voltage required
shut off facility. During telephone conversation. to activate this circuit is about 15 volts.
conversation if you are reminded of some The glowing of LED1, while the music If the voltage is less than 15 volts, the
urgent work, momentarily push switch S1 is generated, indicates that the telephone circuit automatically switches off. How-
until red LED1 glows, keep the telephone is in hold position. As soon as the handset ever, initially both transistors T1 and T2
handset on the cradle, and attend to the is picked up, LED1 is turned off and the are cut off.
work on hand. A soft music is generated music stops. The transistor pair of T1 and T2
and passed into the telephone lines while Normally, the voltage across telephone performs switching and latching action
the other-end subscriber holds. When lines is about 50 volts. When we pick up when switch S1 is momentarily pressed,

ELECTRONICS PROJECTS Vol. 23 145


enough voltage to forward bias transistor
T1 and it starts conducting.
As a consequence, output voltage at
the collector of transistor T1 sustains
forward biasing of transistor T2, even
if switch S1 is released. This latching
action keeps both transistors T1 and
T2 in conduction as long as the output
of the bridge rectifier is greater than 15
volts.
If the handset is now lifted off-
hook, the rectifier output drops to about
9 volts and hence latching action ceases
and the circuit automatically switches
provided the line voltage is more than 15 rectifier. off.
volts, i.e. when the handset is placed on With the handset off-hook after a (EFY lab note. The value of resistor
the cradle. ring, momentary depression of switch S1 R2 determines the current through resistor
Once the transistor pair of TI and causes forward biasing of transistor T2. R1 to develop adequate voltage (greater
T2 starts conducting, melody generator Meanwhile, if the handset is placed on than 0.65 volts) for conduction of transistor
IC1 gets the supply and is activated. The the cradle, the current passing through T1. Hence it may be test selected between
music is coupled to the telephone lines via R1 (connected across the emitter and base 33 kilo-ohms and 100 kilo-ohms to obtain
capacitor C2, resistor R1, and the bridge terminals of pnp transistor T1) develops instant latching.)

Solidstate Switch for


DC-Operated Gadgets
Praveen Shanker

T
his solidstate DC switch can be Hence a latch
assembled using just three is formed and
transistors and some passive com- transistor T2
ponents. It can be used to switch on one (as also transis-
gadget while switching off the second tor T1) contin-
gadget with momentary operation of ues to conduct,
switch. To reverse the operation, you just which activates
have to momentarily depress another gadget 1 and
switch. LED1 glows.
The circuit operates over 6V-15V DC Conduc-
supply voltage. It uses positive feedback tion of transis-
from transistor T2 to transistor T1 to keep tor T2 causes
this transistor pair in latched state (on/ its collector to
off), while the state of the third transistor be pulled to-
stage is the complement of transistor T2’s wards positive
conduction state. rail. Since the
Initially when switch S3 is closed, collector of T2
both transistors T1 and T2 are off, as of LED2. is connected to the base of pnp transis-
no forward bias is available to these, When switch S1 is momentarily tor T3, it causes transistor T3 to cut
while the base of transistor T3 is depressed, T1 gets the base drive and off, switching off the supply to gadget
effectively grounded via resistors R8 it grounds the base of transistor T2 via 2) as well as extinguishing LED2. This
and R6 (shunted by the load of the resistor R4.Hence transistor T2 (pnp) also status is maintained until switch S2
first gadget). As a result, transistor T3 conducts. The positive voltage available at is momentarily pressed. Depression of
is forward biased and gadget 2 gets the collector of transistor T2 is fed back to switch S2 effectively grounds the base
the supply. This is indicated by glowing the base of transistor T1 via resistor R3. of transistor T1, which cuts off and thus

146 ELECTRONICS PROJECTS Vol. 23


virtually opens the base-emitter circuit of explained earlier. of gadget 1 must be less than 220 ohms)
transistor T2 and thus cutting it off. This EFY lab note. During testing, it was to sustain the latched ‘on’ state. But this
is the same condition as was obtained noticed that for proper operation of the stipulation is not applicable for gadget 2.
initially. This condition can be reversed circuit, gadget 1 must draw a current A maximum current of 275 mA could be
by momentarily pressing switch S1 as of more than 100 mA (i.e. the resistance drawn by any gadget.

Infrared Car Parking Guard


T.K. Hareendran

T
his car parking guard circuit is buzzer PZ1 beeps at a rate determined by
basically an infrared active the values of timing components R6, R7,
proximity detector. It is built using and C7. Simultaneously, DC lamp driver
easily available components and is ener- transistor T3 controlled by the output
gised by the DC supply going to the car'fs of IC2 causes lamp L1 to blink, which
reversing lamp. serves as a warning signal. This condition
The DC supply going to the car’s is maintained until IC1 receives a valid
reversing lamp is converted to 5 volts 20kHz signal at its pin 3.
using regulator LM7805 and supplied to Whenever the IR beam radiated by
the complete circuit, except transistor T3 IRLED1 and IRLED2 is reflected by a
(and lamp L1), for which 12 volts potential nearby object (at the back side of the
developed across capacitor C2 is used. Di- vehicle), IC1 receives 20kHz reflected
ode D3 protects the circuit against wrong signal at its pin 3 on detection by pho-
supply polarity. totransistor T2 (in Darlington configura-
During car reversal, the high-efficien- tion). As a result, IC2 pulls its output
cy IRLEDs (IRLED1 and IRLED2), driven pin 8 low as it gets locked to the detected
by pnp transistor T1 with a modulating 20kHz tone.
frequency of about 20 kHz (available Consequently, reset pin 4 of timer IC2
from pin 5 of IC1 LM567, the versatile is also pulled low and thus the astable is
PLL tone decoder IC), emit infrared light. disabled. Pin 3 of IC2 goes low and the
(1-ohm resistor R1 limits the IRLED buzzer starts sounding continuously (LED
current.) At this juncture, the output remains lit) to alert the driver to stop the able and attractive cabinet. Fig.
at pin 8 of IC1 is at high level and the vehicle at once. 2 shows a proposed enclosure. Fit
astable built around timer LM555 (IC2) After wiring and testing, en - the LED and buzzer in dashboard
is enabled. As a result, LED1 blinks and close the circuit board in a suit- panel. For interconnection, use
flexible wires with sufficient
strands.
Now attach the gadget to the
back bumper of the vehicle, prefer-
ably at its centre-point, as shown
in Fig. 3, and make supply con-
nections in parallel to the reverse
lamp, ensuring correct polarity.
After careful checking, test run
and check the result.
The normal infrared detection
range is about 100 cm, which can
be further increased by adding
suitable lenses/reflectors.
Note. In place of part numbers
of IRLED1, IRLED2, and photo
Darlington transistor T2 used here,
you may use locally available types
with high efficiency/sensitivity.

ELECTRONICS PROJECTS Vol. 23 147


FM Band Receiver
D. Prabakaran

T
his circuit is a modified form of of directly driving 1.5-watt power at 9 be used.
FM receiver circuit published in volts into a 4-ohm speaker. This power is The amplified IF signal from the IF
March ’93 issue of EFY or Electron- enough for portable operation. A separate amplifier limiter inside CA1190 is con-
ics Projects Vol. 14. The modified part built-in regulated power supply provides nected to the active-low pass filter. The
pertains to the use of IC CA1190 and 9V different voltages to various function- filter shapes the response (amplitude vs
regulator 7809. CA1190 has been used to al blocks within the IC. CA1190 is frequency) to peak around 5.5 MHz and
replace TBA120S and LM741. CA1190 available in 16-pin bentdown wing tab removes unwanted high-frequency content
also comprises an audio power amplifier heat-sink. package in the signal. It is followed by a
stage (which was not a part of the earlier Variable capacitor VC1 is not differential peak FM detector that consists
circuit). easily available in the market, but of a highinput impedance differential am-
The front end of the circuit is built one can make it using a 2xPVC gang plifier with detector coil L3 and 5.5MHz
around AN7213 (IC1), followed by the IF condenser by removing some of its ceramic filter connected between the two
amplifier stage built around transistor plates. (Only one plate is needed for inputs of the differential amplifier. The
BC109 (T1). The 5.5MHz IF output from each of sections (a) and (b) of the detected audio signal is applied to the
IC1, as amplified by transistor BC109, is 2X gang condenser.) Also remove the AF power amplifier through DC volume
applied to the FM detection stage built trimmer from the top of the gang. Coil control.
around BEL IC CA1190, which is nor- L2 is a centre tapped coil having sec- Instead of FM IF transformer, we’ve
mally used in TV receivers as TV sound tions ‘a’ and ‘b’ (see diagram). You can used ceramic filters, as these are compact,
IF system. adjust lengths of L1 and L2, if required, have high selectivity, and don’t require
The CA1190 includes a multistage to obtain a slight variation in frequency. alignment, unlike the conventional LC
IF amplifier, limiter, FM detector, and For IF stage alignment, 5.5MHz FM tuned circuits.
an audio power amplifier that is capable signal from the signal generator may

148 ELECTRONICS PROJECTS Vol. 23


8085 Kit-Based Relay Control
S. Rajkumar

T
his 8085 kit-based interface cir-
cuit controls 64 relays. It is as-
sumed that the 8085 kit has an
8255 programmable peripheral interface
IC, whose ports have been extended via
suitable connectors in this circuit. The
8255 has been configured for mode 'e0'f
operation. Ports A, B, and C of 8255 are
configured as output ports using control
word 80hex. The various outputs of 8255
after buffering by 74LS244 are used as
follows:
PA0: Connected to pin 13 of IC 74259
for relay switching (logic 1 for 'eon'f and
logic 0 for 'eoff'f)
PB0, PB1, PB2: As address for IC
74259 to select up to eight different relay
numbers
PC0, PC1, PC2: As address for
74LS138 to select up to eight different
IC 74259.
The interface circuit comprises 1-of-8
demultiplexer IC 74138, octal buffer/driver
IC 74244, and IC 74259 (configured here
as 8-bit addressable latch). The supply
for these ICs is taken from the 8085 kit plexer IC 74138. The output at pin 15 is play shows ‘num’. Enter the relay number
itself. For relays, an external 12V supply used as a chip select line for IC 74259. (decimal numbers from 00 to 64 can be
is used. Similarly, it is possible to connect the re- used if all ICs and relays are in place) and
Octal buffer/driver IC 74244 has open- maining seven outputs as chip select lines press ‘next’. The corresponding relay will
collector outputs. It is used as a buffer for other seven 74259 ICs. So a total of 64 be activated, with the relay number also
for outputs from 8255. The relay on/off relays can be controlled. displayed in the kit.
information available PA0 pin of port A is The relays are controlled via relay For addressing peripheral devices
used as data input at pin 13 of IC 74259. driver transistors 2N2222. If the input (8255 and 8279), the I/O mapped address
The three bits PB0 through PB2 are used voltage to the base is low (logic 0), the scheme is employed in the kit. So the us-
as a 3-bit address for IC 74S259. transistor remains turned off, while logic ers need to modify the addresses for the
IC 74259 is used here in 8-bit ad- 1 output activates the relay. A diode in peripherals in accordance with the specific
dressable latch mode. In this mode. The par-allel with the relay coil protects the kit used by them.
data at its pin 13 corresponds to the data transistor from the high voltage induced (EFY lab note. The program may
for the selected output (1=‘on,’ 0=‘off’). in the relay coil during its turn-off pe- have to be slightly modified, since key-
The remaining outputs are not affected riod. board/display routine may require use
and stay in their previous state, so the When the 8085 program for relay se- of specific registers in different kits.
other relays controlled by these pins are lection is executed in the kit, the display Also, depending on the type of display
not affected. shows ‘code’. Enter the code (‘1’ for switch- (common-cathode/common-anode) used,
The 3-bit data at PC0 and PC2 are ing on the relay and ‘0’ for switching off the coding of characters to be displayed
used as a 3-bit address for 1-of-8 multi- the relay) and press ‘next’. Now the dis- would differ.)

RELAY CONTROL PROGRAM ENVIRONMENT


(The locations may vary from kit to kit. Locations used at EFY are shown within parentheses.)

RAM locations used for the program : 6000-60A0 (9000-90A0) Port-C (output) of 8255 : 02 (0A)
Stack pointed initialised at : 80FF (90FF) Control word of 8255 : 03 (0B)
Port-A (output) of 8255 : 00 (08) Control word of 8279 : 61 (01)
Port-B (output) of 8255 : 01 (09) Data address of 8279 : 60 00

ELECTRONICS PROJECTS Vol. 23 149


program listing
Addr. Opcode Label Mnemonics Comments Addr. Opcode Label Mnemonics Comments

6000 21B060 LXI H, 60B0H MESSAGE1: (MESSAGE 'gCODE'h DISPLAY USING 8279)
6003 31FF80 LXI SP, 80FFH 6050 3E04* MESSAGE1: MVIA 04 ;Set mode of 8279
6006 3E80 MVI A,80 ;8255 control word for ports 6052 D361* OUT CWR(8279)
;A, B & C as output 6054 3E3C* MVI A,39 ;7-seg. code for “C”
6008 D303* OUT CWR(8255) 6056 D360* OUT DAT(8279)
600A CD5060* LP2: CALL MESSAGE1 ;Call subroutine for message 6058 3E5C* MVI A,5C ;7-seg. code for “O”
;display 'gCODE'h 605A D360* OUT DAT(8279)
600D CD640A* CALL RDKBD ;Subroutine in the kit to accept the 605C 3E3F* MVI A,5E ;7-seg. code for 'gD'h
;hex digit from keyboard and store 605E D360* OUT DAT(8279)
;it in the acc. 6060 3E2E* MVI A,79 ;7-seg. code for 'gE'h
6010 E606 ANI 0F 6062 D360* OUT DAT(8279)
6012 FE01 CPI 01 ;Check for relay 'eON'f 6064 C9 RET
6014 CA2560 JZ LP1
6017 FE00 CPI 00 ;Check for relay 'eOFF'f MESSAGE2: (MESSAGE 'gNUM'h DISPLAY USING 8279)
6019 CA2560 JZ LP1 606E 3E04* MESSAGE2: MVIA 04 ;Set mode of 8279
6022 C30A60 JMP LP2 6070 D361* OUT CWR(8279)
6025 D300* LP1: OUT PORTA(8255) ;Send data to 6072 3E41* MVI A,54 ;7-seg. code for 'gN'h
;pin 13 of IC74259 6074 D360* OUT DAT(8279)
6027 CD6E60 CALL MESSAGE2 ;Call subroutine for message 6076 3E5C* MVI A,3E ;7-seg. code for 'gU'h
;'hNUM'h 6078 D360* OUT DAT(8279)
602A CD640A CALL RDKBD 607A 3E5c* MVI A,55 ;7-seg. code for 'gM'h
602D 0E04 MVI C,04 607C D360* OUT DAT(8279)
602F 07 LP3: RLC ;Shifted to second(tens) place 607E C9 RET
6030 0D DCR C
6031 C22F60 JNZ LP3 BCDBIN: (CONVERSION OF A BCD NUMBER TO BINARY NUMBER)
6034 57 MOV D,A 6080 78 MOV A,B ;Move the BCD value to acc.
6035 CD640A* CALL RDKBD 6081 E60F ANI 0F ;Mash the higher order bits
6038 82 ADD D ;Combine the two keyboard entries 6083 4F MOV C,A ;Move the low order bits to reg.C
6039 47 MOV B,A ;Move the relay number to reg. B 6084 78 MOV A,B ;Move the BCD value to acc.
603A CD160B* CALL DISPLAY ;Subroutine in the kit to display 6085 E6F0 ANI F0 ;Mask the low rder bits
;acc. Contents 6087 0F RRC ;Rotate acc. Content right by one position
603D CD8060 CALL BCDBIN ;Call BCD to binary 6088 0F RRC ;Rotate acc. Content right by one position
;conversion subroutine 6089 0F RRC ;Rotate acc. Content right by one position
6040 05 DCR B 608A 0F RRC ;Rotate acc. Content right by one position
6041 78 MOV A,B 608B 87 ADD A ;Multiply the acc. Content by 2,(A+A)
6042 D301* OUT ;Send 3-bit address of 74259 608C 47 MOV B,A ;Move acc. Content by 2(2A)
PORTB(8255) ; via reg.B 608D 87 ADD A ;Multiply the acc. Content by 2(2A+2A)
6044 0F RRC ;Rotate acc. Right by one position 608E 87 ADD A ;Multiply the acc. Content by 2(4A+4A)
6045 0F RRC ;Rotate acc. Right by one position 608F 80 ADD B ;Add the reg.B content (8A+2A)
6046 0F RRC ;Rotate acc. Right by one position 6090 81 MOV C ;Add the low-order bits stored in reg.C
6047 D302* OUT 6091 47 MOV B,A ;Move the binary result in reg.B
PORTC(8255) ;Send 3-bit address of 74138 6092 C9 RET ;Return to main program
6049 76 HLT ;Halt
Note: * Indicates that opcode is dependent on I/O address used in the specific kit.
CWR indicates control word register

Verified CONCEPT at EFY using the following modified program on Dynalog kit
Addr. Opcode Label Mnemonics Addr. Opcode Label Mnemonics Addr. Opcode Label Mnemonics

ORG 9000H 9034 07 LP3: RLC 905C C9 RET


9000 21A090 LXI H,90A0H 9035 0D DCR C ORG 9080H
9003 31FF90 LXI SP,90FFH 9036 C23490 JNZ LP3 9080 78 BCDBIN: MOV A,B
9006 3E80 MVI A,80H 9039 57 MOV D,A 9081 E60F ANI 0FH
9008 D30B OUT 0BH 903A CD640A CALL 0A64H 9083 4F MOV C,A
900A E5 PUSH H 903D E1 POP H 9084 78 MOV A,B
900B 21B090 LP2: LXI H,90B0H 903E 77 MOV M,A 9085 E6F0 ANI F0H
900E CD5590 CALL DIS 903F 82 ADD D 9087 0F RRC
9011 CD640A CALL 0A64H 9040 47 MOV B,A 9088 0F RRC
9014 E60F ANI 0FH 9041 219F90 LXI H,909FH 9089 0F RRC
9016 FE01 CPI 01H 9044 CD5590 CALL DIS 908A 0F RRC
9018 CA2390 JZ LP1 9047 CD8090 CALL BCDBIN 908B 87 ADD A
901B FE00 CPI 00H 904A 05 DCR B 908C 47 MOV B,A
901D CA2390 JZ LP1 904B 78 MOV A,B 908D 87 ADD A
9020 C30B90 JMP LP2 904C D301 OUT 01H 908E 87 ADD A
9023 D308 LP1: OUT 08H 904E 0F RRC 908F 80 ADD B
9025 21C090 LXI H,90C0H 904F 0F RRC 9090 81 ADD C
9028 CD5590 CALL DIS 9050 0F RRC 9091 47 MOV B,A
902B CD640A CALL 0A64H 9051 D302 OUT 02H 9092 C9 RET
902E E1 POP H 9053 76 HLT SYMBOL TABLE :
902F 77 MOV M,A ORG 9055H LP2 900B LP1 9023 LP3 9034
9030 2B DCX H 9055 3E00 DIS: MVI A,00H DIS 9055 BCDBIN 9080
9031 E5 PUSH H 9057 0600 MVI B,00H
9032 0E04 MVI C,04H 9059 CD160B CALL 0B16H

150 ELECTRONICS PROJECTS Vol. 23


Security alarm For Motor Bikes
Sunish Pootheri

H
ere is a very simple, easy-to-fix gate via resistor R3. 2. The lid of the plastic bottle along
security system for motor bikes. The above two operations take place with electrodes should be water-tight so
It sounds the horn when some- only when transistor T4 is not forward that the water level doesn’t fall much to
one moves the bike with its key off, i.e. biased, which happens when motor bike avoid its replenishment every now and
when the bike is parked. However, when key is in ‘off’ position. then.
the bike key is turned on, the circuit is When motor bike key is in ‘on’ position, 3. The value of capacitor C1 may be
inhibited and the horn will not sound. transistor T4 remains forward biased all varied to have different delays so that a
Whether the motor bike key is in ‘on’
or ‘off’ position, the supply is always
connected to the circuit.
When the motor bike key is in ‘off’
position and the bike is moved, the
water inside the plastic bottle shakes
to short all the three electrodes inside
the bottle together for a short dura-
tion. During this period, both the
inputs of AND gate N1 go high to
cause its output also to go high. As a
result:
1. Both the inputs of AND gate
N2 go high to cause forward biasing
of Darlington pair of transistors T2
and T3, which, in turn, drive the
horn. single shake of water (which causes all
2. Transistor T1 gets forward biased the time. Thus it doesn’t allow charging of the three electrodes to short) may sound
to charge capacitor C1. As a result, pin condenser C1 to sufficient value and so the the horn for sufficient interval as desired
6 of AND gate N2 remains high for some horn circuit doesn’t get activated. by the user.
time even after the electrodes are no more For proper operation of the circuit: 4. One may use the existing motor
shorted by splash of water in the plastic 1. The electrodes should be just above bike horn by connecting the transmitter of
bottle. Hence the horn, once activated, the water level in normally parked posi- transistor T3 to the positive horn terminal
remains ‘on’ until capacitor C1 discharges tion of the motor bike so that response of via a diode (1N5401) without disturbing
below the threshold voltage level of CMOS the circuit is fast. the horn’s existing connections.

Mains-Operated
Christmas Star
Prince Phillips

Here is a low-cost circuit of Christmas star capacitors C1, C2, and C3, diodes D1 and The multivibrator circuit is construct-
that can be easily constructed even by a D2, and zener ZD1 are used to develop a ed using two BC548 transistors (T1 and
novice. The main advantage of this circuit fairly steady 5V DC supply voltage that T2) and some passive components. The
is that it doesn’t require any step-down provides the required current to operate frequency of the multivibrator circuit is
transformer or ICs. the multivibrator circuit and trigger triac controlled by capacitors C4 and C5 and
Components like resistors R1 and R2, BT136 via LED1. resistors R3 through R7. The output of

ELECTRONICS PROJECTS Vol. 23 151


the multivibrator circuit is connected to
transistor T3, which, in turn, drives the
triac via LED1. During positive half cycles
of the multivibrator’s output, transistor
T3 energises triac BT136 and the lamp
glows.

Single-Plate Touch Switch


Pradeep G.

M
ost of the
transistorised touch
circuits published earlier
in EFY used two touch plates for
‘on’ and ‘off’ operations. The circuit
presented here uses only one touch
plate. For each alternate touch on
the touch plate, relay is activated
and deactivated.
When we touch the touch
plate, the induced AC hum
signal available in our body
(from mains wiring) is recti-
fied and filtered by diode D1
and capacitor C1. The result- bistable multivibrator formed by transis- This circuit may be powered by a 12V
ing low voltage is applied to base tors T3 and T4. (A similar circuit is also adaptor. If battery is used, the circuit
transistor T1. used for a clap switch.) The output of should be kept in a room where mains AC
Thus, when the plate is touched for transistor T4 is applied to relay driver supply is available so that mains electric
a moment, transistor T1 conducts. This transistor T5. The required load to be field is induced in the circuit operator’s
variation is detected by transistor T2 controlled can be connected via N/O con- body.
and it applies a triggering pulse to the tacts of relay RL1.

dual-speed Fan Driver for


Heat-Sink
T.K. Hareendran

N
ormally, for an active heat-sink, In practice, small 12V DC motors The temperature sensor used in
the cooling fan continuously with a current consumption of less than this circuit is a BU407 power transistor
rotates at full speed, which is 1 amp are used in active heat-sink (T1) mounted directly on the heat-sink.
undesirable in many situations. Here is a assemblies. The rotation speed of these A good NTC thermistor, if available,
dual-speed fan driver circuit to conserve motors can be changed by varying can be used in place of T1 for better
the energy and prolong the life of cooling the supply voltage between 6 and 12 results. At normal temperature, DC
fan. volts. resistance between emitter and

152 ELECTRONICS PROJECTS Vol. 23


voltage can be set to any range by
connecting a suitable zener diode at
its voltage regulator (VR) pin 4. The
parallel combination of zener diodes
D2 and D3 offers about 9 volts and
the motor starts rotating at a medium
speed.
Whenever the heat-sink’s temperature
goes beyond a predetermined level (fixed
by potmeter VR1), the output state of IC1
changes and transistor T2 is switched off.
The parallel zener combination is then
removed and the reference voltage at pin
4 of IC2 jumps to 12 volts. As a result, IC2
supplies about 12 volts to the motor for
full-speed rotation.
Transistor T3 wired in open-col-
collector terminals of transistor T1 is
lector mode may be used to control the
very high (in kilo-ohms) and the volt-
protection circuit, if any, of the main
age at non-inverting terminal (pin 3) of
system. It provides an active-high type
IC1 (configured here as comparator)
control signal that can be used to inter-
is higher than that at its inverting in-
face this protection circuit with the main
put terminal (pin 2). As a result, IC1
circuit of the system. LED1 is used as
output goes high to switch on transistor
a pilot indicator. If the motor (or the
T2, which connects zener diode D2 (in par-
motor driver section of IC2) fails due to
allel with zener diode D3) to pin 4 of IC2.
any reason, fusible resistor R6 burns out
BA6229 (IC2) is a popular inte-
instantly to protect the rest of the circuit.
grated variable-speed bidirectional motor
Now LED1 goes off to indicate an error in
driver that is generally used in
Internal functional block diagram operation.
electronic mechanisms. Its output
of IC BA6229

Crystal-Controlled Time
Base Generator
Pratap Chandra Sahu

A
digital frequency counter needs a
time-base generator to count the
frequency with high resolution.
Normally, a crystal-based oscillator with
divider IC chain or a similar circuit in
the form of an ASIC (application-specific
IC) is used for time-base generation.
Here we’ve presented a simple circuit
for accurate time-base generation using
the readily available 3.5795MHz crystal
commonly used in telecommunication
equipment.
The 3.5795MHz crystal is used in divided by 3584, giving the final output EFY lab note. To generate required
conjunction with a CD4060-based crystal frequency of around 998.8 Hz. This fre- gate for use in a frequency counter circuit,
oscillator-cum-divider (IC1). The crystal quency can be trimmed to exactly 1 kHz the final oscillator output needs to be fol-
frequency is divided by 512 by IC1, which with the help of trimmer capacitor VC1 lowed by a toggle flip-flop. For example,
is further divided by 7 by CD4017 (IC2). as shown in the figure. The 1kHz signal a 1kHz clock, when applied to a toggle
IC2 is reset as soon as its Q7 output goes can be further divided using decade flip-flop, will generate gates with 1-sec ‘on’
high. counters to generate the required time period and 1-sec ‘off’ period.
Thus the crystal frequency is period.

ELECTRONICS PROJECTS Vol. 23 153


40-metre CW transmitter
D. Prabakaran

T
his 7.0-7.1MHz (40-metre) amateur stem of the ferrite core used in TV balun T3 (2N2222) supplies sufficient drive to
radio band low-power transmitter core. the final power amplifier stage that is built
using two FETs and two bipolar The VFO’s stability is important for around transistor BD139 (T4). Morse key
transistors produces sufficient power of proper operation and hence you should can be connected in the emitter circuit of
about 1 watt for CW operation, to pro- use styroflex/polystyrene capacitors in the transistor T4.
vide adequate coverage if propagation oscillator stage. The entire VFO should
conditions are favourable. The circuit be housed in a mechanically strong alu- RF output is coupled to a half-wave
consists of four stages, namely, vari-
able frequency oscillator (VFO), buffer
amplifier, RF preamplifier, and RF
power amplifier.
The transmitter transmits in the
40-metre band. It is a fully solidstate
unit built using easily available compo-
nents. The variable frequency oscillator
(VFO) stage is built around BFW10 (or
BFW 11). Another BFW10 is used as
the buffer stage.
VFO circuit is a conventional
one, used by many amateur radio op-
erators in India. A 50pF variable ca-
pacitor is used for adjusting the VFO
to ham frequency band of 7.0-7.1
MHz. VFO tuning coil L1 is made by
winding eleven turns of 28 SWG enam- minium box to avoid any stray interfer-
eled copper wire on a PVC pipe former ence. It has an excellent short-/long-term dipole antenna through coaxial feeder.
having a diameter of 2 cm. The length frequency stability. Since the power output is less, there is no
of the coil should be about 1 cm. The carrier output from the VFO is need of antenna tuning network.
RF chokes (RFC1 and RFC2) have an fed to the next buffer stage built around Note. Transistor T4 should be mount-
inductance of 1 mH. One can make these transistor T2 (FET BFW 10), in order to ed with a heat-sink to avoid thermal
by winding 30 turns of 36 SWG on central avoid overloading of the VFO. Transistor runaway.

Temperature-Controlled
Ni-Cd Battery Charger
Shibashish S. Patel

O
vercharging is one of the main charged. Once fully charged, the cells starts charging the battery pack with a
causes of low cell life, which this start warming up. This charger senses preset constant current. When the pack
charger will help prevent. that warming and flips to the trickle becomes warmer than the reference
Overcharging of Ni-Cd cells causes charge mode. temperature (plus a small temperature
heating of cells, resulting in popping The temperature is sensed by a delta, set by the potentiometer), the
of their internal seals and venting of differential thermistor that compensates charger switches to the trickle charge
electrolyte. The Ni-Cd cells on a charger for changes in room temperature. On mode, so the pack can remain connected
stay cool until these are almost fully pressing the reset button, the charger to the charger without harm.

154 ELECTRONICS PROJECTS Vol. 23


The thermistors
should be epoxied to
separate aluminum
plates (say, 5x5 cm
each) and connected
back to the main
circuitry via a
shielded two-wire
cable. Set the battery
sensor thermistor on
the top of the battery
pack being charged,
with a weight on
the top. Make sure
that the batteries
have enough thermal
contact with the
sensor.
The 7805 regula-
tor should be mou-
nted on a heat-sink.
Current setting re-
sistor R2 may be a
high-power potentio-
meter or a switch
selectable resistor
or a single fixed re-
sistor. (The in-circuit
value of R2 for differ-
ent charging current
values is annotated
in the figure). Make
sure that the battery
and sensors are ther-
mally separated from
the other electronics,
so that the heat from
the circuitry doesn’t
affect the sensors.
For calibration,
allow the two temp-
erature sensor plates
to reach the same
temperature and
place a voltmeter
between test points
TP1 and TP2 (going to inverting automatically. charging LED2 glows. (Note. In case the
and non-inverting terminals, The circuit can be used as follows: battery was recently discharged at a high
respectively, of comparator IC3). The • Connect the Ni-Cd pack to rate, it may be warmer than the ambient
positive lead of the meter should touch the charger’s ‘Ni-Cd +’ and ‘Ni-Cd –’ temperature. Let it cool for a while or
TP2, while the negative lead should connectors. It should be allowed to cool place a warmer object on the reference
touch TP1. Now adjust sensor balance down to the ambient temperature before sensor if you’re in a hurry.)
trimpot VR1 for a reading of 20 mV on charging. • Some cells in a series string will
the meter. • Place the battery temperature always be first to get warm. After several
On pressing the reset button, charging thermistor sensor on the top of the Ni-Cd cycles, leave the pack on the charger for a
LED2 glows. Warm up the battery pack, holding it in place with a rubber few hours to trickle charge the lower cells
temperature plate by just touching it band or a heavy object. up to a full state of charge. This process is
with your hand and observe that the • Place the reference temperature called equalising the pack.
LED marked ‘done’ glows (and charging thermistor sensor away from the charger, • The resistance of thermistors TH1
LED2 goes off). This calibration ensures the battery, or any other source of heat. and TH2 used in the circuit should be
that the circuit will now onwards work • On pressing reset button S2, around 1 kilo-ohm under normal light
condition.
ELECTRONICS PROJECTS Vol. 23 155
Measuring Rigs and Add-Ons For
Radio amateurs
D. Prabakaran

E
lectronics engineers and a modulation monitor for checking matching between the equipment and the
technicians possess a wide modulation level (through headphone) aerial. A simple aerial tuner is shown in
selection of test and measurement without using a receiver. Using receivers Fig. 5. The inductor comprises 45 turns of
instruments like signal generators and for this purpose is not advisable because 26SWG, 16mm dia air-core former tapped
oscilloscopes. However, these instruments keeping sensitive receivers very close to at 26, 16, and 12 turns for 40m, 20m, and
are very costly and hence out of reach for ‘Tx’ may adversely affect the RF front-end 12m ham bands, respectively.
many electronics enthusiasts. Here are a of receivers due to high RF radiation. The filter circuit shown in Fig.
few circuits that are useful for building Fig. 4 shows an RF dummy load 6 can be used to minimise power
radio transmitters/receivers without much for adjusting power amplifier stages line interference. The power line acts
difficulty. and aerial tuner without connecting an as a conduit for different undesired
Fig. 1 shows an aerial tuning meter antenna. Four 200-ohm resistors (rated frequencies originated by motors, lighting
to tune the final power stage and the 5 watts each) are connected in parallel systems, and RF equipment. When a
antenna tuner of low-power (less than to achieve an impedance of 50 ohms. The receiver is connected to the power line,
5 watts) QRP transmitters. This meter resistors are packed in a container filled this interference results in undesired
enables you to match your transmitter with silica, to act as RF dummy load. whistles and other noises in the output
and aerial to obtain the maximum When an aerial is to be used on of the receiver.
radiation. several ham bands in conjunction with a Fig. 7 shows a directional power meter
Fig. 2 shows an RF probe aid that long wire antenna, it is necessary to make for use with low-power (QRP) transmitters
converts RF voltage into proportional DC use of an aerial tuner to increase the and aerials for tuning. It can provide up
voltage. By using this aid in conjunction radiation efficiency by achieving proper to 6-watt output. Resistors R1, R2, and R3
with a multimeter, you can measure
RF voltages in various stages of QRP
transmitters. Check whether the AM
transmitters are provided with the means
of monitoring the signals.
Fig. 3 shows the circuit of

Fig. 3: Modulation monitor


Fig. 5: Antenna tuning unit

Fig. 1: Antenna tuning meter

Fig. 2: RF probe aid Fig. 4: RF dummy load Fig. 6: Power-line filter

156 ELECTRONICS PROJECTS Vol. 23


Fig. 7: RF power meter
Fig. 9: Oscillator for Morse code generation audio frequency signal source to test audio
stages of the receiver.
Fig. 10 shows a marker signal
generator. It is a two-transistor oscillator
that can be used with a 1MHz quartz
crystal. In this circuit, transistor T1 is
wired as a common-base amplifier and
transistor T2 is wired as an emitter
follower. The output signal is fed back
to the input via C2 and series resonant
1MHz crystal. The main output signal is
at 1 MHz. Also, there are low-amplitude
harmonic signals at 2 MHz, 3 MHz, and
Fig. 8: Zener regulated 9V power supply Fig. 10: Marker signal generator so on up to 20 MHz. These 1MHz spaced
signals can be used as markers to align a
are 5-watt non-inductive resistors. voltage regulator using discrete receiver, since the receiver will respond
A regulated power supply is important components. to the fundamental 1MHz signal as well
in most applications such as variable Fig. 9 shows an inexpensive oscillator as its harmonics along its tuning range.
frequency oscillators and FM transmitters to test and practice Morse code. You can Thus these markers can be used to
to avoid frequency drift and unacceptable vary the pitch and volume using presets calibrate the dial accurately for every
level of residual mains hum. Fig. 8 VR1 and VR2, respectively. This circuit 1MHz interval throughout its tuning
shows an amplified zener diode shunt can also be used as a continuity tester or range.

Exclusive-OR Gate Applications Anand Tamboli

X
OR gate is a derived logic gate that
finds many applications in digital
circuits. Here we have described
use of XOR gate as controlled inverter, 9’s
BCD subtractor and up-/down-counter.
It can be seen from Fig. 1 and the
accompanying truth table that XOR
gate works as NOT (inverter) gate when
its one input is held high, and as
a buffer when Truth Table I
the same input XOR Gate
is pulled low. A B Y
The common 0 0 0
input (as 0 1 1
shown in Fig. 1 0 1
2) can therefore 1 1 0 Fig. 1: XOR gate as inverter and buffer

ELECTRONICS PROJECTS Vol. 23 157


mode). However,
when control signal
is held high, all bits
are inverted. Thus
the output is
complement of the
input. This comple-
menting function is
useful in subtrac-
tion circuits using
Fig. 2: XOR gate as controlled inverter 1’s and 2’s comple-
ments.
be used as control input for XOR gates In another con-
to behave as inverters or buffers. Here figuration of XOR
one of the inputs of each XOR gate are gate shown in Fig.
connected together to serve as the control 3, the circuit works
signal, while the remaining inputs serve as a 9’s BCD subt-
as input bits. ractor. Its output = Fig. 3: XOR gate as 9’s BCD subtractor
When control signal is zero, the 9 – input.
output is same as the input (buffer The circuit in Fig. 3 Truth Table II
can be used as a down- Down-counter
counter when employed with DiCiBiAi DEC. EQ. D0C0B0A0 DEC. EQ.
4-bit BCD counter IC 7490
0000 0 1001 9
as shown in Fig. 4. Truth
0001 1 1000 8
table of this configuration is
0010 2 0111 7
given alongside. As seen from
0011 3 0110 6
the figure, this circuit can be
0100 4 0101 5
built using a single XOR-IC
0101 5 0100 4
(TTL-7486). The NOR gate used in
0110 6 0011 3
the circuit is inevitable, but it
0111 7 0010 2
can be replaced by a resistance-
1000 8 0001 1
transistor logic (RTL) circuit
1001 9 0000 0
or any other equivalent circuit.
Fig. 4: Up-/down-counter

Wireless Stepper Motor


Control
K.S. Sankar

T
his circuit uses DTMF signals to the appropriate rows and columns of by Darlington pair array IC 2803 (buffer/
drive a stepper motor through an UM91215B. The generated tone is driver) containing eight Darlington stages.
IR beam up to about 1.5 metres. converted into IR energy modulated by the Only four Darlington pairs are used in this
For increased range one may use a DTMF frequency. project and connected to the four coils of
modulated laser beam. The DTMF modulated IR beam the stepper motor, making it to rotate in
The pulse generator is built around is received by a photodetector diode one direction.
a 555 timer wired as an astable and amplified by a Darlington pair of Note that only a single beam is used
multivibrator with a time period of transistors T1 and T2 before being fed to here instead of four beams. The speed
about one second. IC CD4017 serves as DTMF decoder IC 8870, which generates of the stepper motor depends on the
a divide-by-4 ring counter that a BCD output corresponding to the input frequency of 555 astable. If an up-/down-
activates quad switch IC CD4066. DTMF. Outputs A, B, C, and D turn ‘on’ counter IC is used instead of the 4017,
IC CD4066 electronically controls in sequence, since we are transmitting the stepper motor can be controlled to
DTMF tone generator IC UM91215B the code corresponding to digits 1, 2, 4, rotate clockwise or anticlockwise, as
to generate the tones corresponding and 8. desired.
to keys 1, 2, 4, and 8 by shorting The output of decoder 8870 is buffered

158 ELECTRONICS PROJECTS Vol. 23


Fig. 1: Stepper motor controller transmitter

Fig. 2: Circuit diagram of receiver

Readers’ comments if we look at it in the CRO? IC TP5089 from National Semiconductor,


Q1. I am working on the project ‘Wire- Shashikant Sharma whose datasheet is available at the com-
less Stepper Motor Control’ published in Gandhinagar pany’s Website.
EFY’s June issue. Please explain me the The author, K.S. Sankar, replies: 2. The IR light is modulated by the
following: A1. 1. IC UM91215B is a DTMF tone DTMF signal.
1. How the tone generator IC works? generator used in telephone instruments. 3. You will see a complex waveform
2. How the infrared light is modu- Its datasheet is not easily available. This on the scope, which is a combination of
lated? IC has been earlier covered in several ar- low and high frequencies (both in audio
3. What is the nature of IR modulation ticles in EFY. Alternatively, you can use range).

ELECTRONICS PROJECTS Vol. 23 159


Contactless Ringer For Telephones
pradeep G.

S
everal circuits of a telephone npn transistor BC547 in class-C mode of ing duration. As a result, the alarm is
extension ringer have earlier been operation. The transistor conducts during activated when the telephone rings.
published in EFY. The circuit pre- the positive half cycle of square wave. The When the handset is picked up or the
sented here is distinct from these circuits positive voltage (high) available at the telephone stops ringing, the transistor
in that it has no electrical contact with emitter of the transistor pulls reset pin 4 stops conduction. Then reset pin of IC2
the telephone lines. It senses the induced of 555 timer IC high for the correspond- goes low and the alarm is disabled.
fluctuating electric field of telephone lines
when the phone rings.
The input is sensed by a 5-8cm long
plastic insulated flexible wire that is
wound 3-4 times on telephone cable.
When the telephone rings, about 20Hz
AC voltage is available on the telephone
line, which causes field fluctuation up to
a few centimetres outside the telephone
cable also.
The 20Hz AC signal induced in the
pick-up sensor is coupled to the clock pin
of decade counter IC CD4017. The CD4017
is wired as a divide-by-two counter by con-
necting its pin 4 to reset pin 15.
As the input impedance of CMOS IC
is extremely high, the induced electric
field is sufficient to clock it. The output
obtained at pin 3 of CD4017 is a 10Hz
square wave (half of input 20Hz signals).
This square wave signal is used to bias

Mains Manager
Shibashish Patel

Very often we forget to switch off the equipment to control other gadgets. The the master socket. Diode D7 carries
peripherals like monitor, scanner, and main equipment is to be directly plugged the current during negative half cy-
printer while switching off our PC. The into the master socket, while all other cles. Capacitor C3, in series with diode
problem is that there are separate power equipment are to be connected via the D3, is connected across the diode com-
switches to turn the peripherals off. Nor- slave socket. The mains supply from the bination of D4 through D6, in addition
mally, the peripherals are connected to a wall socket is to be connected to the input to diode D7 as well as resistor R10.
single of those four-way trailing sockets of the mains manager circuit. Thus current pulses during positive
that are plugged into a single wall socket. The unit operates by sensing the cur- half-cycles, charge up the capacitor
If that socket is accessible, all the devices rent drawn by the control equipment/load to 1.8 volts via diode D3. This voltage
could be switched off from there and none from the master socket. On sensing that is sufficient to hold transistor T2 in
of the equipment used will require any the control equipment is on, it powers up forward biased condition for about 200
modification. the other (slave) sockets. The load on the ms even after the controlling load on
Here is a mains manager circuit that master socket can be anywhere between the master socket is switched off.
allows you to turn all the equipment on 20 VA and 500 VA, while the load on the When transistor T2 is ‘on’, transistor
or off by just operating the switch on any slave sockets can be 60 VA to 1200 VA. T1 gets forward biased and is switched
one of the devices; for example, when you During the positive half cycle of on. This, in turn, triggers Triac 1, which
switch off your PC, the monitor as well as the mains AC supply, diodes D4, D5, then powers the slave loads. Capacitor
other equipment will get powered down and D6 have a voltage drop of about C4 and resistor R9 form a snubber net-
automatically. You may choose the main 1.8 volts when current is drawn from work to ensure that the triac turns off

160 ELECTRONICS PROJECTS Vol. 23


table lamp to the master
socket and switch it ‘on’.
The lamp should operate
as usual. The slave LED
should turn ‘on’ whenev-
er the lamp plugged into
slave socket is switched
on. Both lamps should be
at full brightness without
any flicker. If so, the unit
is working correctly and
can be put into use.
Note. 1. The de-
vice connected to
the master socket
must have its power
switch on the primary
side of the internal
transformer. Some
electronic equipment
have the power switch
on the secondary side
and hence these de-
vices continue to draw
a small current from
the mains even when
cleanly with an inductive load. discharging capacitor C1 when the unit is switched off. Thus
LED1 indicates that the unit is op- unplugged. LED1 glows whenever the unit such devices, if connected as the
erating. Capacitor C1 and zener ZD1 are is plugged into the mains. Diode D1, in master, will not control the slave
effectively in series across the mains. anti-parallel to LED1, carries the current units correctly.
The resulting 15V pulses across ZD1 are during the opposite half cycles. 2. Though this unit removes the
rectified by diode D2 and smoothened by Don’t plug anything into the master power from the equipment being control-
capacitor C2 to provide the necessary DC or slave sockets without testing the unit. led, it doesn’t provide isolation from the
supply for the circuit around transistors If possible, plug the unit into the mains mains. So, before working inside any
T1 and T2. Resistor R3 is used to limit via an earth leakage circuit breaker. The equipment connected to this unit, it must
the switching-on surge current, while re- mains LED1 should glow and the slave be unplugged from the socket.
sistor R1 serves as a bleeder for rapidly LED2 should remain off. Now connect a

LED-cum-diode tester
D. Prabakaran

This simple LED-cum-diode diodes) and silicon and germanium diodes. Two series combinations of an LED
tester cir-cuit indicates the polarity of Zener diode can be tested for forward and a diode are connected back to
almost all types of LEDs and diodes drop to know whether it is good or bad. back between the outputs from
without any damage. The unit has The average test current is about 5 mA, collectors of transistors T1 and T2.
two test probes and two indicator which is sufficient to illuminate the LED The series combination of a LED and
LEDs. The diode or LED under test may being tested. diode is used in order to increase
be connected either way between the The circuit consists of a standard the forward voltage drop. When
test probes. The cathode terminal is two-transistor astable multivibrator transistor T1 is ‘on’ and transistor T2
automatically indicated by illumination that provides a 200–300Hz squarewave is ‘off’, the current flows through
of the corresponding LED (LED1, if signal. The outputs from the collectors LED1, causing it to glow. When
the cathode is connected to probe 1, of the two transistors are out of phase transistor T1 is ‘off’ and transistor T2
and LED2, if the cathode is connected with each other, i.e. when one output is is ‘on’, LED2 glows. The 200-
to probe 2). This circuit can be used to test high, the other output is low, and vice 300Hz frequency is sufficiently fast
all conventional LEDs (including infrared versa. and as such both LEDs appear to be con-

ELECTRONICS PROJECTS Vol. 23 161


ensure that voltage drop across LED1 or
LED2 is greater than the forward voltage
drop of the diode being tested.
When the diode being tested is
reverse biased, the other LED on the unit
will illuminate. The diode being tested
receives a reverse voltage of about 2.5
volts, which is insufficient to cause any
damage to it.
If the diode being tested is short
circuited, neither of the two LEDs on the
unit would glow. The astable multibvibra-
tor would also stop oscillating.
If the diode being tested is
open circuited, both LEDs on the unit
would remain lit.The circuit operates off 9
volts. However, it can also work satisfac-
tinuously illuminated. polarity. The test current torily at 6 volts. The total supply current
When the diode to be tested is kept in will therefore flow through the diode is about 15 mA at 9 volts. For the test
between the two test probes, it bypasses being tested instead of the bypassed LED probes, one can use small crocodile clips
either LED1 or LED2, depending on the on the unit. Series diodes D1 and D2 (insulated).

Measurement of transistor hFE


Prof. Somnath Chakrabarti

This circuit measures hFE of an npn RE is VE = IERE = hFE x 10-2 volts. For ex- variable linear resistor VR1 (10-kilo-
transistor without using a moving coil ample, if hFE is 100, VE will be 1 volt. This ohm). Thus the voltage at the inverting
instrument or a digital multimeter. voltage is applied to the non-inverting terminal of IC2 (V 2–) could be continu-
A constant-current source is obtained terminal of op-amp µA 741 (IC2) that is ously varied from 0 to 6 volts. When V 2–
using the op-amp µA741 (IC1) in conjunc- used here as a comparator. < V 2+ (=V E), the output of the op-amp
tion with the pnp transistor CK100 (T1). The voltage applied at the inverting will be in the positive saturation state
The value of the constant current is ad- terminal of comparator IC2 is obtained (V0+sat»12 volts). When V 2– > V 2+, the
justed to 10 µA using the values of circuit from the divider network comprising output will be in the negative satura-
components as shown in Fig. 1. a fixed 10-kilo-ohm resistor (R4) and tion state (V 0–sat»–12 volts).
The voltage at the non-inverting
terminal of IC1 is V1+ = 12VxR2/
(R1+R2) = 10 volts. Due to virtual
short-circuit condition, the volt-
age at the inverting terminal also
is V1– = 10 volts. This is also the
voltage at the emitter terminal of
transistor T1.
The current through resistor
R3 = 12V–10V/ 200 kilo-ohm = 10
µA….(i) As long as transistor T1
remains in the active region, it
will pump this constant current
into the base of the npn transistor
under test (TUT). The collector
current (IC) of TUT is given by the
following relationship:
IC = hFE x IB = hFE x 10 µA.
………(ii) The emitter current
(IE) is almost equal to the collec-
tor current (IC). The voltage drop
across 1000-ohm emitter resistor Fig. 1

162 ELECTRONICS PROJECTS Vol. 23


A bicolour LED (two LEDs con- responding to V2– = 6V (refer Fig. 2). Thus
nected in inverse parallel) with for each degree rotation of the pointer on
current-limiting resistor R5 indicates the graduated scale, hFE changes by 600/φ.
the sudden change in the state of the This way the dial can be calibrated while
comparator. When V2 – < V2+, green fixing a needle pointer rigidly to the shaft
LED glows. When V2– > V2+, red LED of the potmeter.
glows. The measurement procedure is very
First, the angle of rotation (f) simple. On the calibrated scale, find the
through which the wiper of the pot- position of the pointer at which one LED
meter sweeps from one end to the turns on and the other LED goes off and
other is noted. This angle is subdi- read the value of hFE directly. Since a
vided into 100 (or any suitable) equal differential voltage (V2+~V2–) of about
parts. On the extreme left the dial is a fraction of 1mV input suffices for the
marked with hFE = 0 corresponding comparator output to change state, the
to V2– = 0V, and on the extreme right transition is very much abrupt. (The dial
Fig. 2 the dial is marked with hFE = 600 cor- reading in Fig. 2 shows hFE=150.)

Infrared Toy Car Motor


Controller
T.K. Hareendran

This add-on circuit enables remote glows again. glass, and connect its wires to the circuit
switching on/off of battery-operated toy This circuit can be easily fabricated board using a short 3-core ribbon cable/
cars with the help of a TV/video remote on a general-purpose printed board. After shielded wire.
control handset operating at 30–40 kHz. construction, enclose it inside the toy Note. Since the circuit uses modu-
When the circuit is energised from a car and connect the supply wires to the lated infrared beam for control func-
6V battery, the decade counter CD4017 battery of the toy car with right polarity. tion, ambient light reflections will not
(IC2), which is configured as a toggle flip- Rewire the DC motor connections and affect the circuit operation. However,
flop, is immediately reset by the power- fix the IR receiver module in a suitable fluorescent tubelights with electronic
on-reset combination of capacitor C3 and location, for example, behind the front ballasts and CFL lamps may cause
resistor R6. LED1 connected to pin 3 (Q0)
of IC2 via resistor R5 glows to indicate
the standby condition. In standby condi-
tion, data output pin of the integrated
infrared receiver/demodulator (SFH505A
or TSOP1738) is at a high level (about 5
volts) and transistor T1 is ‘off’ (reverse
biased). The monostable wired around IC1
is inactive in this condition.
When any key on the remote control
handset is depressed, the output of the
IR receiver momentarily transits through
low state and transistor T1 conducts. As
a result, the monostable is triggered and
a short pulse is applied to the clock input
(pin 14) of IC2, which takes Q1 output (pin
2) of IC2 high to switch on motor driver
transistor T2 via base bias resistor R7
and the motor starts rotating continously
(car starts running). Resistor R8 limits the
starting current.
When any key on the handset is de-
pressed again, the monostable is retrig-
gered to reset decade counter IC2 and
the motor is switched off. Standby LED1
malfunctioning of the circuit.
ELECTRONICS PROJECTS Vol. 23 163
Low-cost battery charger
with high-/low-voltage
cut-off
Vinod C.M.

M
ost battery chargers and cut-off battery if the charger output voltage is As the charging current is less
devices have the following draw- less than the terminal voltage of the than 1 amp even when the battery
backs: battery. terminal voltage drops to 10.5 volts,
• The status of the battery is checked Here we’ve presented a low- both the charger and the battery are
when the charger is still on. Therefore the cost battery charger with high- safe.
sensing unit (the voltage comparator) fails and low-voltage cut-off that The low-voltage cut-off part of the
to check properly whether the battery has overcomes all the above-men-
been charged to the
preset voltage, as
the charging voltage
is above the preset
cut-off voltage level;
for example, charg-
ing voltage for a
12V battery is 12.5
volts.
• There is no
control over the
charging current;
for example, when
the terminal voltage
is about 10 volts,
the charging cur-
rent will be 12-10/
(Rb+Rt), where Rb is
the internal resist-
ance of the battery
and Rt is the equiva-
lent resistance of
the transformer. The
combined resistance
(Rb+Rt) is very small
and hence the charging current will tioned problems. circuit is basically a voltage comparator
be very large, which is harmful to For high-voltage cut-off, the output (IC2). The reference voltage is provided
both the charging unit as well as the of the voltage regulator IC LM317T is at the inverting terminal by a 4.8V zener
battery. adjusted (using preset VR1) to the charg- diode. To save the battery from excess
• There is no control over the ing voltage (Vc), say, 12.5 volts for a 12V, drainage, preset VR2 is adjusted such that
charging DC voltage. That is, at a high 15Ah battery. Resistor R2 limits the maxi- relay RL2 de-energises at the required
mains voltage, say, 240–260V AC, the mum charging current. If the required low-voltage cut-off value, say, 10.5 volts.
charging source voltage will be very large, low-voltage cut-off value is 10.5 volts, the The relay contacts are used to disconnect
hence the charging current will be very maximum charging current will be: the load. Thus the battery terminal volt-
large. Such a rapid charging affects the Imax = Vc-Vpreset amps age will be maintained between 10.5 and
lifespan of the battery. Similarly, during R2 12.5 volts.
low voltage conditions (160–180 volts, Note. An LED can be used to indicate
= 12.5-10.5
which is very common during summer), that the charger is ‘on’. It, along with a
the charger may not be able to charge the = 0.9 amps 1-kilo-ohm series resistor, should be
connected across relay coil RL1.

164 ELECTRONICS PROJECTS Vol. 23


Readers’ comments power is available. It enables automatic Q2. We need the ‘low cost battery charger
Q1. I have the following queries: switching on of the load (emergency with high/low-voltage cut-off’ circuit for
a) What is the role of relay RL1? I lamps, inverters, etc) in the case of power our emergency lantern using 6V, 10Ah
understand that it is meant for adjust- failure. battery. Please suggest modifications
ment of the initial charging voltage. b) The load refers to anything that is to the same for: a) Use with a 6V,10Ah
But does it have any role in cutting off to be operated by the battery. battery
the voltage after charging voltage is c) Switch S1 is just an ‘on’\‘off’ switch for b) High-voltage cut-off only
reached? the load. It plays no role in cut-off action. c) Automatic switching of the circuit to
b) What is load? Is it a bulb/circuitry d) The circuit doesn’t cut off the charg- trickle charging mode when it reaches the
or just meant for indicating that the er unit from the mains. The high-voltage fully charged state
charging is over? cut-off action of the unit is inherent in the Vijayan Thekkeveedu, Nileshwar, Kerala
c) What is the function of switch S1? I sense that the battery can’t get charged A2. a) Adjust the output voltage of 317T
understand that it is meant to switch on/ above the regulated charging voltage (here to around 7 volts to charge the 6V,10Ah
off the load. But does it have any effect on 12.5V) set by preset VR1, so charging battery.
the cut-off function as noticed by me? stops at exactly 12.5V. b) If only a high-voltage cut-off is re-
d) Does auto cut-off mean that the e) For low-voltage cut-off adjustment, quired, you need not use transistor SL100,
voltage/current supply is totally discon- discharge the battery by connecting the the voltage comparator (which drives
nected from the battery? required load and adjust preset VR2 such SL100) and the relay.
e) How the low-voltage potentiometer that relay RL2 gets de-energised at the c) When the battery voltage reaches
is to be adjusted? required low voltage, say, 10.5V. (It may near the preset voltage (7 volts), the
Manish S. Poudwal, Mumbai take some time for the battery terminal charging current becomes negligible, so
The author, Vinod C.M., replies: voltage to drop to 10.5V. ) The contacts of a separate circuitry for trickle charging
A1. a) Relay RL1 is meant to disconnect relay RL2 disconnect the load at exactly is not required.
the load from the battery when mains the set voltage of 10.5V.

Electronic guard for Blind


Pradeep G.

people.
One part of the
dual reflective sensor
module emits audio
frequency modulated
infrared beam, while
the other part is
used to sense the
reflected IR signals.
The audio content is Fig. 2
separated and fed to
an earphone.
The IR transmitter the phototransistor inside the module
part uses NE555 senses the reflected signals. The tone
timer based astable signal amplifier comprising transistors
multibvibrator and T2 and T3 amplifies 1kHz (AF) signals.
has an oscillating Transistor T4 forms a low-power common-
frequency of around emitter amplifier to drive the earpiece.
1 kHz. The infrared The entire unit with battery can be housed
dual sensor used for inside a matchbox-size plastic box.
proximity detection If the object/obstruction is close to the
contains both the unit, the intensity of the reflected signals
IR LED and the will be high. Therefore the sound heard
phototransistor in a

V
through the earphone will be loud. If the
isually impaired persons need to single package. It has object is away from the unit, the signal
use a long stick while walking to five leads, out of which four leads are used strength will be low. Accordingly, the
find any obstructions in front of here. Base leads of the phototransistor are sound heard through the earphone is low.
them. Here is a low-cost circuit based on not used. In this way, the user gets a rough idea of
the infrared proximity sensor to aid these If the obstruction is within 1.5 metres, his distance from the object.

ELECTRONICS PROJECTS Vol. 23 165


Fig. 1

Users are advised to use a single EFY lab note. For testing we’ve with phototransistor in a 4-pin round
earphone instead of a double stereo used a compact (4mm dia.) HO-4R plastic package. Its pin configuration
headphone. This will allow them to hear reflective sensor sample from Micro is shown in Fig. 2. For datasheets, etc, you
other sounds in the vicinity using the Impex, Mumbai (e-mail: microimpex @ may visit the Website ‘www. microimpex.
other ear. vsnl.com). It is a GaAs infra-red sensor com’.

20m, 4W QRP Transmitter


Pradeep G.

U
sing this small yet powerful Adjust gang condenser’s knob until the horizontal dipole antenna via 75-ohm
4W transmitter Hams bulb glows, which indicates that the coaxial cable as shown in Fig. 2. Each
(licenced amateur radio operators) transmitter is okay. (Caution. Don’t arm of the dipole antenna is about 5
can transmit Morse code signals to long switch on the transmitter without an metre long. The correct length L (in
distances in 20-metre band. Morse code output load.) metres) of single pole of the antenna
communication with European and After checking with bulb as load, can be calculated using the following
neighbouring countries is possible. the transmitter can be connected to a
The transmitter (refer Fig. 1)
comprises an oscillator, driver,
and power amplifier. The oscillator
is crystal-controlled. For this, an
inexp-ensive and readily available
crystal with fundamen-tal frequency
of 14.314 MHz is used with the
oscillator. The oscillator delivers
power of about 200 milliwatts. The
next stage is a class-C driver that
delivers power of nearly 1watt.
The final stage is a class-C power
amplifier wired around transistor
BD139, which delivers power of 4
to 5 watts.
After assembling the circuit,
connect a 12V, 5W bulb across
the antenna’s terminals. Apply
regulated 12-15V DC to the circuit.
Fig. 1: The transmitter circuit

166 ELECTRONICS PROJECTS Vol. 23


relationship: movable ferrite bead
L = 71.6/ frequency (MHz) L4: 14 turns of 20 SWG insulated
Winding details of coils are as follows: copper wire over 1.5cm dia. PVC former.
L1: 9 turns of 24 SWG insulated (The coil is to be tapped from 9th to 10th
copper wire over 8mm dia. oscillator coil turn from the top end.)
former with ferrite bead RFC: 12 turns of 36 SWG insulated
L2: 3 turns of 24 SWG insulated copper wire using TV balun core
copper wire over coil L1 Warning. Use of this transmitter with-
Fig. 2: Connection of the transmitter to a L3: 9 turns of 24 SWG insulated out Ham licence is illegal, hence only Ham
horizontal dipole antenna copper wire over 8mm dia. former with licence holders should assemble this project.

Priority Indicator For Quiz


Contests
Madhur Sharma and
Aquil Banglowala

I
n contests like quiz games the contes- open. Initially reset switch S5 is pressed contestant who pressed the switch goes
tants are required to hit their buzz by the quiz master to clear IC4 and set Q low. Accordingly, the output of NAND
er-activating switches to tell the output of IC3 to high state before starting gate N6 goes high, which makes one of the
answer first. Here’s a circuit that provides the contest. Also all the inputs to gate N6 inputs of NAND gate N7 to go from low to
audio-visual indication corresponding to are pulled high via resistors R1 through high state. At the same time, buzzer driver
the contestant who first presses the switch R4, and its output is in low state. transistor T5 conducts to sound the buzzer
and avoids a tie situation between the Now, whenever a contestant presses briefly via relay RL5.
contestants. the respective switch, the corresponding The output of gate N7 goes from high
This circuit can be used for a input to the 74LS175 D-latch (IC4) goes to low state, which, after differentiation
maximum of four contestants. If the high after inversion by gates N1 through by the combination of capacitor C1 and
number of contestants is less than four, N4. Simultaneously, the specific input resistor R9, is used to reset Q output
any of the switches can be left unused/ of NAND gate N6 corresponding to the of the 74LS76 J-K flip-flop (IC3) to low

ELECTRONICS PROJECTS Vol. 23 167


state. The low Q output of IC3, after The latching of switch states takes this happens in a few microseconds and
inversion by gate N5, is applied to clock place almost instantaneously with first hence a tie situation is avoided. Further
pin of the 741LS175 (IC4), which is a depression of any of switches S1 through depression of the switches will not change
positive edge-triggered latch. Thus all the S4. The depression of any of the four the output state of IC4 latches, although
input states at D0 through D3 pins are switches results in a low-going pulse the buzzer sound can be heard even after
transferred to their respective outputs. at the output of NAND gate N7, which, the locking of the circuit.
The outputs of IC4 are used to activate after differentiation, is applied to CD When one round of the quiz completes,
the corresponding relays (RL1 through input of IC3 to cause its Q output to go the quiz master needs to reset the circuit
RL4) to light up the bulbs indicating the from high to low state and immediately with the help of reset switch S5 for the
contestants. latch the states of the four switches. All next round.

Infrared remote control tester


T.K. Hareendran

H
ere’s a simple, low-cost, and easy- (5 volts) and as such driver transistor and the LED blinks to indicate reception
to-construct infrared remote T1 is in cut-off state. Whenever the IR of signals from the remote such as TV
control tester. The tester is receiver module receives a valid (modu- remote control. A miniature active buzzer
built around an easily available infrared lated) infrared signal, its data output pin is connected at the collector of transistor
receiver module (TSOP 1238). goes low in synchronism with the received T1 for audio indication.
Normally, data output pin 3 of the infrared bursts. As a result, transistor T1 The 5V DC for energising the circuit
IR receiver module is at a high level conducts during negative pulse period is directly derived from the 230V AC

Fig. 2: Proposed enclosure with front-panel


layout
Fig. 1: Schemantic diagram of IR remote control tester

mains supply. Unlike the conventional not radiate any heat and makes the tester bient light or electronic ballast-operated
resistive voltage divider, a capacitive quite compact. Another advantage of this tubelights. A suggested enclosure for the
potential divider is used here, which does tester is no false triggering due to the am- circuit is shown in Fig. 2.

Readers’ comments 230V AC is applied, the IR receiver mod- may use a medium-size active DC
Q1. I have the following queries: ule works but on reinstating the supply buzzer, which is readily available
1. Due to space constraints, I after switching off, the IR-RX remains in the market. A PCB-mountable
have used a smaller buzzer (normally activated with LED1 glowing and it does buzzer may also be used.
used in quartz alarm clocks) instead of not sense any infrared signal. It appears 2. The circuit will work satisfactorily
those available in the market for 3 to 27 that the value of C3 (470 nF) and/or its without any modification. I request the
volts. When the buzzer is connected across connection need some revision. I request reader to carefully check his prototype.
the combination of LED1 and 330-ohm you to modify the circuit accordingly. Good-quality capacitors should be used
resistor, as shown in the circuit, it doesn’t Bhabadeb Sinha for C1 and C2 and the dust and dirt
work. What modification is needed for this Through e-mail should be cleaned off thoroughly from the
buzzer to work? The author T.K. Hareendran replies: PCB after soldering. If the problem still
2. If 5-6V DC instead of 230V AC A1. 1. The acoustic buzzer used in persists, he may connect a 1-mega-ohm,
supply is applied at R3 (i.e., without quartz electronic clocks is a pas- 1W resistor in parallel to capacitor C3
C3), the circuit works fine and repeated sive element and hence not suit- and/or replace C1 with a 10µF/16V elec-
‘on’/‘off’ can be made. However, if able for this project. The reader trolytic type.

168 ELECTRONICS PROJECTS Vol. 23


Low-cost cordless FM Microphone
Vivek Kalkur M.

T
his low-cost cordless microphone the transmitter with operating voltage of (T1). The signals are frequency-modulated
can transmit voice signals in FM 3 volts is about 5 mW. by the tank circuit comprising inductor
band (88-108 MHz) up to about The output from the condenser mi- L1 and capacitor C1. The fundamental
50 metres, which can be heard on any crophone is applied to the base of an RF frequency can be varied by replacing
ordinary FM radio. The radiated power of oscillator built around transistor BF194B capacitor C1 with a parallel combina-
tion of a 0-22pF trimmer and a 12pF
capacitor. A 75cm long wire (quarter
wavelength) is used as an antenna for
radiation.
This circuit can be assembled on
a 3×3.8cm general-purpose PCB and
housed in a small plastic case. It
is very sensitive, provides hum-free opera-
tion, and requires no alignment.
Note. Don’t hold the microphone very
near to the radio receiver as it can
produce undesirable noise due to
feedback.

AC Line detector
D. Mohan Kumar

H
ere is a simple and low-cost C1, which is charged to battery voltage case. Use a miniature DC buzzer with
circuit for detecting the presence of 3 volts via resistor R3, discharges and internal oscillator and 3mm transparent
of AC without directly touching causes pnp transistor T3 to conduct and red LED. The circuit operates off 3V DC
the line. It is very useful for checking sound the buzzer as well as light the via two small pen-torch cells (AAA type).
the power in mains wiring, especially LED to indicate the
the broken points in concealed wiring. presence of AC source
Whenever the test probe is taken close to in the vicinity.
any live line, the buzzer sounds and LED During positive
glows, indicating the presence of the AC. half cycles of the AC,
It can detect power from a distance of up capacitor C1 doesn’t
to 31 cm (1 foot) from the line. charge back substan-
The circuit uses an n-channel FET tially via resistor R3
BFW11 (T1) for detecting the mains and as such transistor
50Hz AC. In the absence of 50Hz AC T3 remains ‘on’ to give
mains signal (with the gate of FET continuous audio-visual
open), the drain voltage of JFET T1 indication, as long as
is very low (below 100 mV). However, the probe is kept near
when the probe, connected to the AC source. The
the gate of JFET T1 is brought circuit may provide
closer to 50Hz AC mains, the FET similar indication
T1 cuts off during negative half even in the case of DC
cycles, which causes transistor supply with sufficient
T2 to conduct and its collector AC ripples.
voltage drops to almost the ground Assemble the circuit on a general- You may use a 10cm steel rod or tele-
potential. As a result, capacitor purpose PCB and enclose it in a small scopic antenna as the probe.

ELECTRONICS PROJECTS Vol. 23 169


Multi-pattern Running Lights
Pratap Chandra Sahu

U
sing this circuit you can is wired as an astable multivibrator that is used to drive 16 bulbs. Only
illuminate sixteen bulbs to provide clock for CD4029B binary eight triacs are employed to drive the
sequentially in sixteen different counters (IC2 and IC3). The binary 16 channels. This is possible because
ways. The circuit is economical and uses counters are cascaded together. The whenever the binary code at the EXOR
ICs and triacs to provide more functions outputs of IC3 are EXORed with those of outputs is greater than 8, SPDT relay
and drive more bulbs, respectively. IC2 so as to obtain the binary code for RL1 gets activated, thus multiplexing the
16 channels using eight triacs.
For binary outputs below 8,
the N/C contact of the relay
is connected to the common
point of the first eight bulbs.
When the relay gets activated,
the common point of the
other eight bulbs
is activated via the
N/O contact of the relay.
Timing components of
IC1 are selected to generate
a 1Hz clock. Thus the binary
output of counter IC2 changes
after every one second. But
as counter IC3 is cascaded to
counter IC2, the binary output
of counter IC3 changes after
every 16 pulses/clock cycles.
So after every 16 clocks,
counter IC3 changes its binary
output value.
Now, since the outputs
of the two counters are
EXORed, the original code
of IC2 produces 16 different
combina-tions, generating 16
different sequences/patterns
The circuit uses five ICs, one SPDT sixteen different modes. The EXORed of running light as shown in the table.
relay, and eight triacs. The NE555 (IC1) outputs are fed to a 4-to-6 line decoder

Bulb L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11 L12 L13 L14 L15 L16


Sequence No.
No.

I 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
II 1 0 3 2 5 4 7 6 9 8 11 10 13 12 15 14
III 2 3 0 1 6 7 4 5 10 11 8 9 14 15 12 13
IV 3 2 1 0 7 6 5 4 11 10 9 8 15 14 13 12
V 4 5 6 7 0 1 2 3 4 13 14 15 8 9 10 11
VI 5 4 7 6 1 0 3 2 13 12 15 14 9 8 11 10
VII 6 7 4 5 2 3 0 1 14 15 12 13 10 11 8 9
VIII 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
IX 9 8 11 10 13 12 15 14 1 0 3 2 5 4 7 6
X 10 11 8 9 14 15 12 13 2 3 0 1 6 7 4 5
XI 11 10 9 8 15 14 13 4 3 2 1 0 7 6 5 4
XII 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3
XIII 13 12 15 14 9 8 11 10 5 4 7 6 1 0 3 2
XIV 14 15 12 13 10 11 8 9 6 7 4 5 2 3 0 1
XV 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

170 ELECTRONICS PROJECTS Vol. 23


Home Appliance Protector
Arthur Louis

M
odern homes are equipped with • Protection against surge lasting up by using switch S1. Fuse F2 is provided
many electric and electronic to 60 milliseconds (ms). to protect the household equipment due
equipment such as TV sets, • Power-on audio indication. to any accidental short-circuiting or
music systems, refrigerators, audio-video • A wide voltage range setting with overload.
systems, microwave ovens, and UPS limit indication. Transformer X1 is used to power the
systems. Most of these equipment work Surge protection is provided by metal- entire circuit, except sampling circuit, for
on AC mains voltage, which should be oxide varistor (MOV) RDN 320/14, which which transformer X2 is used. The output
correct within certain limits. An excessive activates when the line voltage exceeds is rectified by diodes D1 through D4,
deviation from nominal voltage may 320 volts to blow fuse F1 (which is in series filtered by capacitor C1, and regulated by
affect the performance of the equipment with MOV) to cut off the power supply to IC 7812 mounted over a heat-sink. Red
adversely and also cause damage. Here transformers X1 and X2. Cutting off the LED (LED1) serves as a power indicator.
is a circuit that continuously monitors transformers results in de-energisation of The output from sampling transformer
the mains power line and protects all the the relay to protect the costly equipment X2 is rectified by diode D5 and smoothed
household electrical/electronic equipment against very high voltage. by filter capacitor C5. Resistor R4 serves as
against any fluctuation. In fact, this circuit If the relay is sluggish, or distance a voltage-dropping resistor. The sampling
is an improved version of the basic low-/ between its pole and other contacts is very voltage is further smoothed by capacitor
high-voltage cut-off circuit, with following large, the voltage may rise even further C6 before application to the terminals of
additional functions/facilities: (beyond 600V AC) before changeover of comparator LM393 via presets VR1 and
• On-time delay of 12 seconds and off- relay contacts occurs. However, when the VR2.
time delay of 4 seconds. voltage rises, the switching off action via The heart of this high-/low-voltage

relay contacts will cut-off circuit are dual comparators (LM393)


take around 60 ms, with open-collector outputs. The fixed
which cannot be reference voltage of 4.2 volts developed
reduced because of across zener diode ZD1 is applied to non-
mechanical inertia inverting and inverting pins of comparators
of relay and disch- A (for high-voltage cut-off) and B (low-voltage
arge of power- cut-off), respectively. When the line voltage
supply capacitors. is higher than the value set by VR1, output
Capacitor C1 pin 1 of comparator A goes from high to
connected across low. Similarly, when the mains voltage goes
the MOV bypasses below the value set by VR2, output pin 7 of
any high-frequency comparator B goes from high to low. Output
voltage surge. An pins 1 and 7 are joined together in wired-OR
AC voltmeter is fashion and thus whenever the voltage is
provided to read out of the set range, pins 2 and 6 of timer
the mains voltage IC3 go low and its output pin 3 goes high

ELECTRONICS PROJECTS Vol. 23 171


to deactivate the relay switching stage. comparators A and B go high when the preset VR1 to read 4.2V DC at its wiper
Simultaneously, LED2 glows to indicate line voltage is within the window. The contact. Similarly, set the variac’s output
that the line voltage is outside the window discharge path of capacitor C8 is cut off and to 140V AC (low cut-off limit) and vary
(pass range). the capacitor charges to 2/3 Vcc in about 12 preset VR2 to read 4.2V DC at its wiper
The ‘on’ and ‘off’ time delays are seconds. As a result, pin 3 of IC3 goes from contact. Use a digital multimeter for
introduced by charging of capacitor high to low. Transistor T3 will get forward measurement. The setting of cut-off is
C8 through resistors R8 and R9 and biased and switch on relay RL1 to provide over. Now on varying the voltage above
discharging of the same through resistor the mains supply to connected equipment/ 285 and also below 140, yellow LED (LED2)
R9 into IC2, respectively. The ‘on’ and ‘off’ loads via its N/O contacts. Green LED glows to indicate the voltage to be out of
time delays can be increased/decreased (LED3) indicates that the mains supply is the window.
by increasing/decreasing the value of available for the appliances. The circuit can be assembled on
resistor R8 and resistor R9, respectively. Whenever the line voltage is out of general-purpose PCBs. Resistors R1,
For achieving much higher delays, value the window, pins 2 and 6 of IC3 go below R2, and R3, MOV, and capacitor C1
of C8 can be increased. 1/3 Vcc and its output pin 3 goes high should be mounted on a separate PCB.
Whenever there is resumption of to switch off the relay and thereby cut The voltmeter, switch S1, fuses F1 and
power after a power break, the power off mains supply to the connected F2 (along with fuse holders), LEDs (in
supply will not be stable for some time equipment. LED holders), and the speaker should be
due to high unsaturated magnetising The melody circuit is activated for about mounted on the front panel. A heat-sink
currents in distribution transformers. 10 seconds whenever the power resumes or should be used with IC 7812. Air vents
So the power supply will contain a lot of high/low cut-off comes into effect, as pin 3 should be provided in the box for air
voltage spikes. A power-on delay of about of IC3 goes from low to high. When output circulation. The low-voltage cut-off can
12 seconds is introduced when the power pin 3 of IC3 goes high, a reduced voltage of be set to 100V AC instead of 140V AC for
is restored or when the voltage returns 3.2 volts developed across zener diode ZD2 fringe areas where the voltage in peak
to its normal value from high/low limits is applied to melody generator IC4, which hours goes as low as 100 volts.
set by the presets. Similarly, an off-time provides a musical note. Volume control This home appliance protector should
delay of about 4 ms is introduced when VR3 can be preset, as desired. be inserted between the outputs of main DP
the voltage goes out of window. This After about 10 seconds, capacitor (distribution point) switch and mounted
delay is introduced not to interrupt the C11 charges enough to makes transistor near the DP switch. Its output should
power supply for short-duration line T1 to conduct and pull pin 2 of IC4 toward be used only for light loads. Heavy loads
voltage fluctuations, which do not affect ground, thereby cutting off the melody such as electric stoves, water heaters, and
the equipment. Caused by switching on/ generator. air-conditioners should not be connected
off heavy loads, these fluctuations die out To set presets VR1 and VR2, connect to its output. If a current of more than 15
within 1-2 seconds. the output of a variac (auto transformer) amps is needed, increase the relay contact
Timer NE555 (IC3) acts as a to the circuit. Set the variac’s output to rating and accordingly the current rating
relay switching stage. The outputs of 285V AC (high cut-off limit) and vary of transformer X1.

RMS-TO-DC CONVERTER
Pratap Chandra Sahu

T
he root mean square (RMS) value small part (less than one per cent) of this peak detector.
of an AC voltage is equivalent to a pulsating DC developed across resistor R2 The capacitor at the output of op-
DC voltage that when applied is buffered by op-amp A1 (¼ of LM324) and amp A2 is charged to the peak value of
across a given resistor for certain time applied to op-amp A2, which is wired as a the sampled pulsating DC. The voltage
dissipates the same amount of heat as
the AC voltage applied across the same
resistor for the same time. So to measure
the RMS value using this principle, an
instrument using heating effect of the
current is required.
Also, it is observed that the RMS value
of a sine wave is 1/√2 (= 0.707) times its
peak value. We’ve used here this fact to
determine the RMS value.
The circuit is built around a quad
op-amp IC LM324 and operates off a
single power supply. The mains AC
voltage is rectified by diode D1. Only a

172 ELECTRONICS PROJECTS Vol. 23


across capacitor C1 is further buffered output for connection to a DC voltmeter. VR1 and VR2 to read 2.3V DC. The
by op-amp A3 to isolate it from the EFY Lab note. With the compo- reading for other AC inputs (230V AC
divider circuit formed by resistors R5 nents as shown in the circuit, the output ± 100V AC) was checked and found to
and R6 and preset VR2. Op-amp A4 for 230V AC input was suitably vary quite linearly throughout the
further buffers the resistor divider adjusted with the help of presets range.

Cell Phone Call Indicator


D. Prabakaran

T
his circuit detects an incoming
call on your cell phone even when
the ringtone switch on your cell
phone is set to ‘off’ position and keeps
the LED flashing until you answer. It is
useful for cell phones without a built-in
light flashing facility.
The signal detected by sensor coil L1
is amplified by transistor T1 to trigger
the monostable built around CMOS timer
7555 (IC1). The output from pin 3 of IC1
is used to flash the ultra-bright LED
(LED1).
This circuit should be placed very
close to the cellular phone so that its
sensor coil L1 can detect the field emitted copper wire on a 5cm dia. PVC pipe. combination of three 7.5µH inductors
by the phone receiver during an incoming Alternatively, one can use commercially (approx. equivalent to 230 µH) in place
call. Sensor coil L1 can be made by available 10mH RF choke for sensor coil. of sensor coil L1 for testing, which gave
winding 130 turns of 35 SWG enamelled EFY Lab note. We used a series satisfactory results.

Keyhole Finder
T.K. Hareendran

T
his keyhole finder is very useful switch and the reed switch closes to of sensitivity-control preset VR1), the
par-ticularly at nights or during power the astable oscillator built astable is disabled as its reset terminal
dark-ness. around IC LM555 (IC1). If ambient light (pin 4 of IC1) is grounded by transistor
Fig. 1 shows the keyhole finder is sufficient (determined by the setting T1.
circuit. The input 230V AC is converted
to a low-voltage, low-current source
by a capacitive potential divider
circuit comprising capacitor C1 as the
main element and resistor R1 as
current limiter. The output AC voltage
of this network is converted to
pulsating DC by diodes D1 and D2
that are wired in half-bridge topology.
Capacitor C2 smooth-enes the DC
supply and zener diode ZD1 (6V)
regulates the output to steady 6V DC.
Whenever the door is closed as per
the mechanical arrangement, the
permanent magnet mounted on the
doorframe comes close to the reed Fig. 1: Keyhole finder

ELECTRONICS PROJECTS Vol. 23 173


When ambient circuit is not rquired, remove
light falls to a transistor T1, preset VR1, and,
low intensity, the of course, the LDR from the gadget.
astable starts Though it is not necessary to remove
working and the resistor R4, there is no harm even if
LED blinks at a you remove it. After removing resistor
low frequency rate R4, connect pin 4 of IC1 to positive-supply
decided by the line directly.)
values of resistors Fig. 2 shows the suggested mechanical
R2 and R3 and fitting plan. The LED must be fitted
capacitor C3. such that it is visible through the
(Note.If the front keyhole and doesn’t hinder the
Fig. 2: Suggested mechanical fitting plan
light-control normal key operation.

Remote-Controlled Fan
Regulator
V. David

H
ere is remote-controlled fan regu- control. Whenever push switch S1 on the
lator that has following • As speed regulation is based on transmitter (oriented toward the
advantages over conventional phase control rather than voltage control, receiver IR detector) is momentarily
regulators: it minimises the power loss due to heating depressed, the IR beam falls on
• The position of the regulator of bulky resistance. phototransistor T1 (3-pin L14F1 or
is displayed digitally over a 7-segment The remote control (IR transmitter) 2-pin SFH313). The same is amplified
display. comprises an IR LED (LD271 or by Darlington pair of transistors T2
• It offers regulation for eight equivalent, similar to those used in and T3 and fed to op-amp CA3140 (IC1)
different speeds, while an ordinary TV/VCR remotes), current-limiting that is used here as a comparator.
regulator permits only five speeds. resistor R1, pushbutton (tactile switch The output of the comparator (IC1)
• It offers soft-touch local and remote S1), and a 3V battery. switches from low to high, which, in

174 ELECTRONICS PROJECTS Vol. 23


turn, activates 555 (IC2) that is common-anode 7-segment LED. are appropriately shorted via the contacts
configured as an astable multivibrator. Speed control is achieved through of reed relays RL1 through RL4. The
The frequency of pulses generated by phase (firing angle) control of a triac via energisation of the appropriate relays
IC2 depends upon resistor R4 and its gate, which obviates the need to use is controlled by the binary count output
capacitor C1. The output of IC2 is bulky resistors or a power transformer. of IC3 via relay driver transistors T4
connected to decade counter IC 7490 Conduction angle of the triac is based on through T7.
(IC3), which counts pulses from 0 to 9. The the bias provided to the gate of the triac The circuit has been designed for
counter’s output is connected to display via the triggering diac, which, in turn, is 6kW load (25amp load at 230V AC) so as
driver IC 7446 (IC4) to display the count controlled through a combination of to accommodate higher-power blowers,
corresponding to the desired speed on a resistors R16 through R20. These resistors etc.

Readers’ comments change in ambient room light. for the transmitter and the correspond-
The circuit has some anomalies. The IR Pradeep G. ing IR module in the receiver would have
transmitter uses unmodulated infrared Bangalore enhanced its range manifold.
rays and hence its range is quite low. It EFY : We agree with Mr Pradeep’s view
is also prone to false alarm because of the and feel that use of 36-38kHz modulator

Using Single Telephone on Two


Telephone Lines
Linu M. Mathew

N
owadays many households have
two telephone lines. One has to
use separate telephone
instruments for the two lines or a double-
line telephone instrument that costs over
Rs 1500. Here is a circuit that converts
your single-line phone to act as a pseudo
double-line phone.
The system shown in Fig. 1 comprises
a double-pole double-throw (DPDT)
changeover switch and two identical
circuits (see Fig. 2), each of which is wired
to separate pairs of telephone lines. Fig. 1: The block diagram for using single instrument on two telephone lines
Fig. 2 shows the circuit
comprising a ringer, an LED
indicator, and a hold circuit.
The changeover switch
enables you to changeover
the use of the tele-phone
instrument between the
two lines.
The ringer circuit is
built around the dual-
tone ringer IC BEL1240
(IC1) that doesn’t need
any external power supply
for its operation. The tone
frequency (F1) and the
sweep frequency (F2) of
dual tones can be altered
by changing the values
of resistors R2 and R3 Fig. 2: The circuit for using single instrument on two telephone lines

ELECTRONICS PROJECTS Vol. 23 175


and capacitor C3 as per the following for green LED1 to glow, the zener will The minimum hold current for
relationship: conduct through LED1, which will glow the telephone line is about 25 mA.
R2 + R3 = 2.72x104(1–0.04Ln.F1 / 1943) to indicate on-hook status for both the Depression of switch S2 makes a 120-ohm
...........(i) line pairs. When the handset is lifted, resistor (test-selected to ensure that
F2 = 0.725F1 ...........(ii) the line voltage for the line in use drops line is not disengaged) to be connected
FSWEEP = 750/C3 (nF) ..........(iii) below 12V DC and therefore LED1 will across the lines, which keeps a current
As the rest of the circuit is polarity- stop glowing. of over 25 mA flowing through the
sensitive, we use a polarity-guard circuit When the telephone line is not in lines. To hold a line in case a call
comprising a bridge rectifier employing use, transistor T1 will be in ‘on’ state is detected on the other line (as its
four 1N4001 diodes. as resistors R5 and R6 make its base ringer will be ‘on’), keep switch S2
When the telephone instrument is forward biased. This makes transistor T2 pressed, flip changeover switch S1 to
in on-hook position, the voltage across to go off, so LED2 doesn’t glow. However, other line, attend to the call, and revert
each of the telephone line pair will be when the telephone is in use, the voltage back switch S1 to continue with the
about 48 volts. As this voltage is much across resistors R4 and R6 drops and conversation on the previous line after
greater than the zener diode (ZD1) it makes transistor T1 to turn off and releasing switch S2.
breakdown voltage of 12 volts plus the transistor T2 to turn on, causing LED2 The circuit can be assembled on
forward voltage drop of about 2 volts to glow. general-purpose PCBs.

Digital Clock with Hour Alarm


Pratap Chandra Sahu

T
his easy-to-fabricate digital hour Hours and minutes can be easily set. cum-divider IC 4060 (IC1), in conjunction
clock with alarm uses readily avail- The alarm can be set to sound for a brief with a 32.768kHz crystal, provides stable
able, low-cost components. Hours duration at any given hour. 2Hz output at Q14 (pin 3) by dividing the
are indicated by LEDs, while minutes The circuit uses seven ICs and crystal frequency by 16,384. The 2Hz clock
are indicated by two 7-segment displays. operates off a 6V DC supply. Oscillator- signal is further divided by a divide-by-

176 ELECTRONICS PROJECTS Vol. 23


two counter wired using half of dual J-K used as follows: with switches S1 and S2 for hours and
flip-flop CD4027B (IC2). The 1Hz clock The reset pulse output generated at minutes setting, respectively. The sounding
thus obtained is fed to a divide-by-60 hourly interval by IC5 is used as clock of alarm at any given hour is made possible
counter wired around CD4566B (IC3) to for IC6. The outputs of IC6 advance by by setting switches S3 and S4 used in
provide clock of one pulse per minute. The one count at hourly intervals. However, conjunction with transistors T3 and T4
7-segment displays for indicating minutes when Q6 output of IC6 goes high, IC6 is and NAND gates N1 through N3. Position
are driven by two decimal counter-cum- reset since Q6 output is fed to its reset 1 of switch S4 is used for alarm setting at
7-segment display driver CD4033B ICs pin via diode D3. This happens after 5 6th to 11th hour, while position 2 of switch
(IC4 and IC5). hours 59 minutes and IC6 starts counting S4 is used for alarm setting at 1st to 5th
IC4 and IC5 are wired as a divide- afresh. Simultaneously, Q output at pin 1 hour and 12th hour, in conjunction with
by-60 counter by connecting the ANDed of IC2, which was high earlier, toggles to setting of switch S4 to appropriate hour
e, f, and g segment outputs of tens counter low state as Q6 output of IC6 clocks IC2 position as marked on the rotary switch
(IC5) to the reset inputs of both IC4 and via diode D4. Thus Q and Q outputs of (The wiring of rotary switch S3 is shown
IC5. The output of IC4 (units counter for section 2 of IC2 keep toggling every six in a box within the figure.) At the selected
minutes) is divided by six in IC5 (tens hours. These outputs are used to drive hour, the collectors of transistors T3 and
counter). The e, f, and g segment outputs transistors T1 and T2, respectively, T4 go high to enable NAND gate N1. Once
of IC5 are high only when the count which, on conduction, provide ground path enabled, the inverted positive output of
reaches 6. Three diodes are used to AND for two sets of hour LEDs. Thus six LEDs NAND gate N2 charges up capacitor C2
the e, f, and g segment outputs to instantly connected to the collector of transistor T2 slowly to sound the piezobuzzer for about
reset the units and tens counters, and light up sequentially at hourly interval, 10 seconds. Transistors T3 and T4 serve
thus the display after the digit ‘59’ is ‘00’ followed by the next six LEDs during the to isolate the common-cathode junctions
and not ‘60’. next six hours. Thus we get display of of the two sets of LEDs, which is essential
The decade counter 4017B (IC6) is twelve hour LEDs sequentially at hourly for proper working of the hours counter.
wired as a divide-by-12 counter by making interval. These LEDs are used for the The power-on reset circuit comprising
use of the second half of the dual JK flip- 12-hour display. capacitor C2 and resistor R3 resets the
flop 4027B (IC2). Since counter IC6 can The fast setting of time is achieved by hour counter (IC6) to its initial state at
count up to 10, the second half of IC2 is making use of 1Hz pulses in conjunction power on.

Automated Traffic Signal


Controller
Vikram Banerjee
Mrinal Kanti Mandal
Dr Anirudha Ghosal

T
his automated traffic signal manually when desired. signals is 8:56 (= 1:7), while for pedestri-
controller can be made by The time period for which green, yel- ans crossing the road the ratio of green
suitably pro-gramming a GAL de- low, and red traffic signals remain ‘on’ and red signals is 16:48 (= 2:6).
vice. Its main features are: (and then repeat) for the straight mov- In Table II (as well as Table I) X, Y,
1. The controller assumes equal traffic ing traffic is divided into eight units of 8 and Z are used as binary variables to
density on all the roads. seconds (or multiples thereof) each. Fig. 1 depict the eight states of 8 seconds each.
2. In most automated traffic signals shows the flow of traffic in all permissible Letters A through H indicate the left and
the free left-turn condition is provided directions during the eight time units of right halves of the roads in four direc-
throughout the entire signal period, which 8 seconds each. For the left- and right- tions as shown in Fig. 1. Two letters with
poses difficulties to the pedestrians in turning traffic and pedestrians crossing a dash in between indicate the direction
crossing the road, especially when the traf- from north to south, south to north, east of permissible movement from a road.
fic density is high. This controller allows to west, and west to east, only green and Straight direction is indicated by St, while
the pedestrians to safely cross the road red signals are used. left and right turns are indicated by Lt
during certain periods. Table I shows the simultaneous and Rt, respectively.
3. The controller uses digital logic, states of the signals for all the traffic. The Boolean functions for all the
which can be easily implemented by using Each row represents the status of a sig-nal conditions are shown in Table II.
logic gates. signal for 8 seconds. As can be observed The left-and the right-turn signals for
4. The controller is a generalised one from the table, the ratio of green, yel- the traffic have the same state, i.e. both
and can be used for different roads with low, and red signals is 16:8:40 (= 2:1:5) are red or green for the same duration,
slight modification. for the straight moving traffic. For the so their Boolean functions are identical
5. The control can also be exercised turning traffic the ratio of green and red and they should be connected to the same

ELECTRONICS PROJECTS Vol. 23 177


Fig. 1: Flow of traffic in all possible directions

Table I
Simultaneous States of Signals for All the Traffic
X Y Z B-C/B-G B-E D-E/D-A D-G F-G/F-C F-A H-A/H-E HC WALK WALK
Lt/Rt St Lt/Rt St Lt/Rt St Lt/Rt St (N-S)/(S-N) (E-W)/(W-E)
0 0 0 R R R R G G R R R R
0 0 1 R G R R R G R R G R
0 1 0 R G R R R Y R R G R
0 1 1 G Y R R R R R R R R
1 0 0 R R R R R R G G R R
1 0 1 R R R G R R R G R G
1 1 0 R R R G R R R Y R G
1 1 1 R R G Y R R R R R R

control output.
The circuit diagram for realising
Table II these Boolean functions is shown in Fig.
Boolean Functions for All the Signal Conditions 2. Timer 555 (IC1) is wired as an astable
Signal Reference Boolean functions multivibrator to generate clock signal for
the 4-bit counter 74160 (IC2). The time
Green B-C(Lt)/B-G (Rt) X’YZ
duration of IC1 can be adjusted by vary-
Green B-E (St) XYZ’ + X’Y’Z
ing the value of resistor R1, resistor R2,or
Red B-E (St) X+Y’Y’Z’
capacitor C2 of the clock circuit. The ‘on’
Yellow B-E (St) X’YZ
time duration T is given by the fol lowing
Green D-E (Lt)/D-A (Rt) XYZ
relationship:
Green D-G (St) XYZ ’ + XY’Z
T = 0.695C2(R1+R2)
Red D-G (St) X’+XY’Z’
IC2 is wired as a 3-bit binary counter
Yellow D-G (St) XYZ
by connecting its Q3 output to reset pin
Green F-G(Lt)/F-C (Rt) X’Y’Z’
1 via inverter N1. Binary outputs Q2,
Green F-A (St) X’Y’
Q1, and Q0 form variables X, Y, and Z,
Red F-A (St) X+X’YZ
respectively. These outputs, along with
Yellow F-A (St) X’YZ’
their complimentary outputs X’, Y’, and
Green H-A (Lt)/H-E (Rt) XY’Z’
Z’, respectively, are used as inputs to the
Green H-C (St) XY’
rest of the logic circuit to realise various
Red H-C (St) X’ + XYZ
outputs satisfying Table I.
Yellow H-C (St) XYZ’
You can simulate various traffic lights
Green Walk (N-S/S-N) X’YZ’ + X’Y’Z
using green, yellow, and red LEDs and
Green Walk (E-W/W-E) XYZ’ + XY’Z
feed the outputs of the circuit to respec-
Note. X’, Y’, and Z’ denote complements of variables X, Y, and Z, respectively.
tive LEDs via current-limiting resistors

178 ELECTRONICS PROJECTS Vol. 23


of 470 ohms each to check the working Table III
of the circuit. Here, for turning traffic Execution Results of Software Program
and pedestrians crossing the road,
SIG-B SIG-D SIF-F SIG-H WALK(N-S) WALK(E-W)
only green signal is made available. It
means that for the remaining period these G G R Y G G R Y G G R Y G G R Y G R GR
signals have to be treated as ‘red’. 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 01
In practice, the outputs of Fig. 2
0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 01
should be connected to solidstate relays
to operate high-power bulbs. Further, if a 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 01
particular signal condition (such as turn- 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 1 01
ing signal) is not applicable to a given 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 01
road, the output of that signal condition 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 10
should be connected to green signal of the
0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 1 10
next state (refer Table I).
The traffic signals can also be control- 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 1 01
led manually, if desired. Any signal state Note. The first column under G (green) in each group of four signals indicates the turn signal,
can be established by entering the binary while the next three columns under GRY indicate signal for the straight traffic.
value corresponding to that particular
state into the parallel input pins of the A software program to verify the func- the next row of results. The test results
3-bit counter. Similarly, the signal can be tioning of the circuit using a PC is given on execution of the program is shown in
reset at any time by providing logic 0 at below. (Source code and executable file Table III.
the reset pin (pin 1) of the counter using are provided in CD. When executing the
an external switch. program, keep pressing Enter key to get

Fig. 2: The circuit diagram for traffic light signalling

ELECTRONICS PROJECTS Vol. 23 179


traffic.c
#include<stdio.h> c=(seq&1);b=(seq&2)>>1;a=(seq&4)>>2; %d\n”,
#include<conio.h> green_bl=and3(not(a),b,c); green_bl,green_bs,red_bs,yellow_bs,
#define TRUE 1 green_bs=or2(and3(not(a),b,not(c)),and3(not green_dl,green_ds,red_ds,yellow_ds,
#define False 0 (a),not(b),c)); green_fl,green_fs,red_fs,yellow_fs,
red_bs=or2(a,and3(not(a),not(b),not(c))); green_hl,green_hs,red_hs,yellow_hs,
int not(int x); yellow_bs=and3(not(a),b,c); walk_ns,stop_ns,
int or2(int x,int y); green_dl=and3(a,b,c); walk_ew,stop_ew);
int or3(int x,int y,int z); green_ds=or2(and3(a,b,not(c)),and3(a,not( getch();
int and2(int x,int y); b),c)); }
int and3(int x,int y,int z); red_ds=or2(not(a),and3(a,not(b),not(c))); return;
}
int main(void) yellow_ds=and3(a,b,c); int and2(int x,int y)
{ green_fl=and3(not(a),not(b),not(c)); {
int a,b,c; green_fs=and2(not(a),not(b)); return(x && y);
int seq,green_bl,green_bs,red_bs,yellow_bs; }
red_fs=or2(a,and3(not(a),b,c));
int and3(int x,int y,int z)
int green_dl,green_ds,red_ds,yellow_ds; yellow_fs=and3(not(a),b,not(c)); {
int green_fl,green_fs,red_fs,yellow_fs; green_hl=and3(a,not(b),not(c)); return(x && y && z);
int green_hl,green_hs,red_hs,yellow_hs; green_hs=and2(a,not(b)); }
int or2(int x,int y)
int walk_ns,stop_ns; red_hs=or2(not(a),and3(a,b,c)); {
int walk_ew,stop_ew; yellow_hs=and3(a,b,not(c)); return(x || y);
walk_ns=green_bs; }
clrscr(); int or3(int x,int y,int z)
stop_ns=or3(and3(not(a),not(b),not(c)),and3( {
printf(“ SIG-B SIG-D SIF-F SIG-H not(a),b,c),a); return(x || y || z);
WALK(N-S) WALK(E-W)\n”); walk_ew=green_ds; }
printf(“G G R Y G G R Y G G R Y G G R Y int not(int x)
stop_ew=or3(not(a),and3(a,b,c),and3(a,not(
{
GR G R\n”); b),not(c))); return(!x);
printf(“%d %d %d %d %d %d %d %d %d }
for(seq=0;seq<8;seq++)
%d %d %d %d %d %d %d %d %d %d
{

Flashing Beacon
Ashok K. Doctor

A
flashing beacon has many uses. rent. Since the IC has
It can be employed as a distress an inbuilt switch-on
sig-nal on highways or as a direc- current limiter, it ex-
tion pointer for parking lots, hospi-tals, tends the bulb life.
hotels, etc. Here we present a flashing For the shown val-
beacon that uses well-known regulator IC ues of resistors and
LM317T. As LM317T regulator can deliver capacitors, the bulb
more than 1 amp. A small 12V, 10W bulb flashes at approxi-
with a high-quality reflector can serve as mately 4 cycles per
a good visible blinker. second. The number
A 12-15V, 1A DC supply is connected of flashes depends on
to the input pin of the IC. A 12V, 10W the charge-discharge
bulb and a combination of resistors and time of the capacitors.
capacitors are connected between the out- Different values of
put pin and ADJ pin of the IC as shown resistors and capacitors
in the figure. The IC is provided with an can be used to increase
aluminium heat-sink to dissipate the or decrease the number
heat generated while delivering full cur- of flashes.

180 ELECTRONICS PROJECTS Vol. 23


Knock Alarm
Pradeep G.

T
his circuit (Fig. 1), used in conjunc- is wired as an astable multivibrator. time that capacitor C5 connected between
tion with a thin piezoelectric plate, Whenever the collector of transistor T6 the emitter of transistor T4 and ground
senses the vibration generated on goes high, the astable multivibrator takes to discharge after a knock. The

Fig. 1: The circuit of knock alarm

knocking a surface (such as a door or


a table) to activate the alarm. It uses
readily-available, low-cost components
and can also be used to safeguard motor
vehicles. The piezoelectric plate is used
as the sensor. It is the same as used
in ordinary piezobuzzers and is easily
available in the market.
The piezoelectric plate can convert
any mechanical vibration into electrical
variation. As it doesn’t sense sound from a
distance like a microphone, it avoids false
triggering. The plate can be fixed on a door,
cash box, cupboard, etc using adhesive. A
1-1.5m long, shielded wire is connected
between the sensor plate and the input
of the circuit. When someone knocks on
the door, the piezoelectric sensor Fig. 2: Proposed installation of knock alarm
generates an electrical signal, which
is amplified by transistors T1 through activates to sound an alarm through time delay can be changed by changing
T3. the speaker. The value of resistor R12 is the value of capacitor C5. After about
The amplified signal is rectified chosen between 220 and 680 ohms such 10 seconds, the alarm is automatically
and filtered to produce a low-level DC that IC1 remains inactive in the absence reset.
voltage, which is further amplified by the of any perceptible knock. The circuit operates off a 9V or a
remaining transistors. The final output When the circuit receives an input 12V battery eliminator. The proposed
from the collector of pnp transistor T6 signal due to knocking, the alarm gets installa-tion of the knock alarm is
is applied to reset pin 4 of 555 (IC1) that activated for about 10 seconds. This is the shown in Fig. 2.

ELECTRONICS PROJECTS Vol. 23 181


Crystal-Controlled VFO for
40m Amateur Radio
D. Prabakaran

V
ariable frequency oscillators tuned circuit components and the degree depends on the following:
(VFOs) are used in amateur radio of regulation of the power supply. • Inductance of coil L1.
transmit-ters for carrier Here’s the circuit of a crystal-controlled • Crystal quality; HC6/U crystals are
generation. VFOs used in home-brew VFO for 40-meter band that overcomes recommended.
equipment are based on bipolar and field- the shortcomings of LC tuned VFOs and For L1 you may use the primary of a
effect transistors, wherein the stability of provides a comparatively stable RF source. short-wave (band 2) oscillator coil. Using
the VFO is governed by the quality of the In order to achieve accurate operating a 44µH inductor for L1, you can obtain
frequency of the RF oscillator, a good frequency shift. Note that the
it uses a quartz crystal as the frequency allotted to ham radio in 40m
main frequency-determining segment lies between 7000 kHz and 7100
element. kHz. XTAL1 and XTAL2 are 7000kHz
By adding an inductor (7MHz) quartz crystals.
and a variable capacitor in Variable condenser VC1 provides
series with the crystal, one main tuning control up to 7045 kHz for
can manage to get a slight the VFO, for an optimum selection of
frequency swing of 10 to 15 the crystal and the inductor. The swing
kHz. By adding a second increases greatly with crystal frequency;
crystal in parallel to the for example, two 10MHz crystals could
first crystal, you can obtain provide a stable swing of 90 kHz, while
a frequency swing of up 3.58MHz crystal could provide only
to 50 kHz. The frequency around 4kHz swing.
swing provided by the crystal

PC-BASED OSCILLOSCOPE
M.M. VijaI Anand

T his circuit conditions different sig-


nals of frequency below 1 kHz and
displays their waveforms on the PC’s
input to the ADC. During positive half
cycle, diode D3 is on and diode D4 is off,
and op-amps A1 and A2 act as inverters.
symmetry of the analogue signal dis-
played in the PC monitor gets affected.
At the zero-crossing instant when the
screen. The hardware is used to condition Thus the output is a replica of the input. input signal transits to negative side, the
the input waveform and convert it to the During the negative half cycle, diode zero-crossing detector informs the PC by
digital format for interfacing to the PC. The D3 is off and diode D4 is on. With taking pin 15 of 25-pin ‘D’ connector of
software for acquiring the data into the PC R2=R3=R4=R5=R6=R=330 ohms, the volt- the parallel port high. The input at pin
and displaying the same on its screen is age (V) at output pin1 of op-amp A1 is re- 15 of ‘D’ connector goes low when the
written in Turbo C. lated to the input voltage (Vi) as follows: input signal transits to positive side.
The input waveform (limited to 5V Vi / R +V / (2R) + V / R=0 The zero-crossing detector communicates
peak-to-peak) is first applied to a full-wave V= -(2/3)Vi with the PC through bit D3 of the status
rectifier comprising op-amps A1 and A2 The final output voltage (Vo) at pin port 379Hex.
of quad op-amp LM324 (IC4) and a zero- 7 of op-amp A2 is given by the following The zero-crossing detector has been
crossing detector built around LM3914 relationship: realised using LM3914 IC. You may adjust
dot/bar display driver (IC8) simultane- Vo = (1+R / 2R) (-2Vi / 3) = -Vi VR1 such that the last LED (LED10) goes
ously. As Vi is negative, the output voltage is off when the input signal transits negative
The full-wave rectifier rectifies the positive. side of the input waveform. The LM3914
input signal such that the negative half The zero-crossing detector detects itself rectifies the input signal and allows
cycle of the input signal is available in the whether the cycle is positive or nega- only positive half of the cycle.
positive side itself, so both the half cycles tive. It is the most critical part of the The output from the full-wave recti-
are read as positive when it is given as circuit and if it operates improperly, the fier is applied to the input of a sample-

182 ELECTRONICS PROJECTS Vol. 23


and-hold circuit comprising op-amps A3 voltage with a loss of about 20 mV/sec Pin 3 (WR): This active-low pin is used
and A4 of the LM324 (IC5), capacitor C3, and this voltage is given to input pin 6 to start the conversion.
transistor T1 (SL100), and analogue switch of the ADC0804 (IC3) via buffer A4 for Pin 9 (Vref/2): This is optional input
IC6 (CD4016). This circuit samples the conversion to the digital format. When pin. It is used only when the input signal
input signal, i.e. it divides the waveform the number of sampling points in the range is small. When pin 9 is at 2V, the
into a number of voltages or points and input signal waveform is increased, the range is 0-4V, i.e. twice the voltage at
inputs each voltage level (with a delay) reconstructed waveform becomes more pin 9.
to the ADC for conversion into the digital accurate. Pin 6 (V+), Pin 7(V-): The actual input
format. Op-amps A3 and A4, along with The ADC0804 is compatible with mi- is the difference in voltages applied to
a switch from IC CD4016 and a 1500pF croprocessors. It is a 20-pin IC that works these pins. The analogue input can range
capacitor with sampling time of 20 µs, are with 5V supply. It converts the analogue from 0 to 5V.
used as voltage followers/buffers. input voltage to 8-bit digital output. The In this circuit, pins 1 and 2 are always
When the base of transistor T1 is data bus is tristate buffered. With eight made low, so the IC and the buses are al-
made low via strobe pin 1 (bit Do of I/O bits, the resolution is 5V/255 = 19.6 mV. ways enabled. Pin 9 is made open, as we
port 37A) of 25-pin D connector of the par- The inbuilt clock generator circuit use analogue input with 0-5V range. Pin
allel port, the transistor stops conducting produces a frequency of about 640 kHz 7 is grounded.
and the voltage at its collector goes high. with R1=10 kilo-ohms and C4=150 pF, Pin 5 (INTR): This active-low pin
The high voltage at the collector of transis- which are the externally connected timing indicates the end of conversion. It is
tor T1 closes the switch inside CD4016. As components. The conversion time obtained connected to pin 17 (bit D3 of I/O port
a consequence, the analogue input signal is approximately 100 µs. The functions of 37A) of ‘D’ connector. (Note that this
is applied to the capacitor, which charges other pins are given below: bit is inverted.)
towards the signal voltage. Pin 1 (CS): This is active-low chip- The start-of-conversion command via
When the switch is subsequently select pin. pin 16 of ‘D’ connector is applied to pin 3 of
opened by applying a logic-high voltage Pin 2 (RD): This active-low pin enables the ADC0804. Since we cannot read 8-bit
from pin 1 of ‘D’ connector to the base of the digital output buffers. When high, the digital data output from ADC through
transistor T1, the capacitor retains the 8-bit bus will be in Hi-Z state. the 4-bit status port at a time, we divide

ELECTRONICS PROJECTS Vol. 23 183


Printer Data port Status port control port address is 0x037a.
Control port conversion time is approximately 100 µs.
LPT1 0x0378 0x0379 0x037a
The port addresses for parallel After the conversion is over, the
LPT2 0x0278 0x0279 0x027a
ports are summarised below: 8-bit binary data for the specific voltage
LPT3 0x03bc 0x03bd 0x03be
(EFY Lab note. For details sample is available in the data bus of the
of the parallel port pins, refer ‘PC- ADC. Since the PC accepts only 4-bit data
it in two 4-bit parts and read. Hence the based Dial Clock with Timer’ project through the status port (379H), the 8-bit
ADC data output is multiplexed through published in Electronics Projects Vol. 23). data must be split into two 4-bit data,
two 4-bit sections of octal buffers of IC1 The software, written in C program- which are accepted one after another. This
(74244) with the help of output-enable ming language, is user-friendly and easy- is done by IC 74244, which is controlled by
signals from pins 2 and 9 of ‘D’ connector to-understand. It gets data from the devel- D0 and D7 bits of the data port. Then the
to pins 1 and 19 (OE1 and OE2, respec- oped hardware circuit and displays it in two 4-bit data are packed to get the final
tively) of IC1. The digital data output the graphical screen with some changes. 8-bit data.
from IC1 is interfaced to the PC via pins The C program includes two user- The default BGI directory path
13 (D4), 12 (D5), 10 (D6), and 11 (D7) of defined functions with the main function: is set as ‘c:\tc\bgi’. The sampling
status input port 379H of ‘D’ connector. graphics( ) and settings( ). The settings( ) time is decided by the ‘for’ loop that
The circuit uses 9V and 5V regulated function is used to adjust the voltage and uses the samp value. The maximum
DC supply voltages as shown in the circuit time scale. The graphics( ) function is used delay produced should be greater
diagram. to display the waveform on the screen. The than 20 µs, which is the maximum
A PC printer port is an inexpensive sample control signal is used to close the acquisition time of the capacitor.
platform for implementing low-frequency switch in the sample-and-hold circuit, so When the sample value is increased,
data acquisition projects. Each printer the capacitor charges towards the analogue the number of points on the input
port consists of data, status, and control input voltage. After the sampling is over, signal decreases and therefore the
port addresses. These addresses are in the switch is opened using the same signal. accuracy decreases. The time scale
sequential order; for example, if the data Then the start-of-conversion control signal may be calibrated with 50Hz sine
port address is 0x0378, the corresponding is given to start the conversion. The sam- wave as reference.
status port address is 0x0379 and the pling time is approximately 20 µs and the

program in ‘c’ for pc oscilloscope


/* PROGRAM FOR PC OSCILLOSCOPE */ settextstyle(0,0,2);
/*by M.M.VIJAI ANAND B.E (E.E.E) C.I.T */ outportb(cont,0x05^0x0b); max=getmaxx();
#include<dos.h> outportb(cont,0x01^0x0b); may=getmaxy();
#include<time.h> outportb(cont,0x05^0x0b); may=may-20;
#include<stdio.h> while((inportb(cont)&0x08)==0x00) //converstion outtextxy(0,may,”OSCILLOSCOPE”);
#include <graphics.h> time is approximately 100 µsec settextstyle(0,0,1);
#include<string.h> { setcolor(BLUE);
#include<stdlib.h> } outtextxy(max-200,may+2,”press ‘a’ for next sam-
#define data 0x0378 ple”);
#define stat 0x0379 outportb(data,0xf0);
#define cont 0x037a a[i]=(inportb(stat)^0x80)&0xf0; setcolor(BROWN);
outportb(data,0x01); outtextxy(max-200,may+10,”press any key to
void graphics(int[],int[]); //FUNCTION TO DIS- b[i]=(inportb(stat)^0x80)&0xf0; exit”);
PLAY GRAPH AND WAVEFORM outportb(data,0xff); setcolor(GREEN);
} settextstyle(0,0,0);
void settings(); //FUNCTION TO CHANGE for(i=0;i<number;i++) for(a=0;a<=may;a+=get)
THE SETTINGS(TIME AND VOLT- { {line(0,a,800,a);
AGE) a[i]=a[i]>>4; }
c[i]=a[i]+b[i]; for(a=0;a<=max;a+=get)
long int samp=7000; //PLEASE CHECK THESE c[i]=c[i]*0.0196*45/scale; {
VALUES WHEN CONVERSION IS } line(a,0,a,may);
// NOT PROP- graphics(c,e); }
ER(+-3000) } setcolor(BROWN);
setlinestyle(0,3,0);
float scale=1; } line(max/2,0,max/2,may);
float times=1; line(0,may/2,max,may/2);
char again=’a’; void graphics(int a1[],int e1[]) setcolor(RED);
int number=800; { for(a=0,c=0;a<=max;a+=50,c++)
int gd=DETECT,gm,max,may,a,b,c,im,error,get=5; {
void main() putpixel(a,may/2,BLUE);
{ char str[10],*st=”-”,d; itoa((a-c*30)*times/2,str,10);
int i,j,k,a[1700],b[1700],c[1700],e[1700]; //This value outtextxy(a+3,may/2+3,str);
1700 is given when we want to compress the wave- clrscr(); }
form initgraph(&gd,&gm,”c:\\tc\\bgi”); //use for(b=(may/2)-45,c=1;b>=0;b-=45,c++)
//done when we compress the default bgi path {
time scale error=graphresult(); itoa((c*scale),str,10);
long int b1; if(error != grOk) putpixel((max/2),b,BLUE);
clrscr(); { outtextxy((max/2)+3,b+3,str);
settings(); printf(“Graphics error %s /n”,grapherrormsg(error)); }
while(again==’a’) //reports error when for(b=(may/2)+45,c=1;b<=800;b+=45,c++)
{ {
for(i=0;i<number;i++) //graphics is not set itoa((c*scale),str,10);
{ printf(“PRESS ANY KEY TO EXIT”); strcat(st,str);
outportb(cont,0x05^0x0b); getch(); putpixel((max/2),b,BLUE);
outportb(cont,0x04^0x0b); exit(1); outtextxy((max/2)+2,b+2,st);
e[i]=(inportb(stat)^0x80)&0x08; } strcpy(st,”-”);
for(b1=0;b1<=samp;b1++) //sampling time is setbkcolor(LIGHTCYAN); }
approximately 50 µsec setcolor(MAGENTA); setcolor(MAGENTA);
{} outtextxy(max-80,may/2+30,”time(msec)”);

184 ELECTRONICS PROJECTS Vol. 23


settextstyle(0,1,0); outtextxy(10,120,”DEFAULT :”); }
outtextxy((max/2)-10,0,”volt(s)”); outtextxy(10,120,” 1 unit = 1 volt”); }
setcolor(RED); }
setlinestyle(0,0,0); outtextxy(10,170,”TYPE ‘C’ TO CHANGE AND ‘D’ }
setcolor(RED); TO DEFAULT”); setcolor(BROWN);
moveto(0,may/2); c=getch(); outtextxy(10,380,”TYPE C TO CHANGE TIME SET-
for(b=0,c=0;b<=number;c+=1, b++) if(c==’c’) TINGS”);
{ { m=getch();
if(e1[b]!=0x08) outtextxy(10,200,”TYPE 1 for 1 unit = 2 volt”); if( m==’c’)
{ outtextxy(10,240,”TYPE 2 for 1 unit = 4 volt”); {
lineto(c*times,((may/2)-a1[b])); outtextxy(10,300,”TYPE 3 for user defined”); cleardevice();
} switch(getch()) outtextxy(10,20,”X AXIS 1 unit= 10msec CHANGE
else { TO x(10msec)”);
{ case ‘1’ : outtextxy(10,40,”TYPE ‘a’ IF x IS (2 to 9) ,’b’ IF x IS
lineto(c*times,((may/2)+a1[b])); { scale=2; (10 to 99) AND ‘c’ IF x IS (.5 TO .9)”);
} break; switch(getch())
} } {
again = getch(); case ‘2’ : case ‘a’:
closegraph(); {scale = 4; outtextxy(10,60,”x value is ....”);
restorecrtmode(); break; n[0]=getch();
} times=atoi(n);
} case ‘3’ : itoa(times,n,10);
{ outtextxy(10,70,n);
void settings() outtextxy(10,340,”TYPE VALUES FROM 1 TO 9 break;
{ (minimize) or m to (magnify)”); case ‘b’:
int gd=DETECT,gm,error,max,may,b; d=getch(); outtextxy(10,60,”x value is ....”);
char c,d,e[2],m,*n; if(d==’m’) n[0]=getch();
times=1; { n[1]=getch();
initgraph(&gd,&gm,”c:\\tc\\bgi”); //default bgi outtextxy(10,360,”TYPE a (1 unit = 0.5 volt) or b times=atoi(n);
directory path (1 unit = 0.25 volt)”); itoa(times,n,10);
error=graphresult(); switch(getch()) outtextxy(10,70,n);
if(error != grOk) { break;
{ case ‘a’:
printf(“Graphics error %s { case ‘c’:
/n”,grapherrormsg(error)); scale=0.5; outtextxy(10,60,”x value is...”);
printf(“PRESS ANY KEY TO EXIT”); break; getch();
getch(); } n[0]=getch();
exit(1); case ‘b’: times=atoi(n)*0.1;
} { outtextxy(10,70,”scale decremented”);
max=getmaxx(); scale=0.25; break;
setbkcolor(LIGHTBLUE); break; }
settextstyle(1,0,0); } number=800;
setcolor(BROWN); } if(times<1)
outtextxy(max/2-60,20,”SETTINGS”); } {number=number/times;
line(0,60,800,60); else }
setcolor(MAGENTA); { e[0]=’0'; getch();
settextstyle(1,0,1); e[1]= ‘0’; }
outtextxy((max/4)-70,80,”Voltage Scale”); e[2]=d; closegraph();
settextstyle(0,0,0); scale=atoi(e); restorecrtmode();
setcolor(BROWN); break; }

Readers’ comments Anand Owen upto 1KHz. To increase the input fre-
This 'PC Based Oscilloscope' article is a Through E-mail quency, we can use op-amps like LM318
good one. But nothing is mentioned about EFY : The author M.M. Vijai Anand with input frequencies more than 1 MHz.
the function of ten LEDs used in the cir- replies : The ten LEDs are used only to avoid the
cuit. Also, why is the range limited to 0-5V The op-amps used for rectification of AC ouput pins of LM3014 to be in floating
and 1KHz? signal in this circuit can withstand only levels.

Intruder radio alert System


David Nash Pious

C
onsider a situation where a message can then
burglar has entered your house be transmitted
and snapped the telephone wires, repeatedly with
leaving you with no means of comm- the help of an FM
unication with the outside world. In transmitter, in the
such an emergency, you will find this hope that some noble
intruder alarm to be very handy. It soul will hear it and
transmits a prerecorded emergency inform the police
message repeat-edly for reception by an about the incident.
FM receiver. The circuit
The message containing address, comprises a sound re-
geographical location, name, etc is cording-and-playback
recorded onto a chip. The prerecorded chip (UM5506BH). Fig. 1: Block diagram of the intruder radio alert system

ELECTRONICS PROJECTS Vol. 23 185


This chip consists of a 96kbit
SRAM and can record up to six
seconds of audio. (For details,
refer ‘Mini Voice Processor’
circuit published in April
2000 issue of EFY.) After the
required message has been
recorded, it is passed to a low-
power, VHF FM transmitter
wired around BC547 and
2N2369 transistors. The range
of this transmitter is 60 to 100
metres using a 40-70cm long
wire as an antenna.
The major advantage of
this circuit is its low power
consump-tion. The author
operated it on 3V button cells
(Maxell CR 2032, CR 2025,
etc used in digital diaries).
To transmit the prerecorded
message, the play button
is pressed repeatedly. The
transm-itted message can be
heard over the FM receiver.
A possible modification,
though it has legal
complications, is to vary
the coil inductance such
that the transmission is on
police band, thus alerting
the police for quick help.
Even the need of repeatedly
pressing play button can be
obviated by confi-guring an
astable multiviberator (using
IC 555 timer) to trigger IC
Fig. 2: Circuit diagram of intruder radio alert system UM5506BH every six seconds
so that the message is played repeatedly.

Readers’ comments replies : around 2N2369.


I need further information on Intruder Whenever a device has to be designed and In June 2000 issue there was an
Radio Alert System circuit. built, the place of need and operating  en- add-on circuit to increase RF level for
1. In the text, the author has men- vironments are taken into consideration increasing range to about 5 km. However,
tioned that the coil inductance can be var- first. In the case of Intruder Radio Alert please note that in order to use such high-
ied so that transmission is on the Police System the intention was to build a device power transmitters, the minimum re-
band. Please give the details of this coil as small as possible and as efficient in quired supply voltage is around 12 volts,
along with winding details. Also give the terms of power consumption as possible. which consequently increases the weight
frequency of the Police band.  Once you build the voice storage system, as well as cost of the project. This was
2. A range of 60 to 100 metres in you may couple some stages of RF ampli- one place where I had to make a com-
congested city environments won’t be suf- fiers after the FM transmitter, if you so promise.
ficient; hence I suggest that an RF power wish. Regarding the Police band transmis-
amplifier be added to the transmitter to Readers may refer to ‘Letters’ sec- sion, RF transmission laws are very strict
increase the range. tion in June 2000 issue regarding ‘Long in India, as in most other countries. Hence
3. Can I use ISD1420 or ISD1416 voice Range FM Transmitter’ by Pradeep G. one can land up behind bars for such a
recorder chip for long message recording He had built an efficient circuit which misadventure!
and playback? transmits to over 2 km. The circuit was Regarding use of ISD1416 or 1420,
A. Kartick Siddhartha originally published in Dec. ‘99 issue. I used UM5506BH for its low cost. One
Chennai Mr Siddhartha may connect this may experiment using VP1000 or even
EFY: The author David Nash Pious transmitter in place of the one wired ISD1420 or 1416.

186 ELECTRONICS PROJECTS Vol. 23


Automatic Porch Light with
Melody
D. Mohan Kumar

T
his simple, low-cost circuit of timing components (potmeter VR1 or comprising transistors T2 and T3. Triac
automati-cally switches on the capacitor C4). BT136 is used in the circuit to operate a
porch light when your car enters The condenser microphone picks up the 230V bulb of up to 500W rating. Resistor
the porch. The light remains on for sound signals from the horn and converts R5 regulates the gate current of the triac.

a predetermined time period and these to electrical signals. The electrical Assemble the circuit on a veroboard
automatically switches off. While signals are amplified by transistor and enclose it in a cabinet. Keep the
you park your vehicle safely, a sweet amplifier T1. During negative transition loudspeaker away from the microphone
melody can also be heard. of the signal at the collector of transistor to avoid undesired triggering. Be careful
The circuit is based on the popular T1, monostable IC1 is triggered and its while connecting and testing the circuit,
timer IC 555. In the circuit, sound is output pin 3 goes high to activate the as some parts of the circuit are at mains
converted to electrical signal, which is melody circuit and triac BT136. LED1 acts potential. The polarity of mains (live and
used for triggering the IC. Usually, trigger as a zener diode, reducing the voltage for neutral) should be the same as shown
pin 2 of the IC remains high. When pin 2 IC2 (UM66 melody generator) to 3.3V, a in the circuit. If IC1 shows unwanted
goes low, it triggers the monostable built safer level. triggering, connect a 4.7k resistor and
around IC 555. Once triggered, output pin The melody circuit is built around the 4.7µF electrolytic capacitor between its
3 of monostable IC1 goes high and stays well-known melody generator IC UM66. pin 4 and ground.
in this state for a known duration, which The musical tone generated by the IC Note. The circuit can be easily
can be controlled by varying the value is amplified by the transistor amplifier modified for use as a burglar alarm.

Melody Generator
Praveen Shanker

T
his melody generator circuit uses Here, NE555 (IC1) is used in astable repeating.
six NE555 timer ICs to produce mode to produce 1Hz clock for decade All the Q outputs of IC2 wired via
ten notes of your choice by counter CD4017 (IC2), which counts up series combinations of 47-kilo-ohm
adjusting various presets. It is also to 10, making its corresponding outputs presets VR2 through VR11 and fixed
possible to add two different special (Q0 to Q9) high for one-second duration 10-kilo-ohm resistors R4 through R13,
effects. each sequentially. The process keeps and diodes D1 through D10, to pin 7

ELECTRONICS PROJECTS Vol. 23 187


of IC3 allow individual adjustment certain limits. Thus if each series is connected to reset pin 4 (point A) of
of the frequency of astable IC3 for combination of 47-kilo-ohm preset and IC4 via switch S1. It provides a
one-second period each. The suggested 10-kilo-ohm fixed resistor is set for a special interrupting effect for the notes
frequencies at the output of IC3 different frequency, ten different notes at the output of IC4. IC6 is adjusted to
may be kept anywhere between 1.6 kHz will be available in the speaker provide an output frequency of 68 Hz
and 8 kHz. connected at the output of IC4. to 1.5 kHz (using VR14). When the
IC4, at the output of IC3, is wired IC5 and IC6 are used optionally for output of IC6 is connected to pin 5 (point
as a simple monostable. Its period can providing special effects. IC5 is wired to B) of IC4 via switch S2, it results in a
be varied with the help of VR12 within give 0.25-second pulses and its output pleasing sound effect.

188 ELECTRONICS PROJECTS Vol. 23

Das könnte Ihnen auch gefallen