Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Universal Battery Charger

Status
Not open for further replies.
Thanks! ..........
Saludos o Regards
Felixls.

Hi Felixls : I have done a digital power supply, sometime ago with a PIC 16F628 and ADC0808 (0 to 12V @ 500mA), I'm modifying the code and h/w to adapt to a 16F877 and this time 0 to 24V @ 10A :cool:. 16F877 is a nice chip with lots of built in A/D, PWM and more... I read the datasheet only today :roll: Of course I'm copying some design ideas from a HP power supply that I have (e.g., storing and recalling of settings, holding a button for about 2 seconds goes into HP setup and so on...) The HP power supply that I have is around 12 years old and very much current limited 1A, however it has got some great features like +/- 25 V, isolated ground and more.... Once I'm done with the H/W and S/W I'll share the details on my website. So stay tuned for the demo... :smile:
 

I finished similar charger but I have problem I can't figure out. When I charge lead acid battery during Constant Voltage charge 14.4V current is not constant. It's changing rapidly, for example it should be 0.5A and slowly decreasing but i have moments when battery is getting 1A or 0.2A and returns to normal charging. What could be wrong ?
Software it's so simple that it must be right. I have two batteries, they are not new but still working.


if (type==CV_LA)
{
if ((Vbat>14.4) && ((OCR1A & 0x1FF) != 0) ) { OCR1A--;}
if ((Vbat<14.4) && ((OCR1A & 0x1FF )!= 0x1ff)&&(Ibat<Imax_LA)) { OCR1A++;}
if ((Ibat<IfinishLA)&&(Vbat>=14.4)) { flag=charged; OCR1A=0;}
}
 

Have you had a look at Felixls code to see how he has done it, I think it's a few post above it may help you has this is all working
Felixls has now shared his code for this wonderful project. :grin:
 

Yes, I saw it.

This part
Code:
void incduty(int value)
{
  pwmduty += value;
  if (pwmduty > 255)
    pwmduty = 255;
}

void decduty(int value)
{
  if (pwmduty < value)
    pwmduty = 0;
  else
    pwmduty -= value;
}
.....
.....
case 1:
      if (actualvoltage > normalchargevoltagecontrol)
        decduty(1);
      else if (actualvoltage < normalchargevoltagecontrol)
        incduty(1);

      if (actualcurrent < finalcurrentcontrol)
      {
        print("#END:CC\n");
        stopCharge();
        return;
      }
     
      break;


I think my code do exactly the same thing but it is a little more compact.
 
Last edited:

Well is the reading on the LCD or the actual current reading on your multi-reader giving fasle readings?

Are you reading the current correctly ?
does your other routines have stable current reading and charging current ?
Have you treid a short delay in between reading and inc OCR1A or decOCR1A

The list is endless

To me you may be looking in one area and the problem may be another, Don't all ways assume that your code must be right, Well it does not seem right after all if your code was right then you would not have this problem.
Aslo what makes it harder is everybody writes code differently which makes is harder to understand what the code is doing, yes it may look simple to you but you have wrote it and you know what you want it to do, I have been reading trhough Felixls's code and after studying and studying I'm getting to understand how it works and what it does, can you see where I'm coming from we can't see all your code and hardware set up so it makes it a bit harder to try and help.
 

Well is the reading on the LCD or the actual current reading on your multi-reader giving fasle readings?

Are you reading the current correctly ?
does your other routines have stable current reading and charging current ?
Have you treid a short delay in between reading and inc OCR1A or decOCR1A

The list is endless .....

Wizpic: I agree with you, there are so many things that can go wrong in the code or hardware. One example may be "you are not measuring the current across the shunt resistor". Happened to me once when I was designing my first power supply. I pulled out the negative pin from across the power ground instead of the shunt and hence things did not work as I expected :oops:

michalo: Now coming to your code you wrote:
if (type==CV_LA)
{
if ((Vbat>14.4) && ((OCR1A & 0x1FF) != 0) ) { OCR1A--;}
if ((Vbat<14.4) && ((OCR1A & 0x1FF )!= 0x1ff)&&(Ibat<Imax_LA)) { OCR1A++;}
if ((Ibat<IfinishLA)&&(Vbat>=14.4)) { flag=charged; OCR1A=0;}
}

