plasmaninjaa
Member
Hi guys, I am running into a problem which I'm sure is very easy to solve. I am just blanking out at the moment.
some probably unimportant details about my project:
I have a project which raises or lowers a hook (responsible for opening or closing a lever) by use of gears and a motor.
There is a main on/off switch on the side which will turn on and off the power to the whole project (so when it is off, the battery is not being drained at all.)
When the user presses a button, the hook squeezes the lever, and if they let go it goes back down (so the lever can only be engaged if the user is present and touching the button.
however the flaw is that if the user holds the button until the lever is squeezed and then immediately switches off power to the box, the lever is still being squeezed even though the user is not pressing the button.
So I need some way for the box to know that if the power switch is shut off, to lower the lever first, and then shut itself off.
I was thinking that a way to accomplish this is to have a darlington transistor connected to the picaxe in parallel to the switch. And the gate of the transistor is controlled by the picaxe. That way, when the power is turned on, the 5v is going through the switch and to the picaxe, and then the picaxe turns on and sends 5v to the gate of the transistor. Then if the power is switched off, power will still be sent to the picaxe because the gate is still receiving 5v from the picaxe.
Then the picaxe will know to continue to send 5v to that gate until the hook is lowered and then stop the 5v to that gate, shutting off the power supply to itself.
This seems to make sense in my head, but it is not working at all.
I have made a simple circuit to try to figure out what is wrong, but even that isnt working and it doesnt make sense to me.
here is a diagram of the circuit: http://imgur.com/DrNCK0c
I would assume that when you turn the switch on, the led turns on and 5v goes from pin 3 back to pin 1 (gate) of the transistor so that when the switch turns back off, the transistor is still activated and the led stays on.
The transistor is a tip102.
I feel like I'm going to feel pretty stupid when the simple answer is given. haha
Thanks for any help
some probably unimportant details about my project:
I have a project which raises or lowers a hook (responsible for opening or closing a lever) by use of gears and a motor.
There is a main on/off switch on the side which will turn on and off the power to the whole project (so when it is off, the battery is not being drained at all.)
When the user presses a button, the hook squeezes the lever, and if they let go it goes back down (so the lever can only be engaged if the user is present and touching the button.
however the flaw is that if the user holds the button until the lever is squeezed and then immediately switches off power to the box, the lever is still being squeezed even though the user is not pressing the button.
So I need some way for the box to know that if the power switch is shut off, to lower the lever first, and then shut itself off.
I was thinking that a way to accomplish this is to have a darlington transistor connected to the picaxe in parallel to the switch. And the gate of the transistor is controlled by the picaxe. That way, when the power is turned on, the 5v is going through the switch and to the picaxe, and then the picaxe turns on and sends 5v to the gate of the transistor. Then if the power is switched off, power will still be sent to the picaxe because the gate is still receiving 5v from the picaxe.
Then the picaxe will know to continue to send 5v to that gate until the hook is lowered and then stop the 5v to that gate, shutting off the power supply to itself.
This seems to make sense in my head, but it is not working at all.
I have made a simple circuit to try to figure out what is wrong, but even that isnt working and it doesnt make sense to me.
here is a diagram of the circuit: http://imgur.com/DrNCK0c
I would assume that when you turn the switch on, the led turns on and 5v goes from pin 3 back to pin 1 (gate) of the transistor so that when the switch turns back off, the transistor is still activated and the led stays on.
The transistor is a tip102.
I feel like I'm going to feel pretty stupid when the simple answer is given. haha
Thanks for any help