You are on page 1of 56

7MHz CW/AM QRP TRANSMITTER

D. PRABAHARAN

T
he circuit
of a 7MHz
C W / A M
QRP transmit-
ter described here
can be used to
transmit either
CW or audio fre-
quency modulat-
ed signal over a
7MHz carrier.
The carrier fre-
quency oscillator is
crystal controlled
using 7MHz crystal
in its fundamental
mode. The tank
circuit comprises a
shortwave oscilla-
tor coil which can
be tuned to 7MHz
frequency with the
help of ½J gang
capacitor VC1.
Transistor T2
(with identical tank circuit connected sion line for maximum power transfer. For CW operation, switch S1 is to be
at its collector as in case of transis- Suitable heatsink should be used for kept on for bypassing the audio driver
tor T1) serves as a power amplifier. transistor T2. transformer and Morse key is used
The RF output from oscillator stage Tuning adjustments may be accom- for on/off-type modulation. CW would
is inductively coupled to the power plished using a 6-volt torch bulb. Connect be generated during key depressions.
amplifier stage. The output from power the bulb to the collector of transistor T1 For AF modulation, Morse key points
amplifier is routed via capacitor C3 first through a coupling capacitor and should be closed and switch S1 should
and inductor L3 to a half-wave dipole tune ½J gang VC1 for maximum bril- be flipped to ‘off ’ position.
using a 75-ohm coaxial cable. ½J gang liance. (Note: the bulb would light ac- Any suitable mic. amplifier may be
capacitor VC3 along with inductor L3 cording to intensity of RF energy.) Same used to feed audio input to the audio
forms an antenna tuning and matching procedure may be repeated for power am- driver transformer X1. (For transformer
network between the output of power plifier stage and antenna tuning network X1 you may use the transistor-radio
amplifier stage and coaxial transmis- for ensuring maximum power transfer. type AF driver transformer.)

Reader Comments: Vaibhav Kumar air-core tube using 26 SWG wire.


¨ I request the author for the following Saharanpur The frequency allotted for amateur
clarifications: The author D. Prabaharan, com- radio operators is 7.0 MHz to 7.1 MHz.
1. Please indicate the construction ments: Hence, any crystal available within this
details of coils L1 and L3 as well as the In reply to the above queries, I frequency can be used. Range of this QRP
inductor which is connected in parallel would like to say that the transistor T1 transmitter depends on propagation condi-
to VC2. is BF495. Power output of this circuit is tions. If conditions are good, the range is
2. Can we use any other crystal in about 150mW. It can be further increased about 500 kms in the CW mode and 100
place of 7MHz crystal? by using separate power supply for the kms in the AM mode.
M.A. Kamal power-amplifier stage (24V, 1A). It is possible to convert this transmit-
Guwahati The coil details are as follows— L1 is ter to 20-meter HAM band. Any crystal
¨ What is the range of this transmit- short-wave oscillator coil; L2:14 turns on available from 14 MHz to 14.350 MHz
ter and what is the output power of this 1cm-diameter air-core tube using 26 SWG range can be used for the purpose. How-
circuit? wire; L3 has 12 turns on 1.5cm-diameter ever, this conversion needs following

198 ELECTRONICS PROJECTS Vol. 19


modifications on coils L1, L2 and L3—L1: connected in-between the positive of the x 250mA
shortwave oscillator coil; L2: 11 turns on supply and the modulation transformer. = 6watt (the power amplifier draws
1cm-diameter air-core tube using 26 SWG Adjust VC1, VC2 and VC3 for maximum 250mA current).
wire; L3: 9½ turns on 1cm-diameter air- current through ammeter (CW-200mA, DC power input (AM mode) = 24V x
core tube using 28 SWG wire. AM-125mA). The power input in CW and 120mA
An ammeter with a range 0-250mA AM mode is calculated as shown below: = 2.8watt (the power amplifier draws
or a multimeter with 0-250mA can be DC power input (CW mode) = 24V 120mA current).

ELECTRONICS PROJECTS Vol. 19 199


A HIERARCHICAL PRIORITY ENCODER
A
normal priority encoder encodes (active-‘low’). Thus Lp=0 and Lq=0. All ment of Lp = 1. All other L’s are not
only the highest-order data line. lines above Lp and also between Lp and changed because the corresponding M’s
But in many situations, not only Lq (denoted as Lj) are at logic 1. All lines are all 1’s. Thus data lines N0 through N7
the highest but the second-highest below Lq logic state are irrelevant, i.e. are same as L0 through L7, except that
priority information is also needed. The ‘don’t care’. Here p is the highest-priority the highest-priority level in L0 through
circuit presented here encodes both value and q the second-highest-priority L7 is cancelled in N0 through N7.
the highest-priority information as well value. (Obviously, q has to be lower than The highest-priority level in N0
as the second-highest priority information p, and the minimum possible value for p through N7 is the second-highest priority
of an 8-line incoming data. The circuit is taken as ‘1’.) leftover from L0 through L7, i.e. Nq=0 and
uses the standard octal priority encoder Priority encoder IC1 generates binary Nj=1 for q<j≤7. Now these N lines are ap-
74148 that is an 8-line-to-3-line (4-2-1) output F2, F1, F0, which represents the plied to priority encoder 2 (IC3) to gener-
binary encoder with active-‘low’ data in- value of p in active-‘low’ format. The ate S2, S1, S0, which represent q. Thus
puts and outputs. complemented F2, F1, and F0 are ap- the second-highest priority value is ex-
The first encoder (IC1) generates the plied to 3-line-to-8-line (one out of eight tracted. Through cascading one can re-
highest-priority value, say, F. The active- outputs is active-‘low’) decoder 74138. Let cover the third-highest priority, and so on.
‘low’ output (A0, A1, A2) of IC1 is in- the output lines of 74138 be denoted as For example, let L0 through L7 = X X
verted by gates N9 through N11 and fed M0 through M7. Now only one line is X 0 1 1 0 1. Here the highest ‘0’ line is L6
to a 3-line-to-8-line decoder (74138) that active-‘low’ among M0 through M7, and and the next highest is L3 (X denotes
requires active-‘high’ inputs. The decoded that is Mp (where the value of p is ex- ‘don’t care’). Thus p=6 and q=3. Now the
outputs are active-‘low’. The decoder iden- plained as above). Therefore the logic level active-‘low’ output of the first priority en-
tifies the highest-priority data line and of line Mp is ‘0’ and that of all other M coder will be F2 F1 F0 = 0 0 1. The input

that data value is cancelled using XNOR lines ‘1’. to 74138 is 1 1 0 and it outputs M0
gates (N1 through N8) to retain the sec- The highest-priority line is cancelled through M7 = 1 1 1 1 1 1 0 1. Since M6=0,
ond-highest priority value that is gener- using eight XNOR gates as shown in the only L6 is complemented by XNOR gates.
ated by the second encoder. figure. Let the output lines from XNOR Thus the outputs of XNORs are N0
To understand the logic, let the in- gates be N0 through N7. Consider inputs through N7 = X X X 0 1 1 1 1. Now N3=0
coming data lines be denoted as L0 to L7. Lp and Mp of the corresponding XNOR and the highest priority for ‘N’ is 3. This
Lp is the highest-priority line (active-‘low’) gate. Since Mp = 0 and also Lp = 0, the value is recovered by priority encoder 2
and Lq the second-highest priority line output of this XNOR gate is Np = comple- (IC3) as S2 S1 S0 = 1 0 0.

ELECTRONICS PROJECTS Vol. 22


ACCURATE ELECTRONIC
STOP-WATCH
H
ere is a simple circuit which counter) IC to obtain a final frequency of either 99.99 seconds or 999.9 seconds
can be used as an accurate 100 Hz or 10 Hz. Due to the use of crystal, maximum count.
stop-watch to count up to 100 the final frequency is very accurate. For proper operation, first press
seconds with a resolution of 0.01 second The output of IC4 (7490) is counted switch S3 (reset) and then operate switch
or up to 1000 seconds with a resolution of and displayed using IC5 74C926 (4-digit S2, according to the resolution/range
0.1 second. This stop-watch can be used for counter with multiplexed 7-segment LED desired (0.1 sec. or 0.01 sec.)/(100 seconds
sports and similar other activities. driver). Due to multiplexed display the or 1000 seconds). Now to start counting,
A 1MHz crystal generates stable power consumption is very low. Switch S2 press switch S1. To stop counting, press
frequency which is divided by two stages (2-pole, 2-way) is used to select appropri- switch S1 again. The counting will stop
of 74390 ICs (dual decade counter) and ate input frequency and corresponding and display will show the correct time
another stage employing 7490 (decade decimal point position to display up to elapsed since the start of counting.

ELECTRONICS PROJECTS Vol. 19 195


CMYK

CIRCUIT
IDEAS

ATMEL AVR ISP DONGLE SANI TH


EO

„ EFY LAB grammed is sent on this pin parallel port.


3. SCK (Shift Clock): Serial clock IC 74LS244 (IC1) acts as a buffer as

A
tmel’s AVR microcontroller generated by the programmer from the well as an isolator circuit when the
chips are in-system program- PC. AVR is not in programming mode. In
mable (ISP), i.e. these can be 4. RST (Reset): Reset (low pulse) idle mode, all the outputs are tristated
programmed directly in the target cir- generated by the program. The AVR so as not to affect the operation of the
cuit. A special programmer software is programmed while in reset state. target system.
is used to download the program from Here’s a dongle circuit for in-sys- When the AVR’s ISP mode is se-
the PC into the AVR’s flash memory. tem programming of Atmel’s AVR chip lected, the lower half of IC 74LS244
Atmel offers a software package called AT90S8515 using such software pack- is enabled, pulling the target system’s
the Atmel AVR ISP that allows pro- ages as Atmel ISP 2.65 and Reset line low. Once the target
gramming of the AVR microcontrollers PonyProg2000. Though not exactly the system is in Reset mode, the SCK,
in the circuit using a simple dongle. A same, a similar dongle circuit can be MISO and MOSI lines are no longer
dongle is nothing but an adaptor cable found at the Website ‘www.iready.org/ loaded by the peripheral circuitry, if
that connects the PC’s parallel port projects/uinternet/ispdongle.pdf.’ any, on the target system. Now, it is
with the ISP pins of the AVR chip for The PC’s parallel-port pins 4 and safe to enable the upper half of
programming. 5 drive buffer IC 74LS244 by enabling 74LS244, driving the MOSI, LED and
For programming, the four lines re- its pins 19 and 1, respectively. A low SCK lines of the dongle. The RST pin
quired from the AVR chip to the ISP pulse on these pins will allow the becomes high after the AVR is pro-
adaptor (dongle) are: passing of the serial clock and data grammed. Glowing of LED2 indicates
1. MOSI (Master Out, Slave In): during programming. MOSI, LED, that the AVR is in programming mode.
Data being transmitted to the AVR be- SCK and RST outputs are buffered There are two standard connectors
ing programmed is sent on this pin from the parallel port’s pins 7, 8, 6 for in-system programming of Atmel
2. MISO (Master In, Slave Out): and 9, respectively. The MISO input AVR microcontroller. One is the 10-
Data received from the AVR being pro- from the AVR is fed into pin 10 of the pin header (dual-in-line (DIL) connec-

100 • FEBRUARY 2005 • ELECTRONICS FOR YOU WWW.EFYMAG.COM


CMYK

CIRCUIT
IDEAS
tor)) used on the Atmel STK kits. The the dongle is identified as a value- 6-line cable of about 30cm length is
other is a 6-pin header (DIL connec- added pack dongle. required for connecting this ISP adap-
tor) used in Atmel ISPs. The two loop- Here, we’ve used an 8-pin single-in- tor (dongle) to the target circuit.
back connections, pin 2-to-pin 12 and line (SIL) connector and an additional If the AVR is not on the target cir-
pin 3-to-pin 11 of the parallel port, are 6-pin SIL connector for the Atmel pro- cuit, you can insert the AVR into the
used to identify the dongle. With only gramer circuit. With the buffer and the ZIF socket and program it. Regulated
pin 2-to-pin 12 link, the dongle is 40-pin ZIF socket in this circuit, it can be 5V DC is required for the AVR and
called STK300 or AVR ISP dongle. used as a standalone programmer. The the associated dongle circuit, whose
With only pin 3-to-pin 11 link, the 6-pin SIL male connector is used for terminals are also provided in connec-
dongle is called STK200 or old Kanda connection between the dongle and the tor CON4. LED1 is used as the power
ISP dongle. With both links in place, AVR on the target board. Thus, another indicator for the circuit. z

WWW.EFYMAG.COM ELECTRONICS FOR YOU • FEBRUARY 2005 • 101


CMYK

CIRCUIT
IDEAS

AUDIO AMPLIFIER FOR S.C. DW


IVEDI

PERSONAL STEREO
„ M. VENK ATESWAR AN
TESWARAN pushpull amplifier, each transistor (T2 tor T2 and R5 and R7 for transistor
or T3) gets double the voltage when T3) so that the acceptable output

I
n the output stages of most broad- activated. without overheating is obtained.
cast receivers and some amplifiers, Connect the low audio signal from You can also replace these transistors
there is a limit up to which maxi- the stereo system at input terminals A with another pair of suitable high-
mum power can be developed with- and B of the audio amplifier and pro- power transistors.
out distortion. In the widely accepted vide mains AC to activate the circuit. For driving transistors T2 and T3,
output circuit, two output transistors During the first half cycle of an AF a 9V audio driver transformer having
are connected in series between the cycle, transistor T2 conducts and the six leads is used. It is readily available
positive and ground and biasing is ad- current flows from positive rail to in the market and reasonably matches

