Arduino Forum

Using Arduino => General Electronics => Topic started by: juan3211 on Mar 03, 2017, 08:32 pm

Title: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 03, 2017, 08:32 pm
Hi, I am working in a project.

I have a solar panel (9 Voc) connected to a battery (AGM, 6V) and then to my arduino (Working with a LDO 3.3V).

I want to control my battery charge and discharge cycles so:

1. with a TL431 and a second mosfet I can make a circuit to disconnect my load (LDO IC and arduino) from battery when the voltage is low, and reconnect it when voltage has rise a little bit (my schema has a bit of hysteresis for doing this. If you want it, please, ask me).

2. with controlling my battery voltage, measuring it by AnalogRead from arduino, I want to disconnect my solar panel from the battery when it's more than 7V.  ( my battery is a 6V system and solar panel is 9Voc)

I want to use a mosfet (for me is the same P or N channel): let's call it "solar-mosfet"

Arduino will control solar panel connection with my battery by putting ON or OFF the solar-mosfet. NO PROBLEM HERE. analogread--> digital write to control solar-mosfet

But If my arduino is disconnected from the battery (low voltage) so my arduino is NOT alive, may be for few days, how can I ensure that the solar-mosfet is ON so the solar panel is charging the battery?

NOTE: may be you have other options, but I want to keep it simply and I have already broke a battery because of it is going up to 8 or 9Volts, low current yes, but high voltage).

Thanks a lot.







Title: Re: MOSFET ON by default when arduino is off.
Post by: CrossRoads on Mar 03, 2017, 08:42 pm
Use a NPN as a buffer between Arduino and MOSFET gate. Then use pullup or pulldown on the gate to hold whatever default level you want when the Arduino is off and the NPN collector is floating.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 03, 2017, 10:44 pm
Hi, thanks

I have simulate this circuit. It is simple as it doesn't need a transistor.

What to do you think about it ???

Thanks,

NOTES:

Switch (key=space) is arduino pin, when arduino is powered off, it is open, so mosfet is ON, when powered and digital input LOW, mosfet is OFF.

Load is battery.

R13 is pull high for the gate of the mosfet

Title: Re: MOSFET ON by default when arduino is off.
Post by: MarkT on Mar 04, 2017, 12:31 am
Won't work, the Arduino pin will drag the gate down towards zero volts when the Arduino is
powered down.  You simulation lacks the Arduino pin circuitry so wouldn't show that.

You must arrange a LOW output to turn on the load and a HIGH output to turn it off.  However
HIGH = 5V, not 8V, so an extra level shifting transistor is probably the best way.  Drive an NPN
that shorts the gate to ground in that circuit.
Title: Re: MOSFET ON by default when arduino is off.
Post by: TomGeorge on Mar 04, 2017, 01:59 am
Hi
OPs circuit.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202014)
Your system gnd needs to be on the battery/load side of the MOSFET not the PV side.

Forget about measuring the PV voltage, use a shottky blocking diode in series with the positive PV terminal.
That is if it isn't already fitted.

Then switch the MOSFET ON when the battery needs charge, if the PV voltage is high enough it will provide current.
If the PV voltage is too low  then NO current will flow.

What are you PV specs.
What are you battery specs?

Tom.. :)
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 04, 2017, 08:28 am
Hi
OPs circuit.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202014)
Your system gnd needs to be on the battery/load side of the MOSFET not the PV side.

Forget about measuring the PV voltage, use a shottky blocking diode in series with the positive PV terminal.
That is if it isn't already fitted.

Then switch the MOSFET ON when the battery needs charge, if the PV voltage is high enough it will provide current.
If the PV voltage is too low  then NO current will flow.

What are you PV specs.
What are you battery specs?

Tom.. :)

Hi Tom, thanks a lot.

I will only measure battery voltage and do as you say, switch the MOSFET on and off when the battery needs charge

My problem is that I have a second circuit that disconnect my arduino from the battery when my battery's voltage is low.

So I want to ensure that when my arduino is powered down, my battery will recharge. "That second circuit" has some kind of hysteresis, so it will powered down arduino at 5.7V and reconnect it again at 6.2V.

The mesasurement of battery voltage and mosfet will disconnect PV from the battery at 7V and reconnect it again at 6.5 or 6.7V ( this is easy as you can program your sketch, the second circuit is ALL analogic).

Here you have the second circuit attached only for reference.

Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 04, 2017, 08:56 am
Won't work, the Arduino pin will drag the gate down towards zero volts when the Arduino is
powered down.  You simulation lacks the Arduino pin circuitry so wouldn't show that.

You must arrange a LOW output to turn on the load and a HIGH output to turn it off.  However
HIGH = 5V, not 8V, so an extra level shifting transistor is probably the best way.  Drive an NPN
that shorts the gate to ground in that circuit.
Use a NPN as a buffer between Arduino and MOSFET gate. Then use pullup or pulldown on the gate to hold whatever default level you want when the Arduino is off and the NPN collector is floating.
Hi @MarkT and @CrossRoads, do you mean something like this circuit ? Is it possible to put R12 as a 100K resistor ? (in order to let it low current device).

is it now ok ? Any more changes ?

Regards,

Title: Re: MOSFET ON by default when arduino is off.
Post by: TomGeorge on Mar 04, 2017, 09:19 am
Hi,
Move the earth like i advised earlier.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202077)
Tom.... :)
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 04, 2017, 10:17 am
Hi,
Move the earth like i advised earlier.
I only partially agree with that Tom. The circuit definitely has problems with ground placement, but making that change alone (battery negative and Arduino ground at the mosfet drain) creates more problems than it solves.

Jaun: You need to move the ground to the battery negative as Tom suggests (because that is where you want the ground for the Arduino to be) AND you need to flip the mosfet around (exchange source and drain) so that you are switching the solar cell and not the battery.

Your circuit is confusing, however from what you previously said I'm taking your "load" as the battery and your voltage source "V5" as the solar cell. This is a FAR from realistic simulation though.

BTW. Your simulation probably wont work properly when you make the suggested changes, but frankly that is just because your simulation is such a poor model.
Title: Re: MOSFET ON by default when arduino is off.
Post by: MarkT on Mar 04, 2017, 01:27 pm
Hi,
Move the earth like i advised earlier.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202077)
Tom.... :)
No, definitely don't move the ground there!
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 04, 2017, 02:46 pm
No, definitely don't move the ground there!
Mark. I know that the ops circuit is poorly drawn, but previously he said ...
-------------------------------------------------
NOTES:
- Switch (key=space) is arduino pin,
- Load is battery.
-------------------------------------------------

So yes, he really does want the ground (common reference node) at the negative of the battery, not at the negative of the solar cell as it currently is shown.

Refer to my previous post. He has to move both the ground and the mosfet (so that it switches the solar cell rather than the battery).
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 04, 2017, 10:41 pm
Hi,
Move the earth like i advised earlier.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202077)
Tom.... :)
I only partially agree with that Tom. The circuit definitely has problems with ground placement, but making that change alone (battery negative and Arduino ground at the mosfet drain) creates more problems than it solves.

Jaun: You need to move the ground to the battery negative as Tom suggests (because that is where you want the ground for the Arduino to be) AND you need to flip the mosfet around (exchange source and drain) so that you are switching the solar cell and not the battery.

Your circuit is confusing, however from what you previously said I'm taking your "load" as the battery and your voltage source "V5" as the solar cell. This is a FAR from realistic simulation though.

BTW. Your simulation probably wont work properly when you make the suggested changes, but frankly that is just because your simulation is such a poor model.
No, definitely don't move the ground there!
Mark. I know that the ops circuit is poorly drawn, but previously he said ...
-------------------------------------------------
NOTES:
- Switch (key=space) is arduino pin,
- Load is battery.
-------------------------------------------------

So yes, he really does want the ground (common reference node) at the negative of the battery, not at the negative of the solar cell as it currently is shown.

Refer to my previous post. He has to move both the ground and the mosfet (so that it switches the solar cell rather than the battery).
Thanks, thanks, thanks and thanks.

I know that the schema is very very basic, but it is because I am beginning with MOSFETs and I want understand how they work.

I think it is not necessary to have a PV and battery model in the simulation.

I have changed (see attach) what you say and put some other parts in order to show you where is the battery, where is arduino, .... (I have put also the first LDO that I have found in Multisim).

I dont understand why I need to change DRAIN and SOURCE

Also, arduino pin is very poor simulated, I don't know if it is enough, and if not, i don't know where I could simulate arduino and analogical parts in the same schema.

What I have found with this simulation is that:
* arduino pin OUTPUT high to DISCONNECT PV from BATTERY
* arduino pin INPUT to CONNECT PV to BATTERY
* arduino powered down ==== INPUT, so I can connect PV and BATTERY

I know that is a poor simulation, but in this circuit and get negative voltages in base of the NPN. Will It hurt my arduino pin?

Sorry for my poor knowledge.

Regards and thanks a lot for your efforts, I am learning a lot of this mosfets.


(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202182)
Title: Re: MOSFET ON by default when arduino is off.
Post by: allanhurst on Mar 04, 2017, 11:10 pm
Clever pv controllers use a maximum power transfer algorithm.

the pv panel has both a voltage ( which increases )  and an internal resistance - (which decreases) as the illumination level increases.

Given the battery isn't fully charged :

- the controller acts as a boost convertor at low illumination levels.
- it acts as a buck convertor at higher levels.

As the internal resistance of the pv is unknown , a hunting algorithm is used to find the highest power transfer point.

Allan
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 04, 2017, 11:34 pm
Clever pv controllers use a maximum power transfer algorithm.

the pv panel has both a voltage ( which increases )  and an internal resistance - (which decreases) as the illumination level increases.

Given the battery isn't fully charged :

- the controller acts as a boost convertor at low illumination levels.
- it acts as a buck convertor at higher levels.

As the internal resistance of the pv is unknown , a hunting algorithm is used to find the highest power transfer point.

Allan
Thanks Allan, here my goal is to connect and disconnect the PV panel from the battery (it is a low voltage and low power PV so I don't want to use a controller).

Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 02:46 am
I think it is not necessary to have a PV and battery model in the simulation.
I understand that you are trying to keep the simulation as simple as possible, but it makes the circuit look a bit obscure.

If you want a really simple approximation then just use a voltage source for the battery (with optional small series resistance) and voltage source with relatively large series resistance (V/R to give panel short circuit current) for the solar panel.

If you want a better model for the solar cell (if your sim software doesn't already include one) then the following circuit gives a very good approximation. Set the current source for the solar cell current maximum (short circuit current) and simply add as many diodes as you need to get the correct open circuit voltage (probably about 14 diodes in your case).

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202207)
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 04:16 am
I know that is a poor simulation, but in this circuit and get negative voltages in base of the NPN. Will It hurt my arduino pin?
That is because you still haven't got the overall circuit topology right. To be clear, you need to disconnect the solar cell from the rest of the circuit, not just disconnect the battery as in your original plan.

Initially I thought that you could still achieve this using the low side switch as per your original plan,  but switching the low side of the solar panel instead of the battery (while keeping a common ground for BJT emitter, and MOSFET source, and Arduino gnd, and battery negative).

After some thought however I now don't think that this simple solution can work, because the mosfet body diode will allow the battery to keep charging even after you attempt to switch out the solar panel (a low side switch on the panel would need to be reverse blocking).

So I suggest changing to a high side switch (p-channel) so that you can keep a common ground for everything. It complicates the circuit a little, but I now believe you need something like the following.

BTW. This is a crude freehand diagram to show basic interconnection only. It's not a complete circuit diagram!.

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202219)
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 05:31 am
BTW. If anyone was wondering what I was referring to previously (which I now believe won't work with a low side switch), it was this.

Note how the internal body diode of the mosfet will prevent it from ever stopping the battery charging.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202225)
Title: Re: MOSFET ON by default when arduino is off.
Post by: allanhurst on Mar 05, 2017, 08:22 am
Then put a diode in series with the MOSFET....


Allan
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 08:33 am
Then put a diode in series with the MOSFET....
Allan
And when you want the mosfet to switch on and charge the battery ...?
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 08:41 am
Allan, the problem is that the mosfet needs to conduct current in the wrong direction. In other words, when it's "on" it need to conduct current backwards, when it's "off" it need to block current backwards.

I think that this should look pretty obvious now that I've re-drawn the circuit. I have to admit that the slightly goofy way the circuit was originally drawn threw me a bit. I could see that the wrong thing was being switched out (battery instead of solar cell), but I didn't see that the low side switch cannot work until I re-drew it.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 05, 2017, 09:49 am
That is because you still haven't got the overall circuit topology right. To be clear, you need to disconnect the solar cell from the rest of the circuit, not just disconnect the battery as in your original plan.

Initially I thought that you could still achieve this using the low side switch as per your original plan,  but switching the low side of the solar panel instead of the battery (while keeping a common ground for BJT emitter, and MOSFET source, and Arduino gnd, and battery negative).

After some thought however I now don't think that this simple solution can work, because the mosfet body diode will allow the battery to keep charging even after you attempt to switch out the solar panel (a low side switch on the panel would need to be reverse blocking).

So I suggest changing to a high side switch (p-channel) so that you can keep a common ground for everything. It complicates the circuit a little, but I now believe you need something like the following.

BTW. This is a crude freehand diagram to show basic interconnection only. It's not a complete circuit diagram!.

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202219)
Thanks again.

I have simulated this (thanks a lot for your PV model, it works !!!)

I have put a NONIDEALBATTERY from MultiSim14 (I don't know how to simulate it correctly).

This circuit works but I have two questions:
1. I have never tought how complicated it is. There is no option to simplify it, isn't it ?
2. I will use SI2301 as P-Mosfet, but what about resistors inyour hand-schema? I have put some values in my simulation, but probably you have a better ones.

I will try now the N-Channel option to see that it doesn't work. Wait a few minutes.

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202245)


Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 05, 2017, 10:19 am
Allan, the problem is that the mosfet needs to conduct current in the wrong direction. In other words, when it's "on" it need to conduct current backwards, when it's "off" it need to block current backwards.

I think that this should look pretty obvious now that I've re-drawn the circuit. I have to admit that the slightly goofy way the circuit was originally drawn threw me a bit. I could see that the wrong thing was being switched out (battery instead of solar cell), but I didn't see that the low side switch cannot work until I re-drew it.
@Stuart0, it is very good to read your comments. I almost doesn't understand anything  :o but I will try to read more info about mosfets. Maybe I misunderstand them from the very begining.

Why are you saying that I tried to disconnect the battery and not the solar panel? Because of the battery was in the first circuit in the DRAIN pin of the mosfet, wasn't it ?

Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 11:39 am
Why are you saying that I tried to disconnect the battery and not the solar panel? Because of the battery was in the first circuit in the DRAIN pin of the mosfet, wasn't it ?
Yes. In the first circuit it was the battery that was connected to the drain. That means you were disconnecting (low side switching) the battery from gnd (the source of the mosfet was gnd). This mean that the low side of the battery would also be disconnected from the arduino gnd - but you wouldn't want that.
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 12:28 pm
This circuit works but I have two questions:
1. I have never tought how complicated it is. There is no option to simplify it, isn't it ?
Not that I could immediately see. That was the most simple high side switch (that was on by default) that I could come up with. Someone else might see a simplification.

BTW. If you're still concerned about power consumption, it should work ok with all the resistors at 100k.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 05, 2017, 01:43 pm
Not that I could immediately see. That was the most simple high side switch (that was on by default) that I could come up with. Someone else might see a simplification.

BTW. If you're still concerned about power consumption, it should work ok with all the resistors at 100k.
Thanks a lot. These kind of circuits are better to do with mosfet than with transistors, aren't they ?

Finally I think you get managed to find the solution, thanks a lot !!!! I hope more people will find this solution good.

Do you think that we can finish then these great post ?

NOTE: in the other hand, do you know any good equivalent circuit for a rechargable battery ? Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: stuart0 on Mar 05, 2017, 03:23 pm
Thanks a lot. These kind of circuits are better to do with mosfet than with transistors, aren't they ?
The main high side switch is usually best to be a mosfet (as it is in this case), however BJTs are just fine for the other two transistors. Small BJT's, like the BC327/BC337 (pnp/npn) for example, are very readily available and cost a few cents each. And they'll do a job like that perfectly well. :)
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Mar 05, 2017, 06:44 pm
The main high side switch is usually best to be a mosfet (as it is in this case), however BJTs are just fine for the other two transistors. Small BJT's, like the BC327/BC337 (pnp/npn) for example, are very readily available and cost a few cents each. And they'll do a job like that perfectly well. :)
Hi, I have just put all things together and check them.

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=202353)

Here you will find the whole circuit with (multisim 14):
1. "P key" will simulate night and day, or shadows in solar panel (it is designed as 9 Voc and 200mA Icc), with the rotary encoder you will have different Vmax.
2. "A key" will change your battery voltage to check what happens when it increases or decreases
3. "Space key" will operate the arduino pin. I will program it to cut off solar panel when battery voltage is above 7V and it will connect it again when battery falls to 6.6V
4. The auto low voltage cut off will cut off loads (LDO and arduino) when battery voltage is about 5.4V and reconnect it again about 6.1V (parameters are 47K, 68K, and 300K resistors). I recommend you to install potentiometers in 68K and 300K resistors and check your already soldered circuit. 300K resistor is the control of the hysteresis (difference between 5.4 and 6.1V)

In the simulation, everything work as expected.

Thanks all for your help.

For explanation this circuit is for a little system in my brother in law's garden. It has a 6V seal acid battery and a 9Voc solar panel, but last years two batteries failed.

I think one of them was because high voltage (low current, yes, but at sun light the temperature and the high voltage of the panel could break the battery).

The other one as because of low voltage. It measures the battery voltage, send trough RF24 to a central node, and after with SIM900 to a web page.But my brother in law usually didn't go frequently so finally the battery voltage went down, and down, and down until it failed.

Thanks a lot again, and I hope you will find this "community" schema useful.

NOTE: May be you can find a cheap solar charger controller, but for us it is better to DIY, isn't it ?  ;)

Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 02, 2017, 11:54 pm
Hi @stuart0 as I said, I have done the last circuit and it works perfectly !!!! Thanks.

Now, I am going to do the same circuit for a little LiIon 3.7V battery, SIM900 module and a standalone ATMEGA328P IC.

I dont remember exactly when and where, but I read about disconnect a solar panel by short circuiting it. Short circuit a solar panel is normal, for example, when you want to check the maximum current that it sources. It is not bad for it.

So .... what do you think about this circuit ?

It is only a NPN transistor, two resistors and a P channel mosfet. Few components.

(https://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=206832)

NOTES: PV+ and PV- are solar panel's terminals, 1N5819 is a schottky not to short circuit the battery, and control switch is simulation an Arduino PIN output (HIGH or LOW)
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 03, 2017, 04:27 am
Hi,
I found this article that I used when running in to trouble when working with mosfet. Maybe it will help you understand how to use mosfet transistors.

attached it is the article.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 04, 2017, 10:08 pm
 
Hi,
I found this article that I used when running in to trouble when working with mosfet. Maybe it will help you understand how to use mosfet transistors.

attached it is the article.
Hi, thanks a lot. This document is great. I helps a lot.

But do you think that my schema is not correct ?? I think that it meets with the document, don't it ?

Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 06, 2017, 05:40 am
Hi,
I checked your schematic and attached it is one in the way I would do it.  It is almost the same as your are but less parts. If you remove the micro it will make the n mosfet disable and let the p mosfet keep charging the battery. I do not know if that is  what you was looking for. A high in the gate of the n mosfet  will disable the P mosfet. If you already fixed yours schematic just disregard it. 
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 07, 2017, 10:31 pm
Hi,
I checked your schematic and attached it is one in the way I would do it.  It is almost the same as your are but less parts. If you remove the micro it will make the n mosfet disable and let the p mosfet keep charging the battery. I do not know if that is  what you was looking for. A high in the gate of the n mosfet  will disable the P mosfet. If you already fixed yours schematic just disregard it. 
Hi Tauro0221, thanks a lot for your schema.

May be I have not explain my schema and my project.

In this case, I have to design a little schema for a project that will be connected thought SIM900 module. It is powered by a Li-Ion 3.7V battery and solar panel as you see.

I want to program it this way:
1. if battery is > 4.1V, disconnect solar panel by short circuiting it with mosfet
2. If battery is < 3.7V, connect solar panel
3. If battery is < 3.5V send a SMS or HTTP GET to a WEB to call for help as the battery will be ruined if there is not more solar power to recharge it.

In this case,I dont mind or I dont want to include a cut off battery schema(if anyone want it, please see some post above).

And as the circuit/project will be on ALWAYS,I don't want to include the circuit that you said some post above to conect solar panel with battery when arduino has not being powered.

The objetive is:
0. keep it as simple as possible.
1. a simple switch on and off a solar panel with a a battery from an Arduino pin.
2. there is no need to have a low battery cut off system
3. there is no need to connect solar panel with battery when arduino has not being powered as in that case and because of it hasn't got a low battery cut off system, i will be always on until battery ruins or is changed or is recharged.

Do you think that my schema meets the requirements?

Regards,

Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 08, 2017, 01:43 am
Hi,


The objetive is:
0. keep it as simple as possible.
1. a simple switch on and off a solar panel with a a battery from an Arduino pin.
2. there is no need to have a low battery cut off system
3. there is no need to connect solar panel with battery when arduino has not being powered as in that case and because of it hasn't got a low battery cut off system, i will be always on until battery ruins or is changed or is recharged.


I think followed what you explained above what you need it is a voltage regulator that provide the voltage that you require from  the battery. The battery will be constantly be charging  by the solar panel.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 08, 2017, 03:45 pm
I think followed what you explained above what you need it is a voltage regulator that provide the voltage that you require from  the battery. The battery will be constantly be charging  by the solar panel.
HI Tauro0221, thanks a lot. I have made what you say some time ago. It is simply, yes, probably a LDO regulator, two capacitors and two resistor to set the voltage that the battery require.

But it has two problems:
1. there is a little or big voltage dropout  so you will lose some power from the solar panel.
2. this is the  main problem: you need to set a voltage to the voltage regulator. Let's set it at 3.9V for a LiIon battery (but it is the same if you put 4.1V or 3.7V). You will lose a lot of oportunities to recharge the battery. First, you need 3.9V PLUS the voltage dropout of the regulator, and also, you will not get more than 3.9V in your battery. Also, when your battery is low (3.6v), the regulator doesn't seem to do a good performance as the battery forces voltage to 3.6V, and regulator forces it to 3.9V.

As my schema is only some resistor, a transistor and a mosfet, I will prefer over the regulator solution.

Looking at my schema, do you think that is something wrong ?

Regards,
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 08, 2017, 07:45 pm
Hi,
I lost where we are so attached is the schematic that your are proposing. Is this the right one? I lost which one we are working on.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 08, 2017, 09:26 pm
Hi,
I lost where we are so attached is the schematic that your are proposing. Is this the right one? I lost which one we are working on.
Yes, of course. It is here attached. May be will it be simpler with a N channel mosfet and also SAFE for arduino ? (si2302) (see second attached file)
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 10, 2017, 06:17 pm
Hi,
I lost where we are so attached is the schematic that your are proposing. Is this the right one? I lost which one we are working on.
Hi @tauro0221 what about my last post ?

Regards
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 10, 2017, 06:25 pm
Hi,
Sorry, but I have been too busy lately. Let's see if I can get sometime and check it out.
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 10, 2017, 10:43 pm
Hi,
I am trying to simulate your schematic using the second schematic  but the mosfet gate it is connected to the ground. The gate always be grounded.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 10, 2017, 11:04 pm
Hi,
I am trying to simulate your schematic using the second schematic  but the mosfet gate it is connected to the ground. The gate always be grounded.
Sorry, change R24 to 1 Ohm or delete it.

R25 is to pull gate down to GND when arduino is off (just in case.If arduino is off, I don't know if output pins are conected to GND or floating). If arduino is working, you will have an output with these two states:
1. HIGH (3.3V):mosfet gate 3.3V=> mosfet ON, so solar panel is shorted. No energy to the battery
2. LOW (0V):mosfet gate 0V=> mosfet OFF, so solar panel current goes to the battery.Charging process.

What do you think ?
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 12:10 am
Hi,
A we taking about the same schematic. I am using the second one as you mentioned in the reply. Any way attached is your schematic. Please check the mosfet gate you will see it is connected to ground. I think it should be connected to the regulator output.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 11, 2017, 12:27 am
Hi,
A we taking about the same schematic. I am using the second one as you mentioned in the reply. Any way attached is your schematic. Please check the mosfet gate you will see it is connected to ground. I think it should be connected to the regulator output.
I have to control gate voltage to put mosfet on or off.

My schema put solar panel in short circuit when mosfet is on, and when arduino output is HIGH (gate voltage = 3.3v, and with the pull down R25 resistor, 0.33mA from output pin of arduino.).
My schema put solar panel to battery when mosfet is off, and when arduino output is LOW (gate voltage = 0V)

I don't know why you think that it won't work

Thanks
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 01:06 am
Hi,
Can you look at the schematic and tell how you can turn the gate to high. Right now it is connected to ground. How can you turn the ground high?

Title: Re: MOSFET ON by default when arduino is off.
Post by: TomGeorge on Apr 11, 2017, 03:37 am
Hi,
Can you look at the schematic and tell how you can turn the gate to high. Right now it is connected to ground. How can you turn the ground high?


The 10K R25 keeps the gate to gnd but if R24 is 220R, the output of the arduino will be able to pull the gate above ground.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=207887)
The circuit is called Shunt Bypassing, and can be done here because of the low power PV.
The MOSFET bypasses the PV current away from the rest of the circuit.
Tom... :)
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 07:30 am
Hi,

Attached it is the schematic that I am using with the voltage that resulted from the circuitlab simulation. I am using the closed components available to simulate your circuit in the circuitlab. Please check it to see if the components used simulate your circuit. Also the simulation showed a zero volt at the mosfet gate. Let me know any changes that I need to do to simulate your circuit. The circuitlab  just have the right components necessary to be able to simulate a circuit. I have the limit edition.

 
Title: Re: MOSFET ON by default when arduino is off.
Post by: TomGeorge on Apr 11, 2017, 07:35 am
Hi,
You have the gate to ground which is one of the arduino outputs, now put it at 5V.
(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=207905)
Tom... :)
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 09:11 am
Hi,
Attached it is the drawing I am using for the simulation.The mosfet it is connected to ground or not. I need to know what is in the circle in red.
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 09:31 am
Hi,

Thank you very much TomGeorge that it is what I have been asking. Why in the schematic the mosfet was connected to  ground? Now when he remove the arduino it will zero the mosfet gate and it wii short the battery. I still does not understand why do not let the battery charging than shorting it.I would let the battery charging. The diode will isolate the battery when there is not light and the solar panel will not discharge the battery. I think now we are working as A team.
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 04:31 pm
Hi,
I ran a test using a switch to simulate when the arduino was IN and OUT. Everything ran OKAY with no problem.

Attached it is the schematic with the voltages in RED when the Arduino was IN and the BLUE when it was OUT.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 11, 2017, 04:46 pm
Hi Tauro0221, sorry I forget to mention that SWITCH "I" in my schema is like the output pin of arduino.

SI2302 works with Vgs >= 2.5V, I will work with 3.3V in my arduino.

I have attached two schemas here:

1. one with arduino output LOW --> mosfet OFF, so solar panel current goes to the battery.Charging process.
2. antoher one with arduino output HIGH --> mosfet ON, so solar panel is shorted. No energy to the battery

Gate is connected to ground thorugh R25 to mantain mosfet OFF when arduino is off or missed(just in case)

(in the first schema, you have the solar panel model that you said and works perfect !!!)

So then, could be this a solution for low power panels ?

(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=207972)


(http://forum.arduino.cc/index.php?action=dlattach;topic=459912.0;attach=207974)
Title: Re: MOSFET ON by default when arduino is off.
Post by: tauro0221 on Apr 11, 2017, 04:53 pm
Hi,

Yes, That will work. I have a question. Why you have to short the solar panel? Any reason why you do it.
Title: Re: MOSFET ON by default when arduino is off.
Post by: juan3211 on Apr 11, 2017, 04:58 pm
Hi,

Yes, That will work. I have a question. Why you have to short the solar panel? Any reason why you do it.
HI, I want to short it to protect battery for overvoltage. For a solar panel there is no problem to short circuit it.

I want to program it this way:

1. if battery is > 4.2V, disconnect solar panel by short circuiting it with mosfet. Mosfet ON
2. If battery is < 3.8V, connect solar panel by mosfet OFF
3. If battery is < 3.6V send a SMS or HTTP GET to a WEB to call for help as the battery will be ruined if there is not more solar power to recharge it.