NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » The stair lights open my door

December 24, 2012
by Pew446
Pew446's Avatar

I know, weird title, but it's true. I posted a while ago about my servo/keypad door system, when you put in the right code, a servo pulls the door latch back and you can push the door open. Well, I have noticed that when I turn on the lights to the stairs right outside my door, it triggers something and it opens as if I had punched in the correct code. I have no idea why. I have two ideas, possibly something with the wall adapter (this runs off a 5 volt wall wart) or it could be my desk button receiving power somehow. (I have a button under my desk to open my door. It is wired into a pin that opens the door when it is set high.) My dad told me the guy who previously owned our house also wired it himself, so there might be an issue there. I was just wondering if anyone had any immediate ideas of what might be going wrong. I will post more info/pictures if needed. Thanks!!

December 24, 2012
by Pew446
Pew446's Avatar

Something else I forgot to mention was that this seems to only work once in a couple minutes. It's like it is building up a capacitance or something. It also does it with my bedroom light.

December 24, 2012
by JimFrederickson
JimFrederickson's Avatar

Since your circuit is not posted I think it will be hard for anyone to give you a really good answer.

My thought is that there are 2 things that contribute to this problem. (I don't think there is a "capacitance" issue, but maybe that was meant as more of a description.)

I do think that after a few power-ups/resets your Microcontroller doesn't reset cleanly and hangs, then in your circuit I am guessing there is not pull-up/pull-down on your I/O pin for the Servo.

When this happens the I/O floats and the Servo actuates. (The pull-up/pull-down would be dependent on how your circuit is designed to function.)

December 24, 2012
by JimFrederickson
JimFrederickson's Avatar

If you do already have pull-up/pull-down resistors in your circuit maybe they are not he appropriate value. (I just noticed that I left out "resistor" from the previous post, but if nothing else this will help to clarify that as well.)

December 24, 2012
by Pew446
Pew446's Avatar

I do not have a resistor on my servo I/O, that is correct. I will post my circuit some time soon, thanks for the help!

December 27, 2012
by Pew446
Pew446's Avatar

I added a resistor to the servo I/O to ground, and the door stops opening when the lights are flipped on. Thanks for the help! (To be honest I have no idea what the resistor value is, but it works so whatever :p)

December 27, 2012
by JimFrederickson
JimFrederickson's Avatar

That's one thing that "multimeters" are for!

I've never bothered, gotten around to, memorize the resister color-code. (I think it's a great system though...)

I pretty much just "match them up" with other when I use them, and if I need specific value I just measure them.

My hardware has the common values I seem to use alot separated, and then a but more just together that I may need for something. (But usually don't...)

Whatever value you used it must be close-enough though. (Sometimes for Hobbyist's that really the best we can hope for...)

December 27, 2012
by Noter
Noter's Avatar

Years ago I learned the color codes but I'm just enough red color blind that I can't read them accurately anyway. I don't even try any more. I keep them separated by value in my parts bin or otherwise use the ohm meter. I bought some resistors a while back and when they came I measured them as usual and they weren't what I expected. Got my wife to verify the colors and sure enough they were coded with the wrong colors. That's about the only time I've had the advantage :-)

January 02, 2013
by alex555
alex555's Avatar

I just look at resistors and know what the values are, although I'mot sure if that is a good thing or not. Also if I ever have any problem with something effected by noise or bouncy signals or something, I always put a .1uF decoupling cap between power and ground as close to the chip as possible. It fixes a lot of problems, even ones you don't know are there.

February 27, 2013
by Pew446
Pew446's Avatar

Turns out this problem isn't fixed. I recently etched a board for the door thinking maybe the breadboard was faulty, but it has the same problem. Flipping on or off the lights after a period of time (or even touching the screw with static built up) will open the door. I also discovered today if I plug something into the wall and turn it on or off, or unplug it, it also opens the door. Sometimes even touching the board will open it. I have no idea what would cause this.

Here are my schematics: schematics

(The keypad is a matrix of 4 rows and 4 columns.) ...and my board design:

design

Here is my code. Sorry to bring up an old topic, but not knowing why this happens is bugging me to death. Thanks!

February 28, 2013
by Noter
Noter's Avatar

You could try a ferrite core on your power in for emf suppression. Maybe put a 10uf cap in series between power and the reset pin too.

February 28, 2013
by pcbolt
pcbolt's Avatar

Pew -

I took a look at your code and it took a little while to decipher but I think I get the gist of it. The one thing that stood out to me was the "exec_key()" subroutine. It looks likes it's recursively calling itself from inside the subroutine. This isn't "forbidden" but it may lead to a stack overflow and random behavior (I'm not certain of this since I did not compile your code and look at the assembly listing). You may want to put a "while(1)" at the top of the subroutine and put a "continue" statement where ever you make a call to "exec_key()" that is inside that code block.

The other thing I would try is to put a "delay_us(10)" at the top of the "check_row()" function just in case there is some capacitance in your wiring and/or keypad. This should give it time to settle out. (If you have a little time there is a 50-minute lecture (#11) at This Site which gives an explanation why this might be the case).

Post a Reply

Please log in to post a reply.

Did you know that you can input numbers in binary via a DIP switch, and output them to the LCD? Learn more...