Picaxe on battery. Need pushbutton on/off solution

Thread Starter

akke

Joined Dec 17, 2015
77
I have a picaxe 18M2 chip running on batteries and I want to implement a on/off pushbutton in order to save batteries when it's off. The picaxe is powered from a 2-cell li-ion pack (7.4V) and I have 5V DC-DC step down converter to get the 5V for the picaxe and other stuff.

So, I was thinking that maybe is's possible to insert a mosfet between the batteries and the 5V converter which I can "overrule" with a pushbutton to power up the system. As soon as it's powered the picaxe should high one of the outputs to keep the mosfet in ON position, so power isn't lost when I release the push button.

But, the picaxe will also need to be able to read the pushbutton state and release the mosfet when I hold the pushbutton for a couple seconds.

I have a TON of IRFB4110 mosfet's on my desk, and I was hoping I could use these for this job.

I'm pretty new to electronics. The digital parts are pretty easy to me but the analog circuits are hard to understand. So please, can anyone help me out with an example circuit on how to build this?

Thanks!
 

crutschow

Joined Mar 14, 2008
34,280
N-MOSFETs, such as the IRFB4110, don't work well as high-side switches if you need to switch the plus side of the power since they need a gate voltage several volts higher than the supply voltage (3V to 10V depending upon the MOSFET) to be fully on.
So you will need to use a P-MOSFET for that task.

Here is a discussion of some circuits for ON/OFF power control from a push-button.
For your application the MOSFET will need to be a logic-level device that fully turns on with a Vgs of 5V or less (as shown in the data sheet where the Rds(on) is specified).
 

Thread Starter

akke

Joined Dec 17, 2015
77
Look up sleep mode for that particular pic. Better way to go.
Sleepmode of a picaxe 18M02 is not very usable afaik.
But the thing is, I want to shutdown the DC-DC converter too. It will use some power, even if the pic was completely disconnected.
So, I wanted to turn on/off the DC-DC converter instead
 

Thread Starter

akke

Joined Dec 17, 2015
77
N-MOSFETs, such as the IRFB4110, don't work well as high-side switches if you need to switch the plus side of the power since they need a gate voltage several volts higher than the supply voltage (3V to 10V depending upon the MOSFET) to be fully on.
So you will need to use a P-MOSFET for that task.

Here is a discussion of some circuits for ON/OFF power control from a push-button.
For your application the MOSFET will need to be a logic-level device that fully turns on with a Vgs of 5V or less (as shown in the data sheet where the Rds(on) is specified).
I'm actually using the IRFB4110 in another project. There a picaxe is running on 5V and it's able to successfully switch on a +- 1 Amp load on an 8V power supply. I have connected the IRFB4110 with a 10K resistor to the picaxe and it seems to be working fine.

So, you're saying this picaxe is not actually fully on? It must be close to fully on then, since it all seems running perfectly fine.

The link you gave me does contain a circuit that will not allow to use the pushbutton for other purposes, so I cannot read it's state using the picaxe, right? Or did I miss something?
 

Thread Starter

akke

Joined Dec 17, 2015
77
I think a circuit like this is what I need : http://forum.allaboutcircuits.com/threads/auto-off-switch.27626/
But my problem is that I want to disconnect the DC-DC voltage step down converter too.

This circuit assumes the battery voltage is 4.5Volt and can be connected to the pic, using the pushbutton.

In my case I can't have the full battery power connected to the picaxe. So it needs a little modifications.

Anyone here can help me?
 

crutschow

Joined Mar 14, 2008
34,280
I'm actually using the IRFB4110 in another project. There a picaxe is running on 5V and it's able to successfully switch on a +- 1 Amp load on an 8V power supply. I have connected the IRFB4110 with a 10K resistor to the picaxe and it seems to be working fine.

So, you're saying this picaxe is not actually fully on? It must be close to fully on then, since it all seems running perfectly fine.