Look at the precedence of the operators. The brackets are evaluated first, then the != is evaluated because it is in brackets and then finally the && condition. Remember the entire && is not evaluated if one of the condition fails. This means if Vbat < 14.4; the rest of the condition is not evaluated (which you maybe expecting it to do).
I would recommend that you break down the code into simpler parts like one shown below and debug step by step. Then you can consolidate the code on step at a time and make it harder for someone else to read, understand and digest :twisted:
Code:
if(Vbat > 14.4) 
{
    if(((OCR1A & 0x1FF) != 0))) {  OCR1A--; }
}
else if (Vbat<14.4)
{
    if(((OCR1A & 0x1FF )!= 0x1ff))
    {
          if ((Ibat<Imax_LA))
             OCR1A++;
    }

}
 

As promised here is my very own version of the digitally controlled power supply. The code has been written in C, and compiled using HiTech-C compiler (lite mode enabled due to evaluation expiration). I have included all the details on my website which is located **broken link removed**
 

As promised here is my very own version of the digitally controlled power supply. The code has been written in C, and compiled using HiTech-C compiler (lite mode enabled due to evaluation expiration). I have included all the details on my website which is located **broken link removed**

You may be better off starting a new thread, I've looked on your web site, The shcematics are not showing yet.
Don't get me wrong I know this was published in Elktor which started others to copy the design and add there own control panels to it, But I remember reading on some web sites that did share this type of project and they pulled it off there web site due to it been unstable and gave full output voltage under certain load conditions and a high ripple.
Have you carried out a short circuit test ?
By this I mean set the voltae to 100mv current to max and short circuit the ouput terminals and see what happens, you will find it will give max output curent or dooms day and the transistors go pop (bang),but if left for longer everything will start and overheat, This test will prove how good the current protection is, I'm not saying this is what you would do under normal conditions. But it was a test I was asked to carry out when I re-deisnged a PSU (attached).
You may have this all ready covered in you software side and shut of the output voltage. It may be worth considering some thing like that.

Aslo have you carried out a test to see what the max ripple is over the entier current range set the voltage to max and drawed the max current to see the max ripple will be and how hot the drive/output transistors will get not for long period's obviously but these are just some of the tests to carry out this will prove how good the PSU is.

Like I said don't get me wrong and I'm not knocking your project or your hard work it was just some of the things pointed out to me and When I did I was supprised how the PSU reacted to the various tests I carried out.

Keep up the good work.
 

Attachments

  • EL power supply.pdf
    193.4 KB · Views: 276

You may be better off starting a new thread, I've looked on your web site, The shcematics are not showing yet.
Yes, I know I'm working on putting the file up as a PDF. I still have a long way to go to install the PDF writer, and see how to convert the word art document into a PDF that is useable. The schematics are similar to the one in Elektor :)
Have you carried out a short circuit test ?
By this I mean set the voltae to 100mv current to max and short circuit the ouput terminals and see what happens, you will find it will give max output curent or dooms day and the transistors go pop (bang),but if left for longer everything will start and overheat, This test will prove how good the current protection is, I'm not saying this is what you would do under normal conditions. But it was a test I was asked to carry out when I re-deisnged a PSU (attached).
You may have this all ready covered in you software side and shut of the output voltage. It may be worth considering some thing like that.

Dude, you are way too fast!! Have you read the "About Me" section on my website. If yes, you'd have figured out that I'm an Engineer with a Masters in Electrical Engineering :grin: Given that, you'd have expected that I would have done some real hard core testing. In fact I have done more tests then you have written. As you'd have seen on my website "JagiChan is an Evil Engineer; putting stuff to gruelling tests" :twisted: There is a quote that states, "Build something that even a fool can use and only a fool will use it!!". I follow the principle in the quote 8)

