Magazines: AutoSpeed  |  V8X  |  Silicon Chip  Shopping: Property  |  Cars  |  Fishing
Email Address:
Password:

Lost your password?

Article Search

Circuit Notebook

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.

 Advertisement
Advertisement 

Automatic security lights

Combination PIR sensor and floodlight units are cheap but rather inflexible if you want to locate the sensor and light in different places. In my case, I wanted to detect movement on the driveway and switch on the lights in the carport around the corner. Yet another job for the ubiquitous PICAXE-08 microcontroller!

Click for larger image

A standard PIR sensor is used as the movement detector. The sensor interfaces to the PICAXE (IC1) on input 2 (pin 5). This pin is pulled low via isolation diode D3 and the normally open (NO) output of the sensor whenever movement is detected. It can also be pulled low by transistor Q1, which acts as a simple inverter for sensors with normally closed (NC) outputs.

So that the lights aren’t needlessly switched on during the day, a light-dependent resistor (LDR) is used as an ambient light sensor. Together with a 100kΩ resistor, the LDR forms a simple voltage divider, which converts its changing resistance to a changing voltage at the micro’s analog input (pin 6). As light falling on the sensor decreases, its resistance increases, resulting in less voltage at the analog input. Below a preprogrammed threshold voltage, it is assumed to be night-time.

When movement is detected, a program timer is started and the relay is energised via Q2, switching on the lights. If no further movement is detected, the lights will turn off after about 10 minutes. However, if movement is detected within this period, the timer is reset, extending the on period a further 10 minutes.

The on time is easily modified to suit your installation (see program listing).

As shown, power comes from a small 9VAC transformer, bridge rectifier (BR1) and a 2200μF filter capacitor. A 9V DC plugpack could also be used; just omit the transformer and BR1 and substitute a 100μF 25V capacitor for the 2200μF unit. A polarity protection diode (eg, 1N4004) in series with the positive plugpack input is also a good idea.

A 7805 low-power regulator provides a stable +5V supply for the PICAXE and associated circuitry. Note that a diode (D2) is included in series with the regulator output to reduce the supply voltage to about 4.4V, which improved system reliability in hot weather.

All 240VAC wiring should be properly terminated and insulated, and the project housed in a suitable plastic instrument case that is protected from the elements. Modifications to fixed mains wiring will require the services of a licensed electrician.

Jeff Monegal,
North Maclean, Qld. ($50)

' Security Lights Controller
' Jeff Monegal   18 May 2004

' PICAXE-08

symbol timer = w6			'used as a lights on timer

'-------------------------------------------------------------------------------------
' The value in the B0 register from the readadc command below may need to be
' changed to suit different types of LDR. Use the debug command to monitor
' the value given by your particular LDR. DonÂ’t forget to change the rest of
' the readadc values throughout the program.
'--------------------------------------------------------------------------------------

start:
  readadc 1,b0				'read the LDR
  debug b0				'look at the value given by your LDR
  if b0 < 140 then night_time		'if less than 140 then it is night time
  goto start

night_time:
  if input2 = 0 then detect		
  readadc 1,b0
  if b0 > 140 then maybe_daytime
  goto night_time

detect:
  pause 100				'short delay then look at the PIR again 
  to confirm if input2 = 0 then yes_detect 'a movement detection and not just noise
  goto night_time

yes_detect:
  timer = 0				'clear timer counter
  high 4					'turn on the lights

time_loop:
  readadc 1,b0
  if b0 > 140 then maybe_daytime
  timer = timer + 1			'add one to the time counter
  if timer > 3000 then time_out 		'change to suit your installation
  pause 100				'(3000 x 200mS = 600s)
  if input2 = 1 then time_loop
  pause 100				'short delay then look again for movement
  if input2 = 1 then time_loop
  timer = 0 				'reset timer if movement detected
  goto time_loop

time_out:
  low 4					'turn the lights off
  pause 3000				'3s before lights can be triggered again
  goto night_time

maybe_daytime:
  pause 2000
  readadc 1,b0
  if b0 > 140 then is_daytime
  goto night_time

is_daytime:
  low 4					'turn lights off in case they are on
  goto start

Op amp auto-zero

This auto-zero circuit was developed to simplify setting up an instrument with a large background signal that needed to be zeroed out. It uses two CA3140 op amps, which themselves could be trimmed out for a smaller final offset value if required (see device datasheet for more details).

Click for larger image

The input signal is applied to IC1, which is configured as an inverting buffer. When momentary switch S1 closes, IC1’s output voltage charges the low-leakage 1µF capacitor via the 10kΩ resistor. When S1 subsequently opens, this voltage (buffered by IC2) is subtracted from the input signal to IC1, thus zeroing the output.