justed so that each transistor gets half ground rail (centre tap of transformer the output and input impedances of
the supply voltage. X1) via the loudspeaker coil (connected the preceeding and succeeding stages.
The circuit presented here is a between the emitter of transistor T2 To test the quality of the audio
simple audio amplifier for a personal and ground) in one direction. While output, connect the stereo’s outputs
stereo system. In this, supply voltage in the second half cycle, transistor T3 to the respective terminals A and B.
to each transistor can be enhanced to conducts and the current flows from Now increase the volume level of
produce a larger output. The audio ground rail to negative rail via the the stereo slowly. If you get a
driver transformer drives the transis- loudspeaker coil (connected between high-level, high-quality sound across
tors adequately. ground and the collector of transistor loudspeaker L1, the amplifier is
A 9V-0-9V, 300mA transformer has T3) in a direction opposite to the pre- working well. If the sound quality is
been used in the set-up. Out of vious flow. not good, decrease the volume level
the four diodes (D1 through D4), two Transistors T2 and T3 of the until the audio amplifier gives good
are used for developing the positive pushpull audio amplifier should results.
voltage rail (+9V) and the other be matched correctly. If these transis- Note that this audio amplifier
two are used for developing the tors get heated, change the bleeding works well for low-level audio
negative voltage rail (–9V). In the resistor pairs (R3 and R4 for transis- signals. z

76 • JANUARY 2005 • ELECTRONICS FOR YOU WWW.EFYMAG.COM


Auto Reset Over/Under
Voltage Cut-Out
J. Gopalakrishnan

T
his over/under voltage cut-out very low mains voltages. inside 555 timer ICs. Supply is tapped
will save your costly electrical The circuit features auto reset and from different points of the power sup-
and electronic appliances from utilises easily available components. It ply circuit for relay and control circuit
the adverse effects of very high and makes use of the comparators available operation to achieve reliability.

7 is therefore serving that LED2 just extinguishes


off. The out- when the mains voltage is slightly
put (at pin 3) less than 270V AC. With RESET
reverses (goes pin 4 of IC2 high, the output pin 3 is
low) when pin also high. As a result transistor T2
2 is taken more conducts and energises relay RL1,
positive than connecting load to power supply via
1/3 Vcc. At the its N/O contacts. This is the situation
same time pin as long as mains voltage is greater
7 goes low (as than 160V AC but less than 270V AC.
Q output of in- When mains voltage goes beyond
ternal flip-flop 270V AC, it causes output pin 3 of
is high) and IC2 to go low and cut-off transistor T2
the ED con- and de-energise relay RL1, in spite of
nected to pin 7 RESET pin 4 still being high. When
is lit. Both tim- mains voltage goes below 160V AC,
ers (IC1 and IC1’s pin 3 goes high and LED1 is
IC2) are config- extinguished. The high output at pin 3
The circuit utilises comparator 2 ured to function in the same fashion. results in conduction of transistor T1.
for control while comparator 1 output Preset VR1 is adjusted for under As a result collector of transistor T1
(connected to reset pin R) is kept low voltage (say 160 volts) cut-out by ob- as also RESET pin 4 of IC2 are pulled
by shorting pins 5 and 6 of 555 IC. The serving that LED1 just lights up when low. Thus output of IC2 goes low
positive input pin of comparator 2 is mains voltage is slightly greater than and transistor T2 does not conduct.
at 1/3rd of Vcc voltage. Thus as long as 160V AC. At this setting the output at As a result relay RL1 is de-energised,
negative input pin 2 is less positive pin 3 of IC1 is low and transistor T1 is which causes load to be disconnected
than 1/3 Vcc, comparator 2 output is in cut-off state. As a result RESET pin from the supply. When mains volt-
high and the internal flip-flop is set, 4 of IC2 is held high since it is connect- age again goes beyond 160V AC (but
i.e. its Q output (pin 3) is high. At ed to Vcc via 100 kilo-ohm resistor R4. less than 270V AC) the relay again
the same time pin 7 is in high imped- Preset VR2 is adjusted for over energises to connect the load to power
ance state and LED connected to pin voltage (say 270V AC) cut-out by ob- supply.

128 ELECTRONICS PROJECTS Vol. 20


CMYK

CIRCUIT
IDEAS

AUTO TURN-OFF S.C. DW


IVEDI

BATTERY CHARGER
„ Y.M. ANANDAVARDHANA to energise electromagnetic relay RL1. Pushing switch S1 latches relay
Relay RL1 is connected to the collec- RL1 and the battery cells start charg-

T
his charger for series-connected tor of transistor T1. Transistor T1 is ing. As the voltage per cell increases
4-cell AA batteries automatically driven by pnp transistor T2, which, in beyond 1.3V, the voltage drop across
disconnects from mains to stop turn, is driven by pnp transistor T3. resistor R4 starts decreasing. When it
charging when the batteries are fully Resistor R4 (10-ohm, 0.5W) is con- falls below 650 mV, transistor T3 cuts
charged. It can be used to charge par- nected between the emitter and base off to drive transistor T2 and, in turn,
tially discharged cells as well. of transistor T3. cuts off transistor T3. As a result, re-
The circuit is simple and can be When a current of over 65 mA lay RL1 de-energises to cut off the
divided into AC-to-DC converter, relay flows through the 12V line, it causes a charger and red LED1 turns off.

driver and charging sections. voltage drop of about 650 mV across You may determine the charging
In the AC-to-DC converter section, resistor R4 to drive transistor T3 and voltage depending on the NiCd cell
transformer X1 steps down mains 230V cut off transistor T2. This, in turn, turns specifications by the manufacturer.
AC to 9V AC at 750 mA, which is rec- transistor T1 ‘on’ to energise relay RL1. Here, we’ve set the charging voltage
tified by a full-wave rectifier compris- Now even if the pushbutton is re- at 7.35V for four 1.5V cells. Nowadays,
ing diodes D1 through D4 and filtered leased, mains is still available to the 700mAH cells are available in the mar-
by capacitor C1. Regulator IC LM317 primary of the transformer through its ket, which can be charged at 70 mA
(IC1) provides the required 12V DC normally open (N/O) contacts. for 10 hours. The open-circuit voltage
charging voltage. When you press In the charging section, regulator is about 1.3V.
switch S1 momentarily, the charger IC1 is biased to give about 7.35V. Pre- The shut-off voltage point is deter-
starts operating and the power-on set VR1 is used for adjusting the bias mined by charging the four cells fully
LED1 glows to indicate that the voltage. Diode D6 connected between (at 70 mA for 14 hours). After measur-
charger is ‘on.’ the output of IC1 and battery limits ing the output voltage, add the diode
The relay driver section uses pnp the output voltage to about 6.7V, drop (about 0.65V) and bias LM317 ac-
transistors T1, T2 and T3 (each BC558) which is used for charging the battery. cordingly. z

96 • FEBRUARY 2005 • ELECTRONICS FOR YOU WWW.EFYMAG.COM


Automatic Dual-
output Display
T
his circuit lights up ten bulbs an oscillator. The output of this oscillator During count up operation, pin 7 of IC2
sequentially, first in one direction is used as a clock for BCD up/down coun- outputs an active low pulse on reaching
and then in the opposite direction, ter CD4510 (IC2). the ninth count. Similarly, during count-
thus presenting a nice visual effect. Depending on the logic state at its down operation, you again get a low-going
In this circuit, gates N1 and N2 form pin 10, the counter counts up or down. pulse at pin 7.

This terminal count output from pin Initially, pin 3 (Q0) of IC3 is high nected to 1-of-10 decoder CD4028 (IC4).
7, after inversion by gate N3, is con- and the counter is in count-up state. On During count-up operation of IC2, the
nected to clock pin 14 of decade counter reaching ninth count, pin 3 of IC3 goes outputs of IC4 go logic high sequentially
IC3 (CD4017) which is configured here low and as a result IC2 starts counting from Q0 to Q9 and thus trigger the tri-
as a toggle flip-flop by returning its Q2 down. When the counter reaches 0 count, acs and lighting bulbs 1 through 10,
output at pin 4 to reset pin 15. Thus Q2 output of IC3 momentarily goes high to one after the other. Thereafter, during
output at pin 3 of IC3 goes to logic 1 and reset it, thus taking pin 3 to logic 1 state, count-down operation of IC2, the bulbs
logic 0 state alternately at each terminal and the cycle repeats. light in the reverse order, presenting a
count of IC2. The BCD outputs of IC2 are con- wonderful visual effect.

ELECTRONICS PROJECTS Vol. 20


CIRCUIT
IDEAS

AUTOMATIC EMERGENCY LIGHT S.C. DW


IVEDI

 PRIYANK MUDGAL stepped down by transformer X1, rec- former output is fed to the collector of
tified by a full-wave rectifier compris- transistor T1, which provides a fixed

T
his emergency light has the ing diodes D1 and D2, filtered by ca- bias voltage of 6.8V to charge the bat-
following two advantages: pacitor C1 and fed to relay coil RL1. tery. When the battery is fully charged,
1. It turns on automatically The relay energises to connect the bat- the battery voltage becomes equal to
the breakdown voltage
of the zener diode
(ZD1). Zener diode ZD1
conducts to provide an
alternative path for the
current to ground and
battery charging stops.
When mains fails,
relay RL1 de-energises.
The battery now gets
connected to the white
LED array (comprising
LED1 through LED6)
through current-limit-
ing resistor R2. The
when the mains power fails, so you tery to the charging circuit through its LEDs glow to light up the room. To
need not search it in the dark. normally-opened (N/O) contacts. Free- increase the brightness in your room,
2. Its battery starts charging as soon wheeling diode D3 acts as a spike you can increase the number of white
as the mains resumes. buster for the relay. LEDs after reducing the value of resis-
Operation of the circuit is quite The charging circuit is built around tor R2 and also use a reflector assem-
straightforward. Mains supply is npn transistor BD139 (T1). The trans- bly. 

114 • MARCH 2007 • ELECTRONICS FOR YOU WWW.EFYMAG.COM


AUTOMATIC EMERGENCY TORCH
J
ust don’t think that this is yet
another addition to other emer-
gency light circuits published in
EFY earlier. This circuit is a hit different.
Its main features are:
1. Very reliable operation.
2. As transformer is not used, it is
compact and cost-effective.
3. The torch bulb glows automatically
at power off and goes out on restoration
of power.
4. Since Ni-Cd battery is used, no
maintenance is required. Also, battery life
is very long, nearly 4-5 years (though this
depends on frequency of usage and also on
ampere-hour rating of the battery used).
Sounds interesting, doesn’t it? Read on
then. The circuit is very simple, compris- charges the battery through resistor R4 and 3. Collector voltage must be 2.0V
ing just a handful of components. This LED D5 combination at about 50mA rate. to 2.2V, i.e. nearly equal to the battery
implies that the circuit operation also is The glowing LED (D5) also gives an indica- voltage.
very simple. The circuit consists of two tion of mains presence. Further, due to the All above voltages should be checked
parts: LED (D5), base of transistor T1 is about with AC mains off. If any of the above-
1. Power supply for charging the Ni- 1.6V (drop across D5) more positive than its mentioned voltages is absent it indicates
Cd battery. emitter. This voltage is more than sufficient that the transistor is bad and it should be
2. Switchover circuit which detects to keep the transistor at cut-off. replaced by a good one.
mains failure and switches the bulb ‘on’. As soon as the mains voltage fails, the Here is a word of caution now. Since
In the power supply section, capacitors base of transistor T1 is pulled low through the circuit is not isolated from AC mains. it
C1 and C2 function as non-dissipating, re- resistor R3 which drives transistor T1 to may be hazardous to touch any component
active impedances which limit the current saturation thereby turning the bulb ‘on’. when the mains supply is on, especially
to a safe value. With the values of capaci- Since the transistor is in its saturated if the supply wires (live and neutral) get
tors as shown, the maximum current that state, the voltage drop across it is very interchanged. It is strongly recommended
can be drawn is limited to about 70 mA low. Hence the bulb glows with full bril- to use an all-plastic enclosure (including
at 230V AC. Resistor R2 limits the initial liance. The bulb can be switched off by the reflector for the bulb) for the circuit.
surge current and resistor R1 assists in the ON/OFF switch, when not required. Also the ON/OFF switch used should have
discharging the capacitors after switch off. With this bulb (2.2V, 250mA) the torch can a plastic lever. Take proper care and pre-
Diodes D1 through D4 form a conventional work continuously for about two hours. cautions while building, testing and using
bridge rectifier while capacitor C3 is the The batteries should be charged for about the circuit, and never ever allow the supply
filter capacitor. Fuse F1 is for protection 14 hours after they are discharged. wires to interchange. It is advisable to pro-
and is very helpful in the event of any You can verify following voltages in vide a plug for the mains input on the box
component giving up the ghost. This sup- the circuit: itself so that it can be plugged directly into
ply charges the battery as long as mains 1. Base voltage of the transistor must a mains outlet. This reduces the chances of
is present. be 1.8V to 2.0V, i.e. about 0.6V less than mains supply wires getting interchanged.
In the ‘switchover’ section, transistor the battery voltage. With proper precautions and a little
T1 is used as switch. Normally, when AC 2. Emitter voltage must be equal to the care, it is hoped that this small circuit will
mains supply is present, the rectifier output battery voltage. help make life a bit more comfortable.

178 ELECTRONICS PROJECTS Vol. 19


Automatic Room Power
Control
A
n ordinary automatic room power
control circuit has only one light
sensor. So when a person enters
the room it gets one pulse and the lights
come ‘on.’ When the person goes out it gets
another pulse and the lights go ‘off.’ But
what happens when two persons enter
the room, one after the other? It gets two
pulses and the lights remain in ‘off’ state.
The circuit described here overcomes
the above-mentioned problem. It has a
small memory which enables it to auto-
matically switch ‘on’ and switch ‘off’ the
lights in a desired fashion.
The circuit uses two LDRs which are
placed one after another (separated by a
distance of say half a metre) so that they
may separately sense a person going into
the room or coming out of the room.
Outputs of the two LDR sensors, after
processing, are used in conjunction with a
bicolour LED in such a fashion that when
a person gets into the room it emits green
light and when a person goes out of the
room it emits red light, and vice versa.
These outputs are simultaneously applied
to two counters.
One of the counters will count as +1,
+2, +3 etc when persons are coming into
the room and the other will count as -1,
-2, -3 etc when persons are going out
of the room. These counters make use
of Johnson decade counter CD4017 ICs.
The next stage comprises two logic ICs
which can combine the outputs of the two
counters and determine if there is any
person still left in the room or not.
Since in the circuit LDRs have been
used, care should be taken to protect them
from ambient light. If desired, one may
use readily available IR sensor modules
to replace the LDRs. The sensors are in-
stalled in such a way that when a person
enters or leaves the room, he intercepts
the light falling on them sequentially—one
after the other.
When a person enters the room, first
he would obstruct the light falling on
LDR1, followed by that falling on LDR2.
When a person leaves the room it will be
the other way round.
In the normal case light keeps fall-
ing on both the LDRs, and as such their
resistance is low (about 5 kilo-ohms). As a

ELECTRONICS PROJECTS Vol. 20


result, pin 2 of both timers (IC1 and IC2), pair T1-T2 conducts because capacitor C5 through N4) are ANDed by AND gates
which have been configured as monostable retains the charge for some time as its (A1 through A4) and then wire ORed
flip-flops, are held near the supply voltage discharge time is controlled by resistor (using diodes D5 through D8). The net
(+9V). R5 (and R7 to an extent). Thus green LED effect is that when persons are entering,
When the light falling on the LDRs portion of bi-colour LED is lit momentar- the output of at least one of the AND
is obstructed, their resistance becomes ily. gates is high, causing transistor T5 to
very high and pin 2 voltages drop to near The same output is also coupled to IC3 conduct and energise relay RL1. The bulb
ground potential, thereby triggering the for which it acts as a clock. With entry of connected to the supply via N/O contact of
flip-flops. Capacitors across pin 2 and each person IC3 output (high state) keeps relay RL1 also lights up.
ground have been added to avoid false advancing. At this stage transistor pair When persons are leaving the room,
triggering due to electrical noise. T3-T4 cannot conduct because output pin and till all the persons who entered the
When a person enters the room, 3 of IC1 is no longer positive as its output room have left, the wired OR output
LDR1 is triggered first and it results in pulse duration is quite short and hence continues to remain high, i.e. the bulb
triggering of monostable IC1. The transistor collectors are in high imped- continues to remains ‘on,’ until all persons
short output pulse immediately charges ance state. who entered the room have left.
up capacitor C5, forward biasing transis- When persons leave the room, LDR2 The maximum number of persons
tor pair T1-T2. But at this instant the is triggered first, followed by LDR1. that this circuit can handle is limited to
collectors of transistors T1 and T2 are in Since the bottom half portion of circuit is four since on receipt of fifth clock pulse
high impedance state as IC2 pin 3 is at low identical to top half, this time, with the the counters are reset. The capacity of
potential and diode D4 is not conducting. departure of each person, red portion of bi- the circuit can be easily extended to
But when the same person pass- colour LED is lit momentarily and output handle up to nine persons by removing
es LDR2, IC2 monostable flip-flop is of IC4 advances in the same fashion as in the connection of pin 1 from reset pin (15)
triggered. Its pin 3 goes high and this case of IC3. and utilising Q1 to Q9 outputs of CD4017
potential is coupled to transistor pair The outputs of IC3 and those of IC4 counters. Additional inverters, AND gates
T1-T2 via diode D4. As a result transistor (after inversion by inverter gates N1 and diodes will, however, be required.

ELECTRONICS PROJECTS Vol. 20


CIRCUIT IDEAS

AUTOMATIC SCHOOL BELL S.C. DWI


VED
I

RAJ KUMAR MONDAL (IC2 and IC3) and AND gate CD4081 (IC4). gate. When SCR1 is fired, it provides
Timer IC1 is wired as an astable ground path to operate the circuit after

C
onsider that a school has a total of multivibrator, whose clock output pulses resetting both decade counters IC2 and
eight periods with a lunch break are fed to IC2. IC2 increases the time IC3. At the same time, LED1 glows to in-
after the fourth period. Each period periods of IC1 (4.5 and 3 minutes) by ten dicate that school bell is now active.
is 45 minutes long, while the duration of times to provide a clock pulse to IC3 ev- When switch S2 is pressed momen-
the lunch break is 30 minutes. ery 45 minutes or after 30 minutes, re- tarily, the anode of SCR1 is again
To ring this automatic school bell to spectively. When the class periods are go- grounded and the circuit stops operating.
start the first period, the peon needs to ing on, the outputs of IC3 switch on tran- In this condition, both LED1 and LED2
momentarily press switch S1. Thereafter, sistors T1 and T2 via diodes D4 through don’t glow.
the bell sounds every 45 minutes to indi- D12. When the eighth period is over, Q9
cate the end of consecutive periods, ex- Resistors R4 and R5 connected in se- output of IC3 goes high. At this time, tran-
cept immediately after the fourth period, ries to the emitter of npn transistor T2 sistors T1 and T2 don’t get any voltage

when it sounds after 30 minutes to indi- decide the 4.5-minute time period of IC1. through the outputs of IC2. As a result, the
cate that the lunch break is over. When The output of IC1 is further connected to astable multivibrator (IC1) stops working.
the last period is over, LED2 glows to in- pin 14 of IC2 to provide a period with a The school bell sounds for around 8
dicate that the bell circuit should now be duration of 45 minutes. Similarly, resis- seconds at the end of each period. One
switched off manually. tors R2 and R3 connected in series to the can increase/decrease the ringing time of
In case the peon has been late to start emitter of npn transistor T1 decide the 3- the bell by adding/removing diodes con-
the school bell, the delay in minutes can minute time period of IC1, which is fur- nected in series across pins 6 and 7 of
be adjusted by advancing the time using ther given to IC2 to provide the lunch- IC1.
switch S3. Each pushing of switch S3 ad- break duration of 30 minutes. The terminals of the 230V AC
vances the time by 4.5 minutes. If the Initially, the circuit does not ground electric bell are connected to the nor-
school is closed early, the peon can turn to perform its operation when 12V power mally-open (N/O) contact of relay RL1.
the bell circuit off by momentarily press- supply is given to the circuit. The circuit works off a 12V regulated
ing switch S2. When switch S1 is pressed momen- power supply. However, a battery source
The bell circuit contains timer IC tarily, a high enough voltage to fire sili- for back-up in case the power fails is also
NE555 (IC1), two CD4017 decade counters con-controlled resistor SCR1 appears at its recommended.

ELECTRONICS FOR YOU OCTOBER 2004


AUTOMATIC SPEED-CONTROLLER
FOR FANS AND COOLERS
D
uring summer nights, the tem- shall get AC supply directly, and so it shall high, while at low speed, it will run for a
perature is initially quite high. run at top speed. When output Q2 becomes much longer time period when any of the
As time passes, the temperature high and Q1 becomes low, relay RL1 is four outputs Q5 through Q8 is high.
starts dropping. Also, after a person falls turned ‘off’ and relay RL2 is switched ‘on’. If one wishes, one can make the fan
asleep, the metabolic rate of one’s body The fan gets AC through a resistance and run at the three speeds for an equal amount
decreases. Thus, initially the fan/cooler its speed drops to medium value. This con- of time by connecting three decimal
needs to be run at full speed. As time tinues until output Q4 is high. When Q4 decoded outputs of IC3 to each of the
passes, one has to get up again and again goes low and Q5 goes high, relay RL2 is transistors T1 to T3. One can also get
to adjust the speed of the fan or the cooler. switched ‘off’ and relay RL3 is activated. more than three speeds by using an
The device presented here makes the The fan now runs at low speed. additional relay, transistor, and associated
fan run at full speed
for a predetermined
time. The speed is
decreased to medium
after some time, and
to slow later on. Af-
ter a period of about
eight hours, the fan/
cooler is switched off.
Fig. 1 shows the
circuit diagram of
the system. IC1 (555)
is used as an astable
multivibrator to
generate clock
pulses. The pulses
are fed to decade
dividers/counters
formed by IC2 and
IC3. These ICs act as

Throughout the process, pin


11 of the IC3 is low, so T4 is cut
off, thus keeping T5 in satura-
tion and RL4 ‘on’. At the end of
the cycle, when pin 11 (Q9) be-
comes high, T4 gets saturated
and T5 is cut off. RL4 is switched
‘off’, thus switching ‘off’ the fan/
cooler.
divide-by-10 and divide-by-9 counters, Using the circuit described above, the components, and connecting one or more
respectively. The values of capacitor C1 fan shall run at high speed for a com- outputs of IC3 to it.
and resistors R1 and R2 are so adjusted paratively lesser time when either of Q0 In the motors used in certain coolers
that the final output of IC3 goes high or Q1 output is high. At medium speed, it there are separate windings for separate
after about eight hours. will run for a moderate time period when speeds. Such coolers do not use a rheostat
The first two outputs of IC3 (Q0 and any of three outputs Q2 through Q4 is type speed regulator. The method of
Q1) are connected (ORed) via diodes D1 connection of this device to such coolers is
and D2 to the base of transistor T1. Ini- given in Fig. 4.
tially output Q0 is high and therefore The resistors in Figs 2 and 3 are the
relay RL1 is energised. It remains tapped resistors, similar to those used in
energised when Q1 becomes high. The manually controlled fan-speed regulators.
method of connecting the gadget to the Alternatively wire-wound resistors of
fan/cooler is given in Figs 3 and 4. suitable wattage and resistance can be
It can be seen that initially the fan used.

194 ELECTRONICS PROJECTS Vol. 21


AUTOMATIC TEMPERATURE
CONTROLLED FAN
H
ere is a circuit through which the D1 combination is used for generating power delivered to fan (load).
speed of a fan can be linearly con- reference voltage as we want to am- The circuit has a high sensitivity and
trolled automatically, depending plify only change in voltage due to the the output RMS voltage (across load) can
on the room temperature. The circuit is change in temperature. be varied from 120V to 230V (for a temp.
highly efficient as it uses thyristors for Op-amp µA741 (IC2) works as a range of 22°C to 36°C), and hence wide
power control. Alternatively, the same comparator. One input to the compara- variations in speed are available. Also
circuit can be used for automatic tempera- tor is the output from the instrumen- note that speed varies linearly and not
ture controlled AC power control. tation amplifier while the other input in steps. Besides, since an optocoupler is
In this circuit, the temperature sensor is the stepped down, rectified and used, the control circuit is fully isolated
used is an NTC thermistor, i.e. one having suitably attenuated sample of AC volt- from power circuit, thus providing added
a negative temperature coefficient. The age. This is a negative going pulsating safety. Note that for any given tempera-
value of thermistor resistance at 25°C is DC voltage. It will be observed that ture the speed of fan (i.e. voltage across
about 1 kilo-ohm. with increase in temperature, pin 2 of load) can be adjusted to a desired value
Op-amp A1 essentially works as IC2 goes more and more negative and by adjusting potmeters VR1 and VR2
I to V (current-to-voltage) converter hence the width of the positive going appropriately.
and converts temperature variations output pulses (at pin 6) increases lin- Potmeter VR1 should he initially kept
into voltage variations. To amplify early with the temperature. Thus IC2 in its mid position to realise a gain of ap-
the change in voltage due to change in functions as a pulse width modulator proximately 40 from the instrumentation
temperature, instrumentation ampli- in this circuit. The output from the amplifier. It may be subsequently trimmed
fier formed by op-amps A2, A3 and A4 comparator is coupled to an optocou- slightly to obtain linear variation of the
is used. Resistor R2 and zener diode pler, which in turn controls the AC fan speed.

ELECTRONICS PROJECTS Vol. 19 189


CD-ROM Drive as Digital
-audio CD-Player
A
CD-ROM drive can be used as a
stand-alone unit for playing dig-
ital audio CDs without interfacing
with a computer. The stereo output of
CD player available at the audio jack
can be amplified using audio input fa-
cility which is normally available on a
tape-deck/tape-recorder or a stereo
amplifier. Audio socket on front/rear of
the CD-ROM drive is capable of driving
headphones or speakers of less than 500
mW. Proper stereo jacks for interconnec-
tion between CD-ROM drive and tape
deck are available from computer/tape
recorder spares vendors. The principle of
operation is illustrated here with the help
of block diagram.
The 4-pin power supply socket avail-
able at the rear of a CD-ROM player is
meant for +5V, ground (two middle pins)
and +12V inputs. The power supply can be since it has self-contained power supply is routed using a yellow wire and
easily derived using a conventional power circuit inside. for +5V a red wir is used, while for
supply circuit as shown in the figure. If While there may be minor differ- ground black wires are used with the sup-
you have an external CD-ROM drive, it ences amongst the available CD-ROM ply connector.
can be simply plugged into the mains drives’ external controls, a typical Once the power supply has been
drive’s controls are shown in connected correctly, you will notice
the figure here. Please ensure that LED indicator on the drive starts
that a proper power supply con- flashing. Now the digital audio CD can
nector available from computer be loaded after pushing the eject but-
spare parts vendor is used for ton. A second push of the same button
connection to CD-ROM drive. causes retraction of CD carriage into the
To identify +5V and +12V pins drive. One can change the track (song)
on the drive connector, please on the CD using play switch on the
note that in the computer +12V CD-ROM drive.

ELECTRONICS PROJECTS Vol. 20


CIRCUIT IDEAS

FLASHING BEACON S.C.


DWI
VED
I

ASHOK K. DOCTOR the figure. The IC is pro-


vided with an aluminium

A
flashing beacon has many uses. It heat-sink to dissipate the
can be employed as a distress sig- heat generated while deliv-
nal on highways or as a direction ering full current. Since the
pointer for parking lots, hospitals, hotels, IC has an inbuilt switch-on
etc. Here we present a flashing beacon current limiter, it extends
that uses well-known regulator IC LM317T. the bulb life.
As LM317T regulator can deliver more than For the shown values
1 amp. A small 12V, 10W bulb with a of resistors and capacitors,
high-quality reflector can serve as a good the bulb flashes at approxi-
visible blinker. mately 4 cycles per second.
A 12-15V, 1A DC supply is connected The number of flashes de-
to the input pin of the IC. A 12V, 10W pends on the charge-dis-
bulb and a combination of resistors and charge time of the capaci-
capacitors are connected between the out- tors. Different values of resistors and ca- crease the number of flashes.
put pin and ADJ pin of the IC as shown in pacitors can be used to increase or de- This circuit costs around Rs 50.

NOVEMBER 2002 ELECTRONICS FOR YOU


CIRCUIT IDEAS

CLAP SWITCH S.C.


DWI
VED

MOHAMMAD USMAN QURESHI depending on the selected values of R7 and On second clap, a negative pulse trig-
C3. This ‘on’ time (T) of IC1 can be calcu- gers IC2 and its output pin 3 goes high for

H
ere’s a clap switch free from false lated using the following relationship: a time period depending on R9 and C5.
triggering. To turn on/off any ap T=1.1R7.C3 This provides a positive pulse at clock pin
pliance, you just have to clap seconds 14 of decade counter IC 4017 (IC3). De-
twice. The cir-cuit changes its output state where R7 is in ohms and C3 in microfar- cade counter IC3 is wired here as a
only when you clap twice within the set ads. bistable.
time period. Here, you’ve to clap within 3 On first clap, output pin 3 of IC1 goes Each pulse applied at clock pin 14
seconds. high and remains in this standby position changes the output state at pin 2 (Q1) of
The clap sound sensed by condenser for the preset time. Also, LED1 glows for IC3 because Q2 is connected to reset pin
microphone is amplified by transistor T1. this period. The output of IC1 provides 15. The high output at pin 2 drives transis-
The amplified signal provides negative pulse supply voltage to IC2 at its pins 8 and 4. tor T2 and also energises relay RL1. LED2

to pin 2 of IC1 and IC2, triggering both the Now IC2 is ready to receive the triggering indicates activation of relay RL1 and on/off
ICs. IC1, commonly used as a timer, is signal. Resistor R10 and capacitor C7 con- status of the appliance. A free-wheeling
wired here as a monostable multivibrator. nected to pin 4 of IC2 prevent false trig- diode (D1) prevents damage of T2 when
Trigging of IC1 causes pin 3 to go high and gering when IC1 provides the supply volt- relay de-energises.
it remains high for a certain time period age to IC2 at first clap. This circuit costs around Rs 80.

ELECTRONICS FOR YOU MAY 2003


Colour Sensor
C
olour sensor is an interesting
project for hobbyists. The circuit
can sense eight colours, i.e. blue,
green and red (primary colours); magenta,
yellow and cyan (secondary colours); and
black and white. The circuit is based on
the fundamentals of optics and digital
electronics.
The object whose colour is required
to be detected should be placed in front
of the system. The light rays reflected
from the object will fall on the three
convex lenses which are fixed in front
of the three LDRs. The convex lenses
are used to converge light rays. This
helps to increase the sensitivity of
LDRs.
Blue, green and red glass plates
(filters) are fixed in front of LDR1, LDR2
and LDR3 respectively. When reflected
light rays from the object fall on the
gadget, the coloured filter glass plates
determine which of the LDRs would get
triggered. The circuit makes use of only
‘AND’ gates and ‘NOT’ gates.
When a primary coloured light ray
falls on the system, the glass plate cor-
responding to that primary colour will
allow that specific light to pass through.
But the other two glass plates will not
allow any light to pass through. Thus 13
only one LDR will get triggered and the
gate output corresponding to that LDR
will become logic 1 to indicate which
colour it is.
Similarly, when a secondary coloured
light ray falls on the system, the two
primary glass plates corresponding to the
mixed colour will allow that light to pass
through while the remaining one will not
allow any light ray to pass through it. As
a result two of the LDRs get triggered and
the gate output corresponding to these 1. Potmeters VR1, VR2 and VR3 may The coloured glass filter should be fixed
will become logic 1 and indicate which be used to adjust the sensitivity of the in front of the LDR as shown in the
colour it is. LDRs. figure. Make three of that kind and
When all the LDRs get triggered or 2. Common ends of the LDRs should fix them in a suitable case. Adjust-
remain untriggered, you will observe be connected to positive supply. ments are critical and the gadget perform-
white and black light indications respec- 3. Use good quality light filters. ance would depend upon its proper fabri-
tively. Following points may be carefully The LDR is mounded in a tube, cation and use of correct filters as well as
noted: behind a lens, and aimed at the object. light conditions.

ELECTRONICS PROJECTS Vol. 20


COMPUTERISED MORSE CODE
GENERATOR / TRANSMITTER
PUNERJOT SINGH MANGAT

T
he circuit given here can
be used to send telegraph-
ic messages via compu-
ter. The message data entered
through the computer keyboard is
converted to corresponding Morse
code and transmitted via the cir-
cuit attached to any IBM compat-
ible computer’s printer port.
Morse code pulses from the
computer appearing at pin 3
of the 25-pin parallel port are
routed to the base of transistor
T1(CL100) which in turn switches
on the audio frequency oscillator
built around IC1 (NE555) for the
duration of each pulse. The frequency of As stated earlier, this circuit is con- various characters appears under the
the oscillator can be varied by adjusting nected to the parallel port of the PC. Only function ‘write(ch)’ of the program wherein
potmeters VR1 (20 kilo-ohm) and VR2 (50 pins 3 and 25 of the ‘D’ connector are used. ‘di’ represents a short duration pulse and
kilo-ohm). Pin 3 corresponding to data bit D1 of port ‘da’ represents a long duration pulse. The
The audio output from pin 3 of IC 378(hex) carries the Morse Code data from program is interactive and permits varia-
(NE555) is connected to an FM transmit- the computer to the circuit while pin 25 tion of speed. The program can be modified
ter comprising transistor T2 (BF194B) and serves as common ground. to read and transmit the text files or one
the associated components. The frequency The circuit should be powered by +5 can even make a TSR (terminate and-stay-
of the transmitter can be changed with volts regulated power supply. It should resident) program.
the help of trimmer capacitor VC1 or by be fixed inside a metal box to reduce in- It is hoped that this circuit idea
changing the number of turns of coil L1. terference. would prove to be of great value to the
The FM modulated signal is coupled to The program, written in TURBO government’s telecom department, defence
a short-wire antenna via capacitor C7. The PASCAL 7.0, accepts the message via services, coast guard, merchant navy and
signal can be received using any ready- the keyboard, converts it to correspond- amateur radio operators as well as all
made FM receiver tuned to the frequency ing Morse code and sends the code to pin those who make use of Morse code for
of the transmitter. 3 of the printer port. The Morse code of message transmission.

PROGRAM LISTING IN TURBO PASCAL 7.0


{$M $450,0,0} procedure di; START:
uses crt,dos: begin clrscr;
label port[$378]:=2; color(11,1);
main,endpro,output,message,startmessage, delay(pause); gotoxy(15,4);
speedselect,fileiput,dosshell port[$378]:=0; write(‘PUNJABl UNIVERSITY PATIALA-147002‘);
,start; delay(pause); gotoxy(1,7);
var end; color(10,3);
s:array [1..14] of string [76]: procedure da; gotoxy(10,18);
pause,x,y,i,b:integer; begin write(‘==========================’);
sl:slring[l]: port[$378]:=2; gotoxy(10,19);
ch:char: delay(pause*3); write(‘Fl = Increase Speed ‘);
procedure color{a,b:integer); port[$378]:=0; gotoxy(10,20);
begin delay(pause); write(‘F2 = Decrease Speed ‘);
textcolor(a); end; gotoxy(10,21);
textbackground(b); begin write(‘F3 = Output to Device ‘);
end; pause:=100; gotoxy(10,22);

190 ELECTRONICS PROJECTS Vol. 19


write(‘F4 = Message Input ‘); begin if ch=’Y’ then begin da; di; da; da; end else
gotoxy(10,23); if y=1 then goto message; if ch==’Z’ then begin da; da; di; di; end else
write(‘F5 = Dosshell y:=y-1; if ch=’1' then begin di; da; da; da; da; end else
‘); x:=76; if ch=’2' then begin di; di; da; da; da; end
gotoxy(10,24); end else
write(‘F6 = Quit ‘); else if ch=’3' then begin di; di; di; da; da; end else
gotoxy(10,25); x:=x-1; if ch=’4' then begin di; di; di; di; da; end else
write(‘==========================’); delete(s[y],length(s[y]),1); if ch=’5' then begin di; di; di; di; di; end else
color(14,1); gotoxy(x,y); if ch=’6' then begin da; di; di; di; di; end else
gotoxy(25,2); write(‘ ‘); if ch=’7' then begin da; da; di; di; di; end else
write(‘PROGRAMMED BY’); gotoxy(x,y); if ch=’8' then begin da; da; da; di; di; end else
gotoxy(21,3); goto message: if ch=’9' then begin da; da; da; da; di; end else
write(‘PUNERJOT SINGH MANGAT’); end; if ch=’0' then begin da; da; da; da; da; end else
color(10,3); if(x=76) and (y=14) then goto message; if ch=’.’ then begin di; da; di; da; di; da; end else
gotoxy(26,17); write(ch); if ch=’;’ then begin da; di; da; di; da; di; end else
write(‘CONTROLS ‘); s[y]:=(s[y]+ch); it ch=’:’ then begin da; da; da; di; di; di; end else
gotoxy(35,19); goto message; if ch=’,’ then begin da; da; di; di; da; da; end else
write(‘SPEED’); end; if ch= ” ‘ then begin di; da; di; di; da; di; end else
color(10,3); OUTPUT: if ch=’?’ then begin di; di; da; da; di; di; end else
gotoxy(35,20); begin if ch=’-’ then begin da; di; di; di; di; da; end else
write(pause); gotoxy(2,25); if ch=’_’ then begin di; di; da; da; di; da; end else
MAIN: write(‘ Sending output to the MorseDevice... if ch=’/’ then begin da; di; di; da; di; end else
window(1,1,80,25); Press any key to stop... ‘); if (ch=#39) or (ch=#96) then begin di; da; da;
gotoxy(2,25); color(12,1); da; da; di; end else
color(0,7); window(3,2,78,15); if (ch=’(‘) or (ch=’)’)then begin da; di; da; da;
write(‘Waiting for the command... ‘); clrscr; di; da; end else
ch:=readkey; for i:= 1 to y do if ch=’ ‘then delay(pause*6);
if ch=#0 then begin if key pressed then goto main;
begin for x:= 1 to length(s[i]) do end;
ch:=readkey; begin end;
if (ch=#59) or (ch=#60) then goto speedselect s1:=(copy(s[i],x,1)); goto main;
else ch:=upcase(s1[1]); end;
if ch=#61 then goto output else delay(pause*2); SPEEDSELECT;
if ch=#62 then goto startmessage else write(ch); begin
if ch=#63 then goto dosshell else if ch=’A’ then begin di; da; end else if(ch=#59)and(pause>50) then pause: =
if ch=#64 then goto endpro; if ch=’B’ then begin da; di; di; di; end else pause+2;
end; if ch=’C’ then begin da; di; da; di; end else if(ch= =#60) and (pause < 190) then pause: =
goto main; if ch=’D’ then begin da; di; di; end else pause - 2;
STARTMESSAGE: if ch=’E’ then begin di; end else color(10,3);
begin if ch=’F’ then begin di; di; da; di; end else gotoxy(35,20);
gotoxy(2,25); if ch=’G’ then begin da; da; di; end else write1n(pause,’ ‘);
write (‘ Enter the message and press ENTER if ch=’H’ then begin di; di; di; di; end else goto main;
KEY...’); if ch=’I’ then begin di; di; end else end;
color(12,1); if ch=’J’ then begin di; da; da; da; end else DOSSHELL:
window(3,2,78,15); if ch=’K’ then begin da; di; da; end else begin
clrscr; if ch=’L’ then begin di; da; di; di; end else color(7,0);
for x:= 1 to 14 do s[x]:=’ ‘ ; if ch=’M’ then begin da; da; end else clrscr;
i:0;x:=1;y:=1;b:=0: if ch=’N’ then begin da; di; end else write1n(‘Type EXIT to return to pro-
end: if ch=’O’ then begin da; da; da; end else gramme...’);
MESSAGE: if ch=’P’ then begin di; da; da; di; end else swapvectors;
begin if ch=’Q’ then begin da; da; di; da; end else exec(getenv(‘comspec’),”);
x:=wherex; if ch=’R’ then begin di; da; di; end else swapvectors;
y:=wherey; if ch=’S’ then begin di; di; di; end else goto start;
ch:=readkey; if ch=’T’ then begin da; end else end;
if ch=#13 then goto main; if ch=’U’ then begin di; di; da; end else ENDPRO:
if ch=#8 then if ch=’V’ then begin di; di; di; da; end else color(7,0);
begin if ch=’W’ then begin di; da; da; end else clrscr;
if x=1 then if ch=’X’ then begin da; di; di; da; end else end.

ELECTRONICS PROJECTS Vol. 19 191


C O N S T R U C T I O N

PC INTERFACED AUDIO
S.C. DWIVEDI

PLAYBACK DEVICE: M-PLAYER where Vref is the reference voltage in volts


and R1 is the resistance in kilo-ohms.
The output current from the DAC is
converted into its corresponding voltage
N.V. VENKATARAYALU AND M. SOMASUNDARAM using a simple current-to-voltage con-
verter wired around one part of the dual
wideband JFET op-amp LF353. The out-

S Hardware
ounds of various kinds have always put from IC2(a) is the required audio sig-
fascinated human beings. Many de- nal that has to be processed and ampli-
vices have been invented for re- The circuit functions as an 8-bit mono fied to feed the speaker. The part follow-
cording and playing back the sounds— player, i.e. the sound files (with .WAV ing the I-V converter is the bass- and
from magnetic tapes to DVD (digital ver- extension) with sound quantised to eight treble-control circuit employing RC-type
satile disc), from Adlib cards to high-per- bits or 256 levels can be played. In variable low-pass and high-pass filters
formance sound cards with ‘surround case of files with 16-bit quantisation, these connected to the input of audio amplifier
sound’ capability. For personal comput- are re-quantised as discussed under ‘Soft- built around the second op-amp inside
ers (PCs), there is a wide variety of such ware’ subheading. Thus, only eight bits LF353 [IC2(b)].
devices. A modern PC, generally, has a are sent to the card through the printer The frequency response of the filters
‘Sound Blaster’ card installed in it. If your port. can be varied using potentiometers VR1
PC does not have a sound card, here is Since there is no duplex communica- and VR2. The low frequencies or bass can
a low-cost audio playback circuit with tion necessary between the player card be cut or boosted with the help of poten-
bass, treble, and volume controls to cre- and the PC, it is sufficient to use the eight tiometer VR1. Similarly, high frequencies
ate your own music player. output data lines of the port 378H (pins 2 or treble can be cut or boosted with the
The playback device ‘M-player’ (i.e. through 9 of 25-pin D-connector). This 8- help of potentiometer VR2. At low fre-
media player) described here uses mini- bit digital output is converted into an ana- quencies, capacitors C2, C3, and C4 act
mal hardware to achieve a moderately logue signal using DAC 0808 (IC1) from as open circuits and the effective feed-
good-quality audio playback device. National Semiconductor. back is through 10k resistors (R4, R5,
The software that accompanies the hard- The output current from the DAC and R6) and potentiometer VR1.
ware is meant for a PC running under varies with the input digital level The audio amplifier IC2(b) acts as an
MS-DOS or a compatible operating sys- (represented by bits D0 through D7), inverting amplifier and the amplification
tem. This device can play a simple 8-bit the reference voltage (Vref), and the value (or attenuation) of the low-frequency bass
PCM (pulse code modulation) wave file of series resistor R1 connected to Vref signals depends on the value of potenti-
with some special effects. The PC is con- pin 14 of DAC0808 IC. The output cur- ometer VR1. The frequency f1 at which C
nected to the device through the PC par- rent Io (in mA) is given by the relation- = C2 = C3 becomes effective is given by
allel port. ship: the equation:

Fig. 1: Circuit of M-player audio playback device

52 ELECTRONICS FOR YOU ❚ MAY 2000


C O N S T R U C T I O N

ohm speaker. The


output-end audio
At frequnecies higher than f2 (f>f2, power amplifier is
high end of audio range), capacitors designed to give a
C2 and C3 overcome the effect of potenti- gain of around 50.
ometer VR1. As C2 and C3 behave One can also use
as short, potentiometer VR1 has no LM380 in various
effect on the output response. Now, the other configurations
gain is controlled by treble potentiometer as per one’s require-
VR2. The frequency f2, below which ments. Another
treble potentiometer VR2 has no popular configura-
effect on the response, is given by the tion is the ‘bridge
equation: configuration’—in
which two LM380s
can be used to ob- Fig. 2: Actual-size PCB layout for M-player
tain larger power
The output of this module is sent to output with a gain
the final 2-watt audio power amplifier of 300.
(LM380) stage through potentiometer VR3
Parallel port
which is used as the volume control. The
power output of this module is fed to an 8-
The output of the
PARTS LIST parallel port is TTL
Semiconductors: compatible. So, logic
IC1 - DAC0808 8-bit D/A converter level 1 is indicated
IC2 - LF353 JFET input wide-band by +5V and logic
op-amp
level 0 by 0V. The
IC3 - LM380, 2-watt audio amplifier
current that one can
Resistors (all ¼watt, ±5% carbon film, unless
sink and source var-
stated otherwise)
ies from port to
R1 - 4.7-kilo-ohm
R2, R9 - 47-kilo-ohm port. Most parallel Fig. 3: Component layout for the PCB
R3 - 1-kilo-ohm ports can sink and
R4-R6 - 10-kilo-ohm source around 12 mA. verted into mono 8-bit PCM data. This
R7, R8 - 39-kilo-ohm The software assumes 0x378 (378H) software is accompanied with a CTUI-
VR1 - 100-kilo-ohm potmeter to be the base address of the parallel port based interface.
VR2 - 470-kilo-ohm potmeter
to which the device is connected. Another The wave file format is probably the
VR3 - 50-kilo-ohm potmeter
possible base address is 0x278 (278H). It least undocumented sound format since
Capacitors:
is advised to modify this address of the there are different schemes with differ-
C1 - 1µF, 25V electrolytic
C2, C3 - 0.05µF ceramic disk
parallel port in the software program, af- ent number of chunks of related informa-
C4 - 0.005µF ceramic disk ter checking the device profile. tion in the file. Even the chunks can be
C5-C7 - 2.2µF, 25V electrolytic Actual-size PCB layout for audio play- of variable size. Therefore it is difficult to
C8, C9 - 470µF, 25V electrolytic back circuit of Fig. 1 is given in Fig. 2 get documentation on all available
Miscellaneous: and its component layout in Fig. 3. chunks.
- 25-pin D connector (male) This software can be used only on

Software
- Loudspeaker 8-ohm, 2W PCM data with data chunk. Every wave
- Power supply: (a) +12V, 500mA file has some minimum chunks (see Table
- (b) –12V, 100mA
The software accompanying this construc- II). These chunks will be present in every
- (c) +5V, 100mA
tion project is written in Turbo C/C++ for wave file. Then there are other chunks
DOS. It can be used to which are actually non-standard. In PCM
TABLE I
play simple 8-bit PCM itself, the above chunk may be followed
Relevant Details of Parallel Port
wave files. 16-bit wave either by DATA chunk or by LIST chunk
Pin No. Pin No. SPP signal Direction Register
(D-type 25) (centronics) in/out files are converted into 8- which, in turn, has lots of sub-chunks.
bit PCM data before pro- (Any information obtained on these
2 2 Data 0 Out Data
3 3 Data 1 Out Data ceeding. chunks by the readers may please be
4 4 Data 2 Out Data Even stereo wave shared with the authors.)
5 5 Data 3 Out Data files can be played; but During playback, the speed with
6 6 Data 4 Out Data
not the stereo way. Only which the processor in the PC can ex-
7 7 Data 5 Out Data
8 8 Data 6 Out Data one channel is chosen. ecute the main loop is first studied using
9 9 Data 7 Out Data Up to six-channel PCM a dummy loop and thus the delay is
18 - 25 19-30 Ground Gnd data can be read and con- adaptively varied with respect to the speed

ELECTRONICS FOR YOU ❚ MAY 2000 53


C O N S T R U C T I O N

TABLE II The software does not include mouse support.


Wave File Format can be used to play
Conclusion
From byte Number Information with the following
of bytes effects:
RIFF chunk: • Play normally We have presented a simple sound card
0 4 Contains the characters ‘RIFF’ • Play with a to playback .wav files with bass and treble
4 4 Size of the RIFF chunk different playback controls. Though the current design
rate, i.e. play it fast plays only mono files (stereo files are
WAVE chunk:
or slow converted to mono), a stereo file player
0 4 Contains the characters ‘WAVE’
4 Variable The FORMAT chunk • Fade-in or can be designed in a similar manner. The
fade-out the volume software can be modified to play audio
The normal FORMAT chunk:
levels either linearly files other than .wav files without any
0 4 Contains the characters ‘fmt’
or exponentially change in the hardware circuit. The en-
4 4 Size of the FORMAT chunk
8 2 Value specifying the scheme • Reverse the coding format of the other audio file types
1-PCM, 85-MPEG layer III wave file and then (like .ra, .mp3) is only to be known. With
10 2 Number of channels play that, those files can be decoded and raw
1-mono, 2-stereo, etc. The menu items digital 8-bit data can finally be sent to the
12 4 Number of samples per second. can be selected us- hardware device. The hardware device can
This gives us the playback rate. ing keyboard keys even be permanently mounted inside the
16 4 Average number of bytes per second. Alt+F for file, Alt+E PC with all the power supplies (+12V, +5V,
This field is used to allocate buffers, etc. for effects, and and –12V) tapped from the system’s
20 2 Contains block alignment information. Alt+O for operation. SMPS.
22 Variable This field contains format-specific data.
Apart from the soft- Note: The complete source code con-
For PCM files, this field is 2 bytes long
ware, the hardware sisting of Mplayer.cpp, Sounds.h,
can be used to vary Globals.h, the executable file Mplayer.exe,
of target processor. This is one of the bass, treble, and volume for the wave file and a sample wave file are likely to be
methods to achieve invariance of the play- that is played. Thus, the hardware and included in next month’s CD (optional)
back speed over a wide range of proces- software complement each other to pro- accompanying EFY.
sor speeds available. vide a good music player. The software

Program Listing
MPLAYER.CPP cprintf(“%c”,205); delay(75);
#include “Sounds.h” for(j=y1+1;j<=y2-1;j++){ gotoxy(3,13);cprintf(“ ”);
void DisplayTip(char *string) gotoxy(x1,j); delay(75);
{ cprintf(“%c”,186); gotoxy(3,14);cprintf(“ ”);
text_info tinf; gotoxy(x2,j); delay(75);
if(strlen(string)<75) cprintf(“%c”,186); gotoxy(3,15);cprintf(“ ”);
{ } delay(75);
gettextinfo(&tinf); gotoxy(x1,y1);cprintf(“%c”,201); gotoxy(3,16);cprintf(“ ”);
textbackground(LIGHTGRAY);textcolor(RED); gotoxy(x2,y1);cprintf(“%c”,187); delay(75);
gotoxy(2,25); gotoxy(x1,y2);cprintf(“%c”,200); gotoxy(3,17);cprintf(“ ”);
for(int i=0;i<75;i++) cprintf(“ ”); gotoxy(x2,y2);cprintf(“%c”,188); return;
gotoxy(2,25); if(caption!=NULL){ }
cprintf(string); textcolor(WHITE); void MenuInitialise(void)
textattr(tinf.attribute); gotoxy(x1+2,y1); {
gotoxy(tinf.curx,tinf.cury); cprintf(“%s”,caption); int i;
} } // The FILE menu option
return; textattr(tinfo.attribute); Menu[MNU_FILE].nextMenu=MNU_EFFECT;
} return; Menu[MNU_FILE].prevMenu=MNU_OPERATION;
void Window(int x1,int y1,int x2,int y2,char } Menu[MNU_FILE].Child=FALSE;
*caption,int BackCol,int TextCol) void DrawScreen(void) Menu[MNU_FILE].num_items=4;
{ { for(i=0;i<4;i++)
text_info tinfo; textbackground(LIGHTGRAY);textcolor(BLACK); {
int i,j; clrscr(); Menu[MNU_FILE].Enabled[i]=TRUE;
gettextinfo(&tinfo); Window(1,2,80,24,NULL,BLUE,WHITE); Menu[MNU_FILE].subMenu[i]=NONE;
textbackground(BackCol);textcolor(TextCol); gotoxy(1,1);cprintf(“ File Effects Operation”); Menu[MNU_FILE].String[i]=(char *)malloc(15);
for(j=y1;j<=y2;j++){ textcolor(RED); Menu[MNU_FILE].Tip[i]=(char *)malloc(50);
gotoxy(x1,j); gotoxy(3,1);cprintf(“F”); Menu[MNU_FILE].OptionID[i]=1+i;
for(i=x1;i<=x2;i++) gotoxy(12,1);cprintf(“E”); }
cprintf(“ ”); gotoxy(24,1);cprintf(“O”); Menu[MNU_FILE].Enabled[1]=FALSE;
} textbackground(BLUE);textcolor(LIGHTBLUE); strcpy(&(Menu[MNU_FILE].String[0][0]),“Open”);
gotoxy(x1+1,y1); gotoxy(3,10);cprintf(“ ”); strcpy(&(Menu[MNU_FILE].String[1][0]),“Save”);
for(i=x1+1;i<=x2-1;i++) delay(75); strcpy(&(Menu[MNU_FILE].String[2][0]),“-”);
cprintf(“%c”,205); gotoxy(3,11);cprintf(“ ”); strcpy(&(Menu[MNU_FILE].String[3][0]),“Exit”);
gotoxy(x1+1,y2); delay(75); strcpy(&(Menu[MNU_FILE].Tip[0][0]),“Open the
for(i=x1+1;i<=x2-1;i++) gotoxy(3,12);cprintf(“ ”); *.wav file”);

54 ELECTRONICS FOR YOU ❚ MAY 2000


C O N S T R U C T I O N

strcpy(&(Menu[MNU_FILE].Tip[1][0]),“Save as a (char *)malloc(15); if(subMenu[0]!=NULL) longLength+=3;


*.wav file”); Menu[MNU_FADEIN].Tip[i]=(char *)malloc(50); for(i=1;i<num_items;i++)
strcpy(&(Menu[MNU_FILE].Tip[2][0]),” “); Menu[MNU_FADEIN].OptionID[i]=31+i; {
strcpy(&(Menu[MNU_FILE].Tip[3][0]),”Quit the } length=strlen(String[i]);
program”); strcpy(&(Menu[MNU_FADEIN].String[0][0]),“Linear”); if(subMenu[i]!=NULL) length+=3;
Menu[MNU_FILE].AtX=2;Menu[MNU_FILE].AtY=2; strcpy(&(Menu[MNU_FADEIN].String[1][0]),” if(length>longLength) longLength=length;
// The EFFECT menu option Exponential”); }
Menu[MNU_EFFECT].nextMenu=MNU_OPERATION; strcpy(&(Menu[MNU_FADEIN].Tip[0][0]),“Apply textbackground(LIGHTGRAY);textcolor(WHITE);
Menu[MNU_EFFECT].prevMenu=MNU_FILE; Linear attenuation or amplification”); for(i=StartY;i<StartY+num_items+2;i++)
Menu[MNU_EFFECT].Child=FALSE; strcpy(&(Menu[MNU_FADEIN].Tip[1][0]),“Apply {
Menu[MNU_EFFECT].num_items=5; Exponential attenuation or amplification”); gotoxy(StartX,i);cprintf(“ ”);
for(i=0;i<5;i++) Menu[MNU_FADEIN].AtX=33;Menu gotoxy(StartX+longLength+5,i);cprintf(“ ”);
{ [MNU_FADEIN].AtY=2; }
Menu[MNU_EFFECT].Enabled[i]=FALSE; // The FADE-OUT menu option StartX++;
Menu[MNU_EFFECT].subMenu[i]=NONE; Menu[MNU_FADEOUT].nextMenu=Menu gotoxy(StartX,StartY);cprintf(“%c”,218);
Menu[MNU_EFFECT].String[i]= [MNU_FADEOUT].prevMenu=NONE; for(i=0;i<longLength+2;i++) cprintf(“%c”,196);
(char*)malloc(15); Menu[MNU_FADEOUT].Child=TRUE; cprintf(“%c”,191);
Menu[MNU_EFFECT].Tip[i]=(char *)malloc(50); Menu[MNU_FADEOUT].num_items=2; gotoxy(StartX,num_items+StartY+1);cprintf(“%c”,192);
Menu[MNU_EFFECT].OptionID[i]=11+i; for(i=0;i<2;i++) for(i=0;i<longLength+2;i++) cprintf(“%c”,196);
} { cprintf(“%c”,217);
strcpy(&(Menu[MNU_EFFECT].String[0][0]),“Fade Menu[MNU_FADEOUT].Enabled[i]=FALSE; for(i=0;i<num_items;i++)
In”); Menu[MNU_FADEOUT].subMenu[i]=NONE; {
strcpy(&(Menu[MNU_EFFECT].String[1][0]),“Fade Menu[MNU_FADEOUT].String[i]= if(String[i][0]!=‘-’)
Out”); (char *)malloc(15); {
strcpy(&(Menu[MNU_EFFECT].String[2][0]),“-”); Menu[MNU_FADEOUT].Tip[i]= textcolor(WHITE);
strcpy(&(Menu[MNU_EFFECT].String[3][0]),“Reverse”); (char*)malloc(50); gotoxy(StartX,StartY+i+1);cprintf(“%c ”,179);
strcpy(&(Menu[MNU_EFFECT].String[4][0]),“Playback Menu[MNU_FADEOUT].OptionID[i]=41+i; if(Enabled[i])
Rate”); } textcolor(BLACK);
strcpy(&(Menu[MNU_EFFECT].Tip[0][0]),“Reduce strcpy(&(Menu[MNU_FADEOUT].String[0][0]), else
volume with increasing time”); “Linear”); textcolor(BROWN);
strcpy(&(Menu[MNU_EFFECT].Tip[1][0]),“Increase strcpy(&(Menu[MNU_FADEOUT].String[1][0]), gotoxy(StartX+2,StartY+i+1);
volume with increasing time”); “Exponential”); for(j=0;j<longLength+1;j++)
strcpy(&(Menu[MNU_EFFECT].Tip[2][0]),“ ”); strcpy(&(Menu[MNU_FADEOUT].Tip[0][0]),“Apply if(j<strlen(String[i]))
strcpy(&(Menu[MNU_EFFECT].Tip[3][0]),“Reverse Linear attenuation or amplification”); cprintf(“%c”,String[i][j]);
the wave file”); strcpy(&(Menu[MNU_FADEOUT].Tip[1][0]),“Apply else
strcpy(&(Menu[MNU_EFFECT].Tip[4][0]),“Vary Exponential attenuation or amplification”); cprintf(“ ”);
the Playnack Rate”); Menu[MNU_FADEOUT].AtX=33;Menu textcolor(WHITE);
Menu[MNU_EFFECT].subMenu[0]=MNU_FADEIN; [MNU_FADEOUT].AtY=2; cprintf(“%c”,179);
Menu[MNU_EFFECT].subMenu[1]=MNU_FADEOUT; } }
Menu[MNU_EFFECT].AtX=11;Menu[MNU_EFFECT]. void RemoveMenu(int MenuID) else
AtY=2; { {
// The OPERATION menu option int i,j; textcolor(WHITE);
Menu[MNU_OPERATION].nextMenu=MNU_FILE; textbackground(BLUE);textcolor(WHITE); gotoxy(StartX,StartY+i+1);cprintf(“%c”,195);
Menu[MNU_OPERATION].prevMenu=MNU_EFFECT; gotoxy(Menu[MenuID].AtX,Menu[MenuID].AtY); for(j=0;j<longLength+2;j++) cprintf(“%c”,196);
Menu[MNU_OPERATION].Child=FALSE; for(i=0;i<30;i++) cprintf(“%c”,205); cprintf(“%c”,180);
Menu[MNU_OPERATION].num_items=3; for(i=1;i<=Menu[MenuID].num_items+2;i++) }
for(i=0;i<3;i++) { }
{ gotoxy(Menu[MenuID].AtX,Menu[MenuID].AtY+i); for(;;)
Menu[MNU_OPERATION].Enabled[i]=FALSE; for(j=0;j<30;j++) cprintf(“ ”); {
Menu[MNU_OPERATION].subMenu[i]=NONE; } DisplayTip(Tip[CurSelect]);
Menu[MNU_OPERATION].String[i]= return; textbackground(GREEN);
(char*)malloc(15); } if(Enabled[CurSelect])
Menu[MNU_OPERATION].Tip[i]= int ShowMenu(int MenuID) textcolor(BLACK);
(char*)malloc(50); { else
Menu[MNU_OPERATION].OptionID[i]=21+i; MENU *menu; textcolor(BROWN);
} int *subMenu; gotoxy(StartX+1,StartY+CurSelect+1);
strcpy(&(Menu[MNU_OPERATION].String[0][0]),“Play”); int nextMenu, prevMenu; cprintf(“ ”);
strcpy(&(Menu[MNU_OPERATION].String[1] char **String, **Tip; for(j=0;j<longLength+1;j++)
[0]),“-”); int *OptionID; if(j<strlen(String[CurSelect]))
strcpy(&(Menu[MNU_OPERATION].String[2] BOOL *Enabled; cprintf(“%c”,String[CurSelect][j]);
[0]),“Record”); char IsChild; else
strcpy(&(Menu[MNU_OPERATION].Tip[0][0]),“Play int num_items; cprintf(“ ”);
the file that was opened”); int longLength,length; ch=getch();
strcpy(&(Menu[MNU_OPERATION].Tip[1] int StartX,StartY; if(ch==0) ch=getch();
[0]),“ “); int i,j; ch+=300;
strcpy(&(Menu[MNU_OPERATION].Tip[2][0]), int CurSelect=0,ch,RetVal; switch(ch)
“Record sound through the microphone”); menu=&(Menu[MenuID]); {
Menu[MNU_OPERATION].AtX=23;Menu num_items=menu->num_items; case ESCAPE:
[MNU_OPERATION].AtY=2; String=menu->String; RemoveMenu(MenuID);
// The FADE-IN menu option nextMenu=menu->nextMenu; return(-1);
Menu[MNU_FADEIN].nextMenu=Menu prevMenu=menu->prevMenu; case ENTER:
[MNU_FADEIN].prevMenu=NONE; subMenu=menu->subMenu; RemoveMenu(MenuID);
Menu[MNU_FADEIN].Child=TRUE; IsChild=menu->Child; if(Enabled[CurSelect]==TRUE)
Menu[MNU_FADEIN].num_items=2; OptionID=menu->OptionID; return(OptionID[CurSelect]);
for(i=0;i<2;i++) Tip=menu->Tip; else
{ Enabled=menu->Enabled; return(-1);
Menu[MNU_FADEIN].Enabled[i]=FALSE; StartX=menu->AtX; case LEFT_ARROW:
Menu[MNU_FADEIN].subMenu[i]=NONE; StartY=menu->AtY; if(IsChild==TRUE)
Menu[MNU_FADEIN].String[i]= longLength=strlen(String[0]); {

ELECTRONICS FOR YOU ❚ MAY 2000 55


C O N S T R U C T I O N

RemoveMenu(MenuID); } ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”);
return(0); void ButtonDisplay(int x1,int y1,char state gotoxy(x,y);
} char *caption) break;
else { case 1:
{ text_info tinfo; _setcursortype(_NOCURSOR);
if(prevMenu!=NONE) gettextinfo(&tinfo); ButtonDisplay(25,7,ENABLE_ACTIVE,“ Ok ”);
{ int i; break;
RemoveMenu(MenuID); if(state==ENABLE_NOTACTIVE) textcolor case 2:
return(ShowMenu(prevMenu)); (YELLOW); ButtonDisplay(45,7,ENABLE_ACTIVE,“Cancel”);
} if(state==ENABLE_ACTIVE) textcolor(WHITE); ButtonDisplay(25,7,ENABLE_NOTACTIVE,“
} if(state==DISABLE) textcolor(LIGHTGRAY); Ok ”);
break; textbackground(CYAN); break;
case RIGHT_ARROW: gotoxy(x1,y1);cprintf(“ %s ”,caption); }
if(subMenu[CurSelect]!=NONE) textbackground(LIGHTGRAY);textcolor(YELLOW); ch=getch();
{ cprintf(“%c”,220); if(ch==0) ch=getch()+300;
RetVal=ShowMenu(subMenu[CurSelect]); gotoxy(x1+1,y1+1);for(i=0;i<8;i++)cprintf(“%c”,223); ch+=300;
if(RetVal!=0) textattr(tinfo.attribute); switch(ch)
{ } {
RemoveMenu(MenuID); void ButtonPushed(int x1,int y1,char *caption) case TAB:
return(RetVal); { Control=(++Control)%3;
} text_info tinfo; break;
} gettextinfo(&tinfo); case ESCAPE:
else int i; _setcursortype(_NOCURSOR);
{ textbackground(LIGHTGRAY);textcolor(WHITE); ButtonPushed(45,7,“Cancel”);
if(nextMenu!=NONE) gotoxy(x1,y1);cprintf(“ ”); ch=1; Control=2;
{ gotoxy(x1,y1+1);cprintf(“ ”); break;
RemoveMenu(MenuID); textbackground(CYAN); case ENTER:
return(ShowMenu(nextMenu)); gotoxy(x1+1,y1);cprintf(“ %s ”,caption); _setcursortype(_NOCURSOR);
} delay(250); ButtonPushed(25,7,“ Ok “);
} gotoxy(x1,y1);cprintf(“ %s ”,caption); ch=1;Control=1;
break; textbackground(LIGHTGRAY);textcolor(YELLOW); break;
case DOWN_ARROW: cprintf(“%c”,220); case SPACE:
textbackground(LIGHTGRAY); gotoxy(x1,y1+1);cprintf(“ ”);for(i=0;i<8;i++) if(Control==2){_setcursortype(_NOCURSOR);
if(Enabled[CurSelect]) cprintf(“%c”,223); ButtonPushed(45,7,“Cancel”);ch=1;}
textcolor(BLACK); textattr(tinfo.attribute); if(Control==1){_setcursortype(_NOCURSOR);
else } ButtonPushed(25,7,“ Ok ”);ch=1;}
textcolor(BROWN); BOOL DisplayDialog(char mode) break;
gotoxy(StartX+1,StartY+CurSelect+1); { case BACK_SPACE:
cprintf(“ ”); int Control=0,ch; if(Control==0 && i>0)
for(j=0;j<longLength+1;j++) int x=29,y=5,i=0,N=0; {
if(j<strlen(String[CurSelect])) char TempStr[40];TempStr[0]=0; gotoxy(—x,y);
cprintf(“%c”,String[CurSelect][j]); switch(mode) cprintf(“ ”);
else { i—;
cprintf(“ ”); case FILE_OPEN: Window(10,3,70,9,“Open TempStr[i]=0;
CurSelect++; File”,LIGHTGRAY,YELLOW);break; gotoxy(29,5);
if(CurSelect==num_items) CurSelect=0; case FILE_SAVE: Window(10,3,70,9,“Save cprintf(“%s”,TempStr);
while(String[CurSelect][0]==’-’) File”,LIGHTGRAY,YELLOW);break; }
{ case PLAYBACK_RATE: Window(10,3,70,9,” break;
if(CurSelect==num_items) Playback Rate”,LIGHTGRAY,YELLOW);break; default:
CurSelect=0; } ch-=300;
else ButtonDisplay(25,7,ENABLE_NOTACTIVE,“ if(ch<300 && i<N)
CurSelect++; Ok ”); {
} ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”); TempStr[i++]=(char)ch;
break; textbackground(LIGHTGRAY);textcolor(YELLOW); TempStr[i]=0;
case UP_ARROW: gotoxy(13,5); gotoxy(29,5);
textbackground(LIGHTGRAY); if(mode==FILE_OPEN || mode==FILE_SAVE) cprintf(“%s”,TempStr);
if(Enabled[CurSelect]) { x++;
textcolor(BLACK); cprintf(“Enter Filename: ”); }
else strcpy(TempStr,sFileName); break;
textcolor(BROWN); N=39; }
gotoxy(StartX+1,StartY+CurSelect+1); } if(ch==1) break;
cprintf(“ ”); else }
for(j=0;j<longLength+1;j++) { textbackground(BLUE);textcolor(WHITE);
if(j<strlen(String[CurSelect])) cprintf(“Playback Rate : ”); for(ch=3;ch<=9;ch++)
cprintf(“%c”,String[CurSelect][j]); strcpy(TempStr,sPlayBackRate); }
else N=5; gotoxy(10,ch);
cprintf(“ ”); } for(i=10;i<=70;i++)
CurSelect—; textbackground(BLUE);textcolor(WHITE); cprintf(“ ”);
if(CurSelect<0) CurSelect=num_items-1; cprintf(“ ”); }
while(String[CurSelect][0]==’-’) gotoxy(29,5);cprintf(“%s”,TempStr); if(Control==1)
{ i=strlen(TempStr); {
if(CurSelect<0) x+=i; if(mode==FILE_SAVE || mode==FILE_OPEN)
CurSelect=num_items-1; for(;;) strcpy(sFileName,TempStr);
else { if(mode==PLAYBACK_RATE)strcpy(sPlayBackRate,
CurSelect—; switch(Control) TempStr);
} { return(TRUE);
break; case 0: }
} _setcursortype(_NORMALCURSOR); return(FALSE);
} textbackground(BLUE);textcolor(WHITE); }

56 ELECTRONICS FOR YOU ❚ MAY 2000


C O N S T R U C T I O N

void SetEnvVariables(){} printf(“———————\n”); attn1=exp(i*step);


void SaveFile(){} printf(“\tM.Somasundaram - msoms@vsnl.com\n fputc(128+(unsigned char)((long double)(fgetc(fp)-
void main() \tN.V.Venkatarayalu - v_rayalu@vsnl.com\n\n”); 128)*attn1),fpt);
{ break; }
int ch; } fclose(fpt);
textbackground(BLACK);textcolor(LIGHTGRAY); } fclose(fp);
clrscr(); } unlink(“test.aud”);
_setcursortype(_NOCURSOR); SOUNDS.H rename(“tmp.aud”,”test.aud”);
DrawScreen(); #include “Globals.h” }
MenuInitialise(); /////////// Playback Sounds /////////////// /////////////// Reverse Wave File ////////////////
sFileName[0]=0; void mPlay(void) void ReverseWave(void)
strcpy(sPlayBackRate,”22400"); { {
for(;;) FILE *fp; FILE *fp, *fpt;
{ unsigned char Sample; long double i;
DisplayTip(“Ready”); clock_t t1; fp=fopen(“test.aud”,“rb”);
ch=getch(); long k=0,t=0,i=0; fpt=fopen(“tmp.aud”,“wb”);
if(ch==0) ch=getch(); fp=fopen(“test.aud”,“rb”); for(i=0.0;i<NoSamples;i++)
ch+=300; t1=clock(); {
switch(ch) while(clock()-t1<18.2){ fseek(fp,-(long)i,SEEK_END);
{ if(k<RateOfPlayBack){ fputc(fgetc(fp),fpt);
case AltF:ch=ShowMenu(MNU_FILE);break; fgetc(fp); }
case AltE:ch=ShowMenu(MNU_EFFECT);break; outp(0x37a,0); fclose(fpt);
case AltO:ch=ShowMenu(MNU_OPERATION); if(feof(fp)) break; fclose(fp);
break; t++;} unlink(“test.aud”);
} k++;} rename(“tmp.aud”,”test.aud”);
switch(ch) i=k/(RateOfPlayBack+2000); }
{ k=0;rewind(fp); /////////////// Set Playback rate ///////////////
case FILE_EXIT: t1=clock(); void SetPlayBackRate(long rate)
ch=AltX; while(clock()-t1<18.2){ {
break; if(k%i==0){ if(rate<65535)
case FILE_OPEN: fgetc(fp); {
if(DisplayDialog(FILE_OPEN)) outp(0x37a,0); if(rate!=0)
if(mOpen()) if(feof(fp)) break; {
{ t++; rate=atol(sPlayBackRate);
for(int i=0;i<5;i++) } RateOfPlayBack=rate;
Menu[MNU_EFFECT].Enabled[i]=TRUE; if(k>0) k=k; }
Menu[MNU_OPERATION].Enabled[0]=TRUE; k++;} ultoa(RateOfPlayBack,sPlayBackRate,10);
for(i=0;i<2;i++) i=k/(RateOfPlayBack+2000); }
{ k=0;t=0;rewind(fp); return;
Menu[MNU_FADEIN].Enabled[i]=TRUE; while(feof(fp)==FALSE) }
Menu[MNU_FADEOUT].Enabled[i]=TRUE; { /////// Open a wav file and set parameters ///////
} t1=clock(); BOOL mOpen(void)
} if(k%i==0){ {
break; Sample=(unsigned char)fgetc(fp); void DisplayTip(char *);
case FILE_SAVE: outp(DATA_OUT,Sample); int TYPE_OF_OUTPUT=MONO_OUTPUT;
/*if(DisplayDialog(FILE_SAVE))mSave();*/ t++;} FILE *fsource, *fdest;
break; k++; fsource=fopen(sFileName,“rb”);
case FADEIN_LINEAR: } if(fsource!=NULL)
FadeCommon(FADEIN,LINEAR); fclose(fp); {
break; outp(DATA_OUT,0); fdest=fopen(“test.aud”,“wb”);
case FADEIN_EXP: } RIFF riff;
FadeCommon(FADEIN,EXPONENTIAL); ///////////// Fade Common Function //////////////// WAVE wave;
break; void FadeCommon(char far InOrOut,char far DATA data;
case FADEOUT_LINEAR: Type) fread(&riff,sizeof(riff),1,fsource);
FadeCommon(FADEOUT,LINEAR); { fread(&wave,sizeof(wave),1,fsource);
break; FILE *fp, *fpt; fseek(fsource,20+wave.fmt.fLen,SEEK_SET);
case FADEOUT_EXP: long double i; fread(&data,sizeof(data),1,fsource);
FadeCommon(FADEOUT,EXPONENTIAL); long double step; if(strncmpi(data.dID,“FACT”,4)==0){
break; long double attn1; fseek(fsource,data.dLen,SEEK_CUR);
case REVERSE: fp=fopen(“test.aud”,“rb”); fread(&data,sizeof(data),1,fsource);
ReverseWave(); fpt=fopen(“tmp.aud”,“wb”); }
break; step=1.0/NoSamples; if(!(strncmpi(riff.rID,“RIFF”,4)==0 && strncmpi
case PLAYBACK_RATE: if(InOrOut==FADEIN) (wave.wID,“WAVE”,4)==0 && strncmpi(data.dID,
if(DisplayDialog(PLAYBACK_RATE)==FALSE) attn1=0; “DATA”,4)==0 && strncmpi(wave.fmt.fID,“fmt
SetPlayBackRate(0); else ”,4)==0 && wave.fmt.wFormatTag==PCM &&
else { wave.fmt.nChannels<=6))
SetPlayBackRate(1); attn1=1; {
break; step=-step; printf(“\a”);
case PLAY: } DisplayTip(“Unrecognizable Format -Not PCM
mPlay(); if(Type==LINEAR) 8-bit.”);
break; for(i=0.0;i<NoSamples;i++) return FALSE;
} { }
if(ch==AltX) attn1+=step; unsigned long dlen=data.dLen;
{ fputc(128+(unsigned char)((long double)(fgetc(fp)- char array[6];int arrayi[6];
_setcursortype(_NORMALCURSOR); 128)*attn1),fpt); int nChannels=wave.fmt.nChannels;
textcolor(LIGHTGRAY); } SamplingFrequency=PBR=RateOfPlayBack=
textbackground(BLACK); else wave.fmt.nSamplesPerSec;
clrscr(); for(i=0.0;i<NoSamples;i++) ultoa(RateOfPlayBack,sPlayBackRate,10);
printf(“MPLAYER Ver.1.0\n”); { NoSamples=(dlen/nChannels)*TYPE_OF_

ELECTRONICS FOR YOU ❚ MAY 2000 57


C O N S T R U C T I O N

OUTPUT;dlen=NoSamples; break; #define AltE 318


BOOL bits16=FALSE; case 4: array[0]=(char)((long)(arrayi[0]+ #define AltF 333
if(wave.fmt.FormatSpecific==BITS16) bits16= 32768)*255/65535); #define AltO 324
TRUE; fputc((int)array[0],fdest); #define AltX 345
if(bits16==FALSE) if(TYPE_OF_OUTPUT==STEREO_OUTPUT) #define LEFT_ARROW 375
while(dlen>0) { #define RIGHT_ARROW 377
{ array[2]=(char)((long)(arrayi[2]+32768)*255/ #define UP_ARROW 372
fread(array,1,nChannels,fsource); 65535); #define DOWN_ARROW 380
switch(nChannels) fputc((int)array[2],fdest); #define ESCAPE 327
{ } #define ENTER 313
case 1: fputc((int)array[0],fdest); break; #define SPACE 332
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) case 6: array[1]=(char)((long)(arrayi[1]+ #define BACK_SPACE 308
fputc((int)array[0],fdest); 32768)*255/65535); #define TAB 309
break; fputc((int)array[1],fdest); #define PCM 1
case 2: fputc((int)array[0],fdest); if(TYPE_OF_OUTPUT==STEREO_OUTPUT) #define IN 0
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) { #define OUT 1
fputc((int)array[1],fdest); array[4]=(char)((long)(arrayi[4]+32768)*255/ #define LINEAR 0
break; 65535); #define EXPONENTIAL 1
case 3: fputc((int)array[0],fdest); fputc((int)array[4],fdest); #define FADEIN 0
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) } #define FADEOUT 1
fputc((int)array[1],fdest); break; #define DATA_OUT 0x378
break; } #define BITS16 16
case 4: fputc((int)array[0],fdest); dlen—; #define BITS8 8
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) } #define STEREO_OUTPUT 2
fputc((int)array[2],fdest); } #define MONO_OUTPUT 1
break; fclose(fsource); typedef char BOOL;
case 6: fputc((int)array[1],fdest); fclose(fdest); typedef struct{
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) return TRUE; char rID[4];
fputc((int)array[4],fdest); } unsigned long rLen;
break; else }RIFF;
} { typedef struct{
dlen—; printf(“\a”); char fID[4];
} DisplayTip(“The file is not available!”); unsigned long fLen;
else return FALSE; unsigned int wFormatTag;
{ } unsigned int nChannels;
NoSamples/=2; } unsigned long nSamplesPerSec;
dlen=NoSamples; GLOBALS.H unsigned long nAvgBytesPerSec;
while(dlen>0) #include <stdio.h> unsigned int nBlockAlign;
{ #include <dos.h> unsigned int FormatSpecific;
fread(arrayi,2,nChannels,fsource); #include <process.h> }FORMATCHUNK;
switch(nChannels) #include <conio.h> typedef struct{
{ #include <string.h> char wID[4];
case 1: array[0]=(char)((long)(arrayi[0]+ #include <math.h> FORMATCHUNK fmt;
32768)*255/65535); #include <stdlib.h> }WAVE;
fputc((int)array[0],fdest); #include <time.h> typedef struct{
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) #define FALSE 0 char dID[4];
fputc((int)array[0],fdest); #define TRUE 1 unsigned long dLen;
break; #define ENABLE_ACTIVE 1 }DATA;
case 2: array[0]=(char)((long)(arrayi[0]+ #define ENABLE_NOTACTIVE 2 struct MENU
32768)*255/65535); #define DISABLE 0 { int subMenu[10];
fputc((int)array[0],fdest); #define NONE -1 char *Tip[10];
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) #define MNU_FILE 0 char *String[10];
{ #define MNU_EFFECT 1 int OptionID[10];
array[1]=(char)((long)(arrayi[1]+32768)*255/ #define MNU_OPERATION 2 BOOL Enabled[10];
65535); #define MNU_FADEIN 3 int num_items;
fputc((int)array[1],fdest); #define MNU_FADEOUT 4 char Child;
} #define FILE_OPEN 1 int AtX,AtY;
break; #define FILE_SAVE 2 int nextMenu;
case 3: array[0]=(char)((long)(arrayi[0]+ #define FILE_EXIT 4 int prevMenu;
32768)*255/65535); #define FADEIN_LINEAR 31 } Menu[5];
fputc((int)array[0],fdest); #define FADEIN_EXP 32 long RateOfPlayBack=15000,PBR;
if(TYPE_OF_OUTPUT==STEREO_OUTPUT) #define FADEOUT_LINEAR 41 long double NoSamples=76455;
{ #define FADEOUT_EXP 42 double SamplingFrequency=44000;
array[1]=(char)((long)(arrayi[1]+32768)*255/ #define REVERSE 14 char sFileName[40];
65535); #define PLAYBACK_RATE 15 char sPlayBackRate[6];
fputc((int)array[1],fdest); #define PLAY 21 ❏
} #define RECORD 22

