Top Banner
56

Kumpulan skematik elektronika 3

Mar 26, 2015

Download

Documents

SCEMATIC ELECTRONIC, ENGINEERING, ELECTRICAL, ELECTRONICS
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Kumpulan skematik elektronika 3
Page 2: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19198

The c i rcu i t of a 7MHz C W / A M

Q R P t r a n s m i t -ter described here can be used to transmit e ither 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 at its collector as in case of transis-tor T1) serves as a power amplifier. The RF output from oscillator stage is inductively coupled to the power amplifier stage. The output from power amplifier is routed via capacitor C3 and inductor L3 to a half-wave dipole using a 75-ohm coaxial cable. ½J gang capacitor VC3 along with inductor L3 forms an antenna tuning and matching network between the output of power amplifier stage and coaxial transmis-

Reader Comments:¨ I request the author for the following clarifications:

1. Please indicate the construction details of coils L1 and L3 as well as the inductor which is connected in parallel to VC2.

2. Can we use any other crystal in place of 7MHz crystal?

M.A. KamalGuwahati

¨ What is the range of this transmit-ter and what is the output power of this circuit?

Vaibhav KumarSaharanpur

The author D. Prabaharan, com-ments:

In reply to the above queries, I would like to say that the transistor T1 is BF495. Power output of this circuit is about 150mW. It can be further increased by using separate power supply for the power-amplifier stage (24V, 1A).

The coil details are as follows— L1 is short-wave oscillator coil; L2:14 turns on 1cm-diameter air-core tube using 26 SWG wire; L3 has 12 turns on 1.5cm-diameter

air-core tube using 26 SWG wire.The frequency allotted for amateur

radio operators is 7.0 MHz to 7.1 MHz. Hence, any crystal available within this frequency can be used. Range of this QRP transmitter depends on propagation condi-tions. If conditions are good, the range is about 500 kms in the CW mode and 100 kms in the AM mode.

It is possible to convert this transmit-ter to 20-meter HAM band. Any crystal available from 14 MHz to 14.350 MHz range can be used for the purpose. How-ever, this conversion needs following

7MHz CW/AM QRP TRANSMITTERD. PRABAHARAN

sion line for maximum power transfer. Suitable heatsink should be used for transistor T2.

Tuning adjustments may be accom-plished using a 6-volt torch bulb. Connect the bulb to the collector of transistor T1 first through a coupling capacitor and tune ½J gang VC1 for maximum bril-liance. (Note: the bulb would light ac-cording to intensity of RF energy.) Same procedure may be repeated for power am-plifier stage and antenna tuning network for ensuring maximum power transfer.

For CW operation, switch S1 is to be kept on for bypassing the audio driver transformer and Morse key is used for on/off-type modulation. CW would be generated during key depressions. For AF modulation, Morse key points should be closed and switch S1 should be flipped to ‘off ’ position.

Any suitable mic. amplifier may be used to feed audio input to the audio driver transformer X1. (For transformer X1 you may use the transistor-radio type AF driver transformer.)

Page 3: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19 199

modifications on coils L1, L2 and L3—L1: shortwave oscillator coil; L2: 11 turns on 1cm-diameter air-core tube using 26 SWG wire; L3: 9½ turns on 1cm-diameter air-core tube using 28 SWG wire.

An ammeter with a range 0-250mA or a multimeter with 0-250mA can be

connected in-between the positive of the supply and the modulation transformer. Adjust VC1, VC2 and VC3 for maximum current through ammeter (CW-200mA, AM-125mA). The power input in CW and AM mode is calculated as shown below:

DC power input (CW mode) = 24V

x 250mA= 6watt (the power amplifier draws

250mA current).DC power input (AM mode) = 24V x

120mA= 2.8watt (the power amplifier draws

120mA current).

Page 4: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 22

A HIERARCHICAL PRIORITY ENCODER

Anormal priority encoder encodesonly the highest-order data line.But in many situations, not only

the highest but the second-highestpriority information is also needed. Thecircuit presented here encodes boththe highest-priority information as wellas the second-highest priority informationof an 8-line incoming data. The circuituses the standard octal priority encoder74148 that is an 8-line-to-3-line (4-2-1)binary encoder with active-‘low’ data in-puts and outputs.

The first encoder (IC1) generates thehighest-priority value, say, F. The active-‘low’ output (A0, A1, A2) of IC1 is in-verted by gates N9 through N11 and fedto a 3-line-to-8-line decoder (74138) thatrequires active-‘high’ inputs. The decodedoutputs are active-‘low’. The decoder iden-tifies the highest-priority data line and

that data value is cancelled using XNORgates (N1 through N8) to retain the sec-ond-highest priority value that is gener-ated by the second encoder.

To understand the logic, let the in-coming data lines be denoted as L0 to L7.Lp is the highest-priority line (active-‘low’)and Lq the second-highest priority line

(active-‘low’). Thus Lp=0 and Lq=0. Alllines above Lp and also between Lp andLq (denoted as Lj) are at logic 1. All linesbelow Lq logic state are irrelevant, i.e.‘don’t care’. Here p is the highest-priorityvalue and q the second-highest-priorityvalue. (Obviously, q has to be lower thanp, and the minimum possible value for pis taken as ‘1’.)

Priority encoder IC1 generates binaryoutput F2, F1, F0, which represents thevalue of p in active-‘low’ format. Thecomplemented F2, F1, and F0 are ap-plied to 3-line-to-8-line (one out of eightoutputs is active-‘low’) decoder 74138. Letthe output lines of 74138 be denoted asM0 through M7. Now only one line isactive-‘low’ among M0 through M7, andthat is Mp (where the value of p is ex-plained as above). Therefore the logic levelof line Mp is ‘0’ and that of all other M

lines ‘1’.The highest-priority line is cancelled

using eight XNOR gates as shown in thefigure. Let the output lines from XNORgates be N0 through N7. Consider inputsLp and Mp of the corresponding XNORgate. Since Mp = 0 and also Lp = 0, theoutput of this XNOR gate is Np = comple-

ment of Lp = 1. All other L’s are notchanged because the corresponding M’sare all 1’s. Thus data lines N0 through N7are same as L0 through L7, except thatthe highest-priority level in L0 throughL7 is cancelled in N0 through N7.

The highest-priority level in N0through N7 is the second-highest priorityleftover from L0 through L7, i.e. Nq=0 andNj=1 for q<j≤7. Now these N lines are ap-plied to priority encoder 2 (IC3) to gener-ate S2, S1, S0, which represent q. Thusthe second-highest priority value is ex-tracted. Through cascading one can re-cover the third-highest priority, and so on.

For example, let L0 through L7 = X XX 0 1 1 0 1. Here the highest ‘0’ line is L6and the next highest is L3 (X denotes‘don’t care’). Thus p=6 and q=3. Now theactive-‘low’ output of the first priority en-coder will be F2 F1 F0 = 0 0 1. The input

to 74138 is 1 1 0 and it outputs M0through M7 = 1 1 1 1 1 1 0 1. Since M6=0,only L6 is complemented by XNOR gates.Thus the outputs of XNORs are N0through N7 = X X X 0 1 1 1 1. Now N3=0and the highest priority for ‘N’ is 3. Thisvalue is recovered by priority encoder 2(IC3) as S2 S1 S0 = 1 0 0.

Page 5: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19 195

ACCURATE ELECTRONIC STOP-WATCH

Here is a simple circuit which can be used as an accurate stop-watch to count up to 100

seconds with a resolution of 0.01 second or up to 1000 seconds with a resolution of 0.1 second. This stop-watch can be used for sports and similar other activities.

A 1MHz crystal generates stable frequency which is divided by two stages of 74390 ICs (dual decade counter) and another stage employing 7490 (decade

counter) IC to obtain a final frequency of 100 Hz or 10 Hz. Due to the use of crystal, the final frequency is very accurate.

The output of IC4 (7490) is counted and displayed using IC5 74C926 (4-digit counter with multiplexed 7-segment LED driver). Due to multiplexed display the power consumption is very low. Switch S2 (2-pole, 2-way) is used to select appropri-ate input frequency and corresponding decimal point position to display up to

either 99.99 seconds or 999.9 seconds maximum count.

For proper operation, first press switch S3 (reset) and then operate switch S2, according to the resolution/range desired (0.1 sec. or 0.01 sec.)/(100 seconds or 1000 seconds). Now to start counting, press switch S1. To stop counting, press switch S1 again. The counting will stop and display will show the correct time elapsed since the start of counting.

Page 6: Kumpulan skematik elektronika 3

1 0 0 • F E B R U A R Y 2 0 0 5 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

CIRCUITIDEAS

CMYK

SANI THEO

A tmel’s AVR microcontrollerchips are in-system program-mable (ISP), i.e. these can be

programmed directly in the target cir-cuit. A special programmer softwareis used to download the program fromthe PC into the AVR’s flash memory.Atmel offers a software package calledthe Atmel AVR ISP that allows pro-gramming of the AVR microcontrollersin the circuit using a simple dongle. Adongle is nothing but an adaptor cablethat connects the PC’s parallel portwith the ISP pins of the AVR chip forprogramming.

For programming, the four lines re-quired from the AVR chip to the ISPadaptor (dongle) are:

1. MOSI (Master Out, Slave In):Data being transmitted to the AVR be-ing programmed is sent on this pin

2. MISO (Master In, Slave Out):Data received from the AVR being pro-

grammed is sent on this pin3. SCK (Shift Clock): Serial clock

generated by the programmer from thePC.

4. RST (Reset): Reset (low pulse)generated by the program. The AVRis programmed while in reset state.

Here’s a dongle circuit for in-sys-tem programming of Atmel’s AVR chipAT90S8515 using such software pack-ages as Atmel ISP 2.65 andPonyProg2000. Though not exactly thesame, a similar dongle circuit can befound at the Website ‘www.iready.org/projects/uinternet/ispdongle.pdf.’

The PC’s parallel-port pins 4 and5 drive buffer IC 74LS244 by enablingits pins 19 and 1, respectively. A lowpulse on these pins will allow thepassing of the serial clock and dataduring programming. MOSI, LED,SCK and RST outputs are bufferedfrom the parallel port’s pins 7, 8, 6and 9, respectively. The MISO inputfrom the AVR is fed into pin 10 of the

ATMEL AVR ISP DONGLE

parallel port.IC 74LS244 (IC1) acts as a buffer as

well as an isolator circuit when theAVR is not in programming mode. Inidle mode, all the outputs are tristatedso as not to affect the operation of thetarget system.

When the AVR’s ISP mode is se-lected, the lower half of IC 74LS244is enabled, pulling the target system’sReset line low. Once the targetsystem is in Reset mode, the SCK,MISO and MOSI lines are no longerloaded by the peripheral circuitry, ifany, on the target system. Now, it issafe to enable the upper half of74LS244, driving the MOSI, LED andSCK lines of the dongle. The RST pinbecomes high after the AVR is pro-grammed. Glowing of LED2 indicatesthat the AVR is in programming mode.

There are two standard connectorsfor in-system programming of AtmelAVR microcontroller. One is the 10-pin header (dual-in-line (DIL) connec-

EFY LAB

Page 7: Kumpulan skematik elektronika 3

CMYK

E L E C T R O N I C S F O R Y O U • F E B R U A R Y 2 0 0 5 • 1 0 1W W W . E F Y M A G . C O M

CIRCUITIDEAS

tor)) used on the Atmel STK kits. Theother is a 6-pin header (DIL connec-tor) used in Atmel ISPs. The two loop-back connections, pin 2-to-pin 12 andpin 3-to-pin 11 of the parallel port, areused to identify the dongle. With onlypin 2-to-pin 12 link, the dongle iscalled STK300 or AVR ISP dongle.With only pin 3-to-pin 11 link, thedongle is called STK200 or old KandaISP dongle. With both links in place,

the dongle is identified as a value-added pack dongle.

Here, we’ve used an 8-pin single-in-line (SIL) connector and an additional6-pin SIL connector for the Atmel pro-gramer circuit. With the buffer and the40-pin ZIF socket in this circuit, it can beused as a standalone programmer. The6-pin SIL male connector is used forconnection between the dongle and theAVR on the target board. Thus, another

6-line cable of about 30cm length isrequired for connecting this ISP adap-tor (dongle) to the target circuit.

If the AVR is not on the target cir-cuit, you can insert the AVR into theZIF socket and program it. Regulated5V DC is required for the AVR andthe associated dongle circuit, whoseterminals are also provided in connec-tor CON4. LED1 is used as the powerindicator for the circuit.

Page 8: Kumpulan skematik elektronika 3

7 6 • J A N U A R Y 2 0 0 5 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

CIRCUITIDEAS

CMYK

S.C. DWIVEDI

In the output stages of most broad-cast receivers and some amplifiers,there is a limit up to which maxi-

mum power can be developed with-out distortion. In the widely acceptedoutput circuit, two output transistorsare connected in series between thepositive and ground and biasing is ad-

justed so that each transistor gets halfthe supply voltage.

The circuit presented here is asimple audio amplifier for a personalstereo system. In this, supply voltageto each transistor can be enhanced toproduce a larger output. The audiodriver transformer drives the transis-tors adequately.

A 9V-0-9V, 300mA transformer hasbeen used in the set-up. Out ofthe four diodes (D1 through D4), twoare used for developing the positivevoltage rail (+9V) and the othertwo are used for developing thenegative voltage rail (–9V). In the

M. VENKM. VENKM. VENKM. VENKM. VENKAAAAATESWARTESWARTESWARTESWARTESWARANANANANAN pushpull amplifier, each transistor (T2or T3) gets double the voltage whenactivated.

Connect the low audio signal fromthe stereo system at input terminals Aand B of the audio amplifier and pro-vide mains AC to activate the circuit.During the first half cycle of an AFcycle, transistor T2 conducts and thecurrent flows from positive rail to

ground rail (centre tap of transformerX1) via the loudspeaker coil (connectedbetween the emitter of transistor T2and ground) in one direction. Whilein the second half cycle, transistor T3conducts and the current flows fromground rail to negative rail via theloudspeaker coil (connected betweenground and the collector of transistorT3) in a direction opposite to the pre-vious flow.

Transistors T2 and T3 of thepushpull audio amplifier shouldbe matched correctly. If these transis-tors get heated, change the bleedingresistor pairs (R3 and R4 for transis-

AUDIO AMPLIFIER FORPERSONAL STEREO

tor T2 and R5 and R7 for transistorT3) so that the acceptable outputwithout overheating is obtained.You can also replace these transistorswith another pair of suitable high-power transistors.

For driving transistors T2 and T3,a 9V audio driver transformer havingsix leads is used. It is readily availablein the market and reasonably matches

the output and input impedances ofthe preceeding and succeeding stages.

To test the quality of the audiooutput, connect the stereo’s outputsto the respective terminals A and B.Now increase the volume level ofthe stereo slowly. If you get ahigh-level, high-quality sound acrossloudspeaker L1, the amplifier isworking well. If the sound quality isnot good, decrease the volume leveluntil the audio amplifier gives goodresults.

Note that this audio amplifierworks well for low-level audiosignals.

Page 9: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20128

7 is therefore off. The out-put (at pin 3) reverses (goes low) when pin 2 is taken more positive than 1/3 Vcc. At the same time pin 7 goes low (as Q output of in-ternal flip-flop is high) and the ED con-nected to pin 7 is lit. Both tim-ers (IC1 and IC2) are config-

ured to function in the same fashion.Preset VR1 is adjusted for under

voltage (say 160 volts) cut-out by ob-serving that LED1 just lights up when mains voltage is slightly greater than 160V AC. At this setting the output at pin 3 of IC1 is low and transistor T1 is in cut-off state. As a result RESET pin 4 of IC2 is held high since it is connect-ed to Vcc via 100 kilo-ohm resistor R4.

Preset VR2 is adjusted for over voltage (say 270V AC) cut-out by ob-

serving that LED2 just extinguishes when the mains voltage is slightly less than 270V AC. With RESET pin 4 of IC2 high, the output pin 3 is also high. As a result transistor T2 conducts and energises relay RL1, connecting load to power supply via its N/O contacts. This is the situation as long as mains voltage is greater than 160V AC but less than 270V AC.

When mains voltage goes beyond 270V AC, it causes output pin 3 of IC2 to go low and cut-off transistor T2 and de-energise relay RL1, in spite of RESET pin 4 still being high. When mains voltage goes below 160V AC, IC1’s pin 3 goes high and LED1 is extinguished. The high output at pin 3 results in conduction of transistor T1. As a result collector of transistor T1 as also RESET pin 4 of IC2 are pulled low. Thus output of IC2 goes low and transistor T2 does not conduct. As a result relay RL1 is de-energised, which causes load to be disconnected from the supply. When mains volt-age again goes beyond 160V AC (but less than 270V AC) the relay again energises to connect the load to power supply.

