Page 1 of 1

DC Genset - I've gone and over-complicated things

Posted: Sat Dec 26, 2009 3:25 pm
by kheston
I've been using MrAl's circuit with my DIY genset for some time now, it works well for the 12v setup I had initially.

However, in the 48v system I'm experimenting with now, I've run into some trouble. There are now four of the MrAl-gulators controlling each of the four alternators and the PID tuning has become vastly more complex with the batteries wired in series. I'm running into situations where I'm either charging one of the batteries too much/little or I exceed the upper voltage limit of my inverter (68v) and its protection mechanisms kick in. Add load variations like a well-pump turning on and off and I'm finding my control algorithm simply can't respond in time. To get around the problem, I've tweaked a regulator circuit I found while Googling and came up with this:

Image

It will allow me to set an upper voltage limit with a digital pot. However, it doesn't let me set a charge rate as it works much like a mechanical voltage regulator does (it's either on or off). So, used by itself, I won't be able to vary the current flowing into my AGM batteries (C/5 or ~20a is the recommended charge rate).

My thought was to wire MrAl's and the latest one together in series (the MrAlgulimiter) on the field coil so I have control over an upper voltage limit and over the charge rate for each battery, but it's not working out that way. I'm misunderstanding the way these circuits work both individually and together, thus I can't get the right amount of current flowing through RField in my simulation:

Image

(note: the voltage-controlled pots are the closest thing I could find to a AD5204)

My guess is I've made the circuit more complicated than it needs to be. Is there a way to combine the output of U1 and U4 before the 2n2222 and use just one TIP3055?

Re: DC Genset - I've gone and over-complicated thi

Posted: Sat Dec 26, 2009 6:10 pm
by MrAl
Hi there Kurt,


Yes there is most likely a simpler way to do this.
Let me ask a few questions to refresh on this project a little first though...


1. You have four batteries, each 12v, and they are wired in series and power
some stuff as 48vdc right?

2. You have four alternators, each one powers it's own battery.

3. You want to control the current from each alternator independently so as to
not charge the battery too fast?

4. You do not tap off power from any individual battery, but always use the
48vdc to power external circuits?

5. What is the part number of the actual part you are using for the dig pot?

6. Since the circuits are connected in series (the four 12v batteries, not the
new circuit) how do you generate an isolated control voltage for each one of
the four sections?

7. You also want to limit the max voltage to any one battery as it gets fully
charged up.

8. What are you currently using to measure the battery voltage?

9. Do you have any means to measure each battery current?

Re: DC Genset - I've gone and over-complicated things

Posted: Sat Dec 26, 2009 7:56 pm
by kheston
MrAl,

1. You have four batteries, each 12v, and they are wired in series and power
some stuff as 48vdc right?
correct, they power a 3.6kw inverter

2. You have four alternators, each one powers it's own battery.
yes, they are isolated from one another and each is connected to one of the 12v AGM batts

3. You want to control the current from each alternator independently so as to
not charge the battery too fast?
The last circuit you designed for this project allows me to do it, but I'd like to add an analog voltage limiter that I can adjust with a digital pot

4. You do not tap off power from any individual battery, but always use the
48vdc to power external circuits?
I plan to power each of the alternator controllers (regulators) from the 12v battery it is monitoring, if possible. Each of the four will be equipped with its own PIC micro. The 4 PICs will be controlled via opto-isolators from a central Micro/PC.

5. What is the part number of the actual part you are using for the dig pot?
AD5204 - a 4ch, SPI version of the AD5220 I have been using.

6. Since the circuits are connected in series (the four 12v batteries, not the
new circuit) how do you generate an isolated control voltage for each one of
the four sections?
see # 4

7. You also want to limit the max voltage to any one battery as it gets fully
charged up.
Yes, but adjustable and in the analog realm, if possible. My PID tuning skills are lousy or a micro just isn't suited well to respond quickly enough to the big voltage swings this system experiences in the field. Likely the former.

8. What are you currently using to measure the battery voltage?
An ADC in the micro. I'm using a voltage divider not unlike the one you recommended in another thread. I'm also monitoring alternator RPM to make sure it's spinning.

9. Do you have any means to measure each battery current?
I have a handful of the Allegro ACS754 ICs. I plan to mount them in such a way that they will only measure the current entering or leaving the battery itself. This way, if there is a load on the system, I can power it with the alternators while knowing I'm charging at a safe current level.

I would really like to be able to design this, hence my renewed interest in LTSpice. I'm just short on some tooling in gray-matter. If you have some suggestions to get me going, it would be great.

Thanks again!

Re: DC Genset - I've gone and over-complicated thi

Posted: Sun Dec 27, 2009 12:24 am
by MrAl
Hi again,


