Tuesday, May 13, 2008

PC-Based Oscilloscope

This circuit conditions different signals of frequency below 1 kHz and displays their waveforms on the PC’s screen. The hardware is used to condition the input waveform and convert it to the digital format for interfacing to the PC. The software for acquiring the data into the PC and displaying the same on its screen is written in Turbo C.
The input waveform (limited to 5V peak-to-peak) is first applied to a full-wave rectifier comprising op-amps A1 and A2 of quad op-amp LM324 (IC4) and a zero crossing detector built around LM3914 dot/ bar display driver (IC8) simultaneously.
The full-wave rectifier rectifies the input signal such that the negative half cycle of the input signal is available in the positive side itself, so both the half cycles are read as positive when it is given as input to the ADC. During positive half cycle, diode D3 is on and diode D4 is off, and op-amps A1 and A2 act as inverters. Thus the output is a replica of the input. During the negative half cycle, diode D3 is off and diode D4 is on. With R2=R3=R4=R5=R6=R=330 ohms, the voltage (V) at inverting pin 2 of op-amp A1 is related to the input voltage (Vi) as follows:

Vi/R +V/(2R)+V/R=0

V= - (2/3)Vi

The final output voltage (Vo) at pin 7 of op-amp A2 is given by the following relationship:

Vo=(1+R/2R)(-2Vi/3)= -Vi

As Vi is negative, the output voltage is positive.

The zero-crossing detector detects whether the cycle is positive or negative. It is the most critical part of the circuit and if it operates improperly, the symmetry of the analogue signal displayed in the PC monitor gets affected. At the zero-crossing instant when the input signal transits to negative side, the zero-crossing detector informs the PC by taking pin 15 of 25- pin ‘D’ connector of the parallel port high.
The input at pin 15 of ‘D’ connector goes low when the input signal transits to positive side. The zero-crossing detector communicates with the PC through bit D3 of the status port 379Hex.
The zero-crossing detector has been realised using LM3914 IC. You may adjust VR1 such that the last LED (LED10) goes off when the input signal transits negative side of the input waveform. The LM3914 itself rectifies the input signal and allows only positive half of the cycle.

The output from the full-wave rectifier is applied to the input of a sample-and-hold circuit comprising op-amps A3 and A4 of the LM324 (IC5), capacitor C3, transistor T1 (SL100), and analogue switch IC6 (CD4016). This circuit samples the input signal, i.e. it divides the waveform into a number of voltages or points and inputs each voltage level (with a delay) to the ADC for conversion into the digital format. Op-amps A3 and A4, along with a switch from IC CD4016 and a 1500pF capacitor with sampling time of 20 μs, are used as voltage followers/buffers.
When the base of transistor T1 is made low via strobe pin 1 (bit Do of I/O port 37A) of 25-pin D connector of the parallel port, the transistor stops conducting and the voltage at its collector goes high. The high voltage at the collector of transistor T1 closes the switch inside CD4016. As a consequence, the analogue input signal is applied to the capacitor, which charges towards the signal voltage.
When the switch is subsequently opened by applying a logic-high voltage from pin 1 of ‘D’ connector to the base of transistor T1, the capacitor retains the voltage with a loss of about 20 mV/sec and this voltage is given to input pin 6 of the ADC0804 (IC3) via buffer A4 for conversion to the digital format. When the number of sampling points in the input signal waveform is increased, the reconstructed waveform becomes more accurate.
The ADC0804 is compatible with microprocessors. It is a 20-pin IC that works with 5V supply. It converts the analogue input voltage to 8-bit digital output. The data bus is tristate buffered. With eight bits, the resolution is 5V/255 = 19.6 mV.
The inbuilt clock generator circuit produces a frequency of about 640 kHz with R1=10 kilo-ohms and C4=150 pF, which are the externally connected timing components. The conversion time obtained is approximately 100 μs. The functions of other pins are given below:

Pin 1 (CS): This is activelow chip-select pin.

Pin 2 (RD): This active-low pin enables the digital output buffers. When high, the 8-bit bus will be in Hi-Z state.

Pin 3 (WR): This active-low pin is used to start the conversion.

Pin 9 (Vref/2): This is optional input pin. It is used only when the input signal range is small. When pin 9 is at 2V, the range is 0-4V, i.e. twice the voltage at pin 9.

Pin 6 (V+), Pin 7(V-): The actual input is the difference in voltages applied to these pins. The analogue input can range from 0 to 5V.

In this circuit, pins 1 and 2 are always made low, so the IC and the buses are always enabled. Pin 9 is made open, as we use analogue input with 0-5V range.

Pin 7 is grounded.

Pin 5 (INTR): This active-low pin indicates the end of conversion. It is connected to pin 17 (bit D3 of I/O port 37A) of ‘D’ connector. (Note that this bit is inverted.)