Auto Reset oveR/undeR voltAge Cut-out

J. Gopalakrishnan

This over/under voltage cut-out will save your costly electrical and electronic appliances from

the adverse effects of very high and

very low mains voltages.The circuit features auto reset and

utilises easily available components. It makes use of the comparators available

inside 555 timer ICs. Supply is tapped from different points of the power sup-ply circuit for relay and control circuit operation to achieve reliability.

The circuit utilises comparator 2 for control while comparator 1 output (connected to reset pin R) is kept low by shorting pins 5 and 6 of 555 IC. The positive input pin of comparator 2 is at 1/3rd of Vcc voltage. Thus as long as negative input pin 2 is less positive than 1/3 Vcc, comparator 2 output is high and the internal flip-flop is set, i.e. its Q output (pin 3) is high. At the same time pin 7 is in high imped-ance state and LED connected to pin

Page 10: Kumpulan skematik elektronika 3

9 6 • F E B R U A R Y 2 0 0 5 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

CIRCUITIDEAS

CMYK

S.C. DWIVEDI

This charger for series-connected4-cell AA batteries automaticallydisconnects from mains to stop

charging when the batteries are fullycharged. It can be used to charge par-tially discharged cells as well.

The circuit is simple and can bedivided into AC-to-DC converter, relay

driver and charging sections.In the AC-to-DC converter section,

transformer X1 steps down mains 230VAC to 9V AC at 750 mA, which is rec-tified by a full-wave rectifier compris-ing diodes D1 through D4 and filteredby capacitor C1. Regulator IC LM317(IC1) provides the required 12V DCcharging voltage. When you pressswitch S1 momentarily, the chargerstarts operating and the power-onLED1 glows to indicate that thecharger is ‘on.’

The relay driver section uses pnptransistors T1, T2 and T3 (each BC558)

Y.M. ANANDAVARDHANA to energise electromagnetic relay RL1.Relay RL1 is connected to the collec-tor of transistor T1. Transistor T1 isdriven by pnp transistor T2, which, inturn, is driven by pnp transistor T3.Resistor R4 (10-ohm, 0.5W) is con-nected between the emitter and baseof transistor T3.

When a current of over 65 mAflows through the 12V line, it causes a

voltage drop of about 650 mV acrossresistor R4 to drive transistor T3 andcut off transistor T2. This, in turn, turnstransistor T1 ‘on’ to energise relay RL1.Now even if the pushbutton is re-leased, mains is still available to theprimary of the transformer through itsnormally open (N/O) contacts.

In the charging section, regulatorIC1 is biased to give about 7.35V. Pre-set VR1 is used for adjusting the biasvoltage. Diode D6 connected betweenthe output of IC1 and battery limitsthe output voltage to about 6.7V,which is used for charging the battery.

AUTO TURN-OFFBATTERY CHARGER

Pushing switch S1 latches relayRL1 and the battery cells start charg-ing. As the voltage per cell increasesbeyond 1.3V, the voltage drop acrossresistor R4 starts decreasing. When itfalls below 650 mV, transistor T3 cutsoff to drive transistor T2 and, in turn,cuts off transistor T3. As a result, re-lay RL1 de-energises to cut off thecharger and red LED1 turns off.

You may determine the chargingvoltage depending on the NiCd cellspecifications by the manufacturer.Here, we’ve set the charging voltageat 7.35V for four 1.5V cells. Nowadays,700mAH cells are available in the mar-ket, which can be charged at 70 mAfor 10 hours. The open-circuit voltageis about 1.3V.

The shut-off voltage point is deter-mined by charging the four cells fully(at 70 mA for 14 hours). After measur-ing the output voltage, add the diodedrop (about 0.65V) and bias LM317 ac-cordingly.

Page 11: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

This terminal count output from pin 7, after inversion by gate N3, is con-nected to clock pin 14 of decade counter IC3 (CD4017) which is configured here as a toggle flip-flop by returning its Q2 output at pin 4 to reset pin 15. Thus output at pin 3 of IC3 goes to logic 1 and logic 0 state alternately at each terminal count of IC2.

Initially, pin 3 (Q0) of IC3 is high and the counter is in count-up state. On reaching ninth count, pin 3 of IC3 goes low and as a result IC2 starts counting down. When the counter reaches 0 count, Q2 output of IC3 momentarily goes high to reset it, thus taking pin 3 to logic 1 state, and the cycle repeats.

The BCD outputs of IC2 are con-

nected to 1-of-10 decoder CD4028 (IC4). During count-up operation of IC2, the outputs of IC4 go logic high sequentially from Q0 to Q9 and thus trigger the tri-acs and lighting bulbs 1 through 10, one after the other. Thereafter, during count-down operation of IC2, the bulbs light in the reverse order, presenting a wonderful visual effect.

AutomAtic DuAl- output DisplAy

This circuit lights up ten bulbs sequentially, first in one direction and then in the opposite direction,

thus presenting a nice visual effect.In this circuit, gates N1 and N2 form

an oscillator. The output of this oscillator is used as a clock for BCD up/down coun-ter CD4510 (IC2).

Depending on the logic state at its pin 10, the counter counts up or down.

During count up operation, pin 7 of IC2 outputs an active low pulse on reaching the ninth count. Similarly, during count-down operation, you again get a low-going pulse at pin 7.

Page 12: Kumpulan skematik elektronika 3

CIRCUIT

IDEAS

1 1 4 • M A R C H 2 0 0 7 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

� PRIYANK MUDGAL

AUTOMATIC EMERGENCY LIGHT

T his emergency light has thefollowing two advantages:

1. It turns on automatically

when the mains power fails, so youneed not search it in the dark.

2. Its battery starts charging as soonas the mains resumes.

Operation of the circuit is quitestraightforward. Mains supply is

stepped down by transformer X1, rec-tified by a full-wave rectifier compris-ing diodes D1 and D2, filtered by ca-pacitor C1 and fed to relay coil RL1.The relay energises to connect the bat-

tery to the charging circuit through itsnormally-opened (N/O) contacts. Free-wheeling diode D3 acts as a spikebuster for the relay.

The charging circuit is built aroundnpn transistor BD139 (T1). The trans-

former output is fed to the collector oftransistor T1, which provides a fixedbias voltage of 6.8V to charge the bat-tery. When the battery is fully charged,the battery voltage becomes equal to

the breakdown voltageof the zener diode(ZD1). Zener diode ZD1conducts to provide analternative path for thecurrent to ground andbattery charging stops.

When mains fails,relay RL1 de-energises.The battery now getsconnected to the whiteLED array (comprisingLED1 through LED6)through current-limit-ing resistor R2. The

LEDs glow to light up the room. Toincrease the brightness in your room,you can increase the number of whiteLEDs after reducing the value of resis-tor R2 and also use a reflector assem-bly. �

S.C. DWIVE

DI

Page 13: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19178

AUTOMATIC EMERGENCY TORCH

Just 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-ing just a handful of components. This implies that the circuit operation also is very simple. The circuit consists of two parts:

1. Power supply for charging the Ni-Cd battery.

2. Switchover circuit which detects mains failure and switches the bulb ‘on’.

In the power supply section, capacitors C1 and C2 function as non-dissipating, re-active impedances which limit the current to a safe value. With the values of capaci-tors as shown, the maximum current that can be drawn is limited to about 70 mA at 230V AC. Resistor R2 limits the initial surge current and resistor R1 assists in discharging the capacitors after switch off. Diodes D1 through D4 form a conventional bridge rectifier while capacitor C3 is the filter capacitor. Fuse F1 is for protection and is very helpful in the event of any component giving up the ghost. This sup-ply charges the battery as long as mains is present.

In the ‘switchover’ section, transistor T1 is used as switch. Normally, when AC mains supply is present, the rectifier output

charges the battery through resistor R4 and LED D5 combination at about 50mA rate. The glowing LED (D5) also gives an indica-tion of mains presence. Further, due to the LED (D5), base of transistor T1 is about 1.6V (drop across D5) more positive than its emitter. This voltage is more than sufficient to keep the transistor at cut-off.

As soon as the mains voltage fails, the base of transistor T1 is pulled low through resistor R3 which drives transistor T1 to saturation thereby turning the bulb ‘on’. Since the transistor is in its saturated state, the voltage drop across it is very low. Hence the bulb glows with full bril-liance. The bulb can be switched off by the ON/OFF switch, when not required. With this bulb (2.2V, 250mA) the torch can work continuously for about two hours. The batteries should be charged for about 14 hours after they are discharged.

You can verify following voltages in the circuit:

1. Base voltage of the transistor must be 1.8V to 2.0V, i.e. about 0.6V less than the battery voltage.

2. Emitter voltage must be equal to the battery voltage.

3. Collector voltage must be 2.0V to 2.2V, i.e. nearly equal to the battery voltage.

All above voltages should be checked with AC mains off. If any of the above-mentioned voltages is absent it indicates that the transistor is bad and it should be replaced by a good one.

Here is a word of caution now. Since the circuit is not isolated from AC mains. it may be hazardous to touch any component when the mains supply is on, especially if the supply wires (live and neutral) get interchanged. It is strongly recommended to use an all-plastic enclosure (including the reflector for the bulb) for the circuit. Also the ON/OFF switch used should have a plastic lever. Take proper care and pre-cautions while building, testing and using the circuit, and never ever allow the supply wires to interchange. It is advisable to pro-vide a plug for the mains input on the box itself so that it can be plugged directly into a mains outlet. This reduces the chances of mains supply wires getting interchanged.

With proper precautions and a little care, it is hoped that this small circuit will help make life a bit more comfortable.

Page 14: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

AutomAtic Room PoweR contRol

An 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

Page 15: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

result, pin 2 of both timers (IC1 and IC2), which have been configured as monostable flip-flops, are held near the supply voltage (+9V).

When the light falling on the LDRs is obstructed, their resistance becomes very high and pin 2 voltages drop to near ground potential, thereby triggering the flip-flops. Capacitors across pin 2 and ground have been added to avoid false triggering due to electrical noise.

When a person enters the room, LDR1 is triggered first and it results in triggering of monostable IC1. The short output pulse immediately charges up capacitor C5, forward biasing transis-tor pair T1-T2. But at this instant the collectors of transistors T1 and T2 are in high impedance state as IC2 pin 3 is at low potential and diode D4 is not conducting.

But when the same person pass-es LDR2, IC2 monostable flip-flop is triggered. Its pin 3 goes high and this potential is coupled to transistor pair T1-T2 via diode D4. As a result transistor

pair T1-T2 conducts because capacitor C5 retains the charge for some time as its discharge time is controlled by resistor R5 (and R7 to an extent). Thus green LED portion of bi-colour LED is lit momentar-ily.

The same output is also coupled to IC3 for which it acts as a clock. With entry of each person IC3 output (high state) keeps advancing. At this stage transistor pair T3-T4 cannot conduct because output pin 3 of IC1 is no longer positive as its output pulse duration is quite short and hence transistor collectors are in high imped-ance state.

When persons leave the room, LDR2 is triggered first, followed by LDR1. Since the bottom half portion of circuit is identical to top half, this time, with the departure of each person, red portion of bi-colour LED is lit momentarily and output of IC4 advances in the same fashion as in case of IC3.

The outputs of IC3 and those of IC4 (after inversion by inverter gates N1

through N4) are ANDed by AND gates (A1 through A4) and then wire ORed (using diodes D5 through D8). The net effect is that when persons are entering, the output of at least one of the AND gates is high, causing transistor T5 to conduct and energise relay RL1. The bulb connected to the supply via N/O contact of relay RL1 also lights up.

When persons are leaving the room, and till all the persons who entered the room have left, the wired OR output continues to remain high, i.e. the bulb continues to remains ‘on,’ until all persons who entered the room have left.

The maximum number of persons that this circuit can handle is limited to four since on receipt of fifth clock pulse the counters are reset. The capacity of the circuit can be easily extended to handle up to nine persons by removing the connection of pin 1 from reset pin (15) and utilising Q1 to Q9 outputs of CD4017 counters. Additional inverters, AND gates and diodes will, however, be required.

Page 16: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU OCTOBER 2004

C onsider that a school has a total ofeight periods with a lunch breakafter the fourth period. Each period

is 45 minutes long, while the duration ofthe lunch break is 30 minutes.

To ring this automatic school bell tostart the first period, the peon needs tomomentarily press switch S1. Thereafter,the bell sounds every 45 minutes to indi-cate the end of consecutive periods, ex-cept immediately after the fourth period,

when it sounds after 30 minutes to indi-cate that the lunch break is over. Whenthe last period is over, LED2 glows to in-dicate that the bell circuit should now beswitched off manually.

In case the peon has been late to startthe school bell, the delay in minutes canbe adjusted by advancing the time usingswitch S3. Each pushing of switch S3 ad-vances the time by 4.5 minutes. If theschool is closed early, the peon can turnthe bell circuit off by momentarily press-ing switch S2.

The bell circuit contains timer ICNE555 (IC1), two CD4017 decade counters

AUTOMATIC SCHOOL BELL

RAJ KUMAR MONDAL

S.C. DWIVEDI

(IC2 and IC3) and AND gate CD4081 (IC4).Timer IC1 is wired as an astablemultivibrator, whose clock output pulsesare fed to IC2. IC2 increases the timeperiods of IC1 (4.5 and 3 minutes) by tentimes to provide a clock pulse to IC3 ev-ery 45 minutes or after 30 minutes, re-spectively. When the class periods are go-ing on, the outputs of IC3 switch on tran-sistors T1 and T2 via diodes D4 throughD12.

Resistors R4 and R5 connected in se-ries to the emitter of npn transistor T2

decide the 4.5-minute time period of IC1.The output of IC1 is further connected topin 14 of IC2 to provide a period with aduration of 45 minutes. Similarly, resis-tors R2 and R3 connected in series to theemitter of npn transistor T1 decide the 3-minute time period of IC1, which is fur-ther given to IC2 to provide the lunch-break duration of 30 minutes.

Initially, the circuit does not groundto perform its operation when 12V powersupply is given to the circuit.

When switch S1 is pressed momen-tarily, a high enough voltage to fire sili-con-controlled resistor SCR1 appears at its

gate. When SCR1 is fired, it providesground path to operate the circuit afterresetting both decade counters IC2 andIC3. At the same time, LED1 glows to in-dicate that school bell is now active.

When switch S2 is pressed momen-tarily, the anode of SCR1 is againgrounded and the circuit stops operating.In this condition, both LED1 and LED2don’t glow.

When the eighth period is over, Q9output of IC3 goes high. At this time, tran-sistors T1 and T2 don’t get any voltage

through the outputs of IC2. As a result, theastable multivibrator (IC1) stops working.

The school bell sounds for around 8seconds at the end of each period. Onecan increase/decrease the ringing time ofthe bell by adding/removing diodes con-nected in series across pins 6 and 7 ofIC1.

The terminals of the 230V ACelectric bell are connected to the nor-mally-open (N/O) contact of relay RL1.The circuit works off a 12V regulatedpower supply. However, a battery sourcefor back-up in case the power fails is alsorecommended.

Page 17: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 21194

AUTOMATIC SPEED-CONTROLLER

FOR FANS AND COOLERS

During summer nights, the tem-perature is initially quite high.As time passes, the temperature

starts dropping. Also, after a person fallsasleep, the metabolic rate of one’s bodydecreases. Thus, initially the fan/coolerneeds to be run at full speed. As timepasses, one has to get up again and againto adjust the speed of the fan or the cooler.

The device presented here makes thefan run at full speedfor a predeterminedtime. The speed isdecreased to mediumafter some time, andto slow later on. Af-ter a period of abouteight hours, the fan/cooler is switched off.

Fig. 1 shows thecircuit diagram ofthe system. IC1 (555)is used as an astablemultivibrator togenerate clockpulses. The pulsesare fed to decadedividers/countersformed by IC2 andIC3. These ICs act as

divide-by-10 and divide-by-9 counters,respectively. The values of capacitor C1and resistors R1 and R2 are so adjustedthat the final output of IC3 goes highafter about eight hours.

The first two outputs of IC3 (Q0 andQ1) are connected (ORed) via diodes D1and D2 to the base of transistor T1. Ini-tially output Q0 is high and thereforerelay RL1 is energised. It remainsenergised when Q1 becomes high. Themethod of connecting the gadget to thefan/cooler is given in Figs 3 and 4.

It can be seen that initially the fan