4. You do not tap off power from any individual battery, but always use the
48vdc to power external circuits?
I plan to power each of the alternator controllers (regulators) from the 12v battery
it is monitoring, if possible. Each of the four will be equipped with its own PIC
micro. The 4 PICs will be controlled via opto-isolators from a central Micro/PC.

I mean the main loads will not be powered from individual batteries right?
The main load will be across the 48v supply right?



5. What is the part number of the actual part you are using for the dig pot?
AD5204 - a 4ch, SPI version of the AD5220 I have been using.

Just wondering why are you using a 4 channel version? Each pot has to be
isolated from the others right? Is this because you intend to use two
pots per battery now?




10. Have you tried measuring the currents yet to see how well the current monitor
chips work for you?


11. When you say you really want to design this, do you mean you want to figure
out how to configure a circuit to do this task or that you would want some circuit
suggestions?


Most battery chargers work by supplying a regulated current to the battery and
then cut out when the battery starts to reach the threshold setting. That would
be the float charge voltage for your battery. A typical way to do this would be
to use two op amps that are wire "OR'ed" together so that the current regulation
kicks in first and then later when the battery becomes charged the voltage
regulation kicks in. This is very similar to a Li-ion battery charger. The
difference is that the current though the field winding is varied in order
to control the voltage and current for the battery.
To control the current and the voltage one more op amp section would be
required, and that would be for monitoring the current.
Do you want a new circuit suggestion?

One last thing...
The diode D4 is a 6v diode? If so, we may need to change that to 4.7v because the
dig pot chips are rated for operation at 5.5v max. That means we need to increase
the value of R10 to about 14k or even a tiny bit higher (15k might be ok too)
unless we end up changing the entire circuit of course.

12. Almost forgot to ask:
What is the maximum charge current that you put into the battery when normally
charging it?

Re: DC Genset - I've gone and over-complicated things

Posted: Sun Dec 27, 2009 11:42 am
by kheston
MrAl,

4) Yes, the only load on the system will be via the inverter (48v output). I don't foresee using the individual batteries to power anything other than the circuit we're looking at in this thread.

5) the AD5204 is a DIP IC that fit the bill. I didn't look for a 2ch. If I move to surface mount, there are a lot more choices, but that complicates prototyping for the time being. So, I stuck with more channels than I need.

10) I've tested the Allegro sensors in just one other circuit. It worked fine. The readings I was getting made sense when compared to the ones I was getting with my clamp meter.

11) You've been gracious enough to provide me with a number of circuits to cope with the analog side of all these (half-complete) projects of mine. Not only do I feel a bit awkward about using this forum as my own personal engineering dept., I also feel as though I should be able to design something like this after 8 years' worth of N&V, EPE and CC subscriptions. Not to mention the books I've read. If my day job was in circuit design, I'd have it, but that all seems to happen overseas now. I was born a couple of decades too late.

I've read tons of tutorials/texts about how to make lights flash, produce buzzing sounds, use op-amps to multiply and divide, and the ramifications of wiring resistors and capacitors in series and parallel, but ask me to draw arrows to show how current is flowing through the MrAlgulator under given conditions and I'm lost. It's embarrassing, really. Haven't given up though.

I took this article to bed with me last night: http://www-personal.engin.umd.umich.edu ... lt-Reg.pdf and it made some sense. So, I've spent part of this AM trying to come up with something on my own. The trouble is: I don't know what I don't know, my college coursework was in the wrong subject. I'll keep at it.

The OR'ing of op-amps sounds promising, but I'd like to set a number of voltage levels (float, absorb, equalize, etc). If I change battery brands, these all will change, so it would be nice to set them in software. Were I to pull this flexibility idea out of the equation, Maxim's got a chip for managing FLA charging that I could splice in somehow, but where's the fun in that?

12) I have 100Ah batteries. The manuf. recommends charging at a max of C/5. So I think that makes my max charge rate 20a. However, with the system under load (like when the well pump's running), I'd like to be able to charge at up to 20 amps while "keeping up" with the load. This is why I mention positioning the Allegro sensors such that the current flowing into and out of each battery is isolated from the current moving through the entire system. That is to say, if the inverter is pulling 20a from each battery and the output of the alternator (for a particular battery) is 40a, that the sensor reads 20a (just the part that the battery is seeing). Make sense?

Thanks again!

Re: DC Genset - I've gone and over-complicated thi

Posted: Sun Dec 27, 2009 4:29 pm
by MrAl

10) I've tested the Allegro sensors in just one other circuit. It worked fine. The readings I was getting made sense when compared to the ones I was getting with my clamp meter.