58 ELECTRONICS FOR YOU ❚ MAY 2000


CIRCUIT IDEAS

EDI
DC MOTOR CONTROL USING A SINGLE SWITCH S.C.
DWIV

V. DAVID When you momentarily press switch If you press S1 again, the high output
S1, timer 555 (IC1) provides a pulse to of IC2 shifts from Q3 to Q4. Since Q4 is

T
his simple circuit lets you run a DC decade counter CD4017 (IC2), which ad- connected to reset pin 15, it resets decade
motor in clockwise or anti-clockwise vances its output by one and its high state counter CD4017 and its Q0 output goes
direction and stop it using a single shifts from Q0 to Q1. When Q1 goes high, high, so the motor does not rotate. LED1
switch. It provides a constant voltage for the output of IC3 at pin 3 goes low, so the glows via diode D1 to indicate that the
proper operation of the motor. The glow- motor starts running in clockwise (forward) motor is in stop condition. Thereafter, the
ing of LED1 through LED3 indicates that direction. LED2 glows to indicate that the cycle repeats.
the motor is in stop, forward rotation and motor is running in forward direction. If you don’t want to operate the motor

reverse conditions, respectively. Now if you press S1 again, the high in reverse direction, remove timer IC4
Here, timer IC1 is wired as a output of IC2 shifts from Q1 to Q2. The along with resistors R5 and R7 and LED3.
monostable multivibrator to avoid false low Q1 output of IC2 makes pin 3 of IC3 And connect ‘b’ terminal of the motor to
triggering of the motor while pressing high and the motor doesn’t rotate. LED1 +Vcc.
switch S1. Its time period is approximately glows (via diode D2) to indicate that the Similarly, if you don’t want to run the
500 milliseconds (ms). motor is in stop condition. motor in forward direction, remove timer
Suppose, initially, the circuit is in Pressing switch S1 once again shifts IC3 along with resistors R4 and R6 and
reset condition with Q0 output of IC2 the high output of IC2 from Q2 to Q3. LED2. And connect ‘a’ terminal of the mo-
being high. Since Q1 and Q3 outputs of The high Q3 output of IC2 makes pin 3 of tor to +Vcc.
IC2 are low, the outputs of IC3 and IC4 IC4 low and the motor starts running in The circuit works off a 9V regulated
are high and the motor doesn’t rotate. anti-clockwise (reverse) direction. LED3 power supply for a 9V DC motor. Use a
LED1 glows to indicate that the motor is glows to indicate that the motor is run- 6V regulated power supply for a 6V DC
in stop condition. ning in reverse direction. motor.

