Monitoring Battery/Charge voltage for engine speed control

Started by veggie, December 28, 2012, 08:15:20 PM

Previous topic - Next topic

veggie


Need some guidance from the micro-controller/Electronic members  :)

One of the components of the CHP controller I am building is a throttle control system that alters engine rpm based on the battery bank charge state.
The engine is a small Changfa 175 diesel with a Leese 12 volt, 160 amp alternator.
The system is a laptop programmed in visual basic with a "plant control" like visual interface, connected to an I/O control board (USB communication).
I used this because I am proficient in VB programming and tweaks/changes can be done rapidly.
So far, the control of relays, reading of temperatures, and general control of the hardware is going fine.
The I/O board I am using has 8 relay outputs and 8 Analog ( 0v - 5v  ) inputs.
So, I want to to use one of the analog inputs to read my battery/charge voltage and in turn, adjust throttle (fast when the battery is empty, slow when it's full).

- Start Loop...
- read battery charge state
- adjust throttle
- Loop

...something like that....

Therefore I need to read the battery bank voltage represented by a 0 - 5 volt signal. Then convert the voltage reading to a % of full scale reading.

QUESTION:
How can I convert say 11 - 15 volts at the battery bank to 0-5 volts for the input on my I/O board. ?
The board is currently an 8 bit resolution analog accuracy however after proving everything I may upgrade the board to one with a higher resolution model if needed.

thanks,
veggie

Jens

Disclaimer: I don't know what I am doing !!!! Follow the suggestion below at your own risk!


A resistive voltage divider between your +15 and ground (2 resistors) with the junction of those two resistors going to the voltage sense line should do what you want.
Total resistance of the two resistors needs to add up enough so as to limit the current that is conducted to ground. Make sure that the resistors are rated for the power you dissipate. Determine the input resistance on the sense line and figure in the current to ground through the sense line.
I would aim for something like 10 ma total current.
The upper resistor (from +15 to the sense line) should be 1/10 (or smaller) the input resistance on the sense line to reduce the loading effect on the circuit
If your sense line is relatively low resistance then you have to include a buffer in the circuit.

Example: let's say your sense line has 100k input resistance, the top resistor in the divider should be 10k or smaller, the parallel resistance of the 100k and the bottom resister on the divider should be about 5k. This should in theory give you a 0-5V signal at the junction point of the divider and if my mental math is right about 1 ma of current. This may or may not be giving you noise, if it does you can try reworking for more current and a small tantalum cap from the sense line to ground would be good (possibly paralleled by a small ceramic cap).

Mad_Labs

Jens is right, a voltage divider is the way to go. My system uses a 4:1 divider, that way I can see spikes as high as 20V without exceeding the ADC input level of 5V. You could use a 3:1, but then you are limited to 15V for equalization but it will make accuracy easier with your 8 bit ADC. I also have a zener diode on the ADC input just in case. Exceeding the ADC input voltage level can trash it. Put a small cap, like .1 or .01uF on the output of the voltage divider to add a little stability.

Jonathan

Lloyd

Veggie,

Motoring voltage is  a poor way to determine engine speed in a charging application, I have spent much time in this regard. Switching based on output current of the alternator is the best method.

You can read about my system here http://www.microcogen.info/index.php?topic=709.msg33683#msg33683 You can find find the hall effects current sensors here http://www.inpowerdirect.com/dccurrentsensors.php for $50.00 how about  this  

Also look at other things on their site many control relay and switching options.

Lloyd
JUST REMEMBER..it doesn't matter what came first, as long as you got chickens & eggs.
Semantics is for sitting around the fire drinking stumpblaster, as long as noone is belligerent.
The Devil is in the details, ignore the details, and you create the Devil's playground.

BruceM

A voltage divider can take your max voltage (say 15V) down to 5 volt, but with only 8 bits of accuracy that would give you a resolution of 15/255=0.059 volts  That's coarse, but if that's sufficient, why make it harder.  Most cheap analog input boards will require at least 10K ohms input impedance for a stable conversion. This might mean an op-amp voltage follower to buffer the input. Check your analog input board specifications for it's required input impedance.

If you need finer resolution you can either change your hardware to 10 or 12 bit analog inputs or use an op-amp circuit to improve your resolution.  You can use an analog op-amp circuit to subtract 11V before scaling, so that a zero value will equal 11V, then you will get a useful resolution of (15-11)/255=0.015 volts.  I can give you a hand with it if you need it.  I have such a subtraction and scaling circuit on my battery bank controller, for reading the nominal 120V battery bank voltage. (Attached)   It will require a quad op amp, and a fair amount of "glue" (resistors, capacitors,trim pots, etc.) and linear regulated 5V or an adjustable precision voltage reference.

I'd want charge current, load current and voltage inputs for this job, but I'd probably use a PicAxe to do the real time controlling, since I also am more comfortable with Basic, and it's easy to add a single chip PixAxe to the analog interface hardware you'll need.  I'd be glad to help with that if you decide to go that route at some point.  

You may be able to find a current sensing board, if not, I can help you with another op amp circuit to change current through a precision shunt resistor into a 0-5V signal.



Best Wishes,
Bruce

Jens

As mentioned by others, voltage is a poor way of controlling speed. I would also advise against current as an indication of speed. The voltage divider is the simplest method to get your 0-5V and I just answered your question with that circuit but the only way to do it properly is to put a sensor in that directly measures rpm or time between index pulses. If your controller needs an analog input then stick a frequency to voltage converter chip in between the two. No big deal!
I can see so many problems with voltage/current sensors that it's not even an acceptable bandaid solution for me.

Lloyd

Jens,

I think you misunderstood, I wasn't intending to use a current sensor to measure speed. I use a flywheel tooth counter to measure speed, and the current sensor on the output of the alternator as the logic for the governor. You need to match the hp load of the alternator required to the hp available from the drive engine. In a 2 speed arrangement the current sensor would be set say from 0 to 2.5 volts low speed, and 2.5 to 5 volts high speed. You wouldn't need a speed sensor in this arrangement, just a actuator linked to the throttle, set the low speed and high speed based on push/pull.

Lloyd


Quote from: Jens on December 29, 2012, 12:55:17 PM
As mentioned by others, voltage is a poor way of controlling speed. I would also advise against current as an indication of speed. The voltage divider is the simplest method to get your 0-5V and I just answered your question with that circuit but the only way to do it properly is to put a sensor in that directly measures rpm or time between index pulses. If your controller needs an analog input then stick a frequency to voltage converter chip in between the two. No big deal!
I can see so many problems with voltage/current sensors that it's not even an acceptable bandaid solution for me.
JUST REMEMBER..it doesn't matter what came first, as long as you got chickens & eggs.
Semantics is for sitting around the fire drinking stumpblaster, as long as noone is belligerent.
The Devil is in the details, ignore the details, and you create the Devil's playground.

BruceM

Since I didn't see Veggie's scheme for throttle adjustment, I didn't comment, but if engine rpm was already limited to an acceptable range, and only a speed setback selection is needed, then one could skip engine rpm sensing.  Perhaps that's what Veggie has planned for the relays.

Otherwise, engine rpm would be needed too, and Jen's suggested F/V converter is a good way to go.

I can't imagine using a PC for real time control, myself. Too much unreliable hardware. OK as a fancy display/user control terminal, but not in any critical real time control loop.  I'd use a PicAxe programmed PIC chip where I could since I like Basic best myself and find them easy and reliable.

I did have another thought about your voltage scaling, Veggie.  If you are only measuring the 12V battery voltage you could just put an 11V Zener diode in series with your 12V battery input to the A/D board.  This would work without any voltage divider or op amp scaling. The Zener will subtract ~11V and you can tweek your software to get a reasonably accurate result. (Some variation with temperature, but minor.)  Put a resistor matching the spec input impedance (10K ohm?) after the Zener. A 5V Zener to ground for input protection after the resistor is the polite thing to do, and a 0.1 uF ceramic cap after the resistor is also a good idea unless your A/D has an input capacitance problem. If so, split the resistance into two series resistors (5K?) and put the capacitor in the middle.  The capacitance will help filter out some of the high frequency noise from the alternator. Increase via 1 uF tantalum in parallel if needed.


Jens

There was a reason why I suggested a Tantalum cap in parallel with a ceramic cap. Ceramics are good for high frequency noise, Tantalums are very good for low to moderate frequencies. Most noise suppression circuits have both.

veggie

Jens, BruceM
Thanks for your voltage conversion solution.
This 0-5 measurement is not for measuring engine speed. It's for measuring battery state.
The objective is to make the throttle "float" to match the load on the system.
In fact I am purposely making the system fuzzy, so knowing the engine speed is not necessary as long as it's roughly matched to the current demand.

Lloyd,
I was not aware of the sensors you posted and it does make some sense to monitor alternator current as a proxy for engine load.

The throttle is controlled by a linear actuator with a 2" stroke (same stoke as my modified throttle rack lever).
The throttle actuator is moved by 1 second pulses from the relays on the control board.
The actuator has limit switches, so any pulses from the relays are ignored once full travel is reached in either direction.
Reversing polarity changes the actuator direction.

The control logic in human English would go something like this....

============================================================

- Set throttle to start position (eg: 10 pulses for approx 1/4 throttle)
- Start engine for warm up (Still below the output speed of the alternator so very little load)
- Wait 1 minute then move the rack to full throttle
- Loop
- read current output until the average reading drops by say 10% (engine is now overproducing for
 the given amperage and a new target amp reading has been established.)
- cut back the throttle until the amps just starts to fall below this new target level (target found)
- speed up slightly until the amp matches the new target.
- Loop

Speed and load should diminish as the bank charges.

When the alternator output has dropped to a preset level (hard programmed by me), kill the engine and let
the solar panels do the rest.

============================================================

I am using a laptop, I/O card, and actuator becasue I already had this stuff kicking around.
If the concept proves to be a dud, then not much has been lost.
If it becomes permanent and useful, then I pull the Arduino out of the box and start playing  :-)
Remember guys, I have zero experience with micro-controller programming and circuit design.