shall get AC supply directly, and so it shallrun at top speed. When output Q2 becomeshigh and Q1 becomes low, relay RL1 isturned ‘off’ and relay RL2 is switched ‘on’.The fan gets AC through a resistance andits speed drops to medium value. This con-tinues until output Q4 is high. When Q4goes low and Q5 goes high, relay RL2 isswitched ‘off’ and relay RL3 is activated.The fan now runs at low speed.

Throughout the process, pin11 of the IC3 is low, so T4 is cutoff, thus keeping T5 in satura-tion and RL4 ‘on’. At the end ofthe cycle, when pin 11 (Q9) be-comes high, T4 gets saturatedand T5 is cut off. RL4 is switched‘off’, thus switching ‘off’ the fan/cooler.

Using the circuit described above, thefan shall run at high speed for a com-paratively lesser time when either of Q0or Q1 output is high. At medium speed, itwill run for a moderate time period whenany of three outputs Q2 through Q4 is

high, while at low speed, it will run for amuch longer time period when any of thefour outputs Q5 through Q8 is high.

If one wishes, one can make the fanrun at the three speeds for an equal amountof time by connecting three decimaldecoded outputs of IC3 to each of thetransistors T1 to T3. One can also getmore than three speeds by using anadditional relay, transistor, and associated

components, and connecting one or moreoutputs of IC3 to it.

In the motors used in certain coolersthere are separate windings for separatespeeds. Such coolers do not use a rheostattype speed regulator. The method ofconnection of this device to such coolers isgiven in Fig. 4.

The resistors in Figs 2 and 3 are thetapped resistors, similar to those used inmanually controlled fan-speed regulators.Alternatively wire-wound resistors ofsuitable wattage and resistance can beused.

Page 18: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19 189

Here is a circuit through which the speed of a fan can be linearly con- trolled automatically, depending

on the room temperature. The circuit is highly efficient as it uses thyristors for power control. Alternatively, the same circuit can be used for automatic tempera-ture controlled AC power control.

In this circuit, the temperature sensor used is an NTC thermistor, i.e. one having a negative temperature coefficient. The value of thermistor resistance at 25°C is about 1 kilo-ohm.

Op-amp A1 essentially works as I to V (current-to-voltage) converter and converts temperature variations into voltage variations. To amplify the change in voltage due to change in temperature, instrumentation ampli-fier formed by op-amps A2, A3 and A4 is used. Resistor R2 and zener diode

D1 combination is used for generating reference voltage as we want to am-plify only change in voltage due to the change in temperature.

Op-amp µA741 (IC2) works as a comparator. One input to the compara-tor is the output from the instrumen-tation amplifier while the other input is the stepped down, rectified and suitably attenuated sample of AC volt-age. This is a negative going pulsating DC voltage. It will be observed that with increase in temperature, pin 2 of IC2 goes more and more negative and hence the width of the positive going output pulses (at pin 6) increases lin-early with the temperature. Thus IC2 functions as a pulse width modulator in this circuit. The output from the comparator is coupled to an optocou-pler, which in turn controls the AC

power delivered to fan (load).The circuit has a high sensitivity and

the output RMS voltage (across load) can be varied from 120V to 230V (for a temp. range of 22°C to 36°C), and hence wide variations in speed are available. Also note that speed varies linearly and not in steps. Besides, since an optocoupler is used, the control circuit is fully isolated from power circuit, thus providing added safety. Note that for any given tempera-ture the speed of fan (i.e. voltage across load) can be adjusted to a desired value by adjusting potmeters VR1 and VR2 appropriately.

Potmeter VR1 should he initially kept in its mid position to realise a gain of ap-proximately 40 from the instrumentation amplifier. It may be subsequently trimmed slightly to obtain linear variation of the fan speed.

AUTOMATIC TEMPERATURE CONTROLLED FAN

Page 19: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

CD-ROM DRive as Digital -auDiO CD-PlayeR

since it has self-contained power supply circuit inside.

While there may be minor differ-ences amongst the available CD-ROM drives’ external controls, a typical

drive’s controls are shown in the figure here. Please ensure that a proper power supply con-nector available from computer spare parts vendor is used for connection to CD-ROM drive. To identify +5V and +12V pins on the drive connector, please note that in the computer +12V

is routed using a yellow wire and for +5V a red wir is used, while for ground black wires are used with the sup-ply connector.

Once the power supply has been connected correctly, you will notice that LED indicator on the drive starts flashing. Now the digital audio CD can be loaded after pushing the eject but-ton. A second push of the same button causes retraction of CD carriage into the drive. One can change the track (song) on the CD using play switch on the CD-ROM drive.

ACD-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 easily derived using a conventional power supply circuit as shown in the figure. If you have an external CD-ROM drive, it can be simply plugged into the mains

Page 20: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUNOVEMBER 2002

ASHOK K. DOCTOR

A flashing beacon has many uses. Itcan be employed as a distress sig-nal on highways or as a direction

pointer for parking lots, hospitals, hotels,etc. Here we present a flashing beaconthat uses well-known regulator IC LM317T.As LM317T regulator can deliver more than1 amp. A small 12V, 10W bulb with ahigh-quality reflector can serve as a goodvisible blinker.

A 12-15V, 1A DC supply is connectedto the input pin of the IC. A 12V, 10Wbulb and a combination of resistors andcapacitors are connected between the out-put pin and ADJ pin of the IC as shown in

S.C. DWIVEDI

the figure. The IC is pro-vided with an aluminiumheat-sink to dissipate theheat generated while deliv-ering full current. Since theIC has an inbuilt switch-oncurrent limiter, it extendsthe bulb life.

For the shown valuesof resistors and capacitors,the bulb flashes at approxi-mately 4 cycles per second.The number of flashes de-pends on the charge-dis-charge time of the capaci-tors. Different values of resistors and ca-pacitors can be used to increase or de-

FLASHING BEACON

crease the number of flashes.This circuit costs around Rs 50.

Page 21: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU MAY 2003

S.C. DWIVEDI

CLAP SWITCHMOHAMMAD USMAN QURESHI

Here’s a clap switch free from falsetriggering. To turn on/off any appliance, you just have to clap

twice. The cir-cuit changes its output stateonly when you clap twice within the settime period. Here, you’ve to clap within 3seconds.

The clap sound sensed by condensermicrophone is amplified by transistor T1.The amplified signal provides negative pulse

to pin 2 of IC1 and IC2, triggering both theICs. IC1, commonly used as a timer, iswired here as a monostable multivibrator.Trigging of IC1 causes pin 3 to go high andit remains high for a certain time period

depending on the selected values of R7 andC3. This ‘on’ time (T) of IC1 can be calcu-lated using the following relationship:T=1.1R7.C3secondswhere R7 is in ohms and C3 in microfar-ads.

On first clap, output pin 3 of IC1 goeshigh and remains in this standby positionfor the preset time. Also, LED1 glows forthis period. The output of IC1 providessupply voltage to IC2 at its pins 8 and 4.

Now IC2 is ready to receive the triggeringsignal. Resistor R10 and capacitor C7 con-nected to pin 4 of IC2 prevent false trig-gering when IC1 provides the supply volt-age to IC2 at first clap.

On second clap, a negative pulse trig-gers IC2 and its output pin 3 goes high fora time period depending on R9 and C5.This provides a positive pulse at clock pin14 of decade counter IC 4017 (IC3). De-cade counter IC3 is wired here as abistable.

Each pulse applied at clock pin 14changes the output state at pin 2 (Q1) ofIC3 because Q2 is connected to reset pin15. The high output at pin 2 drives transis-tor T2 and also energises relay RL1. LED2

indicates activation of relay RL1 and on/offstatus of the appliance. A free-wheelingdiode (D1) prevents damage of T2 whenrelay de-energises.

This circuit costs around Rs 80.

Page 22: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

Colour SenSor

Colour 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 only one LDR will get triggered and the gate output corresponding to that LDR will become logic 1 to indicate which colour it is.

Similarly, when a secondary coloured light ray falls on the system, the two primary glass plates corresponding to the mixed colour will allow that light to pass through while the remaining one will not allow any light ray to pass through it. As a result two of the LDRs get triggered and the gate output corresponding to these will become logic 1 and indicate which colour it is.

When all the LDRs get triggered or remain untriggered, you will observe white and black light indications respec-tively. Following points may be carefully noted:

13

1. Potmeters VR1, VR2 and VR3 may be used to adjust the sensitivity of the LDRs.

2. Common ends of the LDRs should be connected to positive supply.

3. Use good quality light filters.The LDR is mounded in a tube,

behind a lens, and aimed at the object.

The coloured glass filter should be fixed in front of the LDR as shown in the figure. Make three of that kind and fix them in a suitable case. Adjust- ments are critical and the gadget perform-ance would depend upon its proper fabri-cation and use of correct filters as well as light conditions.

Page 23: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19190

The 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 the oscillator can be varied by adjusting potmeters VR1 (20 kilo-ohm) and VR2 (50 kilo-ohm).

The audio output from pin 3 of IC (NE555) is connected to an FM transmit-ter comprising transistor T2 (BF194B) and the associated components. The frequency of the transmitter can be changed with the help of trimmer capacitor VC1 or by changing the number of turns of coil L1.

The FM modulated signal is coupled to a short-wire antenna via capacitor C7. The signal can be received using any ready-made FM receiver tuned to the frequency of the transmitter.

As stated earlier, this circuit is con-nected to the parallel port of the PC. Only pins 3 and 25 of the ‘D’ connector are used. Pin 3 corresponding to data bit D1 of port 378(hex) carries the Morse Code data from the computer to the circuit while pin 25 serves as common ground.

The circuit should be powered by +5 volts regulated power supply. It should be fixed inside a metal box to reduce in-terference.

The program, written in TURBO PASCAL 7.0, accepts the message via the keyboard, converts it to correspond-ing Morse code and sends the code to pin 3 of the printer port. The Morse code of

various characters appears under the function ‘write(ch)’ of the program wherein ‘di’ represents a short duration pulse and ‘da’ represents a long duration pulse. The program is interactive and permits varia-tion of speed. The program can be modified to read and transmit the text files or one can even make a TSR (terminate and-stay-resident) program.

It is hoped that this circuit idea would prove to be of great value to the government’s telecom department, defence services, coast guard, merchant navy and amateur radio operators as well as all those who make use of Morse code for message transmission.

PROGRAM LISTING IN TURBO PASCAL 7.0

{$M $450,0,0}uses crt,dos:labelmain,endpro,output,message,startmessage, speedselect,fileiput,dosshell,start;vars:array [1..14] of string [76]:pause,x,y,i,b:integer;sl:slring[l]:ch:char:procedure color{a,b:integer);begintextcolor(a);textbackground(b);end;

procedure di;beginport[$378]:=2;delay(pause);port[$378]:=0;delay(pause);end;procedure da;beginport[$378]:=2;delay(pause*3);port[$378]:=0;delay(pause);end;beginpause:=100;

START:clrscr;color(11,1);gotoxy(15,4);write(‘PUNJABl UNIVERSITY PATIALA-147002 ‘);gotoxy(1,7);color(10,3);gotoxy(10,18);write(‘==========================’);gotoxy(10,19);write(‘Fl = Increase Speed ‘);gotoxy(10,20);write(‘F2 = Decrease Speed ‘);gotoxy(10,21);write(‘F3 = Output to Device ‘);gotoxy(10,22);

COMPUTERISED MORSE CODE GENERATOR/TRANSMITTER

PUNERJOT SINGH MANGAT

Page 24: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19 191

write(‘F4 = Message Input ‘);gotoxy(10,23);write(‘F5 = Dosshell

‘);gotoxy(10,24);write(‘F6 = Quit ‘);gotoxy(10,25);write(‘==========================’);color(14,1);gotoxy(25,2);write(‘PROGRAMMED BY’);gotoxy(21,3);write(‘PUNERJOT SINGH MANGAT’);color(10,3);gotoxy(26,17);write(‘CONTROLS ‘);gotoxy(35,19);write(‘SPEED’);color(10,3);gotoxy(35,20);write(pause);MAIN:window(1,1,80,25);gotoxy(2,25);color(0,7);write(‘Waiting for the command... ‘);ch:=readkey;if ch=#0 thenbeginch:=readkey;if (ch=#59) or (ch=#60) then goto speedselect elseif ch=#61 then goto output elseif ch=#62 then goto startmessage elseif ch=#63 then goto dosshell elseif ch=#64 then goto endpro;end;goto main;STARTMESSAGE:begingotoxy(2,25);write (‘ Enter the message and press ENTER KEY...’);color(12,1);window(3,2,78,15);clrscr;for x:= 1 to 14 do s[x]:=’ ‘ ;i:0;x:=1;y:=1;b:=0:end:MESSAGE:beginx:=wherex;y:=wherey;ch:=readkey;if ch=#13 then goto main;if ch=#8 thenbeginif x=1 then

beginif y=1 then goto message;y:=y-1;x:=76;endelsex:=x-1;delete(s[y],length(s[y]),1);gotoxy(x,y);write(‘ ‘);gotoxy(x,y);goto message:end;if(x=76) and (y=14) then goto message;write(ch);s[y]:=(s[y]+ch);goto message;end;OUTPUT:begingotoxy(2,25);write(‘ Sending output to the MorseDevice... Press any key to stop... ‘);color(12,1);window(3,2,78,15);clrscr;for i:= 1 to y dobeginfor x:= 1 to length(s[i]) dobegins1:=(copy(s[i],x,1));ch:=upcase(s1[1]);delay(pause*2);write(ch);if ch=’A’ then begin di; da; end elseif ch=’B’ then begin da; di; di; di; end elseif ch=’C’ then begin da; di; da; di; end elseif ch=’D’ then begin da; di; di; end elseif ch=’E’ then begin di; end elseif ch=’F’ then begin di; di; da; di; end elseif ch=’G’ then begin da; da; di; end elseif ch=’H’ then begin di; di; di; di; end elseif ch=’I’ then begin di; di; end elseif ch=’J’ then begin di; da; da; da; end elseif ch=’K’ then begin da; di; da; end elseif ch=’L’ then begin di; da; di; di; end elseif ch=’M’ then begin da; da; end elseif ch=’N’ then begin da; di; end elseif ch=’O’ then begin da; da; da; end elseif ch=’P’ then begin di; da; da; di; end elseif ch=’Q’ then begin da; da; di; da; end elseif ch=’R’ then begin di; da; di; end elseif ch=’S’ then begin di; di; di; end elseif ch=’T’ then begin da; end elseif ch=’U’ then begin di; di; da; end elseif ch=’V’ then begin di; di; di; da; end elseif ch=’W’ then begin di; da; da; end elseif ch=’X’ then begin da; di; di; da; end else