ELECTRONICS FOR YOU SEPTEMBER 2004


CIRCUIT
IDEAS

DIGITAL AUDIO/VIDEO
INPUT SELECTOR
IVEDI
S.C. DW

„ T.K. HAREENDRAN

N
eed to connect more than one S1 once. To select the second AV sig- inputs are connected to the second AV
audio-video (AV) source to nal, press switch S1 twice. In the same signal (not shown in the figure). LED4
your colour television? Don’t way, you can select the other two sig- (not shown in figure) glows to indi-
worry, here’s an AV input expander nals. cate this.
for your TV. It is inexpensive and easy Momentarily pressing of switch S1 Similarly, pressing switch S1 thrice
to construct. once results in clocking of the decade makes the Q3 output of IC1 high. Con-
The working of the circuit is simple counter and relay driver transistor T1 sequently, 2C/O relay RL3 (not shown
in the figure) energises
and the television inputs
are connected to the
third AV signal source.
LED5 (not shown in the
figure) glows to indicate
this.
Again, pressing
switch S1 four times
makes the Q4 output of
IC1 high. Consequently,
2C/O relay RL4
energises and the TV in-
puts are connected to the
fourth AV signal source
(marked as Video-in 4
and Audio-in 4). LED6
glows to indicate this.
and straightforward. Whenever 12V conducts to energise relay RL1. Now Further pressing of switch S1 resets
DC is applied to the circuit, power-on normally opened (N/O) contacts of the decade counter and LED2 glows
LED1 glows. Now reset the decade two-changeover relay RL1 connect the again. Thereafter, the cycle repeats. The
counter by momentarily pressing television set’s inputs to the first AV circuit is wired for four-input selec-
switch S2 to make Q0 output of IC1 signal (marked as Video-In 1 and Au- tion, therefore the Q5 output of IC1 is
high. LED2 glows to indicate that the dio-in 1). LED3 glows to indicate this. connected to reset pin 15 of IC1.
circuit is ready to work. When you press switch S1 twice, Enclose the assembled PCB along
Switch S1 is used for selecting a the Q2 output of IC1 goes high. Con- with the relays in a cabinet with the
particular audio-video (AV) signal. To sequently, 2C/O relay RL2 (not shown input/output sockets and indicators
select the first AV signal, press switch in the circuit) energises and television mounted on the body of the cabinet. z

