Untitled
Untitled
25
© EFY Enterprises Pvt Ltd First Published in this Edition, January
2010
All rights reserved. No part of this book may be reproduced in any
form without the written permission of the publishers.
ISBN 978-81-88152-22-3
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: Shree Gobind Printers Y-56,
Okhla Phase 2, New Delhi 110020.
ELECTRONICS PROJECTS VOL. 25
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 published in Electronics For You magazines between 1979 and 1980.
2. Electronics Projects, Vol. 2 to 19: Yearly compilations (1981 to 1998) of interesting
and useful construction projects and circuit ideas published in Electronics For You.
1. Electronics For You (with CD): In regular publication since 1969, EFY is the natural
choice for the entire electronics fraternity, be it the businessmen, industry professionals
or hobbyists. From microcontrollers to DVD players, from PCB designing software to
UPS systems, all are covered every month in EFY.
2. Linux For You (with CD and DVD): Asia’s first magazine on Linux. Completely
dedicated to the Open Source community. Regular columns by Open Source evangelists.
With columns focused for newbies, power users and developers, LFYis religeously read
by IT implementers and CXOs every month.
3. Facts For You: Amonthly magazine on business and economic affairs. It aims to
update the top decision makers on key industry trends through its regular assortment of
Market Surveys and other important information.
4. BenefIT: A technology magazine for businessmen explaining how they can benefit
from IT.
5. Electronics Bazaar: A monthly B2B magazine for sourcing electronics components,
products and machineries. Ideal for buying decision makers and influencers from
electronics and non-electronics industry. For retail orders:
Kits‘n’Spares
D-88/5, Okhla Industrial Area, Phase-1, New Delhi 110020
Phone: 26371661, 26371662
E-mail: kits@efyindia.com Website: www.kitsnspares.com For magazine subscriptions:
FOREWORD
This volume of Electronics Projects is the twenty forth in the series
published by EFY Enterprises Pvt Ltd. It is a compilation of 23
construction projects and 66 circuit ideas published in ‘Electronics For
You’ magazine during 2004.
We are also including a CD with this volume, which not only contains the
datasheets of major components used in construction projects but also the
software source code and related files pertaining to various projects. This
will enable the reader to copy these files directly on to his PC and
compile/run the program as necessary, without 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 concerned articles. It is a sincere
endeavour on our part to make each project as error-free and
comprehensive as possible. However, EFY cannot take any responsibility
if readers are unable to make a circuit successfully, for whatever reason.
This collection of tested circuit ideas and construction projects in a handy
volume would provide all classes of electronics enthusiasts—be they
students, teachers, hobbyists or resource of electronic circuits, which ily-
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 confident that this volume, like its
predecessors, will generate tremendous interest amongst the readers.
professionals—with a valuable can be fabricated using read
CONTENTS
Section A: Construction Projects
n large establishments, such as ho tels and hospitals, intercoms and call bell systems are
essential for communication between inmates and the assisting staff. Intercom being a
costlier option, in many the relatively inexpensive call indication systems are preferred.
The call indication system gives an audio-visual indication of the call point (room or
cabin number).
In conventional call indication systems, different call points are connected to the
indication system via separate cables. This makes the installation complicated and
costly, especially when the number of calling points is quite large.
Here’s a simple and economical system for call point identification and display. The
system has the following features:
System overview
Fig. 1 shows block diagram of the call indication system. The system comprises different
call points connected to a control panel through a two-core shielded cable. The call
points are arranged in two circuits. The maximum number of call points connected per
circuit is 18. Thus a total of 36 call points can be connected. The
Fig. 2 shows connection of different call points arranged in two circuits. Table I shows
connection details for different numbers of call points on the same and different floors.
The hardware
Fig. 3 shows the microcontroller-based call indication system built around Motorola’s
MC68HC705J1A microcon-troller. The system comprises four main sections, namely,
call-point detection section, analogue-to-digital conversion (ADC) section, display
section and microcont-roller section.
The call-point detection section detects the key pressed from a call point. A fixed DC
voltage (decided by a resistor in series with the key) is transmitted to the
ADC section through the cable. The ADC section converts the analogue signal into
equivalent digital data. The microcontroller decodes the data and displays the call point
number accordingly.
The call-point detection section. The two-core shielded cable connects the call points
internally as well as to the control unit. A shielded cable is used because it reduces the
noise. Rext-1 through Rext-18 are the resistors in series with keys 1 through 18 (refer
Fig. 2). The values of resistors are the same for both call-point circuit-1 and call-point
circuit-2.
=V
ref
The ADC section. The potential drop across resistor R22 on pressing a key varies from
0 volt to 5.25 volts (refer Table II). This analogue voltage is converted into digital
equivalent by IC ADC0801 (IC2).
TABLE I
Suggested Call Point Numbering Mode Connection Details of Call Point
0 1. Connect call point circuit-1 output 001 to 036 to CON1 and CON2
2. Connect call point circuit-2 output
to CON3 and CON4
1 1. Connect call point circuit-1 output 001 to 018 to CON1 and CON2
2. CON3 and CON4 unused
internal successive approximation register (SAR) is reset, and the output lines go to
high-impedance state. When WR transits from low to high state, the conversion begins.
When the conversion is completed, the interrupt request line INTR is asserted low and
the data is placed on the output lines. The INTR signal can be used to know the
completion of conversion. When the data is read by asserting read line RD low, the
INTR is reset.
When Vcc is 5 volts, the input voltage (Vin(+)) can range from 0 to 5 volts and the
corresponding output is 00H to FFH. However, the full-scale output can be restricted to
a lower range of inputs by using pin Vref/2. The voltage at pin Vref/2 decides the
conversion step size.
The ADC continuously converts the analogue input into digital data. This minimises the
chances of malfunctioning when keys from two or more call points are simultaneously
pressed.
Table II gives the analogue voltage V0 and its digital equivalent for different call points.
When no key is pressed, V0 is nearly zero and its digital equivalent produced by the
ADC is 00D. When a key is pressed, the digital equivalent varies from 10D to 200 D
(refer Table II). This digital data is further processed by the microcontroller into the
equivalent call-point number.
The latch and display section. The display device is an interface between the user and
the machine. The call-point location information is displayed on three 7-segment
displays (DIS1 through DIS2) driven using the time-multiplexed technique. DIS1
displays the floor number, while DIS2 and DIS3 display the call point number.
PArTS LIST
Semiconductors:
Capacitors:
C1-C4, C6, C7 - 27pF ceramic disk
C11, C12 - 0.1µF ceramic disk C5 - 1000µF, 25V electrolytic C8 - 150pF ceramic disk
C9, C10 - 1µF, 16V electrolytic Miscellaneous:
X1 - 230V primary to 12V-0-12V,
All the three 7-segment displays share common input lines. Data entered share common
input lines. Data entered segment display. After a few milliseconds, the data for the first
digit is replaced by that of the next digit, but this time only the second display is enabled.
After all the digits are displayed in this way, the cycle repeats. Because of this repetition
at 100 times a second, there is an illusion that all the digits are being continuously
displayed. BCD-to-7-segment decoder/ driver 74LS47 (IC7) and 2N2907 (T1 through
T3) are used for driving the common-anode displays.
Port A of the microcontroller (IC1) is used for reading the ADC output as well as the
data display. Octal transparent latch 74LS373
(IC3) is used to avoid
the bus contention.
While refreshing the
displays, the latch
is made transpar
ent and the data
is displayed digit
wise. During this
per i od,thedata
lines of ADC0801
are in high-imped
ance state as RD and Fig. 4: Circuit diagram of power supply WR are high. Once
all the digits are refreshed, the latch
is made non-transparent. Now if there
is any change in the data line of the
ADC, it will not be reflected on the data
displayed.
10 ms. The timer interrupt generates the interrupt every 10 ms. The displays are
refreshed during the timer interrupt service routine.
Power supply. The power supply circuit is shown in Fig. 4. The AC mains supply is
stepped down by transformer X1 to deliver a secondary output o f 1 2 V - 0 1 2 V A C ,
300mA. The o u t p u t o f the transf o r m e r i s rectified by a full-wave r e c t i f i e r c
o m p r i s ing diodes D1 and D2 and filtered by capacitor C5. The direct +V o u t p u t i
s u s e d f o r IC LM324 (IC4) and the reference circuit, while the r e g u l a t e d 5 V f r
o m r e g u l a t o r I C 7 8 0 5 (IC8) powers the entire circuit excluding IC4 and the
reference circuit.
An actual-size, single-side PCB of Figs 3 and 4 is shown in Fig. 5, with its component
layout in Fig. 6.
TABLE II
rext Vo= 64×10kADC Equi D= Vo range of Call point (11.2k+rext)25×10-3 identification
number
The software
When you connect the pod to your host computer and target hardware, you can use the
actual inputs and outputs of the target system during simulation of the code. You can also
use the ISC05JW software to edit and assemble the code in standalone mode, without
input/output to/ from the pod. The pod (MC68HC705J1CS) can be interfaced to any IBM
computer running on Windows 3.x/Windows 9X using the serial port.
The software routines for the call bell indicator, along with their Assembly language
code, are given in Appendix ‘A’. The following functions are performed by the software
program:
Depending on the number of call points, connect the call points in a single circuit or
arrange them in two circuits. The display indication will vary accordingly.
Normally, the call points are in different rooms. Rext is the resistor that decides the call
point number. It is connected in series with the keys. For making the call, Bell-type push
switches are used. Resistor Rext is placed inside the switch. The change in call point
number can be implemented just by changing Rext.
EFY note. The software program Callnew.asm, along with the Callnew.S19 file and
relevant datasheet, are included in the CD.
An actual-size, single-side PCB of Figs 3 and 4 is shown in Fig. 5, with its component
layout in Fig. 6
callnew.aSm
callnew.asm Assembled with CASMW 10/17/03 10:33:13 AM PAGE 1
138
0800 139 copr equ $07f0
0800 140 copc equ 0
0800 141 copc. equ $01
142
0800 143 mor equ $07f1
0800 144 cop equ 0
0800 145 copen. equ $01
146
147 ******************************************** 07F1 148 org mor 07F1 01 149 fcb $01 ;Watchdog Timer
150 ********************************************** 0300 151 org $0300
152 * Crystal Frequency is 3.2768MHz.This gives the Internal Clock Frequency of
153 * Crystal Frequency/2 = 1.6384MHz.
154 * The Timer interrupt can be programmed to give interrupt after every 16,384,
155 * cycles by selecting rt1 and rt2 in timer status and control register.
156 * Here the Timer is programmed to provide an
interrupt after every 10 miliseconds.
157 * i.e. 16384 cycles.For this option rt0 = rt1 = 0.
158 ********************************************** 0300 [02] 9A 159 start cli ; clear interrupt 0301 [05] 1808
160 bset rtie,tscr ; Activate the Timer Interrupt. 0303 [05] 1308 161 bclr rt1,tscr
0305 [05] 1108 162 bclr rt0,tscr
163 **********************************************
164 * Initilization :-In initialization; the port pins are assigned as input or output
165 * as per the circuit connections.
166 * Port A pins are used for Display of data as well as for reading the ADC
167 * Data.
168 * Port B pins are used for controlling the ADC and Multiplexer.The Port B
169 * pins are connected as:
170 * Pb5: Read of ADC; Pb4 : Write of ADC; Pb3 : Interrupt from ADC;
171 * Pb2: For Channel Selection of 4051; Pb1 :Mode Selection;
172 * Pb0 : Latch Enable.
173 * Keep the display and Buzzer off initially.
174 ********************************************** 0307 [02] A6BF 175 InitA lda #%10111111
0309 [04] B700 176 sta porta
030B [02] A6FF 177 lda #%11111111
030D [04] B704 178 sta ddra ; Port A O/P
179
030F [02] A635 180 InitB lda #%110101 ; Pb5,Pb4,Pb2 and Pb0 in O/P Mode. 181 ; Pb3 and Pb1 in I/P
Mode.
0311 [04] B701 182 sta portb
0313 [02] A635 183 lda #%110101 ; RD,WR and Latch
Enable High,
0315 [04] B705 184 sta ddrb ; Latch Transparant
0317 [05] 1101 185 bclr Pb0,portb ; Latch Latched 186 ********************************************** 187 *
Clear : Clear all memory locations.Later the locations are used for storing the
188 * pending calls.
189 **********************************************
0319 [03] 4F 190 Clear1 clra ; Ram claring
031A [05] C707F0 191 sta copr ; Cick WatchDog Timer
031D [02] AEC0 192 Clear2 ldx #$c0
031F [04] F7 193 Clear3 sta ,x
0320 [03] 5C 194 incx
0321 [02] A3FF 195 cpx #$ff ; Check all the locations are cleared?
0323 [03] 25FA 196 blo clear3
0325 [04] F7 197 sta ,x
198 ********************************************** 199 * Assign : Assigns the memory location for storing the
recent and pending calls.
200 **********************************************
0326 [02] A6D3 201 Assign lda #$D3
0328 [04] B7C8 202 sta Address
032A [04] B7C9 203 sta Disp_Address
204 ********************************************** 205 * Identify : This part of the programm identifies the
location of calling point
206 * from the adc data. The module is 207 * the circuit1(adc_data1) output is analysed while in second part the
208 * the circuit2(adc_data2) output is analysed. 209 * The call point numbers will be stored in ram starting from
address
210 * D3 Hex.
211 * ADC data is compared with already stored calculated values and
212 * accordingly the calling Point destinatio
213 * The Calling Point destination will be 214 * 100 miliseconds.
215 *********************************************
032C [03] B6C8 216 Ident00 lda Address ; If Address=F6 indicates that all the
032E [02] A1F6 217 cmp #$F6 ; 36 memory locations are full
0330 [03] 230F 218 bls Ident03 ;
219
0332 [03] B6C9 220 Ident01 lda Disp_Address ; Wait till all the calling points
0334 [02] A1F6 221 cmp #$F6 ; are displayed.
0336 [03] 2203 222 bhi Ident02
0338 [03] CC03E5 223 jmp Mode00
224 ********************************************** 225 * When Disp_Address points the memory location F7,it
indicates that no call
226 * is pending and the addresss pointers are re-initia lised at starting address
227 * i.e. D3 hex.
228 **********************************************
033B [02] A6D3 229 Ident02 lda #$D3
033D [04] B7C8 230 sta Address
033F [04] B7C9 231 sta Disp_Address
232 ********************************************** 233 * Ident03 : Scan circuit1 output.
234 **********************************************
0341 [03] B6C6 235 Ident03 lda adc_data1 ; adc_data1 stores circuit1 output.
0343 [02] A107 236 cmp #!07
0345 [03] 2206 237 bhi Ident05
238
0347 [05] 3FCA 239 Ident04 clr Count1 ; No call is there.
0349 [05] 3FCC 240 clr Number1
034B [03] 2043 241 bra Ident20 ; Check other circuit 242 ********************************************** 243 *
Ident05 : Adc data is greater than 07,Check for the calling point number.
244 * The range of data for each calling point is stored at memory locations from
245 * 0700hex to 0712hex.
246 **********************************************
034D [03] 5F 247 Ident05 clrx ; Clear the Register X.Reg X acts as 248 ; memory pointer.
249
034E [03] 5C 250 Ident06 incx
251
034F [05] D60700 252 Ident07 lda $0700,x ; Check if the ciccuit1 output lies
0352 [03] B1C6 253 cmp adc_data1 ; in the range?
0354 [03] 2205 254 bhi Ident10 ; Range is found 255
0356 [02] A311 256 Ident08 cpx #!17 ; Is all the ranges are checked?
0358 [03] 25F4 257 blo Ident06
035A [03] 5C 258 Ident09 incx ; increment the memory pointer 259
*********************************************** 260 * Ident10 : The range in which the adc_data lies is 281
036D [05] 3FCC 282 Ident14 clr Number1 ; Key Press is different; start again. 036F [05] 3FCA 283 clr Count1
0371 [03] 201D 284 bra Ident20 ; Check the other circuit 285
0373 [03] B6CA 286 Ident15 lda Count1
0375 [02] A10A 287 cmp #!10
0377 [03] 2317 288 bls Ident20 ; 10 scannings are not over,check other circut.
289 ********************************************** 290 *Ident16 : If the Call point number is already stored, Do
not accept it again
291 *********************************************** 0379 [02] AED3 292 Ident16 ldx #$D3 ; Memory pointer
is initiated at D3hex 293
037B [03] F6 294 Ident17 lda ,x ; Check the data stored memory pointed by 037C [03] B1CC 295 cmp Number1 ; the
memory pointer. 037E [03] 270C 296 beq Ident19 ; The call point is already stored 297
0380 [03] 5C 298 Ident18 incx ; Increment the Memoty pointer 0381 [02] A3F6 299 cpx #$F6 ; Is it a last memory
location? 0383 [03] 23F6 300 bls Ident17
301 ************************************************ 302 * A fresh call is there,store the call point number in
ram
303 *********************************************** 0385 [03] B6CC 304 lda Number1 ; Number 1 stores the
call no.data 0387 [03] BEC8 305 ldx Address
0389 [04] F7 306 sta ,x
038A [05] 3CC8 307 inc Address
308 *********************************************** 309 * Ident19 : Get ready to read new data. 310
*********************************************** 038C [05] 3FCC 311 Ident19 clr Number1
038E [05] 3FCA 312 clr Count1
313 ********************************************** 314
*********************************************** 315 ***********************************************
316 * Ident20 : Scanning of Circuit2
317 * : The output of circuit2 is stored in adc_data2. 318 *********************************************** 0390
[03] B6C7 319 Ident20 lda adc_data2
0392 [02] A107 320 cmp #!07
0394 [03] 2206 321 bhi Ident22
322
0396 [05] 3FCB 323 Ident21 clr Count2
0398 [05] 3FCD 324 clr Number2
039A [03] 2049 325 bra Mode00 ; Check other circuit 326 *********************************************** 327
* Ident22 : Adc data is greater than 07,Check for the calling point number.
328 *********************************************** 039C [03] 5F 329 Ident22 clrx ; Clear the Register X 330
039D [03] 5C 331 Ident23 incx
332
039E [05] D60700 333 Ident24 lda $0700,x
03A1 [03] B1C7 334 cmp adc_data2
03A3 [03] 2205 335 bhi Ident26
336
03A5 [02] A311 337 Ident25 cpx #!17
03A7 [03] 25F4 338 blo Ident23
03A9 [03] 5C 339 incx
340 *********************************************** 341 * Ident26 : The range in which the adc_data lies is
363
03BB [02] 9F 364 Ident29 txa
03BC [02] AA80 365 ora #%10000000
03BE [03] B1CD 366 cmp Number2
03C0 [03] 2706 367 beq Ident31
368
03C2 [05] 3FCD 369 Ident30 clr Number2 ; Not valid key press 03C4 [05] 3FCB 370 clr Count2
03C6 [03] 201D 371 bra Mode00 ;
372
03C8 [03] B6CB 373 Ident31 lda Count2
03CA [02] A10A 374 cmp #!10
03CC [03] 2317 375 bls Mode00 ; 10 scannings are not finished.
376 ***********************************************
377 * Ident32 : If the Call point number is already stored, Do not accept it again
378 *********************************************** 03CE [02] AED3 379 Ident32 ldx #$D3
380
03D0 [03] F6 381 Ident33 lda ,x
03D1 [03] B1CD 382 cmp Number2
03D3 [03] 270C 383 beq Ident36
384
03D5 [03] 5C 385 Ident34 incx
03D6 [02] A3F6 386 cpx #$F6
03D8 [03] 23F6 387 bls Ident33
388
03DA [03] B6CD 389 Ident35 lda Number2 ; Number2 stores the call no.data 03DC [03] BEC8 390 ldx Address
03DE [04] F7 391 sta ,x
03DF [05] 3CC8 392 inc Address
393 ***********************************************
394 * Ident36 : The number is already stored in memory,Do not repeat it.
395 *********************************************** 03E1 [05] 3FCD 396 Ident36 clr Number2
03E3 [05] 3FCB 397 clr Count2
398 ************************************************
399 * Mode : This part of the programme reads the status of the Mode key.Accordingly
400 * the format of the display will be decided.
401 * For Mode 0: The Call Points will be displayed as 001 to 018 for circuit1
402 * and 019 to 036 for circuit2.
403 * For Mode 1: The call points will be displayed as 001 to 018 for circuit1 and
404 * and 101 to 118 for circuit2.
405 * Mode selector switch is connected to pin Pb1 of PortB.
406 *********************************************** 03E5 [05] 02012B 407 Mode00 brset Pb1,Portb,Mode07 ;
check is it a mode 1or 2.
408 ***********************************************
409 * Mode1 : Call points will be decided from 001 to 036
410 * Display the calling point number pointed by register Disp_Address.
411 *********************************************** 03E8 [03] BEC9 412 Mode01 ldx Disp_Address
03EA [03] F6 413 lda ,x
03EB [02] A100 414 cmp #!00 ; Is it 00?
03ED [03] 271C 415 beq Mode06
416 ***********************************************
417 * Mode02 : Data conditioning of circuit2 display.(Display 001 to 018)
418 *********************************************** 03EF [03] BEC9 419 Mode02 ldx Disp_Address
03F1 [03] F6 420 lda ,x
03F2 [04] B7CE 421 sta Data_Out1
422
03F4 [05] 0ECE06 423 Mode03 brset 7,Data_Out1,Mode05 ; Msb of the data decides whether
424 ; it is circuit1 or circuit2 data 03F7 [05] 3FCF 425 Mode04 clr Data_Out2 ;
03F9 [05] 1CD0 426 bset 6,Buzzer ; Buzzer on 03FB [03] 203B 427 bra Discon00
428 ***********************************************
429 * Mode05 : Data conditioning of circuit2 display.(Di splay 019 to 036)
430 *********************************************** 03FD [05] 1FCE 431 Mode05 bclr 7,Data_Out1
03FF [03] B6CE 432 lda Data_Out1
0401 [02] AB12 433 add #!18 ; Add 18 so that display will be from 19
0403 [04] B7CE 434 sta Data_Out1
0405 [05] 3FCF 435 clr Data_Out2
0407 [05] 1CD0 436 bset 6,Buzzer
0409 [03] 202D 437 bra Discon00
438 ***********************************************
439 * Mode06 : The data is 00.It indicates that no key press is found.
440 * Dispaly 000 and Buzzer off.
441 *********************************************** 040B [05] 3FCE 442 Mode06 clr Data_Out1
040D [05] 3FCF 443 clr Data_Out2
590 * Refreshing of Displays.
591 ************************************************ 04AB [02] A6BF 592 Disp00 lda #%10111111
04AD [03] BAD0 593 ora Buzzer
04AF [04] B700 594 sta Porta
04B1 [02] A6FF 595 lda #$ff
04B3 [04] B704 596 sta ddra ; Assign Porta in Output mode. 04B5 [05] 1001 597 bset Pb0,portb ; Make the Latch
transparant.
598 ************************************************ 599 * Disp01 : Refresh the digit1.Keep the digit1 on for 1
milisecond.
600 ************************************************ 04B7 [03] B6C3 601 Disp01 lda position_1 ; Digit 1
Display
ere’s an automatic water-level controller for overhead tanks. It uses an infrared (IR)
transmitter
and a receiver to control the operation of the centrifugal water pump. The pump
controller circuit is built around dual-timer IC NE556 and NAND gate CD4011. IC
NE556 contains equivalent of two NE555 timers. The IR transmitter transmits 38kHz
signals and relay driver transistor SL100 controls the motor operation.
The system
The automatic water-level controller comprises an electronic circuitry and a me
PArTS LIST
Semiconductors:
gate
IC4 - NE555 timer
D1, D2, D5 - 1N4001 rectifier diode D3, D4 - 1N4148 diode
LED1, LED2 - Infrared transmitter LED RX1-RX2 - Infrared receiver module
(TSOP1738)
T1 - SL100 npn transistor
Capacitors:
C1 - 1000µF, 25V electrolytic C2-C8 - 0.1µF ceramic disk
C9, C10 - 4.7µF, 16V electrolytic C11, C12 - 10µF, 16V electrolytic C13 - 100µF, 16V
electrolytic C14 - 0.001µF ceramic disk C15 - 0.01µF ceramic disk
Miscellaneous:
S1 - Push-to-on tactile switch X1 - 230V AC primary to 9V-0-9V,
500mA secondary
transformer
capillary
controller
Nizar P.i.
chanical capillary
arrangement.
Electronic
circuitry. Fig.
1 shows the cir
cuit of automatic
water-level con
troller. The com
ponents used in
this circuit are
l ow - cos tand
readily available
in the market.
The power supply
is built around a
9V-0-9V, 500mA
step-down trans
former (X1), rec
tifier comprising
diodes D1 and
D2, and a filter
capacitor (C1).
The 6V regulator
provides regulat
ed supply to the
circuit.
Boththe
timers of NE556
(IC2) are used in
the monostable
mo d e . T r i gge r
input pins 6 and
8 of IC2 are con
nected to output
pins F and E of
sensors RX1 and
RX2, respective
ly. (The capil
lary tube with
sensors arrange
ment is shown in
Fig. 3). Output
pins 5 and 9 of
IC2 are connect
ed to the inputs
of NAND gates
N3 and N4. The
outputs of NAND
gates N3 and N4
are further con
nected to the RS
flip-flop built around NAND gates N1 and N2.
Power supply terminals A and B are connected to +Vcc pins of RX1 and RX2 sensors
(marked A and B), respectively. If you don’t want to use a 9V battery for the transmitter
circuit, connect points G and D in the pump controller circuit to the respective points (G
and D) in the transmitter circuit.
Fig. 2 shows the transmitter circuit built around timer NE555. Timer NE555 (IC4) is
wired as an astable multivibrator producing a frequency of about 38 kHz. When switch
S1 is pressed, the circuit gets supply and the two infrared transmitter LEDs connected at
the output of IC4 transmit IR beams at a frequency of 38 kHz.
Mechanical capillary tube arrangement. The capillary tube arrangement with sensors
is shown in Fig. 3. IR transmitter LED1 and IR receiver sensor RX1 are connected face
to face both on the top and the bottom of the capillary tube. Using an adhesive, fix IR
receiver modules (TSOP1738) such that their front side is oriented towards IR
transmitters. A very-light-weight float made of an opaque material is placed into the
transparent capillary tube. It moves along the tube, depending on the level of water,
crossing IR beams from the top-level and bottom-level sensors on reaching the top and
bottom level limits. The capillary tube can be made of glass or any transparent material.
The sensor arrangement for the overhead tank is shown in Fig. 4.
or water is at the minimum level, and the motor turns on again.
In case of power failure, if the object was at D, E, C or B level at the time of power
failure, the motor will not start on power resumption. If it was at or below level A, the
motor starts on power resumption and starts filling the tank until the float reaches level
D.
Overhead tank
and reservoir auFig. 2: Transmitter circuittomation
In many houses, water is first stored in a reservoir at or near ground level and from there
it is pumped up to the overhead tank on the rooftop. People generally switch on the pump
when their
The two pairs of the IR LEDs and the IR receiver modules are used for the minimum
(empty) and the maximum (full) water level positions in the tanks.
When the moving object is at level A, the motor is switched on. At B and C levels also,
the motor remains on and water continues to fill the tank. When the float crosses the
upper IR beam to reach level D, the motor turns off, as the tank is full, and water supply
to the tank stops.
As the water is consumed, its level in the tank falls from D to E, C and then to B. At
these levels also, the motor remains ‘off.’ However, when the object crosses the lower
IR beam to reach level A, the system recognises that the tank is almost empty,
tank and the reservoir for automatic operation is shown in Fig. 5. It comprises two
similar arrangements of the pump controller circuit, transmitter circuit and capillary tube
assembly: one for the overhead tank and the other for the reservoir. In the capillary tube
arrangements, ‘M’ represents the top-level sensing unit and ‘N’ the bottom-level sensing
unit for the overhead tank. The connections of relays RL1 and RL2 to the pump are not
identical. This arrangement prevents the motor from working when the reservoir is
empty. The control circuit 2 recognises whether water is at the minimum level of the
reservoir or not.
When the reservoir is empty, the float crosses sensor N to interrupt the IR beams
emanating from it, which triggers IC2 at its pin 8. The triggering of IC2 makes its output
pin 9 high, which energises the relay (RL2) via IC3
taps go dry a n d s w i t c h it off when the overhead tank starts overflowing. In case the
reservoir is e m p t y a n d the motor is switched on, it may damage the motor.
The com
plete arrange
ment for the
o v e r h e a d Fig. 4: Placing of sensors in the overhead tank
and driver transistor SL100. Now the motor starts to fill the tank up to the maximum
level.
When the reservoir is full, the object crosses sensor M to interrupt the IR beams
emanating from it, which triggers IC2 at its pin 6. The triggering of IC2 makes its output
pin 5 high, which de-energises the relay (RL2) via IC3 and the driver transistor. Now the
motor turns off and relay RL2 provides mains supply to relay RL1 connected to the
control circuit 1 for the overhead tank.
X and Z distances (refer Fig. 5) in the sensor assembly depend on the height Y of the
tank/reservoir. The distance X should not be below 20 cm. Otherwise, the IR beams
from one sensor may interfere with IR
Fig. 5: The complete arrangement for the overhead tank and the reservoir for
automatic operation
Fig. 6: Actual-size single side PCB layout for the circuit in Fig. 1 Fig. 8: Actual-size,
single side PCB layout for the circuit in Fig. 2
Fig. 7: Component layout for the PCB of Fig. 6 Fig. 9: Component layout for the PCB
of Fig. 8
beams from the other sensor, af fecting the sensing operation. The complete
Fig. 10: Optional IR transmitter circuit the motor from high or low voltage, use a low-
/high-voltage cut-off circuit.
An actual-size, single-side PCB for the circuits in Fig. 1 and Fig. 2 is shown in Fig. 6
and Fig. 7 with its comp-onent layout in Fig. 8 and Fig. 9, respectively.
any circuits of water-level controller have appeared in EFY. What sets this circuit apart
from
all of them is that it shows the level of water far away from the location of the overhead
tank. Its other features include:
1. Up to five levels of water are in - dicated on LED display along with beep sound.
IC1-IC4, IC20 - CD4093 quad NAND gate IC5, IC6, IC11 - NE556 dual timer
IC7, IC17-IC19 - NE555 timer
IC8, IC9 - CD4066 quad analogue
switch
Capacitors:
C1-C5 - 10µF, 25V electrolytic C6-C15, C28,
C34-C41, C44,
C45, C50-C53,
C61-C66 - 0.1µF ceramic disk
C16-C20, C49 - 4.7µF, 25V electrolytic C21-C25, C31,
C32, C47, C48,
C56 - 0.01µF ceramic disk C26, C27, C55 - 100µF, 25V electrolytic C29, C30, C46 -
47µF, 25V electrolytic C33, C42, C43 - 1µF, 25V electrolytic C54, C58, C59 - 0.22µF
ceramic disk C57 - 0.47µF ceramic disk C60 - 1000µF, 25V electrolytic
Miscellaneous:
X1 - 230V AC primary to 7.5V0-7.5V, 1A secondary transformer
IC converts the received DTMF code into equivalent binary form. BCD-to-decimal
decoder CD4028B (IC14) converts this binary code into decimal. Its Q1 through Q5
outputs are connected to ‘D’ flip-flop CD4013 to control the motor and indicate water
level in the overhead tank through the LED. The present water level in the tank is
indicated by glowing of the respective LED. When the LED goes off, it means water in
the tank is below the indicated level.
Initially, when the power is switched on or the power resumes, all flip-flops of
CD4013B (IC15 and IC16), except one (whose reset pin 4 is connected to pin 6 of
IC14), are reset through the resistorcapacitor network at pins 4 and 10 of the two ICs.
Pins 1 and 2 of IC15 are connected to pin 6 of IC17 via capacitor C59 and the base of
transistor T2 via capacitor C46, respectively, to control the motor. The remaining flip-
flop of IC15 is wired in set/reset mode.
When water goes below the Empty level, the set input of IC15 (as per the received
signal) goes high to make outputs Q1 and Q1 high and low, respectively. The high Q1
output of IC15 energises relay RL1 and the motor is switched on automatically with the
help of IC17 and transistors T3 and T4; the motor is connected through the contacts of
relay RL1.
Q4. I have used 0.1pF and 0.01pF ceramic disk capacitors in place of 0.1µF and 0.01µF
capacitors. The vendor says these will do the job. Please give your suggestion.
Q5. If I switch on mains when the water tank is empty, what time will it take to scan and
start the motor relay?
a1. IC6 is getting heated due to some wrong connection around it or shorting of its two
adjacent pins. Check properly. If everything is okay; the power supply may be faulty.
Replace the transformer with one having a rating of 12-0-12V, 750 mA.
Similarly, PCB for Fig. 2 is shown in Fig. 6 with its component layout in Fig. 7.
Identical points (Q, R, S, T and U) terminated on connector/pads need to be connected
together using wire jumpers. 6V power supply including ground and DTMF output from
connector Con-3 in PCB-1 is to be connected to Con-3 on PCB-2. o
Readers’ comments:
Q1. IC6 (NE556) gets heated excessively within 5 to 6 seconds. As a result, I had to
stop at the very first stage of testing. Note that the manual ‘on’/‘off’ switch (S1) is
functioning properly.
Q2. When 12V power supply to the circuit is switched on, after 5 to 10 seconds, a ‘tick-
tick’ sound comes from the buzzer. Is it the sound of DTMF generated by IC10 when
scanning the water level?
Q3. In Fig. 2, what is the function of variable resistor VR1 (100k)?
a2. The ‘tick-tick’ sound is not a DTMF tone generated by IC10. It may be due to the
water level sensed by the probes (sensors) in the tank. So whenever the power to the
transmitter section is switched on, the tick-tick sound is heard after 3 to 4 seconds as the
level is scanned one by one.
a3. VR1 is used to adjust the time duration up to which the output of IC18 should remain
high. This output activates NAND gate N17 of the buzzer section.
a4. The values of 0.1pF and 0.01pF cannot be replaced with microfarads (µF). These
values are much less than microfarads. The values of ceramic or polyester capacitors are
always marked in picofarads (pF). For example, the values of ceramic capacitors
marked as 104 and 103 are read as 100,000 pF and 10,000 pF, respectively. But these
values can be converted into microfarad units. Thus, when converted into microfarad
units, 104 and 103 become 0.1 µF and 0.01 µF, respectively. (For conversion into
different units, please refer to page 24 of Q&A section in April 2004 issue.)
a5. The level-scanning section will take approx. 23 seconds to scan all the levels. This
time delay is provided by IC11 and R33 and C29. There is no predetermined time to
switch on the motor. One can do it at any time manually, or soon after switching on the
circuit. The water level is scanned only after the power to the circuit is switched on.
Pc-BaSed data logger
m. DeePak
H
through the parallel port of a PC. It uses a ‘C’ program for data acquisition and plotting a
voltage vs time graph on the monitor screen. This data logger can be used for automating
simple experiments in physics laboratories and or monitoring slowly varying physical
variables such as temperature in industries. Its range of operation, resolution and the
maximum data rate are –5V to +5V, 39.2 mV and 18 samples per second, respectively.
Power supply
and +5V, the outputs are 0V, +2.5V and +5V, respectively. The –5V at the inverting input
of IC5 shifts its output level to above 0V. Thus for a swing of input between –5V and
+5V, the output swings from 0 to +5V.
The output of the op-amp is applied to input pin 3 of IC6 (LF398). IC LF398 also
operates off +12V and –12V DC. It has a small acquisition time (10 ms) and less output
noise in hold mode. Droop
IC7
IC8
D1-D5 LED1
- 7812 +12V regulator
- 7805 +5V regulator
- 7912 –12V regulator
- 7905 –5V regulator
- OP-07 op-amp
- LF398 sample-and-hold amplifier
Capacitors:
Miscellaneous:
X1
X1
15V, 1A secondary step-down transformer
rate is low at 10-5V/ms with 0.01µF polypropylene hold capacitor C5 connected to its
pin 6. The control logic signal from pin 14 of the parallel port to pin 8 of this IC controls
sample and hold operation. Logic 1 puts the device in sample mode and logic 0 puts it in
hold mode. The output is obtained at pin 5 while pin 7 is grounded.
f = 1/1.1RC
The frequency of clock generation is set to approximately 610 kHz by resistor R8 (10
kilo-ohms) and capacitor C6 (150 pF). The ADC converts analogue signals in the range
of 0 to +5V to 8-bit digital data. The conversion time is approximately 100 ms.
The output of sample-and-hold IC6 at pin 5 is applied to the +IN (pin 6) of the ADC. The
–IN (pin 7) of the ADC is grounded. Positive 5V is applied to pin 20 and +2.5V is
applied to Vref/2 input (pin 9) of the ADC through divider network comprising resistors
R6 and R7 (each 1 kilo-ohm).
Fig. 4: Actual-size, single-side PCB conductor layout for PC-based data logger
Fig. 5: Component layout for the PCB
The ADC operation is controlled by chip-select (CS), read (RD) and write (WR) inputs.
Logic 0 on CS (pin 1) keeps the ADC enabled. Logic 0 on RD (pin 2) enables the
converted data to appear on digital output pins 11 through 18 of the ADC. The start-of-
conversion pulse is applied to WR (pin 3). When a low-to-high transition occurs on WR
pin, the ADC starts conversion. The interrupt INTR is used as end-of-conversion signal.
After the conversion is over, the INTR signal (pin 5) goes low. The INTR signal goes
high when the conversion starts and remains high during conversion. The signal is
inverted by IC8 and given to pin 10 of the parallel port, which provides the required
positive edge for generating hardware interrupt on end of conversion. When the INTR
output goes low, it indicates that A to D conversion is completed. Digital outputs D0
through D7 of the ADC are connected to data pins 2 through 9 of the parallel port,
respectively. Since the ADC converts analogue inputs in the range of 0 to +5V to 8-bit
digital data, the resolution of the ADC is 19.60 mV. (Resolution = Vref/counts, where
Vref is 5V and counts are 256 for 8-bit digital data.)
The ADC (IC7) and the sample-andhold IC (IC6) are controlled through the parallel port
of the PC. The input/output (I/O) addresses of data, status and control registers of the
parallel port LPT1 are 0378H, 0379H and 037AH, respectively. The data, status and
control bits are designated as Dn, Sn and Cn in the following discussion.
Pin details of the three registers of the parallel port are given in the table. The ‘n’ prefix
to the signal name denotes that the signal is active-low. IC LF398 is set to sample/hold
mode by setting C1 bit (pin 14) of the control register of the parallel port. Resetting C1
bit to low provides logic 1 and setting C1 bit to high provides logic 0 on the control
input (pin 8) of the LF398 as C1 bit is internally inverted and made available on pin 14
of the parallel port. Low-tohigh transition
of C2 bit that appears on pin 16 of the parallel port is applied to WR (pin 3) of the ADC
to initiate data conversion. The falling edge of INTR signal from the ADC, which is
inverted and applied to pin 10 of the parallel port, generates hardware interrupt thro-ugh
IRQ7 line (not shown in Fig. 1). On most systems, the IRQ7 line is used to drive the first
parallel port, normally for the use of a printer.
Control bit 4 (C4 ) of the control port is a PC output line. Making this bit high enables
the interrupt circuitry associated with the ACK input (pin 10) of the parallel port. The
parallel port is enabled to use IRQ7 line for interrupt by setting C4 bit of the control
register to high. Note that C4 bit is not associated with the parallel port connector, rather
it controls logic on the printer card or the PC motherboard.
The digitised data is read from the data register, which is configured to oper- ate in input
mode by setting C5 bit of the control register high.
The outputs for 1Hz squarewave and sinewave inputs with amplitudes of 4V and 5V,
respectively, are shown in Figs 2 and 3.
The actual-size, single-side PCB for PC-based data logger is shown in Fig. 4 and its
component layout in Fig. 5.
register Pin Details of the PC’s Parallel Port Parallel port pin No.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18-25
signal name Direction nStrobe Out Data0 In/Out Data1 In/Out Data2 In/Out Data3
In/Out Data4 In/Out Data5 In/Out Data6 In/Out Data7 In/Out nAck In Busy In
Paper-Out In Select In Linefeed Out nError In nInitialize Out nSelect-Printer Out Ground
—
register bit inverted Control-0 Yes Data-0 No Data-1 No Data-2 No Data-3 No Data-4
No Data-5 No Data-6 No Data-7 No Status-6 No Status-7 Yes Status-5 No Status-4 No
Control-1 Yes Status-3 No Control-2 No Control-3 Yes
——
Software program The IRQ0 interrupt provides timing
to start of conversion (at pin 16 of the The C program (datalog.c) acquires parallel port)
and the IRQ7 interrupt data at the rate of one sample per second provides timing to end
of conversion. The and plots a simulated time vs voltage system timer generates 18.2
IRQ0 intergraph on the monitor screen. It uses two rupts in one second. To set the
required interrupt service routines (ISRs): one is data rate, the counter is initialised with
invoked through IRQ0 (system timer) an appropriate value in the program; interrupt and
the other is invoked through here the counter is set to ‘18’. The ISR IRQ7 (parallel port)
interrupt. The ISRs for IRQ0 on each interrupt decrements are invoked by modifying the
respective the counter. When the counter reaches vectors in the interrupt vector table.
zero, the program sends start-of-converHowever, before calling up the ISRs of sion
pulse to the ADC. The ISR for IRQ7 application program to the interrupts, the sets a flag
to indicate that conversion existing vectors for the interrupts should is complete and the
digitised data may be read from interrupt vector table and be read from the data register.
Before saved. The ISRs are invoked when the providing start-of-conversion pulse, the
interrupt occurs, only if the interrupts sample-and-hold IC is set to hold mode. are
enabled. Similarly, after the digital data is read The priority interrupt controller that
from the data register, the sample-andoccupies addresses 0020H and 0021H hold IC is
set back to sample mode. in the system I/O map is programmed
to enable or disable the interrupts. The Execution of the programIRQ0
and IRQ7 interrupts are enabled
by resetting D0 and D7 bits of the interThe screen is initialised to graphics rupt mask
register at I/O address 0021H mode and a graphic chart is simulated. without affecting
interrupt masks of It requires the graphics initialiser file other IRQs. When an ISR is
invoked on EGAVGA.BGI to be in the directory C:\ an interrupt, the ISR should first ex-
TC\BGI\.
ecute the previous ISR which is chained The vectors of existing timer and to the
interrupt. At the end of the ISR, it parallel port ISR are saved in variis necessary to issue
an end-of-interrupt ables ‘oldintr’ and ‘oldtimer’ using the command to the interrupt
controller. It getvect(....) statements. The vectors of is issued by sending control byte
20H to ISRs of the application program, newintr() I/O address 0020H. Before
terminating and newtimer(), are loaded into the interthe application, the vectors are
restored rupt vector table using the setvect(....) into the vector table to restore the status
statements.
of the system. The status of interrupt masks is obtained and saved. The interrupt requests
IRQ0 and IRQ7 are enabled.
The variable count that determines the data rate is initialised to the required rate: 1, 2, 3,
6, 9 and 18 data samples per second, respectively.
The program then enters the main loop and keeps monitoring the timerflag and the intrflag
until a key is pressed. If the intrflag is 1, the program:
1. Reads the digitised data from the data register
2. Puts the sample-and-hold IC to sample mode by resetting C1 bit to low
3. Computes coordinates of the pixel corresponding to the data
4. Plots data point and draws a line joining the previous data point on the monitor screen
and completes acquisition and plotting of one data
5. Updates variables for acquiring next data
If the timerflag is 1, the program determines whether it is the time to issue SOC (start of
conversation) pulse. If so, the program:
1. Puts the sample-and-hold IC to hold mode by setting C1 bit to high
2. Issues start-of-conversion pulse by setting, resetting and setting C2 bit If a key is
pressed, the program restores interrupt mask and interrupt vectors, and terminates.
ISR for IRQ0 interrupt. The timer ISR performs the following tasks on each interrupt:
1. Calls the previous ISR in the chain
2. Enters 1 into the timerflag variable to indicate the main program that a timer interrupt
has occurred
3. Sends end-of-interrupt command to the interrupt controller
ISR for IRQ7 interrupt. The ISR for the IRQ7 interrupt performs the following tasks on
each interrupt:
1. Calls the previous ISR in the chain
2. Enters 1 into the intrflag variable to indicate the main program that an interrupt on
IRQ7 line has occurred
3. Sends end-of-interrupt command to the interrupt controller
Note. 1. The range of operation and the resolution can be improved by using 12-bit
ADCs operating on a wider range of analogue inputs (such as AD574A), but this will
make design of the system more complicated.
2. The data rate can be improved using a separate clock circuit on-board. However,
there is limit for the same as conversion time of the ADC is 100 ms.
void interrupt(*oldintr)(); void interrupt newintr(); void interrupt(*oldtimer)(); void interrupt newtimer(); void
drawchart();
outportb(CONT, inportb(CONT) & 0xfd);
void main() {
int count,i,time = 80,newvolt=0,oldvolt = 0; unsigned char d=0,intmask;
float yold,ynew;
int gd=DETECT,gm;
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");
oldintr = getvect(0x0f);
/* save vector of old ISR for IRQ7 */ setvect(0x0f,newintr);
/* load vector of new ISR for IRQ7 */ oldtimer = getvect(0x08);
/* save vector of old ISR for IRQ0 */
setvect(0x08,newtimer);
/* load vector of new ISR for IRQ7 */
intmask = inportb(0x21);
/* get the masking status of IRQ7 and IRQ0 */
intmask &= 0x7e;
outportb(0x21,intmask);
/* enable IRQ7 and IRQ0 interrupts */ intrflag=0; timerflag = 0; count = 18; do{ if(intrflag)
}}
}while(!kbhit());
/* acquire and plot the data till key is pressed */
intmask |= 0x80;
/* restore the status of interrupts */ outportb(0x21,intmask);
setvect(0x0f,oldintr);
} setvect(0x08,oldtimer);
getch();
closegraph();
/* terminate the program */ */ void drawchart()
/* simulate graphics chart */
int x;
float q;
char b[10];
settextstyle(0,0,1);
setcolor(3);
outtextxy(170,50,"DATA LOGGER - DATA
sprintf(b,"%+.1f",q-5.0); outtextxy(42,94+(10-q)*30,b); }
for(x=1;x<=8;x++)
/* draw x-axis graduation and calibration */
{
{
line(80+x*60,247,80+x*60,253); sprintf(b,"%d",x);
outtextxy(80+x*60,260,b);
}
}
Readers’ comments:
Q1. Does the ‘PC-based Data Logger’ accept 230V AC, 50 Hz as input and plot a
sinusoidal graph of 5V, 1Hz as the output on the screen? If the input voltage is less than
230V, will the output voltage be less than 5V? Please clarify.
}
if(timerflag)
*/ { timerflag = 0; count--;
if(!count)
{
ere’s a lift safety system that stops lift operation when the number of persons inside the
lift exceeds the lift capacity. It can be installed in factories or other large establishments
where lift is used. The circuit can also be used as visitor counter or room power control.
Fig. 1: Transmitter
Two transmitter and receiver pairs are used at the entry gate of the lift: one pair
comprising IR LED1 and IR RX1 is installed outside the gate, while the other pair
comprising IR LED2 and IR RX2 is installed inside the gate. Proper orientation of
receiver and transmitter pairs is very important. The display section displays the number
of persons inside the lift.
The circuit
of IC4 at its pin 3 is further given (via inverter N1) to pin 5 of IC7 for up-counting.
Capacitor C14 also gets charged by timer IC3 but there is no high output across diode
D4. So no pulse is available at pin 2 of IC5.
Similarly, when a person leaves the lift, timer IC3 gets triggered due to interruption of
the second beam and then timer IC2 gets triggered due to interruption of the first beam.
Triggering of timer IC3 charges capacitor C14 to drive transistor T2. At the same time, a
high output appears across diode D4 due to triggering of timer IC2. This high output is
used to trigger IC5. The high output of IC5 at its
pin 3 is further given (via inverter N2) to pin 4 of IC7 for down-counting. Capacitor C13
also gets charged by timer IC2 but there is no high output across diode D6. So there is no
pulse at pin 2 of IC4.
Thus, when a person enters the lift a high pulse is available at terminal A and LED3
blinks, and when a person leaves
3. The lift safety control section. Points A and B of the receiver circuit (Fig. 2) are
connected to the corresponding points of the lift s a f e t y c o n t o l circuit (Fig. 3). The
lift safety control section is built around up/down-counter IC 74LS192 (IC7), inverter
N3 and quad NAND gate
IC74LS00 (IC9).
The output of
NAND gate N6
is fed to relay
driver transistor
T3 for activating
the lift via N/O
contacts of relay
RL1 as shown in
Fig. 3. The relay
requires 12V to
operate.
This circuit
is designed for
a lift capacity
of nine persons
with safety limit
of five persons.
When the safety Fig. 5: Component layout of the PCB in Fig. 4
limit is crossed, i.e. the number of persons inside the room exceeds five, the lift con-
troller is switched off. When the number of persons inside the room reduces to five, the
lift control is restored as shown in Truth Table I.
The safety limit can be extended by changing the circuit’s logic part (comprising inverter
N3 and NAND gate IC9) accordingly.
TruTH Table I
Counter output of IC7 logic output at pin 3 of N6 Q3 Q2 Q1 = Q3.(Q1+Q2)
0001
0001
0011
0011
0101
0101
0110
0110
0000
1000
TruTH Table II
Counter output of IC7 Dec. logic output at pin 6 of N5 Q3 Q2 Q1 Q0 equ.=
(Q0.Q1.Q2.Q3)
(Fig. 3) sections is shown in Fig. 4 and its component layout in Fig. 5. The combined
PCB can be cut to separate the transmitter section from the rest of the PCB.
000000
000111
001021
001131
010041
010151
011061
011171
100081
100191
To replace the lift control circuit (Fig. 3) with the room power control circuit (Fig. 6),
simply remove the lift safety control circuit connected between points A and B of the
receiver (pulse generator) circuit. Now connect points A and B of the room power
control circuit to the corresponding points of the receiver circuit.
Fig. 6 shows the circuit for automatic room power control along with display. When
nobody is present in the room, the light in the room is automaticallly switched off. The
circuit consists of up-/downcounter 74LS192 (IC1), display driver 74LS47 (IC2),
common-anode display LTS542
(DIS1), inverter (IC3) and 4-input NAND gate (IC4). The output of NAND gate N5 is
conneted to relay driver transistor T1 for power control of the room via N/O contact of
relay RL1. The counter (IC1) counts up to 9. The 4-bit output of IC1 is inverted and fed
to the dual 4-input NAND gate (IC4). If all the four bits of IC1 (Q0 through Q3) are zero,
the output of IC4 is zero. Otherwise, the output of IC4 is high (logic 1).
When the output of IC4 is high, transistor T1 conducts to energise the relay, which
provides mains power supply to the room. Thus only when someone is
ParTs lIsT
Semiconductors:
IC1, IC2-IC5 - NE555 timer
IC6 - 74LS04 hex inverter IC7 - 74LS192 up/down decade
counter
7-segment display LTS542 (DIS1). The four BCD outputs (Q0 through Q3) of up/ down
counter IC7 are fed to decoder/driver IC8. The active-low outputs of the decoder are
connected to the corresponding pins of the 7-segment, common-anode display.
Construction
The circuit (excluding relay) works off a 5V regulated power supply. The actualsize,
single-side PCB for the lift safety control system comprising transmitter (Fig. 1),
receiver (Fig. 2) and lift control
R1, R2
R3, R4, R6
R5, R7
R8-R13, R15, R17, R18-R21 R24-R26
R14, R16
R22, R23
R27, R28
Capacitors:
C1, C2, C11, C12, C19, C20 C3, C5
C4, C6
C7, C8
C9, C10, C17, C18
C13, C14
C15, C16
Miscellaneous: Power supply
Relay
- 1.2-kilo-ohm
- 100-ohm
- 1-mega-ohm
- 10-kilo-ohm
- 4.7-kilo-ohm
- 1-kilo-ohm
- 470-ohm
inside the room, the NAND gate output will be high and hence the power supply of the
room will be ‘on.’ The logic (comprising IC3 and IC4) for maximum nine persons are
summarised in Truth
Fig. 7: Actual-size, single side PCB for automatic power control (Fig. 6)
Table II.
As the circuit uses IC 74LS192, it works only for rooms having a capacity of nine
persons. However, it can be made to work for rooms having a capacity of 15 persons by
using IC 74LS193 in place of IC 74LS192.
An actual-size, single-side PCB for the room power control circuit is shown in Fig. 7
and its component layout in Fig. 8. Points A and B marked on this PCB need to be
connected to the corresponding points in the PCB shown in Fig. 5.
Sound-operaTed on/oFF SwITch
PradeeP G.
M
ost sound-operated remote control devices use condenser microphone as the sensor.
Since
the microphone senses any sound or vibration, these remote controls may give a false
response. The sound is generated by clapping or you can use your voice to activate the
remote control. As the tone frequency generated through clapping or voice command is
not constant, designing a tuned receiver for an ordinary clap or voice-operated switch is
very difficult.
Here we’ve described a unique soundoperated on/off switch that responds only to a
particular frequency of sound (4.5 kHz). A suitable receiver can be easily designed to
receive and detect this tone. An electronic circuit is used to generate 4.5kHz audible
sound. The circuit works
T2, T3
T4
T5
T6
The sound-operated on/off switch comprises an electronic clapper (sound generator) and
a receiver unit to activate the relay.
Electronic clapper. Fig. 1 shows the block diagram of electronic clapper (sound
generator). It comprises tone generator, speaker driver and speaker sections.
The circuit of electronic clapper (Fig. 2) is built around phase-locked loop (PLL) tone
decoder LM567 (IC1). The voltage-controlled oscillator (VCO) section inside IC1 is
configured to generate 4.5kHz signals. A pnp transistor SK100 (T1) is used to drive an
8-ohm, 0.5-watt loudspeaker (LS1). In order to obtain identical waveshapes of the
signals, both the encoder (electronic clapper) and the
decoder (receiver) must use the same IC. This is the precise reason why we’ve used IC
LM567 in place of popular timer IC 555
Fig. 2: Circuit of electronic clapper (sound generator) Resistors (all ¼-watt, ±5%
carbon, unless stated otherwise):
R1, R3, R9, R13,
R15, R17, - 10-kilo-ohm
R2 - 1.8-kilo-ohm
R4 - 4.7-kilo-ohm
R5 - 560-kilo-ohm
R6, R16 - 2.2-kilo-ohm
R7 - 2.7-kilo-ohm
R8 - 680-ohm
R10 - 1-mega-ohm
R11 - 180-kilo-ohm
R12 - 100-kilo-ohm
R14 - 18-kilo-ohm
R18, R19,
R20 - 1-kilo-ohm
Capacitors:
C1, C6, C14 - 100µF, 16V electrolytic C2, C10 - 2.2µF, 16V electrolytic C3, C9 - 22nF
ceramic disk C4 - 0.01µF ceramic disk C5 - 56pF ceramic disk C7, C8, C16,
C17 - 0.1µF ceramic disk C11 - 4.7µF, 16V electrolytic C12 - 1µF, 16V electrolytic
C13 - 0.22µF ceramic disk C15 - 1000µF, 25V electrolytic
Miscellaneous:
Relay
S1
LS1
Battery
- 9V, 150-ohm
- Push-to-on tactile switch
- 8-ohm, 0.5W loudspeaker
- 9V
- IC bases
- Condenser mic
IC LM567 is available in small plastic and metal pakages. The pin configurations
of both the packages are shown in Figs Fig. 9: Component layout for the PCB
Receiver unit. Fig. 5 shows the block diagram of the receiver unit. It comprises
condenser microphone, 4.5kHz tone amplifier, PLL (tone decoder), flip-flop and relay
driver stages. Fig. 6 shows the receiver circuit.
Tone amplifier. When you press switch S1, the electronic clapper generates 4.5kHz
sound. The condenser microphone in the receiver unit converts this sound into an
electrical pulse, which is given to a two-stage, high-gain AF preamplifier comprising
transistors T1 and T2.
PLL tone decoder. The amplified 4.5kHz signals from the tone amplifier stage are given
to PLL tone decoder IC LM567 (IC2) that is tuned for centre frequency of 4.5 kHz. As a
result, the output of IC2 goes low.
Flip-flop section. The high-to-low pulse from PLL tone decoder is given to the clock
input of the dual JK flip-flop wired around CMOS IC CD4027 (IC3). One of the two
flip-flops inside IC3 acts as a squarewave shaper. The squarewave pulse generated by
this flip-flop is coupled to the second flip-flop of the IC. This elimi- nates the need for
an extra monostable multivibrator IC.
Relay driver. The output of the flip-flop section (IC3) is given to the relay driver, which
drives the load connected to N/O contacts of the relay as shown in Fig. 6.
Power supply. Fig. 7 shows the power supply circuit for the receiver unit. The mains
AC supply is stepped down by transformer X1. The output of the secondary transformer
is rectified by a full-wave rectifier comprising diodes D1 and D2 and filtered by
capacitor C15. The regulated 9V from regulator 7809 (IC4) powers the entire receiver
circuit.
Construction
Assemble the electronic clapper and the receiver circuits on two separate PCBs. Check
all the connections thoroughly. Connect a 9V battery to the clapper circuit and 9V
regulated power supply to the receiver circuit. Since IC LM567 works off a maximum of
10 volts, a 9V regulated power supply is recommended.
Now if you press switch S1 momentarily, the clapper produces a sharp audio tone to
energise the relay in the receiver circuit to activate the relay/ load connected via relay
contacts. To deactivate the relay, again press clapper switch S2.
his digital clock can be easily constructed using readily-available ICs and components.
The block diagram of the digital clock
is shown in Fig. 1. The basic 1Hz clock pulse signal is obtained from the clock pulse
generator using a 4.194304MHz crystal. It is divided by 60 by the second’s section to
produce one clock pulse every minute, which is further divided by 60 to produce one
clock pulse every hour. Both the seconds and minutes sections use divide-by-10 and
divide-by-6 counters. The clock pulse from the minute’s section is applied to the hour’s
section, which is a divide-by-12 counter to control the hour and AM/PM indication with
the help of the code converter circuit and J-K flipflop. The outputs of all the counters are
displayed on 7-segment displays after suitable decoding.
Fig. 2 shows the circuit diagram of digital clock with AM and PM indication. The heart
of the circuit is the precision 1-second oscillator section that is built around 14-stage
counters CD4060 (IC1 and IC2). The clock accuracy depends upon the 1-second
oscillator, which divides the crystal frequency (4.194304 MHz) by 16,348 to output 256
Hz at pin 3 of IC1, which is further divided by 256 to output
one pulse per second at pin 14 of IC2. Resistors R1 and R2 are biasing and
powerlimiting resistors, respectively.
The one-second pulse is applied to the clock input of decade counter 74LS90 (IC3),
which is a 4-stage ripple counter containing a master/slave flip-flop acting as a divide-
by-2 counter and three flipflops connected as a divide-by-5 counter. Clock input CP1 of
the divide-by-5 section must be externally connected to Q0 output of the divide-by-2
section. CP0 clock input of the divide-by-2 section receives the clock signal from the
oscillator output and a BCD count sequence is produced.
Q0 through Q3 outputs of the decade counter (IC3) are connected to A0 through A3 input
pins of the BCD to 7-segment decoder/driver 74LS47 (IC9), respectively. IC9 accepts
the 4-line input data, generates their complements internally and decodes the data with
seven AND/OR gates having open-collector outputs to drive LED segments directly. The
‘a’ through ‘f’ outputs of IC 74LS47 (IC9) are connected to the corresponding inputs of
7-segment display DIS1. All the 7-segment displays work in the same fashion. Resistors
R3 through R8 are used as current-limiting resistors for displays DIS6 down to DIS1,
respectively. Each display comprises seven
IC3, IC5
IC4, IC6
IC7
IC8
IC9-IC14
IC15
IC16, IC17 IC18, IC19
IC20
IC21
T1-T4
D1
D2-D5
DIS1-DIS6
LED1
LED2
- CD4060 14-stage counter/ divider and oscillator
- 74LS90 decade counter
- 74LS92 divide-by-12 counter
- 74LS93 divide-by-16 counter
- CD4017 5-stage Johnson counter
- 74LS47 BCD to 7-segment decade counter/driver
- 74LS76 dual JK flip-flop
- 74LS04 hex inverter
- 74LS08 quad two-input AND gate
- 74LS32 quad two-input OR gate
- 7805, 5V regulator
- BC548 npn transistor
- 1N4148 switching diode
- 1N4007 rectifier diode
- LTS542 common-anode 7-segment display
- Green LED
- Red LED
Capacitors:
C1 - 22pF ceramic disk
C2 - 47pF ceramic disk
C3 - 1000µF, 25V electrolytic C4 - 0.1µF ceramic disk
Miscellaneous:
XTAL - 4.194304MHz
S1-S3 - Push-to-on switch
X1 - 230V AC primary to 6V-0-6V,
light-emitting diodes with their common anodes connected together. This configu- -
segment display.
ICs 74LS90 (IC3) and 74LS92 (IC4) are cascaded to produce units’ and tens’ digits of
the seconds’ display. Decade counter IC3 is reset to start counting from 0 after ninth
count. Pin 11 (Q3) of IC3 is connected to clock input pin 14 (CP0) of IC4. After ninth
count, Q3 output of IC3 goes from high to low and provides a clock signal to CP0 (pin
14) of IC4.
IC4 contains a flip-flop acting as a di - vide-by-2 counter and three flip-flops con-
nected as a divide-by-6 counter. After fifth
Fig. 3: Actual-size, single-side PCB for the digital clock using discrete ICs Fig. 4:
Component layout for the PCB count, Q2 output of IC4 goes from high to low and IC4
starts counting from 0.
The next clock pulse resets the seconds section after it counts up to 59 seconds and
provides a clock pulse to the minutes section. IC5 and IC6 are used for generation of
units’ and tens’ digits of the minutes’ display with the help of IC11 and IC12,
respectively. Q2 output of IC4 is connected to the clock input (CP0) of IC5 through
transistor T1. Resistor R9 is pulled low and the high output of inverter N5 provides
forward bias to transistor T1. Q2 output of IC4 is available at pin 14 of IC5 through the
low-resistance path of transistor T1. The emitters of both transistors T1 and T2 are
connected to pin 14 of IC5.
Switch S1 is used for setting the minutes time. When switch S1 is pressed, transistor T1
is reverse biased and transis
Binary input Conversion into 5-bit Code Binary input to code converter Converted
output from code converter Display QD QC QB Qa HE HD HC HB Ha Hrs. Hrs.
(Tens) (Units)
000100
001000
001100
010000
010100
011000
011100
100001
100101
101010
101110
000010
00010110101111000000000110100210300410500610700
8109010111012
The minutes section works the same way as the seconds section. After 59th count, the
next clock pulse resets the minutes section and provides a clock pulse (through transistor
T3) to clock input pin 14 of IC 74LS93 (IC7) of the hours section.
IC 74LS93 is a 4-bit binary counter that consists of four master/slave flipflops which are
internally connected as a divide-by-2 counter section and a divideby-8 counter section.
Each section has a separate clock input, which initiates counting on receiving a high-to-
low clock pulse. QA output of the divide-by-2 section must be externally connected to
CP1 (pin 1) clock input of the divide-by-8 counter section. The input count pulse is
applied to CP0 (pin 14) clock input of the divideby-2 counter section. This configuration
acts as a divide-by-16 counter in normal condition.
Binary counter 74LS93 (IC7) is used both QC and QD outputs become 1, the counter is
reset to 0000 and as a divideby-12 counter. It counts the clock pulse and gives the binary
output from 0000 to 1011.
The outputs of IC7 are given to the code converter section. The code converter section
converts the 4-bit binary input (QA through QD) into 5-bit code (HA through HE) as
shown in the table. For inputs from 0001 through 1001, it produces the same outputs. But
when inputs are 1010, 1011 and 0000, the code converter section converts these into
10000, 10001 and 10010, respectively. The code-converter circuit comprises NOT gates
N1 through N4, AND gates N8 through N13 and OR gates N14 and N15. HA through HE
outputs of the code converter are simplified by using Kar- naugh map as follows:
HA = QA
HB = QD. (QB+QA . QC)
HC = QC
HD = QD . QB
HE = QD . QB + QA . QB . QC . QD HA through HD outputs of the code
converter are connected to 7-segment decoder 74LS47 (IC13) to display the units’ digit
of hour and HE is connected to IC14 to display the tens’ digit of hour. After ninth count,
tens’ digit of the hour display becomes ‘1’ (HE goes high) and units’ digit resets to ‘0.’
To display 01.00.00 after 12:59:59, the code converter circuit resets the tens’ digit to ‘0’
and the units’ digit to ‘1’.
Every twelve hours, HE output goes from high to low. The high clock input of IC8 takes
its output pin 2 (Q1) high, which, in turn, triggers the flip-flop and resets IC8 via diode
D1.
Initially, Q2 output of IC15 is high as Q2 output is low. Thus AM LED1 (green) is on.
After twelve hours, the first clock pulse turns Q2 high and its complement Q2 goes low.
As a result, PM LED2 (red) glows.
Again after twelve hours, HE output of the code converter goes from high to low and
gives another clock pulse to the flipflop with help of CD4017. Now Q2 output goes low
and its complement Q2 becomes high. Thus AM LED glows.
Push-to-on switches S1 and S2 are used to manually set minute and hour, respectively.
The 1Hz clock from the output of IC2 is used to advance the minutes counters (IC5 and
IC6) or the hours counter (IC7) at a fast rate by pressing switch S1 (of the minutes’ set)
or switch S2 (of the hours’ set). Switch S3 is used for initial resetting of IC8.
The power supply circuit is shown in Fig. 5. The AC mains supply is stepped down by
transformer X1 to deliver a secondery output of 9V AC, 300 mA. The output of the
transformer is rectified by a full-wave rectifier comprising diodes D2 through D5.
Capacitor C3 acts as a filter to eliminate ripple. Regulator 7805 (IC21) provides
regulated 5V power supply to the digital clock circuit.
An actual-size, single-side PCB for the digital clock is shown in Fig. 3 and its
component layout in Fig. 4. HA through HE inputs of ICs 13 and 14 have been terminated
on Con-1 and suitably marked on the PCB. These pins are to be connected to code
converter outputs with identical marking and terminated on pads using jumpers.
a BiDireCtional visitors Counter
milind guptA
This counter can be used to know the number of visitors present in a room at any given
time. It is useful for places such as movie halls, buildings and offices. To keep the cost
low, it uses a simple calculator instead of a counter-and-display circuit. The calculator
can be used as a normal calculator any time by plugging it off from the circuit. All the
components are readily available in the market and the circuit is easy to build.
Circuit description
Two transmitter-receiver pairs are used at the passage: One pair comprising light source
A (transmitter) and lightdependent resistor LDR1 (receiver) is installed at entry side of
the passage, while the other pair comprising light source B (transmitter) and LDR2
(receiver) is installed at exit side of the passage. Light from the two light sources
(torches) should continuously fall on the respective lightdependent resistors (LDRs), so
proper orientation of light beams and LDRs is essential. Fig. 1 shows the
transmitterreceiver set-up at the entrance-cum-exit of the passage.
Fig. 2 shows the circuit of the bidirectional visitors counter, wherein sections A and B
are light-detection circuits. The logic control circuit is built around AND gate IC3, NOR
gate IC4 and flip-flops IC5 and IC6. The time delay circuit comprises timers IC11 and
IC12. Optocouplers IC7
collector is low. This low voltage is fed to NAND gate N1, which gives a high output at
its pin 3. As the outputs of NOR gates N7 and N8 are low, the LED inside optocoupler
IC8 is in ‘off’ state and the positive terminals (+) of the calculator remain open.
Similarly, the
Fig. 1: Light beam set-up at the entrance-cum-exit of the passage resistance of LDR2
through IC10 are used to isolate the calculator from the circuit voltage.
The power supply circuit is shown between sections A and B in Fig. 2. The mains AC
supply is stepped down by transformer X1 to 12V AC and the same is rectified by a
bridge rectifier comprising diodes D1 through D4 and then filtered by capacitor C1. The
regulated 9V from regulator IC 7809 (IC1) powers the entire circuit.
Working
Initially, when the power is switched on, flip-flops IC5 and IC6 are in reset state
because of power-on-reset components comprising resistor R5 and capacitors C3 and
C4. Thus transistors T3 and T4 are initially in cut-off state. At the same time, transistor
T5 also is in cut-off state. In brief, when power is switched on, all the terminal keys
including ‘1’ , ‘+’, ‘–’ and ‘=’ of the calculator remain open.
The two similar sections A (comprising LDR1, transistor T1 and NAND gate N1) and B
(comprising LDR2, transistor T2 and NAND gate N2) detect the interruption of light and
then generate clocks at pin 3 of NAND gate N1 and pin 4 of NAND gate N2,
respectively.
When nobody is passing through the passage, light falls on both LDR1 and LDR2, which
thus have low resistance. Since the resistance of LDR1 is low, transistor T1 conducts
and the voltage at its
ParTs LisT
Semiconductors:
IC1 - 7809, 9V regulator
IC2 - CD4093 quad 2-input
Schmitt trigger
IC3 - CD4081 quad 2-input AND
gate
IC4 - CD4001 quad 2-input NOR
gate
IC5, IC6 - CD4013 dual D flip-flop IC7-IC10 - MCT2E optocoupler
IC11, IC12 - NE555 timer
T1-T5 - BC547 npn transistor D1-D4 - 1N4007 rectifier diode D5, D6 - 1N4148
switching diode Resistors (all ¼-watt, ±5% carbon,
unless stated otherwise):
R1, R3 R2, R4
- 3.3-kilo-ohm
- 39-kilo-ohm R5-R9, R12, R13, R18, R19 R10, R11 R14, R16 R15, R17, R20, R21
VR1, VR2 LDR1, LDR2 - Light-dependent resistor Capacitors:
C1 - 1000µF, 35V electrolytic C2, C5, C8 - 0.1µF ceramic disk C3, C4 - 100pF ceramic
disk C6, C9 - 10µF, 25V electrolytic C7, C10 - 0.01µF ceramic disk Miscellaneous:
S1 X1
- 1-kilo-ohm
- 1.2-kilo-ohm
- 100-kilo-ohm
- 10-kilo-ohm
- 200-kilo-ohm preset
- On/Off switch
- 230V AC primary to 0-12V, 300/500 mA secondary transformer
- Calculator
- Light sources (2 torches)
is also low, transistor T2 conducts and the voltage at its collector is low. This low
voltage is further given to NAND gate N2, which gives a high output at its pin 4. As the
outputs of NOR gates N9 and N10 are low, the LED inside optocoupler IC9 is in ‘off’
state and the negative key (–) of the calculator remains open.
Now if somebody enters the passage (to room/hall), first light A is interrupted and then
light B. When light A is interrupted, the resistance of LDR1 increases to provide a low
output at pin 3 of NAND gate N1. This low voltage is fed to AND gate N3 and NOR
gates N7 and N8. Since pin 6 of NOR gate N8 is low, the output of
N8 goes high, setting Q1 output (pin 1) of IC6(B) to high state. Simultaneously, IC8
activates and its internal transistor shorts the ‘+’ key of the calculator.
When the person moves further to interrupt light B, the resistance of LDR2
increases to provide a low output at pin 4
of NAND gate N2. Since IC6(B) is in set condition and pin 13 of NOR gate N10 is low,
its output goes high. This, in turn, sets IC6(A) and its Q2 output (pin 13) is driven high.
As a result, transistor T3
conducts to activate IC7 and its internal transistor shorts terminals of key ‘1’ of the
calculator. The high output of IC6(A) also triggers monostable IC11 via transistor T4,
capacitor C5 and diode D5, which, in turn, triggers monostable IC12 after approximately
one second. The output of IC12 activates IC10 via transistor T5 and its internal transistor
shorts the terminals of the ‘=’ key of the calculator. Thus the ‘=’ key of the calculator
shorts about one second after the ‘1’ key shorts.
The output of AND gate N5 is still low because its pin 8 is at low level due to
obstruction of light B. As the person moves past light source B, light again falls on LDR2
and the output of N5 goes high. This resets flip-flop IC6(B) to make its Q1 out- put (pin
2) high, which, in turn, resets flip flop IC6(A) to make its Q2 output (pin 13) low and
hence the output of AND gate N5
again goes low. As a result, transistors T3
and T4 stop conducting and keys ‘1’ and ‘=’ of the calculator get open. Thus the circuit
returns to its original state after shorting the ‘+,’ ‘1’ and ‘=’ keys of the calculator and it
is ready for another count.
The above explanation can be summarised as follows: When light falling on LDR1 is
interrupted first, followed by light falling on LDR2, the calculator keys ‘+,’ ‘1’ and ‘=’
are automatically shorted consecutively. This adds ‘1’ to the total on the calculator,
indicating that a person is entering, and upcounting takes place. Similarly, when
somebody exits, first light B is interrupted and then light A. When light B is interrupted,
the resistance of LDR2 increases to provide a low output at pin 4 of NAND gate N2.
This low voltage is fed to AND gate N6 and NOR gates N9 and N10. Since pin 9 of
NOR gate N9
is initially low, its output goes high to set IC5(B). Simultaneously, IC9 activates and its
internal transistor shorts the ‘–’ terminals of the calculator.
Now as the person crosses light B to interrupt light A, the resistance of LDR1
increases to provide a low output at pin 3
of NAND gate N1. Since IC5(B) is in ‘set’ condition and pin 2 of NOR gate N7 is low,
its output goes high. This, in turn, sets IC5(A) and its Q1 (pin 1) is driven high. As a
result, transistor T3 conducts to activate IC7 and its internal transistor shorts the
terminals of ‘1’ key of the calculator. The high output of IC5(A) also triggers monostable
IC11 via transistor T4, capacitor C5 and diode D5, which, in turn, triggers monostable
IC12 after a delay of approximately one second. The output of IC12 activates IC10 via
transistor T5 and its internal transistor shorts the terminals of the ‘=’ key of the
calculator. Thus the ‘=’ key of the calculator shorts about one second after the ‘1’ key
shorts.
The output of AND gate N4 is still low because its pin 5 is low due to obstruction of
light A. As the person moves past light beam A, light again falls on LDR1 and the output
of AND gate N4 goes high. This resets flip-flop IC5(B) and its Q2 output (pin 12) goes
high, which, in turn, resets flip-flop IC5(A) to make its Q1 output (pin 1) low and hence
the output of AND gate N4 again goes low. As a result, transistors T3 and T4 stop
conducting and keys ‘1’ and ‘=’ of the calculator become open. Thus the circuit returns
to its original state after shorting the ‘–,’ ‘1’ and ‘=’ keys of the calculator and it is ready
for another count.
In brief, when light falling on LDR2 is interrupted first followed by light falling on
LDR1, the calculator keys ‘–,’ ‘1’ and ‘=’ are automatically shorted consecutively. This
substracts 1 from the total on the calculator, indicating that a person is exiting, and
downcounting takes place.
The total number of persons present in the room/hall, at any time, can be seen on the
display of the calculator.
Construction
An actual-size, single-side PCB for the bidirectional visitor counter, including the power
supply (Fig. 2), is shown in Fig. 3 and its component layout in Fig. 4. This circuit can
also be assembled on any general-purpose PCB if you don’t have the PCB shown in Fig.
3.
Once the circuit has been soldered, connect the calculator. You can use any simple
calculator and connecting it to the circuit does not harm it. If you use jumper plugs
attached to the calculator for connection to the circuit, you can plug off the calculator
from the circuit at any time and use it as a general
To make the connections, open the calculator and solder fine wires on the two contacts
beneath the ‘1’, ‘=’, ‘–’ and ‘+’ keys each. Make a hole on the back side of the calculator
case to allow the wires to come out. Close the calculator after putting back the contact
pads and the keys. Now switch on the calculator.
Use a digital multimeter to measure the DC voltage across the wires coming from the ‘1’
key and identify their polarity. Now connect the negative-polarity wire to emitter pin 4
of optocoupler IC7 and the positive-polarity wire to its collector pin 5. Similarly, find
out the polarities of wires connected to the ‘+’, ‘–’ and ‘=’ keys and connect them to
optocouplers IC8, IC9 and IC10, respectively. The circuit is now ready for use.
As shown in Fig. 1, mount the assembled system on the entrance-cum-exit of the passage
to the room/hall where visitors are to be monitored. Use a 9V battery for back-up.
Testing
To test the circuit, expose both the LDRs to light sources of the same intensities. Switch
on power to the circuit and measure the voltage at the collector of transistor T1 with
respect to ground. If the voltage is more than 5V, set it to approximately one volt (or
less) by adjusting preset VR1. Now obstruct light and measure the voltage again. If the
voltage is below 5V, adjust it to more than 5V using VR1.
For 200-kilo-ohm VR1, the resistance of the LDR in no-light condition should be higher
than 100k and under light, it should be as low as 10k or so. Otherwise, change the value
of VR1 accordingly. Now calibrate transistor T2 as explained above. Once the
adjustments are completed, switch off power to the circuit and again switch it on after 5
to 10 seconds. Now switch on the calculator and press the AC (all clear) button on it.
The display will show ‘0’.
Momentarily obstruct light A followed by light B. Once the path for light B is clear, the
calculator display should show ‘1.’ On repeating the procedure, ‘1’ is added to display
‘2,’ indicating that two people have entered. In the same manner, the displayed figure
will increase by ‘1’ for every obstruction of lights A followed by light B. This indicates
that up-counter is working well.
For testing down-counting, press the AC (all clear) button on the calculator. The display
will show ‘0’. Now momentarily obstruct light B followed by light A. Once the path for
light A is clear, the calculator will display ‘–1’. On repeating the procedure, ‘1’ is
substracted from the existing total (–1) to display ‘–2’, indicating that two persons have
exited. In the same manner, the displayed figure will decrement by ‘1’ for every
obstruction of lights B and A in that order. This indicates that the downcounter is
working well.
If the counter is not working properly, check the soldering for any loose connection.
Check the connections to the calculator by manually shorting the wires of the calculator.
Precautions
To make sure that ambient light doesn’t fall on the LDRs, house the LDRs in black tubes
pointing towards the light sources.
The ICs should be soldered carefully. It is better to use IC bases and plug-in the ICs
later. The solder to the IC pins should not be dry or loose.
Readers’ comments
Q1. we are getting continuous pulses on the calculator but except ‘0,’ nothing is being
displayed on the calculator. Section A of the circuit is responding to the obstructions in
the path of the laser beam but section B is not responding. Why so?
The author, Milind Gupta, replies: a1. Sections A and B are exactly the same. So the
problem could be that your light-dependent resistor (LDR) is not giving enough change in
resistance due to the obstruction. You can check the voltage at the LDR by varying preset
VR2 (200k) and see whether the change is big enough to cause switching in the
transistor. If not, replace LDR2.
As regards pulses in the calculator, do you mean to say that you are getting continuous
pulses without any light obstruction? If yes, one of your 555 ICs might be wired as an
astable rather than a monostable, i.e., pins 2 and 6 are shorting. If you are getting
appropriate pulses but no increment in the calculator, it’s the problem of the calculator.
You should have selected a calculator that accepts the key input as described.
PROGRAMMER FOR 89C51/89C52/
89C2051 MICROCONTROLLERS
T
Here is a simple programmer circuit that can be used to program 89C51, 89C52 and
89C2051 microcontrollers (refer Figs. 1 and 2 for their pin assignments). The fancy here
is that the programmer itself deploys an 89C51 chip containing the necessary firmware.
Operational modes
IC1 IC2
IC3
IC4
T1, T2 T3
T4
D1
ZD1
LED1-LED8 - Red LED LED9 LED10
- 89C51 microcontroller
- MAX232 RS-232 level
converter
- 74LS04 hex inverter
- 7805 +5V regulator
- BC548 npn transistor
- 2N2907 pnp transistor
- BC557 pnp transistor
- 1N4148 switching diode
- 5V zener diode
- Yellow LED
- Green LED
RNW2
Capacitors:
C1
C2 - C5
C6- C9
C10
Miscellaneous:
XTAL1XTAL2
S1, S2
ZIF Socket 1 ZIF Socket 2
- 390-ohm
- 1-kilo-ohm
- 330-ohm
- 4.7-kilo-ohm x 8-resistor
network
- 1-kilo-ohm x 8-resistor net-
work
- 3.57MHz Crystal
- 12MHz Crystal
- Push-to-on switch
- 40-pin ZIF socket
- 20-pin ZIF socket
- 9-pin ‘D’ connector
- 5-pin keyboard connector
Fig. 3: Authors' working model of programming board
programming board can be connected to Com port of a PC, using a 3-wire cable,
terminating on a 9-pin D connector on the board. A simple serial port program run on the
PC starts the dialogue and you can program an 89C51, 89C52 or 89C2051
microcontroller in this programming mode by using program data in an ASCII file on the
PC as well as byte-by-byte from the PC’s keyboard. The locking of the entered code in
the micro
controller is also feasible. priate ZIF socket on the priate ZIF socket on the pin or a 20-
pin IC to the pin or a 20-pin IC to the pin or a 20-pin IC to the pin ZIF socket-2 are used
for inserting an 89C51 (or 89C52) and 89C2051, respectively. IC MAX232 (IC2) is the
voltage level converter, which converts TTL-level signals into RS-232C compatible sig-
nals and vice-versa. The power-on-reset signal is generated by R1-C1 com- bination in
conjunction with NOT gate 74LS04 (IC3), which provides a high-going reset pulse to
pin 9 of IC1. Manual resetting is also possible by shorting capacitor C1 momentarily
using pushto-on tactile switch S1.
Port 0 of IC1 serves as the data bus for the IC to be programmed via ZIF socket-1 or ZIF
socket-2. This port needs pull-up resistors. Therefore pin numbers 39 down to 32 of port
0 are pulled up to +5V through a (4.7k×8) resistor network RNW-1. These pins are also
connected to LED1 to LED8 via current-limiting resistors (1k×8) of RNW-2. Thus, port-
0 data can be viewed on these eight LEDs as complement of the actual data, at a specific
memory location. A 3.57 MHz crystal (XTAL1) is connected to pins 18 and 19 of IC1,
which provides a low baud rate of 1200 for this application. However, a 12MHz crystal
(XTAL2) is used for the 89C51/52
Circuit description
Figs 3 and 4 show the authors' working model and the schematic circuit diagram of the
programmer board, respectively. In Fig. 4, microcontroller 89C51 (IC1) is
preprogrammed for programming other microcontrollers inserted into the approIC (being
programmed) in ZIF socket-1, to meet its internal timing requirements.
The address bus, data bus and control signals are required for programming a new
microcontroller IC. Port 0 and Port 1 pins of IC1 provide 8-bit data bus and eight low-
order address lines (A0 through A7), respectively. Four higher-order ad- dress lines (A8
through A11) are taken from pins 21 through 24 of port 2 (P2.0 through P2.3). To get
A12 address line needed for the 89C52 higher memory IC, pin P3.5 (pin 15) is
connceted to pin 25 of ZIF socket-1.
Pins 25 through 28 of IC1 (P2.4 through P2.7) are used for program control functions for
the new IC (to be programmed in ZIF socket-1 or ZIF socket2). The program control
signals are given in Table.
When the programming (write) mode is invoked, control pin P2.4 is at logic 0, while
pins P2.5 through P2.7 of IC1 are at logic 1 (0111H). During programming mode, the
data received from the serial port is routed through the accumulator to the port pins 39
down to 32 of IC1 and hence given to the data pins of the sockets. Data lines D0 through
D7 of IC1 are connected to pins 39 down to 32 of the ZIF socket-1 and to pins 19 down
to 12 of ZIF socket-2. Pin 30 (PROG) of ZIF socket-1 or pin 6 (INT0) of ZIF socket-2 is
required to be pulsed low for about 100 microseconds during the programming
operation. Also, VPP pin 31 of ZIF socket-1 or VPP pin-1 of ZIF socket-2 gets a pulsed
12V supply a few microseconds before the PROG pin goes low, which lasts for 2
milliseconds (ms) after PROG pin goes high again. This timing is needed by the internal
logic of the microcontroller to keep the voltage applied to the oxide gate of the memory
for suitable duration, thereby writing into the flash memory by turning a 1 into 0.
(Erasing does the opposite of turning a 0 into a 1 bit). The memory bits, after being
programmed, will remain non volatile, until the same is erased, which can be done only
totally for the entire chip's flash memory.
However, the entire flash memory (and not any one location individually) can be erased
by using a proper combination (1000H) of control signals via pins P2.4 through P2.7 by
holding PROG pin low for about 10 ms, with 12V applied to VPP pin.
For reading of the signature byte by IC1, control pins P2.4 through P2.7 are at logic 0
(0000H). The signature is present at address 30H of 89C51 (or 89C52) and address 00H
of 89C2051 microcontroller.
Transistors T1 through T3 are used for generating the pulsed 12V supply using pins 13
(P3.3) and 17 (P3.7) of IC1. When pin 17 (P3.7) goes low, npn transistor T1 is cut off
and its collector voltage rises to drive npn transistor T2 into conduction. As a result the
base of pnp transistor T3 goes low, thereby transistor T3 conducts and its collector
voltage rises to around
tabLe
Flash Programming Modes
Mode rst PseN aLe/PrOG ea/VPP P2.6 P2.7 P3.6 P3.7 Write code data H L H/12V L
H H H Read code data H L H H L L H H
12V. The collector of transistor T3 is connected to VPP pins of the ZIF sockets 1 and 2.
A green LED (LED10) connected to the collector of transistor T3 via currentlimiting
resistor R7 and zener diode ZD1 lights up to provide a visual indication of the
programming voltage.
Data.bas
input “Filename= “;q$
open q$ for random as #3 len=1
field #3,1 as m$
n$=input$(loc(1),#1)
lfp=0
630 lfp=instr(lfp+1,n$,chr$(10))
9001 END
supply is used for the programmer board. While Vpp pulse generation circuitry makes
use of 12.6V, however all ICs de- ployed on the board need regulated 5V DC for their
operation. Regulator IC 7805 (IC4) generates 5V supply from the 12.6V DC to meet this
requirement.
Port 0 of IC1 connected to the ZIF socket-1 and ZIF socket-2 serves as a bidirectional
port for writing (programming) and reading of data to/from the ICs being programmed.
1. In the direct keyboard-entry mode, data entered via the keyboard has to be output to
the LEDs for viewing. During write operation control signal P2.4 would be logic 0
while P2.5 through P2.7 would be at logic 1 (0111H). For reading data from the
programmed IC, port 0 is converted into an input port by outputting FF hex before
outputting the control signals (0011H) via pins P2.4 through P2.7 respectively. Thus, the
function of port 0 is bidirectional.
2. In the serial-port interface mode, data transfer from PC to programming board occurs
serially and after two bytes of ASCII code are received at the programming board, the
same are converted into
one hex byte before being programmed into the new IC (in ZIF socket). The pro-
grammed data is then verified before send- ing the same, along with its address to the PC
for its display on PC monitor. (The data followed by address is output serially to the
computer.) The above procedure is repeated for programming and displaying of the next
data byte.
Proper handshaking between the PC and programming board is essential for successful
operation. The program (data.bas) for interfacing the PC to the programming board is
written in Turbo Basic.(Turbo Basic TB.EXE file is included in current EFY-CD along
with other software) The source code of data.bas is given below:
Start the Turbo Basic program (TB. exe) on the PC, select ‘Key Break–On’ in the Option
menu bar, load the program (data.bas) for interfacing the PC and the programming board
and run it. The program works in the non-compiled mode also. (Note. At line #800, the
maximum value of variable kk may be varied, as necessary, depending on your PC’s
speed, so that the program works smoothly)
Programming
We shall discuss programming aspects relating to both the modes of operation namely,
the direct keyboard-entry mode and the serial-port interface mode. For each mode a
separate preprogrammed 89C51 microcontroller chip with different codes (for monitor
program) is required.
The keyboard is used for entering the address location, program data and commands for
programming, verifying (reading) the programmed data bytes and erasing of the entire
chip. The ‘on’ and ‘off’ status of the display LEDs indicate low (0) and high (1) logic
levels, respectively (i.e. complement of the data). The software program takes into
consideration the keys used for entering hexadecimal numbers 0 through 9 and letters A
through F as also the keys used for high-address selection, low-address selection,
incrementing, decrementing, programming and erasing as per the following details:
In this case, erase the chip and again try to program it.
The address gets incremented until either the chip has been programmed completely or
else the data in the ASCII file has ended. After the programming is complete, release the
12V switch S2 and press Reset switch S1 on the program- ming board.
There is also a provision to write lock bit-1(refer Table). For this, choose the lock bit
option ‘L’in response to the “Want to Erase, or Read or Prog or Lock? (E/R/P/L)”
prompt. Before pressing L key, the 12V LED should not glow inadvertently. If it does,
press Reset to put it off. If the LED is ‘off,’ hold the 12V switch pressed and enter ‘L’
from the keyboard. The following message appears on the screen:
LOCKED,…, CAN’T, READ
When the microcontroller is locked, the capture.dat file can’t capture data in read option.
The LCD module can be directly interfaced with an 89C51 (or 89C52) or 89C2051 chip
as follows:
1. Fig. 5 shows interface circuit between an 89C51 microcontroller and an LCD module.
Here eleven lines of microcontroller 89C51 are interfaced to the LCD module. Port 1 (8
lines comprising pin numbers 1 through 8) are used as data lines and three lines (P3.2
through P3.4 of port 3 of the 89C51 microcontroller) are used as control lines,
respectively, for the LCD module. Accordingly, pins 1 through 8 of 89C51 are connected
to data pins 7 through 14 of the LCD module. Port pins P3.2 through P3.4 (pins 12
through 14) are connected to pins 4 through 6 of the LCD module. Pin 31 of IC 89C51 is
pulled high. The message “ElectronicForYou” gets dis- played on the LCD module after
you press Reset switch shown in Fig. 5. The listing file containing the source code burnt
into 89C51 is given here as EFY.LST.
2. Fig. 6 shows interface circuit of the LCD module to 89C2051 microcontroller. Here
pins 12 through 19 of the 89C2051 are connected to data pins 7 through 14 of the LCD
module. Pins 6 through 8 of Port 3 (P3.2 through P3.4) are connected to pins 4 through 6
of the LCD module. The message “ElectronicForYou” gets displayed on the LCD
module after you press Reset switch shown in Fig. 6. Both ICs (89C51 and 89C2051)
contain identical program and as such EFY.LST is common for both the circuits of Figs.
5 and 6.
Note. For above examples, use only Hitachi HD44780U controller based on 16-
character X 1-line LCD module.
An actual-size single-side PCB layout for the programmer circuit of Fig. 4 is shown in
Fig. 7 with its component layout in Fig. 8.
The programs for the direct keyboard entry mode (pgrmod1.lst) and the serialport
interface mode (pgrmod2.lst) are selfexplanatory. All relevant files, pertaining to this
article, are included in the CD.
PgrmOD1.lst
29 0041 C2 B3 CLR P3.3
30 0043 C2 50 CLR SMALL
31 0045 D2 B6 BEG:
32 0047 D2 B7 SETB P3.7
33 0049 90 00 00 MOV DPTR,#0
34 004C 7A 00 MOV R2,#0
35 004E E5 82 A0: MOV A,DPL
36 0050 F5 90 MOV P1,A
37 0052 E5 83 A1: MOV A,DPH
38 0054 44 C0 ORL A,#0C0H
39 0056 F5 A0 MOV P2,A
40 0058 EA A11: MOV A,R2
41 0059 F5 80 MOV P0,A
42 005B 12 00 78 AA: CALL KBD1
43 005E 12 01 E8 CALL CONVERT
44 0061 FB MOV R3,A
45 0062 94 40 SUBB A,#040H
46 0064 50 1C JNC D
47 0066 EA MOV A,R2
48 0067 C4 SWAP A
49 0068 54 F0 ANL A,#0F0H
50 006A 4B ORL A,R3
51 006B FA MOV R2,A
52 006C E5 83 MOV A,DPH
53 006E 44 E0 ORL A,#0E0H
; CONTROL CODE WRITE SO NEW IC DATA DOES NOT CLASH WITH THIS
68 0092 02 00 DE JMP GO
69 0095 B4 48 03 A4: CJNE A,#048H,A5;SIGNATURE s KEY
70 0098 02 00 E0 JMP SIGNATURE
71 009B B4 47 03 A5: CJNE A,#047H,A6; ENTER KEY
72 009E 02 01 16 JMP NEXT_ADDR
73 00A1 B4 44 03 A6: CJNE A,#044H,A7 ; BACKSPACE KEY
74 00A4 02 01 34 JMP BACKADDR
75 00A7 B4 4A 03 A7: CJNE A,#04AH,A8 ; t KEY
76 00AA 02 01 4F JMP PROG
77 00AD B4 4B 03 A8: CJNE A,#04BH,A9 ; - RIGHTMOST KEY
78 00B0 02 01 7D JMP ERASE
79 00B3 B4 49 03 A9: CJNE A,#049H,A10 ; k KEY
80 00B6 02 01 9F JMP LOCKBIT1
81 00B9 B4 4D 02 A10: CJNE A,#04DH,A101
82 00BC D2 50 SETB SMALL
83 00BE 01 5B A101: AJMP AA ;
84 00C0 75 80 FF H1: MOV P0,#0FFH ; PORT 0 SHOULD BE INPUT PORT NOW!
85 00C3 EA MOV A,R2
86 00C4 54 0F ANL A,#00FH
87 00C6 F5 83 MOV DPH,A
88 00C8 44 C0 ORL A,#0C0H
89 00CA F5 A0 MOV P2,A
90 00CC 01 5B AJMP AA ;DISPLAY NOW SHOWS THE DATA THERE!
91 00CE 75 80 FF L1: MOV P0,#0FFH ; PORT 0 SHOULD BE INPUT PORT NOW!
92 00D1 EA MOV A,R2
93 00D2 F5 82 MOV DPL,A
94 00D4 F5 90 MOV P1,A
95 00D6 E5 83 MOV A,DPH
96 00D8 44 C0 ORL A,#0C0H ; READ MODE ONLY
97 00DA F5 A0 MOV P2,A
98 00DC 01 5B AJMP AA ;DISPLAY NOW SHOWS THE DATA THERE!
99 00DE 80 FE GO: SJMP $ ; FOR FUTURE USE NOW HALTS HERE !100 00E0 D2 B6 SIGNATURE: SETB
P3.6
; ELSE SHOW THE WRONG DATA NOT 1EH THERE ON LEDS & HALT
116 0104 D2 97 BEEP: SETB P1.7 ; USE PORT 1 BIT 7 (A7 ADDR. LINE!)
; 48 CLCL ; VOLTS 12
; DELAY 10 MICRO
; ALE LOW
; DELAY 10 MICRO
; ALE MADE HIGH
; 2 MS DELAY FOR PROGRAMMING GIVEN ; VOLTS ;ALE PIN MADE HIGH AGAIN
; ERASE CODE
; ALE LOW VOLTS
; VOLTS 12
; DELAY 10 MICRO
; ALE LOW
; DELAY 10 MICRO
; ALE MADE HIGH
; 2 MS DELAY FOR PROGRAMMING GIVEN ; VOLTS ; ALE PIN MADE HIGH AGAIN
; ISR SERIAL
.EQU 41H .EQU 43H .EQU 30H .EQU 31H .EQU B7H .EQU B6H ;P3.7 ;P3.6 1
2 0000 .ORG 0
3 0000 01 30 JMP 0030H 4
5 0023 .ORG 23H
6 0023 02 03 95 JMP SERINT 7
8 00 40 PC .EQU 40H 9 00 41 MAXADR 10 00 43 SER_DATA 11 00 30 FLAG 12 00 31 SMALL 13 00 B7 VOLTS
14 00 B6 ALE
15
16 0030 .ORG 30H
17
18
19 0030 75 81 60 BEGIN: MOV SP,#60H
20 0033 75 B0 FF MOV P3,#FFH
21 0036 75 90 00 MOV P1,#0
22 0039 75 80 FF MOV P0,#FFH
23
24 003C 12 03 89 CALL SER_INIT
25 003F KK2:
26 003F 75 A8 90 MOV IE,#90H ;all bits of port 3 set
PgrmOD2.lst
;ENABLE SER INTERRUPT
27
28 0042 90 00 4B MM1: MOV DPTR,#MES1
29 0045 12 03 7E CALL MESDISP 30 0048 02 00 7C JMP S2
31
32
33 004B MES1:
34 004B 52 45 41 44 .DB "R","E',"A","D","Y"," ","W","h","i","c","h","","D","e","v", "i","c","e"
004F 59 20 57 68
0053 69 63 68 20
0057 44 65 76 69
005B 63 65
35 005D 38 39 35 31 .DB "8","9","5","1"," ","O","R"," ","5","2","
","O","r"," ","2","0","5","1","?"
0061 20 4F 52 20
0065 35 32 20 4F
0069 72 20 32 30
006D 35 31 3F
36 0070 45 4E 54 45 .DB "E","N","T","E","R"," ","1","2","3",10,13,FFH
0074 52 20 31 32
0078 33 0A 0D FF
37 ;READY,WHICHDEVICE, 8951, OR 52 OR
2051 ? ENTER 1,2,3"
38
39 007C 30 30 FD S2: JNB FLAG,$ ;flag bit high indicates a data byte received
40 007F E5 43 MOV A,43H ;serial bufer data
41 0081 C2 30 CLR FLAG ;WE HAVE NOW USED THE LAST RECEIVED DATA
42 0083 B4 31 1D CJNE A,#31H,N1 ;for entry "1"
43 0086 74 10 MOV A,#10H ; MAX ADDR FOR 51 IS 0F H ONLY SO 10 H
54 00AA C2 31
CLR SMALL
101 014E 74 F0
102
103
104 0150 F5 A0
105 0152 7F 17
106 0154 DF FE
107
108 0156 C2 B7
109 0158 C2 B6
110 015A 7F 1C
MOV A,43H
CLR FLAG
CJNE A,#"E",S6
JMP ERASE
S6: CJNE A,#"R",S7 JMP READ
S7: CJNE A,#"P",S8 JMP S6_1
S8: CJNE A,#"L",S4 JMP LOCK
LOCK: SETB P3.7 MOV A,#F0H
111 015C DF FE DJNZ R7,$
112 015E D2 B6 SETB P3.6 ;ALE 210 113 0160 D2 B7 SETB P3.7 ;VOLTS 211 0235 D2 B7 114 0162 90 01 6A
MOV DPTR,#MESLOCK 212 115 213 116 0165 12 03 7E CALL MESDISP 214 0237 75 80 FF 117 215 023A E5 31
118 0168 01 F4 JMP S4 216 023C 54 0F 119 016A 4C 4F 43 4B MESLOCK: .DB "L","O","C","K","E","D",".", 217
023E 44 C0
016E 45 44 2E 43
"C","A","N","T"," ","R","E","A","D",10,13,FFH 218 0240 F5 A0
219 0242 E5 30 0172 41 4E 54 20 220 0244 30 31 03 0176 52 45 41 44 221 0247 02 02 4C 017A 0A 0D FF 222 024A
F5 90
0198
44 41 54 41
232 0258 12 02 8C 233 019C 20 73 61 79 234 025B 85 30 82 01A0 20 59 20 66 235 025E 85 31 83 01A4 6F 72 20 236
0261 A3 128 01A7 79 65 73 0A .DB "y","e","s",10,13,FFH 237 0262 85 82 30
01AB 0D FF 238 0265 85 83 31129 01AD C2 B3 READ1: CLR P3.3 ; 5V to pin EA\VPP 239 130 01AF D2 B7
SETB P3.7 240 0268 30 31 08
131 01B1 D2 B6 SETB P3.6 ;HIGHEST ADDR. IS SET LOW241 026B C2 90132 01B3 C2 B5 CLR P3.5 242 026D
00
133 01B5 90 00 00 MOV DPTR,#0 243 026E D2 90
134 244 0270 00
135 01B8 E5 83 CONT1: MOV A,DPH 245 0271 C2 90136 01BA 44 C0 ORL A,#C0H ;READ 246 0273
151 01D9 C2 90 CLR P1.0 262 0294 71 A9152 01DB E5 83 CCC: MOV A,DPH 263
153 01DD 30 31 06 JNB SMALL,CC2 264 0296 E5 31
154 01E0 B4 08 D5 CC1: CJNE A,#08H,CONT1 265 0298 54 0F
155 01E3 02 01 EE JMP CC3 266 029A 12 03 C2
156 01E6 B4 10 CF CC2: CJNE A,#10H,CONT1 267 029D 71 A9
157 01E9 D2 B5 SETB P3.5 ; HIGHEST ADDRESS MADE HIGH 268
158 01EB B5 41 CA CJNE A,MAXADR,CONT1 269 029F E5 30
159 01EE 01 F4 CC3: JMP S4 270 02A1 C4
160 271 02A2 54 0F
161 272 02A4 12 03 C2162 01F0 12 03 5F S6_1: CALL DISPLAY 273 02A7 71 A9
163 274
164 01F3 C2 B3 CLR P3.3 ;SWITCH ON 5 v TO EA\VPP 275 02A9 E5 30
165 ;BITS PORT 2 17 16 28 27 A11 A10 A9 A8 276 02AB 54 0F
166 01F5 D2 B7 SETB P3.7 ;VOLTAGE NOT 12 V 277 02AD 12 03 C2
167 01F7 D2 B6 SETB P3.6 ;HIGH ALE 278 02B0 71 A9
168 279
169 280
170 281 02B2 74 0D
171 282 02B4 71 A9172 01F9 90 00 00 MOV DPTR,#0 ;FIRST ADDRESS OF NEW IC IS POINTED 283 02B6 22
TO. 284
173 01FC C2 90 CLR P1.0 285 02B7 41 07174 01FE 85 82 30 MOV 30H,DPL ;ALSO SAVE IN 30,31 INT. RAM
286
175 0201 85 83 31 MOV 31H,DPH 287
176 0204 12 02 CE CALL SIGNATURE 288
177 0207 MORE: 289 02B9 90 02 C3
178 ;GET ADDRESS 290 02BC 12 03 7E
179 0207 E5 31 MOV A,31H ;HIGH ADDRESS 291 02BF 51 8C
180 0209 54 0F ANL A,#0FH 292
181 020B 44 E0 ORL A,#E0H ;CONTROL CODE FOR WRITING 293 02C1 80 FE
182 020D F5 40 MOV PC,A ; PC IS STORE FOR PORT 2 data 294 02C3 45 52 52 2E 183
;WRITECONTROLCODE 02C7 20 41 54 20 FOR WRITE AND 02CB 0A 0D FF
300 02D2 D2 B7 189 0219 F5 90 YES_OUT:MOV P1,A ;LOW ADDRESS 301 190 ;LOOK DATA FROM SERIAL
AND PUT TO 302 02D4 74 00
MOV P0,#FFH
MOV A,31H
ANL A,#0FH
ORL A,#C0H ;READ CODE MOV P2,A ;HI ADDRESS IN PORT 2MOV A,30H
JNB SMALL,VV1
JMP VV2
VV1: MOV P1,A ; P1 LO ADDR.
VV2: MOV R7,#20H
DJNZ R7,$ ;DELAY
;READ DATA:
MOV A,P0 ;READS THE DATA ON PORT 0 MOV 32H,A ;SAVE IN DATA LOCATION
JMP END
MORE11: JMP MORE1
MOV A,31H
ANL A,#0FH
CALL HEXASC
ACALL TOUT
MOV A,30H
SWAP A
ANL A,#0FH
CALL HEXASC
ACALL TOUT
MOV A,30H
ANL A,#0FH CALL HEXASC ACALL TOUT
MOV DPTR,#MESERR
CALL MESDISP
CALL ADDROUT
SJMP $
MESERR: .DB "E","R","R","."," ","A","T"," ",10,13,FFH
SIGNATURE:
;WRITE ADDR 30H AND CONTROL CODE 00 TO READ BYTE AS 1EH
CJNE A,#1EH,ERRSIG
MOV DPTR,#SIGMES
CALL MESDISP
CALL GETBYTE
MOV A,R2
MOV 31H,A
CALL GETBYTE
MOV A,R2
MOV 30H,A
RET
","O",".","K",10,13
0304 41 54 55 52
0308 45 20 4F 2E
030C 4B 0A 0D
324 030F 45 4E 54 45 .DB "E","N","T","E","R"," ","A","D","D","R","E","S","S",
0313 52 20 41 44 10,13,FFH
0317 44 52 45 53
031B 53 0A 0D FF
325 031F 90 03 27 ERRSIG: MOV DPTR,#SIGMESER
326 0322 12 03 7E CALL MESDISP
327 0325 80 FE SJMP $ ;HALT ON ERROR
328 0327 SIGMESER:
329 0327 45 52 52 4F .DB "E","R","R","O","R"," "
032B 52 20
330 032D 53 49 47 4E .DB "S","I","G","N","A","T","U","R","E","
","H","A","L","T",10,13,FFH
0331 41 54 55 52
0335 45 20 48 41
0339 4C 54 0A 0D
033D FF
331 033E 30 30 FD GETBYTE: JNB FLAG,$ ;read new serial byte 332 0341 E5 43 MOV A,SER_DATA ;DATA IN
A
333 0343 C2 30 CLR FLAG
334 0345 71 A9 ACALL TOUT
335 0347 12 04 25 CALL ASCI_HEX
336
337 034A C4 SWAP A
338 034B 54 F0 ANL A,#F0H339 034D FA MOV R2,A
340 034E 30 30 FD JNB FLAG,$ ;read new serial byte
341 0351 E5 43 MOV A,SER_DATA ;DATA IN A
342 0353 71 A9 ACALL TOUT
343 0355 12 04 25 CALL ASCI_HEX
344 0358 C2 30 CLR FLAG
345
346 035A 54 0F ANL A,#0FH
347 035C 4A ORL A,R2 ; SECOND NIBBLE READ AND PACKED
348 035D FA MOV R2,A ;DATA BYTE IS IN R2 NOW
349 035E 22 RET
350 DISPLAY: ;POINTS TO MESSAGE AND SEND THE
351 035F 90 03 66
DATA OF PROGRAMMING ADDRESS
MOV DPTR,#MESPROG
352 0362 12 03 7E CALL MESDISP
353 0365 22 RET
354 0366 MESPROG:
355 0366 0D 4F 2E 4B .DB 0DH,"O",".","K"," ","A","T"," ",10,13,20H,FFH 036A 20 41 54 20
036E 0A 0D 20 FF
356
357
358 0372 SER_INI2:
359 0372 75 98 52 MOV SCON,#52H
360 0375 75 89 20 MOV TMOD,#20H ;20
361 0378 75 8D FD MOV TH1,#FDH ;FDH362 037B D2 8E
03B9 41 20 54 45
03BD 53 54 0A 0D
398 03C1 FF
Efy.lst
2500 A.D. 8051 CROSS ASSEMBLER - VERSION 3.41f 19 005D
-------------------------------------------------20 005D 74 38 INIT_LCD:MOV A,#38H21 005F 11 8A ACALL CMD
n optical communication system for inter- and intra-building com muni-cations, closed-
circuit TVs,
PC LANs, etc can be built using the following three basic components:
AnjAAn nAndi
flector.
2. It transmits high-quality
audio.
3. It ensures privacy, since
a laser beam is very narrow and
the link is virtually impossible
for someone to tap into.
4. Alignment/orientation of
the transmitter and the receiver
is easy because the laser beam
is visible.
It also offers the following
facilities:
1. When someone intercepts
the beam, the communication
link breaks and the receiver
circuit provides an audio-visual indication
of the interruption by sounding an alarm
and incrementing the count of a 7-segment
display.
2. The person at the receiver end is
alerted of an impending audio message
Fig. 1: Technical data of RLT6505G visible wavelength laser diode through a buzzer
sound by depressing a call switch at the transmitter end.
3. The voice output from the microphone in the transmitter is reproduced through a
loudspeaker in the receiver section after suitable amplification.
Optical output power Threshold current Operation current Operating voltage Lasing
wavelength Beam divergence Beam divergence Astigmatism
Monitor current
PARTS LiST
Semiconductors: IC1
IC2, IC3, IC7, IC8 IC4
IC5, IC6
IC9
IC10
BR1
D1
ZD1
LED1—LED3
DIS1
- 7806 5V regulator
- 555 timer
- LM386 low-power audio
amplifier
- NE567 phase-locked loop
- CD4033 decade counter/
7-segment decoder
- UM66 melody generator
- 1A bridge rectifier
- 1N4001 rectifier diode
- 3.3V zener diode
- 5mm red LED
- LTS543 common-cathode
display
Resistors (all ¼-watt, ±5% carbon, unless stated otherwise):
R1, R19, R20,
R13, R17, R26 - 2.2-kilo-ohm R14 - 2.7-kilo-ohm R15 - 390-ohm R16 - 390-kilo-ohm
R22 - 33-kilo-ohm R23 - 4.7-ohm
R15 - 390-ohm R24 - 36-kilo-ohm R25 - 560-kilo-ohm R29 - 4.7-kilo-ohm R31 - 10-kilo-
ohm
R30 - 220-ohm
VR1 - 47-kilo-ohm preset
VR2 - 100-kilo-ohm presetVR5,VR6 - 10-kilo-ohm preset VR3 - 10-kilo-ohm potmeterVR4 - 5-
kilo-ohm preset VR7 - 10-kilo-ohm potmeter (log.) Capacitors:
indicates interception of the laser beam and activates an audio-visual warning at the
remote receiver. For detecting the 1kHz call/tone signal, another phaselocked loop
(PLL-2) is used. The call detection is indicated by a buzzer sound and an LED.
The output of IC3 is also coupled to the base of the mixer transistor via capacitor C7,
resistor R7, preset VR4 and capacitor C9. Preset VR4 is connected across the condenser
microphone to adjust the audio signals when someone speaks into the microphone. Preset
VR4 is used to vary the biasing signals.
The outputs of IC2 and IC3 and voice signals are mixed by transistor T1 to drive the
laser-pointer LED. The mixer output modulates the intensity of light signals emitted by
the laser diode module in accordance with the level of the code oscillator and tone or
audio signals available at the base of the mixer transistor.
Laser. The laser diodes can be constructed using a variety of different materials to
produce distinctive wavelengths. Semiconductor laser diodes produce a much higher
output power and highly directional beams compared to the LEDs. The laser must be
operated with a large drive current to get a high density of ready-to-combine electrons at
the p-n junction. Fig. 4 shows the optical output vs forward current characteristics of a
laser diode. We can divide it into spontaneousemission region A and laser-oscillation
region B. The current required for starting oscillations is called the threshold current
(Ith), while the forward (excitation) current necessary for maintaining the diode’s
specified optical output is called its operating current (Iop).
For the 5mW laser shown in Fig. 1, the typical values of threshold and operating currents
are 30 mA and 45 mA, respectively. Keychain laser pointers available in the market
have a power output of about 5 mW with forward current limited to 20 to 25 mA. Thus, a
laser diode module of keychain-type visible laser pointer may be used for this
transmitter circuit.
The receiver
The receiver (Fig. 5) consists of a light sensor, a signal preamplifier, audio amplifier,
code detector (with audio/visual alarm) and call/tone detector with buzzer indication. It
uses a light-dependent resistor (LDR) as the light sensor. The resistance of LDR varies
depending on the incident
frequency of the band and output delay are independently determined by external
components.
The output at pin 8 of IC5 remains low as long as the transmitted code is detected by
IC5. As a result, LED1 lights up to indicate continuity of the optical link/path for
communication.
When the laser beam is interrupted due to any reason, the output at pin 8 of IC5 goes high
to drive transistor T4 and its collector voltage falls to trigger monostable circuits built
around IC7 and IC8 (each NE555), respectively. As a result, the output at pin 3 of these
ICs goes high for the predetermined time period. The time periods of timers IC7
light intensity, which, in turn, is a function of its modulation by the mixed output of code
and tone or audio signals at the transmitter mixer stage. The output of the LDR sensor is
amplified by a two-stage transistorised preamplifier.
As stated earlier, IC7 and IC8 are triggered simultaneously. Thus with each interruption
of the light beam, the output of IC8 is pulsed high for a predetermined time to provide
around 3V (determined by the output of zener diode ZD1) to melody IC UM66 (IC10).
Thus IC10 generates a melodious tune whenever the light beam is interrupted. The output
of IC10 is amplified by transistor T5 to drive loudspeaker LS2.
For initiating a call, the person at the transmitter end depresses switch S1 to alert the
remote-end person of an impending voice communication. Thus the modulated light
output from the transmitter contains 1-2kHz tone component in addition to the 10-15kHz
code oscillator output. After detection and preamplification, 1-2kHz tone is decoded by
PLL-2 circuit built around IC6, whose centre frequency is adjusted to match the
frequency of tone/call oscillator in the transmitter.
IC6 is thus used as the call detector. Resistor R20 and capacitor C22 decide the centre
frequency of its inbuilt oscillator in the absence of an input signal. Capacitors C23 and
C24 serve as lowpass filter and output filter, respectively. Preset VR6 is used for tuning
the inbuilt oscillator.
Thus when the 1-2kHz tone component is detected by IC6, its output pin 8 goes low to
light up LED3 as also sound piezobuzzer PZ1 to alert the receiver-end person. Since the
1-2kHz tone component at the output of the preamplifier also passes through LM386
power amplifier, the tone is heard from loudspeaker LS-1 as well.
Voice communication. For voice communication, the person at the transmitter end
speaks into the mike while call switch S1 is open. The modulated light beam contains the
10-15kHz code frequency and voice components. After demodulation at the receiver, the
10-15kHz code component is largely bypassed by capacitor C28 at the input of LM386,
while the voice component (up to 3400 Hz) is attenuated insignifi- cantly. Thus speech is
reproduced at the output of LM386 via loudspeaker LS1. The code component (10-15
kHz) is detected by PLL IC5 signifying uninterrupted light path which is indicated by
LED2, as explained earlier.
Construction
Fig. 6 shows the power supply circuit. The AC mains is stepped down by transformer
X1 to deliver a secondary output of 9V AC at 500 mA. The transformer output is
rectified by bridge rectifier BR-1. Capacitor C1 bypasses ripple and smoothes the
rectifier output before regulation by 6V regulator
7806 (IC1). LED1 indicates power-on state. Resistor R1 acts as the current-limiting
resistor for LED.
Precautions
ere’s a password-based device switching circuit that stops un authorised persons from
switching
on/off the devices. The circuit can switch on only one device at a time, out of a maximum
of nine connected devices. To switch on/off the device, you need to enter a correct 4-
digit password via the keypad.
Fig. 1 shows the block diagram of the device switching system using password. It mainly
comprises a keypad, DTMF tone generator, DTMF decoder, demultiplexer and
password circuit. Four DIP switches (DIP1 through DIP4) are used to set up the
password.
The circuit
Fig. 2 shows the circuit for device switching using password. It can be divided into two
sections, namely, the transmitter section and the DTMF decoder-and-password setup
section.
1. The transmitter section. The transmitter circuit is built around DTMF encoder IC
UM91214B (IC1). The DTMF encoder is commonly used as a dialler IC in telephone
sets to generate DTMF tones. For its time base, IC UM91214B requires a 3.58MHz
quartz crystal, which is connected between pins 3 and 4 of IC1 to form an internal
oscillator. The oscillator output is converted into an appropriate DTMF signal through
frequency division and multiplexing by the control logic of IC1.
A telephone type keypad is connected to ICI via 4-row and 3-column lines. Pins 15
through 18 of IC1 are row pins and pins 12 through 14 are column pins. Of the twelve
keys on the keypad, we’ve used keys ‘1’ through ‘9’, ‘0’ and ‘*.’ The ‘#’ key is not used
here. Keys ‘1’ through ‘9’ are used for controlling the device, key ‘0’ is used to switch
off the device and key ‘*’ is used to reset the circuit.
As stated earlier, we’ve used here a telephone-type keypad (also used for cash/debit
card purchases) with twelve push-to-on switches to enter the password to control the
devices.
PARTS LiST
Semiconductors:
IC1 - IC UM91214B DTMF dialler IC2 - KT3170/MM8870 DTMF
decoder
Capacitors:
C1 - 10µF, 10V electrolytic C2, C3 - 39pF ceramic disk
C4, C5 - 0.01µF ceramic disk
Miscellaneous:
XTAL1, XTAL2 - 3.58MHz crystal oscillator S1 - On/off switch
DIP1-DIP4 - 4-way DIP switch
- Keypad
Thus a valid DTMF tone is the sum of a lower-frequency tone (697 Hz, 770 Hz, 852 Hz
or 941 Hz) and a higher-frequency group
(1209 Hz, 1336 Hz, 1477
Hz or 1633 Hz). The DTMF
dialling scheme allows 16
unique combinations of
tones (codes), of which elev
en codes have been used
here. DTMF tones are so
chosen that none of the
tones is harmonic of the
other tones. Therefore there
is no chance of distortion
caused by harmonics. Each
tone is sent as long as a key
remains pressed.
TheDTMFcodi ng
scheme simplifies decod
ing because the compos
ite DTMF signal may be
separated using a bandpass
filter into single frequency
components, which may be
handled individually.
When you press any key on the keypad, its binary code is output by decoder IC2. Bit one
of the binary code is fed to shift register IC4(A), the second bit is fed to shift register
IC4(B), the third bit is fed to shift register IC5(A) and the fourth bit is fed to shift
register IC5(B). The clocks for IC4 and IC5 are generated by StD pin 15 of decoder IC2
via AND gate N17. The StD clocks shift data into shift registers IC4 and IC5.
The password in decimal numbers is set through the keypad. The corresponding binary
numbers are fed through the DIP Keypad switches. The data across the No. Seq. outputs
of IC4 and IC5, along 9with the password set by DIP 7switches, should result into a low 6output across the
outputs of IC11 5through IC13. Reg. No.Once all the four digits of the password are entered, the 4-bit
static data is available at the outputs of the shift registers (IC4 and IC5).
Password setting (refer table). Suppose you want to set up the password 9765. Press
digits 9, 7, 6 and 5 sequentially and the password gets stored into shift registers IC4 and
IC5 in binary format.
For the first binary digit (A bit), data stored into IC4(A) is 1101, so you have to set 1101
through switch DIP1 by making its S1 on (1), S2 on (1), S3 off (0) and S4 on (1).
For the second binary digit (B bit), data stored into IC4(B) is 0110, so
1 0 0 1 Q3
0 1 1 1 Q2
0 1 1 0 Q1
0 1 0 1 Q0
4321
you have to set 0110 through switch DIP2 by making its S1 off, S2 on, S3 on and S4 off.
For the third binary digit (C bit), data stored into IC5(A) is 0111, so you have to set
0111 through switch DIP3 by making its S1 off, S2 on, S3 on and S4 on.
For the fourth binary digit (D bit), data stored into IC5(B) is 1110, so have to set 1110
through switch DIP4 by making its S1 on, S2 on, S3 on and S4 off.
Now your password is set and the circuit is ready to control the devices.
Password checking. IC6 through IC9 are used to check the password. If the password
fed through DIP switches is correct, all the outputs of IC6 through IC9 go low and these
are ORed by dual 4-input OR gates IC11 and IC12. Thus the outputs of gates N18
through N21 are low. The outputs of IC11 and IC12 are fed to IC13.
4. Enabling/disabling demultiplexer. The password is correct means that the inputs of
gate N22 are low as these are connected to the outputs of gates N18 through N21. As a
result, the output of gate N22 goes low, which enables the demultiplexer (IC3) for
switching the appliance. Since the output of gate N22 is also connected to pin 2 of gate
N17, it disables the clock signals of IC4 and IC5 at the same time.
If the password is wrong, the output of any one of gates N18 through N21 goes high. As a
result, the output of gate N22 also goes high, which disables the demultiplexer (IC3).
Since the output of gate N22 is also connected to pin 2 of gate N17, it enables the clocks
signals of IC4 and IC5 at the same time. As a result, the appliance cannot be controlled.
5. Appliance on/off control circuit.The first four decimal digits you enter through the
keypad form the password. Pressing the fifth decimal digit on the keypad switches on the
device. Note that a particular device can be turned on only if you enter the corresponding
decimal number on the keypad as the fifth number; for ex- ample, if you want to turn on
device No. 1, press digit ‘1’ on the keypad. Digit ‘0’ turns off the device. Key ‘*’ resets
the circuit.
Suppose the 4-digit password you entered is correct. Now if you press ‘9,’ which is the
fifth digit entered by you, the respective device No. 9 turns on via relay RL9 and inverter
N31. When you further press ‘0’ key, which is the sixth key pressed by you, Q10 output
of IC3 goes low and device No. 9 turns off. When you press the ‘*’ key, the Q12 output
of IC3 goes low and the circuit resets via inverter N32.
Fabrication
An actual-size, single-side PCB for the device switching circuit comprising both the
transmitter (encoder) and the decoder (including circuitry) is shown component layout in
Fig. 4. However, if the transmitter circuit is to be used from a remote location, it needs
to be separated. To meet this requirement, a separate PCB for the transmitter circuit is
given in Fig. 5 and its component layout in Fig. 6.
password setting in Fig. 3 and its
remote-controlled SoPHIStIcAted
electronIc code locK
Arup KumAr Sen
L
ocking up valuables is a common practice to protect them from thieves. Various types of
locks have
been built for greater security. Among these is an electronic code lock, which ensures
additional security by demanding a secret number (code) for opening the lock. Different
types of circuits using different techniques have been developed for entering the code
and its consequent processing.
Here’s a sophisticated electronic code lock using the dual-tone multi-frequency (DTMF)
signalling technique. The DTMF signalling technique improves signal readability even in
a noisy environment.
Relay A is used for opening the lock and relay B is used for closing the lock. The same
code number is used for gaining access to the circuit for activating any of the relays.
Principle
When you press any key on the DTMF encoder, a DTMF signal is generated, which is
first converted into a 4-bit equivalent binary/hexadecimal number by the DTMF decoder
and then stored in a 4-bit latch. The two numbers generated due to pressing of two keys
in sequence are stored in two different latches. The two latched numbers as a whole
form the higher and lower nibbles of an 8-bit number.
Using a magnitude comparator, the resulting number is compared with another 8-bit
number (code) applied to the comparator through two thumbwheel switches. If the two
numbers match, the result of comparison is logic 1, which would allow the operator to
switch on a relay by pressing a particular key from the keypad. The relay contacts would
then activate a motor or a solenoid to open/close the door.
In case the numbers entered via keypad and thumbwheel switches don’t match, pressing
that very key would only advance a counter to decrease the allowed number of maximum
chances for inputing the correct code. Once the maximum number of allowed attempts is
over, the chance counter disables the input system, so pressing any key doesn’t have any
effect over the relays used for opening and closing the lock until and unless the chance
counter is reset and correct code is entered
ParTs LIsT
Semiconductors:
IC1 - UM91215B DTMF dialler IC2 - MT8870 DTMF decoder IC3 - 74LS00 quad NAND gate IC4, IC5 - 74LS08
quad AND gate IC6 - CD4017 decade counter IC7, IC8 - 74LS75 4-bit bistable latch IC9, IC10 - CD4511 BCD-to-7-
segment
decoder/driver
R1
R2
R3, R18, R20 R4
R5
R6
R7
R8
R9, R10, R14, R15, R17
R11
R12, R13, R16, R19, R21
Capacitors:
C1
C2
C3
C4
C5, C6
C7
C8
Miscellaneous: S1
S2, S3
LS1, LS2
TWS1, TWS2 RL1-RL3
X1
otherwise):
- 3-kilo-ohm
- 100-kilo-ohm
- 1-kilo-ohm
- 10-ohm
- 220-kilo-ohm
- 33-kilo-ohm
- 1-mega-ohm
- 330-kilo-ohm
- 220-ohm
- 22-kilo-ohm
- 10-kilo-ohm
From Table I it is clear that if key 3 is pressed, 1477 Hz from the high-frequency group
and 697 Hz from the low-frequency group produce the corresponding DTMF signal.
The DTMF signals generated due to pressing of different keys modulate the infrared (IR)
rays generated by an IR LED. Transistor T1 (BC548) acts as the modulator. Normally,
the LED is off. But
via keypad.
Circuit description
Fig. 1 shows the block diagram of remote-controlled sophisticated electronic code lock.
The entire circuit can be divided into two sections:
1209 Hz
High-frequency group
1336 Hz 1477 Hz 1633 Hz
23A
56B
89C
0 # D, I
when a DTMF signal is applied at the base of the transistor, the LED starts emitting IR
rays due to varying collector current of transistor T1.
Dialler IC UM91215B (IC1) needs only 3 volts for its operation, but at least 4 volts
should stay across the IR LED for effective transmission. Hence a supply of 4.5 volts is
used. Three pencil cells in series can provide the required voltage. The supply for IC1 is
regulated by zener diode ZD1.
Fig. 3 shows the DTMF signal receiver, chance counter and relay driver circuit.
When Darlington phototransistor T2 (L14F1) receives the modulated IR rays from IR
LED, it converts the IR pulse train into equivalent electrical signal and couples the same
to DTMF decoder IC
Fig. 6: PCB layout of Fig. 7: Component DTMF signal generator layout for the PCB
and transmitter
CM8870 (IC2). If the signal is of sufficient amplitude and duration greater than the length
of time predetermined by R8-C4 time constant, IC2 detects the signal and outputs a high-
going pulse (StD) at its pin 15. The outputs at pins 11 through 14 of IC2 are the
hexadecimal equivalent of the detected signal. Different decoded 4-bit numbers that
would be generated due to pressing of different keys are shown in Table II.
The decoded number is latched in IC7 or IC8 depending upon the conditions governed by
the latch-enable and relayselect signal generator logic circuit built around IC3, IC4, IC6
and transistor T3. The latched data from IC8 (74LS75) goes to BCD-to-7-segment
decoder-cum-driver CD4511 (IC10). The decoded data at the TabLe II output of IC10
DC
100
200
300
401
501
601
701
810
910
010
*10
#11
A11
B11
C11
D00
Pin 12
b
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
IC7 and IC8 are also connected to 4-bit magnitude comparators IC11 and IC12 (each
CD4585), respectively. Here, the combined output of the two latches is used as one of
the two 8-bit numbers required by the magnitude comparator. Thumbwheel switches
TWS1 and TWS2 are connected to comparators IC11 and IC12, respectively, for setting
the 8-bit code. If the latched data inputs A0 through A7 from keypad and B0 through B7
from the thumbwheel switches are equal, the composite comparator outputs logic 1 at pin
3 of IC12. Output pin 3 is designated as A=B. When A=B is high, either relay A or relay
B can be energised depending upon the signal from the relay-enable signal generator
built around IC5.
The circuit is powered by 230V AC mains using switch S1. The AC mains is stepped
down by transformer X1 to deliver a secondary output of 12V-0-12V at 500 mA. The
transformer output is rectified by diodes D2 and D3 and smoothed by capacitor C7.
Regulator 7805 (IC14) provides regulated 5V supply, which is connected to the entire
circuit via normally closed (N/C) contacts of limit microswitch LS2. Another limit
microswitch LS1 is connected to the base of transistor T4.
The status of limit microswitches LS1 and LS2 depends upon the position of the door-
locking plunger. In the unlocked condition, the plunger stays in its retarded state remote
from limit microswitch LS2, and the N/C contact of LS2 allows current to the circuit. On
the other hand, the N/C contacts of limit microswitch LS1 are cutoff by the plunger and
hence relay RL1 cannot be energised. However, relay RL2 can be energised.
If the plunger is moved forward to lock the door (using relay RL2), the plunger pushes
limit microswitch LS2. When the plunger is completely advanced, it breaks the N/C
contacts of microswitch LS2 and hence the connection of the circuit with +12V power
supply. Being disconnected with the power supply, relay RL2, and consequently the
motor/solenoid driving the plunger, goes off.
To resume the supply for unlocking, one has to press push-to-on switch S3.
Consequently, the relay RL3 gets supply and pulls its armature. Even if S3 is released
now, relay RL3 would still be in the energised condition, getting supply through its N/O
contacts and providing supply to the circuit.
When the plunger is moved forward from its retarded position, microswitch LS1 frees
itself and reconnects to the base of transistor T4, allowing relay RL1 to be activated. If
the plunger is moved back to open the door (using relay RL1), limit microswitch LS1
would again be pushed and disconnect from the base of transistor T4, stopping the
supply to the motor/solenoid. Thus the two microswitches also act as the limit switches
for the motor.
When the circuit is switched on, counters IC6 (CD4017) and IC13 (CD4033) are reset
by the power-on-reset citcuits comprising R13 and C5, and R16 and C6, respectively.
So pin 13 of IC13 and Q0 output of IC6 both go high.
Now, if any key is pressed, and the generated IR ray having sufficient am- plitude falls
on phototransistor T2, the decoded data would be available at the outputs of IC2. The
StD pulse from pin 15 of IC2 goes to pin 9 of IC5. Since pin 10 of IC5 is already high
due to pin 13 of IC13, the output of AND gate N11 would be a high-going pulse having
duration equal to StD. This output pulse would make pin 1 of AND gate N5 high. AND
gates N5 and N6 of IC4 together form a 3-input AND gate, which receives inputs at pins
4 and 5 from NAND gates N1 and N3 of IC3, respectively.
Normally, the outputs of NAND gates N1 and N3 are high if none of the keys ‘0’, ‘*’ and
‘#’ is pressed (refer Table II), so pin 2 of AND gate N5 is also high. Pin 3 of AND gate
N5 goes high whenever pin 8
Fig. 8: Actual-size, single-side PCB layout of the receiver, chance counter and relay
driver circuit
Fig. 9: Component layout for the PCB
of N11 goes high. Since pin 10 of N7 and pin 13 of N8 are tied to pin 3 of N5, these
would also go high. Pin 12 of N8 is already high by the Q0 output of IC6 (CD4017). The
output of N8 goes to latch-enable pins 4 and 13 of IC8.
The 4-bit data output of IC2 goes to latches IC7 and IC8. The StD pulse from IC2
forward biases transistor T3 to generate a clock pulse at its collector. This pulse being
applied to the clock input of counter IC6 (CD4017), the counter advances by one and its
Q1 output toggles from low to high state.
Now, if another key is pressed, the corresponding hexadecimal number is latched to IC7.
At the end of this latching process, transistor T3 comes out of its saturated state and
again applies a clock pulse to counter IC6. The counter advances by one to make its Q2
output high. Since Q2 output is tied to reset pin 15 of IC6, it immediately resets IC6 and
its Q0 output goes high again. The process continues as long as one goes on pressing
keys, except ‘0,’ ‘*’ and ‘#.’
When ‘#’ key is pressed, the output of NAND gate N1 goes low as both of its of NAND
gate N1 goes low as both of its input AND gate formed by N5 and N6 is disabled, hence
STD1 pulse is not allowed to change the counter CD4033 state or enable any latch to
change its previously latched data.
The relay RL1 driving signal would be high if both the inputs of N11 are high. Pin 1 of
N9 is fed by the composite comparator’s output at pin 3 (A=B) of IC12. So pin 1 of N9
would be high if the numbers latched in IC7 and IC8 are equal to the number preset by
thumbwheel switches TWS1 and TWS2. The input at pin 2 of gate N9 will be high when
‘#’ key is pressed. Output at pin 3 of gate N9 is used to generate the relay RL1 select
signal and clock for IC13.
So for driving relay RL1, one has to enter the correct code, then press ‘#’ key on the
keypad. On the other hand, for driving relay RL2, one needs to press ‘0’ key after
entering the correct code from the keypad. The magnitudes of the relay drive signals from
gates N9 and N12 are boosted by transistors T4 and T5, respectively.
Since the lock-opening code comprises only two decimal digits, the number of chances
to open the lock has been limited to two to ensure security. This is achieved with a
chance counter built around decade counter-cum-7-segment decoder CD4033 (IC13).
The power-on reset signal to counter IC13 is provided by capacitor C6 and resistor R16.
The counter remains reset until ‘#’ key is pressed. When ‘#’ key is pressed, pin 5 of gate
N10 goes high by the relay RL1 select signal. Pin 4 of the same gate also goes high by
STD1 pulse if output pin 13 of IC13 is high. So the counter would get a clock pulse only
when ‘#’ key is pressed and its output pin 13 is high. But the clock pulse would advance
the counter by one only if the counter’s chip-enable input (pin 2) is low.
Pin 2 of counter IC13 is connected to the output of the composite comparator (at pin 3
(A=B) of IC12). So if the correct code is entered from the keypad, the high A=B output
would inhibit the counter from advancing. But if the entered code is wrong, the low A=B
output would allow the counter to advance by one.
In this way, the counter tracks the number of failed attempts and displays the same on 7-
segment display DIS3. If display DIS3 shows ‘1,’ it means that one of the allowed
chances have been exhausted.
The segment-c output (pin 13) of IC13 goes low with the exhaustion of two chances,
which disables gate N11 and no STD1 pulse is generated further. So the input system
would have no control over relay RL1 or RL2.
However, you can retry opening the lock by either of the following two ways:
1. Switching off the power supply to the circuit and then switching it on again to apply a
power-on-reset to the chance counter.
2. Pushing manual reset switch S2 of the chance counter.
Construction
The transmitter part (acting as the key) is powered by a battery, so one can carry the
same along with him. The lock system, including the IR receiver and relay driver circuit,
is fitted on the back side of the door to be locked. The mechanical arrangement for the
same is shown in Fig. 4. The manual reset switch, which you can use in the case of
emrgency, must be kept hidden. You can mount it on the back side of the door such that in
the case of emergency, you can access it from the front of the door by drilling a hole on
the door. Drill a hole in front of the IR sensor (phototransistor T2) so that when the IR
LED of transmitter is brought in front of the door, the emitted IR ray falls on the sensor.
Mount the 7-segment displays on the front side of the door, so you can view the entered
data code.
Alternatively, you can mount the entire transmitter-receiver combination on the back of
the door. But, in that case, the keypad must be kept exposed for code entry from the front
side of the door. The output of the transmitter can be connected directly to the receiver
input, eliminating the need for infrared radiator. For the purpose, connect resistor R1 of
the transmitter section directly to capacitor C3 of the receiver section after removing IR
diode, transistor T1 (transmitter section), phototransistor T2 and resistor R5 (receiver
section).
Whatever be the mounting option, it must be borne in mind that although IC2 (CM8870)
is capable of detecting/decoding all the DTMF codes shown in Table I, only digits 1
through 9 can be used for formation of a code. The numbers representing ‘0,’ ‘#,’ and ‘*’
keys haven’t been used to form the code. Hence, the thumbwheel switches must be set to
form a code between numbers 1 to 9 only.
Fig. 5 shows the connections of relays RL1 and RL2 to drive a single reversible-type
AC motor. Instead of the motor, a solenoid can also be used to drive the plunger for
opening or closing the door. If you use the solenoid, limit switch LS1 can be dispensed
with to directly drive the base of transistor T4.
2. Switch on the DTMF transmitter and hold it close to the door such that the emitted IR
ray falls on the sensor (phototransistor T2).
5. If the entered code is correct, relay RL2 energises and the motor starts running to
rotate the plunger in reverse direction to disengage it from the supports. As soon as the
plunger pushes limit microswitch LS1, the motor stops. Now you can push the shutters to
open the door.
Emergency blocking
If you fail to enter the correct code in the allowed two chances, the input system would
not accept any more signal from the IR transmitter until and unless the receiver is reset.
Resetting can be done by either momentarily cutting the power to the circuit by using
power switch S1 or by pressing manual reset switch S2. These switches should be kept
hidden and used only in the case of emergency.
For greater security, you can increase the number of digits forming the code with some
changes in the circuit. For a 3-digit code, you need to add another CD4585.
Actual-size, single-side PCBs for the transmitter and the receiver, chance counter and
relay driver circuit are given in Figs 6 and 8, respectively, and their component layouts
in Figs 7 and 9, respectively.
Readers’ comments
I have the following queries:
1. The code lock is working well but its range is 12.7 cm to 15 cm (5 to 6 inches) only.
Why?
10001
20010
30011
40100
50101
60110
70110
81000
91001
01010
*1011
#1100
A1101
B1110
C1111
D0000
proper orientation of the IR LED and the sensor (2N5777). Fig. 1 here shows the
sensitive surface on the devices that transmits/receives the IR radiation.
IC 91215B can stand supply voltage of up to 5.5V, so supply voltage to the dialler may
be increased slightly to extend the range. However, keep in mind that the gadget is not
meant for use as a remotecontrolled device. So a range of 12.7 to 15 cm is sufficient for
opening or closing the door.
temPerAture IndIcAtor uSIng
H
The circuit
Fig. 1 shows the block diagram of the temperature indicator using microcontroller
AT89C52. The power supply for the circuit is regulated by IC 7805 and supplied to
different parts of the unit. DS1621 is the temperature sensor chip. The microcontroller
unit (MCU) reads the temperature from the sensor. The temperature data is compared
with certain user-defined temperature values and processed inside the MCU as per the
program and then sent to the LCD for display.
Power supply. The power supply unit consists of a step-down transformer (230V AC
primary to 0-9V, 250mA secondary), bridge rectifier and voltage regulator. The output
of the transformer is fed to bridge rectifier diodes D1 through D4 (each 1N4007). The
ripple from the output bridge rectifier is filtered by capacitor C1 and fed to regulator IC
7805. The regulated output is given to the temperature sensor, microcontroller unit and
LCD module, respectively.
When switch S1 is closed, LED1 glows to indicate the presence of power in the system.
sensor chip DS1621 (IC3) is an 8-pin DIP IC. Its pin details are shown in Fig. 3 and the
internal block diagram in Fig. 4. The chip can measure temperatures from
–55°C to +125°C in 0.5°C increments, which are read as 9-bit values. It can operate off
2.7V to 5.5V. Data is read/written via a 2-wire serial interface. Pins 1 and 2 of the
temperature IC are connected to pins 11 and 10 of the microcontroller, respectively.
The thermal alarm output (Tout) of IC DS1621 activates when the temperature exceeds
user-defined high temperature TH. The output remains active until the temperature drops
below user-defined low temperature TL. User-defined tempera- ture settings are stored
in the non-volatile memory. Temperature settings and temperature readings are all
communicated to/from IC DS1621 over a 2-wire serial cable. The most significant bit
(MSB) of the data is transmitted first and the last significant bit (LSB) is transmitted last.
Addressing. The chip address of DS1621 comprises internal preset code nibble ‘1001’
(binary) followed by externally configurable address pins/bits A2, A1 and A0. The
eighth bit of the address byte is determined by the type of operation (either read or write)
that is to be performed. For writing to the device the eighth bit is ‘0’ and for reading
from the device the eighth bit is ‘1.’ In our case, A2, A1 and A0 pins are grounded and
hence the device address for writing is ‘1001000b’ or 90(hex) and for reading the
device address is ‘10010001b’ or 91(hex).
quired if DS1621 is used for thermostat control, since it contains flag bits THF (high-
temperature flag) and TLF (lowtemperature flag) which are set to ‘1’ when temperature
crosses the respective limits earlier written into TH and TL registers. It also contains the
flag bit (Done), which is set to ‘1’ when results of conversion are available after issuing
of start conversion command EE(hex). The other bits of configuration register are
defined below:
‘NVB’ is the non-volatile memory busy flag, ‘1’ is write to an E2 memory cell in
progress, ‘0’ indicates that non-volatile memory is not busy, ‘POL’ is non-volatile output
polarity bit (‘1’=active-high and ‘0’=active-low) and ‘1SHOT’ is one-shot mode. A
copy to E2 may take up to 10 ms. If 1SHOT is ‘1,’ DS1621 will perform one temperature
conversion upon reception of the Start Convert T protocol. If 1SHOT is ‘0’, DS1621
will continuously perform temperature conversions. This bit is nonvolatile.
Command Set. Complete command instruction set for accessing various internal
registers as well as for starting and stopping of conversion process are given in Table I.
For understanding the exact sequence in which Start bit, address byte, acknowledgement
bit, command byte(s) and data byte(s) are to be sent along the I2C bus, please refer to the
datasheet of DS1621, wherein these aspects have been explained in proper detail. This
will help
Ports 0 and 2 are 8-bit bidirectional input/output (I/O) ports. These ports haven’t been
used in this temperature indicator.
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Ports 1.0 through 1.7 are
connected to pins 7 through 14 of the LCD. Port-1 output buffers can sink/ source four
TTL inputs.
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Ports 3.0 and 3.1 of IC2
are connected to serial clock line (SCL) and serial data line (SDA) of IC3, respectively.
Ports 3.2 through 3.4 are connected to pins 4 through 6 of the LCD, respectively. Port-3
output buffers can sink/source four TTL inputs.
A 12MHz crystal oscillator is connected to XTAL1 and XTAL2 pins for operation of the
microcontroller. A high pulse on RST pin (pin 9) while the oscillator is running resets
the microcontroller. In this circuit, this pin is connected to +Vcc through capacitor C5
(10 µF, 16V). The external-access enable pin (EA) is connected to +Vcc for internal
program executions. This pin also receives the 12V programming-enable voltage (VPP )
during flash programming when 12V programming is selected.
The program
The C-language program for microcontroller AT89C52 is compiled using cross-
compiler C51 Version 7.10 from Keil Software. The demo version of this compiler is
available for free on the Website ‘www.keil.com.’ It can compile programs up to 2 kB
only, which is sufficient for writing most programs.
For testing the display, the program Hello.c is given here. This program,
ParTs LIsT
Semiconductors:
IC1 - 7805 regulator IC
IC2 - AT89C52 microcontroller IC3 - DS1621 temperature sensor D1-D4 - 1N4007
rectifier diodes LED1 - Red LED
Capacitors:
C1 - 470µF, 25V electrolytic capacitor
Miscellaneous:
Transformer - 230V AC primary to 0-9V,
250mA secondary
Crystal - 12 MHz
LCD - 16×1 LCD module
S1 - On/Off SPST switch
when loaded to AT89C52, displays “Hello! How R U?” on the LCD. The Hello.c
program has nothing to do with temperature. It just guarantees a perfect communication
between the LCD and the microcontroller. For temperature indication, the program
Temp52.c is used. The programs Hello.c and Temp52. c, along with the hex files, are
given at the end of this article.
The communication interface between the temperature sensor and the microcontroller
chip follows the I2C (Inter Integrated Circuit) standard, which is implemented in ‘C’
here. I2C is a simple master/slave type interface. Simplicity of the I²C system is
primarily due to the bidirectional 2-wire (SDA and SCL) design and the protocol format.
Bidirectional communication is through 2-wire lines (which are either active-low or
passive-high). In the program, the i2c_stop, i2c_start, i2c_write and i2c_read functions
are used for communicating Clock and Data from DS1621 to P3.0 and P3.1 of AT89C52,
respectively. Such functions as command, ready and display in the program are used for
driving the LCD.
Program compilation for 8051 family controller. Keil C51 can compile C programs
for most of the Atmel family microcontrollers. It also supports other devices. Unlike
other cross-compilers (Hi-Tech, IAR, SDCC, etc), Keil C51 offers such features as fast
code generation,
strong multitasking environment, real-time operating system and inbuilt code optim-
isation. To enjoy these features, you’ll need other assembler. As far as code generation
is concerned, it uses minimum RAM and on-chip flash, allowing faster and optimised
program in Intel-Hex format, which can be loaded to the microcontroller using any
programmer. Conversion of C program into Intel-Hex format takes only a few seconds.
In fact, you don’t require
LCD
For display, a Lampex make 16x1 LCD (model GDM1601A) was used. Pin connections
of this LCD are given in Table II. Pins 15 and 16 haven’t been used. Pin 3 is con15 and
16 haven’t been used. Pin 3 is con kilo-ohm preset that is used to control the light
intensity of the LCD. Note that the Hitachi make 16×1 LCD (HD44780A00) will not
work in this project.
Construction
Fig. 6: Solder-side PCB layout for temperature indicator Fig. 7: Component layout
for the PCB using AT8952
the solder points on the PCB. Capacitors C3 and C4 must be connected near IC2 and
IC3, respectively. The actual-size, single-side PCB layout for the circuit and its
component layout are shown in Figs 6 and 7, respectively.
Program compilation
After you’ve installed Keil C51 in your PC, you can compile C program and generate
hex file in either DOS or Windows mode. Here, program compilation for the program
Hello.c has been explained. The same procedure is to be followed for the temperature
indication program Temp52. c. For more example programs, refer to the directory in
your hard drive where Keil is installed in the example folder.
DOS mode. 1. Installation of Keil C51 automatically generates ‘Keil’ folder in your
computer’s C drive.
Instruction
Read Temperature
Access TL
Access Configuration
‘.uv2.’
5. Select CPU as Atmel/AT89C52.
6. Choose ‘Yes’ in the option “Copy standard 8051 code to current project folder.”
7. Choose ‘View/Project Window.’ A ‘Project Workspace’ window appears.
8. Double-click ‘Target 1.’
9. Right-click ‘Source Group1’ and select “Add files to Group ‘Source Group1.’” A
window appears.
10. Add ‘Hello.c’ and close this window.
TabLe II
Pin Connections of the LCD Pin No. Functions
TabLe I
Ds1621 Command set
Description Protocol
6. Type ‘bl51 Hello. obj.’ This command is used for linking the Hello.obj file created by
Keil C51.
7. Type ‘oh51 Hello.’ This command is used for creating the hex file.
Windows mode. 1. Installation of Keil C51 software automatically creates the icon
‘Keil uVision2’ on the desktop.
2. Double-click ‘Keil uVision2.’
3. Suppose you have kept ‘Hello.c’ under ‘C:\Windows \ Desktop\Hello’ folder. Open
‘Hello.c’ from the ‘File’ menu.
4. From the menu bar, select ‘Project/ New Project.’ Name the new project and save it
with extension
Pin 1
Pin 2
Pin 3
Pin 4
Pin 5
Pin 6
Pin 7
Pin 8
Pin 9
Pin 10 Pin 11 Pin 12 Pin 13 Pin 14 Pin 15 Pin 16 Ground (Gnd)
+Vcc
V0 (display intensity control) RS (connected to P3.2 of AT89C52) R/W (connected to
P3.3 of AT89C52) EN (connected to P3.4 of AT89C52) D0 (connected to P1.0 of
AT89C52) D1 (connected to P1.1 of AT89C52) D2 (connected to P1.2 of AT89C52) D3
(connected to P1.3 of AT89C52) D4 (connected to P1.4 of AT89C52) D5 (connected to
P1.5 of AT89C52) D6 (connected to P1.6 of AT89C52) D7 (connected to P1.7 of
AT89C52) Backlight +Vcc (not used)
Backlight Gnd (not used)
11. Double-click ‘Source Group1’ on the ‘Project Workspace’ window. Now the file
name ‘Hello.c’ appears.
12. From ‘Project’ menu, select ‘Options for File ‘Hello.c.’ In ‘Properties,’ choose file
type as ‘C source file.’
13. Again from ‘Project’ menu, select ‘Options for Target ‘Target1.’” A screen appears.
14. Choose ‘Output’ and tick on ‘Hex File’ for generating the hex file. Again choose
‘Listing’ option and tick on ‘Conditional and Assembly Code’.
15. Open the Project menu and select ‘Build Target’ or press F7. The compiler shows
“”Hello” 0 Error(s), 0 Warning(s)” in the output window just below the project
window.
16. Close the screen and go to the ‘Hello’ folder to see the generated hex file and listing
file.
Load the hex file into the microcon - troller chip using a programmer. (Here’ we’ve used
Atmel Flash Programmer from Frontline Electronics.) Now integrate the microcontroller
chip into the populated PCB comprising the temperature sensor and the LCD module.
Troubleshooting
1. Check the COM port on your PC before programming.
2. In case there is no message even if all the connections are correct, adjust the intensity
control potentiometer (VR1) for display.
3. Check whether your hex file matches with the hex file given below in the article.
4. If the LCD shows wrong characters, replace it with another make LCD.
5. If DS1621 is not connected properly to AT89C52, the display will be completely
blank.
Note: All the source codes and relevant files of this article have been included in CD.
/* Written By: Aditya Rane
T.E Computer Engg, Lokmanya Tilak College of Engineering, New Bombay, Vashi
E-mail: aditya@orionengg.com
Program for temperature indicator compiled under
keil 'C' */
#include<stdio.h>
#include<string.h>
#include<Regx52.h>
//-----------------------------------------------------------------------//Global Variable
//------------------------------------------------------------------------int temperature;
#define HIGH 0x01 // Active High Signal #define LOW 0x00 // Active Low Signal #define TRUE 0x01 // Active High
State #define FALSE 0x00// Active Low State
i2c_start();
i2c_write(0x90); i2c_write(0xEE); i2c_stop();
i2c_start();
i2c_write(0x90); i2c_write(0xAA); i2c_start();
i2c_write(0x91); ch = i2c_read(); i2c_stop();
TEmP52.C
temperature = 0;
convert(ch);
if(flag == FALSE)
{
}
else {
flag = TRUE;
tmp = temperature;
if(tmp != temperature) {
tmp = temperature;
s",temperature," Centigrade");
}
}
sprintf(str,"%d%
} } j <<= 1;
CLOCK = HIGH; j |= DATA;
delay_time();
CLOCK = LOW;
for(x=0;x<8;++x)
{ if(((ch & 0x80) ? 1 : 0)) temperature = temperature + arr[x] * ((ch & 0x80) ? 1 : 0);
ch <<= 1;
}
}
else
{
ch=~ch;
ch=ch+1;
for(x=0;x<8;++x) {
while(P1_7) {
if(((ch & 0x80) ? 1 : 0)) temperature = temperature + arr[x] * ((ch & 0x80) ? 1 : 0);
ch <<= 1;
}
temperature=-temperature;
}
}
:100F270025642573002043656E7469677261646583 :090F3700008040201008040201B2
:100DA800C2007F3C7E00120F9A7F0C7E00120F9
AC1
:100DB8007F067E00120F9A120F8B7F90120EB87F5B :100DC800EE120EB8120F6A120F8B7F90120EB87
FB8
:100DD800AA120EB8120F8B7F91120EB8120F098
F3C
:100DE80034120F6AE4F508F509AF34120CF220004A
:100DF8000AD20085082285092380BCE5236509708D
:100E080004E522650860B08508228509237538FF46
:100E180075390F753A2785083B85093C753DFF757F
:100E28003E0F753F2C7B007A00792412085C7F0105
:100E38007E00120F9A7F807E00120F9A7B007A0044
:080E48007924120E50020DBFC7
:0E0F7C00E4FFFE0FBF00010EEF64644E70F53F
:010F8A002244
:0F0F8B00D2B1120F7CD2B0120F7CC2B1C2B02211
:100F6A00C2B0C2B1D2B0120F7CD2B1A2B1E433
F591
:010F7A003541
:010F7B002253
:020EB800AD0784
:100EBA00E4FCED30E703D38001C392B1ED25E0FDF8
:100ECA00D2B0120F7CC2B00CBC08E7A2B1E433FC6A
:070EDA00D2B0120F7CC2B080
:010EE10022EE
:100F0900E4FDA2B1E4FCED25E0FDD2B0A2B1E433E9
:0D0F19004205120F7CC2B00CBC08EBAF0506
:010F260022A8
:020CF2008F353C
:100CF40078377C007D007BFF7A0F79387E007F088F
:100D0400120C2CE53530E7047F0180027F00EF7080
:100D140041F536E53530E7047F0180027F00EF605E
:100D24002374372536F8E6FD7C00E5357E0030E790
:100D3400047F0180027F00120C7FEF2509F509EE84
:100D44003508F508E53525E0F5350536E536B4080A
:100D5400C2226335FF0535E4F536E53530E7047F17
:100D64000180027F00EF602374372536F8E6FD7CAE
:100D740000E5357E0030E7047F0180027F00120C1D
:100D84007FEF2509F509EE3508F508E53525E0F589
:100D9400350536E536B408C2C3E49509F509E4958A
:030DA40008F50847
:010DA7002229
:100F4000C2B47590FFC2B2D2B3309706C2B4D2B465
:050F500080F7C2B4228D
:0E0F9A00120F408F90C2B2C2B3D2B4C2B422C2
:060E50008B358A3689375C
:100E5600E4F538F539AB35AA36A937120F55EF2424
TEmP52.hEx
:100E6600FFFFEE34FFFED3E5399FE5389E5042E59D :100E7600396408453870067FC0FE120F9AE539645A
:100E860010453870067F80FE120F9A120F40AB3560 :100E9600AA36A937853982853883120C52F590D245
:100EA600B2C2B3D2B4C2B40539E53970A8053880E8 :010EB600A497
:010EB7002218
:03000000020FA844
:0C0FA800787FE4F6D8FD758148020DA8A2 :100B5C00E709F608DFFA8046E709F208DFFA803
E7B
:100B6C0088828C83E709F0A3DFFA8032E309F60868 :100B7C00DFFA8078E309F208DFFA807088828C83D0
:100B8C00E309F0A3DFFA806489828A83E0A3F60884 :100B9C00DFFA805889828A83E0A3F208DFFA804C5E
:100BAC0080D280FA80C680D4806980F28033801035 :100BBC0080A680EA809A80A880DA80E280CA80339E
:100BCC0089828A83ECFAE493A3C8C582C8CCC58316
:100BDC00CCF0A3C8C582C8CCC583CCDFE9DEE780E6
:100BEC000D89828A83E493A3F608DFF9ECFAA9F065 :100BFC00EDFB2289828A83ECFAE0A3C8C582C8CCBB
:100C0C00C583CCF0A3C8C582C8CCC583CCDFEADED3 :100C1C00E880DB89828A83E493A3F208DFF980CC35
:100C2C0088F0EF60010E4E60C388F0ED2402B4042E :100C3C000050B9F582EB2402B4040050AF232345D5
:060C4C008223900BAC7343
:100C5200BB010CE58229F582E5833AF583E0225057 :100C620006E92582F8E622BBFE06E92582F8E222A1
:0D0C7200E58229F582E5833AF583E49322BB :100C7F00EF8DF0A4A8F0CF8CF0A428CE8DF0A42E89
:020C8F00FE2243
:10080000E5442438F8E60544227835300802783883 :10081000E475F001120CBC020C912001EB7F2ED28A
:10082000018018EF540F2490D43440D4FF30050BCE :10083000EF24BFB41A0050032461FFE545600215A0
:10084000450548E5487002054730080D7835E475E0 :10085000F001120CBCEF020CAA020EE27403D208E3
:100860008003E4C208F5448B358A368937E4F545C0 :10087000F547F548E54560077F2012083B80F57590
:1008800046FFC202C201C203C204C206C207C209B5 :10089000120809FF700D3008057F0012084CAF48A0
:1008A000AE4722B4255FC2D5C205120809FF24D085 :1008B000B40A00501A75F00A784530D50508B6FF1D
:1008C0000106C6A426F620D5047002D20480D924DD :1008D000CFB41A00EF5004C2E5D205020A4CD2028E
:1008E00080C6D20180C0D20380BCD2D580BAD206E5 :1008F00080B47F2012083B2003077401B5450040F7
:10090000F1120800FF12083B020874D209D20780D6 :1009100095120800FB120800FA120800F94A4B7001
:1009200006791D7A0B7BFF20032EE545602A7E00A9 :100930008E82758300120C5260060EEE654670F0D2
:10094000C2D5EBC0E0EAC0E0E9C0E0EE120A93D005 :10095000E0F9D0E0FAD0E0FB120C91FF60AAEBC006
:10096000E0EAC0E0E9C0E012083BD0E02401F9D0A1 :10097000E03400FAD0E0FBE5460460DCD546D980DF
:10098000877BFF7A0A798FD203809C791080027965 :1009900008C207C2098008D2D5790A8004790AC240
:1009A000D5E546047002F546E4FAFDFEFF120800A4 :1009B000FC7B08200213120800FD7B1030010A1294
:1009C0000800FE120800FF7B20EC3382D592D55040 :1009D00013C3E43001069FFFE49EFEE42002039D62
:1009E000FDE49CFCE4CBF8C202EC700CCFCECDCC85 :1009F000E824F8F870F38017C3EF33FFEE33FEED11
:100A000033FDEC33FCEB33FB994002FB0FD8E9EBF1 :100A1000300205F8D0E0C448B202C0E00AEC4D4E06
:100A20004F78207B0070C2EAB5460040BCC0E0129F :100A30000A95D0F0D0E0200204C4C0E0C4B202C0E5
:100A4000F0120824D0F0D5F0EB020874120CCC0997 :100A50001153098B5808E24C08DE42098F4F099761
:0F0A60004409974908F743099D550981460981C3 :100A6F00450981470B3D5008E62D08EA2E090D2B4D
:100A7F0008EE23090B200B262A08A64800000905BB :100A8F003F3F3F00790AA2D5200414300609B91060
:100A9F00020404B9080104A2D52007025001042062 :100AAF0003689203B545005034C0E07F203004192D
:100ABF007F30A20372077206500F120AECC203C2F4 :100ACF0007C206C2097F30800F300603E9C0E0126B
:100ADF00083B300603D0E0F9D0E0B545CC3006171F :100AEF007F30B9100C12083B7F583005077F788094
:100AFF0003B9080312083B3003057F2D02083B7F23 :100B0F00202009F87F2B2007F322920380CF286E35
:100B1F00756C6C2900D2021208003002F8C20278FC :100B2F004530D50108F60208A62D50434958120842
:100B3F00002403B405004001E4900B389312082CF5 :0D0B4F00743A12082CD20475450402098B7B
:100F5500E4FFFE120C91600C0FEF70010E09E970B1 :050F6500F20A80EF22FA
:100C9100BB010689828A83E0225002E722BBFE0261 :090CA100E32289828A83E4932294
:100CAA00BB010689828A83F0225002F722BBFE0129 :020CBA00F32223
:100CBC00FAE6FB0808E6F925F0F618E6CA3AF62239 :100CCC00D083D082F8E4937012740193700DA3A3B7
:100CDC0093F8740193F5828883E4737402936860CB :060CEC00EFA3A3A380DFCB
:100EE200EFB40A07740D120EED740A309811A89926 :100EF200B8130CC2983098FDA899C298B811F63070
:070F020099FDC299F5992247
:00000001FF
void ready(void);
void command(int);
void display(char *);
void main (void)
{
command(0x3c);
command(0x0c);
command(0x06);
command(0x01);
command(0x80);
display("Hello! How R U ?"); while(1);
}
void command(int a) {
hELLo.C
void ready(void);
ready();
P1=a;
P3_2=0x00;
P3_3=0x00;
P3_4=0x01;
P3_4=0x00;
}
if(i == 8)
command(0xc0); if(i == 16)
command(0x80); ready();
P1 = str[i];
P3_2 = 0x01; P3_3 = 0x00; P3_4 = 0x01; P3_4 = 0x00;
}
}
void ready(void) {
P3_4=0x00;
P1=0xff;
P3_2=0x00;
P3_3=0x01;
while(P1_7)
{
:0300000002092AC8
:0C092A00787FE4F6D8FD75810E0208AE5F :1009190048656C6C6F2120486F7720522055203F25 :0109290000CD
:1008AE007F3C7E001209067F0C7E001209067F0631 :1008BE007E001209067F017E001209067F807E00EF
:0E08CE001209067BFF7A09791912080080FED4 :100906008E0D8F0E1208DC850E90C2B2C2B3D2B421
:03091600C2B42246
:060800008B088A09890A39
P3_4=0x00; P3_4=0x01; }
P3_4=0x00;
}
Readers’ comments
I have purchased the complete kit, While assembling it, I found that the J2 label shown
on the PCB is missing in the kit. As such, the LCD module could not be attached to the
PCB. Also, J1 label
hELLo.hEx
:10080600E4F50BF50CAB08AA09A90A1208F1EF24C6
:10081600FFFFEE34FFFED3E50C9FE50B9E5042E54D :100826000C6408450B70067FC0FE120906E50C64D1
:1008360010450B70067F80FE1209061208DCAB0815
:10084600AA09A90A850C82850B83120868F590D23D :10085600B2C2B3D2B4C2B4050CE50C70A8050B80C5
:01086600A4ED
:01086700226E
:1008DC00C2B47590FFC2B2D2B3309706C2B4D2B4D0
:0508EC0080F7C2B422F8
shown on the PCB having two holes has neither been shown in the circuit diagram nor it
was found in the kit. Please clarify.
EFY: J1 and J2 are nothing but jumper connectors. You can use any conductor wire to
connect them. The respective holes for connecting these jumpers are provided in the
PCB.
PIC16F84-based Coded deVICe
swItChIng system
H
ere’s a microcontroller-based code lock that can be used for pre venting unauthorised
access to
A buzzer has been added to provide suitable feedback with respect to the data entered
via the keypad. The number of beeps indicates whether the data has been entered
correctly or not. When anyone trying to access the device enters the
Vijaya Kumar P.
Working model of PIC16F84-based coded device switching system
incorrect password three times, the circuit sounds an alarm.
The alarm can be configured to work in two modes: auto-reset and latch-up. In the auto-
reset alarm mode, all the keys pressed are ignored and the buzzer keeps beeping
continuously for one minute, and thereafter the code lock resets automatically.
However, if you want additional security, you can enable the latch-up mode. In this mode
the code lock never switches to the normal mode from the alarm mode and the only way
to reset the code lock is to interrupt the power. When not in use, the code lock goes into
sleep mode, and
it wakes up if any key is pressed. This feature reduces the power consumption by the
microcontroller.
Circuit description
Fig. 1 shows the block diagram of the microcontroller-based code lock. Pin diagram of
PIC16F84 microcontroller is shown in Fig. 2. Basically, the circuit
Parts List
Semiconductors:
IC1 - 7805 +5V regulator
IC2 - PIC16F84 microcontroller
T1-T5 - BC547 npn transistor
D1-D5 - 1N4007 rectifier diode
LED1-LED4 - Red LED
Resistors (all ¼-watt, ±5% carbon, unless
stated otherwise):
R1 - 10-kilo-ohm
R2 - 4.7-kilo-ohm
R3-R5 - 220-ohm
R6-R10 - 2.2-kilo-ohm
R11-R14 - 1-kilo-ohm
Capacitors:
C1 - 470µF, 35V electrolytic
C2, C3 - 0.1µF ceramic disk
C4, C5 - 33pF ceramic disk
Miscellaneous:
RL1- RL4 - 12V, 285-ohm, 1C/O relay
The password is stored in the internal 64-byte EEPROM memory of the microcontroller
at addresses 0x00 through 0x3F. The memory can be programmed and read by both the
device programmer and the CPU when the device is not code
Four special-function registers are used to read and write the EEPROM. These registers
are named as EECON1, EECON2, EEDATA and EEADR, respectively. Register
EEDATA holds 8-bit data for read/write and register EEADR holds the address of the
EEPROM location being accessed. Register EECON1 contains the control bits, while
register EECON2 is used to initiate the read/write operation.
Oscillator. The internal oscillator circuitry of the microcontroller generates the device
clock. The microcontroller can be configured to work in one of the four oscillator
modes:
1. External resistor-capacitor
2. Low-power crystal (oscillation frequency up to 200 kHz)
3. Crystal/resonator (oscillation frequency up to 4 MHz)
4. High-speed crystal/resonator (oscillation frequency up to 10 MHz)
In this circuit, the oscillator is configured to operate in crystal mode with a 4MHz crystal
along with two 33pF capacitors.
Reset circuit. The built-in power-on reset circuitry of the microcontroller eliminates the
need for the external power-on reset circuit. In the circuit, MCLR pin is tied to VDD
through resistor R1 (10 kiloohms) to enable power-on reset. The internal power-up timer
(PWRT) provides a nominal 72ms delay from power-on reset. This delay allows VDD to
rise to an acceptable level when the microcontroller is powered on. The oscillator start-
up timer (OST) provides 1024-oscillator cycle delay after the power-up timer delay is
over. This ensures that the crystal oscillator has started and is stable.
Power supply. The 12V DC supply for the circuit is obtained from a 12V adaptor with
500mA rating. Any other source such as a 12V lead-acid battery can also be used. This
12V DC is used for operation of the relays used in the circuit. The regulated +5V supply
for the microcontroller is derived using regulator IC 7805 (IC1). Diode D1 protects the
circuit from reverse supply connections. Capacitor C1 filters out the ripples present in
the incoming DC voltage.
Keyboard. The 12-key matrix keyboard comprises 12 tactile pushbutton switches
arranged in four rows and three columns as shown in Fig. 3. Data is entered via this
keyboard.
Ports A and B of the microcontroller are bidirectional I/O ports. Three lines of Port A
(RA0 through RA2) are used as the output-scan lines and four lines of Port B (RB4
through RB7) are used as the input-sense lines. Port B of IC2 has weak
internal pull-ups, which can be enabled through the software. This eliminates the need
for connecting external pull-up resistors to pins 10 through 13. Resistors R2 through R4
protect Port A’s output drivers from shorting together when two keys of the same row
are inadvertantly pressed simultaneously.
In the scanning routine, initially all the scan lines are made low and it is checked
whether all the keys are in released state. If all the keys are in released state, the If any of
the sense lines is found low, it means that a key at the intersection of the current scan line
and the low sense line has been pressed. If no key is found to be pressed, the next scan
line is made low and again scan lines are checked for low state. This way all the twelve
keys are checked for any pressed key by the microcontroller.
In sleep (powerdown) mode, the device oscillator is turned off and the microcontroller
is placed in its lowest-current consumption state.
Also note that the microcontroller’s processor is put into sleep (power-down)
mode. The interrupt-on-change feature of
Port-B pins RB4 through RB7 is used to
wake up the processor from sleep.
When any key is pressed, one of the
sense lines becomes low. This change in
the pin status causes an interrupt to wake
up the microcontroller (IC2) from sleep.
Now each scan line is made low
while keeping the remaining scan lines
in high state. After making a scan line
low, the status of the sense lines is read.
I/O pin status remains unaltered during sleep mode.
Relays. To turn on/off the equipment or to lock/unlock the solenoid-operated locks, four
relays (RL1 through RL4) are provided—one for each channel. Since the current-driving
capacity of the port pins of PIC16F84 (IC2) is not enough to drive the relays directly,
transistors T2 through T5 are used to boost the current to drive relays RL1 through RL4,
respectively.
Fig. 6(b): Flow-chart for changing the password of the code lock
The bases of transistors T2 through T5 are connected to Port-B pins 6 through 9 (RB0
through RB3) through basecurrent-limiting resistors R7 through R10, respectively. The
equipment or solenoid-operated locks can be connected to the normally open (N/O)
contacts of these relays. Diodes D2 through D5 are used as freewheel clamp diodes. The
series combination of a red LED (LED1 through LED4) and a current-limiting resistor
(R11 through R14) is connected across each relay coil.
The main circuit and the matrix keyboard can be assembled on separate PCBs. First
check the assembled PCBs for proper connections as per the circuit diagram. Then
connect the main PCB to the matrix keyboard PCB using 7-pin SIP connectors and wires,
ensuring one-to-one connection between the two PCBs. Connect the external 12V DC
supply with the correct polarity, without inserting the PIC microcontroller into the
socket, and follow these steps:
2. Now check the availability of +5V at pins 4 and 14 of IC2 before placing IC2 into the
socket.
3. To check the buzzer operation, connect pin 2 of IC2 socket to +5V available at pin 3
of IC1. Now the buzzer should beep continuously.
4. Check the operation of the four relays by connecting pins 6 through 9 of IC2 socket
one by one to +5V.
5. Before placing jumper JP1, check the voltage at pin 3 of IC2 using a multimeter. The
meter should read +5V or logic 1. Now on placing jumper JP1, the meter should read 0V
or logic 0 at pin 3.
Now remove the supply and insert the programmed PIC16F84 microcontroller into the
socket and switch on the supply. After poweron, the buzzer beeps once to indicate that
the microcontroller is ready to take the user data. Now you can lock/unlock or change the
password as described below. Initially the four channels can be accessed using the
default password ‘1234.’
Operating procedure
Fig. 6(c): Flow-chart for password verification, device (channel) selection and key
scanning
turn off de-energises and it remains in this state until you unlock/switch it on again.
Software
The software is written in Microchip’s Assembly language. Fig. 6 shows the flow-chart
for the program. In the flowchart, important labels and subroutine names used in the
program are also mentioned within the corresponding process boxes to enable easy
understanding of the program. For instructions, you may refer to the PIC16F84 datasheet.
The code is compiled and hex file is generated using MPLAB IDE. You can generate the
hex file by using the MPASM.exe assembler also. The hex file generated can be burnt
into the microcontroller using any PIC programmer that supports PIC16F84. We’ve used
here PICburner to program the PIC. It is published in Electronics Project Vol-23.
CODLOCK.LSt
MPASM 03.20 Released CODLOCK.ASM 7-1-2004 16:25:54 PAGE 1
Readers’ comments
I have the following queries:
Q1. Can I changeover from PIC16F84A to
PIC16F628? PIC16F628 is a cheaper microcontroller that is pin-compatible with
PIC16F84A. It is readily available from
Microchip, which is already phasing out
PIC16F84A for the last three years.
Q2. Is it possible to change the length of
the password?
Q3. Can only one output be used?
Q4. Can an alphanumeric keypad be
used?
Jatinder Chawla Through e-mail
The author, Vijaya Kumar P., replies: a1. I think you are talking of older PIC16F84
and PIC16C84. At present, PIC16F84A is widely available in India. I have been
informed by Microchip’s technical support (e-mail: taiwan.techhelp@ microchip.com)
that PIC16F84A is still available in the ‘2004 Products Selector Guide.’ I haven’t seen
any phase-out note on this device. For reference, you may check out the ‘Products
Selector Guide’ in ‘Product Document List’ on Microchip’s website
‘www.microchip.com’. I have used PIC16F84A microcontroller because EFY readers
can find its programmer in Sept. 2002 issue of the magazine. Of course, you can also use
PIC16F628 and PIC16F627 microcontrollers, which are pin-compatible with
PIC16F84A, but this requires a few modifications in the program.
a2. It is clearly mentioned in the article that the password length can be changed from
four digits to upto 15 digits as desired by the user.
a3. Yes, if you want only one channel, one output can be used. You can use any one of
the channels, say, Channel 1. Then you don’t need relays RL2 through RL4 and the
associated components, i.e., transistors T3 through T5, resistors R8 through R10, diodes
D2 through D5, and LED2 through LED4.
a4. An alphanumeric keypad cannot be used with the circuit because, to include
alphanumeric characters, we’ll have to use separate keys for each alphabet and numeral.
This requires more number of input/output (I/O) port pins to implement the matrix
keyboard. Since there are no additional free pins available in this application, the
method you proposed is not possible.
Another way is to use a keypad similar to the one used in mobile handsets. Here, each
key is multiplexed with a digit and one or more characters. The digit/character inputted
depends upon the number of pressing actions within fixed time duration. But this type of
keypad implementation requires a display device, such as LCD, to ensure that the correct
key is pressed. Again, this requires more I/O pins to interface the LCD and the project
becomes costly. Moreover, displaying the password entered in this case is not a secure
way!
Load ProteCtor wIth remote swItChIng
FaCILIty
S. SiVaramaKriShnan
F
or inverters and UPS systems, the load should not be much below or above the rated
power since it can
cause excess heating of the output transformer windings and the active driving device
and thereby damage them. Some domestic appliances also need to be protected against
under-/over-voltage.
1. It shuts down the load at undernormal voltage, which goes off at under/over-voltage.
Circuit description
Fig. 1 shows the block diagram of the remote-controlled load protector. Basically, it
comprises a transformer, rectifier, filter, regulator and comparator along with remote
switching transmitter and receiver circuitry. The remote signal transmitter is used for
remote switching of the device during the normal voltage.
/over-voltage.
2. After under-/over-voltage, the load
is automatically restarted.
3. A visual indication is given for
transformer, rectified, filtered and then applied to the comparator as well as the
regulator. The regulator provides 12V regulated power supply to the circuit excluding
the comparator and the timer.
The circuit comprises two sections, namely, the transmitter (remote handset) and the
receiver-cum-load protector.
The remote transmitter. Fig. 2 shows the remote transmitter built around astable
multivibrator IC NE555 (IC1). Powered by a 9V battery, the remote transmitter transmits
a preset frequency when push-to-on switch S1 is pressed. The modulated IR beam is
received by phototransistor T1 of the receiver-cum-load protector unit.
Power supply. The circuit is powered by AC mains through fuse F1. The AC mains is
stepped down by transformer X1 to deliver a secondary output of 18V0-18V, 250mA.
The transformer output is rectified by diodes D1 and D2 and filtered by capacitor C4.
The filtered output is fed to IC2 and also the junction of resistor R17 and preset VR3.
IC2 provides 12V regulated supply to the circuit. The output of IC2 is smoothed by
capacitor C3.
Receiver. The receiver section is built around transistors T1 through T3 and IC3 through
IC5. Darlington-pair phototransistor T1 is used to sense the infrared signals. The
phototransistor is sensitive to the incident radiation. The incident p h o t o n s r e s u l t i
n a b a s e current, which is amplifiedbythegain of the photo-darlington.
The frequency signals from the phototransistor are amplified by npn transis- tors T2 and
T3 and applied to phase-locked loop IC NE567 (IC5) through capacitor C10. IC NE567
is a highly stable phaselocked loop with synchronous AM lock detection and power
output circuitry. It is primarily used as a tone decoder, which drives a load whenever a
sustained frequency falling within its detection band is present at its self-biased input.
The centre frequency of the band and the output delay are independently determined by
external components.
IC5 detects the code frequency. In the absence of any input signal, the centre frequency of
its internal free-running, current-controlled oscillator is determined by preset VR4 and
capacitor C9. Preset VR4 is used for tuning IC5 to
the desired centre frequency
in the code frequency range,
which should match the fre
quency of the code generator
in the transmitter. Low-pass
frequency is determined by
capacitor C8. Capacitor C7 at
tenuates frequencies outside
the detection band to elimi
nate spurious outputs.
Pins 2 and 6 of IC7 are pulled high through resistor R4. Diodes D4 and D5 are used for
wired-OR operation. Whenever the output of any one of the comparators (N1 or N2)
goes low, the output coupled to pin 2 of IC7 goes low to trigger it. This happenes when
under-/over-voltage conditions are encountered. As a result, the output of IC7 goes high
to cut off transistor T4 and de-energise relay RL1.
IC NE555 (IC7) behaves like a levelsensing device. In the normal voltage condition, its
low output drives pnp transistor
Fig. 4: Actual-size, single-side combined PCB layout for the remote handset (Fig. 2)
and receivercum-load protector (Fig. 3)
Fig. 5: Component layout for the PCB
Parts List
Semiconductors:
IC1, IC4, IC7 - NE555 timer
IC2 - 7812, 12V regulator
IC3 - CD4027 dual JK flip-flop IC5 - NE567 phase-locked loop IC6 - LM324
comparator
ZD1 - 6.2V zener diode
D1-D3 - 1N4007 rectifier diode D4, D5 - 1N4148 switching diode T1 - L14F1
phototransistor T2, T3 - BC547 npn transistor T4 - CK100 pnp transistor T5 - SL100
npn transistor IRD1, IRD2 - Infrared diodes/LEDs LED1, LED2 - Red LED
Capacitors:
C1-C2, C5,
C9, C12 - 0.01µF ceramic disk
C3, C8, C10 - 0.1µF ceramic disk
C4 - 1000µF, 40V electrolytic C6, C7 - 2.2µF, 25V electrolytic C11 - 39pF ceramic
disk
C13 - 33µF, 25V electrolytic Miscellaneous:
E1 - 500mA fuse
RL1 - 12V, 200Ω 1C/O relay X1 - 230V AC to 18V-0-18V, 250mA
secondary transformer
T4 into conduction to energise relay RL1 and operate the device connected to the
contacts of the relay. Diode D6 is used as a free-wheeling diode. LED2 indicates relay
energisation and device ‘on’ condition.
Working
If mains voltage is less than 245V but more than 200V, the output of IC2 is low and relay
RL1 energises via relay-driver pnp transistor T5 to provide mains to the load (device) to
be protected.
When mains voltage increases beyond 245V, which also means that the sampled voltage
at pin 2 becomes higher than the reference voltage (6.2V), the output of N1 at pin 1 goes
low to trigger IC7. As a result, the output of IC7 goes high to de-energise the relay via
relay-driver pnp transistor T4 and LED1 stops glowing to indicate that the device is
switched off (protected from over-voltage).
Similarly, when mains voltage goes below 200V, which also means that the voltage at
pin 5 goes below the reference voltage (6.2V), the output of N2 at pin 7 goes low to
trigger IC7. The triggered IC7 provides a high output to de-energise the relay via relay-
driver pnp transistor T4 and LED1 stops glowing to indicate that the load (device) is
protected from under-voltage.
Remote switching of the load
At the normal mains voltage, the load (device) connected across the normallyopened
(N/O) contacts of relay RL1 is in ‘on’ condition. Now if you want to switch off the load,
simply press switch S1 on the remote handset momentarily. As a result, relay RL1 de-
energises to disconnect the load from mains. This happens because the output of IC3 (pin
15) goes low on pressing switch S1 on the remote transmitter, which inhibits the power
supply for IC6 and IC7, and relay RL1 de-energises. Similarly, you can switch on the
load again by pressing S1 momentarily, which toggles IC3 to re-establish supply for IC6
and IC7. Thereafter, the cycle repeats if switch S1 on the remote is pressed again and
again. The remote handset can control devices from a distance of up to 8 metres.
Construction
The circuit of the load protector with remote switching facility can be assembled on any
general-purpose PCB. However, the actual size, single-side combined PCB layout for
the remote handset (Fig. 2) and the receivercum-load protector (Fig. 3) is shown in Fig.
4 and its component layout in Fig. 5.
It would help to rectify any problem if you use IC bases instead of directly soldering the
ICs onto the PCB. Ensure proper contacts between pins of the IC bases and the solder
points on the PCB. q
VOICE RECORDINg AND
PLAYBACK usINg APR9600 ChIP
K. Krishna Murty
D
igital voice processing chips with different features and coding techniques for speech
compression and processing are available on the market from a number of semiconductor
manufacturers. Advanced chips such as Texas instruments’ TMS320C31 can implement
various voice-processing algorithms including code-excited linear prediction, adaptive
differential pulse-code modulation, A law (specified by California Council for
International Trade), µ law (specified by Bell Telephone) and vector sum-excited linear
prediction.
On the other hand, APR9600 singlechip voice recorder and playback device
Fig. 1: Functional block diagram of IC APR9600
from Aplus Integrated Circuits makes use of a proprietary analogue storage technique
implemented using flash nonvolatile memory process in which each cell is capable of
storing up to 256 voltage levels. This technology enables the APR9600 to reproduce
voice signals in their natural form.
ParTS lIST
Semiconductors:
IC1 - APR9600 voice processor IC2 - LM386 low-power audio
amplifier
T1-T3 - BC557 pnp transistor D1 - 1N4001 rectifier diode LED1-LED3 - Red LED
Miscellaneous:
S1-S9 - Push-to-on switch
S10-S12 - On/off switch
LS1 - 8-ohm, 0.5W speaker
- Condenser microphone
amplifier, automatic gain control (AGC) circuits, internal anti-aliasing filter, in- tegrated
output amplifier and messages management are some of the features of the APR9600
chip.
Fig. 1 shows the functional block diagram of IC APR9600. Complete chip management
is accomplished through the device control and message control blocks.
Voice signal from the microphone (see Fig. 2) is fed into the chip through a differential
amplifier.
It is further amplified
by connecting Ana_Out
(pin 21) to Ana_In (pin
20) via an external DC
blocking capacitor C1.
A bias signal is applied
to the microphone and
to save power during
playback, the ground
return of this bias
network can be con
nected to the normally
open side of the record
switch. Both Mic.in and
Mic.Ref (pins 18 and 19)
must be coupled to the
microphone network
through capacitors.
Recording signal
from the external
source can also be fed
directly into the chip
using Ana_In (pin 20),
but the connection be
tween Ana_In (pin 20)
and Ana_out (pin 21)
is still required for
playback. An inter-
nal anti-aliasing filter
automatically adjusts
its response according
to the sampling fre
quency selected. Then
the signal is processed
into the memory array
through a combination
of the sample-and-hold
circuit and analogue
read/write circuit. The Fig.
2: Random-access mode configurationincoming voice signals
are sampled and the instantaneous volt
age samples are stored in the non-volatile
flash memory cells in 8-bit binary encoded
format.
Table II reference rosc Values and Corresponding Sampling Frequencies ref rosc
Sampling Input frequency bandwidth
Duration
60 sec
40 sec
32 sec Note. Rosc table above is for reference only, different lots of ICs will have somewhat different Rosc
value performance
An internal oscillator provides sampling clock to the APR9600. The frequency of the
oscillator and sampling rate depend on the value of resistor R12 [R12(A)+R12(B)]
connected across OSCR (pin 7) of the chip and the ground.
Message management. The APR9600 chip supports the following message modes:
The modes are defined by pins 24 (MSEL1), 25 (MSEL2) and 9 (/M8_Op- tion) as
shown in Table I, and cannot be mixed.
An important feature of the APR9600 chip is indication of changes in the device status
through beeps superimposed on the device output; for example, the start of recording is
indicated by a beep, so the person can now start speaking into the microphone. This
feature is enabled by making pin 11 (BE) high.
General functional description. On power up, pin 23 (CE) is pulled low through
resistor R7 to enable the device for operation. Toggling this pin by switch S9 also resets
several message management features. Pin 27 (RE) is pulled low to enable recording
and it is pulled high for playback. To start record- ing/playback, switch the appropriate
trigger pin as described later. Glowing of LED1 indicates that the device is busy and no
commands can be currently accepted. The LED is driven by pnp transistor T1, which is
connected to pin 10 (Busy) of the chip. LED2 indicates recording in each individual
memory segment. It is driven by pin 22 (strobe) through transistor T2.
Random-access mode
Now to start recording the first mes- sage, press switch S1 and hold it in this position. A
beep sound is heard and LED2 blinks. You can now speak into the condenser mic. The
recording will terminate if switch S1 is released or if the recording time exceeds 7.5
sec- onds. Similarly, press switches S2 through S8 to record other sound tracks. For
recording of two or four sound tracks of fixed
Playback of sound tracks. Open switch S10 to make pin 27 high while keeping other
switches in the same positions as in recording. Toggling switches S1 through S8 causes
playback of particular sound tracks. Pressing the same switch again or switch S9
terminates playback of the sound track. Pressing any other switch (S1 through S8) while
a sound track is being played causes a new sound track to be played. If the switch is held
pressed, the particular sound track will play continuously.
Tape mode
The tape mode operation is much like the conventional cassette tape 60 seconds. Press
switch S1 again and again to record second, third, fourth and other consecutive sound
tracks. Each sound track may have a different length but the total length of all sound
tracks cannot exceed 60 seconds. When LED3 lights up during recording, it indicates the
end of memory array.
Playback in tape mode with auto-rewind option. Open switch S10 to pull pin 27 high
while keeping other switches in the same positions as applicable during recording.
Toggle switch S1 repeatedly to play consecutive sound tracks. Press switch S9 to reset
the sound track counter to zero. During playback, LED3 indicates that all recorded
messages have been played.
Recording in tape mode with normal option. Fig. 4 shows the circuit for recorcding/
playback in tape mode with normal option. Connect pins 24 (MSEL1),
switch S10 to enable the recording of message. Press switch S9 to reset the sound track
counter to zero. The normal-mode recording is similar to the rewind-mode recording,
except that after swich S1 is released, the sound counter doesn’t increment itself to the
next sound track location. To record the first sound track, press switch S1 and hold it in
this position. A beep sounds and LED2 blinks. Now you can speak into the microphone.
To record the next message, release switch S1 and toggle switch S13. Now press switch
S1 again and hold in this position. A beep sounds and LED2 blinks. This means you can
speak into the microphone to record the message. In case you press switch S1 without
toggling switch S13 to record the message, the message will be recorded at the location
of the first message.
Playback in tape mode with normal option. Open switch S10 to pull pin 27 high while
keeping other switches in the same positions as during recording operation. First, press
switch S9 to reset the sound track counter to zero. Now momentarily press switch S1 to
play the first sound track. Momentarily pressing of switch S1 again and again will still
play the first sound track. The sound track counter can be incremented to play the next
sound track by momentarily pressing switch S13.
The combined actual-size, single-side PCB for the circuits of Figs 2, 3 and 4 is shown in
Fig. 5 and its component layout in Fig. 6.
To obtain the configuration of Fig. 2, connect connector Con1 to Con2 using burgstick
connectors with ribbon cable or simply using jumper wires. Similarly, configuration of
Fig. 3 or Fig. 4 can be realised by connecting Con1 to Con3 or Con4. Note that switch
S1 is common for all configurations. q
DYNAmIC TEmPERATuRE
INDICATOR AND CONTROLLER
H
ere’s a standalone digital thermometer that also controls the temperature of the heating
The circuit is programmed for ‘on’/‘off’ control. It is very compact using few
components and can be implemented for
PIC16F73 microcontroller is the heart of the circuit as it controls all the functions. Fig. 1
shows the pin configuration of PIC16F73 microcontroller.
Fig. 1: Pin configuration of PIC16F73 microcontroller
The circuit
Fig. 2 shows the functional block diagram of the PIC16F73-based dy- namic temperature
controller. The temperature transducer (AD590) senses the temperature and converts it
into an
ParTS lIST
Semiconductors:
IC1
IC2
IC3
T1
D1-D5 AD590 LED1 LED2
- 7812, 12V regulator
- 7805, 5V regulator
- PIC16F73 microcontroller
- SL100 npn transistor
- 1N4007 rectifier diode
- Temperature sensor
- Red LED
- Green LED
- 16×2-line LCD
Capacitors:
C1 - 1000µF, 35V electrolytic C2 - 0.33µF ceramic
C3-C6 - 0.33µF ceramic
C7 - 100µF, 100V electrolytic
Miscellaneous:
X1
XTAL
RL1 S1
Port-A pins 3 (RA1) and 5 (RA3) are programmed as analogue inputs. The inbuilt 8-bit
ADC converts the analogue input signal into 8-bit digital equivalent output. Its analogue
reference voltage is software-selectable to either the positive supply voltage of the
device (Vcc) or the voltage level of RA3 pin. Here, Vcc (5V) is selected as the analogue
reference voltage.
Pins 3 (RA1) and 5 (RA3) are proFig. 2: Block diagram of the PIC16F73-based
dynamic temperature controller
Fig. 3: Circuit of PIC16F73 microcontroller-based dynamic temperature controller
The microcontroller has been programmed to sense the analogue voltages corresponding
to the sensed and set temperature values. The sensed voltages are manipulated such that
the corresponding temperature values are displayed on the LCD by sending out the
corresponding data signals through pins 11 through 18 (RC0 through RC7) and control
signals through pins 4, 6 and 7 (RA2, RA4 and RA5) of the microcontroller. Then the
sensed temperature value is compared with the set-point temperature value. Pin 22
(RB1) of the microcontroller goes high if the set-point temperature is higher than the
sensed temperature. This pin has been programmed as an output to control the relay
through transistor T1. The relay contacts are connected to the heating element.
Data is sent to the LCD’s data pins 7 through 14. Control signals required before each
data transmission are sent to pins 4, 5 and 6 (RS, R/W and Enable) of the LCD.
Fig. 5: Actual-size, single-side PCB layout for temperature Fig. 6: Component layout
for the PCB indicator using PIC16F73
The relay is con - nected between +12V and the collector of transistor T1. When pin 22
of the microcontroller is high, transistor T1 saturates and the relay energises to switch
the device ‘on.’ When pin 22 is low, transistor T1 cuts off and the relay de-en- ergises to
turn the device ‘off.’ Diode D5 is used here as a free-wheeling diode.
Fig. 4 shows the flow-chart of the pro - gram. The microco-ntroller is programmed to
give various functional commands with delays for proper initialisation of the LCD. The
control signals for the LCD are given from Port A (RA1) of the microcontroller. The
analogue voltage corresponding to the sensed temperature given to Port A (RA1) is
converted into a digital value and stored in the micro-controller. A binary value of ‘255’
corresponds to 5V (500 kilo-ohms). Based on this relation, calibration is done to extract
the digits of the sensed temperature value in degree Kelvin. These digits are then sent
from Port C of the microcontroller to the data lines of the LCD.
Similarly, the set temperature is displayed on the LCD. The difference between the
sensed and set temperature values is calculated and accordingly RB1 pin of Port B goes
high or low to control the relay.
An actual-size, single-side PCB layout for the dynamic temperature controller using
PIC16F73 is shown in Fig. 5 and its component layout in Fig. 6. After making the PCB,
check whether all the tracks are as per the circuit diagram. If the tracks are correct,
solder the components to the board. Place AD590 close to the soldering iron. Now
switch on the power supply and check voltages at various points before placing the
microcontroller into the circuit. Taking into consideration the sizes of the various
components and the way they have been placed, select the dimen- sions of the cabinet for
the device. Put the entire circuit inside the cabinet and test the working of the circuit.
When burning the program into the microcontroller, use power supply with a proper
current limiter to prevent damage to the parallel port of the computer as well as the
microcontroller. The analogue voltage to the microcontroller should not be given
directly from the power supply, as occasional spikes in the power supply may damage
the microcontroller. Instead, you can pro- vide the analogue voltage by means of a
potentiometer connected across the required voltage.
Fluctuations visible on the LCD, especially when the sensed temperature value equals
the set temperature value, can be eliminated by connecting capaci- tors between the
supply and the ground to bypass the AC interference. Make sure that a pin configured as
output is not given an input signal by chance.
Note. In EFY Lab, we used soldering iron as the heating element. The device was
modeled to give an ‘on’/‘off’ signal corresponding to the sensed and set-point
temperature. When the sensed temperature was below the set temperature, the soldering
iron got switched ‘on,’ and when the sensed temperature crossed the set temperature
value, the soldering iron got switched off.
TemP.lsT
LOC OBJECT CODE LINE SOURCE TEXT VALUE
0006 300A 00040 MOVLW B'00001010' ;to set ra1(present)& ra3(user-defined) as 00041 ;i/p pins&ra2,ra4,ra5 as o/p
control to lcd
0007 0085 00042 MOVWF TRISA
0008 0187 00043 CLRF TRISC ;PORTC AS OUTPUT DATA PORT TO LCD
0009 0186 00044 CLRF TRISB
000A 3004 00045 MOVLW B'00000100' ;to set analog i/p(ra1&ra3),vref(Vcc) 00046 ;dig i/p(ra3,ra4&ra5)
000B 009F 00047 MOVWF ADCON1
000C 1283 00048 BCF STATUS,RP0 ;to go to bank0
000D 00049 INITIALIZE ;*** LCD Initialization
000D 01AD 00050 CLRF COUNT0 ;all these are delay loops
000E 01AE 00051 CLRF COUNTER
000F 201C 00052 CALL MSCOUNTER
0010 2026 00053 CALL T48US
0011 203A 00054 CALL FUNCTIONSET
0012 202C 00055 CALL CHARACTER_ENTRY
0013 2033 00056 CALL CLEAR_DISPLAY
0014 2041 00057 CALL DISPLAYON
0015 00058 BEGIN ;beginning the proper function
0015 2048 00059 CALL DISPLAY
0016 2068 00060 CALL PRESENT
0017 206D 00061 CALL CHECK
0018 1803 00062 BTFSC STATUS,0
0019 207E 00063 CALL HUNDREDS
001A 2089 00064 CALL TENS
001B 2895 00065 GOTO SUBTRACT
00066
00067
001C 00068 MSCOUNTER ;*** 150ms counter before LCD initializaion
001C 302C 00069 MOVLW D'300'
001D 00A2 00070 MOVWF TIME1
001E 307C 00071 LOOP1 MOVLW D'124'
001F 00A3 00072 MOVWF TIME2
0020 0000 00073 LOOP2 NOP
0021 0BA3 00074 DECFSZ TIME2,F
0022 2820 00075 GOTO LOOP2
0023 0BA2 00076 DECFSZ TIME1,F
0024 281E 00077 GOTO LOOP1
0025 0008 00078 RETURN
0026 00079 T48US ;***48usDelayLoopforLCDinitialization
0026 3090 00080 MOVLW D'400'
0027 00AD 00081 MOVWF COUNT0
0028 00082 T_LOOP
0028 2062 00083 CALL T12US
0029 0BAD 00084 DECFSZ COUNT0,F
;RS line to 1 to i/p Data ;R/W line to 0 to write ;send character to LCD ;Clock the LCD
;delay for LCD busy
;*** Initialization Display Data for LCD ;Store (PC+W) in PC(addr $02) to jump ;forward
;ascii for t
;ASCII for e
;ASCII for m
;ASCII for p
;ASCII for .
;ASCII for blank
;ASCII for :
2;ASCII for blank
005A 3454 00149 RETLW H'54' 005B 3465 00150 RETLW H'65' 005C 346D 00151 RETLW H'6d' 005D 3470 00152
RETLW H'70' 005E 34A5 00153 RETLW H'a5' 005F 34FE 00154 RETLW H'fe' 0060 343A 00155 RETLW H'3a'
0061 34FE 00156 RETLW H'fe'
00157
0062 00158 T12US
0062 2863 00159 GOTO $+1 0063 2864 00160 GOTO $+1 0064 2865 00161 GOTO $+1 0065 2866 00162 GOTO $+1
0066 0000 00163 NOP 0067 0008 00164 RETURN 0068 00165 PRESENT 0068 3049 00166 MOVLW B'01001001'
;set clk 2 fosc/8,ADON,i/p channel ra1 0069 009F 00167 MOVWF ADCON0
006A 201C 00168 CALL MSCOUNTER
006B 151F 00169 BSF ADCON0,2 ;set GO bit to start ADC 006C 0008 00170 RETURN
006D 00171 CHECK
006D 191F 00172 BTFSC ADCON0,2 ;when conversion is complete ADCON0 will ;*** 12 microseconds timer ***
;be cleared and control will come out of loop ;the ADC value is found in ADRES ;255-ADRES
00173 006E 286D 00174 GOTO CHECK 006F 081E 00175 MOVF ADRES,W 0070 00A0 00176 MOVWF AD1 0071
3CFF 00177 SUBLW D'255' 0072 00A5 00178 MOVWF FIN 0073 1003 00179 BCF STATUS,0 0074 0D25 00180
RLF FIN,W 0075 00A6 00181 MOVWF CONFU 0076 3064 00182 MOVLW D'100' 0077 0226 00183 SUBWF
CONFU,W 0078 01A7 00184 CLRF A
0079 01A8 00185 CLRF B3
007A 01A9 00186 CLRF C3
007B 01AC 00187 CLRF COUNT 007C 01AB 00188 CLRF COUNT1 007D 0008 00189 RETURN
007E 00190 HUNDREDS 007E 0FAB 00191 INCFSZ COUNT1,F ;2 count hundreds subtract from 100 until
00202 ;100 so as to extract the tens place 0088 0008 00203 RETURN
0089 00204 TENS
0089 0FAC 00205 INCFSZ COUNT,F ;2 count tens subtract from 10 008A 300A 00206 MOVLW D'10'
008B 02A6 00207 SUBWF CONFU,F
008C 1803 00208 BTFSC STATUS,0
008D 2889 00209 GOTO TENS
008E 300A 00210 MOVLW D'10'
008F 0726 00211 ADDWF CONFU,W
0090 00A9 00212 MOVWF C3 ;ones place-difference+10 gives ones place 0091 3001 00213 MOVLW D'1' 0092 022C
00214 SUBWF COUNT,W 0093 00A8 00215 MOVWF B3 0094 0008 00216 RETURN
00217
00218
00219
;temp in kevin =500 -(255-ADRES)*2 ;******subtraction from 500 is done by digitwise subtraction
;various cases are to be considered inorder to initiate subtraction
;*to give the set-point value follow the same procedure as above user_defined 00EB 3059 00312 MOVLW
B'01011001' ;set clk 2 fosc/8,ADON,i/p channel ra3 00EC 009F 00313 MOVWF ADCON0
00ED 201C 00314 CALL MSCOUNTER
00EE 151F 00315 BSF ADCON0,2
00EF 00316 CHECK1
00EF 191F 00317 BTFSC ADCON0,2
00F0 28EF 00318 GOTO CHECK1
00F1 081E 00319 MOVF ADRES,W
00F2 00A1 00320 MOVWF ADUSER
00F3 3CFF 00321 SUBLW D'255'
00F4 00A5 00322 MOVWF FIN
00F5 1003 00323 BCF STATUS,0
00F6 0D25 00324 RLF FIN,W
00F7 00A6 00325 MOVWF CONFU
00F8 3064 00326 MOVLW D'100' ;2 extract hundreds value 00F9 0226 00327 SUBWF CONFU,W
00FA 01A7 00328 CLRF A
00FB 01A8 00329 CLRF B3
00FC 01A9 00330 CLRF C3
00FD 01AC 00331 CLRF COUNT
00FE 01AB 00332 CLRF COUNT1
00FF 1803 00333 BTFSC STATUS,0
0100 2103 00334 CALL HUNDREDS1
0101 210E 00335 CALL TENS1
0102 2919 00336 GOTO SUBTRACT1
0103 00337 HUNDREDS1
0103 0FAB 00338 INCFSZ COUNT1,F ;2 count hundreds
0104 3064 00339 MOVLW D'100' 0105 02A6 00340 SUBWF CONFU,F 0106 1803 00341 BTFSC STATUS,0 0107
2903 00342 GOTO HUNDREDS1 0108 3001 00343 MOVLW D'1' 0109 022B 00344 SUBWF COUNT1,W 010A
00A7 00345 MOVWF A
010B 3064 00346 MOVLW D'100' 010C 07A6 00347 ADDWF CONFU,F 010D 0008 00348 RETURN
010E 00349 TENS1
010E 0FAC 00350 INCFSZ COUNT,F 010F 300A 00351 MOVLW D'10' 0110 02A6 00352 SUBWF CONFU,F 0111
1803 00353 BTFSC STATUS,0 0112 290E 00354 GOTO TENS1 0113 300A 00355 MOVLW D'10' 0114 0726 00356
ADDWF CONFU,W 0115 00A9 00357 MOVWF C3 0116 3001 00358 MOVLW D'1' 0117 022C 00359 SUBWF
COUNT,W 0118 00A8 00360 MOVWF B3 0119 00361 SUBTRACT1 0119 300A 00362 MOVLW D'10' 011A 00B2
00363 MOVWF C1 011B 3009 00364 MOVLW D'9' 011C 00B1 00365 MOVWF B1 011D 3004 00366 MOVLW D'4'
011E 00B0 00367 MOVWF A1 011F 3000 00368 MOVLW D'0' 0120 0629 00369 XORWF C3,W 0121 1903 00370
BTFSC STATUS,Z 0122 2931 00371 GOTO UNIT1 ;in case tens place is 0,B1 should be made 10 0123 0829 00372
MOVF C3,W
0124 0232 00373 SUBWF C1,W
0125 00B3 00374 MOVWF C2
0126 3000 00375 MOVLW D'0'
0127 0628 00376 XORWF B3,W
0128 1903 00377 BTFSC STATUS,Z
0129 2944 00378 GOTO TEN1 ;in case tens place is 0 ,A1 should be made 5 012A 0828 00379 MOVF B3,W
012B 0231 00380 SUBWF B1,W
012C 00B4 00381 MOVWF B2
012D 0827 00382 MOVF A,W
012E 0230 00383 SUBWF A1,W
012F 00B5 00384 MOVWF A2
0130 294B 00385 GOTO DISPLAY2
0131 00386 UNIT1 ;*when units place is zero 0131 01B3 00387 CLRF C2
0132 3000 00388 MOVLW D'0'
0133 0628 00389 XORWF B3,W
0134 1903 00390 BTFSC STATUS,Z
0135 293E 00391 GOTO UNITY1
0136 0AB1 00392 INCF B1,F
0137 0828 00393 MOVF B3,W
0138 0231 00394 SUBWF B1,W
0139 00B4 00395 MOVWF B2
013A 0827 00396 MOVF A,W
013B 0230 00397 SUBWF A1,W
013C 00B5 00398 MOVWF A2
013D 294B 00399 GOTO DISPLAY2
013E 00400 UNITY1 ;*when units place and tens place are both zeroes 013E 01B4 00401 CLRF B2
013F 0AB0 00402 INCF A1,F
0140 0827 00403 MOVF A,W
0141 0230 00404 SUBWF A1,W
;2 count tens
;ones place
0142 00B5 00405 MOVWF A2
0143 294B 00406 GOTO DISPLAY2
0144 00407 TEN1
;RS line to 1 to i/p Data ;R/W line to 0 to write ;send character to LCD ;Clock the LCD
code (temp.lst), the result of analogueto-digital conversion (ADC) has been subtracted
from ‘255.’ In the explanation, it is mentioned that ‘255’ stands for ‘5V,’ so what’s the
purpose behind doing so?
2. Again, the result of the above subtraction is multiplied by ‘2’ in line No. 00180. Why?
3. At the start of the ‘Subtract’ subroutine (line No. 00220), the comment routine (line
No. 00220), the comment ADRES)*2.” In this equation, what is the reason behind using
‘500’ and not any other number? What is the significance of the given formula?
4. In the same subroutine, i.e., ‘Subtract,’ the author has used Nos. 10, 9, 4 and 0 (line
Nos 00221, 00223, 00225 and 00227, respectively) for digit-wise subtrac- tion. Here,
why specifically only these numbers are used?
The logic behind the formula 500– (255–ADRES)*2 follows. The ADC inside the PIC is
8-bit and hence the maximum digital value is ‘255’ corresponding to the analogue
voltage value of 5V, as given in the specification of the PIC. Thus, we arrive at the
relationship that ‘5V’ corresponds to ‘255’ (digital value).
Again, the temperature sensor used has the sensitivity of 1 µA/K, and the tem- perature
sensing range is 218K to 423K. Since the output from the temperature sensor is a current
corresponding to the sensed temperature, we used a 10-kiloohm resistor to convert the
current into voltage. Thus, the voltage sensitivity of our set-up will be 1mV(0.01V)/K
resulting in the input voltage range to the ADC of the PIC as 2.18V to 4.23V.
Now, in order to arrive at the formula, we made an approximation to the linearity in the
relationship between the temperature and voltage.
That is,
255 5V 500K
254 4.98V 498K
253 4.96V 496K
and so on.
Since the sensitivity is 0.01V/K, for each unit change in the digital value the voltage
value changes by 0.01V. The for- mula was derived to approximate the above
relationship between the digital value and the temperature value in Kelvin scale. We
want the temperature in Kelvin value to energise/de-energise the relay and also to
display on the LCD panel. Hence, when the ADC shows ‘255’ the display should show
‘500K,’ when the ADC shows ‘254’ the display should show ‘498K,’ and so on. The
relay should energise/de-ener- gise accordingly.
So based on the relationship mentioned above, we arrived at a linear relationship that is
an approximation for the actual non-linear relationship between the sensed temperature
and the digital value.
For example, when ADRES is ‘248,’ according to the formula, the temperature is
calculated as follows:
(255–248)x2=7x2=14
Now, 500–14=486K
Thus we arrive at the temperature in Kelvin.
This explanation suffices for the first three queries of Mr Dudhia.
Regarding the fourth query, since the PIC is a RISC processor, with 35 instructions, we
had to arrive at a complicated logic to do the subtraction from ‘500’ as the maximum
possible digital value was ‘255.’ Hence, to do an operation like 500–238, we need to do
digit-wise subtraction. For the units place we perform 10–8=2, for the tens place we
perform 9–3=6, and for the hundreds place we perform 4–2=2, result- ing in ‘262’ as the
correct answer. The algorithm is based on the fact that we need to do subtraction from
‘500’ and hence the numbers 10, 9 and 4. Again, if the units place of the number to be
subtracted is ‘0,’ we need to subtract the tens digit from ‘10’ and the units digit from ‘0’
and so on. For example, 500-240 will be done as follows:
Units digit of the result=0–0=0 Tens digit of the result=10–4=6 Hundreds digit of the
result=4–2=2 We have put ‘A1’ as the number from which the units digit is to be
subtracted, ‘B1’ for the tens digit and ‘C1’ for the hundreds digit.
If the number to be subtracted has non-zero units, tens and hundreds digits: A1=10,
B1=9, C1=4
If only the units digit is zero:
A1=0, B1=10, C1=4
If the tens digit is zero:
A1=10, B1=9, C1=5
and so on for different combinations.
STEPPER MOTOR CONTROL USING
89C51 MICROCONTROLLER
H
ere’s a stepper motor controller based on 89C51 microcontroller to control the rotation
of a DC
stepper motor in clockwise and anti-clockwise directions. The controller is simple and
easy-to-construct, and can be used in many applications including machine control and
robotics for controlling the axial rotation in XY plane. A similar circuit can be added to
control the rotation of the motor in either XZ or YZ plane.
Fig. 1 shows the block diagram of the stepper motor control system. The power supply
section (in Fig. 2) consists of a stepdown transformer (7.5V AC, 1A), bridge rectifier
(comprising diodes D1 through D4), filter capacitors (C1 and C2) and regulator IC
7805.
to indicate the presence of power in the circuit. Capacitor C3 connected to pin 9 (RST)
provides the power-on reset to the microcontroller.
By combining a versatile 8-bit CPU with Flash on a monolithic chip, Atmel AT89C51 is
a powerful, highly flexible and cost-effective solution to many embedded control
applications. From traffic control equipment to input devices, computer networking
products and stepper motor controllers, 89C51 microcontrollers deliver a high
performance with a choice of configurations and options matched to the specific needs of
each application.
IC AT89C51 features:
Circuit description
Fig. 2 shows the complete circuit of the stepper motor controller. When power supply
switch S1 is closed, LED1 glows
Table I
Power Consumption of Microcontrollers
IC Voh Ioh Voi Ioi Vil Iil Vih Iih Pt CMOS 2.4V –60 µA 0.45V 1.7 mA 0.9V 10 µA 1.9V
10 µA 50 mW NMOS 2.4V –80 µA 0.45V 1.7 mA 0.8V –800 mA 2.0V 10 µA 800 mW
Miscellaneous:
X1 - 230VAC primary to 0-7.5V, 1A secondary step-down transformer
- 5V DC stepper motor S1, S3 - on/off switch
S2 - push-to-on switch
When transistors conduct, 5V (Vcc) is applied to the coils and the currents flow- ing
through them create magnetic fields and the motor starts rotating. The magnetic field
energy thus created is stored in the coils.
When transistors stop conducting, power to the coils is cut off, the magnetic field
collapses and a reverse voltage (called inductive kickback or back emf) is generated in
the coils. The back emf can be more than 100 volts. The diodes connected across the
coils absorb the reverse voltage spike. This voltage, if not absorbed by the diodes, may
produce opposite torque and cause improper rotation of the motor and also damage the
transistors. You can use virtually any type of rectifier or switching diodes of appropriate
current and reverse voltage breakdown rating.
Clock and reset circuit. Two 33pF capacitors (C4 and C5) are connected to pins 18 and
19 of the microcontroller, respectively, with an 11.059MHz piezoelectric crystal
(XTAL1) across them. The clock frequency of the microcontroller depends on the
frequency of the crystal oscillator used. Typically, the maximum and minimum
frequencies are 1 MHz and 16 MHz, respectively, so we should use a piezoelectric
crystal with a frequency in this range. The speed of the stepper motor is proportional to
the frequency of the input pulses or it is inversely proportional to the time delay between
pulses, which can be achieved through software by making use of instruction execution
time.
The time taken by any instruction to get executed can be computed as follows:
Time= C×12
F
where ‘C’ is the number of cycles an instruction takes to execute and ‘F’ is the crystal
frequency.
The crystal frequency in this circuit is 11.059 MHz, so the time taken to execute, say,
ADD A, R1 (single-cycle instruction), is about one microsecond (µs). Use of a 6MHz
crystal will bring down the instruction execution speed to to 2 µs.
When power is applied, the reset input must first go high and then low. A resistor-
capacitor combination (R1-C3) is used to achieve this until the capacitor begins to
charge. At a threshold of about 2.5V, the reset input reaches a low level and the
microcontroller begins to function normally. Reset switch (S2) allows you to reset the
program without having to interrupt the power.
One major feature of 89C51 microcontroller is the versatility built into the I/O circuits
that connect the microcontroller to the outside world. Ports P0 through P3 of the
microcontroller are not capable of driving loads that require tens of milliamperes (mA).
Logic level current, voltage and power requirement for different versions of
microcontrollers are given in Table I.
Driver circuit design. The microcontroller outputs a current of 1.7 mA. To drive the
coil of a stepper motor requiring a torque of 7 kg-cm, 12V DC and 2 amp/phase, we
have to use a driver circuit that amplifies the current from 1.7 mA to 3 amp.
Table II
Clockwise step sequence of the Motor
a1 a2 b1 b2 a1 a2 b1 b2 Hex value
0 0 1 1 0 0 1 1 =33h
0 1 1 0 0 1 1 0 =66h
1 1 0 0 1 1 0 0 =CCh
1 0 0 1 1 0 0 1 =99h
0011
1001
1100
0110
0 1 1 0 0 1 1 =33h 0 0 1 =99h 1 0 0 =CCh 1 1 0 =66h
BC548 and SL100 as the driver transistors for driving a low-power rated stepper motor
for driving a low-power rated stepper motor inch) floppy drives. But for a 7 kg-cm step-
per motor, a driver circuit using transistors SL100 and 2N3055 would be needed to
amplify the current to 2.72 amp. Typically, SL100 and 2N3055 each has a gain (hfe) of
40, but 2N3055 can handle larger current since it belongs to the family of power
transistors. So a heat-sink is required to dissipate the heat generated.
The output gain of the Darlington pair of SL100 and 2N3055 transistors is:
AVo = Io/Iin = 1600 where Io is the output current and Iin is the input current of the
Darlington
pair.
Io = 1600×1.7 mA = 2.72 A
Since the stepper motor has four coils, we need to use four Darlington pairs.
Programming
The program is written in Assembly language and compiled using ASM51 cross-
assembler. The listing file is given at the end of this article. 89C51 microcontroller is
programmed using Atmel’s Flash programmer.
One-step rotation of the stepper motor used in this project equals 1.8o. When you
program the motor for 200 steps, the motor makes one complete revolution, i.e. 360o. In
the program, the line ‘MOV R7, #0CAH’ defines the rotation by 202 steps. The hex
number ‘0CAH’ equals the decimal number ‘202.’ However, one can change the number
of steps in the program as per one’s requirement.
The step sequence is defined by the line ‘MOV A, #033H.’ Table II shows the step
sequence for 100 steps to energise the windings of the stepper motor in clockwise
Fig. 4: Actual-size, single-side pCB for stepper motor control Fig. 5: Component
layout for the pCB system using 89C51 microcontroller
and anti-clockwise directions. The rotor of the stepper motor is in a position of minimum
reluctance and maximum flux. Thus by energising the windings (represented by A1, A2,
B1 and B2), the rotor takes the position accordingly. In the program, the instructions ‘RR
A’ and ‘RL A’ are used for clockwise and anti-clockwise, respectively.
S1 and S3 are toggle switches, while S2 is a tactile switch. Switch S3 interfaced to pin
32 of the microcontroller determines the direction of rotation. When the switch is opened
the motor rotates in clockwise direction, and when the switch is closed the motor rotates
in anti-clockwise direction.
You can assemble the circuit on any general-purpose PCB. An actual-size, single-side
PCB for the stepper motor controller is shown in Fig. 4 and its component layout in Fig.
5.
Mount a 40-pin IC base for the microcontroller on the PCB, so you can remove the chip
easily when required. Normally, six wires of different colours (two being red) are
available for connection to the stepper motor. The sequence for connecting the stepper
motor coils to the driver card is shown in Fig. 2.
After you are done with the hardware part, assemble the program (stpb1.asm) using
ASM51 assembler. Load the hex file generated by ASM51 into a program- mer and burn
it into the chip. Now put the programmed chip on the IC base on the PCB.
Switch on the power supply to the circuit using switch S1. If motor rotation is not stable,
press S2 momentarily. If the motor does not move at all, check the connections.
Note. The source code and the relevant files for this article have been included in CD.
1 $MOD51
0000 2 ORG 0000H 0000 E580 3 MOV A, P0 0002 33 4 RLC A
0003 500B 5 JNC P12
6
0005 7FCA 7 MOV R7, #0CAH; 0007 7433 8 MOV A, #033H; 0009 F5A0 9 P13: MOV P2, A; 000B 23 10 RL A;
000C 111B 11 ACALL DELAY 000E DFF9 12 DJNZ R7, P13
Readers’ comments
What changes are to be made if I use a 12V DC stepper motor instead of the 5V DC
stepper motor?
STPB1.LST
13
0010 7FCA 14 P12: MOV R7, #0CAH; 0012 7433 15 MOV A, #033H;
0014 F5A0 16 P11: MOV P2, A; 0016 03 17 RR A;
0017 111B 18 ACALL DELAY
0019 DFF9 19 DJNZ R7, P11
20
21
001B 758910 22 DELAY: MOV TMOD, #10H 001E 7B05 23 MOV R3, #05
0020 758B08 24 Z: MOV TL1, #8D
replies:
Mr Savaliya should use the Darlington pair of transistors SL100 and 2N3055. It has been
mentioned in the text also under the heading ‘driver circuit design.’
The point to be noted is that the power supply to the motor driver circuitry
0023 758D01 25 MOV TH1, #1D
0026 D28E 26 SETB TR1
0028 308FFD 27 BACK: JNB TF1, BACK 28
002B C28E 29 CLR TR1
002D C28F 30 CLR TF1
002F DBEF 31 DJNZ R3, Z
0031 22 32 RET
33 END
and the controller circuitry should be different. The controller works off +5V and the
power supply to the driver circuit will be +12V. The grounds for both the supplies will
be the same. This configura- tion works well with the 12V DC stepper motor.
MICROPROCESSOR-baSEd HOME
SECURITy SySTEM
B.B. Manohar
D
on’t take the chance of becoming a victim of burglary, which is of ten accompanied by
violence.
Protect your family and valuables with this microprocessor-based home security system
that will let you rest your head knowing that should any one try to break into your home,
an alarm will go off and the police will be alerted immediately.
The transmitter section continuously transmits infrared (IR) rays, which are received by
the receiver section. The received signal is further amplified and given to the PLL
section, where its frequency is locked to the transmitted frequency.
When the IR signal is interrupted, the microprocessor starts working as per the program
burnt into the erasable programmable read-only memory (EPROM) and controls the
siren, telephone (via cradle and redial switches) and cassette player (in which the alert
message is recorded already) via the respective relays.
Fig. 2 shows the complete circuit of the 8085 microprocessor-based home security
system.
The output of IC1 is fed to the base of transistor T1, which drives an infrared light-
emitting diode (IR LED) to transmit the modulated IR signal. Resistor R4 limits the
current flowing through the IR LED. Preset VR1 is used to vary the modulating
frequency.
The transmitter and the receiver are arranged such that the transmitted IR rays fall
directly onto phototransistor L14G1 (T2) of the receiver. The signal received by T2 is
amplified by transistor T3 and operational amplifier µA741 (IC2).
Series input resistor R8 and feedback resistor R9 determine the gain of op-amp IC2. The
amplified signal is applied to pin 3 of PLL LM567 (IC3) through capacitor C4.
IC LM567 is a highly stable PLL with synchronous AM lock detection and power output
circuitry. It is primarily used as a frequency decoder, which drives the load whenever a
sustained frequency
ParTs lIsT
Semiconductors:
IC1 - NE555 timer
IC2 - µA741 operational amplifier IC3 - LM567 phase-locked loop IC4 - 8085
microprocessor
IC5 - 2732A EPROM (4k)
IC6 - 74LS373 octal transparent
latch
falling within its detection band is present in its self-biased input. The centre frequency
of the detection band and output delay are independently determined by the external
components.
In the absence of any input signal, the centre frequency of the PLL’s internal free-running,
current-controlled oscillator is determined by resistor R12 and capacitor C8. Preset
VR2 is used for tuning IC3 to the desired centre frequency in the 6-10kHz range, which
should match the modulating frequency of the transmitter. Capacitors
C6andC7areusedaslow-passfilter(LPF) and output filter, respectively.
When the received signal is locked to the frequency of the transmitted signal, pin 8 of
IC3 goes low and LED1 glows. Since pin 8 is connected to the base of transistor T4
through resistor R13, it is cut off and its collector voltage rises. As a result, transistor T5
is forward biased to energise relay RL5. The pole and normally-closed (N/C) contact of
relay RL5 are connected to +5V and pin 4 (PA0) of IC7, respectively.
Normally, the transmitted IR signal falls on phototransistor T2, so relay RL5 is energised
and there is no input to the processor via IC7. When the IR signal is interrupted, relay
RL5 de-energises to provide a high (TTL-level) signal to the processor via port A of the
programmable peripheral interface (PPI).
When the microprocessor gets a high signal from port A of IC7, it starts working as per
the code loaded in the EPROM (IC5).
The low-order multiplexed address and data lines AD0 through AD7 of IC4 are
connected to the EPROM (IC5) through the octal latch (IC6), while its high-order
address lines A8 through A10 are directly connected to the EPROM. Address lines A0
through A7 are separated
PB0 (pin 18), PB1 (pin 19), PB2 (pin 20) and PB7 (pin 25) of IC7 are connected to the
bases of transistors T6 through T9 via resistors R19 through R22, respectively. A high
signal on these pins energises relays RL1 through RL4. Switch S1 is used to reset IC4.
The circuit for detecting the polarity reversal in the telephone line is built around
optocouplers IC8 and IC9. Normally, TIP is positive with respect to the RING lead of
the telephone line. With the handset in off-hook position, a nominal loop current of 10
mA is assumed to flow through the telephone lines. Resistor R23
Fig. 5: Actual-size, solder-side pCB layout for the home security system
Fig. 6: Actual-size, component-side pCB layout for the home security system
is selected as 120 ohms to develop a voltage of 1.2V (which is adequate for an LED to
turn on fully). When DC line voltage polarity reversal occurs, optocoupler IC8’s internal
LED conducts and LED3 glows to indicate polarity reversal. Simultaneously,
optocoupler IC9’s internal LED goes off and its pin 5 (collector) goes high to provide
line-reversal sense signal to 8085 via pin 14 of 8255 PPI.
Fig. 3 shows the power supply circuit. The AC mains is stepped down by transformer
X1 to deliver a secondary output of 12V AC at 300 mA. The transformer output is
rectified by a full-wave bridge recti- fier comprising diodes D7 through D10. Capacitor
C12 acts as a filter to eliminate ripples. IC10 and IC11 provide regulated 5V and 9V
power supplies, respectively. Capacitors C13 and C14 bypass any ripple present in the
regulated outputs. Switch S2 acts as an ‘on’/‘off’ switch.
Relay connections. The cradle switch in the telephone instrument is a double
Fig. 7: Component layout for the pCB
pole, two-way switch. Replace this cradle switch with the contacts of DPDT relay RL3
as shown in Fig. 2. Now relay RL3 is used to implement the action of lifting the
telephone handset.
There are four pads on the PCB of the telephone instrument where cradle switch is
connected. The two pads which are shorted when the telephone handset is placed on the
cradle are connected to the normally closed (N/C) contacts of relay RL3, while the other
two pads which are shorted when the handset is off-hook are connected to the normally
open (N/O) contacts of relay RL3.
Relay RL2 is connected in parallel to the redial button of the telephone instrument. When
relay RL3 energises to emulate lifting of the handset, relay RL2 is energised to switch on
the redial button and the already loaded telephone number of the police station or any
other help provider is automatically dialled.
Relay RL4 activates the siren whenever the IR signal being received is interrupted. The
siren sounds continuously until the user presses the reset button.
Relay RL1 is used to switch on the audio cassette player, in which the user’s residential
address and alert message to be conveyed to the police station are prerecorded. The
speaker output of the cassette player is connected to the telephone’s microphone to
convey the alert message to the police station. The player gets switched off when the
message is over.
The transmitting IR LED1 and phototransistor T2 of the receiver are fitted to the
opposite pillars of the gate such that the IR rays emitted by the LED directly fall on the
phototransistor.
The IR LED transmits a train of IR pulses. These pulses are received by the receiver and
amplified by IC2. Output pin 8 of the PLL (IC3) is low when the PLL network is locked
to the transmitter frequency and relay RL5 energises to make PA0 line of IC7 low.
When someone walks through the gate to enter your home, the transmitted signal is
interrupted. Output pin 8 of the PLL network goes high and relay RL5 de-energies to
make PA0 line of IC7 high. Now the microprocessor starts working as per the program
loaded in the EPROM.
Relay RL4 energises to activate the siren. At the same time, relay RL3 energises to
emutate lifting the telephone handset off the cradle to provide the dial tone. After a few
seconds, relay RL2 energises to short the redial button contacts. After the loaded number
is dialled, it switches off relay RL2. Then relay RL1 turns on the audio player.
Here we have provided the same polarity-reversal detection facility so that the audio
player turns on only when polarity-reversal is detected.
The actual-size, double-side track layouts for solder and component sides of the PCB for
the 8085 microprocessor-based home security system are shown in Figs 5 and 6,
respectively, and their component layout in Fig. 7.
Software program
Fig. 4 shows the flow-chart of the Assembly language program. The device interface IC
(IC7) is initialised with control word 99H. Ports A and C of IC7 act as input ports,
while port B becomes the output port.
After initialisation, the 8085 microprocessor reads the status of port A. If port A is high,
siren is activated. The telephone goes in off-hook condition and the emergency number is
dialled through the redial button. Redial button gets switched off after the number is
dialled. Now the microprocessor reads the status of port C and checks for the polarity
reversal of the telephone line. When polarity reversal is detected, the audio player turns
on to play the message. Otherwise, the process repeats from activation of the siren
followed by emergency number dialling and so on. After delivering the message, the
player automatically gets turned off. The siren sounds until the reset switch is pressed.
SeCuriTy.LST
2500 A.D. 8085 CROSS ASSEMBLER - VERSION 3.00b
-------------------------------------------------
INPUT FILENAME : SECURITY.ASM
OUTPUT FILENAME : SECURITY.
1 0000 ORG 0000H
2 0000 3E 99 MVI A,99H ;Move control word to accumulator. 3 0002 D3 03 OUT 03H ;O/P control word to control
registor. 4 0004 DB 00 L1:IN 00H ;Read port-A.
5 0006 FE 01 CPI 01H ;Accumulator value compared with 01H 6 0008 C2 04 00 JNZ L1 ;Jump to L1 if it is not equal.
7 000B 3E 88 L2:MVI A,88H ;Move 88H to accumulator. 8 000D D3 01 OUT 01H ;O/P the accumulator content to
port-B (Siren ON).
9 000F 06 FF MVI B,FFH;
10 0011 0E FF LA:MVI C,FFH ;Delay Routine.
11 0013 0D LB:DCR C
12 0014 C2 13 00 JNZ LB
13 0017 05 DCR B
14 0018 C2 11 00 JNZ LA
15 001B 3E 84 MVI A,84H ;Move 84H to accumulator.
16 001D D3 01 OUT 01H ;O/P the accumulator content to port-B. 17 001F 06 FF MVI B,FFH
18 0021 0E FF LAA:MVI C,FFH ;Delay Routine.
19 0023 0D LBB:DCR C
20 0024 C2 23 00 JNZ LBB
21 0027 05 DCR B
22 0028 C2 21 00 JNZ LAA
23 002B 3E 86 MVI A,86H ;Move 86H to accumulator.
24 002D D3 01 OUT 01H ;O/P the accumulator content to port-B. 25 002F 11 FF FF LXI D,FFFFH
26 0032 1B LOOP1:DCX D
27 0033 7A MOV A,D
28 0034 B3 ORA E
29 0035 C2 32 00 JNZ LOOP1
30 0038 3E 84 MVI A,84H ;Move 84H to accumulator.
31 003A D3 01 OUT 01H;O/P the accumulator content to port-B.
32 003C 06 40 MVI B,40H
33 003E 11 FF FF SEC:LXI D,FFFFH
34 0041 DB 02 IN 02H
35 0043 FE 01 CPI 01H
36 0045 CA 59 00 JZ OFF
37 0048 1B LOOP:DCX D
38 0049 7A MOV A,D
39 004A B3 ORA E
40 004B C2 48 00 JNZ LOOP
41 004E 05 DCR B
42 004F C2 3E 00 JNZ SEC
43 0052 DB 02 IN 02H ;Read port-C.
44 0054 FE 01 CPI 01H ;Accumulator value compared with 01H 45 0056 C2 0B 00 JNZ L2 ;Jump to L2 if it is not
equal. 46 0059 3E 85 OFF:MVI A,85H ;Move 85H to accumulator. 47 005B D3 01 OUT 01H ;O/P the accumulator
content to port-B. 48 005D 01 FF 01 LXI B,1FFH
49 0060 11 FF FF SEC0:LXI D,FFFFH
50 0063 1B LOOP0:DCX D
51 0064 7A MOV A,D
52 0065 B3 ORA E
53 0066 C2 63 00 JNZ LOOP0
54 0069 0B DCX B
55 006A 78 MOV A,B
56 006B B1 ORA C
57 006C C2 60 00 JNZ SEC0
58 006F 3E 80 MVI A,80H
59 0071 D3 01 OUT 01H
60 0073 11 FF FF LP1: LXI D,FFFFH
61 0076 1B LP:DCX D
62 0077 7A MOV A,D
63 0078 B3 ORA E
64 0079 C2 76 00 JNZ LP
65 007C C3 73 00 JMP LP1
66 007F 76 HLT
67 0080 END
************* S Y M B O L I C R E F E R E N C E T A B L E ************* L1 0004 L2 000B LA 0011 LAA
0021 LB 0013 LBB 0023 LOOP 0048 LOOP0 0063 LOOP1 0032 LP 0076 LP1 0073 OFF 0059
SEC 003E SEC0 0060
LINES ASSEMBLED : 67 ASSEMBLY ERRORS : 0 q
Safety Guard for the Blind
F
or the blind, it’s difficult to step out without someone’s help. To make the life simpler
for them,
here’s an electronic safety guard system that alerts them of any obstacle or object in their
path. The system can detect obsta- cles within one metre.
The system comprises transmitter and receiver sections (see Fig. 1). The receiver
section uses an embedded system that tells the voice processor to play the recorded
message in case any obstacle is
P. Murali KuMar
System operation
The transmitter is built around timer IC 555, which is designed to operate at a frequency
of 38 kHz. This signal is ampli- fied by a current amplifier and transmit- ted through
infrared (IR) diodes.
The IR rays reflected back from any obstacle are received by the IR receiver. The re-
ceived signal is amplified by the amplifier stage, so even the weak signals can be picked
up by the receiver. The amplified signal voltage is compared with a fixed threshold
voltage
Parts List
Semiconductors:
IC1 -555 timer
IC2 - 7805 5V regulator
IC3 - LM311 comparator IC4 - AT89C51 microcontroller
chip
IC5 - ISD1420 voice processor T1-T5, T7 - BC 548 npn transisor T6 - BC558 pnp
transisor IR LED1, IR LED2 - Infrared LEDs (5mm dia.) IRX1
ZD1 D1
Miscellaneous:
B1, B2 - 9V battery
XTAL1 - 3.579MHz crystal oscilla-
tor
S1, S2 - On/off SPST switch S3, S4 - Push-to-on tactile switch MIC - Condensor
microphone JACK1 - Jack for headphone connec-
tor
RL1 - 5V, 100-ohm, singlechangeover relay
microcontroller.
When the comparator output goes high because of reflection of signal from an object, the
micro- controller energises a relay via the relay driver. The relay contacts are used by a
voice processor to play a prerecorded warning message (such as “hey, there’s an
obstacle”). The user can hear the played message using a headphone.
Circuit description
As shown in Fig. 4, ports P1.0 through P1.3 of IC4 are used as the input ports. The
corresponding outputs are available at ports P2.0 through P2.3. The output of the
comparator is fed to port P1.0 and the corresponding output at port P2.0 is fed to the
base of transistor T6 (BC558) through resistor R18.
Normally, when no signal is applied at input port P1.0, output port P2.0 is high. When
input P1.0 becomes high, output P2.0 goes low and transistor T6 conducts. This, in turn,
drives transistor T7 (BC548) to energise relay RL1, which is indicated by glowing of
LED4. In case the circuit behaves abnormally, press reset switch S3 momentarily to
reset the circuit.
Voice processor. The voice processor section receives regulated 5V DC supply from
regulator IC2. Voice processor IC ISD1420 (IC5) used here is a 28-pin chip from
Winbond. It can record a voice mes- sage up to 20 seconds long. The recorded message
can be played at the press of a button connected to one of its pins.
message.
Program
compilation
After installing
Keil C51 in your sys-
tem, you can compile C
program and generate
hex file in either DOS
or Windows mode. For
DOS-mode operation,
refer to the ‘Tempera-
ture Indicator Using
Software program
Written in C language, the software program (Embed.c) for the microcontrol- ler is
simple and easy to understand. You don’t have to write long Assembly language program
for this operation. The program is converted into Intel-Hex format for loading to the
microcontroller. Here, we’ve used cross-compiler C51 ver- sion 7.10 from Keil
Software for conver- sion. The demo version of this compiler is available for free on the
Website ‘www. keil.com.’
The C program includes ‘<Regx51. h>’ file, which defines pseudo-variables to interact
with memory-mapped devices and I/O ports of the microcontroller. The I/O ports P1.0
through P2.7 of AT89C51 are defined in the program. The program line “{if(t0==0) {
t4=1;” instructs the mi- crocontroller that if its input port P1.0 is low, its output port P2.0
should be high. Otherwise, P2.0 must be low.
The listing file (Embed.lst) generated by Keil compiler is given at the end of
Screenshot of editing window
AT89C52’ article published in July issue. Every time you create a new program in Keil
C51 version 7.10, you must create a project file with ‘.uv2’ extension. Then write the
program in ‘Edit’ window, com- pile it and link it. (The compiled program with ‘.hex’
and ‘.lst’ files has been included in CD.)
If you want to create your own pro - gram, the steps for Windows mode are:
1. Install Keil software in ‘C’ drive. After installation, ‘Keil uVision2’ icon is
automatically created on the desktop.
2. Double-click ‘Keil uVision2’ on the desktop.
3. Suppose you have kept ‘Embed.c’ under ‘C:\Windows\Desktop\Embedded’ folder.
Open ‘Embed.c’ from ‘File’ menu.
4. From ‘Project’ menu bar, select ‘New Project.’ Name the new project and save it
with ‘.uv2’ extension.
5. Select CPU as ‘Atmel/AT89C51.’
6. Choose ‘Yes’ in the option ‘Copy standard 8051 code to current project folder.’
7. From ‘View’ menu, select ‘Project Window.’ ‘Project Workspace’ window appears
on the left-hand side of the PC screen.
8. Double-click ‘Target 1.’
9. Right-click ‘Source Group1’ and select ‘Add files to Group ‘Source Group1.’’ A
window appears.
10. Add ‘Embed.c’ and close this window.
11. Double-click ‘Source Group1’ in ‘Project Workspace’ window to get ‘Embed. c’
(see the screenshot).
12. Right-click ‘Embed.c’ in ‘Project’ window, select ‘Options for File Embed. c’ and
choose ‘File Type’ as ‘C source file’ under ‘Properties.’
13. Again from ‘Project’ menu, select ‘Options for Target 1.’ An ‘Option’ screen
appears.
14. Choose ‘Output’ and tick ‘Hex File’
Fig. 6: Actual-size, single-side PCB for transmitter and receiver circuits of the safety
guard
Fig. 7: Component layout for the PCB
for generating the hex file. Again choose ‘Listing’ option and tick ‘Conditional’ and
‘Assembly Code.’
15. Open ‘Project’ menu and select ‘Build Target’ or press ‘F7’ key.
For any syntax error, the window will contain a list of errors with the line numbers.
Double-clicking an error mes- sage will cause the corresponding line in the source edit
window to be highlighted. Correct errors, if any, and press ‘F7’ key again.
If compilation is successful, an object file with ‘.obj’ extension is created for the source
file. The compiler shows ‘“Embed”- 0 Error(s), 0 Warning(s)’ in the output window just
below the project window. It also produces a listing file with ‘.lst’ extension for the
source file. Then the system links all the generated files into a combined hex file (with
‘.hex’ extension) suitable for loading into the chip. In this example, the files created are
‘startup.obj,’ ‘startup.lst,’ ‘Embed.obj,’ ‘Embed.lst’ and ‘Embed.hex.’
16. Close the screen and go to ‘Embedded’ folder to see the generated hex and listing
files.
17. Load the hex file into the microcontroller chip using a programmer.
We’ve used Atmel Flash Programmer V.1 from Front- line Electronics. It is a serial port
programmer. The proce- dure for loading the hex file into Atmel Flash programmer is
given below:
1. Double-click the icon of the programmer.
2. Select the appropriate COM port from ‘Settings’ menu bar.
3. Select ‘89C51’ from ‘Selection’ option in ‘Device’ menu bar.
4. Load the hex file from ‘File’ menu.
5. Choose ‘Auto’ in ‘Device’ menu bar. This will automati- cally erase the previous
pro- gram, if any, and load the new program into the chip.
Construction and working
The transmitter and re - ceiver circuits can be assem- bled on separate general-pur- pose
PCBs. Both the circuits must be separated or covered by some opaque, non-conduct- ing
material so that no stray signal from the transmitter falls on the receiver. The units can be
carried in a bag, with the IR transmitting LEDs and the receiver sensor (IRX1) mounted
on the front side of
This system uses only one pair of transmitter and receiver circuits for alerting against the
obstacles in the path of the user, but it can be extended to use three more pairs for
detection of objects on the right, left and back side. As shown in Fig. 4, input ports P1.1,
P1.2 and P1.3 of AT89C51 and their corresponding output ports P2.1, P2.2 and P2.3 are
left unused. These ports can be used for detection of objects on the right, left and back
side. Separate pairs of transmitter and receiver circuits are required for all the sides.
If all the eight ports are to be used, use the same circuits as used at ports P1.0 and P2.0
for all the ports (shown by dotted lines in Fig. 4). Apart from adding these circuits to the
microcontroller section, you also need to use the same but separate transmitter (Fig. 2),
receiver (Fig. 3) and voice processor circuits (Fig. 5) for each input-output port
combination. (Separate voice processor is not required if you make use of the multiple-
message record/play capability of IC APR9600 as in ‘Voice Recording and Playback
Using APR9600 Chip’ construction project published in EFY’s September ’04 issue.
Relays can also be replaced by transistor switches.)
The combined actual-size, single-side PCB for the transmitter and receiver cir- cuits is
shown in Fig. 6 and its component layouts in Fig. 7. The transmitter and re- ceiver PCBs
can be separated by cutting the PCB along the dotted lines.
EFY note .The source code and other relevant files of this project have been included in
CD.
EmbEd.C
/* C PROGRAM OF EMBEDDED SYSTEM */ #include<stdio.h>
#include<Regx51.h>
sbit t0=P1^0;
sbit t1=P1^1;
sbit t2=P1^2;
sbit t3=P1^3;
sbit t4=P2^0;
sbit t5=P2^1;
sbit t6=P2^2;
sbit t7=P2^3;
sbit t8=P2^4;
sbit t9=P1^5;
sbit t10=P1^6;
sbit t11=P1^7;
sbit t12=P2^5;
sbit t13=P2^6;
sbit t14=P2^7;
void main()
{
t9=t10=t11=t12=t13=t14=0; t0=1; t1=1;t2=1;t3=1;//t3=t2=t1=t0=1;
for(; ;)
}
}
l1: if(t0==0) t5=t6=t7=t8=0; }
t4=t6=t7=t8=0;
}
}}
EmbEd.lSt
C51 COMPILER V7.10 EMBED 10/11/2004 10:52:09 PAGE 1
; SOURCE LINE # 21
0035 D2A2 SETB t6 0000 C2A7 CLR t14 0002 C2A6 CLR t13 0004 C2A5 CLR t12 0006 C297 CLR t11 0008 C296
CLR t10 000A C295 CLR t9 0037 C2A4 CLR t8 0039 C2A3 CLR t7 003B C2A1 CLR t5 003D C2A0 CLR t4 ;
SOURCE LINE # 40
0017 D2A0 SETB t4 ; SOURCE LINE # 26 ; SOURCE LINE # 27 0046 C2A4 CLR t8 0048 C2A2 CLR t6 004A
C2A1 CLR t5 004C C2A0 CLR t4 ; SOURCE LINE # 46
0023 l2:
0023 20910C JB t1,l3 ; SOURCE LINE # 30 ; SOURCE LINE # 31 0052 C2A3 CLR t7 0054 C2A2 CLR t6 0056
C2A1 CLR t5 0058 C2A0 CLR t4
0032 l3:
0032 20920C JB t2,l4 ; SOURCE LINE # 35
; SOURCE LINE # 36
; SOURCE LINE # 37
MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 92 ---
CONSTANT SIZE = ------XDATA SIZE = ---- ---
PDATA SIZE = ---- ---
DATA SIZE = ---- ---
IDATA SIZE = ---- ---
BIT SIZE = ---- ---
END OF MODULE INFORMATION.
e’ve seen in movies highly secured dens that require one to press certain number
combina-
tion to gain entry. These locking systems use expensive microprocessors and PCs, which
a common man can’t afford.
Here is a digital combination lock using solidstate memory ICs that costs much less. As
shown in Fig. 1, the system uses two key sets (user and security key sets), D-type flip-
flops, comparators and solenoid. The user code comprising eight bits is compared with
the preset security code of the same length (eight bits). If the user code matches with the
security code, access is granted for opening the code lock by pressing an ‘Enter’ key.
The lock can be closed/reset by using the reset key.
Circuit description
Fig. 2 shows the power supply circuit for the lock. The AC mains is stepped down by
transformer X1 to deliver a sec- ondary output of 9V AC at 300 mA. The transformer
output is rectified by a fullwave bridge rectifier comprising diodes D1 through D4.
Capacitor C2 acts as a filter to eliminate ripples. Regulator IC 7805 (IC9) provides
regulated 5V power supply to the circuit.
Fig. 3 shows the circuit of the digital combination lock. The user key set com- prising
switches is connected to D-type flip-flop 74LS74 ICs (IC1 through IC4), which act as
the storage devices for the sequence entered by pressing push-to-on tactile switches S1
through S8.
Pressing any of the user keys results in logic 1 to be clocked to the ‘Q’ output of the
respective flip-flop of IC 74LS74. Else, the ‘Q’ outputs of the flip-flops of IC1 through
IC4 remain at logic 0. The outputs of IC1 through IC4 are fed to ‘A’ inputs of two 4-bit
magnitude comparator 74LS85 ICs (IC5 and IC6). The ‘B’ inputs of IC5 and IC6 are
connected to the security key set (S9 through S16). Output pin 6 of IC5 (OA=B) and input
pin 3 of IC6 (IA=B) are cas- caded to obtain the 8-bit sequence.
Output pin 6 of comparator IC5 goes high if the input bit sequence is the
Fig. 1: Block diagram of digital combination lock
Fig. 2: Power supply circuit
SreeKuMar V.
same as the pre - set bit sequence, i.e. ‘A3A2A1A0’ is equal to ‘B3B2B1 B0.’
Similarly, out- put pin 6 of com- parator IC6 goes high if the input bit sequence is the
same as the pre- set bit sequence, i.e. ‘A3A2A1A0’ is
Parts List
Semiconductors:
IC1-IC4, IC7 - 74LS74 dual D-type flip-flop IC5, IC6
IC8
IC9
LED1 LED2 T1
D1-D6
- 74LS85 4-bit magnitude
comparator
- 74LS00 quad 2-input NAND
gate
- 7805 5V regulator
- 5mm red LED
- 5mm green LED
- SL100 npn transistor
- 1N4001 rectifier diode
Capacitors:
C1 - 100µF, 16V electrolytic C2 - 1000µF, 25V electrolytic C3 - 0.1µF ceramic disk
Miscellaneous:
X1 - 230V, AC primary to 9V AC,
- Solenoid or equivalent
equal to ‘B3B2B1B0.’ The high output of IC6 is fed to flip-flop IC7. Pressing ‘Enter’
key (S17) causes a clock transi- tion at the input of IC7 and its Q1 output (pin 5) goes
high. As a result, transistor T1 conducts and relay RL1 energises. At the same time, the
solenoid connected to the relay contacts moves back to unlock the door.
In case the user input bit sequence doesn’t match with the preset security bit sequence,
the output of IC6 remains low and therefore pressing ‘Enter’ key doesn’t activate the
relay driver transistor. Con- sequently, the solenoid doesn’t move back to unlock the
door.
Solenoid connections are shown in Fig. 4. Driving the solenoid with DC is very simple.
Just switch on the DC sup- ply to it using a relay or transistor, and the solenoid operates.
However, when the solenoid is driven, flywheel diodes are necessary. The large
inductance of the coil can cause large voltage spikes to appear across the switching
element (relay or transistor doing the switching), unless the current flowing through the
coil is allowed to dissipate slowly.
When relay RL1 energises, the cur - rent flowing down through the solenoid coil is
limited by the resistance of the coil. The inductors tend to oppose the
Fig. 4: Solenoid connections quick change in the current flowing through them and
generate a voltage of their own to stop this happening. When relay contacts open, the
inductor generates a voltage to make the current to continue down through the coil, and
the current flows up through the diode and back into the inductor. This is the reason why
a freewheeling diode (D6) is
Fig. 5: Actual-size, single-side PCB for digital combination lock Fig. 6: Component
layout for the PCB
used here. The logic built around NAND gates N1 and N2 enables the buzzer when the
sequence matches and ‘Enter’ key is pressed. Capacitor C1 prolongs the buzzer sound.
Operation
This circuit is designed for 8-digit binary codes and can be divided into two parts,
namely, the user key panel and the security key panel. Switches S1 through S8 shown
within the rectangular dotted lines form the user key panel. Similarly, switches S9
through S16 shown within another rectangular dotted lines form the security key panel.
Suppose you want to set the pass - word as ‘1578.’ For this, connect the first switch
(S9), fifth switch (S13), seventh switch (S15) and eighth switch (S16) of the security key
set to +5V and ground all the remaining switches. To open the lock, you’ll have to
momentarily press the first switch (S1), fifth switch (S5), seventh switch (S7) and eighth
switch (S16) of the user key set to match with the preset code in the security key set and
then press ‘Enter’ key (S17).
If the entered sequence matches with the preset sequence, the buzzer sounds to indicate
the correct entry and LED2 glows to indicate that the lock has opened. If the sequence
doesn’t match, the buzzer doesn’t sound and LED1 glows to indicate that the door is not
opening. For the next trial, press reset key S18.
Pressing ‘Enter’ key obviates fool - ing of the system by random entries when someone
is trying to open the lock. With eight digits, up to 28combina- tions are possible, which
makes it very difficult for a person to keep on trying by pressing ‘Enter’ every time.
After each entry, reset switch S18 should also be pressed to clear all the flip-flops (IC1
through IC4 and IC7).
Fabrication
An actual-size, single-side PCB for the digital combination lock (including the user and
security key sets) is shown in Fig. 5 and its component layout in Fig. 6. If you want to
install the user and secu- rity key sets away from the gate, you can separate them from the
main circuit by using extended wires. An electromechani- cal device such as relay,
magnetic bell or solenoid can be used to open the lock. The power supply circuit can be
easily wired on a separate general-purpose PCB.
Precautions
1. Use a TTL logic gate such as 74LS74, 74LS85 or 74LS00 to minimise power
consumption.
ere is a low-cost, wireless lampbrightness controller. It uses ul trasonic sound waves for
remote
As with any other remote control, the system basically comprises a transmitter and a
receiver circuit. Frequencies above 20 kHz are inaudible (ultrasonic). The transmitter
circuit generates ultrasonic sound of 40-50kHz frequency. The receiver senses the
ultrasonic sound from the transmitter and enables a unijunction transistor (UJT) based
relaxation oscillator, which, in turn, controls the lamp brightness by phase control of a
silicon
controller
PradeeP G.
Fig. 1: Block diagram of the ultrasonic lamp-brightness controller
Fig. 2: Circuit of the ultrasonic transmitter
controlled rectifier (SCR).
Fig. 1 shows the block diagram of the ultrasonic lamp-brightness controller. The
received signals are amplified and given to the comparator after rectification and
filtering. The comparator provides clock pulse to the decade counter. The output of the
decade counter enables the UJT oscillator to control the phase angle of the current
through the load via the SCR.
Fig. 2 shows the circuit of the ultrasonic transmitter. The transmitter uses a free-running
astable multivibrator built around NOR gates of CD4001B that oscillates at a frequency
of 40 to 50 kHz.
The transmitter is powered from a 9V PP3 cell. Preset VR1 is used for setting the
frequency to 40 kHz. When switch S1 is p re s se d , t he signal is given to the transmitter
transducer and inaudible 40kHz sound is transmitted.
Fig.3 shows the receiver circuit of the ultrasonic lampb r i g h t n e s s controller. The 9 .
1 V p o w e r supply for the receiver circuit is derived from
Parts List
Semiconductors:
IC1 - CD4001 NOR gate IC2 - CA3140 operational
amplifier
IC3 - CD4017 decade counter T1, T2 - BC549C npn transistor T3 - 2N2646 unijunction
transistor
Capacitors:
C1
C2
C3
C4, C5
C6
C7
C8
Miscellaneous: S1
TX1
RX1
- 470-kilo-ohm
- 18-kilo-ohm
- 56-kilo-ohm
- 8.2-kilo-ohm
- 1.2-kilo-ohm
- 10-kilo-ohm
- 100-kilo-ohm
- 120-kilo-ohm
- 4.7-kilo-ohm
- 10-kilo-ohm, 10W
- 47-kilo-ohm preset
- 20-kilo-ohm preset
- 2.2-mega-ohm preset
- Push-to-on switch
- 40kHz ultrasonic
transmitter
- 40kHz ultrasonic receiver
- 230V, 60W lamp
230V, 50Hz AC mains. The AC mains is rectified by diodes D13 through D16 and
limited to 9.1V by using zener diode ZD1. Resistor R3 is used as the current limiter.
Capacitor C8 acts as a filter to eliminate ripples.
The receiver transducer senses 40kHz signals from the transmitter and converts them into
equivalent electrical variation of the same frequency. These signals are amplified by
transistors T1 and T2, then rectified and filtered.
The filtered DC voltage is given to the inverting pin 2 of operational amplifier CA3140
(IC2). The non-inverting pin 3 of IC2 is connected to a variable DC volt- age via preset
VR2 that determines the threshold value of the ultrasonic signal received by the receiver
for controlling the lamp brightness.
The clock pulse from IC2 is applied to 5-stage Johnson decade counter IC 4017 (IC3).
Johnson counters are a variation of standard ring counters, with the inverted output of the
last stage fed back to the input of the first stage. They are also known as twisted ring
counters. An n-stage Johnson counter yields a count sequence of 2n length, so it may be
considered to be a mod-2n counter.
For each pulse from the op-amp, the output of IC3 changes sequentially from Q0 to Q9.
Q0 through Q9 outputs of IC3 are connected to presets VR3 through VR12 via diodes D3
through D12. The other ends of presets are shorted and connected to capacitor C7 and
the emitter of the UJT (T3). The preset-capacitor combination at the emitter of the UJT
forms a relaxation oscillator around the UJT.
Initially, the UJT is in cut-off region and its internal input diode is reverse-biased. When
Q0 output of decade counter CD4017 (IC3) goes high, capacitor C7 starts charging
through preset VR3. When the voltage across the capacitor becomes high enough, it
forward biases the internal input diode of the UJT, and the capacitor discharges into the
low-resistance region between the UJT’s emitter and resistor R14. Discharging
continues until the voltage across the capacitor becomes zero and the internal diode of
the UJT is again reverse-biased. When the diode is reverse-biased, capacitor C7 starts
charg- ing again.
The process of charging and discharging produces a sawtooth pulse. This pulse triggers
SCR1 to control the phase angle of the current through the lamp. The capacitor-preset
combinations determine the oscillation frequency of the UJT. At Q0 through Q9 outputs
of IC3, presets are set at different values to obtain different phase angles. SCR1
Fig. 4: Actual-size, single-side PCB for transmitter and receiver units of the lamp-
brightness controller
Fig. 5: Component layout for the PCB
directly drives the lamp.
After assembling the circuit, adjust the frequency of the transmitter to exactly 40 kHz.
Orient the ultrasonic transducer transmitter towards the receiver transducer such that the
receiver can directly receive the ultrasonic waves from the transmitter. Press switch S1
to switch on the transmitter for each operation of switch S1. The brightness level of lamp
varies due to the phase control by the UJT.
The combined actual-size, single-side PCB for the transmitter and receiver units of the
lamp-brightness controller is shown in Fig. 4 and its component layout in Fig. 5. The two
PCBs can be separated by cut- ting along the vertical line. q
moVing message oVer dot-matrix
displaY
C
ontrolling electronic devices from a PC is a real fun. Here is a mov ing message display
that makes
use of the PC’s parallel port. The mes - sage typed from the keyboard of the PC is
displayed on the 5×7 dot-matrix display in moving format.
Moving message employing 5×7 (or 8×8) dot-matrix displays are used in many public
places including railway stations and general stores for announcements. These can
display any symbol of any language. In cheaper type of moving
a. Kannabhiran
message displays, the message is stored in ROM/EPROM and the same cannot be
changed easily. The costlier ones do provide the facility for changing the message.
The dot-matrix display circuit presented here has the following advantages:
1. The message to be displayed forms part of the program, so we can change the message
whenever required.
2. Up to sixteen 5×7 dot-matrix dis- plays can be used.
3. The program can be easily modified
Parts List
Semiconductors:
Capacitors:
C1 - 1000µF, 25V electrolytic Miscellaneous:
X1
- 230V AC to 7.5V-0-7.5V, 500mA transformer
Pin number traditional use Port name read/Write Port address Port bit
Fig. 1: Block diagram for moving message display using PC’s parallel port
to display characters of other scripts. 4. The cost of the circuit will depend
on the number of displays used in the
circuit.
Here, the circuit is designed for Eng-
lish characters using four 5×7 dot-matrix
displays. The message display speed can
be varied by changing the display rate in
the program.
PC’s parallel port
The PC’s parallel port (LPT port) is used to output the display code and control signals
for the moving message display. signals for the moving message display. pin D-type
female connector at the back of your PC. IBM PCs usually come with one or two LPT
ports.
Each parallel port is actually made up of three ports, namely, data port, status port and
control port.
Pins 2 through 9 form the 8-bit data port. This is purely a write-only port, which means it
can be used only to output data.
Pins 1, 14, 16 and 17 form the control port. This port is read-/write-capable, which
means it can be used both for outputing and inputing some data to/from the external
hardware.
Table I shows pin details of the standard parallel port (SPP), including their traditional
usage. The base address of the first parallel port (LPT1) is 378 (hex) or 888 (decimal).
The data port of the parallel port can be accessed by its base address. The status port
can be accessed using base address+1, i.e. 0379 hex (or 889 decimal). The control port
can be accessed using base address+2, i.e. 037A hex (or 890 decimal).
Similar method can be followed for LPT2, whose base address is 0278 in hex. In the
present application, we only need to output data. Since status port is a readonly port, the
same is not used. Pins 18 through 25 are grounded.
The circuit
Fig. 1 shows the block diagram of the moving message display. The data to be output
from the PC’s parallel port (LPT1) is first processed by the program. Data lines D0
through D2 of the parallel port are used to enable the seven rows of the dot-matrix
display using the 1:8 de- multiplexer (IC1). Data lines D3 through D7 and control lines
C0, C1, C2 and C3 are used (as output lines) to enable the columns of the dot-matrix
display via the 1:16 demultiplexer (IC2).
Fig. 2 shows the circuit diagram of the moving message display using the PC’s parallel
port. The circuit comprises 1-of-8 demultiplexer 74LS138 (IC1), octal tristate buffers
74LS244 (IC5 through IC8), 1-of-16 demultiplexer 74LS154 (IC2), transistors and four
5×7 dot-matrix displays. Discrete light-emitting diodes (LEDs) can also be arranged in a
matrix format to make an alphanumeric display, with each diode representing a pixel.
However, it is advantageous to use a 5×7 matrix display which can be obtained in a
single package such as FYM-2057IAX from Ningbo Foryard Opti-Electronics Co. Ltd
(refer Fig. 3).
D2, filtered by capacitor C1, then regu - lated by regulator 7805C (IC9) to provide
regulated 5V power supply to the circuit.
1-of-8 demultiplexer 74LS138 (IC1) provides ground path to the cathodes of all the
LEDs of the dot-matrix display through inverters and transistors by using the time-
division multiplexing technique. Pins 1 through 3 of IC1 are connected to pins 2 through
4 of LPT1. The outputs of
tabLe ii
Hex equivalent of the Data bits for Display of Columns and rows
D7 D6 D5 D4 D3 D2 D1 D0
0 0 1 1 0 0 0 0 30
0 1 0 0 1 0 0 1 49
1 1 0 0 1 0 1 0 CA
1 1 0 0 1 0 1 1 CB
1 1 1 1 1 1 0 0 FC
1 1 0 0 1 1 0 1 CD
1 1 0 0 1 1 1 0 CE
The software program for the moving message display is written in ‘C++’ language. It
works as per the flow-chart shown in Fig. 4. The message (data) entered from the
keyboard of the PC gets stored into an array.
Variable ‘b’ in the program signifies the number of blank spaces to be added before and
after the message. Its value is determined from the number of dot-matrix displays used in
the circuit. Since we have used four displays, assign a value of ‘4’ to variable ‘b.’ The
program now adds four blank spaces before and after the message. In case you are using
all the sixteen displays, assign a value of ‘16’ to variable ‘b’.
The stored data is converted into the equivalent ASCII code and stored in the new array.
ASCII code conversion is performed by including the header file ‘<ctype.h>’ in the
software.
The length of the message (including characters, numbers and blank spaces) is measured
by string function, which is performed by the header file ‘<string. h>.’ The message is
converted into hex code and sent to the parallel port for 5x7 dot-matrix display. At the
parallel port, data output is available in time-division multiplexing format. The speed of
operation depends on the value of ‘g’ used in the program.
Suppose you want to display the mes - sage “Electronics For You.” The length of this
message is calculated by the string function as ‘19.’ Since we’ve used four
displays, four blank spaces get added before and after the message. Thus the length of the
message now increases to 19+8=27.
The 8-bit data available (through data lines D0 through D7) from the parallel port’s
address 0×378 (base address+0) is used to display a single letter. Three bits (D0
through D2) from base address+0 are given to demulti- plexer IC1 and the remaining five
bits (D3 through D7) are given to the buffers (IC5 through IC8). Data flow from the
buffers is controlled by demultiplexer IC2. Rows and columns of all the four dot-matrix
displays are controlled by D0 through D2 and D3 through D7 with the help of control
pins C0, C1, C2 and C3. The four control bits (C0 through C3) from base address+2 of
the parallel port are given to IC2 to provide active-low output to enable the buffers.
Suppose you want to display letter ‘A.’ Draw ‘A’ on the 5×7 dot-matrix display as
shown in Fig. 5. Now, to convert the letter ‘A’ into column bits (D3 to D7) for each row,
the ‘off’ LEDs represent ‘0’ and dark or lighted LEDs represent ‘1.’ Thus bits D3
through D7 are converted into their binary and hex formats in Table II for each of the
rows. For activation of rows, we use bits D0 through D2 and they simply change
sequentially to output binary ‘000’ through ‘110’ (refer Table II). Hex equivalent of the
eight data bits for each row is shown in the last column of Table II.
The rows of the display are selected through demultiplexer IC1 by using the three bits
D0 through D2 from the paral- lel port and the columns of the display are selected by the
remaining five bits D3 through D7 from the parallel port. These eight bits are converted
into the equivalent hexadecimal value and sent through the parallel port by the program.
Similarly, you can convert any letter of a message into its equivalent hex output for a
blank space. Digits D3 through D7 of Table II will be all zeros for all rows, while
activating bits D0 through D2 will change sequentially from ‘000’ through ‘110.’
EFY note. The source code and other relevant files of this project have been included in
CD. q
SECTION B : CIRCUIT IDEAS
Intruder AlArm
Praveen Kumar
T
his circuit, fitted to the door of your house, sounds an alarm if anyone pushes the door.
This way it alarms
you against thieves or intruders. The cir - a laser diode is powered by a 9V bat- tery.
When switch S1 in the transmitter section is closed, the laser diode glows. Closing
switch S2 provides power sup- and transistor T1 stops conducting since the LDR offers
a high resistance in the absence of light. Transistor T2 receives base current and starts
conducting. The
ply to the re - ceiver section. Light falling from the laser diode on the light-depend ent
resistor (LDR) in the receiver sec tion provides base current to transistor T1 and it starts
conducting.
This grounds the base of transistor T2, so it doesn’t conduct and the alarm re- mains off.
When somebody pushes the door, light incident on the LDR is interrupted cuit (refer Fig.
1) comprises transmitter and receiver sections. The transmitter is fitted onto the inside of
the doorframe and the receiver is fitted to the door panel.
The transmitter section comprising pulse from the emitter of transistor T2 is connected to
the inputs of AND gate N1 (IC1). The high ouput of AND gate is con- nected to a JK
flip-flop (IC2) that works as a latch. As a result, output pin 12 (Q1) of IC2 goes high to
cause conduction of transistor T3 and consequent sounding of the alarm. The alarm can
be turned off by switch S2.
Arrange the laser diode and the LDR such that when the circuit is ‘on’ and the door is
closed, light from the laser diode falls on the LDR to keep the alarm off. In order to make
sure that ambient light is not incident on the LDR, make the ar- rangement as shown in
Fig. 2.
EFY note. While testing at EFY Lab, a laser torch in place of the transmitter was used.
led-BAsed messAge dIsplAy
S.C. DwiveDi
T
his LED-based message display is built around readily availble, lowcost components. It
is easy to fab- ricate and makes use of 3mm red LEDs. A total of 172 LEDs have been
arranged to display the message “HAppY NEW YEAR 2004.”
in Fig. 1. The anodes of LED1 through LED11 are connected to point A and the cathodes
of these LEDs are connected to point B. Similarly, letter ‘A’ is built using LED12
through LED21. All the anodes of LED12 through LED21 are connected to point A,
while the cathodes of these LEDs are connected to resistor R8 (not shown in the circuit
diagram). Other letters/words can also be easily arranged to make the required sentence.
The power supply for the message display circuit (Fig. 2) comprises a 0-9V, 2A step-
down transformer (X1), bridge rectifier comprising diodes D1 through D4, and a filter
capacitor (C1). IC 7806 (IC1) provides regulated 6V DC to the display circuit
comprising timer 555 (IC2) and decade counter CD4017 (IC3). The astable
multivibrator built around IC2 produces 1Hz clock at its output pin 3. This output is
connected to clock pin (pin 14) of the decade counter.
The decade counter can count up to 10. The output of IC3 advances by one count every
second (depending on the time period of astable multivibrator IC2).
When Q1 output of IC3 goes high, transistor T1 conducts and the current flows through
LED1 through LED48 via resistors R7 through R11. Now the word ‘HAppY’ built
around LED1 through LED48 is displayed on the LED arrange- ment board.
Next, when Q2 output of IC3 goes high, transistor T2 conducts and the cur- rent flows
through LED49 through LED87 via resistors R12 through R14. Now the word ‘NEW’ is
displayed on the LED ar- rangement board.
Again, when Q3 output goes high, transistor T3 conducts and the current flows through
LED88 through LED128 via resistors R15 through R18. Now the word ‘YEAR’ is
displayed on the LED ar- rangement board.
Similarly, when Q4 output goes high, transistor T4 conducts and the current flows
through LED129 through LED172 via resistors R19 through R22. Now digits ‘2004’ are
displayed on the LED arrange- ment board.
During the entire period when Q5, Q6, Q7, or Q8 output go high, transistor T5 conducts
and the cur- rent flows through all the LEDs via diodes D9 through D12 and resistors R7
through R22. Now the complete message “HAppY NEW YEAR 2004” is displayed on
the LED arrangement for four seconds.
Thus, the display board displays ‘HAppY,’ ‘NEW,’ YEAR’ and ‘2004’ one after
another for one second each. After that, the message “HAppY NEW YEAR 2004” is
displayed for 4 seconds (because Q5 through Q8 are connected to resistor R6 via diodes
D5 through D8).
At the next clock input output Q9 goes high, and IC3 is reset and the display is turned off
for one second. Thereafter the cycle repeats.
dC-to-dC Converter
PrinCe PhilliPS
H
ere’s a low-cost circuit to convert 6V DC into 12V DC. It uses no transformer and is
easy to con-
The circuit is built around IC 555, which generates the required frequency of around 2 to
10 kHz to drive power transistor BD139 (T2). The output fre- quency of the IC can be
adjusted by a 47k potmeter (VR1) and given to the base of transistor T2 via resistor R3.
Transistor T2 is mounted on an aluminium heat-sink. Inductor L1 and capacitor C5
(2200µF, 35V) are energy storage components. The 12V zener di- ode regulates the
voltage across the output of the circuit.
The inductor comprises 100 turns of 24SWG enamelled copper wire wound on a 40mm
dia. toroidal ferrite core. The more the turns on the core, the higher the current delivering
capability of the circuit to the load at the output.
The output current is controlled by transistor BC549 (T1) with the help of resistors R4
and R5. The output volt- age is controlled by the zener diode and smoothed by capacitor
C5.
You can obtain regulated 12V DC, 120 mA across the output of this circuit. At higher
loads (below 100 ohms), the circuit might not perform well and deliver as much current.
Use a large capacitor (C5) and inductor for higher voltages and higher currents,
respectively. Different output voltages can be obtained by using zener diodes of other
ratings.
versAtIle proxImIty deteCtor wIth Auto
reset
KauShiK hazariKa
E
lectrochemical processes taking place in our body generate complex signals (hum) that
are continu- ously being passed along the nerve fibres hum.
throughout the body. Any physical activ- Here’s a circuit that operates when it ity such as
muscle movement increases detects hum generated by the human body
22 220 3 30
220 82 10 50
220 10 5 20
68 68 68
in proximity. Its versatility lies in the fact that you don’t need to touch the metal plates
for detection. Just the presence of your hand/body within 1 cm of the sensing loop
triggers the circuit. The activation of the circuit is indicated by the glowing of an LED
and an audible beep. The circuit continues to glow and beep until the hand DC to the
circuit.
radio frequency oscillator is at the heart of all radio transmitters and receivers. It gener
Connect the Morse key (S1) across ca - pacitor C5 as shown in the figure. Attach a
telescopic antenna (capable of transmit- ting over a short distance) at the output terminal.
The coil and gang capacitor C2 form the tank circuit. The coil (L) has a total of 60 turns.
Winding details are given in Fig. 2. Tappings on the coil allow selec- tion of the
required band. The frequency can be varied using C2 (main tuning).
On reducing turns of the coil (us - ing selector switch S2), the oscillator’s frequency in
creases because frequency is in- versely propor- tional to induct- ance. Capacitor C1
couples the signal from the tank cir- cuit to the base of transistor T1 (2N2222).
Transistor T1 provides the re- quired positive feedback for oscillation and transistor T2
(BC547) func-
For stable oscillations, use a polysty - rene capacitor as C1. All other capaci- tors may
be ceramic disk type. Enclose the circuit in a metal box for better shielding.
progrAmmABle tImer for ApplIAnCes
miteSh P. PariKh
T
matically turns the appliance on/off after a preset time. The time period can be varied
from 8 seconds to 2 hours with the help of rotary switches S2 and S3. The circuit works
in two modes: off mode and cyclic mode. Slide switch S4 is used for mode selection.
In the off mode, the appliance turns on after a preset time (set by rotary switch S2),
remains on for another preset time (set by rotary switch S3) and then turns off. In the
cyclic mode, this process repeats again and again.
The circuit is built around three quad two-input NAND gate ICs CD4011 (IC1, IC3 and
IC5), two 14-bit binary ripple counters CD4020 (IC2 and IC4) and a relay driver
transistor (T1). It works off a 12V DC, 500mA power supply. You can also power the
circuit from mains by using a 12V DC, 500mA adaptor in place of the 12V DC power
supply.
Let’s assume that you want an ap - pliance to turn on after two minutes and keep it on for
another two minutes. For this set the rotary switches S2 and S3 to positions as shown in
the figure.
Initially, when power switch S1 is closed, a small charging current pulse through
capacitors C2 and C3 resets both the counters (IC2 and IC4) to make all their outputs
(Q4 through Q14) low. The high output at pin 10 of NAND gate N3 starts the first
oscillator comprising NAND gates N1 and N2, which provides clock pulses to IC2 at
the rate of one pulse per second. The glowing of red LED (LED1) indicates that this
oscillator is working well and timer is ‘on.’
Readers’ comments
1. What should be the values of VR1, R2 and C1 for making the timer for 12-hour and
24-hour operation in the circuit? Variable resistors are not available above the mega-
ohm value. If non-polar type C1 of a higher value is not available, what type of capaci-
tor can be used and how it should be connected?
2. Can this timer be used for 15A to 20A loads, and if any spark develops, is there any
method to eliminate spark?
The author, Mitesh P. Parikh, replies: 1.I am thankful to Mr Nair for showing interest
in my circuit. Here are the replies to his queries:
1. For 12-hour and 24-hour operation, the values of various components are VR1=528
kilo-ohms (using a 1-mega-ohm preset), R2=0 ohm (R2
unused) and C1=10µF,
16V electrolytic capaci-
tor with positive termi-
nal connected to pin 4
of N2 of the first os-
cillator and negative
terminal connect
ed to the junction of
resistors R1 and VR1 Modified circuit of programmable timer for appliances as shown in
the figure.
Similarly, this can be done for the sec-
ond oscillator also. Using these values,
at pins 2 (Q13) and 3 (Q14) of IC4 (IC
CD4020), we will get a delay of 12 hours
and 24 hours, respectively.
For elimination of sparking, you should use a good-quality relay. Else, you can use a
silicon-controlled rectifier (SCR) for switching heavy loads. In this case, there is no
spark, but an addition- al circuit is required between the timer and the SCR for triggering
and turning off the SCR at the correct time.
AntI-BAg-snAtChIng AlArm
D. mohan Kumar
H
ere is a simple alarm circuit to thwart snatching of your valuables while travelling. The
circuit
kept in your bag or suitcase sounds a loud alarm, simulating a police horn, if someone
attempts to snatch your bag or suitcase. This will draw the attention of other passengers
and the burglar can be caught red handed.
In the standby mode, the circuit is locked by a plug and socket arrangement (a mono plug
with shorted leads plugged into the mono-jack socket of the unit). When the burglar tries
to snatch the bag, the plug detaches from the unit’s socket to activate the alarm.
The output from pin 6 of IC1 is fed to trigger pin 2 of IC NE555 (IC2) via coupling
capacitor C1 (0.0047 µF). IC2 is configured as a monostable. Its trig- ger pin 2 is held
high by resistor R4 (10 kilo-ohms). Normally, the output of IC2 remains low and the
alarm is off. Resistor R6, along with capacitor C3 connected to reset pin 4 of IC2,
prevents any false triggering. Resistor R5 (10 mega-ohms), preset VR (10 mega-ohms)
and capacitor C2 (4.7 µF, 16V) are timing components. With these values, the output at
pin 3 of IC2 is about one minute, which can be increased by increasing either the value
of capacitor C2 or preset VR.
When there is an attempt at snatching, the plug connected to the circuit detaches. At that
moment, the voltage at the invert- ing input of IC1 exceeds the voltage at the non-
inverting input and subsequently its output goes low. This sends a low pulse to trigger
pin 2 of IC2 to make its output pin 3 high. Consequently, the alarm circuit built around IC
UM3561 (IC3) gets the supply voltage at its pin 5.
Resistor R7 (330 ohms) limits the current to IC3 and zener diode ZD1 limits the supply
voltage to IC3 to a safe level of 3.3 volts. Resistor R9 limits the current to the base of
T1.
The circuit can be easily constructed on a vero board or general-purpose pCB. Use a
small case for housing the circuit and 9V battery. The speaker should be small so as to
make the gadget handy. Connect a thin plastic wire to the plug and secure it in your hand
or tie up somewhere else so that when the bag is pulled, the plug detaches from the
socket easily.
off tImer wIth AlArm
PraDeeP G.
H
ere’s an inexpensive transistorised timer that automatically switches off TV and other
appli-
ances after the set time. It works off a 12V DC, 300mA power supply.
Using preset VR1, you can set the time period from a few minutes up to half an hour.
After connecting the power supply, momentarily press tactile switch S1. Transistors T1
and T2 conduct to energise relay RL1 and green LED (LED1) glows. The load/appliance
con- nected via N/O contact of relay RL1 is switched on.
At the same time, transistor T3 con - ducts and transistor T4 stops conducting. So the
buzzer doesn’t sound and also red LED (LED2) doesn’t glow.
When the ‘off’ time period is over, relay RL1 de-energises and the appliance connected
via N/O contact of the relay is glows to indicate that the set time period switched off.
The buzzer sounds and LED2 is over.
over-voltAge proteCtor
P.v. vinoD Kumar
T
his circuit protects your television as well as other electrical appliances from over-
voltage. It uses
operational amplifier µA741 (IC1) as a comparator. The unregulated power sup- ply is
connected to resistor R3 and preset VR1 through resistor R2. Zener diode ZD1 provides
reference voltage of 5.1V to the inverting input (pin 2) of IC1.
The non-inverting input (pin 3) of IC1 senses voltage fluctuation in the mains. preset
VR1 is adjusted such that for mains supply below 240V AC, the voltage at the non-
inverting terminal of IC1 is less than 5.1V. Hence the output
of IC1 is zero and transistor T1 is in non-conducting state. At the same time transistor T2
conducts to energise relay RL1 to connect the mains to the load.
When AC mains is beyond 240V, the voltage at pin 3 of IC1 goes above 5.1V. The high
output of IC1 drives transistor T1 and transistor T2 stops conducting to de-energise the
relay. Hence the appliance turns off.
preset VR2 is used for proper biasing of transistor T1. The AC mains supply is stepped
down by transformer X1 to deliver a sec- ondary output of 7.5V-0-7.5V AC, 1A. The
output of the transformer is rectified by a full-wave rectifier comprising diodes D1
through D4. Capacitors C1 and C2 act as filters to eliminate ripples. Regu- lator IC 7812
is used to provide regulated 12V supply.
fuse-Cum-power fAIlure IndICAtor
v. GoPalaKriShnan
T
inverter circuit and two timer circuits built around IC NE555. LDR1 and preset VR1
form a voltage divider at the input of the cascaded amplifier comprising two BC548
transistors (T1 and T2). The base of tran- sistor T1 is connected to the junction of LDR1
and the preset through resistor R2. The base of transistor T2 is connected to the collector
of T1. The trigger pin of timer IC NE555 (IC2), which is configured as a monostable, is
connected to the collector of T2. The output of transistor T1 is inverted by transistor T2.
The inverted output of T2 triggers the monostable circuit.
LED1 gets power supply from the AC mains through transformer X1. The secondary
output of the transformer is rec- tified and fed to regulator IC 7806 (IC1). The 6V
regulated output drives LED1. As LDR1, enclosed in a cabinet, is kept illuminated by the
light from LED1, the output of transistor T2 is normally high.
The transformer has a fuse on the input side of primary winding. When power supply
goes off due to power cut or fuse blown off, no light falls on LDR1 and the output of
transistor T2 goes low. This high-to-low transition triggers the monostable (IC2) and its
output pin 3 goes high for about 7 seconds. The output of the monostable is connected to
reset pin 4 of IC3 (NE555), which is configured in astable mode. The output of the
astable circuit is connected to a loudspeaker. IC3, along with the loudspeaker, forms an
alarm circuit. Triggering of the monosta- ble activates the alarm circuit, indicating the
power failure.
LDR1, cascaded amplifier, monostable and astable circuits get power supply from a 6V
battery.
led-BAsed reAdIng lAmp
Pranab Kumar roy
T
his lamp circuit using ultra-bright white LEDs provides sufficient light for reading
purposes while
consuming approximately 3 watts of power. In the case of AC mains failure, the battery
backup circuit instantly lights up the LEDs. When the power resumes, the battery supply
is automatically discon- nected and the lamp circuit again works off AC mains.
The power supply circuit consists of 0-7.5V, 500mA step-down transformer X1,
rectifier diodes D1 through D4 and filter capacitor C1. Regulator IC 7805 (IC1) pro-
vides regulated 5V to LEDs, so there is no variation in the intensity of the lamp light
even if the mains power supply fluctuates. A total of ten white LEDs (LED1 through
LED10) are connected in parrallel across the 5V power supply. Resistors R1 through
R10 (each 56 ohms) are connected in series with the white LEDs to limit the current. To
increase the intensity of the lamp light, you can add more LEDs in the same man- ner; a
maximum of 15 LEDs can be used for the lamp.
When power switch S1 is closed, relay RL1 energises to disconnect the 6V, 4Ah battery
(connected across N/C contact of relay RL1) from input to regulator IC1 if battery switch
S2 is closed. When power switch S1 is open, relay RL1 de-energises and connects the
battery to the input of IC1 via N/C contacts of the relay.
Diodes D5 and D6 are reverse-current protection diodes that don’t allow the bat- tery
current to flow towards the power supply section. Diode D7 is for reverse polarity
protection of the battery. Before connecting the battery, make sure that it is fully charged.
The circuit can be assembled on a general-purpose pCB. Arrange all white LEDs (LED1
through LED10) on the pCB. Now remove the bulb holder from the lamp and fix the pCB
(where bulb holder was mounted) such that LED light falls on your book properly. No
separate reflectors are required for LEDs as the LEDs have inbuilt lens reflectors. Use a
heat-sink for IC1 as indicated in the figure.
Caution. Though you can read for hours without eye strain in this lamp light, don’t
directly look at white LEDs for long.
moBIle Cellphone ChArger
C
harging of the cellphone battery is a big problem while travelling as power supply
source is not
generally accessible. If you keep your cellphone switched on continuously, its battery
will go flat within five to six hours, making the cellphone useless. A fully charged
battery becomes necessary espe- cially when your distance from the nearest relay station
increases. Here’s a simple charger that replenishes the cellphone battery within two to
three hours.
Basically, the charger is a current-lim - circuit also monitors the voltage level of the
battery. It automatically cuts off the charging process when its output terminal voltage
increases above the predetermined voltage level.
Timer IC NE555 is used to charge and monitor the voltage level in the battery. Control
voltage pin 5 of IC1 is provided with a reference volt- age of 5.6V by zener increases
the voltage at pin 2 of IC1 above the trigger point threshold. This switches off the flip-
flop and the output goes low to terminate the charging proc- ess. Threshold pin 6 of IC1
is referenced
LED Status for Different Charging Conditions Load across the output Output
frequency (at pin 3) LED1
No battery connected
Charging battery
Fully charged battery
765 kHz On
ited voltage source. Generally, cellphone battery packs require 3.6-6V DC and 180-
200mA current for charging. These usually contain three NiCd cells, each having 1.2V
rating. Current of 100mA is sufficient for charging the cellphone battery at a slow rate. A
12V battery containing eight pen cells gives sufficient current (1.8A) to charge the
battery con- nected across the output terminals. The
Readers’ comments
The circuit is not working. I tried by changing the values of 3.3-kilo-ohm resistor R6 to
33 kilo-ohms and some other components but to no avail. In this regard, please clarify:
1. Whether the output of the circuit is to be connected to the mobile cell-phone charging
socket or directly to the battery after taking it out from the cell phone.
diode ZD1. Threshold pin 6 is supplied with a voltage set by VR1 and trigger pin 2 is
supplied with a voltage set by VR2.
When the discharged cellphone battery is connected to the circuit, the voltage given to
trigger pin 2 of IC1 is below 1/3Vcc and hence the flip-flop in the IC is switched on to
take output pin 3 high. When the battery is fully charged, the output terminal voltage
The author, D. Mohan Kumar, replies: I thank Mr Diwakar for showing interest in my
circuit. I have designed the circuit for use during long journeys. My prototype is
performing well and the circuit was also at 2/3Vcc set by VR1. Transistor T1 is used to
enhance the charging current. Value of R3 is critical in providing the required current for
charging. With the given value of 39-ohm the charging cur- rent is around 180 mA.
The circuit can be constructed on a small general-purpose pCB. For calibra- tion of cut-
off voltage level, use a variable DC power source. Connect the output ter- minals of the
circuit to the variable power supply set at 7V. Adjust VR1 in the middle position and
slowly adjust VR2 until LED1 goes off, indicating low output. LED1 should turn on
when the voltage of the variable power supply reduces below 5V. Enclose the circuit in
a small plastic case and use suitable connector for connecting to the cellphone battery.
Note. At EFY lab, the circuit was tested with a Motorola make cellphone battery rated at
3.6V, 320 mAH. In place of 5.6V zener, a 3.3V zener diode was used. The charging
current measured was about 200 mA.The status of LED1 is shown in the table.
However, while checking the circuit, Mr Diwakar may note that the perfor- mance of the
circuit depends on the voltage settings at pins 2 and 6 of IC 555 using VR2 and VR1.
Resistor R6 and VR2 form a potential divider to give a voltage below 1/3Vcc at pin 2 to
switch on the IC. Resistors R4 and R5 and VR1 provide a reference voltage of 2/3Vcc at
pin 6. The voltage at pins 2 and 6 is to be adjusted to around 3.8V and 7.5V,
respectively, after connecting a variable power supply to the output terminals.
The charging current is available from the emitter of T1 when the output of IC1 is high.
T1 gets bias from the output of IC1 through R3. If the output of IC is correct, change the
value of R3 to give proper bias to T1.
The circuit is designed to provide suf - ficient voltage and current to charge a cell phone
two or three times during the jour- ney. That is why a 12V power source with 1.6A
current is used in the circuit as power source. Check the outputs of IC1 and T1 and
measure the voltages at pins 2 and 6 after proper adjustments of VR1 and VR2. The
circuit will work if all the connections and components are correct.
one after another repeatedly for two dif - ferent services on the same workpiece. This is
cumbersome as they need to fully concentrate on delicate handwork on precious jewels.
Switching in such situations cannot be done by hand, and doing it by foot using ordinary
switches is too tedious. This is mainly because of the difficulty in sensing and
controlling the switch position by foot. Ordinary pushbutton switches make or break a
contact momentarily, and they cannot hold the keypress status. You need a bistable
multivibrator with two independent trigger inputs to solve this problem.
Here’s a smart foot switch based on dual negative-edge triggered mas- ter slave JK flip-
flop IC 74LS76 (IC1). J1 and J2 inputs are conneted to 5V through resistors R2 and R5
(each 10k), respectively. K1 and K2 inputs are grounded. preset pins 2 and 7 are short-
ed and connected to 5V via resistor R7 (10k). push-to-on switch S3 connected to the
preset inputs is also grounded. Clock and clear inputs of the two flip-flops are cross-
connected, i.e. CLK1 (pin 1) is conneted to CLR2 (pin 8) and CLR1 (pin 3) is connected
to CLK2 ( pin 6). Clock input pins 1 and 6 are pulled up high through resistors R1 and
R4 (each 4.7k), respectively.
push-to-on switches S1 and S2 are connected between clock and ground of the flip-flops.
Switch S1 activates device 1, while switch S2 activates device 2. Switch S3 activates
both device 1 and device 2 simultaneously. Device status is indicated by LED1 and
LED2. Glowing of LED1 and LED2 indicates that device 1 and device 2, respectively,
are in on condition. The LEDs are connected from +5V to Q1 (pin 14) and Q2 (pin 10)
of IC1 through resis- tors R3 and R6, respectively.
Initially when the power supply is switched on, Q1 and Q2 outputs of the JK flip-flops
are at low level (logic 0). When switch S1 is pressed for the first time, the high level
(logic 1) present at J1 input is transferred to Q1 output on the trailing edge of clock
(CLK1). The high level (logic 1) at Q1 activates relay RL1 through pin 16 of IC
ULN2003 (IC2), turning on device 1 via its normally-opened (N/O) contacts. Clock
CLK1 of flip-flop IC1(A) is also connected to clear input CLR2 of flip-flop IC1(B) so
as to clear it asynchro- nously. Switch debounces don’t affect the circuit as the same J1
state is being transferred to Q1 output on succeeding trailing edges. At the same time,
device 2 is switched off.
When switch S2 is pressed, flip-flop IC1(A) gets cleared via CLR1 and the high state of
J2 input of flip-flop IC1(B) is transferred to its Q2 output on the trailing edge of clock
(CLK2). This high level (logic1) activates relay RL2 through pin 15 of IC2, turning on
device 2 via its N/O contacts. At the same time, device 1 is switched off.
Now if you want to turn on both the devices simultaniously, press switch S3
momentarily. Switch S3 provides ground to preset inputs pRE1 and pRE2 of flipflops
IC1(A) and IC1(B), making their Q1 and Q2 outputs high, which energises both the
relays turning on the two devices. LEDs glow to indicate that both the de- vices are ‘on.’
place all the three switches (S1 through S3) where you can easily press them by foot
when required. The LEDs can also be mounted at a convenient location to know whether
the devices are turned on.
doorBell-Controlled
T
his add-on circuit automatically turns on your porchlight when your doorbell rings, so
you can
see the person ringing the doorbell at the doorstep. This also helps to guard against
burglars, who usually press the doorbell switch to confirm that there is no one at home.
By turning on the porchlight, the circuit will trick them into believing that someone is
inside the home.
You can easily connect the circuit to your doorbell. The light remains on for around 20
seconds and then turns
porChlIght
t.a. babu
off. This duration is enough for you to find your way in the dark to open the door.
However, duration can be varied by changing the RC components (R1 and C2).
When you momentarily press pushto-on DpST switch (S1), the AC mains is supplied to:
ere’s a simple AC mains voltage indicator that uses three LEDs to indicate low, normal
and high
levels of AC mains voltage. The 5mm red LEDs are connected between the collectors of
transistors T1, T2 and T3 and resistors R2, R4 and R6, respectively. presets VR1, VR2
and VR3 are used to adjust the base voltages of transistors T1, T2 and T3, respectively.
Initially, set presets VR1 through VR3 towards ground to provide a low-resist- ance path
across the base of transistors T1 through T3, respectively.
For setting the low voltage level, connect a manual AC voltage regulator (MVR) to the
primary of transformer X1 and switch on power supply to the circuit
byflippingswitchS1to‘on’position.Setthe ACvoltageofMVRtoabout175Vandslowly
adjust VR1 until LED1 starts illuminating.
When voltage across the base of transistor T1 reaches 9.7V (zener voltage 9.1V plus
base emitter voltage 0.6V) by adjusting presetVR1,transistorT1startsconducting. This
causes LED1 to light up. LED1 stops glowing abruptly when the base voltage drops
below the preset value. For setting the normal voltage level, set the AC voltage
ofMVRtoabout200VandadjustVR2slowly until LED2 starts illuminating.
For setting the high voltage level, set the AC voltage of MVR to about 230V and adjust
VR3 slowly until LED3 starts illu- minating. Now remove the MVR from the primary of
step-down transformer X1 and connect the AC mains voltge to the moni- tor. Now the
unit is ready for use.
If the mains voltage is above 230 volts, all the three LEDs continue to glow, indi- cating
that the voltage is above 230 volts (high). If the voltage drops below 230 volts, LED3
goes off but LED2 and LED1 con- tinue to glow, indicating that the voltage is above 200
volts but below 230 volts. If the voltage drops further below 200 volts, LED2 goes off
but LED1 continues to glow, indicating that the voltage is above 175 volts but below 200
volts.
If the voltage drops below 175 volts, LED1 also stops glowing. At this stage, all the
three LEDs are off, indicating that the voltage is below 175 volts.
To sum up, first, a high voltage (more than 230V) is indicated by glowing of all the three
LEDs (LED1, LED2 and LED3). Second, normal voltage (200V-230V) is in- dicated by
glowing of two LEDs (LED1 and LED2). Third, a low voltage (175V-200V) is indicated
by the glowing of LED1 only. The circuit draws a total current of about 40 mA when all
the LEDs glow. Mount all the LEDs on the front panel of the enclosure vertically in
ascending order with a spac- ing of 4 cm between them as shown in Fig. 2. Fix the unit at
a convenient place in the house to monitor the mains voltage.
sound-operAted lIght
raj K. GorKhali
H
ere’s a circuit that turns on your roomlight on detecting the sound produced when
someone claps,
tries to open your door or even inserts a key in the doorlock. This helps to guard against
burglars as they assume that you are awake. The sensitivity control lets you adjust the
sensitivity of the circuit to detect the intended sound level. The circuit switches the light
alternately, i.e. if one sound pulse switches the light on, the next one switches it off. So
you don’t need to go to the switchboard to switch off the light.
The sound sensitivity is adjusted by preset VR1. A high value of reference volt- age at
pin 3 of IC1 means a subtle sound is needed to change its output at pin 6. A low value of
reference voltage at pin 3 of IC1 means a loud sound is needed to change its output at pin
6. Fix the reference voltage such that the output state of IC1 doesn’t change with
unwanted sounds.
In the absence of any sound, the inverting input voltgae is almost equal to the full DC
voltage (about 12V DC), which ensures that output pin 6 of the op-amp is initially low.
Since the JK flip-flop (IC2) has been wired as a toggle flip-flop and its output pin 15 is
initially low, transistor T1 is in cut-off mode and relay RL1 remains de-energised. The
AC power connected to the bulb via relay contact thus does not reach the bulb and it
remains ‘off.’
Now when you produce some sound near the condenser microphone, the cur- rent flows
through the microphone and the voltage across the microphone goes down from 12V DC
via the potential divider formed by resistor R1 and the microphone. If the sound is loud
enough to bring the voltage at the inverting input below the reference voltage at the non-
inverting input, output pin 6 of the op-amp (IC1) goes from low to high. This low-to-high
going pulse triggers the flip-flop (IC2) at clock pin 13 and its output pin 15 goes high.
Now the relay energises and the bulb glows via its N/O contacts.
producing anothor sound causes a low-to-high transition at output pin 6 of the op-amp
(IC1). This low-to-high going pulse triggers the flip flop at clock pin 13 and its output
pin 15 goes low. Now the relay de-energises and the bulb goes off via its N/C contacts.
This way, the bulb glows alternately if there are recurrent sound pulses.
Low-Cost ELECtroniC Quiz tabLE
Vinod C.M.
H
ere is a simple, low-cost quiz ta ble for four game participants. It de-termines the
contestant who
first presses the switch (S1 through S4) to answer a question and locks out the
The circuit works off 12V, 1.5A power supply. The current rating of the power supply
should be according to the load (wattage of bulbs). For higher-wattage bulbs, use power
supply of a higher cur- by preset VR1. For example, if preset VR1 is set for a resistance
of 4.7k, it will give a delay of approximately 4 seconds, meaning that buzzer PZ1 and
bulb BL1 will be ‘on’ for 4 seconds. It also indicates that partici-
remaining three entries. Simultaneously, the respective audio alarm sounds and the bulb
glows. The quiz table can be used for more number of contestants simply by add- ing
buzzers, bulbs, MOSFETs and diodes. Besides, it provides an option for varying the
time for which an individual buzzer and the corresponding bulb should be ‘on’ after a
particular competitor has pressed the pushbutton. These timings can be set by presets
VR1 through VR4 as required. rent rating.
If participant A presses switch S1, MOSFET T1 is triggered and the cor- responding
bulb BL1 (connected between drain of the MOSFET and 12V supply) glows and
simultaneously piezobuzzer PZ1 connected in parallel to bulb BL1 sounds for the preset
time. At the same time, capacitor C1 charges up to 12V, which then discharges through
preset VR1. The discharging time of capacitor C1 is decided pant A is the first to press
his switch. Even if any other participant, say, participant B, presses switch S2 after
participant A has already pressed switch S1, buzzer PZ2 and bulb BL2 will not function
since MOSFET T2 has no gate voltage to trigger because it is grounded through R2 and
D1.
The same principle applies for other contestants as well. Instead of bulbs, you can also
use a group of LEDs. Fig. 2 shows the set-up for electronic quiz table.
zEnEr DioDE tEstEr
P. Venkata RatnaM
T
his zener diode tester can be used to check zener diodes of 3.3V to 18V. The breakdown
voltage of the
unknown zener diode is indicated on the precalibrated dial of potmeter VR1. The tester
can also identify the polarity of zener diodes.
The power supply section comprising such that the voltage at its wiper arm (red
crocodile clip) exceeds the breakdown voltage of the zener diode, the zener diode
conducts and applies the bias voltage at the base of transistor T2, which causes red
LED1 to light up. When the voltage at the wiper arm (red clip) is less than the
breakdown voltage, the zener diode does
transformer X1, rectifier diode D1, filter capacitor C1, resistor R1, transistor T1 and
zener diodes ZD1 and ZD2 provides approximately 20V DC stabilised voltage to the
sensor section. The sensor circuit comprises resistors R2 and R3, potmeter VR1, red
LED1 and transistor T2.
When linear potmeter VR1 is adjusted not conduct and red LED1 does not glow.
For calibration of the zener diode tester, initially set the pointer knob of potmeter VR1
towards zero-resistance position. Short red clip of the potmeter and black clip of the
transistor and switch on the tester. Rotate the pointer knob of potmeter VR1 slowly in
clockwise direc- tion until LED1 just starts to glow. Mark this setting of the knob on the
paper dial as 0V.
Now connect a known zener diode of 3.3V between both the clips (red clip to the
cathode and black clip to the anode of the zener diode) as shown in the figure. Rotate the
knob of potmeter VR1 further in clockwise direction until LED1 just starts to glow. Mark
this setting of the knob on the paper dial as 3.3V. Likewise, calibrate the dial of potmeter
VR1 for other values of zener diodes by connecting known zener diodes to the tester.
Now the tester is ready for use.
For testing an unknown zener diode, connect it across the clips in correct polarity and
rotate the knob of potmeter VR1 until red LED1 just starts to glow. The voltage shown
by the pointer knob on the dial at this setting is the breakdown voltage value of the zener
diode under test.
If the zener diode is connected in reverse polarity (red clip to the an- ode and black clip
to the cathode), the LED glows brightly at all settings of the knob above the zero reading,
indicating that the zener diode is wrongly connected. The anode and cathode terminals of
rectifier diodes can also be identi- fied in this way. Do not touch the clips while testing.
HigHway aLErt signaL Lamp
d. Mohan kuMaR
H
battery power.
tional safety during night, or when you need to stop your vehicle on side of the highway.
The circuit saves considerable
Fig. 3: Suggested
arrangement of LEDs
kept high by resistor R1.
The circuit is built around two timer ICs NE555 (IC1 and IC2). IC1 is designed as a
standard monostable, while IC2 is designed as an astable. Darlington pho- totransistor
L14F1 (T1) is used as a pho- tosensor to activate the monostable. The collector of
phototransistor T1 is connected to trigger pin 2 of IC1, which is normally pulse to IC1,
and the output of IC1 goes high for a period determined by resistor R2 and capacitor C1.
The output of IC1 is fed to the base of transistor T2 via resis- tor R3. Transistor T2
conducts to drive transistor T3 and its collector goes high to take reset pin 4 of IC2 to
high level. This activates astable IC2, which switches on and off the LED chain
alternately. The intermittent flashing of LEDs gives a beautiful tricolour flashlight effect.
The circuit can be easily constructed on a small piece of general-purpose PCB. Fig. 2
shows the bottom and front views of Darlington phototransistor L14F1. The proposed
arrangement of LEDs, which are soldered in a circular fashion on a general-purpose
PCB, is shown in Fig. 3. Use a circular reflector for the LEDs to get brighter light. Fix
the LED arrangement on the rear side of your vehicle, and the phototransistor where it is
illuminated directly by the headlight of the approach- ing vehicle. 12V DC supply to the
circuit, can be provided by your vehicle battery with proper polarity.
VariabLE powEr suppLy witH DigitaL
ControL
Manesh t. Mathew
T
he most frequently used device in electronic workshops and labora tories is a universal
power supply
Readers’ comments
I am very happy about your suggestion of the use of regulator LM317. However, there is
no provision of applying different input voltages to get different output
voltages.Theinputvoltagesupplyfrommains transformer after rectification is directly
connected to pin 3 of regulator LM317. I tried with an output load of 10.5V, 350 mA for
12V input (fixed) to regulator LM317 and the regulator was heated normally.
Pleasetellmeasimplewaytoapplydiffer- ent input voltages to get different output voltages
at approx. 1A load.
Ankana Mukherjee Through email The author, Manesh Mathew, replies: LM317 is
used as a variable voltage regu- lator to achieve different output voltages at pin 2
according to different voltages applied at pin 1. This is done through a digital control, as
explained in the circuit. At pin 3, apply an input voltage that is approx. 3V above the
maximum output voltage one requires, i.e., to get a regulated voltage of 12V at 1A, one
has to apply a minimum input voltage of 15V, 1A. (Refer to the specifications of the IC
for the maximum input that can be ap- plied to get the regulated output.) This is done to
compensate for the voltage drop in the regulator and input voltage variations. In this
circuit, the input voltage of the regulator is kept constant at 15V for getting 12V and
below, as per one’s requirements.
simpLE sECurity systEm
PRaVeen kuMaR M.P.
H
ere’s a simple home security system that sounds an alarm whenever somebody enters
your house
through the gate. The circuit consists of transmitter, receiver and alarm sections. The
transmitter and receiver sections are fitted on the compound wall pillars to which the
gate is attached, while the alarm circuit is mounted inside the house. The transmitter
continuously transmits IR rays, which are incident on the receiver. When anyone passes
through this continuous flow of IR beam, this is sensed and the alarm sounds, indicating
that somebody has opened the front gate and entered the compound. The alarm will be
‘on’ until the reset pushbutton is pressed.
The transmitter is built around timer NE555 (IC1), which is wired as an astable
multivibrator to oscillate at a frequency of 38 kHz. The output of IC1 is connected (via
resistor R3) to the base
Readers’ comments
CircuitisnotworkingeventhoughIhaveused the same components as given in the article.
What may be the problem in my circuit? Does it require any change or correction?
This may be due to the misalignment of transmitter and receiver sections. In order to
eliminate this problem, the following steps may be taken:
1. Construct the transmitter as given in the article and a portion of the receiver as shown
in the figure here. Use a shielded cable for connecting the IR eye (IR RX1) and a
regulated 5V supply for the receiver section.
2. IR RX1 (TSOP1738) works in the IR region of light, i.e., at about 38 kHz. The output
of the transmitter is tuned to this frequency by adjusting preset VR1.
3. Place IR RX1 near IR LEDs such that they face each other and are in line of sight.
This will allow the IR rays emitted by IR LEDs to fall on IR RX1. Adjust pre- set VR1
slowly, using a screwdriver, until LED3 glows. Now the transmitter and the receiver are
aligned correctly. When RX1 is taken away from IR LEDs, LED3 must stop glowing.
4. Now construct the remaining por - tion of the receiver circuit as given in the article.
of transistor T1. Transistor T1 drives both IR LEDs (LED1 and LED2). VR1 is used for
adjusting the transmitting frequency.
The IR beams transmitted by LED1 and LED2 are incident on infrared receiver module
RX1 of the receiver section, which produces a low output if the IR beam is interrupted
by someone. Transistor T2 becomes forward biased and the output of IC2 goes low. The
low output of IC2 is fed to the clock input of the JK flip-flop (IC3). The JK flip-flop acts
as a latch. Its high output drives piezobuzzer PZ1 via transistor T3 and the buzzer sounds.
To stop the alarm, you have to press reset switch S2.
Mount the transmitter and receiver units on the pillars of the gate. Ensure that ambient
light does not reach the units to cause false alarm.
sing this circuit you can check con-tinuity of low-resistance paths such as PCB tracks,
small
The tester is built around optocoupler MCT2E (IC1) and timer IC 555 (IC2) that is
wired in free running mode. Optocoupler MCT2E is used here as a continuity sen- sor.
Testing probes A and B are connected to pins 1 and 2 of optocoupler IC1. The
phototransistor inside the optocoupler is connected to transistor BC547 (T1) to form a
Darlington pair, which improves the performance of the circuit.
When the probes are not shorted, the LED inside the optocoupler glows and the
Darlington pair conducts to keep reset pin 4 of IC 555 at ground level and thus no
sound is produced.
When probes are shorted via a low resistance, the LED stops glowing and the Darlington
pair doesn’t conduct. As a result, reset pin 4 of IC2 goes high to ac- tivate the
loudspeaker, which generates a sharp audio tone. To minimise the current through IC1
when probes are not shorted, adjust VR1 until the circuit just stops sounding. The output
tone and loudness can be varied by adjusting presets VR2 and VR3, respectively.
CHiLD’s Lamp
d. Mohan kuMaR
H
ere is a mini emergency lamp that you can use as a tabletop lamp in your child’s study
room.
It is battery-operated and gives sufficient light for the child to move out of the room
when power fails. The white LED in the circuit automatically turns on when light in the
room goes off following a power cut. The LED gives a flashing light instead of glowing
continuously to reduce power consumption.
The circuit comprises a light sensor and an LED flasher designed around CMOS IC
CD4093 (IC1). The light sensor switch comprises a light-dependent resistor (LDR) and
npn transistors T1 and T2. When ambient light is present, the low resistance of LDR1
drives transistor T1 into conduction. This keeps transistor T2 cut-off due to low base
bias. The flasher circuit does not get power as long as ambient light falls on LDR1.
When the resistance of LDR1 becomes high in dark- ness, transistor T1 stops conducting
and transistor T2 starts conducting to turn on the LED lamp.
IC1 is designed as a
simple oscillator using
its gate 1 (comprising
input pins 1 and 2 and
output pin 3). The oscil-
lator’s external compo-
nents comprise resistor
R2 and capacitor C1.
Diode D1 and resistor R4
help in rapid charging
of capacitor C1. When
capacitor C1 charge to
around 50% of Vcc, out-
put of gate 1 of IC1 goes
low to discharge capaci
tor C1. The output from
pin 3 of IC1 again goes
high to charge capacitor
C1 again. This cycle repeats and sets up
an oscillation, which is given to gate 2
(comprising input pins 5 and 6 and output
pin 4) of IC1. Gate 2 serves as a buffer to
drive the white LED (LED1).
small veroboard. Use a reflective holder for LED1, which should be directed down-
wards at an angle of 45 degrees to prevent direct viewing of LED1 which gives a
highintensity light that is harmful for eyes. Preset VR1 can be adjusted to control the
sensitivity of LDR1. You can enclose the circuit in a plastic doll with LED1 as its
headlamp to make it an attractive gadget for your child. Mount LDR1 such that ambient
light falls on it directly.
CLap-opEratED ELECtroniC switCH
diPanjan BhattaChaRjee
H
ere’s a simple clap-operated electronic switch. Using this switch, you can turn on any
appliance
by clapping five times and turn it off by a single clap. The switch activates the appliance
only if you apply the right clap code (five claps here) within the preset time (10
seconds). If you apply a wrong clap code (other than five claps) or you are unable to
apply five claps within 10 seconds, the switch does not activate the On/Off Status of
the Appliance for Every Clap
appliance.
Claps RL1 RL2 LED2 Appliance status
The circuit works off
a 9V DC power supply. 1 En De Off Off The condenser microphone 2 En De Off Off converts
the clap sound 3 En De Off Off into an electrical signal. 4 En De Off Off This electrical signal
is 5 En De Off Off amplified by transistor 6 Off Off On Off after 10 seconds BC549 (T1). The
ampli- Note: En = energised; RL1 = Relay 1; De = de-energised; RL2= Relay 2
fied output is given to trigger pin 2 of monostable IC1, which produces a clock pulse at
its output pin 3. The output of IC1 is fed to clock pin 14 of decade counter IC2.
Initially, when the power is switched on, the Q0 output of IC2 is high and glow- ing of
LED2 indicates that the switch is ready for use. All others outputs of IC2 (Q1 through
Q9) are low. The Q5 output is used for activating the appliance via relay RL2.
At each clock (generated with each clap), the output of IC2 gets incre- mented. The Q1
output of IC2 is used to trigger the monostable (IC3). The output of IC3 is used to drive
relay RL1. IC3 acts as a monostable multivibrator with a time period of approximately
10 sec- onds, which provides delay time to turn on an appliance even after completing
the five claps before the preset time of 10 seconds. Contacts of relay RL1 separate the
other output pins of IC2 (except Q5) from reset pin 15 for the preset time of 10 seconds.
When all the five claps are applied within 10 seconds, the Q5 output of IC2 goes high
and relay RL2 energises to turn on the appliance just after the de-ener- gisation of relay
RL1. The table shows the on/off condition of the appliance for every clap.
When you apply a wrong clap code, the high output of IC2 resets it via its pin 15 and the
appliance doesn’t turn on.
LigHt-ControLLED DigitaL Fan
rEguLator
I
t is very difficult to trace the switchboard in a dark room at night. Here is a torchlight-
operated switch that allows you to control the fan speed remotely from your bed. The fan
speed can be var- ied by the number of times you focus the torch light on the light-
dependent resistor of the circuit—same way as you control
V. GoPalakRishnan
Fan Control With Torch Light Focused on the LDR
Fan speed
Off
1 (min) Off
2
Off
3
Off
4
Fig. 1 shows the circuit of lightcontrolled digital fan regulator. It comprises timer NE555
(IC1), decade counter 7490 (IC2), BCD-to-7-seg- ment decoder/driver 7447 (IC3),
com- mon-anode 7-segment display (DIS1),
BCD-to-decimal decoder 7442 (IC4) and a hex inverter (IC5). The fan regulator is
triggered when torchlight falls on light-dependent resistor LDR1 and its resistance goes
low.
The monostable (IC1) is wired such that its time period is adjusted to 1.3 seconds. The
monos- table clocks are counted
Fig. 2: Relay contacts of fan regulator resistors with decade counter IC2. The Q0
through Q3 outputs of decade counter IC2 are
given to IC3 and IC4. segment display, while the outputs of IC4 segment display, while
the outputs of IC4 segment display (DIS1) shows the number of times you focus the
torchlight on LDR1. If it is an even number, the fan will be off. With the increase in odd
numbers, the speed of fan increases.
The odd-numbered outputs of decoder IC4 (Q1, Q3 Q5, Q7 and Q9) go to the cor-
responding relay driver circuits via hex inverter IC5. The normally-opened (N/O)
contacts of relays RL1 through RL5 are connected to regulating resistors as shown in
Fig. 2.
The even-numbered outputs of decoder IC4 (Q0, Q2 Q4, Q6 and Q8) are not used. At
these outputs, the fan turns off. Pushto-on switches S1 and S2 are used for initial
resetting of monostable IC1 and decade counter IC2, respectively. For the circuit to
work even in the presence of ambient light, for example, during daytime, LDR1 is made
dark by covering it with an inked paper.
The digital fan regulator circuit (ex - cept relay driver circuits) works off 5V DC, while
the relay driver circuits work off 6V DC.
sEnsitiVE optiCaL burgLar aLarm
PRadeeP G.
T
his optical burglar alarm uses two 555 timer ICs. Both the ICs are wired as astable
multivibrators. The
first astable multivibrator built around IC1 produces low frequencies, while the second
astable multivibrator built around IC2 produces audio frequencies.
ere is a circuit that can be used in offices, stores, warehouses, etc dur-ing night to check
whether
Up to nine separate alert rings are considered here. The count displayed is the number of
times the watchman
XLHH
HH
X Reset
X Preset
H No change H Count up
Count down
failed to register his presence. The mobile phone records the called number and call
time, and it can be used with the displayed count to get the timing details.
The telephone lines (TIP and RING) in the circuit are connected across optocoupler
MCT2E (IC1) through a resis- tor-capacitor (R1-C1) combination. The diode in the
optocoupler conducts only during ring pulses. The collector of the optocoupler transistor
is normally off and a 5V signal is available here. This signal is connected to the trigger
input of IC 555 (IC2) configured in monostable mode. The time constant of IC2 is set to
nearly one minute (1.1RxC). Its output pin 3 is low during normal mode of optriggered
on this trailing edge to energise relay RL1. This relay is used to switch on alert lamp L1.
The circuit doesn’t respond to additional trigger inputs for the set duration of the
monostable. The caller may cut the phone call after hearing ringback tone from the called
phone.
The sensor circuit formed using LDR1 activates another monostable 555 (IC6). LDR1
has a resistance of 2.2 kiloohms in daylight, which drops below 50 ohms when torchlight
beam falls on it. (An LDR of nearly 2cm diameter has been used in this circuit.)
Comparator LM358 (IC5) compares the level set at pin 3 (nearly 1V, set using a 10k pot)
with the level at pin 2.
XXH
voltage is above 1V and IC5 has a low output at its pin 1. When light is falling on LDR1,
its voltage drops below 1V and IC5 output at its pin 1 becomes high. This low-to-high
transition is NANDed with the output of monostable IC2 (via invert- ers gates N1 and
N2) to form the trigger signal for monostable IC6. So the trigger input is normally high,
which falls when torchlight beam is focused on LDR1. It returns to high state when
torchlight is switched off. So the torch is used as a remote for triggering monostable IC6
and this triggering is enabled only when alert lamp L1 is ‘on.’
Monostable IC6 has a time constant of nearly one minute (1.1RxC). It is used to form a
down clock signal for 4-bit up/down-counter 74LS192 (IC7). Counter IC7 has two
separate clocks for up and down counts (refer to the table). For cor- rect counting, it
needs one clock line to be high during high-to-low transition of the other clock line.
Otherwise, it counts erratically.
To operate counter IC7, the voltage levels and timings of the two clock inputs (up and
down) are to be properly adjusted. Both trigger inputs, i.e. up and down clocks, are
asynchronous.
Counter 74LS192 (IC7) is reset to zero state by making its reset pin 14 high through reset
switch S1. The 7-segment, common-anode display DIS1 is driven through IC 74LS47
(IC8). When the phone rings, count ‘1’ is displayed after nearly one minute. This
happens if the watchman fails to focus the torchlight beam on LDR1.
If LDR1 receives light from the torch of the watchman within the allowed time period,
the down clock remains high until the up clock is high. The counter counts up and then
down, so, in effect, the count remains unchanged.
All components, except LDR1, are kept in a sealed cabinet with locking arrangement.
Only LDR1 is wall-mounted and vis- ible outside. This is done to avoid manual resetting
of the counter. The circuit is to be powered by a battery to avoid resetting of the count
during power failure.
1. Initially, when the power supply is switched on, power-on-reset components C8 and
R13 reset counter IC7 and the display shows ‘0.’
2. Now dial the telephone number (where parallel system is installed) from outside or
from your mobile. For the first ring, relay RL1 energises and alert lamp L1 glows.
his cell-phone-controlled audio/ video mute switch is highly use ful in automobiles. The
circuit automatically disconnects power supply to the audio/video system whenever the
mobile handset is lifted off the holder for making or receiving a call. You can use any
read- ily available cell-phone holder with some minor alterations or fabricate it yourself
as shown in Fig. 1.
Fig. 1: Proposed cell-phone holder Fig. 2: The circuit of the cell phone-controlled
audio/video mute switch
care while handling it. The audio/video sys - tem is connected to the circuit via normally
opened (N/O) contacts of the relay.
When the cell phone is in its holder, LDR1 does not receive any light from white LED1
and its resistance is high. As a result, the voltage at pin 2 of IC1 remains high to provide
a low output at pin 3. The low output of IC1 activates relay RL1 and the
audio/videosystemgetspowersupplyviaits N/O contacts. LED3 glows to indicate that the
audio/video system is ‘on.’
When the handset is taken off the holder, light rays from LED1 fall on LDR1 and its
resistance decreases. As a result, the voltage at pin 2 of IC1 de- creases to provide a
high output at its pin 3. The high output of IC1 deactivates relay RL1 and the audio/video
system does not get power supply. LED2 glows to indicate that the audio/video system is
‘off.’
ere’s a simple panel frequency meter to measure the frequency of 230V AC mains. When
you connect it to the 230V AC line, the display shows the line frequen- cy. Generally, the
line frequency is 50 Hz, which may vary from 48 Hz to 52 Hz. Beyond this frequency
range, sensitive equipment may start malfunc- tioning.
1Hz clock. The output of gate N1 is fed back to its inputs via potentiometer VR1 and
resistor R4. Capacitor C2 connected between the inputs of gate N1 and ground
charges/discharges depending on the logic level at the output of gate N1. The values of
VR1, R4 and C2 are selected to produce accurate 10Hz clock.
Decade counter IC CD4017 (IC4) divides the output of IC3 by 10 to provide one pulse
per second. LED1 connected to pin 12 of IC4 gives one flash per second to indicate that
the oscillator and the counter are working properly.
This 1Hz clock is fed to clock pin 14 of decade counter IC CD4017 (IC5), whose Q0
output is given to pin 2 and the square wave produced by IC2 is given to pin 1 of AND
gate N1. Therefore, the unknown frequency of AC mains line, applied to pin 1 of AND
gate N1, passes through it for only one second and the number of clocks per second are
counted by IC7 and IC8.
Decade counters/7-segment decod - ers IC7 and IC8 are cascaded to drive common-
cathode, 7-segment displays DIS1 and DIS2 (each LTS543). DIS1 shows units place of
the frequency and DIS2 shows tens place. The top and bottom views of LTS543
commoncathode, 7-segment displays are shown in Fig. 2.
This is an auto-reset circuit. You can select the reset time of 1 second through 5 seconds
using rotary switch S2, which is connected to reset pins of IC5, IC7 and IC8. For long-
time display of the frequency, keep the knob of rotary switch S2 towards fifth position.
Keeping ro- tary switch S2 to first position (minimum reset time) allows you to instantly
see any variation in the supply frequency on the display. Also, while adjusting the
generator frequency to mains frequency, keep rotary switch S2 towards first position.
ranDom FLasHing X-mas stars
d. Mohan kuMaR
T
his novel colour display adds glit ter to your Christmas and New Year celebrations.
Unlike the usual
running or flickering pattern, the lamps flash randomly to give a more attractive lighting
effect. The display is fully auto- matic: the bulbs remain switched off dur- ing day and
turn on like twinkling stars in the evening.
in the evening.
stage, ripple-carry binary counter IC CD4060B. This IC has an internal oscil- lator and
14 bistable stages that are cascaded in series fashion. When the first bistable gets the
clock signal from the oscillator, it turns on to drive the second bistable, which, in turn,
drives the third bistable and so on. Each bistable divides the input signal by two. Out of
a total of 14 possible outputs only ten outputs have been brought out on the external pins.
This circuit uses only six outputs. Values of resistor R4, VR2 and capacitor C4 de-
termine the basic frequency of the built-in oscillator. By adjusting VR2, the flashing rate
of the lamp can be changed.
Five outputs of IC1 are connected to the gates of triacs TR1 through TR5 (BT136) via
current-limiting resistors R5 through R9, respectively. When the outputs of IC1 go high,
the triacs get gate current to switch on the lamps (230V, 60W). The lamps turn on/off in a
random fashion, giving a display pattern that is more attractive than the monotonous
pattern of chaser lamps.
The use of a light-dependent resistor (LDR) automates the working of the cir- cuit, so the
user doesn’t have to manually switch on/off the lamps daily. LDR1 and npn transistors
T1 and T2 (each BC549) form the automatic switch. The resistance of LDR1 is low in
daylight and increases in darkness. So during daytime, LDR1 gives base current to
transistor T1, which conducts to pull the base of transistor T2 to low and hence
transistor T2 remains cut-off. As a result, the rest of the circuit remains inactivated.
During night, tran- sistor T1 turns off to drive transistor T2 and provide supply voltage
to IC1. Potme- ter VR1 is used to adjust the sensitivity of the LDR.
The circuit is powered directly from the AC mains via capacitor and bridge rectifier
module (BR1). Absence of trans- former for the power supply reduces the cost as well
as the size of the unit. Capacitor C1 drops the AC voltage to a safer level. The bridge
rectifier module rectifies the AC and capacitor C2 smoothes the resulting DC. Zener
diode ZD1 regulates the output voltage to 12V DC.
The circuit can be assembled on a small PCB or a breadboard. Mount the triacs with
sufficient space in between to avoid short circuit. You can add a musi- cal tone
generation circuit to this circuit so that it sings a musical song when the lamps flash. It
can be connected directly between output pin 15 of IC1 and ground, replacing the
piezobuzzer. Connect ground rail (negative) of the circuit to the neutral line. Enclose the
circuit in a shockproof plastic case.
Caution. Take extreme care while testing the circuit since most of its parts are at mains
potential and hence lethal.
pC-basED DC motor spEED
T
his circuit allows you to control the speed of a DC motor (in eight lev-els) from your
PC’s parallel
port. The PC uses a software program to control the speed of the motor.
The motor is connected to the PC through an interface circuit. The interface circuit
consists of 1-of-8 decoder IC 74LS138 (IC1), hex inverter ICs 74LS04 (IC2 and IC3),
resistor networks, timer
ControLLEr
R. kaRthiCk
IC 555 (IC4) and motor driver transistor SL100 (T1). The decoder IC accepts binary
weighted inputs A0, A1 and A2 at pins 1, 2 and 3, respectively. With active-low enable
input pins 4 and 5 of the decoder grounded, it provides eight mutually exclusive active-
low outputs (Q0 through Q7). These outputs are inverted by hex inverters IC2 and IC3.
The resistor network comprising presets VR1 through VR8, resistors R1 and R2 and
capacitor C1 are the timing components of timer IC 555 (IC4), which is configured in
astable mode. The output of IC4 is a square wave, which is fed to the base of transistor
T1 via current-limiting resistor R3. Transistor T1 is used to drive the motor.
The pulse-width modulation (PWM) method is used for efficient control of the
motor. The output of the PC is decoded to select a particular preset (VR1 through VR8).
The value of the selected preset, along with resistors R1 and R2 and capaci- tor C1,
changes the output pulse width at pin 3 of IC4. Thus the motor speed can be
increased/decreased by choosing a particu- lar resistance. For high-power motors, the
transistor can be replaced by an IGBT or a power MOSFET.
The software (speedM.c) is written in ‘C’ language and compiled using Turbo C
compiler.
Initially, when the motor is ‘off,’ the program prompts you to press ‘Enter’ key to start
the motor. Once you press the key, the motor starts running at full speed. After a few
seconds, the program asks you to press any key from the keyboard to go to the next
screen for controlling the speed of the motor. This screen has options for increasing and
decreasing the motor speed and also for exiting from the program. For increasing the
speed enter choice 1 and press ‘Enter’ key, and for decreasing the speed enter choice 2
and press ‘Enter’ key. This action changes the speed by one step at-a-time and the
message “Speed de- creased” or “Speed increased” is displayed on the screen. To go to
the main menu, again press ‘Enter’ key.
for(j=0;j<=25;j++)
{
gotoxy(x,j);
cprintf(" ");
}
for(i=0;i<8;i++)
a[i]=i;
gotoxy(23,11);
printf("Press Enter to start the motor"); getch();
gotoxy(28,13);
printf("WAIT STARTING MOTOR"); start();
gotoxy(25,15);
printf("Motor started sucessfully"); gotoxy(22,17);
printf("Press any key for speed control"); getch();
while(1)
{
clrscr();
gotoxy(25,3);
for(j=0;j<79;j++) {
gotoxy(j+1,2); printf("*");
}
} gotoxy(23,3);
printf("DC MOTOR SPEED CONTROL USING
speedm.c
PC");
for(j=0;j<79;j++)
{
gotoxy(j+1,4); printf("*");
}
{ gotoxy(23,13);
printf("MOTOR IS RUNNING IN LOW SPEED"); printf("\n");
printf("\t\t\t1.INCREASE SPEED\n\t\t\ t2.DECREASE SPEED\n\t\t\t3.EXIT") ;
for(j=0;j<79;j++)
{
gotoxy(j+1,8);
printf("*");
}
for(j=0;j<79;j++) {
gotoxy(j+1,10);
printf("*");
}
gotoxy(1,9);
printf("Enter your choice:");
scanf("%d",&c1);
switch(c1) {
case 3 : for(j=c;j>=0;j--) {
outportb(0X0378,j); delay(100);
}
outportb(P,0); case 1:if(c==7) {
FULL SPEED");
{
case 2: if(c==0) gotoxy(23,13);
printf("MOTOR IS RUNNING IN getch(); }
outport(P,a[c]);
gotoxy(33,13);
printf("SPEED INCREASED"); }
outport(P,a[c]);
gotoxy(33,13);
printf("SPEED DECREASED");
}
gotoxy(17,13);
textcolor(2);
cprintf("KARTHICK.R\nECE\ nK.L.N.COLLEGE OF ENGG\nMADURAI.");
}}
}
void start() {
outportb(0x0378,0); for(i=0;i<8;i++)
{
outportb(0X0378,i); delay(1000);
}
FrEQuEnCy DiViDEr using 7490
DECaDE CountEr
sRiniVas MaRyala
H
ere is a low-cost circuit for generating different square-wave sig nals. The circuit is
built around
a 10MHz crystal oscillator, hex inverter IC 7404 and seven decade counter ICs 7490.
to the internal ripple delays. Therefore the decoded output signals are subject to
decoding spikes and should not be used for clocks or strobes.
Since the output of the divide-by-two section is not internally connected to the
succeeding stages, IC 7490 can be operated in various counting modes.
In this circuit, ICs 7490 are config- ured as divide-by-10 counters. The power
output states of the counter on a highto-low clock transition. The output states do not
change simultaneously due supply to the circuit is regulated by IC 7805 (IC1). LED1
indicates power on/off to the circuit. A 10MHz clock pulse is generated by the crystal
and the associated circuit consisting of IC2 (7404). This clock pulse is fed to pin 1 of
IC3 (IC 7490), which divides it by 10 to give a 1MHz clock pulse at its output pin 12.
The 1MHz clock pulse is fed to the input of the next stage and so on up to IC9.
Thus at all the seven counter stages, we get unique output pulses (1 MHz, 100 kHz, 10
kHz, 1 kHz, 100Hz, 10Hz and 1 Hz, respectively). These output pulses are selected by
rotary switch S2 and fed to an output jack. The blinking/ flash rate of LED2 indicates the
output frequency. However, you can identify output frequencies of 1 Hz and 10 Hz only.
Above 10 Hz, the LED blinks so fast that it’s not possible to estimate the frequency.
reading light inside the car greatly assists passengers during night, but often the interior
dome lamp is
too bright and distracting to the driver. A linear regulator such as a rheostat can be used
to control the brightness of the dome lamp but it consumes a lot of power.
Here is a dome lamp dimmer that gives you a fairly linear control over the lamp
brightness from lowto highintensity while consuming little power. Since it is a
pulsewidth modulated chopper circuit, you can also use it to dim a halogen bulb or
control the speed of a mini drill, etc.
In the circuit, timer NE555 (IC1) is wired as an astable multivibrator to produce square
wave at its output pin 3. The output of timer IC1 charges/discharges capacitor C1 via
diodes D1 and D2. Adjust potmeter VR1 to control the RC time constant during the
charge-discharge cycle and get the timer output with the desired pulse width. Thus the
brightness of lamp B1 canbevariedfromlowtohighby adjusting potmeter VR1.
Most cars run only one wire to power the lamp and use the car body for the return
current path. Connect ground path of the circuittothecarbody.Useasuit- able heat-sink for
the MOSFET to handle the load current.
oFFsEt tuning inDiCator
B
efore the transceivers became popu-lar, the receiver and the transmitter were separate
entities.
Zero beating your continuous-wave (CW) transmitter to the called station was a simple
matter. When transceivers appeared, difficulties arose. So modifications followed: first,
a fixed CW offset of 600-800 Hz was provided. When a signal is tuned in, the local
transmitter frequency is near that of the station being received. Next, to make the setting
more accurate, a sidetone monitor producing a tone exactly equal to the count of offset
appeared in most transceivers. By matching the incoming signal to the sidetone,
transmitter frequency would be equal to the received signal frequency. However,
matching the two tones is difficult and time-consuming.
Here’s an easy-to-build offset tuning indicator for CW that provides a visual indication
when the signal and sidetone match. It is built around tone decoder IC LM567, which is
an 8-pin PLL IC. A lock
For Cw
d. PRaBakaRan
his code lock is useful for appli ances requiring exclusive or au thorised use by those
who know
The circuit doesn’t require additional AND or NOT gate operations at the outputs. It
uses two pairs of 4-way DIP switches. The code is set using DIP switches DIP3 and
DIP4. Then these two switches are hidden inside the assembly. With DIP3 and DIP4, up
to 256 code combinations are possible. The unlocking code is set by the user using DIP
switches DIP1 and DIP2, which is compared with the preset code entered earlier via
DIP3 and DIP4. If the two codes match, transistor T1 conducts.
The codes are compared using two cascaded 4-bit magnitude comparator ICs (IC1 and
IC2). If the input nibble present at DIP1 matches with preset DIP3 nibble, output pin 6 of
IC1 (connected to input pin 3 of IC2) goes high. Now if nibble present at DIP2 matches
with the preset nibble at DIP4, pin 6 of IC2 also goes high. This high output drives
transistor T1 and the appliance turns on via relay contacts.
After use, disturb the positions of DIP1 and DIP2 so that the appliance can’t be operated
by unauthorised persons. This will also switch the appliance off.
The circuit works off a 5V DC power supply. Hidden switch S0 can be used to manually
turn on/off the appliance if you have forgotten the preset code.
Caution. You may use this code lock at your own risk. After all, a clever intruder will try
all 256 possible combinations one after the other to break the secret code.
stabilised power supply with short-circuit
H
ere is an efficient 4-stage stabi lised power supply unit for test ing elec-tronic circuits. It
provides
well regulated and stabilised output, which is essential for most electronic circuits to
give proper results. The circuit provides an audio-visual indication if there is a short
circuit in the PCB under test, so the power supply to the circuit ‘under test’ can be cut-
off immediately to save the valuable components from damage.
The circuit provides four different regulated outputs (12V, 9V, 6V and 5V) and an
unregulated 18V output, which
indication
d. Mohan KuMar
are selectable through rotary switch S2. The selected output is indicated on the analogue
voltmeter connected to the outputs rails.
piezobuzzer.
A fuse-failure indicator distinguishes short circuit at the output and input failure. It
consists of a bicolour LED (LED1) and resistors R1 and R2. When power is available
and the fuse is intact, red and green halves of LED1 are effectively in parallel to output a
yellowish light. When fuse fails, green LED goes off and red LED lights up to indicate
fuse breakdown.
The circuit can be easily constructed on a general-purpose PCB. Use small heat-sinks for
all ICs to dissipate heat. The output voltage can be read on a voltmeter. Enclose the
circuit in a metal box with provisions for voltmeter, LEDs, rotary switch, etc.
light-operated internal
U
sing this light-operated circuit, you can close or open the door of your room remotely
from your bed.
You just have to focus the torchlight on the light-dependent resistor of the circuit, which
you can install inside your room at a suitable position.
door latch
V. GopalaKrishnan
The circuit comprises a control unit and a driver unit for the stepper motor circuit used
to latch/open the door.
The control unit comprises two timer 555 ICs (IC1 and IC2), NAND gate IC (IC3), 4-bit
bidirectional universal shift register (IC4), OR gate (IC5), NOR gate (IC6), hex inverter
(IC7) and dual D-type positive-edge triggered flip-flop (IC8) as shown in Fig. 1. The
driver circuit shown in Fig. 2 uses four Darlington pair transistors (T1 through T8) to
increase the current carrying capability for operating the stepper motor.
The astable multivibrator built around timer 555 (IC1) has a time period of 1.5 seconds.
The monostable built around IC2 is triggered when torchlight is focused on light-
dependent resistor LDR1. Sensitivity potentiometer VR1 is adjusted to ambient light.
Normally, the LDR is kept covered to avoid its activation by ambient light.
When torchlight is focused on the LDR, the monostable (IC2) is triggered. The ‘on’ time
of IC2 is adjusted to 15 seconds by potentiometer VR4. The outputs at pin 3 of astable
IC1 and monostable IC2 are fed to NAND gate N1 of IC3. The Q0 and Q1 outputs of
shift register IC4 are ORed by OR gate N2 and its output
10001
20010
30100
41000
IC4 forms the second input for NOR gate N3. The output of NOR gate N3 goes to shift-
right and shift-left serial data inputs (pins 2 and 7) of IC4.
Mode-control inputs S0 and S1 are used for direction changing of shift register IC4. The
Q1 output of dual D-type flipflop IC8 is fed to S0 directly and to S1 after inversion by
N4.
The output of monostable IC2 resets IC4 via resistor R4, which stops the stepper motor.
You can also manually stop the stepper motor by pushing switch S1 to ‘on’ position.
Switch S2 is used for resetting dual D-type flip-flop IC8. The monostable out- put also
provides clock to the D flip-flop operating in toggle mode by connecting Q1 to D1 of
IC8.
Fig. 2 shows the driver unit for the stepper motor, along with windings details of the
stepper motor. Connect Q0 through Q3 outputs of IC4 in the control unit (Fig. 1) to
positive and ground power supply terminals of the driver unit (Fig. 2). The waveform
drive pattern of shift outputs of IC4 is shown in the table.
When you direct torchlight on the LDR, the stepper motor runs in one direction to latch
the door. If you again focus torchlight on the LDR, the stepper motor runs in reverse
direction to open the latch.
T his simple circuit monitors the mains distribution box constantly and sounds an alarm
when it senses a high temperature due to overheating, helping to prevent disasters caused
by any sparking in the mains box due to short circuits. It also automatically switches on a
bright white LED when the power fails. The LED gives ample light to check the mains
box wiring or fuses in darkness. The circuit beeps once when power fails and again
when power resumes.
NE555 (IC1) is wired as an astable multivibrator. When the temperature around diode
D5 rises due to overheating of the fuse, the resistance of the diode decreases and
transistor T1 stops conducting. This enables IC1 and the oscillator starts to sound an
alarm. By adjusting preset VR1, you can set the temperature level at which the alarm
circuit is activated.
The emergency light circuit uses pnp transistor BC558 (T2) and a few passive
components. It is powered by a 9V rechargeable battery, which is constantly charged via
forward-biased diode D6 when mains power is present. Resistor R7 reduces the
charging current to a safer level. The forward biasing of diode D6 results in reverse
biasing of transistor T2 and thus the white LED (LED3) is off. When the power fails,
transistor T2 is forward biased and lights up the LED. When the power resumes,
transistor T2 stops conducting and the LED doesn’t glow.
The circuit can be easily constructed on any general-purpose PCB. Diode D5 should be
placed close to the fuse to sense the heat. It can be connected to the PCB using a short
piece of shielded wire. The white LED should be directed towards the fuse such that the
maximum light falls on the fuse.
To test the circuit, take the hot tip of the soldering iron near diode D5. The buzzer will
sound to indicate the high temperature.
digital stop watch
C.h. Vithalani
H
IC MM74C926 consists of a 4-digit counter, an internal output latch, npn output sourcing
drivers for commoncathode, 7-segment display and an internal multiplexing circuitry
with four multiplexing outputs. The multiplexing circuit has its own free running
oscillator, and requires no external clock. The counter advances on negative edge of the
clock. The clock is generated by timer IC LM555 (IC1) and applied to pin 12 of IC2.
A high signal on reset pin 13 of IC2 resets the counter to zero. Reset pin 13 is connected
to +5V through reset push-on-switch S3. When S2 is momentarily pressed, the count
value becomes 0, transistor T1 conducts and it resets IC1. Counting starts when S2 is in
‘off’ condition.
A low signal on the latch-enable input pin 5 (LE) of IC2 latches the number in the
counter into the internal output latches. When switch S2 is pressed, pin 5 goes low and
hence the count value gets stored in the latch. Display-select pin 6 (DS) decides whether
the number on the counter or the number stored in the latch is to be displayed. If pin 6 is
low the number in the output latch is displayed, and if pin 6 is high the number in the
counter is displayed.
When switch S2 is pressed, the base of pnp transistor T2 is connected to ground and it
starts conducting. The emitter of T2 is connected to DS pin of IC2. Thus, when switch S3
is pressed, reset pin 13 of IC2 is connected to ground via transistor T1 and the oscillator
does not generate clock pulses. This is done to achieve synchronisation between IC1 and
IC2.
First, reset the circuit so that the display shows ‘0000.’ Now open switch S2 for the stop
watch to start counting the time. If you want to stop the clock, close switch S2.
Rotary switch S1 is used to select the different time periods at the output of the astable
multivibrator (IC1). The circuit works off a 5V power supply. It can be easily assembled
on a general-purpose PCB. Enclose the circuit in a metal box with provisions for four 7-
segment displays, rotary switch S1, start/stop switch S2 and reset switch S3 in the front
panel of the box.
flashing-cuM-running light
a. siVasubraManian
T
his circuit generates flashing lights in running pattern. In conven tional running lights, the
LEDs
glow one by one. In this circuit, the LEDs flash a number of times one by one.
The circuit comprises two astable multivibrators (IC1 and IC3) and a decade counter
(IC2). Astable multivibrator IC1 produces approximately 0.72Hz clock frequencies,
which are given to decade counter IC2. The decade counter is designed to count Q0, Q1
and Q2 outputs, while its fourth output (Q3) is used to reset it. The Q0, Q1 and Q2
outputs of IC2 are fed to npn transistors T1, T2 and T3, respectively. The collectors of
transistors T1, T2 and T3 are connected to the emitter of transistor T4, while their
emitters are connected to LED1, LED2 and LED3 via 150-ohm resistors R6, R7 and R8,
respectively. The LEDs are activated one by one by the decade counter outputs.
Now for each output period of IC2, a particular LED blinks at the rate of 8.4 Hz. The
blinking then shifts to the next LED when the output of IC2
advances by one count (after about 1.3 seconds). Similarly, the blinking effect shifts to
the next LED after another 1.3 seconds and the cycle repeats thereafter.
Flashing frequencies can be changed by changing the values of R10 and R11 and
capacitor C4. The circuit can be easily assembled on any general-purpose PCB. It works
off a 12V regulated power supply. You can also add more LEDs in series with LED1,
LED2 and LED3, respectively.
faulty car indicator alarM
debaraj Keot
B efore taking a turn, either left or right, car drivers need to switch on the car’s turn-
indicator lamps so that the approaching vehicle drivers can take precaution accordingly.
An accident is likely to occur in case your car’s turn-indicator lamps fail to glow due to
some reason or the other. Here’s a circuit that sounds an alarm if your turn-indicator
lamps don’t glow, helping you to safeguard against any accident.
L2 or L3-L4) causes
a voltage drop across
series resistor R1.
This voltage drives
pnp transistor T1 into
saturation. In this con
dition, pnp transistor
T2 does not conduct
and hence relay RL1
does not energise. No
sound from piezobuzzer
PZ1 (connected to nor
mally-opened (N/O)
contacts of relay RL1)
means that the turn-indicator lamps are working satisfactorily.
When one or both of the turn-indicator bulbs are fused, the voltage drop across R1 is
insufficient and pnp transis- tor T1 remains cut-off. In this condition, pnp transistor T2
conducts to energise relay RL1 and piezobuzzer PZ1 sounds to indicate that one or both
the turn-indicator bulbs are fused.
Install the circuit (excluding turn-indicator lamps L1 through L4, which are already fitted
in your car) near the driv- er’s seat so that the driver has easy access to blinker switch
S1. To turn left, the driver needs to connect blinker switch S1 to left position to flash
front and back left-turn-indicator lamps (L1 and L2). Similarly, to turn right, he needs to
connect blinker switch S1 to right position to flash front and back right-turn indicator
lamps (L3
and L4).
h i s F M t r a n s m i t t e r f o r y o u r s t e r e o o r a n y o t h e r amplifier provides a
good signal
strength up to a distance of 500 metres with a power output of about 200 mW. It works
off a 9V battery.
The audio-frequency modulation stage is built around transistor BF494 (T1), which is
wired as a VHF oscillator and modulates the audio signal present at the base. Using
preset VR1, you can adjust the audio signal level. The VHF frequency is decided by coil
L1 and variable capacitor VC1. Reduce the value of VR2 to have a greater power output.
The next stage is built around transistor BC548 (T2), which serves as a Class-A power
amplifier. This stage is inductively coupled to the audio-frequency modulation stage. The
antenna matching network consists of variable capacitor VC2 and capacitor C9. Adjust
VC2 for the maximum transmission of power or signal strength at the receiver.
For frequency stability, use a regulated DC power supply and house the transmitter
inside a metallic cabinet.
For higher antenna gain, use a telescopic antenna in place of the simple wire. Coils L1
and L2 are to be wound over the same air core such that windings for coil L2 start from
the end point for coil L1. Coil winding details are given below:
L1: 5 turns of 24 SWG wire closely wound over a 5mm dia. air core
L2: 2 turns of 24 SWG wire closely wound over the 5mm dia. air core
L3: 7 turns of 24 SWG wire closely wound over a 4mm dia. air core
his simple key-operated gate locking system allows only those persons who know the
preset code to
open the gate. The code is to be entered from the keypad within the preset time to operate
the motor fitted in the gate. If anyone trying to open the gate presses a wrong key in the
keypad, the system is disabled and, at the same time, sounds an alarm to alert you of an
unauthorised entry.
Figs 1 and 2 show the block and circuit diagrams of the key-operated code locking
system, respectively. Connect points A, B, C, D, E, F and ground of the circuit to the
respective points of the keypad. Keys S7, S16, S14 and S3 are used here for code entry,
and the remaining keys are used for disabling the system. It is very important to press the
keys in that order to form the code. To start the motor of the gate, press switches S7,
S16, S14 and S3 sequentially.
If the keys are pressed in
a different order from the
preset order, the system
will lock automatically
and the motor will not
start.
Initially, 6V is not
available at pin 14 of Fig. 1: Block diagram of simple key-operated gate locking
system AND gate IC6, so no pulse
reaches the base of npn transistor T1 to
trigger timer IC5 and, as a result, the
gate doesn’t open. To enable the system,
first you have to trigger IC4. Pressing
switch S7 triggers timer IC4 to provide
6V to IC6 for approximately 17 seconds.
Within this time, you have to press
switches S16, S14 and S3 sequentially.
As a result, the outputs of timers IC1,
IC2 and IC3 sequentially go high. These
high outputs are further given to gates
N1 and N2 of IC6 to trigger IC7 via npn
transistor T1. The time durations for the high outputs of IC1, IC2 and IC3 are preset at
13.5, 9.43 and 2.42 seconds, respectively.
When all the four switches (S7, S16, S14 and S3) are pressed sequentially, timer IC7
triggers to start the motor for the preset period to open the gate. Once the time elapses,
the motor stops automatically. The ‘on’ time for the motor can be selected by adjusting
preset VR5. Here, the minimum ‘on’ time is
If a switch other than S7, S16, S14 and S3 is pressed, IC5 triggers to energise relay RL1,
which disconnects the power supply of the second relay and the system gets locked and
piezobuzzer PZ1 sounds an alarm to alert you that somebody is trying to open the gate
lock.
Now to stop the sound and reset the system again press any key (other than S7, S16, S14
and S3) from the keypad.
The circuit works off 6V DC regulated power supply and can be easily assembled on a
general-purpose PCB.
dc Motor control using a single switch
V. daVid
T
his simple circuit lets you run a DC motor in clockwise or anticlockwise direction and
stop it
using a single switch. It provides a constant voltage for proper operation of the motor.
The glowing of LED1 through LED3 indicates that the motor is in stop, forward rotation
and reverse conditions, respectively.
Here, timer IC1 is wired as a monostable multivibrator to avoid false triggering of the
motor while pressing switch S1. Its time period is approximately 500 milliseconds (ms).
Suppose, initially, the circuit is in reset condition with Q0 output of IC2 being high.
Since Q1 and Q3 outputs of IC2 are low, the outputs of IC3 and IC4 are
high and the motor doesn’t rotate. LED1 glows to indicate that the motor is in stop
condition.
When you momentarily press switch S1, timer 555 (IC1) provides a pulse to decade
counter CD4017 (IC2), which advances its output by one and its high state shifts from Q0
to Q1. When Q1 goes high, the output of IC3 at pin 3 goes low, so the motor starts
running in clockwise (forward) direction. LED2 glows to indicate that the motor is
running in forward direction.
Now if you press S1 again, the high output of IC2 shifts from Q1 to Q2. The low Q1
output of IC2 makes pin 3 of IC3 high and the motor doesn’t rotate. LED1 glows (via
diode D2) to indicate that the motor is in stop condition.
Pressing switch S1 once again shifts the high output of IC2 from Q2 to Q3. The high Q3
output of IC2 makes pin 3 of IC4 low and the motor starts running in anticlockwise
(reverse) direction. LED3 glows to indicate that the motor is running in reverse
direction.
If you press S1 again, the high output of IC2 shifts from Q3 to Q4. Since Q4 is connected
to reset pin 15, it resets decade counter CD4017 and its Q0 output goes high, so the
motor does not rotate. LED1 glows via diode D1 to indicate that the motor is in stop
condition. Thereafter, the cycle repeats.
If you don’t want to operate the motor in reverse direction, remove timer IC4 along with
resistors R5 and R7 and LED3. And connect ‘b’ terminal of the motor to +Vcc.
Similarly, if you don’t want to run the motor in forward direction, remove timer IC3
along with resistors R4 and R6 and LED2. And connect ‘a’ terminal of the motor to
+Vcc.
The circuit works off a 9V regulated power supply for a 9V DC motor. Use a 6V
regulated power supply for a 6V DC motor.
handy tester
d. Mohan KuMar
F
or beginners, here’s a low-cost multitester that can be used to test the condition of almost
all the electronic components from resistors to ICs. It uses only a few components but
can also detect polarity, continuity, logic states and activity of multivibrators.
The circuit is extremely simple and exploits the biasing property of bipolar transistors.
Transistors T1 and T2 act as transistor switches driving the red and green halves of
bicolour LED1 independently to give results of the test.
When power is applied by pressing switch S1, transistor T1 stops conducting due to the
lack of forward bias. At the same time, transistor T2 takes base bias voltage from the
battery through resistor R1 and conducts. This allows the red half of bicolour LED1 to
illuminate.
When the base of transistor T1 gets positive voltage through resistor R3, it conducts to
light up the green half of bicolour LED1. When transistor T1 conducts, the base of
transistor T2 is grounded and it cuts off to turn off the red half of bicolour LED1. The
functioning of the circuit thus depends on the signal obtained at the base of transistor T1.
The table gives the testing procedures for various components with the expected
indications/results.
Bi-Colour LED Status for Various Tests Component/test Test procedure LED1
status Result Note
Continuity Red and black probes to the test points
Polarity
Logic
IC
Multivibrator IC 555 Red probe to the positive of the circuit and black probe to the test
point
Red probe to the circuit’s positive and black probe to the output
Red probe to the circuit’s positive and black probe to the output
Red probe to the circuit’s positive and black probe to the output
Electrolytic capacitor
Diode (LED/
Photodiode/IR diode) Red probe to the positive and black probe to the negative lead
Red probe to the anode and black probe to the cathode
Red probe to the cathode and black probe to the anode
In both conditions
Red probe to the base of the transistor and black probe first to the collector and then to
the emitter
Black probe to the base of the transistor and red Green ‘on’
Red ‘on’
Green ‘on’
Red ‘on’
Green ‘on’
Red ‘on’
Green ‘on’
Red ‘on’
Colour changes from red to yellow to green cyclically Red ‘on’
Green gradually turns red Red ‘on’ Green ‘on’
Good
Faulty
Green ‘on’ and then probe first to the collector and then to the emitter red ‘on’ Transistor
doesn’t conduct
prograMMable electronic dice
Maneesh Chadha
H ere’s a simple programmable electronic dice with numeric display. This dice can be
programmed using a 4-way DIP switch to display any random number between ‘1’ and
‘2,’ ‘1’ and ‘3,’ ….. or ‘1’ and ‘9.’
To obtain the desired dice range, inner switches A, B, C and D of DIP switch are to be
set as per the table. For example, if you want the electronic dice to count from 1 to 8,
close switches A and D and keep B and C open. On pressing switch S1, the display
varies fast between ‘1’ and ‘8.’ When you release S1, the display stops shuffling and the
last (latest) number remains on it.
IC1 is a dual 4-input Schmitt trigger NAND gate 74LS13. Gate N1 is used as an
oscillator built using resistor R2 and capacitor C1 to produce approximately 70kHz
clock frequency, which is fed to IC2. Gate N2 loads data at the inputs of IC2.
IC2 is a presettable binary counter (74LS191) with parallel loading facility. Whenever
its pin 11 goes low, the data present at its inputs D through
1 to 2 B and A D and C
1 to 3 C only A, B and D
1 to 4 A and C B and D
1 to 5 B and C A and D
1 to 6 A, B, and C D only
1 to 7 D only A, B and C
1 to 8 A and D B and C
1 to 9 B and D A and C
A (which is ‘0001’) appears at its outputs QD through QA when all the inner switches of
DIP switch are open and DIS1 shows the minimum count as ‘1’ (and not ‘0’).
With inner switches of DIP switch in positions shown in the table, the count output can
go from ‘0001’ to the maximum count shown under ‘Dice Range’ in the table when
switch S1 is depressed. On releasing switch S1, the last count within the dice range gets
displayed.
The outputs of IC2 are displayed
on common-anode, 7-segment display LTS542 (DIS1). BCD-to-7-segment decoder IC
7447 (IC3) is used to drive the display. Resistor R8 limits the current through DIS1.
pc-based candle ignitor
r. KarthiCK
H
ere’s a PC-based lighting system that lets you light up a candle us-ing matchsticks by just
pressing the ‘Enter’ key on the PC’s keyboard. It is especially useful when celebrating
such occasions as birthdays and anniversaries.
The number of matchsticks required to light up the candle is placed on the candle
(alongside its wick) as shown in the figure. The heating coil for igniting the matchsticks
is kept near them.
The interface circuitry between the PC and the heating coil for the candle-matchsticks
arrangement comprises an inverter, monostable and relay driver. Transistor BC548 (T1)
acts as the inverter, IC 555 (IC1) is configured as the monostable circuit and transistor
SL100 (T2) is the relay driver.
When you press ‘Enter’ key on the keyboard, the inverted output at the collector of
transistor T1 goes low to trigger IC1 through its pin 2. Output pin 3 of the monostable
goes high and transistor T2 conducts for around 50 seconds.
The conduction of transistor T2 energises relay RL1, which, in turn, connects the heating
coil to 230V AC through the normally opened (N/O) contact. In place of the heating coil,
you can also use an electric cigarrette lighter. The heating coil becomes red hot when
connected across the 230V AC and ignites the matchsticks. The flames of the matchsticks
light up the candle.
The program, written in ‘C’ language, is simple and easy to understand. The parallel-
port D-type female connector normally available on the back of the PC is used for
outputting the data to the interfacing circuitry. The address 378H of parallel-port LPT1 is
used in the program. The parallel-port pin 2 corresponding to data bit D0 sends the
control signal to energise the relay, which, in turn, connects the load to AC mains.
This circuit uses only one output of the PC’s parallel port to light up the candle, but it
can be extended to light up up to eight diyas/candles in thiruvillaku (as called in South
India) by using eight outputs with a slight change in the program and adding seven
similar circuits.
{
n=random(10);
/* PC Based Lighting System */ #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int n;
clrscr();
outportb(0x0378,0);
textcolor(n);
gotoxy(23,13);
cprintf(“Press enter to light up the DEEPAM”); delay(100);
}
outportb(0x0378,1);
getch();
getch();
}
solidstate reMote control switch
seeMant sinGh
H
ere is a solidstate remote control switch which uses readily available electronic
components. The control circuit comprises the transmitter and receiver sections. The
range of the transmitter is around seven metres.
The transmitter circuit (shown in Fig. 1) is built around a timer IC (555) wired as an
astable multivibrator. It works off a 9V battery. When remote control switch S1 is
pressed, the astable multivibrator built around IC1 starts oscillating at a frequency of
about 38 kHz. The signal frequency at output pin 3 of IC1 is transmitted through two
infrared diodes (IR LED1 and IR LED2). A green LED (LED1) connected to pin 3 glows
whenever S1 is pressed, indicating the presence of a signal for transmission at the output
of the multivibrator.
The output frequency F at pin 3 of IC1 depends on the timing components, viz, resistors
R1 and R2 and capacitor C2. It is given by the following relationship:
F = 1.443/(R1+2R2)C2
This frequency is fed to npn transistors T1 and T2 (each BC547) through resistor R4
(470-ohm) to drive the IR LEDs. Resistor R5 limits the current flowing through the IR
LEDs.
The receiver circuit (shown in Fig. 2) consists of regulator IC 7806 (IC4), IR receiver
module (TSOP1738), timer 555 (IC2) and decade counter CD4017 (IC3). Timer 555
(IC2) is wired as a monostable multivibrator.
The 9V DC power supply for the receiver circuit is regulated by regulator IC 7806. The
presence of power in
the circuit is indicated
by glowing of the red
LED (LED2).
The IR receiver
module (TSOP1738),
which gets 5.1V power
supply through zener
diode ZD1, receives
the transmitted signal
of about 38 kHz. The
signal is amplified by
transistor BC558 (T3)
and given to triggering
pin 2 of IC2 through Fig. 1: Transmitter circuit of the green LED (LED3).
The output of IC2 is given to the clock input (pin 14) of IC3. Here, IC3 is wired as a
bistable circuit. For every clock input, pins 2 and 3 of IC3 alternately go high.
Initially, when the power to the receiver circuit is switched on, pin 3 of IC3 is high and
therefore the yellow LED (LED4) connected to it glows. The glowing of LED4 indicates
that the appliance is in ‘off’ condition.
When a clock pulse is received at pin 14 of IC3, pin 3 goes low to turn off LED4, while
pin 2 becomes high. The high output at pin 2 triggers the gate of
Initially, when no signal is received from the transmitter, the output of the IR receiver
module is high (approx. 5V).
When the transmitter is pointed at the receiver and switch S1 is momentarily pressed, the
transmitted IR rays are sensed by the receiver module and its output pulses low to trigger
the monostable (IC2). The output of IC2 goes high for about five seconds. Thus, even if
you press the remote switch more than one time by mistake, there won’t be any change in
the output of the receiver within this period and hence no undesired switching of the
appliance. The signal reception is indicated by glowing triac BT136, which, in turn,
controls the appliance.
Precautions. Don’t touch the leads of the triac as it is connected across the 230V AC
mains. Also, make sure that the neutral point of mains is connected to the ground line of
the circuit and not vice versa.
Microcontroller-based Monitoring
systeM
Maneesh Chadha
I
n establishments such as small ho tels, small offices and clinics, inter coms or calling
bells prove to be a costlier option for communication between number of points. Here’s
a simple and inmates and the assisting staff since such economical room-monitoring
system that a provision can be made only for a limited provides audio-visual
identification of
Codes for Display Generation along with RAM Locations for Their Storage
9
F
P0.6
1
1
1
0
0
0
0
0
the call point. The system also provides feedback to the caller (in the form of busy
signal). Using minimal hardware and software, it’s a clean and easy way to
communicate.
7
A
P0.1
1
0
0
1
0
0
0
0
0 F2H 68H
0 48H 67H
0 60H 66H
0 32H 65H
0 24H 64H
0 04H 63H
0 0BH 62H
0 00H 61H
R1 through R8 are pull-up resistors, while resistors R10 through R17 are current-
limiting resistors. Other passive components constitute the reset and clock circuitry for
operating the microcontroller.
IC1 are used as output, input and output ports, respectively. Switches S1 through S8 are
interfaced as inputs to controller IC1 via port 1 (p1.0 through p1.7). These switches,
along with the respective LEDs, are to be installed in eight different rooms, while the
remaining circuit is to be placed in the control room. Resistors has to wait for some
time. When the LED stops blinking, he can press the switch for help. The LED again
blinks to indicate that the request is being processed.
Written in Assembly language, the program for the microcontroller (MS. ASM) is simple
and easy to understand. It is given at the end of the article. The table provides codes for
generating the 7-segment display and the RAM locations of the microcon-troller where
these are to be stored.
The complete Assembly program can be written using any text editor. Save the file as
‘MS.ASM.’ Generate the hex file (MS.HEX) by using the ASM51.EXE assembler. (This
assembler was included in EFY-CD of March 2003 issue at path ‘E:\Software
\Efysoftware\TEMar03\ 89C51Pgmr\Test Setup.’) The complete procedure can be
summarised as:
1. Program the micro-controller with the MS.HEX file using AT89C51 programmer.
2. After successfully programming the code, take the microcontroller out from the
programmer and connect it to its IC base on the PCB of the circuit.
3. After assembling and soldering all other components, connect a 5V DC external
power supply.
4. Now if you press any switch, the corresponding call-point number should display for
a few seconds. At the same time, LEDs at all the call points should blink and the buzzer
in the control room should sound for this duration.
5. If the kit is working properly, install the main unit with 7-segment display and buzzer
in the control room and all the eight switches with LEDs beside them at different call
points.
Note: The source code of this article is included in the CD.
0000 1 ORG 00H
0000 0143 2 AJMP START
0003 3 ORG 03H
0003 32 4 RETI
000B 5 ORG 0BH
000B 32 6 RETI
0013 7 ORG 13H
0013 32 8 RETI
001B 9 ORG 1BH
001B 32 10 RETI
0023 11 ORG 23H
0023 32 12 RETI
0025 13 ORG 25H
0025 14 DELAYMS:
0025 7F00 15 MOV R7,#00H ;delay of millisecond
0027 16 LOOPA:
0027 0F 17 INC R7 ;increment R7 by one
0028 EF 18 MOV A,R7 ;store R7 value to Accumulator (A)
0029 B4FFFB19 CJNE A,#0FFH,LOOPA
002C 22 20 RET
002D 21 DELAYHS:
002D 7E00 22 MOV R6,#00H ;half second delay
002F 7D08 23 MOV R5,#008H ;initialize R5
0031 24 LOOPB:
0031 0E 25 INC R6 ;to call milliseconds delay
0032 1125 26 ACALL DELAYMS ;call ms delay routine above
0034 EE 27 MOV A,R6 ;store R6 value to A
0035 70FA 28 JNZ LOOPB ;go to LOOPB unless R6=OO
0037 E5A0 29 MOV A,0A0H ;store port-2 value to A
0039 F4 30 CPL A ;complement A and output A to port 2 to
003A F5A0 31 MOV 0A0H,A ;blinks all port LEDs
003C 7400 32 MOV A,#00H ;initialize A
003E 1D 33 DEC R5 ;decrement R5
003F ED 34 MOV A,R5 ;move R5 value to A
0040 70EF 35 JNZ LOOPB ;if A is not 0 then go to LOOPB
mS.lSt
;locate reset routine at 00H
;jump to START of main program ;locate interrupt 0
;returns from external interrupt 0 ;locate timer 0 interrupt
;returns from timer 0 interrupt ;locate interrupt 1
;returns from external interrupt 1 ;locate timer 1 interrupt
;returns from timer 1 interrupt ;locate serial port interrupt
;returns from serial port interrupt ;locate beginning of delay program 0042 22 36 RET ;delay routine eight times 0043 37
START:
0043 756100 38 MOV 61H,#00H ;store 1st code at 61H 0046 7562B0 39 MOV 62H,#0B0H ;store 2nd code at 62H
0049 756304 40 MOV 63H,#04H ;store 3rd code at 63H 004C 756424 41 MOV 64H,#24H ;store 4th code at 64H
004F 756532 42 MOV 65H,#32H ;store 5th code at 65H 0052 756660 43 MOV 66H,#60H ;store 6th code at 66H 0055
756748 44 MOV 67H,#48H ;store 7th code at 67H 0058 7568F2 45 MOV 68H,#0F2H ;store 8th code at 68H 005B 46
LOOP:
005B E590 47 MOV A,90H ; continuously read the inputs 005D B4FF02 48 CJNE A,#0FFH,L1 ;detect any switch
press 0060 015B 49 AJMP LOOP ;again jump to LOOP to read port-1 0062 50 L1:
0062 7C00 51 MOV R4,#00H ;scan for any switch is pressed 0064 52 L2:
0064 D3 53 SETB C ;loop L2 unless carry=0 detected 0065 33 54 RLC A ;rotate A with carry flag 0066 0C 55 INC
R4 ;increment R4, each time loop L2 is run 0067 40FB 56 JC L2
0069 EC 57 MOV A,R4 ;R4 value for switch number 006A 2460 58 ADD A,#60H ;add A
006C F8 59 MOV R0,A ;move Address pointer to register R0 006D E6 60 MOV A,@R0 ;address pointer R0 points to
correct
code stored
006E F580 61 MOV 80H,A ;code stored at A transferred to port-0
0070 75A000 62 MOV 0A0H,#00H ;initialize port-2 to start LEDs blinking
0073 112D 63 ACALL DELAYHS ;call four seconds delay
0075 7580FF 64 MOV 80H,#0FFH
0078 75A0FF 65 MOV 0A0H,#0FFH
007B 015B 66 AJMP LOOP ;delay returns here
67 END ;end program
VERSION 1.2k ASSEMBLY COMPLETE, 0 ERRORS FOUND
autoMatic school bell
raj KuMar Mondal
C
onsider that a school has a total of eight periods with a lunch break after the fourth
period. Each period is 45 minutes long, while the duration of the lunch break is 30
minutes.
To ring this automatic school bell to start the first period, the peon needs to momentarily
press switch S1. Thereafter, the bell sounds every 45 minutes to indicate the end of
consecutive periods, except immediately after the fourth period, when it sounds after 30
minutes to indicate that the lunch break is over. When the last period is over, LED2
glows to indicate that the bell circuit should now be switched off manually.
In case the peon has been late to start the school bell, the delay in minutes can be
adjusted by advancing the time using switch S3. Each pushing of switch S3 advances the
time by 4.5 minutes. If the school is closed early, the peon can turn the bell circuit off by
momentarily pressing switch S2.
The bell circuit contains timer IC NE555 (IC1), two CD4017 decade counters (IC2 and
IC3) and AND gate CD4081 (IC4). Timer IC1 is wired as an astable multivibrator,
whose clock output pulses are fed to IC2. IC2 increases the time periods of IC1 (4.5 and
3 minutes) by ten times to provide a clock pulse to IC3 every 45 minutes or after 30
minutes, respectively. When the class periods are going on, the outputs of IC3 switch on
transistors T1 and T2 via diodes D4 through D12.
Resistors R4 and R5 connected in series to the emitter of npn transistor T2 decide the
4.5-minute time period of IC1. The output of IC1 is further connected to pin 14 of IC2 to
provide a period with a duration of 45 minutes. Similarly, resistors R2 and R3
connected in series to the emitter of npn transistor T1 decide the 3-minute time period of
IC1, which is further given to IC2 to provide the lunch-break duration of 30 minutes.
Initially, the circuit does not ground to perform its operation when 12V power supply is
given to the circuit.
When the eighth period is over, Q9 output of IC3 goes high. At this time, transistors T1
and T2 don’t get any voltage through the outputs of IC2. As a result, the astable
multivibrator (IC1) stops working.
The school bell sounds for around 8 seconds at the end of each period. One can
increase/decrease the ringing time of the bell by adding/removing diodes connected in
series across pins 6 and 7 of IC1.
The terminals of the 230V AC electric bell are connected to the normally-open (N/O)
contact of relay RL1. The circuit works off a 12V regulated power supply. However, a
battery source for back-up in case the power fails is also recommended.
AutomAtic WAter PumP
H
ere’s a circuit that automatically controls the water pump motor. The motor gets
automatically
switched on when water in the overhead tank (OHT) falls below the lower limit.
Similarly, it gets switched off when the tank is filled up. Built around only one NAND
gate IC (CD4011), the circuit is simple, compact and economical. It works off a 12V DC
power supply and consumes very little power.
The circuit can be divided into two parts: controller circuit and indicator circuit.
Fig. 1 shows the controller circuit. Let us consider two reference probes ‘A’ and ‘B’
inside the tank, where ‘A’ is the lower-limit probe and ‘B’ is the upper-limit probe. The
12V DC power supply is given to probe C, which is the limit for minimum water always
stored in the tank.
The lower limit ‘A’ is connected to the base of transistor T1 (BC547), the collec- tor of
which is connected to the 12V power supply and the emitter is connected to relay RL1.
Relay RL1 is connected to pin 13 of NAND gate N3.
controller
R. ARAvind & v. PRAdeeP KumAR
Similarly, the upper-limit probe ‘B’ is connected to the base of transistor T2 (BC547),
the collector of which is con- nected to the 12V power supply and the emitter is
connected to pins 1 and 2 of NAND gate N1 and ground via resistor R3. The output pin 4
of NAND gate N2 is connected to pin 12 of NAND gate N3. The output of N3 is
connected to input pin 6 of N2 and the base of transistor T3 via resistor R4. Relay RL2
connected to the emitter of transistor T3 is used to drive the motor.
If the tank is filled below probe A, transistors T1 and T2 do not conduct and the output
of N3 goes high. This high output energises relay RL2 to drive the the logic built around
NAND gates N1 and N2 outputs low to pin 12 of gate N3. The net effect is that the output
of N3 remains high and the motor continues pumping water into the tank.
When the tank is filled up to probe B level, water inside the tank still provides base
voltage to transistor T1 and relay RL1 energises to make pin 13 of gate N3 high. At the
same time, water inside the tank also provides base voltage to drive transistor T2 and
the logic built around NAND gates N1 and N2 outputs high to pin 12 of gate N3. The net
effect is that the output at pin 11 of N3 goes low and the motor stops pumping water into
the tank.
When the tank is filled above probe A but below probe B, water inside the tank provides
base voltage to drive transistor T1 and relay RL1 energises to make pin 13 of gate N3
high. However, water inside the tank does not provide base voltage to transistor T2, so it
does not conduct and
Water-level Indication by LEDs Level of water Glowing of LEDs inside the tank
Note. The user can adjust the level to which water must be filled in the tank by adjusting
the heights of probes A and B. The stand and adjusting screws should be insulated to
avoid shorting.
noise meter
d. mohAn KumAR
N
beyond 100 dB, it may affect your psycho - motor performance, detracting your attention
and causing stress. Noise pollution may also affect your hearing ability.
Noise intensity level in households is around 47 dB. But hi-fi music systems and TV sets
operated at high volumes add to this sound, posing a health hazard.
Here’s a simple circuit that senses and displays the noise intensity level in your room. It
also gives a warning beep when noise crosses the safe level of 30 dB.
The circuit comprises a sound intensity sensor and a display unit. The regulator circuit
built around regulator IC 7809 (IC1) provides regulated 9V power supply to the circuit.
The sound intensity sensor is built around a condenser microphone, opamp IC CA3130
(IC2) and associated components. Op-amp IC2 is configured as a high-gain inverting
amplifier. The voltage supply to IC2 at its non-inverting pin 3 is divided to half by
resistors R3 and R4, which is also used as the reference voltage. Resistor R1 determines
the sensitivity of the condenser microphone.
The microphone picks up sound vibrations and converts them into the corresponding
electric pulses, which are fed to the inverting input of IC2 (pin 2) via capacitor C4 and
resistor R2. Capacitor C4 blocks any DC entering the op-amp, since it may affect the
functioning of the op-amp. The output of IC2 is connected to the inverting input through
resistor R5 (10 mega-ohms) for negative feedback. Since the input impedance of IC2 is
very high, even a small current can activate the op-amp.
The output of IC2 is given to preset VR1 via capacitor C5, which is used to control the
volume. Capacitor C5 blocks DC, allowing only AC to pass through preset VR1. The
AC signals from the wiper reservoir capacitor for DC and resistor R6 provides the path
for its discharge.
The display circuit is built around monolithic IC LM3914 (IC3), which senses the
analogue voltage and drives ten LEDs to provide a logarithmic analogue display. Current
through the LEDs is regulated by the internal resistors of IC3, eliminating the need for
external resistors. The built-in low-bias input buffer of IC3 accepts signals down to
ground potential and drives ten individual comparators inside IC3. The outputs of IC3 go
low in a descending order from 18 to 10 as the input voltage increases.
Pin 9 of IC3 is connected to 9V to get the dot-mode display. In the dot-mode display,
there is a small amount of overlap between segments. This assures that at no time will all
LEDs be ‘off.’
When output pin 10 of IC3 goes low, pnp transistor T1 gets base bias (normally cut-off
due to resistor R7) to sound the pi- ezobuzzer (PZ1) connected to its collector.
of VR1 are fed to a diode pump comprising diodes Dl and D2. The diode pump rectifies
the AC and maintains it at the output level of IC2. Capacitor C6 acts as a Each LED
connected to the output of
IC3 represents the sound level of 3 dB, so when all the ten LEDs glow, it means the
sound intensity is 30 dB.
preset VR1 until only the first LED (LED1) lights up. Keep the circuit near the audio
equipment or TV set to monitor the audio level.
Anti-theft AlArm for Bikes
PRAveen KumAR m.P.
I
f anybody tries to steal your bike, this circuit turns on the horn of the bike to alert you of
the impending
theft.
Usually, a handle lock is used on the handle bar for the safety of bikes, with the front
mudguard in a slanted position. When the handle lock is freed, the front mudguard can be
aligned with the body of the bike.
This circuit consists of transmitter and receiver sections. The transmitter (IR LED1) is
fitted on the back end of the front mudguard and the receiver sensor (IRX1) is fitted on
the central portion of the crash guard of the bike such that IR rays from the transmitter
directly fall on the sensor when the front mudguard comes in line with the body of the
bike.
The transmitter section is built around timer 555 (IC2), which is wired as an astable
multivibrator with a frequency of around 38 kHz. The output of IC2 is further amplified
by transistor T1 and given to an infrared light-emitting diode (IR LED1), which
continuously transmits the IR frequency.
The receiver section uses IR receiver module TSOP 1738 (IRX1), which is nor- mally
used in TV receivers. The receiver module senses the IR modulated frequency
transmitted by the IR LED.
When no IR rays are incident on the sensor, its output is high. But the output of the IR
sensor goes low when it senses the modulated IR signal. The output of the receiver
module is given to a negativevoltage comparator built around IC LM311 (IC3). The input
voltage at pin 2 of IC3 is fixed by using the voltage-divider network comprising resistors
R7 and R8.
When IR rays are not incident on the IR receiver module, the voltage at pin 3 of IC3 is
greater than the voltage at pin 2. As a result, the output of comparator IC3 is low. But
when the receiver senses IR rays from IR LED1, the voltage at pin 3 of IC3 is lower than
the voltage at pin 2. As a result, the output of the comparator goes high.
The output of the comparator is given to a latch made up of JK flip-flop (IC4). The low-
to-high going pulse from the comparator makes the output of IC4 high until it is reset. The
output of IC4 is latched and
used to energise relay RL1 via transistor T2. The relay is connected to the negative
terminal of the mobike’s horn, while the positive terminal of the horn is connected to the
positive terminal of the battery via resistor R1. The energised relay drives the horn,
which continues sounding until you press reset switch S2 momentarily.
At night, lock your bike using the handle lock and switch on the circuit using switch S1.
Since the IR transmitter (IR LED1) and the receiver (IRX1) will not be in line of sight,
IR rays from IR LED1 will not be incident on the sensor. When anyone tries to move the
bike away, the IR transmitter and the IR receiver will come in line of sight and the IR
rays from the IR transmitter will be incident on the receiver. This will make the output of
the comparator (IC3) high. The pulse from the comparator will make the output of latch
IC4 high and transistor T2 will conduct to sound the horn via relay RL1.
Note. The circuit excluding the transmitter and the receiver can be housed in a small
metal box and kept inside the tool box of the bike.
Before you start your bike, make sure that the circuit is switched off using switch S1.
timer With musicAl AlArm
his low-cost timer can be used for introducing a delay of one minute to two hours. After
the timing period is over, a musical song is heard.
The circuit is built around popular CMOS oscillator/divider CD4060 (IC1). It works off
a 9V PP3 battery and its standby current drain is very low.
By adjusting preset VR1, the time delay can be adjusted. After time delay is over, output
pin 3 of IC1 goes high and
PRAdeeP G.
Fig. 2: The circuit of timer with musical alarm
Preset VR2 is used to control the volume of the loudspeaker.
The timer gets activated when power is supplied by pressing switch S1. To switch off
the alarm, you need to switch off the power supply.
mAins fAilure/resumPtion AlArm
v. dAvid
T
his mains indicator sounds an alarm whenever AC mains fails or re-sumes. It is very
useful in
The mains detector circuit is built around capacitors C1 and C2, resistor R1, and diodes
D1 and D2. It provides sufficient voltage for the glowing of internal LED of optocoupler
MCT2E (IC1).
Initially SPDT switch S1 is at position 1. When mains fails, pin 5 of gate N2 goes high
and the oscillator built around gates N2 and N3 of IC2 produces low-frequency
oscillations at pin 10, which are further given to pin 4 of IC 555 (IC3). The oscillation
frequency can be varied from 0.662 Hz to 1.855 kHz using preset VR1.
IC 555 (IC3) is wired as an audio tone generator. The tone of this audio oscillator can be
varied from 472 Hz to 1.555 kHz using preset VR2. The low-frequency input activates
IC3 to generate audio tones and loudspeaker LS1 connected to its output pin 3 sounds an
alarm indicating mains failure.
To turn off the alarm, slide the pole of switch S1 to position 2. Now the circuit is ready
for sensing the mains resumption.
When mains resumes, pin 5 of gate N2 goes high and the oscillator built around gates N2
and N3 of IC2 produces low-frequency oscillations at pin 10, which are given to reset
pin 4 of IC3. As a result, loudspeaker LS1 again sounds to indicate that mains has
resumed. To turn off the alarm, slide the pole of switch S1 back to position 1. Now the
circuit is again ready for sensing the mains failure.
The circuit works off a 9V battery. It can be housed in a box and installed where you
want to monitor the status of mains.
soldering iron temPerAture controller
P.v. vinod KumAR
H
the soldering iron is to be kept on for long since you can control the heat dissipation from
the iron. When a soldering iron is switched on, the iron takes time to reach the solder’s
melting point. Simply connect this circuit to the soldering iron as shown in the figure and
the iron reaches the solder’s melting point quickly.
The circuit can be housed in a box with the potentiometer fixed on the side such that its
knob can be used from outside the box to adjust the soldering iron’s temperature.
multiPurPose White-led light
n.S. hARiSAnKAR, vu3nSh
S
tandard fluorescent lamps and their smaller versions called compact fluo-rescent lamps
(CFLs) radiate light in all directions (360°) and tend to increase the room
temperature. In emergency lights
using these lamps, the battery
lasts only a few hours due to the
power loss during conversion of
DC into AC. These limitations
can be overcome by using ultra
bright white LEDs.
Here is a torch-cum-table
lamp using white LEDs that
can also be modified to act as
an emergency-cum-bedroom
light. Its main features are
long and continuous operation,
very low power consumption,
selectable light angle, very
long life and negligible heat
radiation.
acts as a torch. When the pole of switch S1 is at position 2, both the table lamp and the
torch modes remain off.
and a combination of white LEDs. Resistor R3 (4.7-ohm, 2W) limits the current through
the battery. The radiation angles selected for white LEDs are 60° and 20°. Three
columns of LED clusters (A, B and C) are made on separate transparent acrylic sheets,
with each sheet having a total of twelve LEDs affixed to it.
The left (A) and right (C) columns use 20° LEDs, while the middle column (B) uses 60°
LEDs. All the twelve LEDs of each column are connected in series to separate 15-ohm
current-equalisation resistors (R8 through R19) as shown in Fig. 2, and to current-limiter
resistors R7 (10-ohm, 1W) and R6 (5-ohm, 1W) as 7 hours in torchlight mode and
around 14 hours in table lamp mode, depending on the battery capacity and quality. For
the torch mode, only the left and right LED columns are used. These LEDs beam light up
to 6 metres. In table lamp (spread light) mode, only the middle column of LEDs is used.
You can select between the table lamp and torch modes by using rotary switch S1, which
is a single-pole, 3-way switch. When the pole of switch S1 is set at position 1, the C
column of 60° LEDs lights up and the system acts as a table lamp. When the pole of
switch S1 is set at position 3, columns A and C light up and the system glows. To charge
the battery, flip switch S2 to ‘on’ position. To check the status of the battery, flip switch
S3 to ‘on’ position. This will give an indication of battery charge. If low-battery
indicator LED1 turns off, the battery needs to be charged.
Fig. 3 shows the circuit of emergency lamp with brightness control, which is derived
from Fig. 1 with slight modifica- tion in the combination of LEDs. Built around four
multichip (MC) LEDs, it is very compact and simple, and can work in two modes,
namely, bedroom lamp and emergency lamp.
In bedroom lamp mode, only one blue LED glows. This LED is mounted at the top in
upside down position to avoid direct viewing of the blue light. The arrangement gives a
pleasant, well-spread light.
In emergency lamp mode, 8mm, 80° bright-white multichip LEDs give 80° spread light,
which is sufficient for in- door uses. Circular PCBs for multichip LEDs have four
internal junctions each. Solder LED17 through LED20 in the first PCB, LED21 through
LED24 in the second PCB, LED25 through LED28 in the third PCB and LED29 through
LED32 in the fourth PCB, with a spac- ing of 3 to 4 cm between two adjacent LEDs.
Finally, house all the four circular PCBs in a compact cabinet along with the reflector
such that light can spread out in the room.
Each multichip LED gives a power of 32 candles. Therefore use of four 8mm multichip
LEDs will give a total power of 128 candles.
In emergency lamp mode (selected through rotary switch S5), all the four multichip
LEDs (including LED17 through LED32) glow. The DC power source is a 6V, 4Ah
chargeable battery, with charging circuit built around popular IC LM317 (IC2). Resistor
R21 (2.2-ohm, 1W) acts as the current limiter for the battery.
You can control the candle power (brightness) of LEDs as per your requirements.
Transistor SL100 (T1) and its associated components form the candle controller
(brightness controller). The base biasing voltage of the transistor is stabilised by resistor
R24 and diodes N3 and N4 (1N4001). This constant voltage is given to the base of the
transistor through a potentiometer VR1 (4.7k lin.). By adjusting the potentiometer, you
can control the intensity of the multichip LEDs. No heat-sink is required for the
transistor. Fig. 3: Emergency lamp with brightness control
electronic WAtchdog
TAPAn KumAR mAhARAnA
H
ere’s an electronic watchdog for your house that sounds to inform you that somebody is
at the gate.
The circuit comprises a transmitter unit and a receiver unit, which are mounted face to
face on the opposite pillars of the gate such that the IR beam gets interrupted when
someone is standing at the gate or passing through it.
The transmitter circuit (see Fig. 1) is built around timer NE555 (IC1), which is wired as
an astable multivibrator producing a frequency of about 38 kHz. The infrared (IR) beam
is transmitted through IR LED1.
The receiver circuit is shown in Fig. 2. It comprises IR sensor TSOP1738 (IR RX1), npn
transistor BC548 (T1), timer NE555 (IC2) and some
resistors and capacitors.
IC2 is wired as a monos
table multivibrator with
a time period of around
30 seconds. The melody
generator section is built
around melody generator
IC UM66 (IC3), transistor
T2 and loudspeaker LS1.
Fig. 3 shows pin con
figurations of IR sensor
TSOP1738 and melody
generator IC UM66.
When anyone interrupts the IR beam falling on the sensor, its output goes high to drive
transistor T1 into conduction and pin 2 of IC2 goes low momentarily. As a re
sult, IC2 gets triggered and its pin 3 goes high to supply 3.3V to melody generator IC3 at
its pin 2, which produces a sweet melody through the speaker fitted inside the house.
Output pin 3 of IC2 remains high for around 30 seconds.
Fig. 4 shows mounting arrangement for both the transmitter and receiver units on the gate
pillars. To achieve a high directivity of the IR beam towards the sen
sor, use a reflector behind the IR LED.
After both the units have been built, connect 6V power supply to the receiver circuit.
You should
hear a continuous mel
ody from the speaker.
Now connect 6V power
to the transmitter also
and orient IR LED1
towards IR receiver.
The melody should stop
after about 30 seconds.
Now the transmitter
and the receiver units
are ready for use.
When somebody
enters through the
door, the IR beam is
interrupted and the Fig. 4: Mounting arrangement for transmitter and receiver units
alarm sounds for 30
seconds. The alarm keeps sounding as long
as one stands between the transmitter and
receiver units. Using preset VR1, you can
set the volume of the loudspeaker.
n this fire alarm circuit, a thermistor works as the heat sensor. When temperature
increases, its resistance decreases, and vice versa. At normal temperature, the resistance
of the thermistor (TH1) is approximately 10 kilo-ohms, which reduces to a few ohms as
the temperature increases beyond 100°C. The circuit uses readily available components
and can be easily constructed on any general-purpose PCB.
When thermistor TH1 becomes hot, it provides a low-resistance path to extend positive
voltage to the base of transistor T1 via diode D1 and resistor R2. Capacitor C1 charges
up to the positive voltage and increases the ‘on’ time of alarm. The higher the value of
capacitor C1, the higher the forward voltage applied to the base of transistor T1
(BC548). Since the collector of transistor T1 is connected to the base of transistor T2,
transistor T2 provides positive voltage to reset pin 4 of IC1 (NE555). Resistor R4 is
used such that IC1 remains inactive in the absence of positive voltage. Diode D1 stops
discharging of capacitor C1 when the thermistor connected to the positive supply cools
down and provides a high-resistance (10-kilo-ohm) path. It also stops the conduction of
T1. To prevent the thermistor from melting, wrap it up in mica tape.
The circuit works off a 6V-12V regulated power supply. LED1 is used to indicate that
power to the circuit is switched on.
tWilight lAmP Blinker
T.K. hAReendRAn
D
uring sunset or sunrise, the ambient light is not adequate to lead you through the open
doorway
or make your way around obstructions. To avoid any mishap, here is a twilight lamp
blinker that you can place near obstructions.
Fig. 1 shows the circuit of the twilight lamp blinker. For powering the circuit, the mains
input (230V AC) is down-converted by resistors R1 and R2, capacitor C1 and diodes
D1 and D2 into a DC voltage that is low enough to safely charge the back-up battery
pack. Resistor R2 across capacitor C1 functions as a bleeder resistor. Zener diode ZD2
protects against over-voltage.
Miniature Ni-Cd battery packs for cordless telephones are easily available at reasonable
rates. Use such a battery pack with 4.8V, 500mAh rating for ef- ficient and long-time
back-up. The pole of switch S1 should be in position 2 if you use a battery. If you are not
interested in the back-up facility, flip switch S1 to position 1.
The rest of the circuit includes a lightdetector resistor (LDR1), IC CD4093 (IC1) and a
preset (VR1) for brightness control. LDR1 is used as a sensor that has a low resistance
during daytime and a high resistance at night.
When light falls on the LDR, its low resistance provides low level at the inputs of
NAND gate N1. The high input from N1 makes the output of N2 low and the relaxation
oscillator (built around NAND gates N3 and N4 of IC1, capacitor C3 and
Fig. 2: Proposed enclosure resistor R3) does not oscillate. As a result, transistor T1
does not conduct and LED1
Fig. 1: Circuit diagram of twilight lamp blinker
does not blink.
On the other hand, in darkness, the high resistance of LDR1 provides a high level at the
input pins of NAND gate N1. The low output from N1 makes the output of N2 high and
the relaxation oscillator oscillates. As a result, transistor T1 conducts and LED1 blinks.
Transistor T1 is the LED driver. Resistor R4 limits the current flowing through LED1
and hence its brightness. You may connect one or two additional LEDs in series with
LED1 to get more light. The low brightness of LED1 will extend the battery back-up
time.
During daytime, light falls on LDR1 and transistors T1 and T2 remain cutoff to make
pins 4 and 8 of IC1 low. Since transistor T3 is also cut-off, IC1 is not triggered. As a
result, output pin 3 of IC1 (connected to the gate of triac 1 via resistor R5 and red LED1)
remains low and the street bulb does not glow.
At night, no light falls on LDR1 and transistors T1 and T2 conduct to make pins 4 and 8
of IC1 high. Due to the con- duction of transistor T3, trigger pin 2 of IC1 remains low.
The high output of IC2 at its pin 3 turns the street bulb ‘on.’
Assemble the circuit, except LDR1, on any general-purpose PCB. Use long wires for
LDR1 connections so that it can be mounted at a place where sufficient light falls on it.
WAter-level controller
K.P. viSwAnAThAn
H
ere is a simple, automatic waterlevel controller for overhead tanks that switches on/off
the pump
motor when water in the tank goes below/above the minimum/maximum level. The water
level is sensed by two floats to operate the switches for controlling the pump motor.
Each sensors float is suspended from
above using an aluminium rod. This arrangement is encased in a PVC pipe and fixed
vertically on the inside wall of the water tank. Such sensors are more reliable than
induction-type sensors. Sensor 1 senses the minimum water level, while sensor 2 senses
the maximum water level (see the figure).
Leaf switches S1 and S2 (used in tape recorders) are fixed at the top of the sen- sor units
such that when the floats are lifted, the attached 5mm dia. (approx.) aluminium rods push
the moving contacts (P1 and P2) of leaf switches S1 and S2 from normally closed (N/C)
position to normally open (N/O) position. Similarly, when the water level goes down,
the moving contacts revert back to their original positions.
Normally, N/C contact of switch S1 is connected to ground and N/C contact of switch S2
is connected to 12V power supply. IC 555 is wired such that when its trigger pin 2 is
grounded it gets triggered, and when reset pin 4 is grounded it gets reset. Threshold pin 6
and discharge pin 7 are not used in the circuit.
When water in the tank goes below the minimum level, moving contacts (P1 and P2) of
both leaf switches will be in N/C position. That means trigger pin 2 and reset pin 4 of
IC1 are connected to ground and 12V, respectively. This triggers IC1 and its output goes
high to energise relay RL1 through driver transistor SL100 (T1). The pump motor is
switched on and it starts pumping water into the overhead tank if switch S3 is ‘on.’
As the water level in the tank rises, the float of sensor 1 goes up. This shifts the moving
contact of switch S1 to N/O position and trigger pin 2 of IC1 gets connected to 12V. This
doesn’t have any impact on IC1 and its output remains high to keep the pump motor
running.
As the water level rises further to reach the maximum level, the float of sen- sor 2 pushes
the moving contact of switch S2 to N/O position and it gets connected to ground. Now
IC1 is reset and its output goes low to switch the pump off.
As water is consumed, its level in the overhead tank goes down. Accordingly, the float
of sensor 2 also goes down. This causes the moving contact of switch S2 to shift back to
NC position and reset pin 4 of IC1 is again connected to 12V. But IC1 doesn’t get
triggered because its trigger pin 2 is still clamped to 12V by switch S1. So the pump
remains switched off.
When water level further goes down to reach the minimum level, the moving contact of
switch S1 shifts back to N/C position to connect trigger pin 2 of IC1 to ground. This
triggers IC1 and the pump is switched on.
The float sensor units can be assem - bled at home. Both the units are identi- cal, except
that their length is different. The depth of the water tank from top to the outlet water pipe
can be taken as the length of the minimum-level sensing unit. The depth of the water tank
from top to the level you want the tank to be filled up to is taken as the length of the
maximumlevel sensing unit. The leaf switches are fixed at the top of the tank as shown in
the figure.
Each pipe is closed at both the ends by using two caps. A 5mm dia. hole is drilled at the
centre of the top cap so that the aluminium rod can pass through it easily to select the
contact of leaf switches. Similarly, a hole is to be drilled at the bottom cap of the pipe so
that water can enter the pipe to lift the float.
When water reaches the maximum level, the floats should not go up more than the
required distance for pushing the moving contact of the leaf switch to N/O position.
Otherwise, the pressure on the float may break the leaf switch itself. The length of the
aluminium rod is to be selected accordingly. It should be affixed on the metal/thermocole
float using some glue (such as Araldite).
sound-oPerAted intruder AlArm
RAj K. GoRKhAli
W
hen this burglar alarm detects any sound, such as that created by opening of a door or
inserting
a key into the lock, it starts flashing a light as well as sounding an intermittent audio
alarm to alert you of an intruder. Both the light and the alarm are automatically turned off
by the next sound pulse.
230V AC mains is stepped down by transformer X1, rectified by diode D1 and filtered
by capacitor C1 to give 12V DC. The voltage at the non-inverting input (pin 3) of op-
amp CA3140 (IC1) is treated as the reference voltage and it can be set using preset VR1.
The voltage at the inverting input (pin 2) is the same as that across the condenser
microphone. The condenser microphone should be carefully set for a high sensitivity of
the sound. A high reference value means a subtle sound is enough to change the output of
IC1 at pin 6. Fix the reference voltage such that the output remains unchanged during any
false triggering.
In the absence of any sound, the voltage at input pin 2 of IC1 is almost equal to the full
DC voltage and therefore the output of IC1 remains low. Since IC CD4027 is wired in
toggle mode, its output pin 15 is also low. This makes reset pin 4 of IC3 low to reset the
astable multivibrator built around timer 555 (IC3). As a result, tran- sistor T1 is cut-off
and relay RL1 remains de-energised. In de-energised state, both the N/O contacts of
relay RL1, i.e. RL1(a) and RL1(b), remain open. RL1(a) contacts keep the lamp turned
off, whereas RL(b) contact disconnects the output of the astable multivibrator built
around IC 555 (IC4) to disable the speaker.
In the case of any noise, a current flows through the microphone and the voltage at pin 2
reduces to make the output of op-amp IC1 high. IC2 gets triggered by the pulse available
at its pin 13 and its output at pin 15 goes high to enable asta- ble multivibrator IC3. The
output of IC3 goes high for three seconds and then goes low for 1.5 seconds. This repeats
until pin 15 of IC2 remains high. The high output of IC3 energises the relay via driver
transistor T1, while the low output de-energies the relay.
When relay RL1 is energised, relay contact RL1(a) passes on the AC power to bulb B1
and it lights up. At the same time, relay contact RL1(b) allows the output of astable
multivibrator IC4 to the speaker and an audio tone is generated. The frequency of this
audio tone is approximately 480 Hz. Both the flashing of the bulb and the audio tone
continue as long as the output of flip-flop IC2 remains high.
Now if the circuit detects any further sound, the output of flip-flop IC2 goes low. This
makes reset pin 4 of astable multivibrator IC3 low and IC3 stops oscillating. The low
output of IC3 de-energises the relay to turn the bulb and the tone off.
his versatile hit switch is the electronic equivalent of a conventional switch. It can be
used to control
The circuit of the hit switch uses a piezoelectric diaphragm (piezobuzzer) as the hit
sensor. A piezoelectric material develops electric polarisation when strained by an
applied stress. The hit sensor makes use of this property.
When you hit or knock the piezo element (hit plate) with your fingertip,
hit sWitch
T.A. BABu
hanting combines singing and music with mantras. The sweetness of chanting stills the
mind, dissolves worries and opens the heart. Chanting forms an integral part of the
practice schedule at siddha yoga retreats, centres and ashrams. Here are a few
electronic chanting players for some popular mantras and artis.
programmed read-only memory (ROM) chip bonded on a hylam board. (The ROM chip
is a complementary metal-oxide semiconductor (CMOS), large-scale integrated (LSI)
chip.) Known as chip-on-board (COB), these boards are available in differ- ent sizes,
under a blob of epoxy, with chips programmed with single or multiple mantras/artis
such as gayatri mantra, ganapati mantra, krishna mantra, om namah
Fig. 1: The circuit for 3-in-1 mantra player including the power supplys h o w n i n
Fig. 6, Figs 1, 2 and 4, Figs 3 and 5, and Fig. 7, respectively. Some manufacturers make
these COBs with different pad con- figurations, so their specifications should be strictly
followed.
Besides a preprogrammed data ROM, the COBs contain an inbuilt oscillator, counter,
shift register, adaptive differential pulse-code modulation (ADPCM) synthesiser and
digital-to-analogue converter (DAC).
Fig. 2: The COB circuit for 2-in-1 mantra player Fig. 3: The COB circuit for 6-in-1
mantra player
Fig. 4: The COB circuit for 5-in-1 mantra player
Fig. 5: The COB circuit for another 2-in-1 mantra player
oscillator regulate the pace of the mantra and other activity inside the chip. Its frequency
is decided by an external resistor (Rosc) connected between its two input pins. The
controller controls all the activities inside the chip. It sends appropriate signals to the
counter and the shift register to read the data in the ROM. The output of the ROM is fed
back to the controller, which directs it to the ADPCM synthesiser. The synthesiser’s
output is sent to the DAC, which converts it into audio. The audio output from the DAC
is reproduced by the loudspeaker. The potentiometer connected to the input of the
loudspeaker acts as a volume controller.
The COB works off 3V DC and is capa - ble of driving the loudspeaker directly.
Fig. 1 can be divided into power supply and COB sections. The same power supply
section is to be used for the COB circuits shown in Figs 2 through 5 as well. The 3V
power supply for the COB is derived by using a 3V-0-3V center-tapped transformer
(X1). The secondary output of the transformer is applied to a full-wave rectifier
comprising diodes D1 and D2. The output of the full-wave rectifier is filtered by
capacitor C1 to provide 3V DC to the COB.
For 3-in-1 mantra player, connect A and B terminals of the power supply section to the
corresponding points of the COB section as shown in Fig. 1. Then connect 230V AC
mains to the primary of transformer X1. Now the circuit is ready to play.
The desired mantra can be selected by applying positive supply to trigger pin 3 of IC1
by pressing push-to-on switch S1 momentarily. When you press switch S1 for the first
time, “wahe guru” is played. When you press switch S1 second time, “satnam wahe
guru” is played. When you press switch S1 third time, “satnam karta purush” is played.
Using preset VR1, the volume of the sound can be controlled.
For 2-in-1 mantra player, connect the power supply section of Fig. 1 to the COB section
shown in Fig. 2. The desired mantra can be selected by applying positive supply to
trigger pin 3 of IC2 by pressing push-to-on switch S2 momentarily. When you press
switch S2 for the first time, “jai ganesh jai ganesh deva” is played. When you press
switch S2 second time, “aarti kijje hanuman lala ki” is played.
For 6-in-1 mantra player, connect the power supply section of Fig. 1 to the COB section
shown in Fig. 3. The desired mantra can be selected by applying positive supply to
trigger pin 4 of IC3 by pressing push-to-on switch S3 momentarily. When you press
switch 3 for the first time, the circuit starts playing “om bhurbhua swaha” When you
press switch S3 second time, “om namah shivaye” is played. When you press switch S3
third time, “jai ganesh, jai ganesh deva” is played. When you press switch S3 fourth
time, “govind bolo hari gopal bolo” is played. When you press switch S3 fifth time,
“shriman narayan narayan” is played. When you press switch S3 sixth time, “om krishna
yadhamah” is played.
For 5-in-1 mantra player, connect the power supply section of Fig. 1 to the COB section
shown in Fig. 4. When you press switch S4 for the first time, “om bhurbhua swaha” is
played. On consequent press- ing of switch S4, “om namo shivaye,” “jai ganesh, jai
ganesh deva” “jai siya ram” and “govind bolo hari gopal bolo” are played in that order.
For another 2-in-1 mantra player, connect the power supply section of Fig. 1 to the COB
section shown in Fig. 5. When you press switch S5 for the first time, “om bhurbhua
swaha” is played. When switch S5 is pressed second time, “om namah shivaye” is
played.
The circuit for playing a single mantra with loud sound is shown in Fig. 6. The circuit
comprises power supply, COB (shown within dotted lines) and low-power audio
amplifier sections. Low-power audio
Fig. 6: The circuit (including power supply) for playing a single mantra with
amplified sound Fig. 7: The COB circuit for 2-mantra player
amplifier IC LM386 (IC6) is used here to get louder sound.
get louder sound. 6V centre-tapped transformer (X2) instead of the 3V-0-3V centre-
tapped transformer. The secondary output of the transformer is rectified by a full-wave
rectifier com- prising diodes D3 and D4, and filtered by capacitor C4 to provide 6V DC
to the power amplifier (IC6). Zener diode ZD1 in series with resistor R6 reduces the
supply voltage to 3V for the COB section.
Connect all the three sections together by connecting their identical terminals. Then
connect 230V AC mains to the primary of transformer X2. Now the circuit is ready to
work. Simply press switch S6 to provide the power supply to IC6 and IC7 and “om
namah shivaye” start playing loudly. Using preset VR6, you can control the volume of the
sound.
mantra player with loud sound, disconnect the COB circuit shown within dotted lines in
Fig. 6 and replace it with the COB circuit shown in Fig. 7. The desired mantra can be
selected by applying positive supply to trigger pin 15 or 16 of IC8 by changing the
position of switch S7. Note that switch S6 should be kept pressed.
When switch S7 is in position 1, “shri krishanah sharnam namah” is played. The mantra
repeats continuously. To stop it, either release switch S6 or shift switch S7 to position 2.
If you choose to shift switch S7, “shri krishana” stops playing but “hari krishana, hari
krishana” starts playing. The mantra repeats continuously. To stop it, either release
switch S6 or shift switch S7 to position 1.
For ease of construction, assemble a small printed circuit board (PCB) for the amplifier
and power supply circuits. Various types of plastic enclosures for electronic chanting
players are available in the market. Use a suitable enclosure for this player. Take care
while handling and soldering the COBs as the CMOS chips can get damaged due to static
charge.