Shop OBEX P1 Docs P2 Docs Learn Events
PWM Solar Charge controller (Restarting old project) — Parallax Forums

PWM Solar Charge controller (Restarting old project)

eagletalontimeagletalontim Posts: 1,399
edited 2014-08-29 15:43 in Propeller 1
I am back at it again and this time with a little more knowledge I hope :P I just recently bought some 12V solar panels and should be able to make around 200W to start with. I do plan on buying several more panels, but I need to be able to regulate what level the batteries charge to. I know there are a few ways to do this, but I would like to use a Prop to control the charging.

Some components I already have and am hoping I can use these P-Channel mosfets instead of buying parts if I can help it. Here is the mosfet I have :

http://www.digikey.com/product-detail/en/DMP3010LK3-13/DMP3010LK3-13DITR-ND/3076559 : 17A continuous

The first one is probably my best bet since it has higher amperage abilities. Problem is, 200W at 12V is 16.7A which is right on the verge of max. Is it possible to "stack" this mosfet and increase amperage ability? I use basic transistors and resistors to drive this mosfet. I can build several "driver" circuits to accommodate the extra mosfet if it is possible.

Second question is... To properly charge a battery, I understand that dumping the maximum amperage into it until the "saturation level" has been hit then switching to voltage leveling is best. Is this correct and how would I detect that the charging needs to switch to "float"?

Edit * : I also have an 8 bit 5V ADC and was wondering if I could use a resistor voltage divider circuit to monitor the battery voltage with this ADC?
«1