PCB FOR 8085


Available at:
MICROPROCESSOR KIT
Kits‘n’Spares
(EFY NOVEMBER 99) 303, Dohil Chambers, 46, Nehru Place,
New Delhi 110019; Phone: 26430523,
26449577; E-mail: kits@efyindia.com
WITH ALL ITS ICs

108 • MARCH 2005 • ELECTRONICS FOR YOU WWW.EFYMAG.COM

CMYK
DIGITAL DICE WITH NUMERIC
DISPLAY
T
he circuit described here is that binary output pins of the counter IC2 are TABLE I
of a digital dice with numeric dis- connected to corresponding input pins of Dice range Connect Connect
play. Timer IC 555 wired as an 4-bit binary adder IC3 (7483) which is pin 2 to pin 3 to
astable multivibrator produces pulses at wired to give binary output equal to bi- 1 to 2 pin 9 +5V
1 to 3 pin 9 pin 12
about 48 kHz rate. These pulses are fed nary input+1. Thus the output of the dice 1 to 4 pin 8 +5V
to pin 14 of the decade counter IC 7490. ranges from 1 to 6. For obtaining other 1 to 5 pin 8 pin 12
The oscillator is activated by depression dice ranges, reset pins 2 and 3 connections 1 to 6 pin 8 pin 9
of switch S1. may be made as per Table I. 1 to 8 pin 11 +5V
1 to 9 pin 11 pin 12
Using different connections tor pins 2, The binary summation outputs from