I'd have to see the circuit to know whether it's working perfectly fine or not.

The link you gave me does contain a circuit that will not allow to use the pushbutton for other purposes, so I cannot read it's state using the picaxe, right? Or did I miss something?
Answer to first question above in red.
What other purposes to you want to use the pushbutton for? :confused:
I thought you just wanted to turn the power on and off.
 

Thread Starter

akke

Joined Dec 17, 2015
77
I tried drawing a circuit for this myself but I'm not sure this will work. Could anyone please verify if it makes any sense at all?
It probably needs some adjustments because I'm very new to electronics so I probably made mistakes. It seemed too easy to build this circuit ...

The idea is the following:

When connecting the battery the mosfet will be off. Because R2 is pulling the gate down. In this state the circuit shouldn't be using much power.

Hitting the S1 pushbutton will activate the voltage divider R1+R2 and bring the mosfet's gate to +5V. The mosfet will power the dc-dc step down voltage converter and power the picaxe with +5V. The picaxe's first job is to bring RA4 high.
By doing so, it's keeping the mosfet's gate high over R3 and D1.

Hitting the S1 pushbutton while the circuit is powered will not make any difference to the power, right ? The mosfet is already high and will keep the dc-dc converter powered.

I connected RA5 to the voltage divider too. This way I can check the state of the pushbutton when the circuit is already powered.

Is this making any sense at all?
 

Attachments

Thread Starter

akke

Joined Dec 17, 2015
77
Answer to first question above in red.
What other purposes to you want to use the pushbutton for? :confused:
I thought you just wanted to turn the power on and off.
I want to use the pushbutton for several things.
First: to power on the system
Second: to select a different picaxe program / option, when the circuit is powered.
Thirth: when holding the button for X seconds (I can measure that using a picaxe program) I want the system to power off. Which the picaxe can do by bringing low the pin that's powering the mosfet..
 

crutschow

Joined Mar 14, 2008
34,280
You circuit in post #8 looks okay in general but the IRFB4110 MOSFET requires a Vgs of 10V to be fully ON as a switch (as per the Rds(on) rating in the data sheet).
Even if you remove R3 the circuit picaxe applies about 4.3V to the gate and the maximum Vgs(thres) is 4V @ Id=250μA so it may be barely turned on from the picaxe voltage.

One solution is to use a logic level P-MOSFET that fully turns on at 3V or so. (A 5V logic-level device would also likely work, especially if you changed the diode to a Schottky type).