Comments

  • kwinnkwinn Posts: 8,697
    edited 2014-08-16 10:03
    I am back at it again and this time with a little more knowledge I hope :P I just recently bought some 12V solar panels and should be able to make around 200W to start with. I do plan on buying several more panels, but I need to be able to regulate what level the batteries charge to. I know there are a few ways to do this, but I would like to use a Prop to control the charging.

    Some components I already have and am hoping I can use these P-Channel mosfets instead of buying parts if I can help it. Here is the mosfet I have :

    http://www.digikey.com/product-detail/en/DMP3010LK3-13/DMP3010LK3-13DITR-ND/3076559 : 17A continuous

    The first one is probably my best bet since it has higher amperage abilities. Problem is, 200W at 12V is 16.7A which is right on the verge of max. Is it possible to "stack" this mosfet and increase amperage ability? I use basic transistors and resistors to drive this mosfet. I can build several "driver" circuits to accommodate the extra mosfet if it is possible.

    Yes, you can put 2 mosfets in parallel to increase the current.
    Second question is... To properly charge a battery, I understand that dumping the maximum amperage into it until the "saturation level" has been hit then switching to voltage leveling is best. Is this correct and how would I detect that the charging needs to switch to "float"?

    The best charging method depends on the battery chemistry. What kind of batteries do you plan to use?

    Edit * : I also have an 8 bit 5V ADC and was wondering if I could use a resistor voltage divider circuit to monitor the battery voltage with this ADC?

    Yes, a resistor divider would work for monitoring the battery voltage. You will need to shut off the charging current (float) when measuring the battery voltage for determining if the battery is charged.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-16 10:42
    All I have right now is car batteries. I plan on getting deep cell marine batteries eventually. Is there a good formula I can use to figure max amperage for the MOSFETs in parallel? If I add 5 together all with different gate controllers, do they all need to be run from different pin on the prop? If not, how do I calculate the resistor value to drive all 3904 transistors?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-16 14:17
    The solar cell output current will vary with the amount of sunlight falling on the cell, and the voltage will vary with the load on the cell so the power available is rarely the 200W you get by multiplying the no load voltage by the current available in full sunlight. Those are maximum ratings.

    A 12V lead acid battery needs a13.8 to 14.4 V input voltage to charge it so you have three ways to approach this:

    1- Put 2 solar cells in series to get a high enough voltage to charge the battery.

    2- Use a switching regulator to boost the output voltage of a single solar cell.

    3- Use an MPPT charger.

    The MPPT charger is the most efficient method, and the two solar cells in series the least efficient.

    Car batteries are normally charged with a constant voltage, and deep discharge (marine) batteries can be charged with a constant voltage or a charge controller optimized for that type of battery to maximize the battery life.

    The mosfets you have will work if all you want to do is turn the charging current on and off, but not as a linear device to control the charging current. A single 200W solar cell or two cells in series would not put out enough current to damage a car battery as long as the charging current was turned off when the battery was fully charged.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-16 20:19
    So I just did some more reading up on an MPPT charge controller and WOW... I don't think I have the knowledge to build one on my own unfortunately. I plan to get over 1Kw solar eventually and don't want to keep having to upgrade parts for each panel added. Most of the items I have been getting are from Ebay since I am extremely limited on cash and I just don't think a cheap Ebay charge controller is what I should go with from the beginning. I would not know where to even start to design my own MPPT so that is probably out of the question unless someone has a full schematic and code for it for the Prop. The Obex seems to be broken at the moment so I can't search there for anything :(

    So from what I understand is with stationary panels, I will lose some of the panel's ability to charge the best. Moving the panels according to the best output via a processor like the Prop would be better. Problem is...in electronics, I know how to turn something on or off. Adjusting current or voltage without a linear / mechanical device is a little out of my realm at the moment but I would love to learn. I can spend hours of researching something, but I usually don't comprehend until I actually put my hands on it. If someone is willing to help me along as I lean to build this charge controller, I would greatly appreciate the teaching!

    What I would need to start with is the heart of the charging circuitry. In the above post it is stated "The mosfets you have will work if all you want to do is turn the charging current on and off, but not as a linear device to control the charging current." I don't quite understand this. I thought current was voltage and amperage moving through the circuit. The only way to change the amperage is to add resistance which will also reduce voltage but increase power dissipation which in turn creates heat. How is it possible to "digitally" adjust current? Using PWM would still cause the current to flow through the circuit as much as the circuit is set to handle correct? If you change the duty cycle of the PWM, the current does not change correct? I think I am confusing myself :P

    EDIT * I found an interesting item that may be useful in this circuit : http://www.panucatt.com/Current_Sensor_for_Arduino_p/cs-100a.htm
  • kwinnkwinn Posts: 8,697
    edited 2014-08-17 10:09
    So I just did some more reading up on an MPPT charge controller and WOW... I don't think I have the knowledge to build one on my own unfortunately. I plan to get over 1Kw solar eventually and don't want to keep having to upgrade parts for each panel added. Most of the items I have been getting are from Ebay since I am extremely limited on cash and I just don't think a cheap Ebay charge controller is what I should go with from the beginning. I would not know where to even start to design my own MPPT so that is probably out of the question unless someone has a full schematic and code for it for the Prop. The Obex seems to be broken at the moment so I can't search there for anything :(

    An MPPT charge controller is not a simple project. It involves two separate systems with fairly complex behaviours. The current draw from the solar panel needs to be controlled so that the maximum possible power (watts) are extracted from it, and the output voltage to the batteries controlled to provide the maximum charging current to the batteries. In addition to that it has to make sure that the batteries are not damaged by excessive input current or overcharging.

    In theory one should be able to do all of that by monitoring the input current and voltage to the batteries and using a propeller to control the output voltage of a switching regulator.

    So from what I understand is with stationary panels, I will lose some of the panel's ability to charge the best. Moving the panels according to the best output via a processor like the Prop would be better.

    Moving the panels to face the sun will produce more power from the solar panel, so better charging of the batteries. The motors to move the panels can be relatively small since the speed is very low. The motor controls can be a very simple on/off circuit using the mosfets you already have. You will need a potentiometer or encoder for panel position.
    the Problem is...in electronics, I know how to turn something on or off. Adjusting current or voltage without a linear / mechanical device is a little out of my realm at the moment but I would love to learn. I can spend hours of researching something, but I usually don't comprehend until I actually put my hands on it. If someone is willing to help me along as I lean to build this charge controller, I would greatly appreciate the teaching!

    What I would need to start with is the heart of the charging circuitry. In the above post it is stated "The mosfets you have will work if all you want to do is turn the charging current on and off, but not as a linear device to control the charging current." I don't quite understand this. I thought current was voltage and amperage moving through the circuit. The only way to change the amperage is to add resistance which will also reduce voltage but increase power dissipation which in turn creates heat. How is it possible to "digitally" adjust current? Using PWM would still cause the current to flow through the circuit as much as the circuit is set to handle correct? If you change the duty cycle of the PWM, the current does not change correct? I think I am confusing myself :P

    What I meant by the sentence you quoted is that if you put the mosfet between two panels in series and the battery it would work as an on/off switch. If you tried to adjust the current through the mosfet by reducing it's gate voltage it would overheat and burn out. Using PWM would allow you to control the average charge current. If the solar panel could produce 10A and the mosfet was on for 50% of the time the average current would be 5A.

    Before I make any suggestions it would be nice to have a look at the data sheet for the solar panel. Can you post a link to it, or the part/model number?

    The current sensor you found could be useful but I would suggest looking at the INA219 (http://www.parallax.com/product/29130) before deciding. It is meant for use with solar panels, provides current, voltage, and power readings, and has sample software for the propeller.
    EDIT * I found an interesting item that may be useful in this circuit : http://www.panucatt.com/Current_Sensor_for_Arduino_p/cs-100a.htm
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-17 10:50
    Here is one of the panels I bought. I have some individual cells and some EVA material coming as well for a separate panel I want to tinker with. The problem with the Parallax INA219 is that it can only handle 3.2A which is WAY below what I am shooting for. If figured 2 current sensors and 2 ADC IC's would be able to handle the incoming voltage and amperage along with the battery voltage and outgoing current to the load(s).

    http://www.ebay.com/itm/271576325290
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-17 15:49
    I just got done building a PWM controller to test my abilities with the Prop and the Mosfets. I am using 1 NPN transistor and 2 P-Channel Mosfets. With the proper resistor values, the mosfets don't even get warm and the motor increments speed as the program increases the pulse width. Once it gets to 100% duty cycle, it drops back to 0% and continues from there. I honestly don't know how much amperage this circuit can handle, but I was reading over 2A draw on the motor and there was no heat even if I held the motor from spinning when the Duty Cycle was under 20%. Anything over that, I could not hold the shaft still anymore.

    With the above circuit, I could only use this for the solar charger to just turn the current on or off correct? I can't limit the current using PWM? Is there a reason why these mosfets will not work for an MPPT charger? Some of the other circuits I have seen for MPPT chargers use even lower rated mosfets than the ones I have.
  • kwinnkwinn Posts: 8,697
    edited 2014-08-17 17:11
    The INA219 current sensing resistor can be changed to handle higher currents. Changing to a 0.01 ohm resistor would give you a 0 to 32A range.

    Unfortunately not much information on that solar panel. You will need to do some experimenting to use it.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-17 17:41
    So basically, there is no such thing as an all in one MPPT controller that can handle any solar input between the range of 12V to 36V and under 100A? The controller will have to be build specifically to the panels?

    I have replaced the motor with a speaker and was playing with the PWM code to see how the Duty Cycle affects the sound vs the "Period" the pulse stays high. The longer the pulse stays high, the more current passes through at the input voltage. When I shorten the period, the amperage decreases and the voltage fluctuates. Is this what you were meaning by "linear" control?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-17 20:06
    So basically, there is no such thing as an all in one MPPT controller that can handle any solar input between the range of 12V to 36V and under 100A? The controller will have to be build specifically to the panels?

    I have replaced the motor with a speaker and was playing with the PWM code to see how the Duty Cycle affects the sound vs the "Period" the pulse stays high. The longer the pulse stays high, the more current passes through at the input voltage. When I shorten the period, the amperage decreases and the voltage fluctuates. Is this what you were meaning by "linear" control?

    I am far from being an expert on all that is available in the solar energy industry, but generally speaking the solar panels, MPPT controllers, and batteries are a matched set. The solar panels are selected based on the power requirement and average sunlight at the location, the MPPT controller based on the peak power available and the charging voltage requirement, and the batteries on the power storage capacity.

    The average charging current going to the batteries can be controlled with PWM, but it is a very inefficient way of doing it. For instance, if you wanted to reduce the average current to 50% of what is available you would turn the mosfet on for 50% of the time and off for 50%. That means you are loosing half of the power the solar panel could produce. To make a solar installation as economically viable as possible you want to use every watt the solar panel can produce to charge batteries or power your equipment.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-17 20:13
    I have been reading up on Buck converters which I think would be what needed to the controlled via PWM. Not using PWM directly to the battery. I happen to have 100ft 12G magnet wire that may work for the inductor. One thing I don't quite get yet is the voltage coming in from the panels at say 26V. Would running this through a buck converter controlled with PWM cause the voltage to drop to the desired 13.8V but not the available amperage? If the amperage does drop, is it less than just running PWM directly from the source to the battery?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-17 20:21
    PS - What I meant by linear control was that the gate voltage on the mosfet is varied so that the resistance between the source and drain of the mosfet increases to reduce the total current. Think of it as having a potentiometer/rheostat between the battery and the solar panel. Problem with this is that the mosfet will now be dissipating quite a bit of power ( I squared x R ). When the mosfet is on it has very low resistance so the high current causes very little heating. When the mosfet is off the resistance is very high so the current is miniscule and the power dissipation is very low. Between those two states power dissipation is much higher.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-17 21:13
    One question I do have is during charging, can I put say 70 volts into the battery until the battery reaches max battery voltage of say 13.8V? Once it reaches the 13.8V, adjust the PWM to reduce the output voltage down to 13.8V?
  • jmgjmg Posts: 15,173
    edited 2014-08-18 02:30
    One question I do have is during charging, can I put say 70 volts into the battery until the battery reaches max battery voltage of say 13.8V? Once it reaches the 13.8V, adjust the PWM to reduce the output voltage down to 13.8V?

    70 Volts ? I presume you mean the full solar energy, which will act like a current source rather than a voltage source.

    Do you plan to use an inductor ?
    The simplest controllers would just be a series On-Off switch, to set the average current.
    However, you need to measure the battery voltage, and with both operating load and charge currents flowing, that is not so easy.
    You also want to reduce the current swings into the battery, which means a proper inductor, synchronous switching and smoothed regulator and an accurate means to measure both Load and Battery currents.
    Add measure of Solar Voltage and Current, and MPPT is not much of a step from there - you do not need to tune that operating point every switching cycle, but can do a slower triangle modulated sweep to check the peak power is in the centre.
    A first pass design can just use a lookup for the V/I locus, and then you can add MPPT and see how much power you really gain, for how much effort.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-18 04:30
    I do plan on using an inductor but I don't know how many wraps of wire or what gauge wire I need. I was incorrect in the size magnet wire I already have. It is actually 16 gauge. So far from what I am seeing, I need 3 current sensors, and 3 voltage sensors? One for solar in, one for charge to battery, and another voltage out to load.
  • kwinnkwinn Posts: 8,697
    edited 2014-08-18 05:52
    I have been reading up on Buck converters which I think would be what needed to the controlled via PWM. Not using PWM directly to the battery. I happen to have 100ft 12G magnet wire that may work for the inductor. One thing I don't quite get yet is the voltage coming in from the panels at say 26V. Would running this through a buck converter controlled with PWM cause the voltage to drop to the desired 13.8V but not the available amperage? If the amperage does drop, is it less than just running PWM directly from the source to the battery?

    Using a buck converter to regulate the incoming 26V to 13.8V would increase the current going to the battery.

    Lets assume the buck converter has 90% efficiency and the solar panel puts out 26V and 10A, so 260W total.

    The formula to calculate the output current would be Iin x Vin/Vout x Converter Efficiency.

    Iin = 10A, Vin = 26V, Vout = 13.8V, and converter efficiency is 90% or 0.9 so:

    The buck converter would output 13.8V and (10 x 26/13.8 x 0.9 = 16.96A) which would be 234W
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-18 07:29
    So how do I reduce current and adjust the voltage to 13.8v for the float mode?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-18 11:28
    So how do I reduce current and adjust the voltage to 13.8v for the float mode?

    The simplest way would be to use a switching regulator with an adjustable output voltage. Increasing the output voltage will increase the current going to the battery, decreasing the voltage will decrease the current to the battery. A propeller or other uC would control the output voltage based on the input and output voltage/current measurements. Of course the switching regulator has to be able to handle the maximum incoming voltage and current as well as the outgoing current. Not quite as good as an MPPT controller, but probably the next best choice.

    There are several types of solar power systems and the design varies depending on it's usage. A system for powering a remote weather station would need to power the station during the day and charge a battery to power it during the night and on overcast days. A system for outdoor lighting would only need to charge the batteries during the day, and the batteries would power the lights at night.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-18 12:43
    If I use the buck converter for the main charge, could I still use it for the float charge as well? Instead of pumping as much power needed to hit maximum watts, could the float mode just adjust the pwm to reduce the voltage down to the desired level or do I need a separate circuit for the float mode?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-18 21:11
    No need for PWM or a separate circuit for float mode. You reduce the output voltage of the buck converter until the current drops to the desired level. When the buck converter output equals the battery voltage the current is zero. You may need a diode between the buck converter and the battery to prevent reverse current flow.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-18 21:33
    I thought to adjust voltage out of the buck controller, you adjust the PWM duty cycle lower?

    Also... I made my own hand wound inductor with a ferrite core from RadioShack and some 16G enamel coated wire I have. It is about 30 wraps around a 3/8" square core. I do plan on getting something better as soon as I figure out what would be better.... When running the PWM, I can actually hear the inductor doing it's thing. Is there a specific frequency I should run this at? I have seen 20khz to 80khz but my mosfet / driver cannot do that since the best I was able to get on my O-scope before there was no "calulatable frequency" was around 10khz. The faster I got the frequency, the hotter the mosfet started to get. If I ran the duty cycle down lower than 50%, it would heat up way too hot and I shut down the circuit.
  • kwinnkwinn Posts: 8,697
    edited 2014-08-19 07:18
    It sounds like you are building your own buck converter with that inductor and mosfet. If the mosfet gate driver does not provide enough current to turn the mosfet on and off quickly it will spend more time in the linear region and get hot. The higher the frequency the more time in the linear region. Need to see a schematic to verify this is what is happening, but it is the most likely answer.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-19 09:58
    I can post a schematic when I get home from work. The pwm code I am using is the pwm asm found in the obex. In the code, you can set the period and the duty cycle. The period is based off clock cycles. How can I determined the value to set in the period value to set the frequency to 20khz?
  • kwinnkwinn Posts: 8,697
    edited 2014-08-19 15:21
    For 20KHz the period would be 50 microseconds.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-19 17:29
    Ok, here is the schematic of the circuit I currently have. I think I found one design flaw just by drawing it out... The mosfet gate gets pulled up to whatever the input voltage is and I think that is an issue. I will have to pull it up to the 12V battery instead of the 24 + volts I plan on running into the circuit.
    1024 x 288 - 22K
  • kwinnkwinn Posts: 8,697
    edited 2014-08-19 19:26
    Ok, here is the schematic of the circuit I currently have. I think I found one design flaw just by drawing it out... The mosfet gate gets pulled up to whatever the input voltage is and I think that is an issue. I will have to pull it up to the 12V battery instead of the 24 + volts I plan on running into the circuit.

    No, pulling the gate up to the input voltage (+24V) is not the problem. This is a P channel enhancement mode mosfet so the gate needs to be at +24V to turn it off. The problem is that the gate (which has capacitance) has to charge and discharge through the 220 and 330 ohm resistors, which takes time. During that time power is dissipated so the more often you turn it on and off the more power the mosfet has to dissipate and the warmer it gets. This is why a gate driver is used. It charges and discharges the mosfet gate capacitance much faster so less power is dissipated.
  • jmgjmg Posts: 15,173
    edited 2014-08-19 19:28
    At these power levels, you will need a 'proper' FET driver

    - Take a look at some of the data sheets on here
    http://www.linear.com/parametric/Switching_Battery_Chargers

    This app note has a variant on a MPPT
    http://cds.linear.com/docs/en/lt-journal/LTJournal-V22N2-01-df-LT3796-XinQi.pdf

    and this app note looks to have a good topology
    http://ww1.microchip.com/downloads/en/AppNotes/01467A.pdf

    (note this design can have vin pass through VBat)

    It mentions using NCO, and a Pulse Frequency mode, so maybe the Prop can drive the MCP14628* with Pulse Frequency mode managed by one COG ?
    ( or just use the PIC16F1503, as they are cheap enough )

    Addit: * the MCP14628 looks to be 5V optimised, so either use a 74LVC1T45 interface, or find a 3v3 MOSFET driver to direct connect the Prop.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-19 20:01
    Since I can't afford to buy a PCB, I am hoping to stay with through hole components. And.. Since I have over 200 Watts of 12V (22 to 24V output) solar panels coming in, I need to have a charge controller that can handle this and plenty more room for double or triple the input. Should I just bite the bullet and buy a ready made one or should I buy parts to build my own?

    Since it appears my mosfets will not be able to be driven with my current inventory, I will need to buy parts. If I buy parts, I might as well buy the right stuff the first time so I don't have to keep upgrading every time I get more panels. Is there an all around good mosfet and driver that I should look into that can handle the very minimum of 20A and can handle the 20 to 50 khz?

    I found this FET which looks like it can handle the voltages and current, but I am not sure if it can handle the frequency or what driver to use with it. Are all drivers good for any FET (Mosfets)?

    @jmg, the MCP14628 only handles 2A. The system I am working to set up would fry that instantly correct? (Hmmm. I think I see what this part is now. For some reason I was thinking this was the mosfet. This is a driver....)
  • fridafrida Posts: 155
    edited 2014-08-20 01:23
    In the picture you draw:
    Where deliver the coil its stored enegi?
    Should the diode not be placed on the other side of the coil?
  • CRST1CRST1 Posts: 103
    edited 2014-08-20 04:06
    Take a look at IGBTs. At work all high current drives and dc buss choppers use IGBT to switch. We have up to 150 HP 300 amp units. The choppers regulate the dc buss to 850 volts thru an IGBT to a 4 ohm resistor pack with PWM.
Sign In or Register to comment.