if ch=’Y’ then begin da; di; da; da; end elseif ch==’Z’ then begin da; da; di; di; end elseif ch=’1' then begin di; da; da; da; da; end elseif ch=’2' then begin di; di; da; da; da; end elseif ch=’3' then begin di; di; di; da; da; end elseif ch=’4' then begin di; di; di; di; da; end elseif ch=’5' then begin di; di; di; di; di; end elseif ch=’6' then begin da; di; di; di; di; end elseif ch=’7' then begin da; da; di; di; di; end elseif ch=’8' then begin da; da; da; di; di; end elseif ch=’9' then begin da; da; da; da; di; end elseif ch=’0' then begin da; da; da; da; da; end elseif ch=’.’ then begin di; da; di; da; di; da; end elseif ch=’;’ then begin da; di; da; di; da; di; end elseit ch=’:’ then begin da; da; da; di; di; di; end elseif ch=’,’ then begin da; da; di; di; da; da; end elseif ch= ” ‘ then begin di; da; di; di; da; di; end elseif ch=’?’ then begin di; di; da; da; di; di; end elseif ch=’-’ then begin da; di; di; di; di; da; end elseif ch=’_’ then begin di; di; da; da; di; da; end elseif ch=’/ ’ then begin da; di; di; da; di; end elseif (ch=#39) or (ch=#96) then begin di; da; da; da; da; di; end elseif (ch=’(‘) or (ch=’)’)then begin da; di; da; da; di; da; end elseif ch=’ ‘then delay(pause*6);if key pressed then goto main;end;end;goto main;end;SPEEDSELECT;beginif (ch=#59) and (pause>50) then pause: = pause+2;if (ch = =#60) and (pause < 190) then pause: = pause - 2;color(10,3);gotoxy(35,20);write1n(pause,’ ‘);goto main;end;DOSSHELL:begincolor(7,0);clrscr;write1n(‘Type EXIT to return to pro-gramme...’);swapvectors;exec(getenv(‘comspec’),”);swapvectors;goto start;end;ENDPRO:color(7,0);clrscr;end.

Page 25: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

52

Sounds of various kinds have alwaysfascinated human beings. Many de-vices have been invented for re-

cording and playing back the sounds—from magnetic tapes to DVD (digital ver-satile disc), from Adlib cards to high-per-formance sound cards with ‘surroundsound’ capability. For personal comput-ers (PCs), there is a wide variety of suchdevices. A modern PC, generally, has a‘Sound Blaster’ card installed in it. If yourPC does not have a sound card, here isa low-cost audio playback circuit withbass, treble, and volume controls to cre-ate your own music player.

The playback device ‘M-player’ (i.e.media player) described here uses mini-mal hardware to achieve a moderatelygood-quality audio playback device.The software that accompanies the hard-ware is meant for a PC running underMS-DOS or a compatible operating sys-tem. This device can play a simple 8-bitPCM (pulse code modulation) wave filewith some special effects. The PC is con-nected to the device through the PC par-allel port.

HardwareThe circuit functions as an 8-bit monoplayer, i.e. the sound files (with .WAVextension) with sound quantised to eightbits or 256 levels can be played. Incase of files with 16-bit quantisation, theseare re-quantised as discussed under ‘Soft-ware’ subheading. Thus, only eight bitsare sent to the card through the printerport.

Since there is no duplex communica-tion necessary between the player cardand the PC, it is sufficient to use the eightoutput data lines of the port 378H (pins 2through 9 of 25-pin D-connector). This 8-bit digital output is converted into an ana-logue signal using DAC 0808 (IC1) fromNational Semiconductor.

The output current from the DACvaries with the input digital level(represented by bits D0 through D7),the reference voltage (Vref), and the valueof series resistor R1 connected to Vref

pin 14 of DAC0808 IC. The output cur-rent Io (in mA) is given by the relation-ship:

where Vref is the reference voltage in voltsand R1 is the resistance in kilo-ohms.

The output current from the DAC isconverted into its corresponding voltageusing a simple current-to-voltage con-verter wired around one part of the dualwideband JFET op-amp LF353. The out-put from IC2(a) is the required audio sig-nal that has to be processed and ampli-fied to feed the speaker. The part follow-ing the I-V converter is the bass- andtreble-control circuit employing RC-typevariable low-pass and high-pass filtersconnected to the input of audio amplifierbuilt around the second op-amp insideLF353 [IC2(b)].

The frequency response of the filterscan be varied using potentiometers VR1and VR2. The low frequencies or bass canbe cut or boosted with the help of poten-tiometer VR1. Similarly, high frequenciesor treble can be cut or boosted with thehelp of potentiometer VR2. At low fre-quencies, capacitors C2, C3, and C4 actas open circuits and the effective feed-back is through 10k resistors (R4, R5,and R6) and potentiometer VR1.

The audio amplifier IC2(b) acts as aninverting amplifier and the amplification(or attenuation) of the low-frequency basssignals depends on the value of potenti-ometer VR1. The frequency f1 at which C= C2 = C3 becomes effective is given bythe equation:

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

N.V. VENKATARAYALU AND M. SOMASUNDARAM

S.C. DWIVEDIPC INTERFACED AUDIOPLAYBACK DEVICE: M-PLAYER

Page 26: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

53

At frequnecies higher than f2 (f>f2,high end of audio range), capacitorsC2 and C3 overcome the effect of potenti-ometer VR1. As C2 and C3 behaveas short, potentiometer VR1 has noeffect on the output response. Now, thegain is controlled by treble potentiometerVR2. The frequency f2, below whichtreble potentiometer VR2 has noeffect on the response, is given by theequation:

The output of this module is sent tothe final 2-watt audio power amplifier(LM380) stage through potentiometer VR3which is used as the volume control. Thepower output of this module is fed to an 8-

ohm speaker. Theoutput-end audiopower amplifier isdesigned to give again of around 50.

One can also useLM380 in variousother configurationsas per one’s require-ments. Anotherpopular configura-tion is the ‘bridgeconfiguration’—inwhich two LM380scan be used to ob-tain larger poweroutput with a gainof 300.

Parallel portThe output of theparallel port is TTLcompatible. So, logiclevel 1 is indicatedby +5V and logiclevel 0 by 0V. Thecurrent that one cansink and source var-ies from port toport. Most parallelports can sink andsource around 12 mA.

The software assumes 0x378 (378H)to be the base address of the parallel portto which the device is connected. Anotherpossible base address is 0x278 (278H). Itis advised to modify this address of theparallel port in the software program, af-ter checking the device profile.

Actual-size PCB layout for audio play-back circuit of Fig. 1 is given in Fig. 2and its component layout in Fig. 3.

SoftwareThe software accompanying this construc-tion project is written in Turbo C/C++ for

DOS. It can be used toplay simple 8-bit PCMwave files. 16-bit wavefiles are converted into 8-bit PCM data before pro-ceeding.

Even stereo wavefiles can be played; butnot the stereo way. Onlyone channel is chosen.Up to six-channel PCMdata can be read and con-

verted into mono 8-bit PCM data. Thissoftware is accompanied with a CTUI-based interface.

The wave file format is probably theleast undocumented sound format sincethere are different schemes with differ-ent number of chunks of related informa-tion in the file. Even the chunks can beof variable size. Therefore it is difficult toget documentation on all availablechunks.

This software can be used only onPCM data with data chunk. Every wavefile has some minimum chunks (see TableII). These chunks will be present in everywave file. Then there are other chunkswhich are actually non-standard. In PCMitself, the above chunk may be followedeither by DATA chunk or by LIST chunkwhich, in turn, has lots of sub-chunks.(Any information obtained on thesechunks by the readers may please beshared with the authors.)

During playback, the speed withwhich the processor in the PC can ex-ecute the main loop is first studied usinga dummy loop and thus the delay isadaptively varied with respect to the speed

Pin No. Pin No. SPP signal Direction Register(D-type 25) (centronics) in/out

2 2 Data 0 Out Data3 3 Data 1 Out Data4 4 Data 2 Out Data5 5 Data 3 Out Data6 6 Data 4 Out Data7 7 Data 5 Out Data8 8 Data 6 Out Data9 9 Data 7 Out Data

18 - 25 19-30 Ground Gnd

TABLE IRelevant Details of Parallel Port

PARTS LISTSemiconductors:IC1 - DAC0808 8-bit D/A converterIC2 - LF353 JFET input wide-band

op-ampIC3 - LM380, 2-watt audio amplifier

Resistors (all ¼watt, ±5% carbon film, unlessstated otherwise)R1 - 4.7-kilo-ohmR2, R9 - 47-kilo-ohmR3 - 1-kilo-ohmR4-R6 - 10-kilo-ohmR7, R8 - 39-kilo-ohmVR1 - 100-kilo-ohm potmeterVR2 - 470-kilo-ohm potmeterVR3 - 50-kilo-ohm potmeter

Capacitors:C1 - 1µF, 25V electrolyticC2, C3 - 0.05µF ceramic diskC4 - 0.005µF ceramic diskC5-C7 - 2.2µF, 25V electrolyticC8, C9 - 470µF, 25V electrolytic

Miscellaneous:- 25-pin D connector (male)- Loudspeaker 8-ohm, 2W- Power supply: (a) +12V, 500mA- (b) –12V, 100mA- (c) +5V, 100mA

Fig. 2: Actual-size PCB layout for M-player

Fig. 3: Component layout for the PCB

Page 27: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

54

From byte Number Informationof bytes

RIFF chunk:0 4 Contains the characters ‘RIFF’4 4 Size of the RIFF chunk

WAVE chunk:0 4 Contains the characters ‘WAVE’4 Variable The FORMAT chunk

The normal FORMAT chunk:0 4 Contains the characters ‘fmt’4 4 Size of the FORMAT chunk8 2 Value specifying the scheme

1-PCM, 85-MPEG layer III10 2 Number of channels

1-mono, 2-stereo, etc.12 4 Number of samples per second.

This gives us the playback rate.16 4 Average number of bytes per second.

This field is used to allocate buffers, etc.20 2 Contains block alignment information.22 Variable This field contains format-specific data.

For PCM files, this field is 2 bytes long

MPLAYER.CPP#include “Sounds.h”void DisplayTip(char *string){text_info tinf;if(strlen(string)<75){gettextinfo(&tinf);textbackground(LIGHTGRAY);textcolor(RED);gotoxy(2,25);for(int i=0;i<75;i++) cprintf(“ ”);gotoxy(2,25);cprintf(string);textattr(tinf.attribute);gotoxy(tinf.curx,tinf.cury);}return;}void Window(int x1,int y1,int x2,int y2,char *caption,int BackCol,int TextCol){text_info tinfo;int i,j;gettextinfo(&tinfo);textbackground(BackCol);textcolor(TextCol);for(j=y1;j<=y2;j++){gotoxy(x1,j);for(i=x1;i<=x2;i++)cprintf(“ ”);}gotoxy(x1+1,y1);for(i=x1+1;i<=x2-1;i++)cprintf(“%c”,205);gotoxy(x1+1,y2);for(i=x1+1;i<=x2-1;i++)

cprintf(“%c”,205);for(j=y1+1;j<=y2-1;j++){gotoxy(x1,j);cprintf(“%c”,186);gotoxy(x2,j);cprintf(“%c”,186);}gotoxy(x1,y1);cprintf(“%c”,201);gotoxy(x2,y1);cprintf(“%c”,187);gotoxy(x1,y2);cprintf(“%c”,200);gotoxy(x2,y2);cprintf(“%c”,188);if(caption!=NULL){textcolor(WHITE);gotoxy(x1+2,y1);cprintf(“%s”,caption);}textattr(tinfo.attribute);return;}void DrawScreen(void){textbackground(LIGHTGRAY);textcolor(BLACK);clrscr();Window(1,2,80,24,NULL,BLUE,WHITE);gotoxy(1,1);cprintf(“ File Effects Operation”);textcolor(RED);gotoxy(3,1);cprintf(“F”);gotoxy(12,1);cprintf(“E”);gotoxy(24,1);cprintf(“O”);textbackground(BLUE);textcolor(LIGHTBLUE);gotoxy(3,10);cprintf(“ ”);delay(75);gotoxy(3,11);cprintf(“ ”);delay(75);gotoxy(3,12);cprintf(“ ”);

delay(75);gotoxy(3,13);cprintf(“ ”);delay(75);gotoxy(3,14);cprintf(“ ”);delay(75);gotoxy(3,15);cprintf(“ ”);delay(75);gotoxy(3,16);cprintf(“ ”);delay(75);gotoxy(3,17);cprintf(“ ”);return;}void MenuInitialise(void){int i;// The FILE menu optionMenu[MNU_FILE].nextMenu=MNU_EFFECT;Menu[MNU_FILE].prevMenu=MNU_OPERATION;Menu[MNU_FILE].Child=FALSE;Menu[MNU_FILE].num_items=4;for(i=0;i<4;i++){Menu[MNU_FILE].Enabled[i]=TRUE;Menu[MNU_FILE].subMenu[i]=NONE;Menu[MNU_FILE].String[i]=(char *)malloc(15);Menu[MNU_FILE].Tip[i]=(char *)malloc(50);Menu[MNU_FILE].OptionID[i]=1+i;}Menu[MNU_FILE].Enabled[1]=FALSE;strcpy(&(Menu[MNU_FILE].String[0][0]),“Open”);strcpy(&(Menu[MNU_FILE].String[1][0]),“Save”);strcpy(&(Menu[MNU_FILE].String[2][0]),“-”);strcpy(&(Menu[MNU_FILE].String[3][0]),“Exit”);strcpy(&(Menu[MNU_FILE].Tip[0][0]),“Open the *.wav file”);

TABLE IIWave File Format

of target processor. This is one of themethods to achieve invariance of the play-back speed over a wide range of proces-sor speeds available.

The softwarecan be used to playwith the followingeffects:

• Play normally• Play with a

different playbackrate, i.e. play it fastor slow

• Fade-in orfade-out the volumelevels either linearlyor exponentially

• Reverse thewave file and thenplay

The menu itemscan be selected us-ing keyboard keysAlt+F for file, Alt+Efor effects, andAlt+O for operation.Apart from the soft-ware, the hardwarecan be used to vary

bass, treble, and volume for the wave filethat is played. Thus, the hardware andsoftware complement each other to pro-vide a good music player. The software

does not include mouse support.

ConclusionWe have presented a simple sound cardto playback .wav files with bass and treblecontrols. Though the current designplays only mono files (stereo files areconverted to mono), a stereo file playercan be designed in a similar manner. Thesoftware can be modified to play audiofiles other than .wav files without anychange in the hardware circuit. The en-coding format of the other audio file types(like .ra, .mp3) is only to be known. Withthat, those files can be decoded and rawdigital 8-bit data can finally be sent to thehardware device. The hardware device caneven be permanently mounted inside thePC with all the power supplies (+12V, +5V,and –12V) tapped from the system’sSMPS.

Note: The complete source code con-sisting of Mplayer.cpp, Sounds.h,Globals.h, the executable file Mplayer.exe,and a sample wave file are likely to beincluded in next month’s CD (optional)accompanying EFY.

Program Listing

Page 28: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

55

strcpy(&(Menu[MNU_FILE].Tip[1][0]),“Save as a *.wav file”);strcpy(&(Menu[MNU_FILE].Tip[2][0]),” “);strcpy(&(Menu[MNU_FILE].Tip[3][0]),”Quit the program”);Menu[MNU_FILE].AtX=2;Menu[MNU_FILE].AtY=2;// The EFFECT menu optionMenu[MNU_EFFECT].nextMenu=MNU_OPERATION;Menu[MNU_EFFECT].prevMenu=MNU_FILE;Menu[MNU_EFFECT].Child=FALSE;Menu[MNU_EFFECT].num_items=5;for(i=0;i<5;i++){Menu[MNU_EFFECT].Enabled[i]=FALSE;Menu[MNU_EFFECT].subMenu[i]=NONE;M e n u [ M N U _ E F F E C T ] . S t r i n g [ i ] = (char*)malloc(15);Menu[MNU_EFFECT].Tip[i]=(char *)malloc(50);Menu[MNU_EFFECT].OptionID[i]=11+i;}strcpy(&(Menu[MNU_EFFECT].String[0][0]),“Fade In”);strcpy(&(Menu[MNU_EFFECT].String[1][0]),“Fade Out”);strcpy(&(Menu[MNU_EFFECT].String[2][0]),“-”);strcpy(&(Menu[MNU_EFFECT].String[3][0]),“Reverse”);strcpy(&(Menu[MNU_EFFECT].String[4][0]),“Playback Rate”);strcpy(&(Menu[MNU_EFFECT].Tip[0][0]),“Reduce volume with increasing time”);strcpy(&(Menu[MNU_EFFECT].Tip[1][0]),“Increase volume with increasing time”);strcpy(&(Menu[MNU_EFFECT].Tip[2][0]),“ ”);strcpy(&(Menu[MNU_EFFECT].Tip[3][0]),“Reverse the wave file”);strcpy(&(Menu[MNU_EFFECT].Tip[4][0]),“Vary the Playnack Rate”);Menu[MNU_EFFECT].subMenu[0]=MNU_FADEIN;Menu[MNU_EFFECT].subMenu[1]=MNU_FADEOUT;Menu[MNU_EFFECT].AtX=11;Menu[MNU_EFFECT]. AtY=2;// The OPERATION menu optionMenu[MNU_OPERATION].nextMenu=MNU_FILE;Menu[MNU_OPERATION].prevMenu=MNU_EFFECT;Menu[MNU_OPERATION].Child=FALSE;Menu[MNU_OPERATION].num_items=3;for(i=0;i<3;i++){Menu[MNU_OPERATION].Enabled[i]=FALSE;Menu[MNU_OPERATION].subMenu[i]=NONE;M e n u [ M N U _ O P E R A T I O N ] . S t r i n g [ i ] = (char*)malloc(15);M e n u [ M N U _ O P E R A T I O N ] . T i p [ i ] = (char*)malloc(50);Menu[MNU_OPERATION].OptionID[i]=21+i;}strcpy(&(Menu[MNU_OPERATION].String[0][0]),“Play”);strcpy(&(Menu[MNU_OPERATION].String[1] [0]),“-”);strcpy(&(Menu[MNU_OPERATION].String[2] [0]),“Record”);strcpy(&(Menu[MNU_OPERATION].Tip[0][0]),“Play the file that was opened”);strcpy(&(Menu[MNU_OPERATION].Tip[1] [0]),“ “);strcpy(&(Menu[MNU_OPERATION].Tip[2][0]), “Record sound through the microphone”);Menu[MNU_OPERATION] .AtX=23 ;Menu [MNU_OPERATION].AtY=2;// The FADE-IN menu optionM e n u [ M N U _ F A D E I N ] . n e x t M e n u = M e n u [MNU_FADEIN].prevMenu=NONE;Menu[MNU_FADEIN].Child=TRUE;Menu[MNU_FADEIN].num_items=2;for(i=0;i<2;i++){Menu[MNU_FADEIN].Enabled[i]=FALSE;Menu[MNU_FADEIN].subMenu[i]=NONE;M e n u [ M N U _ F A D E I N ] . S t r i n g [ i ] =

(char *)malloc(15);Menu[MNU_FADEIN].Tip[i]=(char *)malloc(50);Menu[MNU_FADEIN].OptionID[i]=31+i;}strcpy(&(Menu[MNU_FADEIN].String[0][0]),“Linear”);strcpy(&(Menu[MNU_FADEIN].String[1][0]),” Exponential”);strcpy(&(Menu[MNU_FADEIN].Tip[0][0]),“Apply Linear attenuation or amplification”);strcpy(&(Menu[MNU_FADEIN].Tip[1][0]),“Apply Exponential attenuation or amplification”);M e n u [ M N U _ F A D E I N ] . A t X = 3 3 ; M e n u [MNU_FADEIN].AtY=2;// The FADE-OUT menu optionMenu[MNU_FADEOUT].nextMenu=Menu [MNU_FADEOUT].prevMenu=NONE;Menu[MNU_FADEOUT].Child=TRUE;Menu[MNU_FADEOUT].num_items=2;for(i=0;i<2;i++){Menu[MNU_FADEOUT].Enabled[i]=FALSE;Menu[MNU_FADEOUT].subMenu[i]=NONE;M e n u [ M N U _ F A D E O U T ] . S t r i n g [ i ] = (char *)malloc(15);M e n u [ M N U _ F A D E O U T ] . T i p [ i ] = (char*)malloc(50);Menu[MNU_FADEOUT].OptionID[i]=41+i;}strcpy(&(Menu[MNU_FADEOUT].String[0][0]), “Linear”);strcpy(&(Menu[MNU_FADEOUT].String[1][0]), “Exponential”);strcpy(&(Menu[MNU_FADEOUT].Tip[0][0]),“Apply Linear attenuation or amplification”);strcpy(&(Menu[MNU_FADEOUT].Tip[1][0]),“Apply Exponential attenuation or amplification”);M e n u [ M N U _ F A D E O U T ] . A t X = 3 3 ; M e n u [MNU_FADEOUT].AtY=2;}void RemoveMenu(int MenuID){int i,j;textbackground(BLUE);textcolor(WHITE);gotoxy(Menu[MenuID].AtX,Menu[MenuID].AtY);for(i=0;i<30;i++) cprintf(“%c”,205);for(i=1;i<=Menu[MenuID].num_items+2;i++){gotoxy(Menu[MenuID].AtX,Menu[MenuID].AtY+i);for(j=0;j<30;j++) cprintf(“ ”);}return;}int ShowMenu(int MenuID){MENU *menu;int *subMenu;int nextMenu, prevMenu;char **String, **Tip;int *OptionID;BOOL *Enabled;char IsChild;int num_items;int longLength,length;int StartX,StartY;int i,j;int CurSelect=0,ch,RetVal;menu=&(Menu[MenuID]);num_items=menu->num_items;String=menu->String;nextMenu=menu->nextMenu;prevMenu=menu->prevMenu;subMenu=menu->subMenu;IsChild=menu->Child;OptionID=menu->OptionID;Tip=menu->Tip;Enabled=menu->Enabled;StartX=menu->AtX;StartY=menu->AtY;longLength=strlen(String[0]);