3 (reset to zero inputs Ro(1) and Ro(2)) and IC 7483 are connected to IC4 (7447) which of about 48,000 times per second. As soon
the binary output pins 12, 9, 8 and 11 of is a BCD to 7-segment decoder/driver. as the switch is released, the last (latest)
IC7490, various count ranges can be set. The output from IC4 is connected to a number remains on display. Thus the
For the given circuit the count range is set 7-segment common-anode LED display circuit performs the function of a random
as 0 to 5 by connecting QB and QC outputs (LTS542). number generator with the displayed
to Ro(1) and Ro(2) inputs, respectively. When switch S1 is depressed, the LED number lying within the selected (wired)
At the count of 6, QB and QC outputs (D1) glows and the number displayed at range.
of IC2 go high and counter is reset. The the 7-segment display changes at a rate

188 ELECTRONICS PROJECTS Vol. 19


DIGITAL MAINS VOLTAGE INDICATOR
C
ontinuous monitoring of the mains CD4029B (counter). The counter clocked from comparator A2 inhibits the decoder
voltage is required in many ap- by NE555 timer-based astable (CD4514) that is used to decode the out-
plications such as manual volt- multivibrator generates 4-bit binary ad- put of IC4029 and drive the LEDs. This
age stabilisers and motor pumps. An ana- dress for multiplexer-demultiplexer pair ensures that the LEDs of the bar graph
logue voltmeter, though cheap, has many of CD4067B and CD4514B. are ‘on’ up to the sensed voltage-level pro-
disadvantages as it has moving parts and The voltage from the wipers of pre- portional to the mains voltage.
is sensitive to vibrations. The solidstate sets are multiplexed by CD4067B and the The initial adjustment of each of the
voltmeter circuit described here indicates output from pin 1 of CD4067B is fed to presets can be done by feeding a known
the mains voltage with a resolution that the non-inverting input of comparator A2 AC voltage through an auto-transformer
is comparable to that of a general-pur- (half of op-amp LM358) after being buff- and then adjusting the corresponding pre-
pose analogue voltmeter. The status of ered by A1 (the other half of IC2). The set to ensure that only those LEDs that
the mains voltage is available in the form unregulated voltage sensed from rectifier are up to the applied voltage glow.
of an LED bar graph. output is fed to the inverting input of (EFY note. It is advisable to use ad-
Presets VR1 through VR16 are used comparator A2. ditional transformer, rectifier, filter, and

to set the DC voltages corresponding to The output of comparator A2 is low regulator arrangements for obtaining a
the 16 voltage levels over the 50-250V until the sensed voltage is greater than regulated supply for the functioning of the
range as marked on LED1 through the reference input applied at the non- circuit so that performance of the circuit
LED16, respectively, in the figure. The inverting pins of comparator A2 via buffer is not affected even when the mains volt-
LED bar graph is multiplexed from the A1. When the sensed voltage goes below age falls as low as 50V or goes as high as
bottom to the top with the help of ICs the reference voltage, the output of com- 280V. During Lab testing regulated 12-
CD4067B (16-channel multiplexer) and parator A2 goes high. The high output volt supply for circuit operation was used.)

ELECTRONICS PROJECTS Vol. 22


CIRCUIT IDEAS

DIGITAL STOP WATCH S.C.


DWI
VED
I

C.H. VITHALANI push-on-switch S3. When S2 is momen- Thus, when switch S3 is pressed, reset
tarily pressed, the count value becomes pin 13 of IC2 is connected to ground

H
ere’s a digital stop watch built 0, transistor T1 conducts and it resets via transistor T1 and the oscillator does
around timer IC LM555 and 4-digit IC1. Counting starts when S2 is in ‘off’ not generate clock pulses. This is done
counter IC with multiplexed 7-seg- condition. to achieve synchronisation between IC1
ment output drivers (MM74C926). A low signal on the latch-enable input and IC2.
IC MM74C926 consists of a 4-digit pin 5 (LE) of IC2 latches the number in First, reset the circuit so that the dis-
counter, an internal output latch, npn the counter into the internal output latches. play shows ‘0000.’ Now open switch S2
output sourcing drivers for common- When switch S2 is pressed, pin 5 goes for the stop watch to start counting the
cathode, 7-segment display and an low and hence the count value gets stored time. If you want to stop the clock, close

internal multiplexing circuitry with four in the latch. Display-select pin 6 (DS) de- switch S2.
multiplexing outputs. The multiplexing cir- cides whether the number on the counter Rotary switch S1 is used to select the
cuit has its own free running oscillator, or the number stored in the latch is to be different time periods at the output of the
and requires no external clock. The displayed. If pin 6 is low the number in astable multivibrator (IC1). The circuit
counter advances on negative edge of the output latch is displayed, and if pin 6 works off a 5V power supply. It can be
the clock. The clock is generated by timer is high the number in the counter is dis- easily assembled on a general-purpose
IC LM555 (IC1) and applied to pin 12 played. PCB. Enclose the circuit in a metal box
of IC2. When switch S2 is pressed, the with provisions for four 7-segment dis-
A high signal on reset pin 13 of base of pnp transistor T2 is connected to plays, rotary switch S1, start/stop switch
IC2 resets the counter to zero. Reset pin ground and it starts conducting. The emit- S2 and reset switch S3 in the front panel
13 is connected to +5V through reset ter of T2 is connected to DS pin of IC2. of the box.

