1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

A pic based Charge Controller

Discussion in 'Renewable Energy' started by bryan1, Sep 18, 2009.

  1. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,162
    Likes:
    340
    Location:
    Brisbane Australia
    Thanks Jason,

    The video looks good. I may have to buy a copy of Proteus. It looks really useful.

    I guess you can remove the resistors all together. However, on the actual hardware the diodes or 1K resistors are needed (in the original position) otherwise, when two buttons are pressed at the same time it shorts two of the LCD data lines. Not good.

    Mike.
     
  3. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,162
    Likes:
    340
    Location:
    Brisbane Australia
    Sorry for ignoring you, only just noticed the post.

    The way the keys are read is by pulling A6 low and reading the data pins therefore reading them all at once.

    Mike.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US

    Mike quick fix for me would be to use RB0:RB4 for Buttons and RB5:RB7 for LCD.
    i would just have to use diodes or resistor for RB6-7

    or better yet use a Shift register with Latch 595 perhaps, since you wanted to save all INTx and ANx
     
    Last edited: Sep 28, 2009
  6. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,162
    Likes:
    340
    Location:
    Brisbane Australia
    I did it the way it is to use the minimum number of pins and keep as much of the other hardware free. Don't know why it didn't work on the simulator.

    Anyway, next step is to get some kinda boost converter working. Guess I should post a thread in the general section and see if one of the analogue guys can help.

    Mike.
     
  7. nickelflippr

    nickelflippr Member

    Joined:
    Oct 20, 2006
    Messages:
    891
    Likes:
    18
    Location:
    Oregon, USA
    No problem, it looks like I had my logic backwards (which is the norm for me), thinking A6 was high before seeing the code. Made up a little key pad so will have to add the diodes/resistors and give it a go, looks good!

    Using the 8Mhz internal oscillator the best PWM resolution is only 8 bits. So at best with a 5V reference you have 0.02V steps. Multiply that by the divider of four for a final 0.1V resolution. Is that good enough? Using an external oscillator, or an 18f with HSPLL , you could get that to ten bits I think, or 0.02V final resolution.

    More bloat to add?, red led- bulk charge, orange led- absorb charge, green led- float charge, and led for dump load.

    EDIT: This is going to be a buck converter for me, as the open circuit voltage is around 21V for the so called 12V panel.
     
    Last edited: Sep 28, 2009
  8. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    I posted reply in the new thread Pommie made. I really don't think it's worth trying to do SMPS MPPT on a 12v to 12v system. The power gains are too small for that much complexity and reliability.
     
  9. nickelflippr

    nickelflippr Member

    Joined:
    Oct 20, 2006
    Messages:
    891
    Likes:
    18
    Location:
    Oregon, USA
    The MPPT part was going to be the last thing on my list. Would be interesting to fiddle with, if only for the educational part. Have most all the parts I think.

    Going to follow the PicDem Buck Development board schematic, and try out a tc4426 inverting mosfet driver and a irfr5023 p-channel mosfet for the voltage control mode next.

    Any, and all insights, much appreciated:).
     
  10. weglobal

    weglobal New Member

    Joined:
    Aug 20, 2008
    Messages:
    9
    Likes:
    0
    Hi
    I need a help to design a battery charger from solar panel , I have a 6V 2.2W solar panel which I am connecting to a 3.6V NIMH 2500mAh battery, I want to use a MOSFET as switch so I will be monitoring the bat voltage , when rich 4.5V the MOSFET will be turned OFF , the reason also that I am using the MOSFET is to not have too much losses and also for power of thr battery not to come back to the solar once the MOSFET is OFF and solar voltage is lower than the Battery.
     
  11. ravimarcus

    ravimarcus New Member

    Joined:
    Aug 8, 2007
    Messages:
    6
    Likes:
    0
    Hi,

    I am working on a MPPT charger for 12V panels using a PICmicro.

    The panel is connected to a variable buck converter and then to a battery. The PICmicro monitors the PV, PI, BV and BI. The buck converter reference is varied based on the power input and output calculations to achieve MPPT.

    I have the PCB ready and am yet to develop the software for this. Hope this idea works out.

    Cheers

    Ravi
     
  12. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    Ok I've finished a version of a PIC 12F675 based solar battery charge controller. All the source code is open source in Mikro C compiler. It's using a little PCB I created that all mounts on the back of the 16x2 LCD.

    It's fairly sophisticated in that it can be set to display battery voltage 6v 12v 24v 36v 48v etc and the setpoint voltage (where charging cuts out) can be adjusted in 0.02v steps (with a 12v system) and the settings all save to eeprom so they remain when next powered up.

    It's a bit crude in that it only has the most basic of features to display the battery voltage, setpoint voltage and whether the load is on etc. I couldn't fit too many more features in as the little 1k memory in the 12F675 is pretty much maxed out. So it's got no datalogging or niceties like that.

    [​IMG]

    This is the charge controller mounted on the back of a 16x2 LCD, it uses the little Shift1-LCD PCB I designed;

    [​IMG]

    [​IMG]

    For this solar charge controller it doesn't need much more than a pot to calibrate the battery voltage, 2 buttons, and a transistor and relay to turn the Load on/off.

    More info and schematic etc can be found on this page (all code and design is open source);
    Shift1-LCD Projects

    And Bryan1, I'm quite happy to send you a free assembled PCB with the PIC and charge controller firmware already installed. In return I'd just like a photo of how you used it to put up on my web page. I don't have any spare text LCDs at the moment (for some reason i have gone through a lot lately ;)) so you need to supply your own 16x2 LCD.
     
  13. Jeff Birkle

    Jeff Birkle New Member

    Joined:
    Nov 4, 2009
    Messages:
    9
    Likes:
    0
    Hey Guys

    I'm new to this site.
    This is awesome.
    Just what I've been looking for.
    I have some parts and wanted to build an MPPT for wind and hydro with a DC KWH meter since it will use the same pic controller.
    Amps will be up to almost 200 with wind so I would rather use a shunt as opposed to a hall sensor.
    I'll reread this post to absorb more and keep in touch.

    Thanx
     
  14. ameal

    ameal New Member

    Joined:
    Aug 24, 2008
    Messages:
    28
    Likes:
    0
    Location:
    Coimbra, Portugal
    Fet drivers

    It seems that the LM27222 is a very well designed driver, with control outputs for N-MOSFET,
    either high and low side gates with diode emulation specific for buck designs.
    It really worths a look from everyone. It will work with minimal components.

    best regards
     
  15. chokchai

    chokchai New Member

    Joined:
    Apr 8, 2009
    Messages:
    4
    Likes:
    0
    Location:
    Thailand
  16. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    I'll comment. I think it is extremely over-complicated for the task it does. Also the PCB designer doesn't seem to have a good grasp of SMPS PCB layout.

    But he gets full points for releasing all the schematic and source code for free, there has obviously been a lot of work gone into it.
     
  17. Oznog

    Oznog Active Member

    Joined:
    Apr 21, 2004
    Messages:
    2,879
    Likes:
    11
    Location:
    Austin, Tx
    Well, a buck or buck/boost has its own losses. If you do EXTREMELY good design, they can be quite low, if you know what you're doing but just make a basic effort it could still be like 10% loss, if you don't know what you're doing and copy something off the Internet and use a random surplus inductor and transistor you could get 30% loss.

    Capacitor losses can be significant too. Low ESR caps that handle amps of ripple are expensive and never really as "low ESR" as you want. Ceramic MLCCs rock in this area, BTW.

    The problem with PIC as a SMPS controller is not so much lack of resolution but lack of resolution at high freq. A well designed controller is in the 50KHz-500KHz range, or even well into the MHz range. Even operating at 10MIPs, the duty cycle resolution on a 1MHz PWM is very poor. Lowering the freq increases the resolution, but lower freq requires much larger and more expensive caps and inductors. And, notably, an inductor of a specific size may come in 20 different uH values- but the higher inductance ones have proportionally higher wire resistances and thus higher I^2*R losses. So 50KHz may be prohibitively low for a "real" SMPS.

    On the other hand, higher freq increases the core losses and switching losses. Also potentially very significant and something to "worry about".

    Also, consider this-
    A PIC board running at max freq with an LCD may need 30mA, and if you use a linear reg, that's 30mA off the main batt 24 hrs a day. Not insignificant considering it's only helping 8 hrs or so out of the day. Proper use of Sleep mode will help, but you may need to shut down the PWM entirely, which is ok for night. There are also PIC chips where you can keep the PWM active while putting the instruction core into Sleep for awhile; the current will not be as low as total Sleep but much lower. Anyhow, my point there is you can't neglect the power required for the board in the budget for calculating the advantages of an MPPT.
     
    Last edited: Dec 15, 2009
  18. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    Hi Oznog, some good points you raised there.

    As for the current requirement, my Shift1-LCD charge controller (which is not SMPS or MPPT, just charge on-off) only takes 4mA for the PIC 12F675 and LCD, the PIC takes about 1mA (using 4MHz internal osc) and the LCD (with no backlight) is typically around 3mA. I have tested this on a few Shift1-LCD projects.

    The big hog would be a standard 7805 regulator, they take 6mA or so quiescent current, total waste since the entire app only needs 4mA. These days I use a lot of SMD 5v regulators which only waste a few uA.

    I really wouldn't bother with MPPT on most 12v solar apps unless it was something very specialised.
     
  19. ameal

    ameal New Member

    Joined:
    Aug 24, 2008
    Messages:
    28
    Likes:
    0
    Location:
    Coimbra, Portugal
    my panels are 175w units with Vopen of 42Volts. I´ll reduce those to 12v.
    Connecting directy to the battery i have 5Amps, but with MPPT i´de have about 20Amp.
    so i have much to gain and i´m ansiously waiting for pointers to start testing.

    As soon as i finish my egg incubator (within a month) i´ll start on this.
     
  20. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    Why would you connect 24v solar panels to a 12v battery and complain you only get 5A?
     
  21. smanches

    smanches New Member

    Joined:
    Mar 5, 2009
    Messages:
    986
    Likes:
    8
    Location:
    Oregon, USA
    It's not the MPPT giving you the bulk of the gain, it's just the fact that it's a switching (buck) charger. MPPT is useful in the "not optimal" conditions. In optimal conditions, it doesn't make that much of a difference.
     
    Last edited: Dec 18, 2009

Share This Page