The one concern with my control logic is that the engine has to slow down just enough to notice a drop in amperage (below each target point) to know that it went too far (feedback) and then speed up slightly to hold the new target point.
I'm not sure if this would create a stall condition where the engine can't recover because it falls behind the alternator load. ??? ? ?

veggie

mobile_bob

a few thoughts from this corner

i would not control the fuel rack directly, i would favor using the servo to bias the governor spring

this would allow the governor to maintain overspeed control, so that there would be no chance of a puter malfunction and a runaway engine.

maybe you are already doing it this way? if not i would suggest considering it.

as for the conversion thing

many good ways have been suggested, here is another

use a current sensor like Lloyd posted to bias a transistor, set the threshold so that when there is little or no load the engine is allowed to idle, and when the load increases to the threshold the engine speeds up?  this is easy to do with solenoid bias of the governor spring, i use this method to provide for two speed operation, although i could easily use the same equipment to do 3 speed operation (using the two solenoids i currently have mounted)  probably not as elegant as your servo which if done right could provide for variable speed across a wide range, instead of steps, is this what you have in mind?

here is something that might be useful?

http://cubloc.com/download/etc/IO-CELL.pdf

they are discontinued products, but the schematics might come in handy?
and you might be able to alter it to accept 11-15vdc input and output 0-5vdc?