JULY 2004 ELECTRONICS FOR YOU


DIGITAL SPEEDOMETER
NARENDRA WADHWANI

T
his instrument displays the speed the IR LED, a phototransistor is and thus output of LM324 becomes logic
of the vehicle in kmph. An mounted. IC LM324 is wired as a ‘high’. So rotation of the speedometer
opaque disc is mounted on the comparator. cable results in a pulse (square wave) at
spindle attached to the front wheel of When a hole appears between the the output of LM324. The frequency of
the vehicle. The disc has ten equidistant IR LED and phototransistor, the this waveform is proportional to the
holes on its periphery. On one side of phototransistor conducts. Hence the volt- speed.
the disc an infrared LED is fixed and on age at collector of the phototransistor Let ‘N’ be the number of pulses in
the opposite side of the disc, in line with and inverting input of LM324 go ‘low’, time ‘t’ seconds and numerically equal
to the number of kilometres per hour
(kmph). For a vehicle such as LML
Vespa, with a wheel circumference of
1.38 metres, and number of pulses equal
to 10 per revolution, we get the
relationship:
N pulses
= N kmph
t
Nx1000
= metres per second
3600x1.38
Nx1000x10
= pulses per second
3600x1.38

Therefore, time ‘t’ in seconds


= 0.4968 second.
As shown in the timing diagram, at
t=0, output of astable flip-flop IC1(a) i.e.
½556 goes low and triggers monostable
multivibrator IC1(b) i.e. ½556. Pulse
width of monostable IC1(b) = 0.5068 sec.
For IC1(a), t(on) = 0.51 sec. and t(off)=
0.01 sec. The outputs of IC1(a) and
IC1(b), and the signal from the
transducer section are ANDed. The
number of pulses counted during the
gating period (0.4968 sec.) is the speed
N in kmph (kilometres per hour).
At the end of the gating period,
output ‘B’ of monostable IC1(b) goes low
and B goes high. The rising edge of B is
used to enable the quad ‘D’ flip-flops IC6
and IC7.
At this instant, i.e. at t=0.5068 sec.,
the number (speed) N will be latched
corresponding to the ‘D’ flip-flops and
displayed. At t=0.52 sec., output of
astable flip-flop IC1(a) goes low and
remains low for 0.01 sec. This
waveform is inverted and applied to
the reset terminals of all counters (ac-
tive high).
Thus the counters are reset and

140 ELECTRONICS PROJECTS Vol. 19


previous speed is displayed. The Yamaha, whose circumference of wheel
new speed is displayed at t=0.52 + = 1.8353m, can be obtained in a similar
0.5068 sec. In this way the speed fashion. The gating period will simply
will be updated every 0.52 sec. vary in direct proportion to the wheel
This speedometer can measure diameter. It will be 0.6607 sec. for
up to 99 kmph with a resolution of Yamaha.
1 kmph. The range can be increased The same speedometer can be used
up to 999 kmph by adding another for other vehicles by making similar cal-
stage consisting of one each of ICs culations. In all the calculations it has
7490, 74175, 7447 and a 7-segment been assumed that the speedometer
display. The voltage supply required cable makes one revolution for every
for the operation of the circuit is revolution of the wheel of the vehicles.
derived from the vehicle power Note that on/off periods of the wave-
supply (12V). forms have to be precise. High quality

counting begins afresh at t=0.53 sec. up The calculations shown above are for multiturn pots and low temperature co-
to the time t=0.52+0.2068 sec. However LML Vespa and Kinetic Honda. The cal- efficient components should be used in
the ‘D’ flip-flops are not enabled and the culations for using this speedometer for the timer ICs.

ELECTRONICS PROJECTS Vol. 19 141


ECONOMICAL PUMP CONTROLLER
T
he automatic pump controller quick response, no wear and tear, and cannot be used for purely non-conducting
eliminates the need for any no mechanical failures. The circuit fluids. For non-conducting fluids, some
manual switching of pumps in- diagram is shown in Fig.2. The device modifications need to be made in the fluid-
stalled for the purpose of pumping wa- performed satisfactorily on a test run level sensors. The circuit can however be
ter from a reservoir to an overhead tank in conjunction with a 0.5 HP motor kept intact.
(refer Fig.
1). It auto-
matically
switches on
the pump
when the
water level
in the tank
falls below
a certain
low level
L), provided
the water
level in the
reservoir
is above a
certain level
(R). Subse-
quently, as
the water
level in the
lank rises
to an upper
l e v e l ( M ) , Fig. 2: Circuit diagram of pump controller.
the pump is
switched off automatically. The pump and pump.
is turned on again only when the water The sensors used in the circuit can
level again falls below level L in the be any two conducting probes, preferably
tank, provided the level in the reser- resistant to electrolytic corrosion. For
voir is above R. This automated action instance, in the simplest case, a properly
continues. sealed audio jack can be used to work as
The circuit is designed to ‘overlook’ the sensor.
the transient oscillations of the water The circuit can also be used as a
level which would otherwise cause the constant fluid level maintainer. For this
logic to change its state rapidly and purpose the probes M and L are brought
unnecessarily. The circuit uses a single very close to each other to ensure that the
CMOS chip (CD4001) for logic process- fluid level is maintained within the M and
ing. L levels.
No use of any moving electro- The advantage of this system is that
mechanical parts in the water-level it can be used in tanks/reservoirs of any
sensor has been made. This ensures capacity whatsoever. However, the circuit Fig. 1: Block diagram of pump controller.

184 ELECTRONICS PROJECTS Vol. 19


Electrical Equipment Control
Using PC
P.V. Vinod Kumar

H
ere is a novel idea
for using the printer
port of a PC, for con-
trol application using soft-
ware and some interface
hardware. The interface cir-
cuit along with the given
software can be used with
the printer port of any PC for
controlling up to eight equip-
ment. for only one device, being controlled by
The interface circuit D0 bit at pin 2 of the 25-pin parallel port.
shown in the figure is drawn Identical circuits for the remaining data

ELECTRONICS PROJECTS Vol. 20 179


CIRCUIT IDEAS

Electronic Jam A.P.S


. DH
ILLO
N
output pin 8 of IC3 becomes high, which
causes outputs of both gates N1 and
N2 to go to logic 0 state. Logic 0 output
of gate N2 inhibits IC1, and thus press-
RAJESH K.P. ing of any other switch S1 through S8
has no effect. Thus, the contestant who

T
his jam circuit can be used in through R8. All eight outputs of IC1 presses his switch first, jams the dis-
quiz contests wherein any par- are connected to inputs of priority en- play to show only his number. In the
ticipant who presses his button coder 74LS147 (IC2) as well as 8-input unlikely event of simultaneous press-
(switch) before the other contestants, NAND gate 74LS30 (IC3). The output ing (within few nano-seconds difference)
gets the first chance to answer a ques- of IC3 thus becomes logic 0 which, after of more than one switch, the higher
tion. The circuit given here permits up inversion by NAND gate N2, is applied priority number (switch no.) will be
to eight contestants with each one al- to latch-enable pin 11 of IC1. With all displayed. Simultaneously, the logic 0
lotted a distinct number (1 to 8). The input pins of IC2 being logic 1, its BCD output of gate N1 drives the buzzer via
display will show the number of the con- output is 0000, which is applied to 7- pnp transistor BC158 (T1). The buzzer
testant pressing his button before the segment decoder/driver 74LS47 (IC6) af- as well the display can be reset (to
others. Simultaneously, a buzzer will ter inversion by hex inverter gates in- show 0) by momentary pressing of re-
also sound. Both, the display as well as side 74LS04 (IC5). Thus, on reset the set switch S9 so that next round may
the buzzer have to be reset manually display shows 0. start.
using a common reset switch. When any one of the push-to-on Lab Note: The original circuit sent
Initially, when reset switch S9 is mo- switches—S1 through S8—is pressed, by the author has been modified as it
mentarily pressed and released, all out- the corresponding output line of IC1 is did not jam the display, and a higher
puts of 74LS373 (IC1) transparent latch latched at logic 0 level and the display number switch (higher priority), even
go ‘high’ since all the input data lines indicates the number associated with when pressed later, was able to change
are returned to Vcc via resistors R1 the specific switch. At the same time, the displayed number.

ELECTRONICS FOR YOU n  JUNE '99


CIRCUIT IDEAS

ELECTRONIC MOTOR STARTER SUN


IL KU
MAR

T.A. BABU preset VR1 such that T1 conducts when While making over-/under-voltage set-
voltages goes beyond upper limit (say, ting, disconnect C2 temporarily. Capacitor

T
his motor starter protects single- 260V). When T1 conducts, it switches off C2 prevents relay chattering due to rapid
phase motors against voltage fluc- T2. Transistor T2 works as the under-volt- voltage fluctuations.
tuations and overloading. Its salient age protector. The under-voltage setting is Regulator IC 7809 gives the 9V regu-
feature is a soft on/off electronic switch done with the help of preset VR2 such that lated supply to soft switch as well as the
for easy operation. T2 stops conducting when voltage is below relay after filtering by capacitor C4. A suit-
The transformer steps down the AC lower limit (say, 180V). Zener diodes ZD1 able miniature circuit breaker is used for
voltage from 230V to 15V. Diodes D1 and and ZD2 provide base bias to transistors T1 automatic over-current protection. Green

D2 rectify the AC voltage to DC. The un- and T2, respectively. Transistors T3 and T4 LED (LED1) indicates that the motor is
regulated power supply is given to the pro- are connected back to back to form an SCR ‘on’ and red LED (LED2) indicates that
tection circuit. configuration, which behaves as an ‘on’/ the power is ‘on’. The motor is connected
In the protection circuit, transistor T1 is ‘off’ control. Switch S1 is used to turn on to the normally-open contact of the relay.
used to protect the motor from over-volt- the pump, while switch S2 is used to turn When the relay energises, the motor turns
age. The over-voltage setting is done using off the pump. on.

OCTOBER 2003 ELECTRONICS FOR YOU


Electronic Scoring Game
Y
ou can play this game alone
or with your friends. The
circuit comprises a timer IC,
two decade counters and a display
driver along with a 7-segment
display.
The game is simple. As stated
above, it is a scoring game and the
competitor who scores 100 points rap-
idly (in short steps) is the winner. For
scoring, one has the option of pressing
either switch S2 or S3. Switch S2,
when pressed, makes the counter
count in the forward direction, while
switch S3 helps to count downwards. Before ‘Y’, is summarised below: above and notes down his new score (say,
starting a fresh game, and for that matter 1. Player ‘X’ starts by momentary X2). He adds up this score to his previous
even a fresh move, you must press switch pressing of reset switch S1 followed score. The same procedure is repeated by
S1 to reset the circuit. Thereafter, press any by pressing and releasing of either player ‘Y’ in his turn.
of the two switches, i.e. S2 or S3. switch S2 or S3. Thereafter he presses 4. The game carries on until the score
On pressing switch S2 or S3, the switch S4 to read the display (score) attained by one of the two players totals
counter’s BCD outputs change very and notes down this number (say X1) up to or exceeds 100, to be declared as the
rapidly and when you release the switch, manually. winner.
the last number remains latched at the 2. Player ‘Y’ also starts by momen- Several players can participate in this
output of IC2. The latched BCD number tary pressing of switch S1 followed game, with each getting a chance to score
is input to BCD to 7-segment decoder/ by pressing of switch S2 or S3 and during his own turn.
driver IC3 which drives a common- then notes down his score (say Y1), The circuit may be assembled
anode display DIS1. However, you can after pressing switch S4, exactly using a multipurpose board. Fix the
read this number only when you press in the same fashion as done by the first display (LEDs and 7-segment display)
switch S4. player. on top of the cabinet along with the
The sequence of operations for playing 3. Player ‘X’ again presses switch S1 three switches. The supply voltage for the
the game between, say two players ‘X’ and and repeats the steps shown in step 1 circuit is 5V.

ELECTRONICS PROJECTS Vol. 20


CIRCUIT IDEAS

ELECTRONIC SECURITY SYSTEM S.C. DWI


VED
I

K. BHARATHAN output of
t h e

T
his reliable and easy-to-operate elec- Darlington
tronic security system can be used pair drives
in banks, factories, commercial es- the loud-
tablishments, houses, etc. speaker
The system comprises a monitoring sys- whose out-
tem and several sensing zones. Each sens- put volume
ing zone is provided with a closed-loop can be con-
switch known as sense switch. Sense trolled by
switches are fixed on the doors of premises potentiom-
under security and connected to the moni- eter VR1.
toring system. As long as the doors are Capacitor
closed, sense switches are also closed. The C1 serves
monitoring system can be installed at a as a filter
convenient central place for easy operation. capacitor.
Fig. 1 shows the monitoring circuit Y o u
only for zone 1 along with the common can alter
alarm circuit. For other zones, the the alarm
monitoring circuit is identical, with only sound as
the prefixes of components changing desired by
as per zone number. Encircled points A, changing
B, and C of each zone monitoring circuit the con-
need to be joined to the corresponding nections of
points of the alarm circuit (upper half IC1 as
of Fig. 1). shown in
When zone 1 sensing switch S11, zone the table.
on/off slide switch S12, and system on/off T h e
switch S1 are all on, pnp transistor T12 circuit con-
reverse biases to go in cut-off condition, tinues to
with its collector at around 0 volt. When sound the
the door fitted with sensor switch S11 is alarm until
opened, transistor T12 gets forward biased zone door Fig. 1: Monitoring circuit along with the alarm circuit
and it conducts. Its collector voltage goes
high, which forward biases transistor T10
via resistor R10 to turn it on. (Capacitor
C10 serves as a filter capacitor.) As a re-
sult, the collector voltage of transistor T10
falls to forward bias transistor T11, which
conducts and its collector voltage is sus-
tained at a high level. Under this latched
condition, sensor switch S11 and the state
of transistor T12 have no effect. In this
state, red LED11 of the zone remains lit.
Simultaneously, the high-level voltage
from the collector of transistor T11 via di-
ode D10 is applied to VDD pin 5 of siren
sound generator IC1 (UM3561) whose pin
2 is grounded. Resistor R3 connected across
pins 7 and 8 of IC1 determines the fre-
Fig. 2: Physical layout of sensors and monitoring/alarm system
quency of the in-built oscillator. As a re-
sult, IC1 starts generating the audio signal is closed (to close switch S11) and the The system operates off a 3V DC bat-
output at pin 3. The output voltage from reset switch is pressed momentarily (which tery or recharging battery with charging
IC1 is further amplified by Darlington pair causes transistor T10 to cut off, returning circuit or battery eliminator. If desired,
of transistors T1 and T2. The amplified the circuit to its initial state). more operating zones can be added.

MARCH 2003 ELECTRONICS FOR YOU


CIRCUIT IDEAS

Alarm sound Circuit connections for respective ing to the zone glows to indicate that the
zones in closed door of the zone is open. The alarm and
IC pin 1 connected to IC pin 6 connected to position. Also the LED indication will continue even af-
Police siren NC NC keep zone slide ter that particular door with the sensing
Ambulance siren NC VDD switches S12, S22, switch is immediately closed, or even if
Fire engine Sound NC VSS S32, S42, etc in that switch is removed/damaged or con-
Machinegun sound VSS NC ‘on’ position. This necting wire is cut open.
puts the system in Any particular zone in the monitoring
Note. NC indicates no connection
operation, guard- system can be put to operation or out of
ing all the zone operation by switching on or switching off
Initially keep the monitoring system doors. the corresponding slide switch in the moni-
switch S1 off. Keep all the zone doors fixed Now, if the door of a particular zone toring system.
with sensing switches S11, S21, S31, S41, is opened, the monitoring system sounds The circuit for monitoring four zones
etc closed. This keeps the sensing switches an audible alarm and the LED correspond- costs around Rs 400.

ELECTRONICS FOR YOU MARCH 2003


CIRCUIT IDEAS

ELECTRONIC WATCHDOG S.C.


DWI
VED
I

TAPAN KUMAR MAHARANA The circuit comprises


a transmitter unit and

H
ere’s an electronic watchdog for a receiver unit, which
your house that sounds to inform are mounted face to
you that somebody is at the gate. face on the opposite

Fig. 4: Mounting arrangement for transmitter and receiver units

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
Fig. 1: 38kHz IR transmitter circuit Fig. 3: Pin configurations of multivibrator producing a frequency of
TSOP1738 and UM66 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 monostable
multivibrator with a time pe-
riod 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 configurations of IR
sensor TSOP1738 and melody
generator IC UM66.
Fig. 2: Receiver circuit The power supply for the

transmitter is derived from the receiver and trigger pin 2 of IC2 remains high. Fig. 4 shows mounting arrangement
circuit by connecting its points A and B When anyone interrupts the IR beam for both the transmitter and receiver units
to the respective points of the receiver falling on the sensor, its output goes high on the gate pillars. To achieve a high di-
circuit. The receiver is powered by regu- to drive transistor T1 into conduction and rectivity of the IR beam towards the sen-
lated 6V DC. For the purpose, you can pin 2 of IC2 goes low momentarily. As a sor, use a reflector behind the IR LED.
use a 6V battery. result, IC2 gets triggered and its pin 3 After both the units have been built,
The transmitter and receiver units are goes high to supply 3.3V to melody gen- connect 6V power supply to the receiver
aligned such that the IR beam falls di- erator IC3 at its pin 2, which produces a circuit. You should hear a continuous
rectly on the IR sensor. As long as IR sweet melody through the speaker fitted melody from the speaker. Now connect
beam falls on the sensor, its output re- inside the house. Output pin 3 of IC2 6V power to the transmitter also and
mains low, transistor T1 does not conduct remains high for around 30 seconds. orient IR LED1 towards IR receiver. The