if(subMenu[0]!=NULL) longLength+=3;for(i=1;i<num_items;i++){length=strlen(String[i]);if(subMenu[i]!=NULL) length+=3;if(length>longLength) longLength=length;}textbackground(LIGHTGRAY);textcolor(WHITE);for(i=StartY;i<StartY+num_items+2;i++){gotoxy(StartX,i);cprintf(“ ”);gotoxy(StartX+longLength+5,i);cprintf(“ ”);}StartX++;gotoxy(StartX,StartY);cprintf(“%c”,218);for(i=0;i<longLength+2;i++) cprintf(“%c”,196);cprintf(“%c”,191);gotoxy(StartX,num_items+StartY+1);cprintf(“%c”,192);for(i=0;i<longLength+2;i++) cprintf(“%c”,196);cprintf(“%c”,217);for(i=0;i<num_items;i++){if(String[i][0]!=‘-’){textcolor(WHITE);gotoxy(StartX,StartY+i+1);cprintf(“%c ”,179);if(Enabled[i])textcolor(BLACK);elsetextcolor(BROWN);gotoxy(StartX+2,StartY+i+1);for(j=0;j<longLength+1;j++)if(j<strlen(String[i]))cprintf(“%c”,String[i][j]);elsecprintf(“ ”);textcolor(WHITE);cprintf(“%c”,179);}else{textcolor(WHITE);gotoxy(StartX,StartY+i+1);cprintf(“%c”,195);for(j=0;j<longLength+2;j++) cprintf(“%c”,196);cprintf(“%c”,180);}}for(;;){DisplayTip(Tip[CurSelect]);textbackground(GREEN);if(Enabled[CurSelect])textcolor(BLACK);elsetextcolor(BROWN);gotoxy(StartX+1,StartY+CurSelect+1);cprintf(“ ”);for(j=0;j<longLength+1;j++)if(j<strlen(String[CurSelect]))cprintf(“%c”,String[CurSelect][j]);elsecprintf(“ ”);ch=getch();if(ch==0) ch=getch();ch+=300;switch(ch){case ESCAPE:RemoveMenu(MenuID);return(-1);case ENTER:RemoveMenu(MenuID);if(Enabled[CurSelect]==TRUE)return(OptionID[CurSelect]);elsereturn(-1);case LEFT_ARROW:if(IsChild==TRUE){

Page 29: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

56

RemoveMenu(MenuID);return(0);}else{if(prevMenu!=NONE){RemoveMenu(MenuID);return(ShowMenu(prevMenu));}}break;case RIGHT_ARROW:if(subMenu[CurSelect]!=NONE){RetVal=ShowMenu(subMenu[CurSelect]);if(RetVal!=0){RemoveMenu(MenuID);return(RetVal);}}else{if(nextMenu!=NONE){RemoveMenu(MenuID);return(ShowMenu(nextMenu));}}break;case DOWN_ARROW:textbackground(LIGHTGRAY);if(Enabled[CurSelect])textcolor(BLACK);elsetextcolor(BROWN);gotoxy(StartX+1,StartY+CurSelect+1);cprintf(“ ”);for(j=0;j<longLength+1;j++)if(j<strlen(String[CurSelect]))cprintf(“%c”,String[CurSelect][j]);elsecprintf(“ ”);CurSelect++;if(CurSelect==num_items) CurSelect=0;while(String[CurSelect][0]==’-’){if(CurSelect==num_items)CurSelect=0;elseCurSelect++;}break;case UP_ARROW:textbackground(LIGHTGRAY);if(Enabled[CurSelect])textcolor(BLACK);elsetextcolor(BROWN);gotoxy(StartX+1,StartY+CurSelect+1);cprintf(“ ”);for(j=0;j<longLength+1;j++)if(j<strlen(String[CurSelect]))cprintf(“%c”,String[CurSelect][j]);elsecprintf(“ ”);CurSelect—;if(CurSelect<0) CurSelect=num_items-1;while(String[CurSelect][0]==’-’){if(CurSelect<0)CurSelect=num_items-1;elseCurSelect—;}break;}}

}void ButtonDisplay(int x1,int y1,char state char *caption){text_info tinfo;gettextinfo(&tinfo);int i;if(state==ENABLE_NOTACTIVE) textcolor (YELLOW);if(state==ENABLE_ACTIVE) textcolor(WHITE);if(state==DISABLE) textcolor(LIGHTGRAY);textbackground(CYAN);gotoxy(x1,y1);cprintf(“ %s ”,caption);textbackground(LIGHTGRAY);textcolor(YELLOW);cprintf(“%c”,220);gotoxy(x1+1,y1+1);for(i=0;i<8;i++)cprintf(“%c”,223);textattr(tinfo.attribute);}void ButtonPushed(int x1,int y1,char *caption){text_info tinfo;gettextinfo(&tinfo);int i;textbackground(LIGHTGRAY);textcolor(WHITE);gotoxy(x1,y1);cprintf(“ ”);gotoxy(x1,y1+1);cprintf(“ ”);textbackground(CYAN);gotoxy(x1+1,y1);cprintf(“ %s ”,caption);delay(250);gotoxy(x1,y1);cprintf(“ %s ”,caption);textbackground(LIGHTGRAY);textcolor(YELLOW);cprintf(“%c”,220);gotoxy(x1,y1+1);cprintf(“ ”);for(i=0;i<8;i++) cprintf(“%c”,223);textattr(tinfo.attribute);}BOOL DisplayDialog(char mode){int Control=0,ch;int x=29,y=5,i=0,N=0;char TempStr[40];TempStr[0]=0;switch(mode){case FILE_OPEN: Window(10,3,70,9,“Open File”,LIGHTGRAY,YELLOW);break;case FILE_SAVE: Window(10,3,70,9,“Save File”,LIGHTGRAY,YELLOW);break;case PLAYBACK_RATE: Window(10,3,70,9,” Playback Rate”,LIGHTGRAY,YELLOW);break;}ButtonDisplay(25,7,ENABLE_NOTACTIVE,“ Ok ”);ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”);textbackground(LIGHTGRAY);textcolor(YELLOW);gotoxy(13,5);if(mode==FILE_OPEN || mode==FILE_SAVE){cprintf(“Enter Filename: ”);strcpy(TempStr,sFileName);N=39;}else{cprintf(“Playback Rate : ”);strcpy(TempStr,sPlayBackRate);N=5;}textbackground(BLUE);textcolor(WHITE);cprintf(“ ”);gotoxy(29,5);cprintf(“%s”,TempStr);i=strlen(TempStr);x+=i;for(;;){switch(Control){case 0:_setcursortype(_NORMALCURSOR);textbackground(BLUE);textcolor(WHITE);

ButtonDisplay(45,7,ENABLE_NOTACTIVE,“Cancel”);gotoxy(x,y);break;case 1:_setcursortype(_NOCURSOR);ButtonDisplay(25,7,ENABLE_ACTIVE,“ Ok ”);break;case 2:ButtonDisplay(45,7,ENABLE_ACTIVE,“Cancel”);ButtonDisplay(25,7,ENABLE_NOTACTIVE,“ Ok ”);break;}ch=getch();if(ch==0) ch=getch()+300;ch+=300;switch(ch){case TAB:Control=(++Control)%3;break;case ESCAPE:_setcursortype(_NOCURSOR);ButtonPushed(45,7,“Cancel”);ch=1; Control=2;break;case ENTER:_setcursortype(_NOCURSOR);ButtonPushed(25,7,“ Ok “);ch=1;Control=1;break;case SPACE:if(Control==2){_setcursortype(_NOCURSOR); ButtonPushed(45,7,“Cancel”);ch=1;}if(Control==1){_setcursortype(_NOCURSOR); ButtonPushed(25,7,“ Ok ”);ch=1;}break;case BACK_SPACE:if(Control==0 && i>0){gotoxy(—x,y);cprintf(“ ”);i—;TempStr[i]=0;gotoxy(29,5);cprintf(“%s”,TempStr);}break;default:ch-=300;if(ch<300 && i<N){TempStr[i++]=(char)ch;TempStr[i]=0;gotoxy(29,5);cprintf(“%s”,TempStr);x++;}break;}if(ch==1) break;}textbackground(BLUE);textcolor(WHITE);for(ch=3;ch<=9;ch++)}gotoxy(10,ch);for(i=10;i<=70;i++)cprintf(“ ”);}if(Control==1){if(mode==FILE_SAVE || mode==FILE_OPEN) strcpy(sFileName,TempStr);if(mode==PLAYBACK_RATE)strcpy(sPlayBackRate, TempStr);return(TRUE);}return(FALSE);}

Page 30: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

57

void SetEnvVariables(){}void SaveFile(){}void main(){int ch;textbackground(BLACK);textcolor(LIGHTGRAY);clrscr();_setcursortype(_NOCURSOR);DrawScreen();MenuInitialise();sFileName[0]=0;strcpy(sPlayBackRate,”22400");for(;;){DisplayTip(“Ready”);ch=getch();if(ch==0) ch=getch();ch+=300;switch(ch){case AltF:ch=ShowMenu(MNU_FILE);break;case AltE:ch=ShowMenu(MNU_EFFECT);break;case AltO:ch=ShowMenu(MNU_OPERATION); break;}switch(ch){case FILE_EXIT:ch=AltX;break;case FILE_OPEN:if(DisplayDialog(FILE_OPEN))if(mOpen()){for(int i=0;i<5;i++)Menu[MNU_EFFECT].Enabled[i]=TRUE;Menu[MNU_OPERATION].Enabled[0]=TRUE;for(i=0;i<2;i++){Menu[MNU_FADEIN].Enabled[i]=TRUE;Menu[MNU_FADEOUT].Enabled[i]=TRUE;}}break;case FILE_SAVE:/*if(DisplayDialog(FILE_SAVE))mSave();*/break;case FADEIN_LINEAR:FadeCommon(FADEIN,LINEAR);break;case FADEIN_EXP:FadeCommon(FADEIN,EXPONENTIAL);break;case FADEOUT_LINEAR:FadeCommon(FADEOUT,LINEAR);break;case FADEOUT_EXP:FadeCommon(FADEOUT,EXPONENTIAL);break;case REVERSE:ReverseWave();break;case PLAYBACK_RATE:if(DisplayDialog(PLAYBACK_RATE)==FALSE)SetPlayBackRate(0);elseSetPlayBackRate(1);break;case PLAY:mPlay();break;}if(ch==AltX){_setcursortype(_NORMALCURSOR);textcolor(LIGHTGRAY);textbackground(BLACK);clrscr();printf(“MPLAYER Ver.1.0\n”);

printf(“———————\n”);printf(“\tM.Somasundaram - [email protected]\n\tN.V.Venkatarayalu - [email protected]\n\n”);break;}}}

SOUNDS.H#include “Globals.h”/////////// Playback Sounds ///////////////void mPlay(void){FILE *fp;unsigned char Sample;clock_t t1;long k=0,t=0,i=0;fp=fopen(“test.aud”,“rb”);t1=clock();while(clock()-t1<18.2){if(k<RateOfPlayBack){fgetc(fp);outp(0x37a,0);if(feof(fp)) break;t++;}k++;}i=k/(RateOfPlayBack+2000);k=0;rewind(fp);t1=clock();while(clock()-t1<18.2){if(k%i==0){fgetc(fp);outp(0x37a,0);if(feof(fp)) break;t++;}if(k>0) k=k;k++;}i=k/(RateOfPlayBack+2000);k=0;t=0;rewind(fp);while(feof(fp)==FALSE){t1=clock();if(k%i==0){Sample=(unsigned char)fgetc(fp);outp(DATA_OUT,Sample);t++;}k++;}fclose(fp);outp(DATA_OUT,0);}///////////// Fade Common Function ////////////////void FadeCommon(char far InOrOut,char far Type){FILE *fp, *fpt;long double i;long double step;long double attn1;fp=fopen(“test.aud”,“rb”);fpt=fopen(“tmp.aud”,“wb”);step=1.0/NoSamples;if(InOrOut==FADEIN)attn1=0;else{attn1=1;step=-step;}if(Type==LINEAR)for(i=0.0;i<NoSamples;i++){attn1+=step;fputc(128+(unsigned char)((long double)(fgetc(fp)- 128)*attn1),fpt);}elsefor(i=0.0;i<NoSamples;i++){