The OR'ing of op-amps sounds promising, but I'd like to set a number of voltage levels (float, absorb, equalize, etc). If I change battery brands, these all will change, so it would be nice to set them in software. Were I to pull this flexibility idea out of the equation, Maxim's got a chip for managing FLA charging that I could splice in somehow, but where's the fun in that?

12) I have 100Ah batteries. The manuf. recommends charging at a max of C/5. So I think that makes my max charge rate 20a. However, with the system under load (like when the well pump's running), I'd like to be able to charge at up to 20 amps while "keeping up" with the load. This is why I mention positioning the Allegro sensors such that the current flowing into and out of each battery is isolated from the current moving through the entire system. That is to say, if the inverter is pulling 20a from each battery and the output of the alternator (for a particular battery) is 40a, that the sensor reads 20a (just the part that the battery is seeing). Make sense?

Thanks again!
Hi again,

Ok, so we will say about 20 amps max. One little question:
Do you happen to know the ratio of current through the field winding to alternator current?
In other words, if you have say 20 amps charging the battery how much current is then flowing
through the field winding? [This information helps build the control law for studying the feedback system]

The OR'ing of the outputs is unrelated to the set points. You would still be able to set the voltage at any
time and also the max current (current limit for charging).

The current sensors have output that centers at Vcc/2 right? That means they are biased at one half
the supply voltage. Do you happen to have any that are not biased like that? Those are probably
dual polarity when we really only need single polarity, although they would still work. The set point
dig pot would be biased also to get the max range of adjustment.

The monitoring of the battery current would be directly in line with one battery terminal. That means
the current through the battery would be measured. If there is no load, the battery will go up to say
20 amps charge (if that is the set point) and maintain that level. If there is a load, the circuit will put
the maximum current into the system in an attempt to put 20 amps through the battery. If there
happened to be 10 amps load then the battery would see 15 amps if the max available was really
25 amps. If 20 amps load, the battery would see 5 amps charge, etc. If the load were greater than
25 amps (we are supposing that 25 is the max the alternator can put out) then the battery
would be discharging at the rate ILoad-25 amps rather than the full load current rate. In this mode
the alternator would be supplying some of the load current but the battery would not be charging.
Note that in this system there is no way to limit the max current coming from the alternator
when there is a significant load. To do that, another current sensor and op amp would be required.
So another question would be:
Do you really have to limit the current out of the alternator, or can you let that go to as high as
it can produce when there is a significant load on the system?

The circuit to do all of this is surprisingly simple if you would like to see a schematic.

That paper on the linear regulators was interesting, but if you look at a simple op amp circuit
and try to develop the math for that circuit that turns out to be very informative and can shed
much light on how most linear regulators work. The feedback and how they handle that feedback
is the whole key to the linear regulator. How it is possible to use an amplifier with a very very
high gain (op amp) in a circuit to control the output while measuring that output. A 'block'
diagram is very helpful in understanding this kind of thing and it gets very simple that way.
I can post a block diagram if you like.
Actually a block diagram of your project wouldnt hurt either i guess.

Re: DC Genset - I've gone and over-complicated things

Posted: Sun Dec 27, 2009 5:53 pm
by kheston
MrAl,

I bought the Bi-directional current sensors on purpose. At some point, I'd like to monitor the drain current on the batteries individually to make performance assessments. I don't mind the reduced granularity.

It would be fine for the alternator outputs to max when the load was large enough, so long as I can set an upper limit on the current flowing into the battery.

I don't know the field to output current ratio, but I'll bet even I could build a circuit to figure it out.

The linear regulator paper's pages 6 and 7 look really familiar. There's some of that in the ratiometric VR you designed for me (Vout = Vref x (1 + RF2/RF1)). That part seems simple enough. I've annotated your schematic as an exercise:
Image

How close am I?

It sounds like you may already have a schematic, please post if you do (just because you check your answer in the back of the textbook, it doesn't mean you can't learn the material). I'm really curious about how you're limiting current and setting a pressure ceiling all at once.

I'll set to work on a system block diagram.

Re: DC Genset - I've gone and over-complicated thi

Posted: Sun Dec 27, 2009 6:27 pm
by MrAl
Hi there,


You're very close in your analysis. The 1k resistor is there to power the 2N2222 because the LM358 can not get
all the way up to 12v on it's output, it's more like 10v, so the 1k is able to supply closer to the full 12v to the
base of the 2N2222. The 200 ohm is there also because the LM358 can not get up to full voltage, only up to
about 10v, so when it's output is around 10v (maxed out) the base of the 2N2222 can be higher than that.
With 1k and 200 ohms it works out to just slightly less than 12v. Without those two resistors, the max
voltage at the base of the 2N2222 would be around 10v and that would not be enough to drive the transistor
properly. Of course that depends on what the max field voltage needs to be to drive the alternator.
For example, if the max voltage only needs to be 6v then we can get rid of one of the resistors.

I'll post a schematic of the purposed new method of limiting both voltage and current and making
them both adjustable in a few minutes...

As you can see from the new schematic, the current limit is given it's own control op amp and the
output is wire OR'ed with the voltage control op amp using two diodes. The third diode (which may
not be needed) is there just to drop a little more voltage to help the LM358 outputs reach closer to
the full 12v again.
The two diodes D1 and D2 allow only one loop to take control at a time, either the voltage control
or the current control, and this is both necessary and sufficient to regulate both the max charge
current and the max charge voltage level.