bob g


BruceM

Veggie,
I think your plan of using the PC with the VB you are comfortable with to develop your control logic is a good one.
Once you have your control strategy fully developed and tested, transistioning to a microcontroller would be easy.



veggie

Quote from: mobile_bob on December 30, 2012, 12:30:11 AM

i would not control the fuel rack directly, i would favor using the servo to bias the governor spring
this would allow the governor to maintain overspeed control, so that there would be no chance of a puter malfunction and a runaway engine.


Bob, thanks for your comments.
I used the wrong teminology......
My actuator is in fact connect to the throttle/governor spring control lever.

Also, in my software there are many error trapping routines which basically say ... ON ERROR CLOSE THROTTLE  ;)
and then it reports the routine where the error occurred.
IMHO, this is one of the advantages of using a computer control system. It can communicate visually and log megs of data to a disc file.
In the Oil industry where I work, PC's are controlling plants, gathering stations, and small Oil Battery sites all over the place.
Process control software has come a long way.

cheers,
veggie


thomasonw

#13
Veggie,

Hello. Just finished reading your question here, and some other posts of yours.  It occurs to me that perhaps much of what you are doing I am also working to solve in my DC generator control project, namely:


  • Start and Stop of Engine
  • Monitoring for Faults
  • Throttle speed control based on load
  • Measurement of Volts and Amps to determine that load

I am going a bit further in that I am also using the controller as the Voltage Regulator for the alternator.  Am basing it on the  Amtel Microcontroller (Arduino environment, though I am not using a 'Shield' but instead a single PCB with the microcontroller included).   http://www.microcogen.info/index.php?topic=2941.0   Perhaps you can find some ideas as I progress on this project.

I think to your original question of how to scale battery voltage down to a 0-5v input.  There most certainly is great input here, and I also struggled with the issue of resolution when using a simple voltage divider.  Because I was looking to control the field of the alternator I wanted finer resolution then a simple voltage divider would provide.  After looking a discreet Op-Amp approach I ended up using an integrated component the INA-220 to solve this issue.  It was about the same BOM cost, and the INA220 had lots of nice pre-processing capabilities to smooth and average the results - and it will measure current via an external shunt.

However, I might offer that for the need you called out in your question - namely throttle control - the resolution you will get from a simple 3:1 or 4:1 resister divider might be sufficient.    Perhaps something like this would be all you need:




The resisters selected give a 3.9:1   4.9:1 ratio, and the large cap gives a lot of smoothing that perhaps will reduce the need to do software averaging.  Adding some clipping diodes to protect the input of the A/D converter would be a good idea as well.  (Note:  I have edited this to correct the ratio number from 3.9 to 4.9, see next  post from Thob)

Best of luck!  Great thing about projects like this is there are SO many ways to go!

-al-




Thob

thomasonw,

I think the resistor divider should be calculated as 1.2 / (1.2 + 4.7) = 0.203; 1/0.203 = 4.92 : 1 (Instead of 3.9 : 1).

Maybe that was just a typo?

In any case, I would suggest that whatever circuit is used that you measure Vbat with a reliable meter and compare to what your software reads.
Witte 98RC Gas burner - Kubota D600 w/ST7.5KW head.
I'm not afraid to take anything apart.
I am sometimes afraid I'm not going to get it back together.