attn1=exp(i*step);fputc(128+(unsigned char)((long double)(fgetc(fp)- 128)*attn1),fpt);}fclose(fpt);fclose(fp);unlink(“test.aud”);rename(“tmp.aud”,”test.aud”);}/////////////// Reverse Wave File ////////////////void ReverseWave(void){FILE *fp, *fpt;long double i;fp=fopen(“test.aud”,“rb”);fpt=fopen(“tmp.aud”,“wb”);for(i=0.0;i<NoSamples;i++){fseek(fp,-(long)i,SEEK_END);fputc(fgetc(fp),fpt);}fclose(fpt);fclose(fp);unlink(“test.aud”);rename(“tmp.aud”,”test.aud”);}/////////////// Set Playback rate ///////////////void SetPlayBackRate(long rate){if(rate<65535){if(rate!=0){rate=atol(sPlayBackRate);RateOfPlayBack=rate;}ultoa(RateOfPlayBack,sPlayBackRate,10);}return;}/////// Open a wav file and set parameters ///////BOOL mOpen(void){void DisplayTip(char *);int TYPE_OF_OUTPUT=MONO_OUTPUT;FILE *fsource, *fdest;fsource=fopen(sFileName,“rb”);if(fsource!=NULL){fdest=fopen(“test.aud”,“wb”);RIFF riff;WAVE wave;DATA data;fread(&riff,sizeof(riff),1,fsource);fread(&wave,sizeof(wave),1,fsource);fseek(fsource,20+wave.fmt.fLen,SEEK_SET);fread(&data,sizeof(data),1,fsource);if(strncmpi(data.dID,“FACT”,4)==0){fseek(fsource,data.dLen,SEEK_CUR);fread(&data,sizeof(data),1,fsource);}if(!(strncmpi(riff.rID,“RIFF”,4)==0 && strncmpi(wave.wID,“WAVE”,4)==0 && strncmpi(data.dID,“DATA”,4)==0 && strncmpi(wave.fmt.fID,“fmt”,4)==0 && wave.fmt.wFormatTag==PCM && wave.fmt.nChannels<=6)){printf(“\a”);DisplayTip(“Unrecognizable Format -Not PCM 8-bit.”);return FALSE;}unsigned long dlen=data.dLen;char array[6];int arrayi[6];int nChannels=wave.fmt.nChannels;SamplingFrequency=PBR=RateOfPlayBack= wave.fmt.nSamplesPerSec;ultoa(RateOfPlayBack,sPlayBackRate,10);NoSamples=(dlen/nChannels)*TYPE_OF_

Page 31: Kumpulan skematik elektronika 3

ELECTRONICS FOR YOU z MAY 2000

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

58

OUTPUT;dlen=NoSamples;BOOL bits16=FALSE;if(wave.fmt.FormatSpecific==BITS16) bits16= TRUE;if(bits16==FALSE)while(dlen>0){fread(array,1,nChannels,fsource);switch(nChannels){case 1: fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[0],fdest);break;case 2: fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[1],fdest);break;case 3: fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[1],fdest);break;case 4: fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[2],fdest);break;case 6: fputc((int)array[1],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[4],fdest);break;}dlen—;}else{NoSamples/=2;dlen=NoSamples;while(dlen>0){fread(arrayi,2,nChannels,fsource);switch(nChannels){case 1: array[0]=(char)((long)(arrayi[0]+ 32768)*255/65535);fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT)fputc((int)array[0],fdest);break;case 2: array[0]=(char)((long)(arrayi[0]+ 32768)*255/65535);fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT){array[1]=(char)((long)(arrayi[1]+32768)*255/ 65535);fputc((int)array[1],fdest);}break;case 3: array[0]=(char)((long)(arrayi[0]+ 32768)*255/65535);fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT){array[1]=(char)((long)(arrayi[1]+32768)*255/ 65535);fputc((int)array[1],fdest);}

break;case 4: array[0]=(char)((long)(arrayi[0]+ 32768)*255/65535);fputc((int)array[0],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT){array[2]=(char)((long)(arrayi[2]+32768)*255/ 65535);fputc((int)array[2],fdest);}break;case 6: array[1]=(char)((long)(arrayi[1]+ 32768)*255/65535);fputc((int)array[1],fdest);if(TYPE_OF_OUTPUT==STEREO_OUTPUT){array[4]=(char)((long)(arrayi[4]+32768)*255/ 65535);fputc((int)array[4],fdest);}break;}dlen—;}}fclose(fsource);fclose(fdest);return TRUE;}else{printf(“\a”);DisplayTip(“The file is not available!”);return FALSE;}}

GLOBALS.H#include <stdio.h>#include <dos.h>#include <process.h>#include <conio.h>#include <string.h>#include <math.h>#include <stdlib.h>#include <time.h>#define FALSE 0#define TRUE 1#define ENABLE_ACTIVE 1#define ENABLE_NOTACTIVE 2#define DISABLE 0#define NONE -1#define MNU_FILE 0#define MNU_EFFECT 1#define MNU_OPERATION 2#define MNU_FADEIN 3#define MNU_FADEOUT 4#define FILE_OPEN 1#define FILE_SAVE 2#define FILE_EXIT 4#define FADEIN_LINEAR 31#define FADEIN_EXP 32#define FADEOUT_LINEAR 41#define FADEOUT_EXP 42#define REVERSE 14#define PLAYBACK_RATE 15#define PLAY 21#define RECORD 22

#define AltE 318#define AltF 333#define AltO 324#define AltX 345#define LEFT_ARROW 375#define RIGHT_ARROW 377#define UP_ARROW 372#define DOWN_ARROW 380#define ESCAPE 327#define ENTER 313#define SPACE 332#define BACK_SPACE 308#define TAB 309#define PCM 1#define IN 0#define OUT 1#define LINEAR 0#define EXPONENTIAL 1#define FADEIN 0#define FADEOUT 1#define DATA_OUT 0x378#define BITS16 16#define BITS8 8#define STEREO_OUTPUT 2#define MONO_OUTPUT 1typedef char BOOL;typedef struct{char rID[4];unsigned long rLen;}RIFF;typedef struct{char fID[4];unsigned long fLen;unsigned int wFormatTag;unsigned int nChannels;unsigned long nSamplesPerSec;unsigned long nAvgBytesPerSec;unsigned int nBlockAlign;unsigned int FormatSpecific;}FORMATCHUNK;typedef struct{char wID[4];FORMATCHUNK fmt;}WAVE;typedef struct{char dID[4];unsigned long dLen;}DATA;struct MENU{ int subMenu[10];char *Tip[10];char *String[10];int OptionID[10];BOOL Enabled[10];int num_items;char Child;int AtX,AtY;int nextMenu;int prevMenu;} Menu[5];long RateOfPlayBack=15000,PBR;long double NoSamples=76455;double SamplingFrequency=44000;char sFileName[40];char sPlayBackRate[6];

o

Page 32: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU SEPTEMBER 2004

T his simple circuit lets you run a DCmotor in clockwise or anti-clockwisedirection and stop it using a single

switch. It provides a constant voltage forproper operation of the motor. The glow-ing of LED1 through LED3 indicates thatthe motor is in stop, forward rotation and

reverse conditions, respectively.Here, timer IC1 is wired as a

monostable multivibrator to avoid falsetriggering of the motor while pressingswitch S1. Its time period is approximately500 milliseconds (ms).

Suppose, initially, the circuit is inreset condition with Q0 output of IC2being high. Since Q1 and Q3 outputs ofIC2 are low, the outputs of IC3 and IC4are high and the motor doesn’t rotate.LED1 glows to indicate that the motor isin stop condition.

DC MOTOR CONTROL USING A SINGLE SWITCHV. DAVID

S.C. DWIVEDI

When you momentarily press switchS1, timer 555 (IC1) provides a pulse todecade counter CD4017 (IC2), which ad-vances its output by one and its high stateshifts from Q0 to Q1. When Q1 goes high,the output of IC3 at pin 3 goes low, so themotor starts running in clockwise (forward)direction. LED2 glows to indicate that themotor is running in forward direction.

Now if you press S1 again, the highoutput of IC2 shifts from Q1 to Q2. Thelow Q1 output of IC2 makes pin 3 of IC3high and the motor doesn’t rotate. LED1glows (via diode D2) to indicate that themotor is in stop condition.

Pressing switch S1 once again shiftsthe high output of IC2 from Q2 to Q3.The high Q3 output of IC2 makes pin 3 ofIC4 low and the motor starts running inanti-clockwise (reverse) direction. LED3glows to indicate that the motor is run-ning in reverse direction.

If you press S1 again, the high outputof IC2 shifts from Q3 to Q4. Since Q4 isconnected to reset pin 15, it resets decadecounter CD4017 and its Q0 output goeshigh, so the motor does not rotate. LED1glows via diode D1 to indicate that themotor is in stop condition. Thereafter, thecycle repeats.

If you don’t want to operate the motor

in reverse direction, remove timer IC4along with resistors R5 and R7 and LED3.And connect ‘b’ terminal of the motor to+Vcc.

Similarly, if you don’t want to run themotor in forward direction, remove timerIC3 along with resistors R4 and R6 andLED2. And connect ‘a’ terminal of the mo-tor to +Vcc.

The circuit works off a 9V regulatedpower supply for a 9V DC motor. Use a6V regulated power supply for a 6V DCmotor.

Page 33: Kumpulan skematik elektronika 3

CIRCUITIDEAS

1 0 8 • M A R C H 2 0 0 5 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

CMYK

Need to connect more than oneaudio-video (AV) source toyour colour television? Don’t

worry, here’s an AV input expanderfor your TV. It is inexpensive and easyto construct.

The working of the circuit is simple

and straightforward. Whenever 12VDC is applied to the circuit, power-onLED1 glows. Now reset the decadecounter by momentarily pressingswitch S2 to make Q0 output of IC1high. LED2 glows to indicate that thecircuit is ready to work.

Switch S1 is used for selecting aparticular audio-video (AV) signal. Toselect the first AV signal, press switch

T.K. HAREENDRAN

DIGITAL AUDIO/VIDEOINPUT SELECTOR S.C. DW

IVEDI

S1 once. To select the second AV sig-nal, press switch S1 twice. In the sameway, you can select the other two sig-nals.

Momentarily pressing of switch S1once results in clocking of the decadecounter and relay driver transistor T1

conducts to energise relay RL1. Nownormally opened (N/O) contacts oftwo-changeover relay RL1 connect thetelevision set’s inputs to the first AVsignal (marked as Video-In 1 and Au-dio-in 1). LED3 glows to indicate this.

When you press switch S1 twice,the Q2 output of IC1 goes high. Con-sequently, 2C/O relay RL2 (not shownin the circuit) energises and television

inputs are connected to the second AVsignal (not shown in the figure). LED4(not shown in figure) glows to indi-cate this.

Similarly, pressing switch S1 thricemakes the Q3 output of IC1 high. Con-sequently, 2C/O relay RL3 (not shown

in the figure) energisesand the television inputsare connected to thethird AV signal source.LED5 (not shown in thefigure) glows to indicatethis.

Again, pressingswitch S1 four timesmakes the Q4 output ofIC1 high. Consequently,2C/O relay RL4energises and the TV in-puts are connected to thefourth AV signal source(marked as Video-in 4and Audio-in 4). LED6glows to indicate this.

Further pressing of switch S1 resetsthe decade counter and LED2 glowsagain. Thereafter, the cycle repeats. Thecircuit is wired for four-input selec-tion, therefore the Q5 output of IC1 isconnected to reset pin 15 of IC1.

Enclose the assembled PCB alongwith the relays in a cabinet with theinput/output sockets and indicatorsmounted on the body of the cabinet.

PCB FOR 8085MICROPROCESSOR KIT(EFY NOVEMBER 99)WITH ALL ITS ICs

Kits‘n’Spares303, Dohil Chambers, 46, Nehru Place,New Delhi 110019; Phone: 26430523,26449577; E-mail: [email protected]

Available at:

Page 34: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19188

DIGITAL DICE WITH NUMERIC DISPLAY

The circuit described here is that of a digital dice with numeric dis- play. Timer IC 555 wired as an

astable multivibrator produces pulses at about 48 kHz rate. These pulses are fed to pin 14 of the decade counter IC 7490. The oscillator is activated by depression of switch S1.

Using different connections tor pins 2,

3 (reset to zero inputs Ro(1) and Ro(2)) and the binary output pins 12, 9, 8 and 11 of IC7490, various count ranges can be set. For the given circuit the count range is set as 0 to 5 by connecting QB and QC outputs to Ro(1) and Ro(2) inputs, respectively.

At the count of 6, QB and QC outputs of IC2 go high and counter is reset. The

binary output pins of the counter IC2 are connected to corresponding input pins of 4-bit binary adder IC3 (7483) which is wired to give binary output equal to bi-nary input+1. Thus the output of the dice ranges from 1 to 6. For obtaining other dice ranges, reset pins 2 and 3 connections may be made as per Table I.

The binary summation outputs from

IC 7483 are connected to IC4 (7447) which is a BCD to 7-segment decoder/driver. The output from IC4 is connected to a 7-segment common-anode LED display (LTS542).

When switch S1 is depressed, the LED (D1) glows and the number displayed at the 7-segment display changes at a rate

TABLE IDice range Connect Connect pin 2 to pin 3 to1 to 2 pin 9 +5V1 to 3 pin 9 pin 121 to 4 pin 8 +5V1 to 5 pin 8 pin 121 to 6 pin 8 pin 91 to 8 pin 11 +5V1 to 9 pin 11 pin 12

of about 48,000 times per second. As soon as the switch is released, the last (latest) number remains on display. Thus the circuit performs the function of a random number generator with the displayed number lying within the selected (wired) range.

Page 35: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 22

DIGITAL MAINS VOLTAGE INDICATOR

Continuous monitoring of the mainsvoltage is required in many ap-plications such as manual volt-

age stabilisers and motor pumps. An ana-logue voltmeter, though cheap, has manydisadvantages as it has moving parts andis sensitive to vibrations. The solidstatevoltmeter circuit described here indicatesthe mains voltage with a resolution thatis comparable to that of a general-pur-pose analogue voltmeter. The status ofthe mains voltage is available in the formof an LED bar graph.

Presets VR1 through VR16 are used

to set the DC voltages corresponding tothe 16 voltage levels over the 50-250Vrange as marked on LED1 throughLED16, respectively, in the figure. TheLED bar graph is multiplexed from thebottom to the top with the help of ICsCD4067B (16-channel multiplexer) and

CD4029B (counter). The counter clockedby NE555 timer-based astablemultivibrator generates 4-bit binary ad-dress for multiplexer-demultiplexer pairof CD4067B and CD4514B.

The voltage from the wipers of pre-sets are multiplexed by CD4067B and theoutput from pin 1 of CD4067B is fed tothe non-inverting input of comparator A2(half of op-amp LM358) after being buff-ered by A1 (the other half of IC2). Theunregulated voltage sensed from rectifieroutput is fed to the inverting input ofcomparator A2.

The output of comparator A2 is lowuntil the sensed voltage is greater thanthe reference input applied at the non-inverting pins of comparator A2 via bufferA1. When the sensed voltage goes belowthe reference voltage, the output of com-parator A2 goes high. The high output

from comparator A2 inhibits the decoder(CD4514) that is used to decode the out-put of IC4029 and drive the LEDs. Thisensures that the LEDs of the bar graphare ‘on’ up to the sensed voltage-level pro-portional to the mains voltage.

The initial adjustment of each of thepresets can be done by feeding a knownAC voltage through an auto-transformerand then adjusting the corresponding pre-set to ensure that only those LEDs thatare up to the applied voltage glow.

(EFY note. It is advisable to use ad-ditional transformer, rectifier, filter, and

regulator arrangements for obtaining aregulated supply for the functioning of thecircuit so that performance of the circuitis not affected even when the mains volt-age falls as low as 50V or goes as high as280V. During Lab testing regulated 12-volt supply for circuit operation was used.)

+

Page 36: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUJULY 2004

DIGITAL STOP WATCH S.C. DWIVEDI

Here’s a digital stop watch builtaround timer IC LM555 and 4-digitcounter IC with multiplexed 7-seg-

ment output drivers (MM74C926).IC MM74C926 consists of a 4-digit

counter, an internal output latch, npnoutput sourcing drivers for common-cathode, 7-segment display and an

internal multiplexing circuitry with fourmultiplexing outputs. The multiplexing cir-cuit has its own free running oscillator,and requires no external clock. Thecounter advances on negative edge ofthe clock. The clock is generated by timerIC LM555 (IC1) and applied to pin 12of IC2.

A high signal on reset pin 13 ofIC2 resets the counter to zero. Reset pin13 is connected to +5V through reset

C.H. VITHALANI push-on-switch S3. When S2 is momen-tarily pressed, the count value becomes0, transistor T1 conducts and it resetsIC1. Counting starts when S2 is in ‘off’condition.

A low signal on the latch-enable inputpin 5 (LE) of IC2 latches the number inthe counter into the internal output latches.When switch S2 is pressed, pin 5 goeslow and hence the count value gets stored

in the latch. Display-select pin 6 (DS) de-cides whether the number on the counteror the number stored in the latch is to bedisplayed. If pin 6 is low the number inthe output latch is displayed, and if pin 6is high the number in the counter is dis-played.

When switch S2 is pressed, thebase of pnp transistor T2 is connected toground and it starts conducting. The emit-ter of T2 is connected to DS pin of IC2.

Thus, when switch S3 is pressed, resetpin 13 of IC2 is connected to groundvia transistor T1 and the oscillator doesnot generate clock pulses. This is doneto achieve synchronisation between IC1and IC2.