NOVEMBER 2004 ELECTRONICS FOR YOU


CIRCUIT IDEAS

melody should stop after about 30 sec- door, the IR beam is interrupted and the Using preset VR1, you can set the volume
onds. Now the transmitter and the re- alarm sounds for 30 seconds. The alarm of the loudspeaker.
ceiver units are ready for use. keeps sounding as long as one stands This circuit can also be used as a door-
When somebody enters through the between the transmitter and receiver units. bell or burglar alarm.

ELECTRONICS FOR YOU NOVEMBER 2004


FLUID LEVEL DETECTOR
H
ere is a simple but versatile cir-
cuit of fluid level detector which
can be used for various applica-
tions at home and in industry.
Circuit is built around 2-input NAND
Schmitt trigger gates N1 and N2. Gate
N1 is configured as an oscillator operat-
ing at around 1 kHz frequency. When
the fluid level reaches the probe’s level,
the oscillations are coupled to the diode
detector stage comprising diodes D1 and
D2. capacitor C4 and resistor R2. The
positive voltage developed across ca-
pacitor C4 and resistor R2 combination
is applied to Schmitt NAND gate N2 be suitably interfaced to any external detector circuit. Since high frequency AC
which is used here as a buffer/driver. circuit for indication purposes or driving is used for the electrodes, there is no cor-
The output of gate N2 is connected to any load as desired. rosion of the electrodes which is normally
opto-coupler MCT2E. The output across Use of opto-coupler ensures complete observed with DC being applied to the
pins 4 and 5 of the opto-coupler can isolation of the load from the fluid level electrodes.

196 ELECTRONICS PROJECTS Vol. 19


circuit
ideas

Guitar Effect Pedal Power


edi
s.c. dwiv
 Raj K. Gorkhali connecting points as shown in Fig. 2.
The circuit (Fig. 2) can be divided

A
friend of mine plays guitar with into two sections: power supply and
several guitar effect pedals. He signal handling. The power supply regulators. This supply is more than
had a problem with battery section is built around transformer X1, enough for the five effect pedals.
eliminators and cables of the pedals regulators 7805 and 7905, bridge recti- The greater the voltage drop across
cluttering the stage and so he asked fier comprising diodes D1 through D4, the regulator, the lower the output
for help. The solution is simple as de- and a few discrete components. The current potential. Resistors R1 and
scribed here. signal-handling circuit is built around R2 provide a constant load to ensure
A small box is fitted to the rear of two OP27 op-amps (IC3 and IC4). that the regulators keep regulating.
the amplifier providing a 9V output for The power supply of about 9V Capacitors C3 through C8 ensure that
the effect pedal. The amplifier section for the effect pedals is derived from the supplies are as clean as possible. It
gets 9V through step-down transformer X1. MOV1 is a is very important to use proper heat-
a pedal switch metal-oxide varistor that absorbs any sinks for IC1 and IC2. Otherwise, these
(refer Fig. 1). large spike in mains power. could heat up.
This power out- IC 7905 (IC1) is a -5V low-power Working of the circuit is simple.
put and guitar regulator. By using a 3.9V zener diode The input signal stage uses a basic
signal input (ZD1) at its ground terminal, you get differentiation amplifier to accept the
lines are com- -8.9V output. The same technique is incoming signal and a voltage fol-
bined into a also applied to IC 7805 (IC2)—a +5V lower to buffer the output to the power
Fig. 1: A typical guitar
single unit with regulator to get 8.9V. Use good-qual- amplifier. The differential amplifier is
pedal switch multi-way cable ity components and heat-sinks for the built around IC3. It works by effective-
ly looking at the signals
presented to its inputs.
If the input signals are of
different amplitudes, IC3
amplifies the difference
by a factor determined
by R4/R3 (where R4=R6
and R3=R5). If the input
signals have same ampli-
tudes, these are attenuat-
ed by the common-mode
rejection ratio (CMRR) of
the circuit. The value of
CMRR is determined by
the choice of the op-amp
the auxiliary components
used and circuit topolo-
gy. You can use standard
resistors. With the values
shown, you get an overall
gain of unity.
The combination
of resistor R7 and C13
serves as a passive low-
pass filter, progressively
attenuating unwanted
high-frequency signals.
Fig. 2: Pedal power circuit The second op-amp (IC4)

1 0 8 • D e c e m b e r 2 0 1 0 • e l e c t ro n i c s f o r yo u w w w. e f y m ag . co m
circuit
ideas
forms a simple voltage follower (its amplifier. The unit must be compact, First, mains power is tapped from the
output follows its input), providing a yet robust. So use a very sturdy alu- transformer. The second lead carries
low output impedance to drive into the minium extrusion for the cabinet in or- the 9V output to the amplifier. The
standard power amplifier. der to neatly house the assembled PCB. third is the guitar signal input at the
Assemble the circuit on a general- To ensure simple operation, there five-way socket for connection to the
purpose PCB and fit it to the rear of an are only three connections to the unit. effect pedal. 

w w w. e f y m ag . co m e l e c t ro n i c s f o r yo u • D e c e m b e r 2 0 1 0 • 1 0 9
Handy Zener Diode Tester
H
ere is a handy zener diode four 1.5V batteries and the remaining one- quired AC voltage across transformer’s
tester which tests zener diodes third is sufficient for accommodating this 230V AC terminals. This AC voltage is
with breakdown voltages extend- circuit. In this circuit a commonly available converted to DC by diode D1 and filter
ing up to 120 volts. The main advantage transformer with 230V AC primary to 9-0- capacitor C2 and is used to test the zener
of this circuit is that it works with a volt- 9V, 500mA secondary is used in reverse to diodes. R3 is used as a series current
age as low as 6V DC and consumes less achieve higher AC voltage across 230V AC limiting resistor.
than 8 mA current. terminals. After assembling the circuit, check DC
The circuit can be fitted in a 9V battery Transistor T1 (BC547) is configured voltage across points A and B without con-
box. Two-third of the box may be used for as an oscillator and driver to obtain re- necting any zener diode. Now switch S1
on. The DC voltage across A-B should vary
from 10V to 120V by adjusting potmeter
VR1 (10k). If every thing is all right, the
circuit is ready for use.
For testing a zener diode of un-
known value, connect it across points A
and B with cathode towards A. Adjust
potmeter VR1 so as to obtain the maxi-
mum DC voltage across A and B. Note
down this zener value corresponding
to DC voltage reading on the digital
multimeter.
When testing zener diode of value less
than 3.3V, the meter shows less voltage
instead of the actual zener value. However,
correct reading is obtained for zener diodes
of value above 5.8V with a tolerance of ±10
per cent. In case zener diode shorts, the
multimeter shows 0 volts.

ELECTRONICS PROJECTS Vol. 20


CIRCUIT IDEAS

HIT SWITCH SAN


I THE
O
Initially, the input of gate N1 is low,
while the input of gate N2 is high. Trig-
gering the voltage-control switch by hit-
ting the sensor pulls the input of gate N1
T.A. BABU amplified by transistor BC547 (T1). The to high level and causes the bistable to
combination of transistor T1 and the bridge toggle. The capacitor gets charged via re-

T
his versatile hit switch is the elec- rectifier comprising diodes D1 through D4 sistor R1 and the circuit changes its state.
tronic equivalent of a conventional acts as a voltage-control switch. The in- This latch continues until the bistable
switch. It can be used to control verter gates of IC CD4069 (IC1) together switch gets the next triggering input.
the switching of a variety of electronic with associated components form a Every time the hit plate receives a hit,
devices. bistable switch. the voltage-control switch triggers the
The circuit of the hit switch uses a IC CD4069 is a CMOS hex inverter. bistable circuit. That means every subse-
piezoelectric diaphragm (piezobuzzer) as Out of the six available inverter gates, only quent hit at the sensor will toggle the state
the hit sensor. A piezoelectric material de- three are used here. IC1 operates at any of the switch. The red LED (LED1) con-
velops electric polarisation when strained voltage between 3V and 15V and offers a nected at the output of gate N3 indicates
‘on’/‘off’ position of
the switch. Relay
RL1 is activated by
the hit switch to con-
trol the connected
load.
The circuit works
off 12V DC. It can be
constructed on any
general-purpose PCB.
For the desired re-
sults, proper connec-
tions and installation
of the hit sensor are
necessary. Remove
the cover of the
by an applied stress. The hit sensor makes high immunity against noise. The recom- piezobuzzer and connect its two leads to
use of this property. mended operating temperature range for the circuit. Mount the plate such that it
When you hit or knock the piezo ele- this IC is –55°C to 125°C. This device is receives the hit properly. The piezoelectric
ment (hit plate) with your fingertip, a small intended for all general-purpose inverter material on the plate can easily get dam-
voltage developed by the piezo element is applications. aged, so hit the switch gently.

ELECTRONICS FOR YOU DECEMBER 2004


HOUSE SECURITY SYSTEM
MALAY BANERJEE

H
ere is a low-cost, invisible laser M1 through M6 is used to direct the step-down transformers (X1 and X2), two
circuit to protect your house laser beam around the house to form a 6V relays (RL1 and RL2), an LDR, a
from thieves or trespassers. A net. The laser beam is directed to fi- transistor, and a few other passive com-
laser pointer torch, which is easily avail- nally fall on an LDR that forms part of ponents. When switches S1 and S2 are
able in the market, can be used to oper- the receiver unit as shown in Fig. 2. activated, transformer X1, followed by a
ate this device. Any interruption of the beam by a thief/ full-wave rectifier and smoothing capaci-
The block diagram of the unit shown trespasser will result into energisation tor C1, drives relay RL1 through the
in Fig. 1 depicts the overall arrange- of the alarm. The 3V power-supply cir- laser switch.
ment for providing security to a house. cuit is a conventional full-wave recti- The laser beam should be aimed con-
A laser torch powered by 3V power- fier-filter circuit. Any alarm unit that tinuously on LDR. As long as the laser
supply is used for generating a laser operates on 230V AC can be connected beam falls on LDR, transistor T1 re-
beam. A combination of plain mirrors at the output. mains forward biased and relay RL1 is
The receiver thus in de-energised condition. When a
unit comprises person crosses the line of laser beam,
two identical relay RL1 turns on and transformer X2

gets power supply and RL2


energises. In this condition,
the laser beam will have no
effect on LDR and the alarm
will continue to operate as long
as switch S2 is on.
When the torch is switched
on, the pointed laser beam is
reflected from a definite point/
place on the periphery of the
house. Making use of a set of
properly oriented mirrors
one can form an invisible net
of laser rays as shown in the
block diagram. The final ray
should fall on LDR of the
circuit.
Note. LDR should be kept
in a long pipe to protect it from
other sources of light, and
its total distance from the
source may be kept limited to
500 metres.

ELECTRONICS PROJECTS Vol. 22 119


CIRCUIT
IDEAS

INFRARED BUG S.C. DW


IVEDI

„ T.K. HAREENDRAN cuit, in principle, con-


verts the IR signal pulse

T
his circuit can be used to de- trains into noticeable au-
tect the presence of modulated ral notes.
infrared signals in its vicinity S1 is used to switch
from any electronic source, for in- on/off mains power and
stance, an IR handheld remote control- LED1 indicates power-
ler. It can also be used for testing IR ‘on.’ Resistor R4 and
burglar alarm systems. zener diode ZD2 form
Fig. 1 shows the circuit of the in- a low-current voltage Fig. 2: Pin configurations of LM386, BC547/337 and UM66
frared bug. Besides the power supply stabiliser for providing
(one 9V PP3/6F22 compact battery steady 5.1V DC to the small signal- T2. The amplified signal is fed to the
pack), it consists of an infrared preamplifier circuit. IR LED1 is the melody generator via resistor R5. The
signal detector-cum-preamplifier main sensing element. output of the melody generator is fed
followed by a melody generator The IR signal detected by IR LED1 to LM386 low-power audio amplifier
and a tiny audio amplifier. The cir- is amplified by npn transistors T1 and (IC2) via variable resistor VR1, which
works as the volume control.
The loudspeaker sounds to in-
dicate the presence of IR signal
near the circuit.
IC LM386 is wired as a
minimum-parts amplifier with
a voltage gain of ‘20,’ which is
sufficient for this application.
Capacitor C3 is used for
decoupling of the positive rail
and the R-C combination net-
work comprising C4 and R7
bypasses high frequency to
ground.
The circuit can be easily
wired on a small veroboard or
any general-purpose PCB. Pin
configurations of IC LM386,
transistor BC547 and melody
generator UM66 are shown in
Fig. 2. A miniature metallic
cabinet may be used for enclos-
Fig. 1: Infrared bug ing the gadget. z

100 • MARCH 2006 • ELECTRONICS FOR YOU WWW.EFYMAG.COM

CMYK
CIRCUIT IDEAS

INFRARED PROXIMITY DETECTOR SUN


IL KU
MAR

K.S. SANKAR The receiver section comprises an in- Both the transmitter and the receiver
frared receiver module, a 555 monostable parts can be mounted on a single bread-

T
his proximity detector using an multivibrator, and an LED indicator. Upon board or PCB. The infrared receiver must
infrared detector (Fig. 1) can be reception of infrared signals, 555 timer be placed behind the infrared LED to avoid
used in various equipment like au- (mono) turns on and remains on as long false indication due to infrared leakage.
tomatic door openers and burglar alarms. as infrared signals are received. When the An object moving nearby actually
The circuit primarily consists of an infra- signals are interrupted, the mono goes off reflects the infrared rays emitted by the
red transmitter and an infrared receiver. after a few seconds (period=1.1 R7xC6) infrared LED. The infrared receiver has
The transmitter section consists of a depending upon the value of R7-C6 com- sensitivity angle (lobe) of 0-60 degrees,
555 timer IC functioning in astable mode. bination. Thus if R7=470 kilo-ohms and hence when the reflected IR ray is
It is wired as shown in the figure. The C6=4.7µF, the mono period will be around sensed, the mono in the receiver part is
output from astable is fed to an infrared 2.5 seconds. triggered. The output from the mono may
LED via resistor R4, which limits its oper- be used in any desired fashion. For ex-
ating current. This circuit provides a fre- ample, it can be used to turn on a
quency output of 38 kHz at 50 per cent light when a person comes nearby by
duty cycle, which is required for the infra- energising a relay. The light would auto-
red detector/receiver module. Siemens matically turn off after some time as the
SFH5110-38 is a much better choice than person moves away and the mono pulse
SFH506-38. Siemens SFH5110-38 is turned period is over.
on by a continuous frequency of 38 kHz The sensitivity of the detector depends
with 50 per cent duty cycle, whereas Fig. 2: Proposed arrangement for on current-limiting resistor R4 in series
SFH506 requires a burst frequency of 38k separation of IR LED and receiver module with the infrared LED. Range is approxi-
to sense. Hence, SFH5110-38 is used. in the proximity detector mately 40 cm. For 20-ohm value of R4 the
object at 25 cm can
be sensed, while for
30-ohm value of R4
the sensing range re-
duces by 22.5 cm.
(Note. The au-
thor procured the
samples of Siemens
products from
Arihant Electricals,
New Delhi, the dis-
tributor of Siemens
in India.)
This circuit costs
Fig. 1: IR proximity detector around Rs 125.

ELECTRONICS FOR YOU JANUARY 2003


CIRCUIT IDEAS

INFRARED REMOTE CONTROL TIMER S.C.


DWI
VED
I

Fig. 2: IR receiver section


DIPANJAN BHATTACHARJEE whose frequency may
be varied with the help

T
his infrared remote control timer can of potmeter VR3.
be used to turn an appliance on/off When switch S1 of
for a period of 0.11 second to 110.0 the transmitter is
seconds. pressed, the modu-
The circuit comprises two sections, lated IR rays are gen-
namely, the transmitter section and the erated, which are re-
receiver section. ceived by photodiodes
Fig. 1 shows the IR transmitter sec- in the receiver section
tion. The astable multivibrator NE555 (IC1) and amplified by the
is used to generate a 10kHz modulated IR amplifier circuit. The
signal. The output of IC1 is connected to output of op-amp goes
the base of pnp transistor T1 via resistor low to trigger the
R2. Two infrared LEDs (IR1 and IR2) are monostable. Then high
connected in series between the collector output at pin 3 of IC3
(via resistor R3) and ground. activates the two-
When switch S1 is pressed, the IR LEDs changeover relay RL
transmit the modulated IR signal of 10-11 via transistor T3
kHz. This frequency can be changed with (BC548) for a preset
the help of VR1 potmeter. time.
In the receiver section shown in Fig. The on/off time
2, two photodiodes (IR3 and IR4) receive can be set in the timer
the IR signal transmitted by the IR trans- with the help of VR3
mitter. Transistors T2 and T3 amplify the and C10. Switch S2 is
weak signal. The amplified signal is fil- used to reset the
tered by capacitors C6 and C7. The ampli- monostable. If you
fied and filtered signal is now fed to the want to turn the appli-
inverting input pin 2 of op-amp IC2 (IC ance on for a preset
741). The output of IC2 is further con- time, connect the ap-
nected to trigger pin 2 of timer NE555 (IC3) pliance via relay RL(a).
that is used as a monostable multivibrator On the other hand, if
you want to
turn the appli-
ance off for a
preset time,
connect the ap-
pliance via re-
lay RL(b). The
timer can be re-
set by pressing
reset switch S2.
The circuit
works up to 3
metres without
using any fo-
cusing lens.
However, you
can increase
the operating
range by using
focusing lens.
This circuit
costs around
Fig. 1: IR transmitter section Rs 100.

MAY 2003 ELECTRONICS FOR YOU