Post Top Ad

Tuesday, November 7, 2023

Single Push ON / OFF Circuit Using Mosfet irfz44n | Single Push Latching Circuit


 Single Push ON / OFF Circuit Using Mosfet irfz44n | Single Push Latching Circuit

Amazing electronics project Single Push ON / OFF Circuit or Single Push Latching Circuit Using Mosfet irfz44n, capacitor, transistor bc 557 / bc 558, resistor, Led and more use karke ye project banaya he aap aasani se sikh sakte he

Hello everyone, was looking for an on/off circuit on the net. Everything I found was not what I was looking for. I was talking to myself, there are necessarily a way to that. That's what I needed.


-Only one push button to do on and off.


-Must only use one pin on uC. Not 2.


-Must work with battery.


-From 3.3v to 20v


-Working with or without regulator. (Remove regulator from 3.3 to 5v in)


-No special i.c.


I designed a schematic and code to do that. This is working very well. Very handy schematic to have in many projects.

Here i'm using an atmega328. But any uC can do the same. In this example I'm using 20V in. It's the maximum voltage i can. Why ? Because mosfet vgs max as per datasheet is -20v maximum. I tried to go to 30v. it was workin. I went up to 35v and it was working... for a while. Mosfet as blow :) Thing is, schematic is good to go higher. But you will need to find an mosfet for that.


I'm using a P mosfet to allow current to pass or not. Vgs threshold for the Si2369ds is -2.5v.


When the push button is not pressed. Vgs is 0v. R1 resistor 1M pull up the gate to Vcc. So Vgs (volt gate vs volt source) is 0v. At Vgs 0v, current doesn't flow.


When we push the button. Current is flowing by R1, R2 and T1.


T1 2n3904 is closed by r2 resistor and put the gate to gnd. 0v is now on the transistor collector. Vgs is now -20v and current is flowing throw the mosfet and turn on the uC.


Here is the magic happen, uC turn on, we put the interrupt pin in input mode but, we activate the internal pull-up, so 5v is coming from uC to R2. But keep in mind this pin is in input mode to sense interruption on falling edge.

We release the button, but uC is sending 5v on R2 the circuit stay on. T1 stay closed, mosfet gate is at 0v.


So far so good. Circuit is on. Transistor is closed, we have 0v on transistor collector. And a 5v comes out from interrupt pin.


When we push a second time the button, we are sending a low (0,7v) to the uC and an interrupt appears. Because, collector transistor is 0v (this one is closed). Interrupt occurs at falling edge.


ATTTENTION: In some case 0,7v can be seen as High or not enough to trig a Low. Do your experiment. In my case, this has always worked. If you need 0v. See the mosfet schematic.


In the interrupt sub routine we turn the pin in output mode and we send a low on that pin.


When we release the button, T1 will open and the whole circuit will shut down.


Yes but if i have 20v in i'll send 20v on the interrupt pin and the uC will explode!! ?

Not really. Interrupt pin never go higher than 3.7v. Because of the transistor and R2.


More explanation at next step.


When the device is off, we aren't consuming current anymore (a few pa). At this scale we can run on battery for years...


I added another schematic I did and tested. This one is all mosfet. P type and a N type instead of a transistor. We must add a zener diode 5.1v to protect the uC from Vbatt. We can use separate mosfet or all in one ic package like DMC3021LSD-13, DMG6601LVT, IRF7319TRPBF.


Both method works fine. But 2n3904 leakage is better than mosfet. 50nA vs 1uA as per datasheet. Also in the mosfet version, we have C1 always hot. So if this capacitor is leaking, battery will be drained.

Current is flowing by the most easy way. It passes by R1(1M) R2 (100k) and T1 (0,7v). As you can see on photo. Interrupt pin never goes higher than 3.7v even if we have 20v in.


If you look at the first picture. Rise time is 163ms. As soon as i press power on. uC turn on. Waiting time fuse bit is set to 65ms. We are around 0.68v for this time. After, 65ms we are around 0.7v because uC is sending 5v with a pull up we have a 0.1v of rising. But button is pushed so it can't go higher than 0,7v. Soon i release the push button, voltage rise to 3.7v.


When you power off the mosfet, we can see that the interrupt pin goes to 0v in 33us. So the pin is low but the device stays on by pushing the button to low. As soon as we release the button device turn off.