First, reset the circuit so that the dis-play shows ‘0000.’ Now open switch S2for the stop watch to start counting thetime. If you want to stop the clock, close

switch S2.Rotary switch S1 is used to select the

different time periods at the output of theastable multivibrator (IC1). The circuitworks off a 5V power supply. It can beeasily assembled on a general-purposePCB. Enclose the circuit in a metal boxwith provisions for four 7-segment dis-plays, rotary switch S1, start/stop switchS2 and reset switch S3 in the front panelof the box.

Page 37: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19140

This instrument displays the speedof the vehicle in kmph. Anopaque disc is mounted on the

spindle attached to the front wheel ofthe vehicle. The disc has ten equidistantholes on its periphery. On one side ofthe disc an infrared LED is fixed and onthe opposite side of the disc, in line with

DIGITAL SPEEDOMETERNARENDRA WADHWANI

the IR LED, a phototransistor ismounted. IC LM324 is wired as acomparator.

When a hole appears between theIR LED and phototransistor, thephototransistor conducts. Hence the volt-age at collector of the phototransistorand inverting input of LM324 go ‘low’,

and thus output of LM324 becomes logic‘high’. So rotation of the speedometercable results in a pulse (square wave) atthe output of LM324. The frequency ofthis waveform is proportional to thespeed.

Let ‘N’ be the number of pulses intime ‘t’ seconds and numerically equalto the number of kilometres per hour(kmph). For a vehicle such as LMLVespa, with a wheel circumference of1.38 metres, and number of pulses equalto 10 per revolution, we get therelationship:

Therefore, time ‘t’ in seconds= 0.4968 second.

As shown in the timing diagram, att=0, output of astable flip-flop IC1(a) i.e.½556 goes low and triggers monostablemultivibrator IC1(b) i.e. ½556. Pulsewidth 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) andIC1(b), and the signal from thetransducer section are ANDed. Thenumber of pulses counted during thegating period (0.4968 sec.) is the speedN in kmph (kilometres per hour).

At the end of the gating period,output ‘B’ of monostable IC1(b) goes lowand B goes high. The rising edge of B isused to enable the quad ‘D’ flip-flops IC6and IC7.

At this instant, i.e. at t=0.5068 sec.,the number (speed) N will be latchedcorresponding to the ‘D’ flip-flops anddisplayed. At t=0.52 sec., output ofastable flip-flop IC1(a) goes low andremains low for 0.01 sec. Thiswaveform is inverted and applied tothe reset terminals of all counters (ac-tive high).

Thus the counters are reset and

N pulsest

= N kmph

Nx1000 metres per second3600x1.38

=

Nx1000x10 pulses per second3600x1.38

=

Page 38: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19 141

counting begins afresh at t=0.53 sec. upto the time t=0.52+0.2068 sec. Howeverthe ‘D’ flip-flops are not enabled and the

previous speed is displayed. Thenew speed is displayed at t=0.52 +0.5068 sec. In this way the speedwill be updated every 0.52 sec.

This speedometer can measureup to 99 kmph with a resolution of1 kmph. The range can be increasedup to 999 kmph by adding anotherstage consisting of one each of ICs7490, 74175, 7447 and a 7-segmentdisplay. The voltage supply requiredfor the operation of the circuit isderived from the vehicle powersupply (12V).

The calculations shown above are forLML Vespa and Kinetic Honda. The cal-culations for using this speedometer for

Yamaha, whose circumference of wheel= 1.8353m, can be obtained in a similarfashion. The gating period will simplyvary in direct proportion to the wheeldiameter. It will be 0.6607 sec. forYamaha.

The same speedometer can be usedfor other vehicles by making similar cal-culations. In all the calculations it hasbeen assumed that the speedometercable makes one revolution for everyrevolution of the wheel of the vehicles.Note that on/off periods of the wave-forms have to be precise. High quality

multiturn pots and low temperature co-efficient components should be used inthe timer ICs.

Page 39: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19184

Fig. 1: Block diagram of pump controller.

Fig. 2: Circuit diagram of pump controller.

ECONOMICAL PUMP CONTROLLER

The automatic pump controller eliminates the need for any manual switching of pumps in-

stalled for the purpose of pumping wa-ter from a reservoir to an overhead tank (refer Fig. 1). It auto-m a t i c a l l y switches on t h e p u m p w h e n t h e water level in the tank falls below a c e r t a i n l o w l e v e l L), provided t h e w a t e r level in the r e s e r v o i r is above a certain level (R). Subse-quently, as t h e w a t e r level in the lank r i ses to an upper l e v e l ( M ) , the pump is switched off automatically. The pump is turned on again only when the water level again falls below level L in the tank, provided the level in the reser-voir is above R. This automated action continues.

The circuit is designed to ‘overlook’ the transient oscillations of the water level which would otherwise cause the logic to change its state rapidly and unnecessarily. The circuit uses a single CMOS chip (CD4001) for logic process-ing.

No use of any moving electro-mechanical parts in the water-level sensor has been made. This ensures

quick response, no wear and tear, and no mechanical failures. The circuit diagram is shown in Fig.2. The device performed satisfactorily on a test run in conjunction with a 0.5 HP motor

and pump.The sensors used in the circuit can

be any two conducting probes, preferably resistant to electrolytic corrosion. For instance, in the simplest case, a properly sealed audio jack can be used to work as the sensor.

The circuit can also be used as a constant fluid level maintainer. For this purpose the probes M and L are brought very close to each other to ensure that the fluid level is maintained within the M and L levels.

The advantage of this system is that it can be used in tanks/reservoirs of any capacity whatsoever. However, the circuit

cannot be used for purely non-conducting fluids. For non-conducting fluids, some modifications need to be made in the fluid-level sensors. The circuit can however be kept intact.

Page 40: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20 179

ElEctrical EquipmEnt control using pc

P.V. Vinod Kumar

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

The interface circuit shown in the figure is drawn

for only one device, being controlled by D0 bit at pin 2 of the 25-pin parallel port. Identical circuits for the remaining data

Page 41: Kumpulan skematik elektronika 3

CIRCUIT IDEAS

ELECTRONICS FOR YOU���JUNE '99

A.P.S. DHILLON

This jam circuit can be used inquiz contests wherein any par-ticipant who presses his button

(switch) before the other contestants,gets the first chance to answer a ques-tion. The circuit given here permits upto eight contestants with each one al-lotted a distinct number (1 to 8). Thedisplay will show the number of the con-testant pressing his button before theothers. Simultaneously, a buzzer willalso sound. Both, the display as well asthe buzzer have to be reset manuallyusing a common reset switch.

Initially, when reset switch S9 is mo-mentarily pressed and released, all out-puts of 74LS373 (IC1) transparent latchgo ‘high’ since all the input data linesare returned to Vcc via resistors R1

through R8. All eight outputs of IC1are connected to inputs of priority en-coder 74LS147 (IC2) as well as 8-inputNAND gate 74LS30 (IC3). The outputof IC3 thus becomes logic 0 which, afterinversion by NAND gate N2, is appliedto latch-enable pin 11 of IC1. With allinput pins of IC2 being logic 1, its BCDoutput is 0000, which is applied to 7-segment decoder/driver 74LS47 (IC6) af-ter inversion by hex inverter gates in-side 74LS04 (IC5). Thus, on reset thedisplay shows 0.

When any one of the push-to-onswitches—S1 through S8—is pressed,the corresponding output line of IC1 islatched at logic 0 level and the displayindicates the number associated withthe specific switch. At the same time,

Electronic JamRAJESH K.P.

output pin 8 of IC3 becomes high, whichcauses outputs of both gates N1 andN2 to go to logic 0 state. Logic 0 outputof gate N2 inhibits IC1, and thus press-ing of any other switch S1 through S8has no effect. Thus, the contestant whopresses his switch first, jams the dis-play to show only his number. In theunlikely event of simultaneous press-ing (within few nano-seconds difference)of more than one switch, the higherpriority number (switch no.) will bedisplayed. Simultaneously, the logic 0output of gate N1 drives the buzzer viapnp transistor BC158 (T1). The buzzeras well the display can be reset (toshow 0) by momentary pressing of re-set switch S9 so that next round maystart.

Lab Note: The original circuit sentby the author has been modified as itdid not jam the display, and a highernumber switch (higher priority), evenwhen pressed later, was able to changethe displayed number.

Page 42: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUOCTOBER 2003

ELECTRONIC MOTOR STARTER SUNIL KUMAR

T.A. BABU

This motor starter protects single-phase motors against voltage fluc-tuations and overloading. Its salient

feature is a soft on/off electronic switchfor easy operation.

The transformer steps down the ACvoltage from 230V to 15V. Diodes D1 and

D2 rectify the AC voltage to DC. The un-regulated power supply is given to the pro-tection circuit.

In the protection circuit, transistor T1 isused to protect the motor from over-volt-age. The over-voltage setting is done using

preset VR1 such that T1 conducts whenvoltages goes beyond upper limit (say,260V). When T1 conducts, it switches offT2. Transistor T2 works as the under-volt-age protector. The under-voltage setting isdone with the help of preset VR2 such thatT2 stops conducting when voltage is belowlower limit (say, 180V). Zener diodes ZD1and ZD2 provide base bias to transistors T1

and T2, respectively. Transistors T3 and T4are connected back to back to form an SCRconfiguration, which behaves as an ‘on’/‘off’ control. Switch S1 is used to turn onthe pump, while switch S2 is used to turnoff the pump.

While making over-/under-voltage set-ting, disconnect C2 temporarily. CapacitorC2 prevents relay chattering due to rapidvoltage fluctuations.

Regulator IC 7809 gives the 9V regu-lated supply to soft switch as well as therelay after filtering by capacitor C4. A suit-able miniature circuit breaker is used forautomatic over-current protection. Green

LED (LED1) indicates that the motor is‘on’ and red LED (LED2) indicates thatthe power is ‘on’. The motor is connectedto the normally-open contact of the relay.When the relay energises, the motor turnson.

Page 43: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

‘Y’, is summarised below:1. Player ‘X’ starts by momentary

pressing of reset switch S1 followed by pressing and releasing of either switch S2 or S3. Thereafter he presses switch S4 to read the display (score) and notes down this number (say X1) manually.

2. Player ‘Y’ also starts by momen-tary pressing of switch S1 followed by pressing of switch S2 or S3 and then notes down his score (say Y1), after pressing switch S4, exactly in the same fashion as done by the first player.

3. Player ‘X’ again presses switch S1 and repeats the steps shown in step 1

above and notes down his new score (say, X2). He adds up this score to his previous score. The same procedure is repeated by player ‘Y’ in his turn.

4. The game carries on until the score attained by one of the two players totals up to or exceeds 100, to be declared as the winner.

Several players can participate in this game, with each getting a chance to score during his own turn.

The circuit may be assembled using a multipurpose board. Fix the display (LEDs and 7-segment display) on top of the cabinet along with the three switches. The supply voltage for the circuit is 5V.

ElEctronic Scoring gamE

You 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 starting a fresh game, and for that matter even a fresh move, you must press switch S1 to reset the circuit. Thereafter, press any of the two switches, i.e. S2 or S3.

On pressing switch S2 or S3, the counter’s BCD outputs change very rapidly and when you release the switch, the last number remains latched at the output of IC2. The latched BCD number is input to BCD to 7-segment decoder/driver IC3 which drives a common- anode display DIS1. However, you can read this number only when you press switch S4.

The sequence of operations for playing the game between, say two players ‘X’ and

Page 44: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUMARCH 2003

S.C. DWIVEDI

This reliable and easy-to-operate elec-tronic security system can be usedin banks, factories, commercial es-

tablishments, houses, etc.The system comprises a monitoring sys-

tem and several sensing zones. Each sens-ing zone is provided with a closed-loopswitch known as sense switch. Senseswitches are fixed on the doors of premisesunder security and connected to the moni-toring system. As long as the doors areclosed, sense switches are also closed. Themonitoring system can be installed at aconvenient central place for easy operation.

Fig. 1 shows the monitoring circuitonly for zone 1 along with the commonalarm circuit. For other zones, themonitoring circuit is identical, with onlythe prefixes of components changingas per zone number. Encircled points A,B, and C of each zone monitoring circuitneed to be joined to the correspondingpoints of the alarm circuit (upper halfof Fig. 1).

When zone 1 sensing switch S11, zoneon/off slide switch S12, and system on/offswitch S1 are all on, pnp transistor T12reverse biases to go in cut-off condition,with its collector at around 0 volt. Whenthe door fitted with sensor switch S11 isopened, transistor T12 gets forward biasedand it conducts. Its collector voltage goeshigh, which forward biases transistor T10via resistor R10 to turn it on. (CapacitorC10 serves as a filter capacitor.) As a re-sult, the collector voltage of transistor T10falls to forward bias transistor T11, whichconducts and its collector voltage is sus-tained at a high level. Under this latchedcondition, sensor switch S11 and the stateof transistor T12 have no effect. In thisstate, red LED11 of the zone remains lit.

Simultaneously, the high-level voltagefrom the collector of transistor T11 via di-ode D10 is applied to V

DD pin 5 of sirensound generator IC1 (UM3561) whose pin2 is grounded. Resistor R3 connected acrosspins 7 and 8 of IC1 determines the fre-quency of the in-built oscillator. As a re-sult, IC1 starts generating the audio signaloutput at pin 3. The output voltage fromIC1 is further amplified by Darlington pairof transistors T1 and T2. The amplified

ELECTRONIC SECURITY SYSTEMK. BHARATHAN output of

t h eDarlingtonpair drivesthe loud-s p e a k e rwhose out-put volumecan be con-trolled bypotentiom-eter VR1.CapacitorC1 servesas a filtercapacitor.

Y o ucan alterthe alarmsound asdesired bychang ingthe con-nections ofIC1 asshown inthe table.

T h ecircuit con-tinues tosound thealarm untilzone door

is closed (to close switch S11) and thereset switch is pressed momentarily (whichcauses transistor T10 to cut off, returningthe circuit to its initial state).

Fig. 1: Monitoring circuit along with the alarm circuit

The system operates off a 3V DC bat-tery or recharging battery with chargingcircuit or battery eliminator. If desired,more operating zones can be added.

Fig. 2: Physical layout of sensors and monitoring/alarm system

Page 45: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU MARCH 2003

Alarm sound Circuit connections

IC pin 1 connected to IC pin 6 connected to

Police siren NC NCAmbulance siren NC VDD

Fire engine Sound NC VSS

Machinegun sound VSS NC

Note. NC indicates no connection

Initially keep the monitoring systemswitch S1 off. Keep all the zone doors fixedwith sensing switches S11, S21, S31, S41,etc closed. This keeps the sensing switches

for respectivezones in closedposition. Alsokeep zone slideswitches S12, S22,S32, S42, etc in‘on’ position. Thisputs the system inoperation, guard-ing all the zone

doors.Now, if the door of a particular zone

is opened, the monitoring system soundsan audible alarm and the LED correspond-

ing to the zone glows to indicate that thedoor of the zone is open. The alarm andthe LED indication will continue even af-ter that particular door with the sensingswitch is immediately closed, or even ifthat switch is removed/damaged or con-necting wire is cut open.

Any particular zone in the monitoringsystem can be put to operation or out ofoperation by switching on or switching offthe corresponding slide switch in the moni-toring system.

The circuit for monitoring four zonescosts around Rs 400.

Page 46: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUNOVEMBER 2004

Fig. 2: Receiver circuit

Fig. 3: Pin configurations ofTSOP1738 and UM66

S.C. DWIVEDIELECTRONIC WATCHDOG

H ere’s an electronic watchdog foryour house that sounds to informyou that somebody is at the gate.

TAPAN KUMAR MAHARANA

pillars of the gate such that the IRbeam gets interrupted when someoneis standing at the gate or passingthrough it.

The transmitter circuit (see Fig. 1)is built around timer NE555 (IC1),which is wired as an astablemultivibrator producing a frequency ofabout 38 kHz. The infrared (IR) beam

is transmitted through IR LED1.The receiver circuit is

shown in Fig. 2. It comprisesIR sensor TSOP1738 (IR RX1),npn transistor BC548 (T1),timer NE555 (IC2) and someresistors and capacitors. IC2 iswired as a monostablemultivibrator with a time pe-riod of around 30 seconds. Themelody generator section isbuilt around melody generatorIC UM66 (IC3), transistor T2and loudspeaker LS1. Fig. 3shows pin configurations of IRsensor TSOP1738 and melodygenerator IC UM66.

The power supply for the

Fig. 1: 38kHz IR transmitter circuit

The circuit comprisesa transmitter unit anda receiver unit, whichare mounted face toface on the opposite

Fig. 4: Mounting arrangement for transmitter and receiver units

