I am attempting to modify the suggested solenoid interface, and I'm a complete electrical idiot, so I wanted to put this out there and see if people think this will work or if there's a better way to do it.
Essentially, I want to take the standard Arduino - transistor - solenoid circuit and add a manual switch plus a means for the Arduino to detect when the manual switch has been activated.
I'm thinking I can just add a switch S1 in parallel to the transistor to enable manual activation. So far, so good?
Then I want to detect when S1 has been closed. V+ for the solenoid is 12V, and the Arduino analog inputs handle up to 5V, so I think I need a voltage divider between the positive terminal of S1 and GND. Still on target?
If so, I figure that I need a "top" resistor R2 (connected to the positive terminal of S1) and a "bottom" resistor R3 (connected to GND), and a wire connecting the middle of the divider to an analog input on the Arduino. If my algebra is correct, these values come out to:
R2 = 7/5 * R3
I assume it would be a bad thing to use low resistances because I'm putting this between 12V and GND, so I pulled these values out of my butt:
R2 = 14K Ohm R3 = 10K Ohm
Then I should be able to sample the analog input pin and get 0 when S1 is open, and close to max when S1 is closed.
So, does this make any sense at all? Will it work? Is there a better or easier way to do this?
Thanks for any help!!
PS: I'll try to post links to circuit diagrams in a follow-up. YaBB won't let me post them here..