Here is the circuit:
Image

NOTES:
1. If C1 and/or C2 are not used, they are made an open circuit.
2. If D3 is not used, it is made a short circuit.
3. We are now using a 78L05 instead of zeners.
4. The resistor R6 in this schematic is 15k, not 10k as in the previous schematic (RF2).
5. Because a digital pot is being used for current limit, the current limit will be adjustable in discreet steps.
6. The smallest resistance load that can be placed on Vo2 (for monitoring the current) is 10k. Anything
smaller than that might prevent the current limit chip from working properly. If this is to feed a controller
chip ADC input, a 10k series resistor is probably a good idea.

Re: DC Genset - I've gone and over-complicated things

Posted: Sun Dec 27, 2009 9:13 pm
by kheston
Wow, that's really slick, MrAl!

It's ok to add a 1N5401 to shunt Q2.E to ground to protect Q2, correct? Standard caps around the 78L05 as well?

Now comes the understanding-it-part. Here goes...

If I'm not mistaken, the max charge side is a standard linear VR where R6==r2 and R5==r1 (in Vref = Vin*(1+r2/r1)). The charge current limit side is a simple comparator (no feedback). R1 and R7 appear to be current limiters. Good so far?

Okay, now here's where I start to struggle, but I'll give it a shot (pardon the lack of EE jargon):

It appears as though the two op-amps are set head-to-head in such a way that when the voltages present at D1 and D2 are both >= V1, max current will flow through Q1/Q2. When either op-amp output is less than V1, current will flow through it to GND. It only takes one of them to bleed off all available electrons (thus we have both a current limiter and a voltage limiter) and starve Q1.B. Varying the digi-pots, and as a result the amount of pressure produced by each of the op-amps, will yield the desired charging conditions. Clever indeed (whether or not anything I've said here is correct).

Am I close?

Also, there's a very specific reason you've placed the hall-effect sensor on the low side that I don't yet understand. :)

I'll play with this a bit in LTSpice and see if I can learn more (and also because it's a way to get a good netlist to use with FreePCB). This circuit is a night-and-day improvement over my last (all control from the micro) idea. Much appreciated!

Re: DC Genset - I've gone and over-complicated thi

Posted: Mon Dec 28, 2009 6:52 pm
by MrAl
Hi Kurt,


Yes, i left the diode out but that should be included also.
And yes, standard caps for the 78L05 too.

Yes, that's correct about the voltage calculation too, and also
R6 must be 22k rather than 15k because we have to allow the
battery voltage to reach just beyond 14v when charging.
I updated the schematic to show the diode and new resistor value.
The charge limit side however is not a comparator. It's basically
an integrator same as the voltage side. When the voltage op amp
is not in the circuit (it's diode not conducting) the charge limit
op amp *is* in the circuit, and that is also in the feedback path
same as the voltage op amp. The only difference is now the current
limit op amp is in control. The voltage side measures voltage and
controls current though the field, while the current side measures
current and controls the current through the field. They are both
in the feedback path (only one at a time though) so they are both
linear circuits more or less. The two op amps are LM358 again.

The hall effect sensor is placed as close to ground as possible
to help reduce noise and capacitive coupling of the signal. I
believe they are made to work as high or low side sensors so if
this is extremely inconvenient to the application then the sensor
can be put in the high side of the battery, in series with the
positive terminal. First choice though is in the low side.
A good way to wire it would be to bring all the grounds together
at one point.

LT Spice...
If you intend to simulate this (a very good idea BTW) you will need
to include a small resistance in series with the battery. It should
be placed in series with the positive terminal between the (+) terminal
(on the schematic) and the junction just above it where Vo1 and the
78L05 and the rest of the circuit connect. That means that any current
flowing in or out of the battery also flows through this series RS.
This is necessary in order to see how the voltage regulation works.
Also, the battery voltage would have to be set higher than 12v to
show a battery that is getting near fully charged.

A couple of additional questions:
1. Does the alternator ever stop turning, and if so is there a way to detect
this using the micro controller? We need to determine if we need a current
limiting resistor in series with Q2.
2. What is the max current draw of the field winding when it has
12v across it (or what is it's DC resistance)?


New Drawing:
Image