Alternately you could use a CD4071 OR gate powered from the battery to drive the MOSFET gate at the battery voltage (which likely is sufficient to drive the IRFB4110 at the low current you are switching.
One input would be from the PB and the other from the picaxe.
 

Thread Starter

akke

Joined Dec 17, 2015
77
Well, I'm not sure about the 10V rating of the mosfet. I tried the circuit (and made some changes) but I also have an irfb4110 connected to a 2Amp load and it's working fine. So the irfb4110 seem to be fully turned on with 4-5V on the gate. According to fig3 in the datasheet 5V is even close to fully on, so I think it's fine, no?

But I'm having another issue too right now. I'm using the circuit as shown below now but it's using about 500µA when the power is supposed to be OFF. When I remove the connection to pin C.5 the power drops to 270µA and when I remove the connection from D1 to the gate of Q1 power usage drops to 0.2µA.

While trying to figure out how to 'fix' this (I want the power off current to be as low as possible) I left the connection to pin C.5 disconnected and measured the voltage on the Q1 gate. The voltage is 2.8 Volt.

Can anyone please explain to me why the voltage is 2.8Volts?

I guess it has to do with the DC-DC converter or something...
 

Attachments

crutschow

Joined Mar 14, 2008
34,280
Your circuit appears to work with the particular Q1 you are using but it may not with a worst-case device.
The current in Figure 3 is measured with a Vds voltage of 25V, not when it's full ON.

Sounds like there's some sneak leakage path through the DC-DC converter.
What's the voltage at the output of the DC -DC when it's off?

One solution would be to use a high-side switch to the DC-DC input so there's no possible sneak path. That would require a logic-level P-MOSFET.
Below is such a circuit:
PB High Switch Switch.PNG
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
I've done this very same thing when I wanted a button to interact with my device and turn it on. Similar to crutschow's idea I used diode to OR both the button and a micro signal to enable the pass element (in my case a LDO), and by using the diode OR I still had the button signal to toggle an input pin.

I wonder if the transistor is needed by reversing the state of the button: make it low when pressed and use a logic low to "catch" the FET input to keep it on.

http://forum.allaboutcircuits.com/threads/lv-switch-timer.74337/#post-542909
 

Thread Starter

akke

Joined Dec 17, 2015
77
Your circuit appears to work with the particular Q1 you are using but it may not with a worst-case device.
The current in Figure 3 is measured with a Vds voltage of 25V, not when it's full ON.

Sounds like there's some sneak leakage path through the DC-DC converter.
What's the voltage at the output of the DC -DC when it's off?

One solution would be to use a high-side switch to the DC-DC input so there's no possible sneak path. That would require a logic-level P-MOSFET.
Below is such a circuit:
View attachment 96891
Cool. Thanks man!
I think i'll just order the parts you used in your circuit and drop the circuit I was working with.

While I'm going to order parts another question:

I need to be able to switch a 8Amp load using the picaxe too. In my tests this IRFB4110 is able to do that without producing any heat at all. But I'm told here that the IRFB4110 is not fully on with the picaxe's power on it's gate. Could you recommend me any different mosfet to do this?

Right now I have the irfb4110 connected to the load and the battery and the gate to the picaxe using a 10k resistor. It seems to work fine like I said but if a different mosfet is a better fit, than I better order that part while I'm ordering the parts from your circuit...
 

Thread Starter

akke

Joined Dec 17, 2015
77
Other question: can the 2N3904 be replaced with a BC547? I have like 150 of those BC547 NPN transistors here. If I could use those I better use them instead of ordering 2N3904
 

Thread Starter

akke

Joined Dec 17, 2015
77
The IRF7404 is a surfacemount mosfet. I prefer a mosfet in TO220 or something I can at least easily use in my breadboard.

Any suggestion? I need to make an order at conrad.com so it would be good if I can order the mosfet there too.
 
Last edited:

Thread Starter

akke

Joined Dec 17, 2015
77
Also, in your circuit the pushbutton has to be connected to the positive side of the battery, right?
But won't this put a voltage higher than 5V to the picaxe PB_DETECT pin?
 

crutschow

Joined Mar 14, 2008
34,280
The BC547 will work fine as a replacement for the 2N3904 in this circuit.

R1 and R4 are a voltage divider so that the voltage at the input to the picaxe in less than 5V when the PB outputs 7.4V (remember the Vbe of Q1 is 0.7V).

Finding logic level MOSFETs can be somewhat tedious, since, if it's not listed in the search criteria on the supplier website, you have to go to each MOSFET's data sheet and see if it says "Logic Level" or has the Rds rated at Vgs of 5V or less.
Doing a short search on Conrad.com I found a IRLZ24NPBF logic-level N-MOSFET, but didn't see a logic-level P-MOSFET.
You may have to look elsewhere such as Farnell.
 

Thread Starter

akke

Joined Dec 17, 2015
77
So i have to check all mosfets datasheet for the VGs Gate-To-Source voltage and it should be 5v or lower? Correct?
 

Thread Starter

akke

Joined Dec 17, 2015
77
I'll order them from farnell, like you suggested. Farnell has all the other components I was going to order from conrad too. So now it's just to find out which mosfet is not surface-mount and has "logic level" vgs voltage.

I found this one: MTP50P03HDLG

Is this a good replacement for the IRF7404 in the circuit?
I'm also going to relace the 2N3904 with a BC547
 
Top