The start-of-conversion command via pin 16 of ‘D’ connector is applied to pin 3 of the ADC0804. Since we cannot read 8- bit digital data output from ADC through the 4-bit status port at a time, we divide it in two 4-bit parts and read. Hence the ADC data output is multiplexed through two 4-bit sections of octal buffers of IC1 (74244) with the help of output-enable signals from pins 2 and 9 of ‘D’ connector to pins 1 and 19 (OE1 and OE2, respectively) of IC1. The digital data output from IC1 is interfaced to the PC via pins 13 (D4), 12(D5), 10 (D6), and 11 (D7) of status input port 379H of ‘D’ connector.

The circuit uses 9V and 5V regulated DC supply voltages as shown in the circuit diagram.
A PC printer port is an inexpensive platform for implementing low-frequency data acquisition projects. Each printer port consists of data, status, and control port addresses. These addresses are in sequential order; for example, if the data port address is 0x0378, the corresponding status port address is 0x0379 and the control port address is 0x037a. The port addresses for parallel ports are summarized below:


The software, written in C programming language, is user-friendly and easyto-understand. It gets data from the developed hardware circuit and displays it in the graphical screen with some changes.

The C program includes two user-defined functions with the main function: graphics( ) and settings( ). The settings( ) function is used to adjust the voltage and time scale. The graphics( ) function is used to display the waveform on the screen. The sample control signal is used to close the switch in the sample-and-hold circuit, so the capacitor charges towards the analogue input voltage. After the sampling is over, the switch is opened using the same signal. Then the start-of-conversion control signal is given to start the conversion. The sampling time is approximately 20 μs and the conversion time is approximately 100 μs.
After the conversion is over, the 8-bit binary data for the specific voltage sample is available in the data bus of the ADC. Since the PC accepts only 4-bit data through the status port (379H), the 8-bit data must be split into two 4-bit data, which are accepted one after another. This is done by IC 74244, which is controlled by D0 and D7 bits of the data port. Then the two 4-bit data are packed to get the final 8-bit data.

The default BGI directory path is set as ‘c:\tc\bgi’. The sampling time is decided by the ‘for’ loop that uses the samp value. The maximum delay produced should be greater than 20 μs, which is the maximum acquisition time of the capacitor. When the sample value is increased, the number of points on the input signal decreases and therefore the accuracy decreases. The time scale may be calibrated with 50Hz sine wave as reference.

Fuse Monitor

A simple way to see if a fuse has blown without removing it from its holder.Its not often you can design a circuit using just two components, but with just one resistor and an LED this circuit provides visual indication of when a fuse has blown. LED 1 is normally not lit, being "short - circuited" by the fuse, F1. Note that the LED will only light under fault conditions, i.e. a short circuit or shunt on the load. In this case the supply current is reduced to a safe level by R1.

Under-/Over-Voltage Beep For Manual Stabiliser

Manual stabilisers are still popular because of their simple construction, low cost, and high reliability due to the absence of any relays while covering a wide range of mains AC voltages compared to that handled by automatic voltage stabilisers. These are used mostly in homes and in business centres for loads such as lighting, TV, and fridge, voltage fluctuates between very low (during peak hours) and abnormally high (during non-peak hours). Some manual stabilisers available in the market incorporate the high-voltage auto-cut-off facility to turn off the load when the output voltage of manual stabiliser exceeds a certain preset high voltage limit. The output voltage may become high due to the rise in AC mains voltage or due to improper selection by the rotary switch on manual stabiliser.
One of the major disadvantage of using a manual stabiliser in areas with a wide range of voltage fluctuations is that one has to keep a watch on the manual stabiliser’s output voltage that is displayed on a voltmeter and keep changing the same using its rotary switch. Or else, the output voltage may reach the preset auto cuttoff limit to switch off the load without the user’s knowledge. To turn on the load again, one has to readjust the stabiliser voltage using its rotary switch. Such operation is very irritating and inconvenient for the user.
This under-/over-voltage audio alarm circuit designed as an add-on circuit for the existing manual stabilisers overcomes the above problem. Whenever the stabiliser’s output voltage falls below a preset low-level voltage or rises above a preset high-level voltage, it produces different beep sounds for ‘high’ and ‘low’ voltage levels—short-duration beeps with short intervals between successive beeps for ‘high’ voltage level and slightly longerduration beeps with longer interval between successive beeps for ‘low’ voltage level. By using these two different types of beep sounds one can readily readjust the stabiliser’s AC voltage output with the help of the rotary switch. There is no need of frequently checking voltmeter reading.