and trigger pin 2 of IC2 remains high.When anyone interrupts the IR beam

falling on the sensor, its output goes highto drive transistor T1 into conduction andpin 2 of IC2 goes low momentarily. As aresult, IC2 gets triggered and its pin 3goes high to supply 3.3V to melody gen-erator IC3 at its pin 2, which produces asweet melody through the speaker fittedinside the house. Output pin 3 of IC2remains high for around 30 seconds.

Fig. 4 shows mounting arrangementfor both the transmitter and receiver unitson the gate pillars. To achieve a high di-rectivity of the IR beam towards the sen-sor, use a reflector behind the IR LED.

After both the units have been built,connect 6V power supply to the receivercircuit. You should hear a continuousmelody from the speaker. Now connect6V power to the transmitter also andorient IR LED1 towards IR receiver. The

transmitter is derived from the receivercircuit by connecting its points A and Bto the respective points of the receivercircuit. The receiver is powered by regu-lated 6V DC. For the purpose, you canuse a 6V battery.

The transmitter and receiver units arealigned such that the IR beam falls di-rectly on the IR sensor. As long as IRbeam falls on the sensor, its output re-mains low, transistor T1 does not conduct

Page 47: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU NOVEMBER 2004

melody should stop after about 30 sec-onds. Now the transmitter and the re-ceiver units are ready for use.

When somebody enters through the

door, the IR beam is interrupted and thealarm sounds for 30 seconds. The alarmkeeps sounding as long as one standsbetween the transmitter and receiver units.

Using preset VR1, you can set the volumeof the loudspeaker.

This circuit can also be used as a door-bell or burglar alarm.

Page 48: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 19196

FLUID LEVEL DETECTORHere 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 which is used here as a buffer/driver. The output of gate N2 is connected to opto-coupler MCT2E. The output across pins 4 and 5 of the opto-coupler can

be suitably interfaced to any external circuit for indication purposes or driving any load as desired.

Use of opto-coupler ensures complete isolation of the load from the fluid level

detector circuit. Since high frequency AC is used for the electrodes, there is no cor-rosion of the electrodes which is normally observed with DC being applied to the electrodes.

Page 49: Kumpulan skematik elektronika 3

circuitideas

108 • Dec em b er 2010 • electronics for you w w w . e f y m a g . c o m

Raj K. GoRKhali

GuitaR EffEct PEdal PowERs.c. dwivedi

connecting points as shown in Fig. 2. The circuit (Fig. 2) can be divided

into two sections: power supply and signal handling. The power supply section is built around transformer X1, regulators 7805 and 7905, bridge recti-fier comprising diodes D1 through D4, and a few discrete components. The signal-handling circuit is built around two OP27 op-amps (IC3 and IC4).

The power supply of about 9V for the effect pedals is derived from step-down transformer X1. MOV1 is a metal-oxide varistor that absorbs any large spike in mains power.

IC 7905 (IC1) is a -5V low-power regulator. By using a 3.9V zener diode (ZD1) at its ground terminal, you get -8.9V output. The same technique is also applied to IC 7805 (IC2)—a +5V regulator to get 8.9V. Use good-qual-ity components and heat-sinks for the

regulators. This supply is more than enough for the five effect pedals.

The greater the voltage drop across the regulator, the lower the output current potential. Resistors R1 and R2 provide a constant load to ensure that the regulators keep regulating. Capacitors C3 through C8 ensure that the supplies are as clean as possible. It is very important to use proper heat-sinks for IC1 and IC2. Otherwise, these could heat up.

Working of the circuit is simple. The input signal stage uses a basic differentiation amplifier to accept the incoming signal and a voltage fol-lower to buffer the output to the power amplifier. The differential amplifier is 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 combinat ion of resistor R7 and C13 serves as a passive low-pass filter, progressively attenuating unwanted high-frequency signals. The second op-amp (IC4)

Fig. 1: A typical guitar pedal switch

Fig. 2: Pedal power circuit

A friend of mine plays guitar with several guitar effect pedals. He had a problem with battery

eliminators and cables of the pedals cluttering the stage and so he asked for help. The solution is simple as de-scribed here.

A small box is fitted to the rear of the amplifier providing a 9V output for the effect pedal. The amplifier section

gets 9V through a pedal switch (refer Fig. 1). This power out-put and guitar s igna l input lines are com-bined into a single unit with multi-way cable

Page 50: Kumpulan skematik elektronika 3

circuitideas

electronics for you • December 2010 • 109w w w . e f y m a g . c o m

forms a simple voltage follower (its output follows its input), providing a low output impedance to drive into the standard power amplifier.

Assemble the circuit on a general-purpose PCB and fit it to the rear of an

amplifier. The unit must be compact, yet robust. So use a very sturdy alu-minium extrusion for the cabinet in or-der to neatly house the assembled PCB.

To ensure simple operation, there are only three connections to the unit.

First, mains power is tapped from the transformer. The second lead carries the 9V output to the amplifier. The third is the guitar signal input at the five-way socket for connection to the effect pedal.

Page 51: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 20

Handy Zener diode TesTer

Here is a handy zener diode tester which tests zener diodes with breakdown voltages extend-

ing up to 120 volts. The main advantage of this circuit is that it works with a volt-age as low as 6V DC and consumes less than 8 mA current.

The circuit can be fitted in a 9V battery box. Two-third of the box may be used for

four 1.5V batteries and the remaining one-third is sufficient for accommodating this circuit. In this circuit a commonly available transformer with 230V AC primary to 9-0-9V, 500mA secondary is used in reverse to achieve higher AC voltage across 230V AC terminals.

Transistor T1 (BC547) is configured as an oscillator and driver to obtain re-

quired AC voltage across transformer’s 230V AC terminals. This AC voltage is converted to DC by diode D1 and filter capacitor C2 and is used to test the zener diodes. R3 is used as a series current limiting resistor.

After assembling the circuit, check DC voltage across points A and B without con-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.

Page 52: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU DECEMBER 2004

SANI THEOHIT SWITCH

T his versatile hit switch is the elec-tronic equivalent of a conventionalswitch. It can be used to control

the switching of a variety of electronicdevices.

The circuit of the hit switch uses apiezoelectric diaphragm (piezobuzzer) asthe hit sensor. A piezoelectric material de-velops electric polarisation when strained

by an applied stress. The hit sensor makesuse of this property.

When you hit or knock the piezo ele-ment (hit plate) with your fingertip, a smallvoltage developed by the piezo element is

T.A. BABU

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 N1to high level and causes the bistable totoggle. The capacitor gets charged via re-sistor R1 and the circuit changes its state.This latch continues until the bistableswitch gets the next triggering input.

Every time the hit plate receives a hit,the voltage-control switch triggers thebistable circuit. That means every subse-quent hit at the sensor will toggle the stateof the switch. The red LED (LED1) con-nected at the output of gate N3 indicates

‘on’/‘off’ position ofthe switch. RelayRL1 is activated bythe hit switch to con-trol the connectedload.

The circuit worksoff 12V DC. It can beconstructed on anygeneral-purpose PCB.For the desired re-sults, proper connec-tions and installationof the hit sensor arenecessary. Removethe cover of the

piezobuzzer and connect its two leads tothe circuit. Mount the plate such that itreceives the hit properly. The piezoelectricmaterial on the plate can easily get dam-aged, so hit the switch gently.

amplified by transistor BC547 (T1). Thecombination of transistor T1 and the bridgerectifier comprising diodes D1 through D4acts as a voltage-control switch. The in-verter gates of IC CD4069 (IC1) togetherwith associated components form abistable switch.

IC CD4069 is a CMOS hex inverter.Out of the six available inverter gates, onlythree are used here. IC1 operates at anyvoltage between 3V and 15V and offers a

high immunity against noise. The recom-mended operating temperature range forthis IC is –55°C to 125°C. This device isintended for all general-purpose inverterapplications.

Page 53: Kumpulan skematik elektronika 3

ELECTRONICS PROJECTS Vol. 22 119

HOUSE SECURITY SYSTEM

MALAY BANERJEE

step-down transformers (X1 and X2), two6V relays (RL1 and RL2), an LDR, atransistor, and a few other passive com-ponents. When switches S1 and S2 areactivated, transformer X1, followed by afull-wave rectifier and smoothing capaci-tor C1, drives relay RL1 through thelaser switch.

The laser beam should be aimed con-tinuously on LDR. As long as the laserbeam falls on LDR, transistor T1 re-mains forward biased and relay RL1 isthus in de-energised condition. When aperson crosses the line of laser beam,relay RL1 turns on and transformer X2

gets power supply and RL2energises. In this condition,the laser beam will have noeffect on LDR and the alarmwill continue to operate as longas switch S2 is on.

When the torch is switchedon, the pointed laser beam isreflected from a definite point/place on the periphery of thehouse. Making use of a set ofproperly oriented mirrorsone can form an invisible netof laser rays as shown in theblock diagram. The final rayshould fall on LDR of thecircuit.

Note. LDR should be keptin a long pipe to protect it fromother sources of light, andits total distance from thesource may be kept limited to500 metres.

Here is a low-cost, invisible lasercircuit to protect your housefrom thieves or trespassers. A

laser pointer torch, which is easily avail-able in the market, can be used to oper-ate this device.

The block diagram of the unit shownin Fig. 1 depicts the overall arrange-ment for providing security to a house.A laser torch powered by 3V power-supply is used for generating a laserbeam. A combination of plain mirrors

M1 through M6 is used to direct thelaser beam around the house to form anet. The laser beam is directed to fi-nally fall on an LDR that forms part ofthe receiver unit as shown in Fig. 2.Any interruption of the beam by a thief/trespasser will result into energisationof the alarm. The 3V power-supply cir-cuit is a conventional full-wave recti-fier-filter circuit. Any alarm unit thatoperates on 230V AC can be connectedat the output.

The receiverunit comprisestwo identical

Page 54: Kumpulan skematik elektronika 3

CIRCUITIDEAS

1 0 0 • M A R C H 2 0 0 6 • E L E C T R O N I C S F O R Y O U W W W . E F Y M A G . C O M

CMYK

This circuit can be used to de-tect the presence of modulatedinfrared signals in its vicinity

from any electronic source, for in-stance, an IR handheld remote control-ler. It can also be used for testing IRburglar alarm systems.

Fig. 1 shows the circuit of the in-frared bug. Besides the power supply(one 9V PP3/6F22 compact batterypack), it consists of an infraredsignal detector-cum-preamplifierfollowed by a melody generatorand a tiny audio amplifier. The cir-

T.K. HAREENDRAN

INFRARED BUG S.C. DWIVEDI

T2. The amplified signal is fed to themelody generator via resistor R5. Theoutput of the melody generator is fedto LM386 low-power audio amplifier(IC2) via variable resistor VR1, which

works as the volume control.The loudspeaker sounds to in-dicate the presence of IR signalnear the circuit.

IC LM386 is wired as aminimum-parts amplifier witha voltage gain of ‘20,’ which issufficient for this application.Capacitor C3 is used fordecoupling of the positive railand the R-C combination net-work comprising C4 and R7bypasses high frequency toground.

The circuit can be easilywired on a small veroboard orany general-purpose PCB. Pinconfigurations of IC LM386,transistor BC547 and melodygenerator UM66 are shown inFig. 2. A miniature metalliccabinet may be used for enclos-ing the gadget.

cuit, in principle, con-verts the IR signal pulsetrains into noticeable au-ral notes.

S1 is used to switchon/off mains power andLED1 indicates power-‘on.’ Resistor R4 andzener diode ZD2 forma low-current voltagestabiliser for providingsteady 5.1V DC to the small signal-preamplifier circuit. IR LED1 is themain sensing element.

The IR signal detected by IR LED1is amplified by npn transistors T1 and

Fig. 1: Infrared bug

Fig. 2: Pin configurations of LM386, BC547/337 and UM66

Page 55: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOU JANUARY 2003

SUNIL KUMAR

Fig. 2: Proposed arrangement forseparation of IR LED and receiver modulein the proximity detector

Fig. 1: IR proximity detector

This proximity detector using aninfrared detector (Fig. 1) can beused in various equipment like au-

tomatic door openers and burglar alarms.The circuit primarily consists of an infra-red transmitter and an infrared receiver.

The transmitter section consists of a555 timer IC functioning in astable mode.It is wired as shown in the figure. Theoutput from astable is fed to an infraredLED via resistor R4, which limits its oper-ating current. This circuit provides a fre-quency output of 38 kHz at 50 per centduty cycle, which is required for the infra-red detector/receiver module. SiemensSFH5110-38 is a much better choice thanSFH506-38. Siemens SFH5110-38 is turnedon by a continuous frequency of 38 kHzwith 50 per cent duty cycle, whereasSFH506 requires a burst frequency of 38kto sense. Hence, SFH5110-38 is used.

INFRARED PROXIMITY DETECTORK.S. SANKAR Both the transmitter and the receiver

parts can be mounted on a single bread-board or PCB. The infrared receiver mustbe placed behind the infrared LED to avoidfalse indication due to infrared leakage.

An object moving nearby actuallyreflects the infrared rays emitted by theinfrared LED. The infrared receiver hassensitivity angle (lobe) of 0-60 degrees,hence when the reflected IR ray issensed, the mono in the receiver part istriggered. The output from the mono maybe used in any desired fashion. For ex-ample, it can be used to turn on alight when a person comes nearby byenergising a relay. The light would auto-matically turn off after some time as theperson moves away and the mono pulseperiod is over.

The sensitivity of the detector dependson current-limiting resistor R4 in serieswith the infrared LED. Range is approxi-mately 40 cm. For 20-ohm value of R4 the

object at 25 cm canbe sensed, while for30-ohm value of R4the sensing range re-duces by 22.5 cm.

(Note. The au-thor procured thesamples of Siemensproducts fromArihant Electricals,New Delhi, the dis-tributor of Siemensin India.)

This circuit costsaround Rs 125.

The receiver section comprises an in-frared receiver module, a 555 monostablemultivibrator, and an LED indicator. Uponreception of infrared signals, 555 timer(mono) turns on and remains on as longas infrared signals are received. When thesignals are interrupted, the mono goes offafter a few seconds (period=1.1 R7xC6)depending upon the value of R7-C6 com-bination. Thus if R7=470 kilo-ohms andC6=4.7µF, the mono period will be around2.5 seconds.

Page 56: Kumpulan skematik elektronika 3

C I R C U I T I D E A S

ELECTRONICS FOR YOUMAY 2003

S.C. DWIVEDI

This infrared remote control timer canbe used to turn an appliance on/offfor a period of 0.11 second to 110.0

seconds.The circuit comprises two sections,

namely, the transmitter section and thereceiver section.

Fig. 1 shows the IR transmitter sec-tion. The astable multivibrator NE555 (IC1)is used to generate a 10kHz modulated IRsignal. The output of IC1 is connected tothe base of pnp transistor T1 via resistorR2. Two infrared LEDs (IR1 and IR2) areconnected in series between the collector(via resistor R3) and ground.

When switch S1 is pressed, the IR LEDstransmit the modulated IR signal of 10-11kHz. This frequency can be changed withthe help of VR1 potmeter.

In the receiver section shown in Fig.2, two photodiodes (IR3 and IR4) receivethe IR signal transmitted by the IR trans-mitter. Transistors T2 and T3 amplify theweak signal. The amplified signal is fil-tered by capacitors C6 and C7. The ampli-fied and filtered signal is now fed to theinverting input pin 2 of op-amp IC2 (IC741). The output of IC2 is further con-nected to trigger pin 2 of timer NE555 (IC3)that is used as a monostable multivibrator

INFRARED REMOTE CONTROL TIMERDIPANJAN BHATTACHARJEE whose frequency may

be varied with the helpof potmeter VR3.

When switch S1 ofthe transmitter ispressed, the modu-lated IR rays are gen-erated, which are re-ceived by photodiodesin the receiver sectionand amplified by theamplifier circuit. Theoutput of op-amp goeslow to trigger themonostable. Then highoutput at pin 3 of IC3activates the two-changeover relay RLvia transistor T3(BC548) for a presettime.

The on/off timecan be set in the timerwith the help of VR3and C10. Switch S2 isused to reset themonostable. If youwant to turn the appli-ance on for a presettime, connect the ap-pliance via relay RL(a).On the other hand, if

you want toturn the appli-ance off for apreset time,connect the ap-pliance via re-lay RL(b). Thetimer can be re-set by pressingreset switch S2.

The circuitworks up to 3metres withoutusing any fo-cusing lens.However, youcan increasethe operatingrange by usingfocusing lens.

This circuitcosts aroundRs 100.Fig. 1: IR transmitter section

Fig. 2: IR receiver section