Pages: 1 2 [3]   Go Down
Author Topic: Simple Button Input Floating Problems - New User  (Read 3470 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 360
I'm 15. I like making things. I like breaking things better.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I was referring to the fact that the signal itself was bouncing.

Quote
Also, what's to say I don't experience the "noise" for longer than a few ms?
You did.

My guess is you have some long wires acting as antennae for the fridge noise.
Logged

Alice asked the Chesire Cat, who was sitting in a tree, "What road do I take?"
The cat asked, "Where do you want to go?"
"I don't know," Ali

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4060
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@J, it's funny you should ask - I am in the electrical trade.
Haha, well I guess I sure asked a guy that would know, and probably has the best wiring on the block!  Hey, I think I duplicated the problem, more or less.  Changed my sketch to just light up an LED and hold it for several seconds so that I could move it around the house without a computer and still see if I got a spurious signal.  Tried plugging it in next to several things: Freezer, sump pump (1/3 HP IIRC), drill press (couldn't find spec on the motor, probably not more than 1/4 HP) and the pump for the laundry tub (probably also less than 1/4 HP).  The laundry tub pump did the trick (none of the others did).  It would trigger both the input with the external pull-down and the input with the internal pull-up, not every time, maybe half the time.  I'd say the input with the internal pull-up was less sensitive.  It also seemed to work more or less the same when plugged into a surge suppressor.  And like you, I could not get the input with the internal pull-up to trigger if I disconnected the wire to the Arduino.

I ran out of time, but I might try a 100nF bypass cap on the input pin, and maybe a stronger pull-down/up resistor, maybe 2.2K.  If that doesn't clean it up, I'd try my own power supply.  I'm just using one of these to power the Arduino board.  I like 'em because they're convenient, I have several, and they've worked well, but have no idea what to expect of them, power-quality wise. 
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@J, are you proposing to put a small cap between the pin and ground?
 I had a false notification last night at 2am with the fridge unplugged.
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 360
I'm 15. I like making things. I like breaking things better.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Its not the power supply that is the problem. Otherwise it would still be affected without the wire. Your problem is that your wire is acting like an antenna to pick up interference. If you are that against a software solution for fixing it, try a cap and some different size pull downs/ups.
Logged

Alice asked the Chesire Cat, who was sitting in a tree, "What road do I take?"
The cat asked, "Where do you want to go?"
"I don't know," Ali

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@bilbo, that's the part that's confusing me. When the fridge sits in the same place and plugged into a different circuit, the problem goes away, so that seems to eliminate the possibility of RFI. I've tried playing a bit with different resistors, but gave up quickly. I'll play around with that again. Are you suggesting a cap between input pin and ground in the external pulldown scenario?

And, I don't think I have the option to software debounce, since sometimes the doorbell doesn't close the relay long enough. And, I can't control how long guests hold the doorbell button. It is a little curious that I get such short contact closures when the doorbell button is tapped quickly, but I'm guessing that has something to do with the chimes' loads... but totally a guess there.
« Last Edit: April 24, 2011, 09:54:15 am by woodsby » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4060
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@J, are you proposing to put a small cap between the pin and ground?
Yes, exactly!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4060
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And, I don't think I have the option to software debounce, since sometimes the doorbell doesn't close the relay long enough. And, I can't control how long guests hold the doorbell button. It is a little curious that I get such short contact closures when the doorbell button is tapped quickly, but I'm guessing that has something to do with the chimes' loads... but totally a guess there.
That is odd that a doorbell button would trigger the chimes but not the uC.  I forget where we've been on this, but maybe an interrupt is the way to go, no chance of missing that.  There would have to be some hardware conditioning of the signal, I'm thinking Schmitt trigger and also a one-shot with some fairly long latch time, maybe a second, so that takes care of the debounce.  Not sure about your doorbell, I have the old style with solenoids to hit the chimes and such, so lots of inductance and other nastiness, plus the voltage levels are of course incompatible.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Jack, it does trigger the uC, but only for a short time - and I'm wondering if the chimes' inrush has anything to do with that.  I noticed if I hold down the doorbell button for 5 seconds, it only picks the relay and hence changes the pinstate for 4+ seconds.  That said, I don't think it allows enough time to charge a cap enough to hardware debounce.

Looking at the one-shot, it seems like a feasible idea.  I will try sticking a cap between the pin and ground in the pulldown setup.  I'll also post a schematic of the complete doorbell circuit.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Attached is a schematic I drew up quickly (sorry not pretty) for the doorbell circuit I have.  I show the AC Stepdown transformer and the two chimes are shown as two coils.  I put the relay in to isolate in case of any failing parts on the control side.  Please comment if you see a better way to do things.  I am new to DC electronics.


* Doorbell_schem.png (51.62 KB, 1024x720 - viewed 22 times.)
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4060
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey woodsby, you've got the right idea as far as needing something between the doorbell and the MCU.  I'd recommend a considerably different approach, however.  Probably the filter cap explains why short punches on the button don't make it to the MCU.  Even though the 10uF cap isn't huge, it has to charge up far enough (to at least about 7V) to get through the regulator, which takes time, and also has to have enough oomph (to use the technical term) to close the relay.

The transformer gives good isolation from the mains, so I wouldn't worry about anything else in that department.  If you'll let me know what the secondary voltage is on the transformer, in the meantime I'll look for a couple old schematics that I think we can use to get to a solution.

The approach we take will not use power from the doorbell per se to provide the MCU input; instead, we'll just use enough to sense it.  We'll rectify it with a small-signal diode, feed it to a Schmitt trigger through an appropriate voltage divider, then that will feed a one-shot, either TTL or maybe a 555 timer.  One more question, the way this will work with the one-shot, every time the doorbell button is pressed, it will provide one pulse of fixed duration.  Do you have any feel for how long would you like that duration to be?  I'm thinking fairly long, like maybe a second.  That also means the MCU will never see more than one pulse per second (or whatever interval, and note it's also automatically debounced as a bonus, at no extra charge smiley-wink).  If someone hits the button twice or three times in a second, the MCU still gets only one pulse.  Which should be fine, maybe even desirable, at least as far as I understand the application.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4060
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a possible interface circuit.  It's untested, so it may need a little tweaking (or a lot) ...
R1 and R2 form a voltage divider, just to get things in the ballpark, assuming a 16V (RMS) transformer.
D1 is a 5.1V zener diode that will clip the negative-going side of the input and limit the positive side to 5.1V.
IC1 is a hex inverter with Schmitt trigger input, which will give an output signal with fast rise and fall times suitable for use with TTL logic (only one of the six inverters in the package is used).
IC2 is a retriggerable one-shot.  C2 and R3 set the output pulse width.  The values shown should give around 800mS.  R4 is just a pullup to hold the inverting input and clear pins high.  (There are two identical one-shots in the package, only one is used.)
C3 and C4 are just some additional bypass and filtering given the high-noise environment.  C3 is the same as C2, but it's a non-critical value, anything from 10uF to 100uF would be ok.

Now the input will contain all kinds of nasty transients and possibly high flyback voltages from the chime solenoids.  Depending on how bad it is, it's possible this could overwhelm the input components (mainly the zener diode).  It's also possible that there's enough noise to propagate through to the output and thereby render the circuit useless.  (I am not an RFI/EMI type!)  Although I'd be surprised if any actual damage would occur to an MCU, what I'd do before connecting it to an MCU, is just hook an LED (with dropping resistor) to the output and see if the circuit operates and survives many pushes of the doorbell.


* doorbellInterface.png (16.34 KB, 1477x1102 - viewed 21 times.)
« Last Edit: April 25, 2011, 12:30:21 am by Jack Christensen » Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so I finally got a chance to get back to this.  Looks like the bypass cap between input and ground in the internal pullup scenario is the winner.  Also, @Jack, I didn't think about it, but I am going to reduce the filter cap to .2 uF, and based on @bilbo's advice, I will debounce all my inputs if changing the filter cap allows for it.

Thanks all.
Logged

Pages: 1 2 [3]   Go Up
Jump to: