Email Address:

Lost your password?

This is the legacy website; please use the new website.

Circuit Notebook

(1) Automatic Headlight Switch; (2) Simple Universal PIC Programmer; (3) Bat Detector Picks Up Ultra Sound; (4) Junkbox-Parts Over Timer.

Interesting circuit ideas which we have checked but not built and tested. Contributions from readers are welcome and will be paid for at standard rates.

Automatic headlight switch

Click for larger image
This circuit will switch on your car's headlights at a presettable ambient light level. It has a delayed switch-on time of about 15 seconds so that the headlights don't switch on unnecessarily when driving under trees, overpasses, etc.

The circuit is based on a 555 monostable timer circuit which is triggered by a decrease in light level. Power is applied permanently to the circuit from the 12V battery but the circuit is disabled by the relay contacts which pull pin 2 high. When the 12V relay is energised (when the ignition is turned on), the relay contacts open and the voltage at pin 2 is now set by the voltage divider comprising the light dependent resistor (LDR1), resistor R1 and trimpot VR2.

Sudden changes in this voltage are impossible due to the 470μF capacitor C1, connected across LDR1. It eliminates sensitivity to sudden changes in light level. However, once the light level drops, the resistance of LDR1 increases and so the voltage at pin 2 drops and triggers the timing circuit. At the same time, the base of Q1 is pulled low and this discharges the timing capacitor, C3.

The pin 3 output of IC1 now goes high to turn on Q2 which drives the headlamp and parking lights relays. Q2 remains on while capacitor C3 charges towards +12V via resistor R2 and the delay trimpot VR1. VR1 sets the on-time for a period of up to two minutes. However, if the light level stays low, Q1 holds C3 in the discharged state and the lights stay on.

The 2-minute delay time avoids any erratic switching of the headlights due to street lights and also allows the headlights to stay for a short time after you turn off the engine.

Rick Goodwin,
Moonah, Tas. ($35)

Simple universal PIC programmer

This simple programmer will accept any device that's supported by software (eg, IC-Prog 1.05 by Bonny Gijzen at

Click for larger image
The circuit is based in part on the ISP header described in the SILICON CHIP "PIC Testbed" project but also features an external programming voltage supply for laptops and for other situations where the voltage present on the RS232 port is insufficient. This is done using 3-terminal regulators REG1 & REG2.

The PIC to be programmed can be mounted on a protoboard. This makes complex socket wiring to support multiple devices unnecessary. 16F84A, 12C509, 16C765 and other devices have all been used successfully with this device.

Luke Weston,
Wycheproof, Vic. ($30)

Note: this simple circuit will not work with older laptop computers that use low voltage (5V) RS-232 signals.

Bat detector picks up ultrasound

It is well known that bats use ultrasound for navigation and the location of prey. Typically, bats emit rapid bursts of ultrasound in the region of 15-200kHz (ie, beyond the range of human hearing), with wide variations in frequency, depending on the species.

This bat detector is a highly sensitive circuit that "hears" bats in the range of about 20-80kHz. Although this doesn't cover the full range of sounds that many bats emit, it is more than sufficient to detect the average bat at a range of tens of metres.

In operation, the circuit uses an array of LEDs to give a visual indication of a bat's presence, instead of reproducing the audio at a lower frequency. This has two advantages: (1) the absence of headphones
enables you to hear sounds that would otherwise be obscured - eg, the flutter of a bat's wings or the lowest frequencies which a bat emits (sometimes audible as high-frequency, "scratchy" sounds); and (2) it effectively eliminates low frequency sounds (such as hands holding the detector), which can be the bane of budget bat detectors.

The ultrasound is picked up with a standard 40kHz ultrasonic transducer. This transducer is effective up to about 80kHz, although its sensitivity drops off either side of 40kHz. A quality piezo transducer could also be used here but note that this will only be effective up to about 50kHz (if that).

Click for larger image

Op amps IC1b-IC1d are wired as a very high gain preamplifier, amplifying the signal millions of times. This produces sufficient signal amplitude at pin 14 of IC1d to directly clock decade counter IC2 (4017).

IC2 is reset at regular intervals by op amp IC1a which is wired as an oscillator. This resets IC2 at about one tenth the rate of the highest detected frequency. Therefore if, for an example, a 30kHz signal is received, IC2 might only sequence two or three LEDs before being reset. By contrast, if an 80kHz signal is received, IC2 will sequence all the LEDs.

This technique thus provides a visual indication of the received frequency. Note that ultrabright LEDs are recommended for LEDs
1-6, since the LEDs have only a 10% duty cycle.

In use, trimpots VR1 (frequency adjust) and VR2 (gain) are initially both set to mid-position. These may then be further adjusted later on, as required.