I did a little video on the next step to show the whole process.


 Single Push ON / OFF Circuit Using Mosfet irfz44n | Single Push Latching Circuit

Amazing electronics project Single Push ON / OFF Circuit or Single Push Latching Circuit Using Mosfet irfz44n, capacitor, transistor bc 557 / bc 558, resistor, Led and more use karke ye project banaya he aap aasani se sikh sakte he

Hello everyone, was looking for an on/off circuit on the net. Everything I found was not what I was looking for. I was talking to myself, there are necessarily a way to that. That's what I needed.


-Only one push button to do on and off.


-Must only use one pin on uC. Not 2.


-Must work with battery.


-From 3.3v to 20v


-Working with or without regulator. (Remove regulator from 3.3 to 5v in)


-No special i.c.


I designed a schematic and code to do that. This is working very well. Very handy schematic to have in many projects.

Here i'm using an atmega328. But any uC can do the same. In this example I'm using 20V in. It's the maximum voltage i can. Why ? Because mosfet vgs max as per datasheet is -20v maximum. I tried to go to 30v. it was workin. I went up to 35v and it was working... for a while. Mosfet as blow :) Thing is, schematic is good to go higher. But you will need to find an mosfet for that.


I'm using a P mosfet to allow current to pass or not. Vgs threshold for the Si2369ds is -2.5v.


When the push button is not pressed. Vgs is 0v. R1 resistor 1M pull up the gate to Vcc. So Vgs (volt gate vs volt source) is 0v. At Vgs 0v, current doesn't flow.


When we push the button. Current is flowing by R1, R2 and T1.


T1 2n3904 is closed by r2 resistor and put the gate to gnd. 0v is now on the transistor collector. Vgs is now -20v and current is flowing throw the mosfet and turn on the uC.


Here is the magic happen, uC turn on, we put the interrupt pin in input mode but, we activate the internal pull-up, so 5v is coming from uC to R2. But keep in mind this pin is in input mode to sense interruption on falling edge.

We release the button, but uC is sending 5v on R2 the circuit stay on. T1 stay closed, mosfet gate is at 0v.


So far so good. Circuit is on. Transistor is closed, we have 0v on transistor collector. And a 5v comes out from interrupt pin.


When we push a second time the button, we are sending a low (0,7v) to the uC and an interrupt appears. Because, collector transistor is 0v (this one is closed). Interrupt occurs at falling edge.


ATTTENTION: In some case 0,7v can be seen as High or not enough to trig a Low. Do your experiment. In my case, this has always worked. If you need 0v. See the mosfet schematic.


In the interrupt sub routine we turn the pin in output mode and we send a low on that pin.


When we release the button, T1 will open and the whole circuit will shut down.


Yes but if i have 20v in i'll send 20v on the interrupt pin and the uC will explode!! ?

Not really. Interrupt pin never go higher than 3.7v. Because of the transistor and R2.


More explanation at next step.


When the device is off, we aren't consuming current anymore (a few pa). At this scale we can run on battery for years...


I added another schematic I did and tested. This one is all mosfet. P type and a N type instead of a transistor. We must add a zener diode 5.1v to protect the uC from Vbatt. We can use separate mosfet or all in one ic package like DMC3021LSD-13, DMG6601LVT, IRF7319TRPBF.


Both method works fine. But 2n3904 leakage is better than mosfet. 50nA vs 1uA as per datasheet. Also in the mosfet version, we have C1 always hot. So if this capacitor is leaking, battery will be drained.

Current is flowing by the most easy way. It passes by R1(1M) R2 (100k) and T1 (0,7v). As you can see on photo. Interrupt pin never goes higher than 3.7v even if we have 20v in.


If you look at the first picture. Rise time is 163ms. As soon as i press power on. uC turn on. Waiting time fuse bit is set to 65ms. We are around 0.68v for this time. After, 65ms we are around 0.7v because uC is sending 5v with a pull up we have a 0.1v of rising. But button is pushed so it can't go higher than 0,7v. Soon i release the push button, voltage rise to 3.7v.


When you power off the mosfet, we can see that the interrupt pin goes to 0v in 33us. So the pin is low but the device stays on by pushing the button to low. As soon as we release the button device turn off.


I did a little video on the next step to show the whole process.

No comments:

Post a Comment

Post Top Ad

Pages