If desired, IC1 could be followed by a second stage to restore the original signal polarity.

Switch S2 can be used to discharge the capacitor and cancel the zero. Switches S3 and S4 are included to allow fine adjustment of the output voltage. A smaller resistor (4.7MΩ) in the positive charge circuit versus the negative circuit (22MΩ) allows for finer control. Slower adjustment can be arranged by returning these resistors to a lower voltage.

Graham Jackman,
via email. ($30)

Synthetic floating negative inductor

Click for larger image

This circuit is a floating negative inductor using only two op amps. It obviates use of a GIC (General Impedance Converter), which would require more than four op amps for the same purpose. It requires two matched capacitors and three matched resistors. The relevant equations are as follows:

(1) i1 = (V1 - V3)/R;
(2) i2 = (V2 - V4)/R; and	
(3) (V2 - V4). Cs = (V3 - V1). Cs 
		         = (V1 - V2)/R
From (1), (2) and (3):
(4) V1 = -i1. CsR2  + V2
(5) i1 = - i2

   Comparing (4) and (5) with the 
transmission matrix:
V1 = A.V2 - B.i2
i1 = C.V2 - D.i2

Click for larger image
Click for larger image

Now -B is the short circuit transfer impedance, hence equivalent floating impedance is given by Z = -CR², which is equivalent to a negative inductor.

Saumitra Raj Mehrotra,
New Delhi, India. ($30)

Plugpack checker

This simple circuit lets you quickly determine the relative amount of ripple from a DC plugpack. Two test currents are selectable via toggle switch S1. For the 120Ω and 47Ω resistor values shown, this corresponds to 100mA and 250mA of load current when testing 12V plugpacks.

A good-quality 12V plugpack will measure up to about 100mV ripple with a 250mA load. Up to 200mV ripple may be regarded as good, while a budget plugpack may measure up to 500mV. Anything above this can be considered abysmal.

The circuit uses no voltage regulation or supply decoupling to suppress ripple. Therefore, a fraction of the ripple from the power supply appears at the non-inverting input (pin 3) of the op amp (IC1) via the 500kΩ pot (VR1).

Click for larger image

In contrast, the voltage at the op amp’s inverting input (pin 2) is filtered via two low-pass filters, consisting of the two 470kΩ resistors, 100kW potentiometer VR1, a 1MΩ resistor and two 100nF capacitors, which effectively removes most of the ripple.

When the voltage at the inverting input dips below that of the non-inverting input, the op amp’s output swings towards the positive rail, illuminating LED1. The 100kW potentiometer (VR1) acts as a sensitivity adjustment, allowing you to dial up the amount of ripple present before LED1 illuminates. This makes it possible (with a calibrated dial) to determine just how much ripple a plugpack is generating.

Since the two 100nF filter capacitors are initially discharged, LED1 immediately illuminates when a plugpack is connected, then fades (within two seconds) if the ripple rating is within the selected margin. LED2 provides a simple "voltage present" indication.

IC1 has a limited voltage swing at its output, so D1 is included in series to prevent the LED from glowing when it should be off. Bridge rectifier BR1 ensures that the checker works regardless of input polarity.

Before use, the circuit must be calibrated to suit a particular input voltage. We chose 12V, as most (adjustable) plugpacks have a 12V maximum setting. However, the Plugpack Checker may also be calibrated for use with other voltages between about 5.6V and 18.6V.

Initially, turn VR1 fully anti-clockwise (wiper towards 0V) and then connect a 12V battery or other well-regulated (no ripple) 12V DC source. LED2 should illuminate immediately and LED1 may illuminate only briefly, or it may stay illuminated. If it stays illuminated, turn VR2 anti-clockwise (wiper towards 0V) until it just extinguishes, otherwise turn it clockwise until it just illuminates.

With the circuit values shown, you should be able to measure approximately 0-1000mV of ripple. For greater sensitivity but reduced range, the value of VR1 can be scaled downwards. For example, to measure approximately 0-200mV, use a 20kΩ pot instead.

Thomas Scarborough,
South Africa. ($40)

Click for larger image

Contribute and Win!

As you can see, we pay good money for each of the "Circuit Notebook" contributions published in SILICON CHIP. But there’s an even better reason to send in your circuit idea: each month, the best contribution published will win a superb Peak Atlas LCR Meter valued at $195.00.

So don’t keep that brilliant circuit secret any more: sketch it out, write a brief description and send it to SILICON CHIP and you could be a winner!

The following downloads are available for this article:

 RSS  |  Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2008 Silicon Chip Publications Pty Ltd & Web Publications Pty Limited. All Rights Reserved