Once the circuit has been built, switch on and rub your hands together near the ultrasonic transducer. This should light at least one (and perhaps all) of the LEDs. If the circuit is functioning correctly, it should respond to your hands being rubbed together at a 1-metre distance.

If VR1 is set so that IC1a operates at 10kHz, LEDs 1-6 will represent 20-80kHz in 10kHz increments. At least, that's the theory - in practice, IC1a is adjusted using VR1 so that the LEDs match the range of the transducer that's been used.

Besides being used as a Bat Detector, the circuit could also be used as a simple tool to indicate frequency, to find tyre punctures (which emit ultrasound), and to detect other creatures which emit ultrasound (such as certain insects). And at its lowest frequency setting, it could even be used as a simple frequency-to-light convertor, with the LEDs dancing to nearby music.

Thomas Scarborough,
Cape Town, South Africa.

Junkbox-parts oven timer

The motivation for this project came when the timer on our oven failed for the second time. It uses parts that were mostly scrounged from my junkbox.

The resulting timer is very user friendly. You simply dial in the required timing interval in minutes using rotary switches S2 (units) and S3 (tens) and then hit the start switch (S1). Any time up to 99 minutes can be selected.

When S1 is turned on, the display LEDs light, initially indicating "00" and then advancing "01", "02", . . . , "09", "10", "11", etc until the selected timing interval has been reached. The timer then stops counting and sounds a buzzer until the start switch is turned off.

The indicator LEDs can be arranged in semicircular fashion around the switches (ie, one LED at each switch position), thus giving a very effective display. This was much simpler than using a digital readout.

The circuit itself is based on four low-cost CMOS ICs. IC1, is a 4060 14-stage binary counter/divider/oscillator. It's set up to produce a positive-going pulse at its pin 3 output (O13) every minute, as set by the timing components on pins 9, 10 & 11. This means that O13 must have a period of two minutes - ie, it will be low for the first minute and then go high for the next minute. This high-going pulse is then applied back to IC1's reset pin (pin 12) via AND gate IC4b and diode D3. The counter thus restarts and begins counting the next minute interval and so on.

Click for larger image

The period of oscillation is approximately 2.2RC where R is the resistance connected to pin 10 of IC1 (27kΩ, VR1 & VR2) and C is the capacitance on pin 9. VR1 and VR2 provide coarse and fine adjustment of the oscillator frequency, respectively.

IC2 & IC3 are two 4017 decade counters, each having 10 outputs (O0, O1, O2 and so on up to O9). Only one output of each counter will be high at any one time. The counters are reset by taking their pin 15 (MR) inputs momentarily high and this takes the O0 outputs of each counter high. These outputs in turn drive LEDs 1 & 11 and this indicates zero or "00" (the initial state of the counting process).

Each positive-going pulse on pin 14 (CP0) of IC1 advances the count by one, with LEDs 2-10 turning on in sequence to indicate the number of elapsed minutes. When nine pulses have been counted, LED10 will be on. The tenth pulse then resets IC2 (ie O0 goes high and turns on LED1). In addition, IC1's carry out pin (pin 12) goes from low to high and this clocks IC3. As a result, IC3 counts in tens on minutes while IC2 counts the units.

By using the 1-minute pulses from IC1 to clock IC2, the two counters are capable of recording the elapsed time up to 99 minutes, after which both counters are reset to zero and the count restarted.

Both counters can be halted at any time by taking their enable pins (pin 13) high. If this is done, the counter outputs will remain locked at the prevailing count at the time of receiving the disable signal.

As well as driving LEDs 1-9, IC2's outputs are also connected to S2, a single-pole 10-position rotary switch. Similarly, IC3's outputs are connected to rotary switch S3. The wipers of S2 and S3 connect to AND gate IC4a and when both inputs to this gate are high, its pin 3 output goes high and disables the counters.

At the same time, the output of IC4d (pin 11) goes high and turns on transistor Q1 to sound the buzzer. The counters then remain locked in this count position and the alarm continues to sound until the start switch, S1, is turned off.

Because the 4017 ICs can only source a small amount of current, special low-current LEDs must be used. The types used in the prototype were from RS Components, stock number 590-547. These operate with just 2mA of current, with a maximum forward current of 7mA.

Power for the circuit comes from a 9V DC plugpack. Note that the start switch is placed after the 1000μF reservoir capacitor. This prevents the buzzer from making an awful "dying noise" as the capacitor discharges when the timer is switched off.

Jack Holliday,
Nathan, Qld. ($50)

Share this Article: 

Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2021 Silicon Chip Publications Pty Ltd All Rights Reserved