My question is about the manual override button. The idea is that it will close a path from the 9V battery pack through the button, down to 220Ohm resistor towards the mosfet gate. However there is an alternate path which is towards the arduino pin and through the 10kO resistor to ground. It probably wont go through the 10kO resistor having a 220O option, but what about the arduino pin?
NOTE: The red pen connections on the diagram are made underneath the perf board.
int gatePin = 3; // connection to mosfet gate
int ledPin = 13;
void setup() {
pinMode(gatePin, OUTPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
delay(5000);
// Open solenoid by sending voltage to pin3
digitalWrite(ledPin,HIGH);
digitalWrite(gatePin,HIGH);
delay(5000);
// Close solenoid by sending low
digitalWrite(ledPin,LOW);
digitalWrite(gatePin,LOW);
}
The idea is that it will close a path from the 9V battery pack through the button, down to 220Ohm resistor towards the mosfet gate. However there is an alternate path which is towards the arduino pin and through the 10kO resistor to ground. It probably wont go through the 10kO resistor having a 220O option, but what about the arduino pin?
Can you just draw a schematic on a sheet of printer paper and post a photo ?
Just to reiterate, my question is; Since I want to operate the gate at the mosfet from a time-controlled sketch that opens and closes the gate every so often, but I want to add a manual override button, would the correct way to do it be to add that push button switch in that way?
Hi,
No that switch is going to connect a controller output to your 5V supply, that is not good.
You will need to do some diode switching at the MOSFET gate so you can use the arduino output and the bypass switch in parallel.
Your bypass wants to turn the solenoid ON I presume?
Exactly what does it do ? (ie: does it turn it ON when it was OFF or turn it OFF when it was ON or BOTH ?)
Is it MOMENTARY (until you release you finger) or is it a toggle on/off ?)
You will need to do some diode switching at the MOSFET gate so you can use the arduino output and the bypass switch in parallel.
I believe what TomGeorge means is insert a diode from the GPIO pin to the gate resistors and use the push button to pull the gate low. (at least that's my guess)
The manual override would be used to open and close the valve manually. Of course, thats not what you meant, I see...I guess if I try to connect it to the gate, it would have to remain pressed to hold the valve open, which would be uncomfortable. It might be better to just have the button press run a method to hold it open manually for about 5 seconds and then close it. In that case the button would just need to call another method that pulled the existing digital pin high for 5 seconds instead of just waiting for the sketch to run through its normal cycle. but that sounds easy enough to do.
What I meant was actually to have the button open the gate/valve while pressed and close it when let go.
What I meant was actually to have the button open the gate/valve while pressed and close it when let go.
Just connect the button as a pullup to 5V on the mosfet gate. When you press the button , it shorts the gate to 5V and opens the valve until you release it.
I thought that's what I was doing in the diagram on post #4. I connected the button to that 3-way junction but I'm worried it'll affect the D3 pin circuit?
Marciokoko:
I'm worried it'll affect the D3 pin circuit?
It will.
If D3 is LOW and you hit the p.b. (pushbutton), applying 5V there... you can figure out the rest.
A heavy-duty toggle (or p.b.) between FET drain and Gnd would turn it on.
Writing your sketch to poll for your p.b. input (manual/test) is another option.
I thought that's what I was doing in the diagram on post #4. I connected the button to that 3-way junction but I'm worried it'll affect the D3 pin circuit?
D3 doesn't have a current limiting resistor in series in that schematic. (see Tom's schematic in the following post)
I can't answer for TomGeorge but I can tell you for a fact that any schematic that simply shows a diode with no further clarification or specifications is intended to mean a 1n4001 silicon diode. If it were germanium or something smaller like a 1n4148, the part number 1N4148 would be given. If it were larger, like a 1n4007 , the part number would be given. If it were a SCHOTTKY diode, the schottky diode part number would be given, as there are many different ones. The fact that no part number is given tells you that a garden variety 1N4001 will work fine. Of course Tom will have to confirm that but that's my conclusion as someone with 35 years electronics experience. I think I would probably bet money I'm right about that.