It is advisable to preset the high-level voltage 10V to 20V less than the required high-voltage limit for auto-cut-off operation. Similarly, for low level one may preset low-level AC voltage 20V to 30V above minimum operating voltage for a given load.
The primary winding terminals of step-down transformer X1 are connected to the output terminals of the manual stabiliser. Thus, 9V DC available across capacitor C1 will vary in accordance with the voltage available at the output terminals of the manual stabiliser, which is used to sense high or low voltage in this circuit. Transistor T1 in conjunction with zener diode ZD1 and preset VR1 is used to sense and adjust the high-voltage level for beep indication. Similarly, transistor T2 along with zener ZD2 and preset VR2 is used to sense and adjust low voltage level for beep indication.
When the DC voltage across capacitor C1 rises above the preset high-level voltage or falls below the preset low-level voltage, the collector of transistor T2 becomes high due to non-conduction of transistor T2, in either case. However, if the DC voltage sampled across C1 is within the preset high- and low-level voltage, transistor T2 conducts and its collector voltage gets pulled to the ground level. These changes in the collector voltage of transistor T2 are used to start or stop oscillations in the astable multivibrator circuit that is built around transistors T3 and T4. The collector of transistor T4 is connected to the base of buzzer driver transistor T5 through resistor R8. Thus when the collector voltage of transistor T4 goes high, the buzzer sounds. Preset VR3 is used to control the volume of buzzer sound.
In normal condition, the DC voltage sampled across capacitor C1 is within the permissible window voltage zone. The base of transistor T3 is pulled low due to conduction of diode D2 and transistor T2. As a result, capacitor C2 is discharged. The astable multivibrator stops oscillating and transistor T4 starts conducting because transistor T3 is in cut-off state. No beep sound is heard in the buzzer due to conduction of transistor T4 and non-conduction of transistor T5.

When the DC voltage across capacitor C1 goes above or below the window voltage level, transistor T2 is cut off. Its collector voltage goes high and diode D2 stops conducting. Thus there is no discharge path for capacitor C2 through diode D2. The astable multivibrator starts oscillating. The time period for which the beep is heard and the time interval between two successive beeps are achieved with the help of the DC supply voltage, which is low during low-level voltage sampling and high during high-level voltage sampling. The time taken for charging capacitors C2 and C3 is less when the DC voltage is high and slightly greater when the DC voltage is low for astable multivibrator operation. Thus during lowlevel voltage sensing the buzzer beeps for longer duration with longer interval between successive beeps compared to that during high-voltage level sensing.

This circuit can be added to any existing stabiliser (automatic or manual) or UPS to monitor its performance.

Telephone Ring Generator

This ring generator will ring a telephone once every 10 seconds. The interval between rings can be lengthened or shortened by varying the value of the 1 Meg resistor. The 70 volt/30 Hz ring voltage is produced from the 120 volt side of a small 12.6 V AC power transformer. Both capacitors connected across the transformer windings are non-polarized 100 volts. Circuit draws about 300mA from the 12 volt DC power supply during the ringing interval.

Telephone Audio Interface

Audio from a telephone line can be obtained using a transformer and capacitor to isolate the line from external equipment. A non-polarized capacitor is placed in series with the transformer line connection to prevent DC current from flowing in the transformer winding which may prevent the line from returning to the on-hook state. The capacitor should have a voltage rating above the peak ring voltage of 90 volts plus the on-hook voltage of 48 volts, or 138 volts total. This was measured locally and may vary with location, a 400 volt or more rating is recommended. Audio level from the transformer is about 100 millivolts which can be connected to a high impedance amplifier or tape recorder input. The 3 transistor amplifier shown above can also be used. For over voltage protection, two diodes are connected across the transformer secondary to limit the audio signal to 700 millivolts peak during the ringing signal. The diodes can be most any silicon type (1N400X / 1N4148 / 1N914 or other). The 620 ohm resistor serves to reduce loading of the line if the output is connected to a very low impedance.

Powerful AM Radio Transmitter


The circuit for a powerful AM transmitter using ceramic resonator/filter of 3.587 MHz is presented here. Resonators/filters of other frequencies such as 5.5 MHz, 7 MHz and 10.7 MHz may also be used. Use of different frequency filters/resonators will involve corresponding variation in the value of inductor used in the tank circuit of oscillator connected at the collector of transistor T1. The AF input for modulation is inserted in series with emitter of transistor T1 (and resistor R4) using a transistor radio type audio driver transformer as shown in the circuit.
Modulated RF output is developed across the tank circuit which can be tuned to resonance frequency of the filter/resonator with the help of gang condenser C7. The next two stages formed using low-noise RF transistors BF495 are, in fact, connected in parallel for amplification of modulated signal coupled from collector of transistor T1 to bases of transistors T2 and T3. The combined output from collectors of T2 and T3 is fed
to antenna via 100pF capacitor C4.
The circuit can be easily assembled on a general-purpose PCB. The range of the transmitter is expected to be one to two kilometers. The circuit requires regulated 9- volt power supply for its operation. Note: Dotted lined indicates additional connection if a 3-pin filter is used in place.

LED 12 Volt Lead Acid Battery Meter


In the circuit below, a quad voltage comparator (LM339) is used as a simple bar graph meter to indicate the charge condition of a 12 volt, lead acid battery. A 5 volt reference voltage is connected to each of the (+) inputs of the four comparators and the (-) inputs are connected to successive points along a voltage divider. The LEDs will illuminate when the voltage at the negative (-) input exceeds the reference voltage. Calibration can be done by adjusting the 2K potentiometer so that all four LEDs illuminate when the battery voltage is 12.7 volts, indicating full charge with no load on the battery. At 11.7 volts, the LEDs should be off indicating a dead battery. Each LED represents an approximate 25% change in charge condition or 300 millivolts, so that 3 LEDs indicate 75%, 2 LEDs indicate 50%, etc. The actual voltages will depend on temperature conditions and battery type, wet cell, gel cell etc.