Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
fizgig
PostPosted: Mar 22, 2012 - 04:54 PM
Hangaround


Joined: May 03, 2005
Posts: 275
Location: Windsor, CA

So I have a fairly simple doorbell system. It has an AC transformer that supplies about 12.5VAC to the doorbell circuit. One of the 12.5V wires between the transformer and the chimes is interrupted by a an illuminated pushbutton.

The button has an incandescent light in parallel with a switch. This light allows some voltage through to the chimes at all times - about 0.25VAC at the chime terminals. When you push the button, the full 12.5VAC is sent to the chimes causing the ring.

My dilema is trying to find a simple way to sense the pressing of that button. I have easy access to the transformer but I can't think of anything I can do there except have a current transformer ring around one of the wires to sense the power burst. It would be a lot harder to do something at the doorbell or chime end (drywall work).

Is there any clever trick I can implement near the transformer that will allow me t sense the press with a GPIO pin?
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Mar 22, 2012 - 05:09 PM
Moderator


Joined: Jan 23, 2004
Posts: 9832
Location: Trondheim, Norway

Wouldn't a diode and comparator give you 0V when not pressed, and (12.5 - ~.6)V DC when pressed? You can then level-translate that with a simple voltage divider so that it gives you a 0-5V square wave @50Hz/60Hz to the micro.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
DocJC
PostPosted: Mar 22, 2012 - 05:54 PM
Raving lunatic


Joined: Dec 11, 2007
Posts: 6853
Location: Cleveland, OH

Interesting question.
If you only have access to the transformer then as you mentioned sensing the current drawn by the bulb and chime vs that drawn by the chime alone would seem to be a reasonable approach.

It would be good to put an AC ammeter in series with the transformer to measure the two currents and see by how much they differ.

You'd like them to differ by a lot, obviously, as the ABSOLUTE current measurements will vary with the actually 120 VAC level, which can change with "brown outs", and other transients on the power line.

You might try something along this line, totally untested Smile , and somewhat conceptual in nature:

You insert R1 in series with the transformer lead to use as a current sense resistor. The value depends upon the current measurements made above, but perhaps 5 - 10 ohms, in a suitable power rating.

R2 & R3 form a voltage divider to drop the high side voltage down to the 0-5 V range tolerated by an AVR.

D1 rectifies the input sin to give you just the positive peaks going to the R1, R2 divider.

C1 filters it a bit.

V3 represents the transformer's output voltage, and the high side voltage of the current sense resistor.

R4 and R5 match R1 and R2, again with a diode and cap.

V4 will be a little bit lower than V3 because of the voltage drop across R1, the sense resistor.

Both V3 and V4 are low level, "DC" voltages.

One can now measure both V3 and V4 and hence one knows the voltage across the resistor, and hence the current through the resistor, and hence which load is currently being seen by the circuit.

Note that Mega's, at least the one's I've used, do NOT have a true differential ADC input mode, IIRC. But one can easily measure both V3 and V4 with two ADC inputs, each measured with respect to ground, and then one knows the differential voltage.

One could also feed V3 and V4 into an op-amp to amplifiy the small differential voltage, and feed it into a single ADC input, or into an analog comparator input.

R5 was made a pot in the schematic, as one can then tweak the low side leg a bit. This adjusts for differences in the resistors, and sets what the baseline difference voltage measurement will be.

Watch the power rating on R1. The lower its value the less power it has to dissipate, but the smaller will be the difference voltage you are measuring between the two load states.

Watch what you call ground for the circuit.

If you use a clamp on current sensor then these concerns vanish, but I thought I throw this out there as an alternative approach, which you might be able to do totally with parts on hand.

JC
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Chris-Mouse
PostPosted: Mar 22, 2012 - 06:07 PM
Hangaround


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada

How much current is drawn by the chime when it's operating? If it's relatively small, put a small, low voltage lightbulb in series with the chime, and put the bulb inside a light tight container alongside your favorite type of photodetector. At low currents, the bulb will not light, at high currents it lights, and the photodetector sends a signal to the GPIO pin.
The requirements for the bulb would be an operating current equal to or slightly above the operating current of the chime, and a voltage rating low enough that the bulb does not reduce the voltage across the chime too much.
 
 View user's profile Send private message  
Reply with quote Back to top
Kun.io
PostPosted: Mar 22, 2012 - 06:32 PM
Hangaround


Joined: Feb 09, 2012
Posts: 223


Those current sensors for Arduino are a very simple and cheap solution. Search Ebay for "acs712".
 
 View user's profile Send private message  
Reply with quote Back to top
jgmdesign
PostPosted: Mar 22, 2012 - 07:34 PM
Raving lunatic


Joined: Apr 20, 2007
Posts: 6072
Location: Long Island New York

Why not put a simple optoisolator accross the switch? The LED inside the opto will turn on when the button is open causing the transistor output to go low(if it is a transistor output opto). And the collector will float when the button is pushed.

Cannot get any simpler.

Parts:
One optoisolator NPN Transistor output(digikey has thousands)
One LED series resistor(dont want to blow up the new opto)
One Collector resistor


connect the emitter to ground the collector to Vcc through the resistor. Collector to AVR pin

Connect resistor to anode of opto LED, connect cathode and resistor accross the doorbell button

Done!!

EDIT: Put the LED cathode and resistor at the chime. Better spot to get a true read!

DONE AGAIN!!

Had to put a schematic in:

_________________
Jim

I have decided that I am no longer going to plan anything in advance. In a court of law this is called Pre-Meditated, and does not look good for the defense.....

Timer function not working properly? Check CLKDIV8 Fuse first Wink


Last edited by jgmdesign on Mar 22, 2012 - 08:19 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
kk6gm
PostPosted: Mar 22, 2012 - 07:44 PM
Raving lunatic


Joined: Sep 12, 2009
Posts: 2406
Location: Sacramento, CA

A simple way to create a current switch is to run the current through a resistor which also connects to a transistor base and emitter. At a certain current the transistor will turn on and the conducting transistor could drive an optoisolator which signals your AVR. Pick the resistor so that it will drop about 1V when the switch is closed (in reality the base-emitter junction will clamp that at about 0.7V). Depending on the current drawn by the chimes, you may need to limit the transistor base current to a safe value with an additional series base resistor.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits