Go Down

Topic: MOSFET ON by default when arduino is off. (Read 6740 times) previous topic - next topic

juan3211

Mar 03, 2017, 08:32 pm Last Edit: Mar 03, 2017, 08:38 pm by juan3211
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.








CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

juan3211

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


MarkT

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.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

TomGeorge

#4
Mar 04, 2017, 01:59 am Last Edit: Mar 04, 2017, 02:00 am by TomGeorge
Hi
OPs circuit.

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.. :)
Everything runs on smoke, let the smoke out, it stops running....

juan3211

Hi
OPs circuit.

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.


juan3211

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,


TomGeorge

#7
Mar 04, 2017, 09:19 am Last Edit: Mar 04, 2017, 09:20 am by TomGeorge
Hi,
Move the earth like i advised earlier.

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

stuart0

#8
Mar 04, 2017, 10:17 am Last Edit: Mar 04, 2017, 10:33 am by stuart0
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.

MarkT

Hi,
Move the earth like i advised earlier.

Tom.... :)
No, definitely don't move the ground there!
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

stuart0

#10
Mar 04, 2017, 02:46 pm Last Edit: Mar 04, 2017, 02:49 pm by stuart0
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).

juan3211

#11
Mar 04, 2017, 10:41 pm Last Edit: Mar 04, 2017, 10:46 pm by juan3211
Hi,
Move the earth like i advised earlier.

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.



allanhurst

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

juan3211

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,

stuart0

#14
Mar 05, 2017, 02:46 am Last Edit: Mar 05, 2017, 03:13 am by stuart0
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).


Go Up