I currently have a circuit that controls a pump depending on the value of a sensor. If the sensor is off, the pump is on, and if the sensor is on, the pump is off. What I want to do is, if the sensor goes on, I want the pump to stay off, even if the sensor goes back to off, and wait for a reset from a momentary push button. I've tried doing some searching on how to set this up and I think the best way to do it would be with an AND gate, but I've never used one of these before so I'm not sure if that's what I need, or if there's some other easier way. I am trying to do it via hardware, as the arduino is only monitoring the status of the pump, and not actually controlling it. Thanks in advance.
If you want to do it in hardware, you look for a JK-Flip Flop. Perhaps a Gated Flip Flop (with Enable pin.)
I can't get my head around all the ons and offs, but a D-type FF would do this I think.
sensor -> CLK
5v -> D
pushbutton -> RST
output -> Q or \Q
Let's stay with positive logic to make life simpler.
Whenever the sensor goes high it will clock the FF thus causing the output to go high. This output will stay high forever or until the button is pressed, at which time it will go low.
D-type FFs have a Q and /Q outputs so you can choose which logic suites the app.
Note JK flip flops will probably do the same thing, but I find Ds easier to think about. Also the sensor output may have to be sharpened up with a schmitt trigger or something, depends on the sensor type.
Wow! Thanks for pointing me in the right direction. Although, you almost made my head explode. I kept looking up datasheets for flip flops and for some reason it just wasn't sinking in. It wasn't till I downloaded a logic circuit simulator and drew up my circuit that I finally figured out what you guys were saying. I guess I'm more of a visual learner. I'm going to order me a 74LS74 and get this wired up. Thanks again for the help.