Like I said don't get me wrong and I'm not knocking your project or your hard work it was just some of the things pointed out to me and When I did I was supprised how the PSU reacted to the various tests I carried out.
Thank you for the nice comment, but you need wait a little longer, before I can provide some video's about the tests. To be really honest with you guys I don't know how to upload or post videos on my website. I'll have to contact someone on the M$ live to figure out how to do the same. Till then, WISHING YOU ALL A VERY HAPPY AND PROSPEROUS NEW YEAR 2011.
 

Sorry EEYE I have not read your web site about you, If I did I would of not said anything has it sounds you have everything in hand. I'll leave it you.
If you need help converting the word doc or any other format to PDF just PM me and I can do it for you.
Has for the videos why not jsut use youtube or ask Felixis has he has done it on his web site with links to youtube

Happy new year and all the best my friend

wizpic
 

If you need help converting the word doc or any other format to PDF just PM me and I can do it for you.
Has for the videos why not jsut use youtube or ask Felixis has he has done it on his web site with links to youtube wizpic

Dude thanks for asking to help out. I agree with you on using YouTube. I have created an account, uploaded the video and posted the link on my website and somehow by magic, it all seems to work. So check out the video on my website and I hope it answers your questions regarding the DPSU. The schematics will take a few more days... :)
 

eeye I have had a looked at the video and these are my thoughts and opinion about it.
First thing is the backlight for the LCD I found it irritating that it kept going on/off may be leave it on or even longer may be.
Second powering up a little motor and LED does not really put any load on the PSU, neither does it demonstrate the stability of the PSU. The same for powering up the inverter that just shows turning a LED on, You could demonstrate it powering up a drill or a lamp.
Third what does the meter readings read on the LCD compared to your multimeter ?
Please don't think that I'm been negative or slagging your project off, I'm sure that it is a good PSU design but what I have seen so far does not demonstrate the capability of your PSU.
 

Hi guys,

this is a very intersting project.
I have a question about the way the control.
Does the charger support different battery packs, without any modification?
I mean, can it charge nimh battery packs with 3 - 5 - 7 cells and so on, without any change to the circuit parameters?


thank a lot
B.
 
Last edited:

Hi guys,

this is a very intersting project.
I have a question about the way the control.
Does the charger support different battery packs, without any modification?
I mean, can it charge nimh battery packs with 3 - 5 - 7 cells and so on, without any change to the circuit parameters?


thank a lot
B.

Yes it does you just set it in the software no hardware changes required
 
Thx for your reply wizpic,
I can'T understand how it is possible
As in the manuall the buck converter
seems to be calculated for a determined output
Voltage
Could u explain please?

Many thx

B.
 

Hello,

anyone has tried the simulation with proteus?

thx
Ciao
B.
 

Hello,
anyone has tried the simulation with proteus?
thx
Ciao
Yes I have, It does kind of work but only the setting up part of it, Proteus can't keep up with it, You may have to set the crystal for the pic to 8MHZ insted of 20MHZ.

Has for your pevious question, Yes it does use a buck converter but the control for this is done by the software, If you hooked it up ona demo board or even made the PCB to test it on you will see when you first power it up you have to enter the capacity then the number of cells and so on.

If you go back to the first start of the topic and and look at Felixls link to his wonderful site you some videos on there and he shows you how it is done, It's not indepth but it is more than enough to show the basics of it.
Remember to say thanks to Felixls for sharing this great project all the credit goes to him.
 
Yes I have, It does kind of work but only the setting up part of it, Proteus can't keep up with it, You may have to set the crystal for the pic to 8MHZ insted of 20MHZ.

Has for your pevious question, Yes it does use a buck converter but the control for this is done by the software, If you hooked it up ona demo board or even made the PCB to test it on you will see when you first power it up you have to enter the capacity then the number of cells and so on.

If you go back to the first start of the topic and and look at Felixls link to his wonderful site you some videos on there and he shows you how it is done, It's not indepth but it is more than enough to show the basics of it.
Remember to say thanks to Felixls for sharing this great project all the credit goes to him.

Thanks a lot for your fast reply Wizpic and for the patience :)
And thanks a lot to Felixls for sharing this great project.

B.

B.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top