Micro CoGen.

Electrical/Electronic equipment => Automation, Controllers and Regulators => Topic started by: thomasonw on October 29, 2012, 01:10:35 PM

Title: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on October 29, 2012, 01:10:35 PM
As winter is approaching I have more time to Play with things and have picked back up on a project to provide more control of our Kubota / Leece Neville / DC Generator / watermaker.  (referanced here: http://www.microcogen.info/index.php?topic=2257.msg27611#msg27611 (http://www.microcogen.info/index.php?topic=2257.msg27611#msg27611))

This all started out from me wishing to have finer control of the regulator, managing not only the charging voltage, but also the total load placed on the 5Hp Kubota with the overall goal to lower the run time.  In order to do this, I needed to monitor the total Watts being produced by the alternator and adjust the Field to keep the motor fully loaded at all points of the BULK charge state.

Over time I this project, as many do, grew to include not only the alternator regulation function but also basic Kubota start / stop capabilities.

As it stands, key goals include:
- Traditional 'Smart' multi-stage alternator regulator
- Adding Amps sampling to manage total load on Kubota  (The Alternator is able to stall the motor at Full On, so it always running at some reduce state.)
- Basic Start / Stop function of Kubota
- Throttle Management
- Fault monitoring and management
- Remote Display and switch panel


I selected the Amtel / Arduino development environment and have completed the initial hardware design.  My next step is to build a prototype and begin the software, as well as hardware refinements / corrections.

All are posted at: http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/)

I would welcome any and all thoughts on this before I spend more $ on it (specifically sending off for the PCB - as that is a bit harder to change once it arrives).  There are .pdf's of the schematic and PCB as well as Gerber files for the pcb.

Thank you,
-al-


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 29, 2012, 02:53:05 PM
Looks like a great job so far, William.  I'm busy the next couple days but have printed out your schematic for further review, and will try to get back to you soon with any comments.  While I'm missing a system diagram and such to easily follow all of what you're doing, what I have seen looks quite nice.  Though I got re-started in imbedded controllers with PICs and/or Picaxe chips and I use ExpressPCB and their free software for their bargain priced "experimenter size" boards, I also like the Atmel processors and your choice of an open source PCB layout software is a good one too.  (I'm not thrilled with being locked into ExpressPCB but so far I can't complain at all about their quality and competitive pricing.) We all tend to stick with what we know to avoid the long hours of learning curve for something new.

If it were me, I'd think about doing some sort of preliminary real time analysis, to see if the single processor can handle all of the real time tasks you have in mind or if you might want to dedicate some additional smaller controllers or additional analog control circuitry to some.  Processors are cheap, and this isn't going to be a high volume commercial product anyway so it's more about making your development process easier.  You may very well be such a skilled old hand at real time controllers that this suggestion is unwarranted at best and perhaps insulting, and if so my apology. 

Congratulations again on the very nice work, and some good design and tool choices.

Best Wishes,
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Lloyd on October 29, 2012, 09:50:56 PM
Quote from: thomasonw on November 18, 2011, 11:17:20 PM
Hello.

I have just posted my home-built EB300 (also ex-mil unit) / DC generator with parts lists and all.

It is a bit different in that it is a marine usage and also includes a water maker.  But perhaps you can find some good info.

http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator (http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator)

-al-


hey Fellow Monk Owner, and also DC generator GUY.

I'm looking forward to reading up. Here's my story of my Monk and DC Generator. http://www.microcogen.info/index.php?topic=709.0 (http://www.microcogen.info/index.php?topic=709.0)
(http://www.microcogen.info/index.php?action=dlattach;topic=709.0;attach=5292;image)

Lloyd
Quote from: thomasonw on October 29, 2012, 01:10:35 PM
As winter is approaching I have more time to Play with things and have picked back up on a project to provide more control of our Kubota / Leece Neville / DC Generator / watermaker.  (referanced here: http://www.microcogen.info/index.php?topic=2257.msg27611#msg27611 (http://www.microcogen.info/index.php?topic=2257.msg27611#msg27611))

This all started out from me wishing to have finer control of the regulator, managing not only the charging voltage, but also the total load placed on the 5Hp Kubota with the overall goal to lower the run time.  In order to do this, I needed to monitor the total Watts being produced by the alternator and adjust the Field to keep the motor fully loaded at all points of the BULK charge state.

Over time I this project, as many do, grew to include not only the alternator regulation function but also basic Kubota start / stop capabilities.

As it stands, key goals include:
- Traditional 'Smart' multi-stage alternator regulator
- Adding Amps sampling to manage total load on Kubota  (The Alternator is able to stall the motor at Full On, so it always running at some reduce state.)
- Basic Start / Stop function of Kubota
- Throttle Management
- Fault monitoring and management
- Remote Display and switch panel


I selected the Amtel / Arduino development environment and have completed the initial hardware design.  My next step is to build a prototype and begin the software, as well as hardware refinements / corrections.

All are posted at: http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/)

I would welcome any and all thoughts on this before I spend more $ on it (specifically sending off for the PCB - as that is a bit harder to change once it arrives).  There are .pdf's of the schematic and PCB as well as Gerber files for the pcb.

Thank you,
-al-



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 30, 2012, 09:58:59 AM
Had a few minutes before a visiting engineering prof.  shows up. 

I looked up the ina220 current shunt monitor/2 wire bus chip you're using.  Wow, that sure gets rid of a lot of fussy analog drift and offset drift problems if you're going all digital control.   

Nice design, William.  I think I'll be learning a lot from your project, I'm a fossil!

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Thob on October 30, 2012, 02:14:21 PM
I looked over your schematic and have to say it looks pretty well thought out and robust.  Lots of protection there against things going wrong!

I do have a question about the pullup resistors on the SCL-buffered and SDA-buffered lines on the remote panel.  470 ohm resistors R4 and R5 are tied to a 12v supply which is feed by a 470 ohm resistor R3.  If both SCL and SDA are low, then it appears you would only have about 4 volts on the 12v zener.  A similar situation appears on the controller board with R11 and R12 pulling down the voltage supplied by R47.  You may need to run the line driver with a LDO regulator at 8 or 9 volts instead of a resistor/zener setup.  Or use much larger pullup resistors.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on October 31, 2012, 02:12:14 AM
All,

Thank you all so much for your comments.

Bruce:  Being I was starting from fresh, I have a choice of CAD tools.  Eagle seems like a great product, gets LOTS of support, and the free 'one pager' is great.  but I just felt I might get trapped down the road, so went with KiCad.  Seems to be working OK, but have noticed one needs to be careful of the libs - some have errors (like the LEDs that did not include the bottom solder mask), and less common parts one needs to make up.  (Chip guys - if they have libs tend to be Eagle.  Oh Well).  But it has been fun working with it - did need to get a different gerber file viewer (am using gerbv) as the built in one does not render drill files. . .

And ya, the IN220's are great little parts!  I had started with op Amps, but by the time I got into the quality needed for these low Amp-shunt voltages (mostly low off-set voltage), the price was very very close to an IN220!  Plus, that part will do all sorts of averaging - offloading the CPU!   I figure with that should be OK with the CPU cycles as I do not plan on using the RS-232 lib, which looks to be a real pace resource hog - it must to all the I/O bit-banging combined with delays.  I am a little worried about using the other two serial libs (I2C and ONE-WIRE), but perhaps it will be ok.  The ONE-WIRE is such a very very slow protocol (like milli-seconds approaching a second for some functions) I plan on doing a state machine and walk through the IOs based on the master Atmel timer.  That leaves the I2C, and if it gets too bad will just also use a state machine approach and only poll / update the display every 2 seconds or so...

But yes, that IN220 is a real find.  And cheap too considering all it does!  Plus there are others in the series, I choose this one because it handled low-side Amp shunts

Lloyd:  Looked over your project - So nice!  I do wish I started with a 10-15hp engine and could drive a full 200A+, but I have what I have.  Even so, it has worked well.  Between handling battery recharging and water maker duties am happy.  Though we added a couple of large Solar panels this last Spring, and as a result did not use the generator much at all this summer.  We just pulled into Friday Harbor for the winter, where do you base out of?  Perhaps will cross paths this summer as we are looking to start heading North the next few years.

And Thob - Wow, ya.  That will not work.  I had sized the drop resistor based on the Icc typ of the P82B96 and did not give any consideration to the pull-up resistors.  Can just imaging how those poor drivers IC would struggle with such a noisy Vdd!  I added this in because the Vcc MAX of the P82B96 is 15v, and its ABS rating is 17v.  Normally that would be ok, if not on the line, but during equalization would really be pushing it.  I had 1st looked at 12v LDO regulators, but could not find any that warranted their operation when Vin fell below 12-13v.  Am sure many would work, but clearly would be out of spec.    So, am now just thinking of replacing the Resistor/Zener with a couple of simply Diodes - use them for their voltage drop.  Figure I can get a good 1.2 to 1.4v extra 'headroom' off of the raw battery voltage that way.   Or guess I could do a simple Zener / Emitter Follower regulator.   Any other ideas?

Thank you so much for the catch!
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 31, 2012, 11:14:38 AM
Hi William
Here's my thoughts on your schematic this morning:

I'm not sure what the field current being controlled is, but as current goes up you are often better using a gate driver IC (cmos) to get faster on/off switching, less MOSFET heating (and exploding). At the 1 amp peak gate current size they are cheap, small, reliable. Something like an 8 pin TC1411 or MC3315.  In your present design your off transition gate current is seriously limited by R21. I would eliminate Q3 et al and use a driver chip, myself. This may be an irrelevant comment as your field current may be relatively low, but since you used Q1 and Q2 in parallel I it made me worry.

Looks to me that as long as the OC1A pwm function controlling the Field + doesn't require too too much software attention you should be fine, real time wise.  I assume the 2 wire serial interface to the remote display P82B96 has enough buffering to make that less of a cycle stealer, too.  You may have to write some of your own I/O handlers but there is a lot of advanced hobbyist support for Atmel, and you can probably find what you need. 

I would suggest you look into the one wire support overhead before you have your board made.  Last time I looked into them for a project, I ended up avoiding them as there was just too much time lost waiting for conversion and pokey serial data transfer with the software support I had available.  Perhaps your I2C or SPI interface interface and software will be "smart" enough to let you start up a conversion/transfer on your timer schedule and then go about your business.

I hope you'll have time to share your experience as you go, this looks like a lovely, quite advanced design.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Thob on October 31, 2012, 02:15:50 PM
I was thinking of LDO regulator for the line driver with 8 or 9 volts out - that should be sufficient to drive the communication line unless you've got an awful lot of noise.  And it will leave plenty of drop across the regulator on a low battery.  For that matter, you could probably do just fine with +5v, especially since you've already got one on the remote board for the LCD.


Bruce has a good suggestion on using the drivers for the CMOS devices.  I've got some TC4426 (dual) drivers that I've bought for an upcoming project.  If you do use the drivers, be sure to use a bypass capacitor (1uF) right at the chip.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 31, 2012, 02:48:40 PM
William, I had another thought:
I'd also change the field drive to low side PWM; it's typically done that way and the N-ch mosfets are higher performance as well as cheaper. You'd likely only need one N-ch Mosfet.  "Field +" connector would become "Field -", and the other leg of the field coil would be tied to +batt.  

I'd also think about going to 2 or more channel gate drivers and then using them for all the mosfet switched controls, and make them all low side switches, if practical.

I'm such a fossil I use a full duplex (TTL, 5ma) optically isolated current loop design for my remote control panel serial link, since it's about 500 feet (on CAT5 cable) away. Hardly high tech but the control signal is run in the same steel conduit with the 240V twisted pair AC power run (technically a no-no), and I needed something simple and interference proof.  It's updated once per second at a blazing 1200 baud.  Current loop is as simple as a resisitor across the LED of an opto-isolator at the receiving end of a twisted pair, with matching series resistor termination of the pair at the driven end.  Even running my 12A central vacuum with a brushed universal motor wouldn't give me a single data error on a continuous loop back test, so I called it good enough at just 5ma current.  CAT5 cable is a marvelous thing.




Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 02, 2012, 10:26:11 AM
Bruce / Thob:

Thank you again for your time to review and comment.

I can definitely see the advantage of using a FET Driver for the PWM (Field) FETs, and noted several under $2 each.  Not sure will get the same uplift with the more static state drivers (ala the Glow Plug).  And Thob - ya, guess I have been pushing the I2C expansion noise margin a bit.  Given I have set a low-voltage cut-off point for the project at 9v using an nv LDO would give me LOTS of noise margin on the I2C drivers.  Bruce, the P82B96 are not that expensive, but I do get your point that the demands are not that great and perhaps a different approach would be lower cost.  Will look into it more, but at this point am not too concerned about the costs.  What I do not like is the H-Bridge cost, but guess it is inline with what I would need for a discreet H-bridge.....  Oh Well, think Infineon considered that when they set their pricing for the TLE5205? :-)

I have been spending the past few days looking at the High Drive vs. the Low Drive for the Field.  Seeing if there was some reason for High vs. low from the alternators standpoint, or perhaps safety / corrosion. About the only thing I could find was that at one time GM used one approach, and Ford used the other. . .   What is curious is almost without exception, EVERY external regulator I have seen uses High Drive.  In fact, most the IC regulators I looked at early on (ala from On Semiconductor - CS3341, and CS3361)  use High Side Drive.     I looked at the FETs , and there is about a $0.45 delta between the N and P FETs I am using, and the N FETs do look better on specs as well.  I just have this unanswered question in my mind of Why is High Side to prevalent?

In looking at my design, perhaps I would say that using the High Side drives gives a bit better decoupling (via the voltage regulator, and such) then something bouncing against the Gnd plane?  Of course would be easy to bring in a dedicated Field GND line.  Though adding a 2nd GND connector would eat a bit into the FET savings.

But perhaps mostly I am wondering about Why does it seem High Side is so prevalent - Any ideas???

On the other drivers: Pump and Glow-Plug can not be taken low, but in my case the Fuel Pump and Throttle Clutch could.   The fuel pump I am using has an isolated ground wire, as does the cruise-control box I pulled from a scrap yard (even though the automobile wiring diagram showed GND was serviced via the case as opposed to a seperate wire).  Even so, I might just leave that one high-drive as well - if someone else wants to use this design I do not know how universal isolated gnd wires for the cruise control modules... 

And finally, on the software loop overhead.  I think I just need to get some sample one-wire and I2C devices and see what can be done.  I do know the OneWire communication timings can approach a second PER OPERATION, and yes.  That is huge. But I also would expect temperatures will not change so fast, so sampling round-robbin, and perhaps even sampling one say every 5 seconds would be sufficient.    I am intending on doing a 'command queue' for the OneWire in the main loop, and using the Amtel timer to decide when it is time to pull the next command out of the queue.  In this way, I hope to stall the main loop only during the bit-banging of the actual serial transfer.  What I do not know is how much time it will take for even one session of bit-banding to be completed by the default lib.  But, if even that turns out to be too much then maybe will need to look at doing some type of interrupt driven i/o drivers (as opposed to bit banging).  That could be fun!  Brings back memories of a project I did with a 6502 (KIM-1) and a selectric typewriter - using the Timer / IRQ drive actual I/O port changes...

At this point, am still wondering if something is being messed on the whole high vs. low side Field drive - as from an engineering standpoint I can find no difference.   And for software, think I am just going to have to start mocking up things and see what the current libs do. . . .

Thank you again so much for your time and comments.  I will update the schematics perhaps over the weekend and repost a new version.    And if you have any thoughts on the 'Why High Side is so prevalent' - would LOVE to hear them!

-al-


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on November 02, 2012, 12:17:10 PM
Your research is impressive, William.  My own experience is limited to looking at internal alternator regulator designs, and making a linear regulator as an external replacement (for greatly reduced EMI). Perhaps on external regulator designs the alternators have the negative field and one field brush was bonded to the frame, and  the frame provides the negative to the alternator, per the usual automotive wiring practice. That would account for a high side switched design.

Maybe BobG could answer the question of why external regulators are high side switched?

You're absolutely right about gate drivers on PWM vs  on/off functions. The exception would only be for high current devices with a MOSFET that is being operated close to it's a rated current spec.



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mobile_bob on November 02, 2012, 03:11:43 PM
i don't know much about car alternators , however the truck alternators are as follows

most all of the delco's historically were low side driven fields, but they were internal regulators

those with external regulators like the 555, and most all the leece nevilles i know of are high side driven.

i don't think there is any advantage one over the other.

the only thing i can think of is this is a legacy problem, in that in the early days the regulators were remote mounted and if there were a short to ground the alternator would go full field and burn stuff up.

on the other hand if the unit was high side controlled, if the wire got grounded the alternator would quit, and the worst that could happen is the regulator got fried.

as for my preference, as it relates to what is available to drive the field, mosfets are
nice, and low side seems easier to control?  so maybe we go with a low side control?

from a regulator design standpoint, i would probably lean toward a low side (N type mosfet) driver myself.

having said that, every 3 stage controller i know of is a high side controller. balmar, xantrex, amplepower, hehr, and i am pretty sure sterling too.

i can think of no reason why one would be better than the other, and would like to hear if there is a difference or an advantage, with facts to back it up.

bob g
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 02, 2012, 03:41:19 PM
Quote from: mobile_bob on November 02, 2012, 03:11:43 PM
<SNIP>

I can think of no reason why one would be better than the other, and would like to hear if there is a difference or an advantage, with facts to back it up.

bob g

Me too.   

Thanks Bob for the insight.  And FWIW;  Failure Modes I think are a very valid justification.  As I will be installing this in a marine environment, I also am looking to see if I can get any insight from a corrosion / electrolysis risk point of view (So far, nothing)... 

Lacking anything else I am  going to sit on this over the weekend - and decide which way to go:  the better 'electronic' approach, or the 'Lemming' approach :-)

Maybe someone will have a nugget of information between now and then.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Thob on November 02, 2012, 05:52:44 PM
I could see where having one brush holder be grounded, and not insulated, would save a few pennies in building the alternator.  That would force you to use high side regulation.  It may also have depended on what was available for regulator pass transistors - some very early designs may have had a preference for PNP transistors.

Most old generators (that I've seen) are "ground the field to charge", (low side regulator).  I wonder if they wanted to make the new alternator regulator totally different for some reason?  No conspiracy theories here...

In either case, if the transistor driving the field shorts (a likely failure mode), it goes to full charge.  This is probably why they used avalanche diodes - to protect the electrical system in case the regulator went out.  Maybe a just-right sized fuse in the field circuit is in order (that would assume that full voltage on the field is never required)?
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mobile_bob on November 02, 2012, 07:28:18 PM
whatever you come up with, i would definitely fuse the field to protect the regulator
in case of some sort of short,  that of course is if you go with a high side control scheme.

low side failure modes wouldn't result in a regulator failure, but might fail to full output.

something to consider i guess

bob g
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: stuie on November 02, 2012, 09:04:15 PM
another thought on the high side control, is that most regs are powered from D+ when the alternator is running and have a warning light that excites the regulator/field when the D+ is low.
Stu
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 04, 2012, 06:17:22 PM
All,

Thank you again to everyone who provided comments and input to this design.  This evening I posted an update to the hardware design(v 0.1.3) as a result of feedback.  Major changes include adding the FET Driver and correcting the design fault around the I2C extension power supply.  And though it does not show, I have been spending a LOT of time in the PCB layout, cros checking the GBR files and correcting errors in the PCB payout, as well cleaning things up.  I have learned that GBR reviews is one of the MOST critical steps!

And after letting it sit for a few days I have decided to be a Lemming and stick with the High Side field control.  I am so bothered as to how almost universally every example of alternator control devices I can find drive the High Side.  There MUST be a reason, and though a low-side driver does make more sense from a FET driver standpoint, I can not shake the obvious direction the industry has taken - even I have have no clue why. (Failure mode / shorted control wire seems to have some glimmer of insight into it..  But still not satisfactory definitive for my taste.)  

Oh Well - High Side it is and Life goes on!

Going to let this sit for a bit longer as I posted the project to another website this evening.  After a week will look to get the PCBs and parts ordered.  Want them to be at our mail-drop for our trip in December.

Then the REAL fun begins!

Thank you all again, and I will post updates as I have them.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 04, 2012, 06:32:46 PM
BTW:  Note sure if I ever did post the link to the generator its self: http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator (http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator)

It has been running well in our boat for a three years now, though due to the installation of a couple of solar panels was mercifully quiet this summer!  (We did not need to use the Kubot all summer -  not until we got into the end of September and could not keep up with laundry power demands)

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on November 04, 2012, 07:05:34 PM
I'm sure that with the progress in P-ch mosfet efficiency, you'll do just just fine with high side drive.  It does make for slightly easier troubleshooting.  Looking forward to your next report!

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 06, 2012, 09:32:36 AM
Thanks Bruce.

Ordered PCB yesterday, and parts are on their way as well.  As we live a 'mobile life' all are being sent to our Mail Drop in Oregon.  We will look to pick them up when we go there for the Christmas holidays.  So, not much more hardware till the new year!

But perhaps I will start outlining the firmware.   

Will update the blog, and this list when appropriate.

Thank everyone again for the reviews.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 11, 2012, 01:35:23 PM
FYI,

I am starting to play with the Firmware for this project.  The other day I did a simple trial run of the serial protocols, to get an idea of how much time each takes.  I 'mocked up' three tests, ran each 100 times and caculated the time for each set of 100 passes through the loop.  The three serial protocols tested were:

I2C:                                 Send text "Hello World" to a remote LCD/keyboard, and check to see if any key has been pressed.
Serial (TTL level RS-232): Send text "Hello World", and check to see if any key has been pressed.
OneWire:                          Ask one temperature sensor for its current reading.


Here are the results I got:
I2C:            3.4ms / printing - KB Check
Serial:        22ms   / printing - KB Check
OneWire:  124ms   / request**


** A quick comment about the OneWire - At this time I do not actually have any physical device to test, so the above times really represented the time-out of the read request.  But that is also important to know!

The one-wire is slow, as I expected it to me.  My intention is to place all the one-wire temperate sensors into a queue and one at a time after N loops through the main-loop.  In this way I might be sampling each temperate sender every 20 seconds or so, but that should be OK the dT/dT should be low - unless there is a fire!

And speaking of timing-out, I have picked up some concern over the default I2C library in the Arduino environment.  Of all places in a hobbyist Drone group!  Seems there are some conditions where the I2C lib can fault and hang the system.   Even through I am planning on implementing the Watch Dog timer, this is not a desirable situation.  Fortunately someone has developed an improved I2C library that I am investigating using.  More here: http://dsscircuits.com/articles/arduino-i2c-master-library.html (http://dsscircuits.com/articles/arduino-i2c-master-library.html)

And to see more abotu the simple test I did, look here: http://smartdcgenerator.blogspot.com/2012/11/doing-some-timing-tests.html (http://smartdcgenerator.blogspot.com/2012/11/doing-some-timing-tests.html)

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 24, 2012, 09:35:10 AM
Just a quick update,

Last night I posted the 1st cut of the Arduino software.  Because I do not have the PCBs back yet (I am sure they are at the mail Drop, and we will pick them up in late December), testing is very limited.   http://smartdcgenerator.blogspot.com/2012/11/posted-1st-cut-arduino-alternator.html (http://smartdcgenerator.blogspot.com/2012/11/posted-1st-cut-arduino-alternator.html)


While waiting for our trip to Portland for the holidays, will perhaps work on connecting the Cruise Control module to the Kubota throttle and see what problems I come up with there...

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on November 24, 2012, 09:51:20 AM
You're making great progress, William, congrats!
If you could please save your source in a text file or pdf format, more of us would be able to take a look.
I'm not able to open your posted file.
Thanks!
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on November 25, 2012, 09:30:51 PM
Bruce, Thanks.

You should be able to open the ZIP file and read the source using Wordpad, or Notepad.  It is plane text.   I did change the .PDF file from .pde to .txt, perhaps that will help.  Do let me  know if you still are having issues, I tied it on a separate computer to see if perhaps the Google Drive log-in was causing problems, but looks OK to me.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on November 26, 2012, 10:35:26 AM
That works fine now, William. Thanks.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Ronmar on November 29, 2012, 07:55:26 PM
I finally got around to trying to look at your arduino code but I keep getting a google docs error when I try and use the links at the top of the page...  How big are the text files that you had to zip them?  I do most all my internet stuff on an Ipad via wifi from my couch.  First time i tried to look yesterday, that zip file stopped me cold on the Ipad.  Then today when I dusted off the desktop, I get errors...
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on December 01, 2012, 08:53:44 AM
Ronmar,

Sorry you have been having issues.  Good point about NEEDing zip, it is after all only 65K or so.

I just posted an updated 0.0.2 version, not in a Zip, and as a .txt file...

(Boy, seems more work getting this stuff posted so folks can read it -  then the project its self  ;) )

Changes in the 0.0.2 version include:

I placed more 'DEBUG' code in, mostly to allow for simulation.  You can see a lot of this in the Kubota_start() function.

Overall, I feel there is still work to do around readability.  Not too happy with how things laid out, and perhaps inconsistency in function level (e.g. which global variables are changed by the function vs. the calling function..).  After I get away from it for a while, might look a the overall structure some.  Will see.

Thanks again for all who are interested in this, and following!
-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on December 11, 2012, 06:49:25 PM
Still working on the source while I await getting my hands on hardware.

Tonight I posted revision 0.0.4 of the source code, still pre-production (and pre-hardware), but have been making changes to add functions  improved reliability, and correcting errors I find while 'simulating' the software by running in Debug mode on an Arduino.

This version primary adds throttle control to the logic.  I smoothly take the throttle up while starting, and once the charger enters Float Mode, it will back down on the throttle to accommodation the lower load being placed on the Kubota.  I also corrected the RPM calculation function, and added in some configuration parameters to make it easy to adapt to different alternators and pulley ratios.  Version 0.0.3 included a oneWire presence test during startup, and restructuring of the main-loop from in line code to supportive function calls.  Hopefully this will help some with readability.

Next week we travel to Portland for the holidays, and the PCBs and parts are waiting for us at our mail-drop.  Upon returning in January, will begin assembling the hardware and then can make some real progress!

And a side note:  I use wordpad in winXP  to edit the source file.  If you open the file, using the same will  preserve formatting and spacing.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 02, 2013, 10:23:04 AM
The Parts are here!

Here are a couple of photos of the Pile of Parts and one of the PCBs. 

(http://4.bp.blogspot.com/-mMr_8yNBfIo/UORoproBPoI/AAAAAAAAJQQ/eooAGFgZILo/s1600/IMG_3267.JPG)

(http://4.bp.blogspot.com/-wbNf0bLtODg/UORoq-SoeRI/AAAAAAAAJQY/ymoVh4YMGfo/s1600/IMG_3268.JPG)

Time to warm up the Soldering Iron!  But sadly, that will need to wait till next week as in addition to bringing back these parts, we stuffed our poor rental car with other goodies and some of those projects on Viking Star will take priority (ala, installing a new main inverter for the one that failed last month).

And will also say, I really miss our old house at times like this.  With is 4' x 8' "work shop table" and lots and lots of room to spread out all those little bags.   But oh well, 'living on a boat' has its +++ and ----  ;D

Next week I expect to start assemble, will also need to build up some courage towards hand-soldering those INA-220s (there are the two really-small rectangles below C6 and C8 about mid place on the left side of the PCB...  Awk, was about the only part I could not source in Through Hole!)

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 02, 2013, 11:47:37 PM
Great looking PCB William!  Wow, you got them silk screened too.  If you don't mind, who did your board and what price?
I've been using expresspcb.com and have been very happy with their work, but am always on the lookout for a better bargain.   


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 07, 2013, 12:30:58 PM
Quote from: BruceM on January 02, 2013, 11:47:37 PM
...   If you don't mind, who did your board and what price?
.....


Bruce,  Thanks.  I ended up using Advanced Circuits, and specificly their $33/board special: http://www.4pcb.com/33-each-pcbs/index.html (http://www.4pcb.com/33-each-pcbs/index.html) for 2 sided board up to 60 sq-in.  (They also do 4-layer PCBs for $66)

Now, it is a bit misleading as though the price per board is $33, one needs to purchase 4 of them!  (So, if anyone wants an extra board to play with, let me know - else they will become Green Coasters  ;D )  In the end, the total cost was $149.92, including S&H.

I had looked at other venders, and some promising ones included:
   6.4 x 5.1 = 32.64sq. in.   /   163 x 130mm - Note this was only the main PCB, did not include the remote PCB

   PCB Express = $217 (2x boards min.)
   SunStone    = $122.92
   BatchPC      = $91.60 ** Lowest Price 1pc **

   *** Silvtronics    = $102,  plus $12/extra PCBs - Includes full Elec Check! (Mylasia) ****

   Sunstone  = $123 (Oregon)
   PurPCB =$95  ($5/extra PCB)
   Gold Phoenix PCB = $100
   

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

As I am sure you know one-offs are always expensive.   I ended up selecting Advanced Circuits over some of the other options (ala Batch PCB, and Silvertronics) mostly do to a combination of lots of good recommendations I found when doing Google, and also - to be honest - their $33 deal.  Even though it cost me a bit more due to requiring 4x boards, if one is going to school (and has a .edu email address) they drop this 4x requirement.  http://www.4pcb.com/pcb-student-discount.htm (http://www.4pcb.com/pcb-student-discount.htm)l  I kind of like that (and told the sales lady the same when she called me) - their support of students in this way is what tipped my decision.  Do wish I could have order them with tin-lead plating as opposed to lead-free. (Just solders so much nicer - and stores better as well).  But alas, that seems to be going away quickly.  (And I could have gotten tin-lead plating, but not under the $33 deal).   

I did need to do the CAD work to merge the two separate PCBs into one board submitted to them, but even I had no issues figure out how to do that in KiCAD.  Hence the odd-shape - hack saw and file made quick resolution.

PCBs look fine, hope to start some assemble this week.

Should also point out their free automated design checker - it picked up several issues in the gbr files and I found that useful (even if I had not placed the order with them)

I am also intrigued by batchPCB.com - esp for small one-off boards - their approach and cost are very reasonable (flat $2.50 / sq-in)  and I will likely use them in the future for smaller PCBs (smaller in physical size)

-al-

 

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 07, 2013, 03:28:47 PM
Thanks for the good info on PCB vendors, William!  I'll check them out.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mobile_bob on January 07, 2013, 03:59:44 PM
will any of these pc board guys take an existing board and reproduce it?

the reason i am asking is one of my boards has been discontinued by the oem
and i am sure i could get them to ok me having it replicated.

the other board is made in china, and i (like them) really am not concerned with copy infringement issues.

just curious

bob g
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 07, 2013, 05:05:08 PM
I have no idea about backing out an existing PCB to replicate it.  I would think they would need to re-CAD it is some way to end up with the appropriate layer files.    Perhaps this would be a two-step process - get someone to regenerate the CAD drawings, and then use one of these companies to fab the board?

Are these two boards of yours large and complex?

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: yellowhead on January 07, 2013, 06:39:30 PM
Quote from: thomasonw on January 07, 2013, 12:30:58 PM



Now, it is a bit misleading as though the price per board is $33, one needs to purchase 4 of them!  (So, if anyone wants an extra board to play with, let me know - else they will become Green Coasters  ;D )  In the end, the total cost was $149.92, including S&H.

[/quote]

I'd be happy to take on of those extra boards off your hands for $33 (or more for that matter since I couldn't get a one off for that :) I've been following your project with interest and at some point I expect to be trying something very similar. What you have is close enough to what I need so that using your board would put me way ahead of assembling it from regular Arduino boards and shields.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mobile_bob on January 07, 2013, 08:06:55 PM
one board is double sided about 2.2" x 2.2" , half of which is prototype area

the other is about 4 x 5" double sided, it has 8 relays spst, a 2x8 female idc socket
, 8 led's, resistors, and not much else, maybe a diode for polarity protection.

now that i think about it, i might have the art files for the boards, that would probably do it?

bob g
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: SPSInc on January 08, 2013, 07:09:17 AM
Hi Bob,

I might be able to help you out. I layout PCBs on a fairly regular basis. Do you have a schematic of the boards? Doesn't appear to have too much on them.

I've used Advance Circuits a lot. The $33 special is good but their "Barebones" special is great if you can live without a soldermask and silkscreen. Take a look a Imgineering Inc. (pcbnet.com). They have some good prototype specials too.

Eric
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 08, 2013, 01:54:40 PM
Quote from: yellowhead on January 07, 2013, 06:39:30 PM

I'd be happy to take on of those extra boards off your hands for $33 (or more for that matter since I couldn't get a one off for that :) I've been following your project with interest and at some point I expect to be trying something very similar. What you have is close enough to what I need so that using your board would put me way ahead of assembling it from regular Arduino boards and shields.

Yellow Head, you are more then welcome to a board - and if you want to pass on the cost, that is fine as well  ;)

What all is your project?  Somewhere in the back of my mind I had thought this effort might become a basis for a basic engine controller for folks, and hence I tried to make things a bit more generic when making choices.

Drop me an email at mvVikingStar@gmail.com and we can set up the details.  And if you have time, perhaps it would be best to  hang tight for a few weeks till I bring one of these up and see if they even work!

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 08, 2013, 01:57:56 PM
Quote from: mobile_bob on January 07, 2013, 08:06:55 PM

<SNIP>

now that i think about it, i might have the art files for the boards, that would probably do it?

bob g

Bob,  if you have the layers artwork, I think that is mostly what is required.  Are they in electronic form?  If so, you likely are good to go!   Even if you use a different vendor, perhaps running them through the Advanced Circuits design checker app would clear things up quickly.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: yellowhead on January 08, 2013, 07:21:23 PM
Quote from: thomasonw on January 08, 2013, 01:54:40 PM

Yellow Head, you are more then welcome to a board - and if you want to pass on the cost, that is fine as well  ;)

What all is your project?  Somewhere in the back of my mind I had thought this effort might become a basis for a basic engine controller for folks, and hence I tried to make things a bit more generic when making choices.

Drop me an email at mvVikingStar@gmail.com and we can set up the details.  And if you have time, perhaps it would be best to  hang tight for a few weeks till I bring one of these up and see if they even work!

-al-


I have a Changfa R175 belted to a Leece-Neville 555 (picture attached I hope) and I'm planning to use it to charge a 48V battery bank based on the work done by mobile_bob (thanks bob!)

I was originally going to run the thing fast at full field and let my solar charge controller take care of the battery regulation. But the idea of matching engine speed to load is appealing as is removing the charge controller from the charging path. This allows me to supplement whatever is coming through the charge controller to handle 'big loads' as well as providing a bit of backup if the charge controller should ever fail.

I've dabbled with the Arduino before; seeing your project made it an easy choice. Thanks so much for sharing it. I think it will make a great basis for a general alternator based charge controller. Having a single board that does 90% of what I need seemed like too good an opportunity to pass up.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 10, 2013, 01:00:46 PM
Well, I could not stand it any more - despite a PILE of other things to do I had to start playing with this project.  Last night I soldered in most the Big Stuff:

(http://3.bp.blogspot.com/-gBBzfLhyUJY/UO8ZlDW302I/AAAAAAAAJRY/J9zV_pdt_K0/s1600/IMG_3272.JPG)

And today hope to make more progress with the SMD's.  Still am not looking forward to the INA-220's, despite being wonderful little devices - they look littler and littler to me each time I peak at the PCB traces. . . .

Have not discovered too many problems so far, but of course there are some - though they are easily corrected.  And will also add:  "Yellowhead" and I have been talking off line on how to use this with his 48v DC generator.  So far looks rather doable, providing the alternator still uses a 12v field.

Will post more here when I get the rest of the board set up, and if folks want more blow-by-blow details I am trying to keep them here:

http://smartdcgenerator.blogspot.com/search/label/Status (http://smartdcgenerator.blogspot.com/search/label/Status)



-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 10, 2013, 04:43:56 PM
Sorry about your LCD misalignment, William.  I think it's one of those laws of nature that 1st cut PCB art work is never perfect.  I know mine sure aren't!

I was wondering what you're using for hand SMD work...Chipquick?  I have avoided SMDs but it's looking more and more impossible to avoid.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 10, 2013, 09:20:50 PM
Quote from: BruceM on January 10, 2013, 04:43:56 PM
  I have avoided SMDs but it's looking more and more impossible to avoid.



Bruce, thanks for the continued encouragement.  Yes, SMD parts are just so common these days - you will note I used good old fashon Through Hole parts where I could. . .  But I wonder if they will go the way of lead plating. . . .

On Soldering the SMD parts, I am 1st tinning the pads with leaded solder, then placing the part and tacking one lead.  After checking, tacking the rest.  Along the lines of: http://www.youtube.com/watch?v=3NN7UGWYmBY

However, I have no mag glass, and have been using the camera in 'micro focus' mode to take photos then enlarge them on the computer to see my progress. And of course I need to time my efforts between the ferry runs as the ferry dock is right next where we are moored for the winter.    Perhaps tomorrow I will skip caffeine and tackle the INA-220!  But 1st I need to finish up with the passives and test the 5-volt switcher, this is my 1st switching PS and I relied A LOT on the app notes.  So . . . .

And thanks for the lead on Chipquick, seems an interesting product.  But perhaps more to aid removal then initial install?

(Notice I am passing over the LCD thing.  Oh Well, if that was the the only time in life something went a little wrong  ::)  )

-al-


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 11, 2013, 09:24:54 AM
Thanks for the u-tube link.  I remember that video now.  The video makes it look easy, but I didn't see the soldering iron shaking over a half inch area like mine does.  :P

You'll definitely want steady seas.  Good luck, and let us know how it goes.  Victory to the bold!







Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mike90045 on January 11, 2013, 12:12:38 PM
QuoteOn Soldering the SMD parts, I am 1st tinning the pads with leaded solder, then placing the part and tacking one lead.  After checking, tacking the rest.  Along the lines of: http://www.youtube.com/watch?v=3NN7UGWYmBY 

That's the way I do it too.  I have a PCB pattern and parts list for a 48V- 12V board, that handles a couple hundred watts, if anyone wants the gerber file.   slide show here.  http://www.naturalstudies.org/Photo_galleries/LED_driver/
(http://www.naturalstudies.org/Photo_galleries/LED_driver/)

Distributing 48v is much less lossy, than trying to run hundreds of watts via 12V
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Ronmar on January 11, 2013, 05:28:08 PM
Quote from: BruceM on January 11, 2013, 09:24:54 AM

You'll definitely want steady seas.  Good luck, and let us know how it goes.  Victory to the bold!

You havn't really worked on electronics untillyou have tried to repair a circuit board trace and replace burnt components while your ship is breaking ice:)
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 12, 2013, 07:40:03 PM
Quote from: Ronmar on January 11, 2013, 05:28:08 PM

You haven't really worked on electronics untill you have tried to repair a circuit board trace and replace burnt components while your ship is breaking ice:)

Well, no ice breaking, and managed to work between the rocking.  Tonight I finished assembling the two boards and even powered them up!

(http://3.bp.blogspot.com/-YeSNuK7CmUA/UPIT0qnK_mI/AAAAAAAAJS4/rvJgvXWLxHM/s1600/IMG_3350.JPG)
17.6mA draw, and 4.99v from the 5V switcher.   And two LED light up!


As expected, the SMD parts were a PITA.  But in the end it looks OK.   I am planning on revising the design, and one thing I am looking to do as add the ability to use a MSOP to DIP addaper board, like:

(http://4.bp.blogspot.com/-EU4Lt4d4x9Y/UPIWfZX8g0I/AAAAAAAAJTI/L3vbvyiiekQ/s1600/MSOP-10_adapter_DIP.jpg)

In that way one can pre-solder the INA-220's, verify their function, and then solder the entire unit onto the main board.  Of course will leave the native INA-220 pads so someone can mount them direct if they wish...

And here are some more photos for your enjoyment.

(http://4.bp.blogspot.com/-tRgcL0ZCKeE/UPITyMEfqII/AAAAAAAAJSY/wmnQevi0ubM/s640/IMG_3336.JPG)

(http://2.bp.blogspot.com/-JTM6D8WbqiY/UPITzm5gzmI/AAAAAAAAJSo/AZ_qp63eI8c/s400/IMG_3339.JPG)

(http://4.bp.blogspot.com/-Nq5AWilJaPA/UPITyg1a-mI/AAAAAAAAJSg/QAU_rSQGuIk/s1600/IMG_3316.JPG)
               (This was one of the close-up photos I used to check out the INA-220 soldering...)


A few more at: http://smartdcgenerator.blogspot.com/2013/01/ready-for-software-loading.html (http://smartdcgenerator.blogspot.com/2013/01/ready-for-software-loading.html)

Next step will be to install the Arduino boot-loader and then start testing out sub-systems. 


-al-



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 12, 2013, 08:27:22 PM
Nice work on the SMDs, William. They look great. I think I'd be better suited to the adapter board approach.

I hope the INA-220's check out without a hitch.  They sure are a nice solution.

Thanks so much for letting us follow your progress!


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Ronmar on January 13, 2013, 12:03:39 AM
Check R-10 in that closeup pic.  It looks like the one end needs to be re-flowed as it might not have bonded to the trace on the top of the circuit board(I don't see any solder:()...  Sorry, the QA gene kicked in:)  When you get a bulged solder union on the side you applied the solder on, that usually indicates too little heat(or a little too much solder).  When the component lead dosn't get hot enough, the solder resists wicking down into the hole and out onto the trace/pad on the component side of the board.  That is what looks like happended to the left end of R-10.  When you get a bulge on the component side, that usually indicates too much solder applied, it flows down the lead, out onto the trace on the component side and continues to build/bulge pulled by gravity.  Ideally, each side of the board has just enough solder to form a fillet that extends to the outside edge of the pad around the lead, and about the same distance up the lead...

Soldering is definitely one of those skills that needs practice.  Best advice I got and that I continue to pass along is to get some breadboard and cuttoff the ends of resistor leads(still enough left on the resistor to install) Or use whole resistors to practice with.  I still do it occasionally, especially before starting a project or tricky repair.  Radioshack used to sell these little 2" X 2" breadboard squares full of circular pads that were great for practice...  I solder two or three pads then QA with a magnifying glass, then solder 2-3 more. This really helps to get your heat application and solder application timing/rythm fine tuned... 

Solder issues can cause the weirdest problems, especially when you throw vibration/shock temperature change into the mix...
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 13, 2013, 09:18:54 PM
Quote from: Ronmar on January 13, 2013, 12:03:39 AM

Check R-10 in that closeup pic.  It looks like the one end needs to be re-flowed as it might not have bonded to the trace on the top of the circuit board(I don't see any solder:()...  Sorry, the QA gene kicked in:) 


QA Guys, I remember them from my PM and EE days.  They were the guys that had all the COOL equipment, thermal cameras, microscopes, saws to cut apart solder and crimp joints to look at under their microscope. . . .   I also remember learning a LOT from those folks.  Ronmar,  yea - that one needed to be re-fluxed and re-flowed.  I had gone back and touched up a few solder joints like that after I took the photo..  (Really, I had!).   But your points are 100% on, and not just solder joints.  I think any connection introduces points of failure - and that was one of the reasons I selected to place the Amtel CPU down on the the controller board as opposed to making an Arduino 'shield' - less connectors...

And speaking of that Amtel CPU - today I was able to burn in the boot-loader, connect up a USB cable and download some Arduino sketches  (Sketches is Arduino speak for program).   AND I was able to verify the two INA-220s are working!   Yea!

(http://3.bp.blogspot.com/-GfT-bpzI4Q0/UPN_H6cSUgI/AAAAAAAAJWg/rxa2yULOH7E/s1600/IMG_3358.JPG)
              (Burning in the Arduino boot-loader using the Uno as a master)

Next step will be to start working through the program with real hardware, as opposed to the mocking up I had been doing using the Arduino Uno.  Lots of debugging I am sure. 

And now that I have verified the INA-220's are alive I can solder in the two bypass caps C6 and C8  (plus, check again the solder joints ;) )

And btw: For anyone else looking to burn in an Arduino boot-loader - there seems to be a problem using the built in Burn utility.  Esp if using a Uno board for the master.  I found another burner called OptiLoader that worked great:  https://github.com/WestfW/OptiLoader (https://github.com/WestfW/OptiLoader)

Google optiLoader for lots of examples of how to use it (including some youtubes), and I put instruction on the blog for how to burn the controller board.  Click on the Assembly button at the top of the blog page.  And if folks wish to bypass all this, Amtel-328 CPUs are available with the bootloader already burned in.

-al-

Title: Worlds Smallest Diesel DC Generator! (And some results).
Post by: thomasonw on January 18, 2013, 07:56:30 PM
Introducing the Worlds Smallest Diesel Generator!  Delivering upwards of 2Ks of 'simulated' power, with easy Software Only update to a 4KW unit!!

(http://3.bp.blogspot.com/-XDpDkMbla8o/UPny7H38fWI/AAAAAAAAJYw/VxoDmHyyuEw/s1600/IMG_3397.JPG)

And best of all, it is available for well under $20 !!!     ;)


Over the past couple of days I have been using an Arduino UNO to simulate how the real Kubota DC Generator and Battery would respond while debugging the Smart Generator and Engine Controller.   Been focusing on control and regulation of Amps, Volts, Watts and EGT as well as testing fault conditions and automatic Starting / Stopping.  (Wish I could get the UNO to say 'Grrrrrrr' when it senses the starter is being asked for.  So far, I only light up a small LED. . .).  Have not done anything with throttle / speed control yet.

So far am encouraged.  Here is a graph showing the results of a Simulated run.  The Top line is the power delivered to the 'battery' as measured by Watts.:

(http://2.bp.blogspot.com/-v3aZwDLhNk8/UPn0jpbTXXI/AAAAAAAAJZM/kxyO8qLIByE/s1600/Smart+Regulator.JPG)

Lots of measurements are shown (VBat, Amps, EGT, etc.), sorry for not cleaning  it up.  The one to focus on is the top line - that is the Watts being 'delivered'.  In this early run I noted several spikes.  Need to work to see if those are in the Controller firmware, or perhaps an artifact of the UNO Simulator.



And for reference, look at the results of this run:

(http://1.bp.blogspot.com/-Z4hudLJcSAg/UPn2lVVZyqI/AAAAAAAAJZg/YYn8bUAH1ig/s1600/Typical+Regulator.JPG)

This time the controller was configured to preform along the lines of a typical 'external 3-stage regulator'.  (Ones that monitors only voltage - not Volts and Amps as this controller does).  Notice the red triangle at the top left, the Unused Capacity?   It is an outcome of Amp control / limit being left to the self limiting nature of an alternator and only pulling back as battery voltage rises.   Given that a system needs to be sized to where peak alternator watts align with the peak capability of the driving engine -  we end up with unused excess engine capacity before the peak load point is reached.   In the 1st graph Amps are driven higher during the initial charging period - fully matching watts delivered to the capability of the driving engine.  As battery voltage raises the Amps are reduced - maintaining  a constant load to the engine.
 
More to do,  will be looking into those Spikes next and refining the Field PWM algorithm as it takes into account Battery Volts, Amps, Watts load to the engine, and  EGT (which seems to be a fair proxy for relative engine loading - and may lead to 'self optimizing' management of engine loading).  Then debugging the speed control - matching  speed to load (slowing down the engine as the battery charges and watts delivered are reduced).  And who knows, maybe even connecting this to the REAL Kubota / DC Generator!

And maybe it is OK to solder in C6 and C8, seeing as the INA-220's are working well!

Fun, Fun, Fun!

-al-








Title: Re: Worlds Smallest Diesel DC Generator! (And some results).
Post by: Lloyd on January 19, 2013, 12:03:13 AM
Thomas,

I think I must need a little more info. Like a key to the graphed data.

It's all fun and games to test the board...but I also want to see a real engine driving a real alternator, into a real discharged bat bank. For this board test how did you model the engine, the alternator, and the bat bank.

Thanks for your work. I will be curious to see how your systems work in comparison to mine using the Balmar regulator with DBW speed control to match amps to engine load. I have the parts now just need to find sometime to finish the install.

Lloyd


Quote from: thomasonw on January 18, 2013, 07:56:30 PM
Introducing the Worlds Smallest Diesel Generator!  Delivering upwards of 2Ks of 'simulated' power, with easy Software Only update to a 4KW unit!!

(http://3.bp.blogspot.com/-XDpDkMbla8o/UPny7H38fWI/AAAAAAAAJYw/VxoDmHyyuEw/s1600/IMG_3397.JPG)

And best of all, it is available for well under $20 !!!     ;)


Over the past couple of days I have been using an Arduino UNO to simulate how the real Kubota DC Generator and Battery would respond while debugging the Smart Generator and Engine Controller.   Been focusing on control and regulation of Amps, Volts, Watts and EGT as well as testing fault conditions and automatic Starting / Stopping.  (Wish I could get the UNO to say 'Grrrrrrr' when it senses the starter is being asked for.  So far, I only light up a small LED. . .).  Have not done anything with throttle / speed control yet.

So far am encouraged.  Here is a graph showing the results of a Simulated run.  The Top line is the power delivered to the 'battery' as measured by Watts.:

(http://2.bp.blogspot.com/-v3aZwDLhNk8/UPn0jpbTXXI/AAAAAAAAJZM/kxyO8qLIByE/s1600/Smart+Regulator.JPG)

Lots of measurements are shown (VBat, Amps, EGT, etc.), sorry for not cleaning  it up.  The one to focus on is the top line - that is the Watts being 'delivered'.  In this early run I noted several spikes.  Need to work to see if those are in the Controller firmware, or perhaps an artifact of the UNO Simulator.



And for reference, look at the results of this run:

(http://1.bp.blogspot.com/-Z4hudLJcSAg/UPn2lVVZyqI/AAAAAAAAJZg/YYn8bUAH1ig/s1600/Typical+Regulator.JPG)

This time the controller was configured to preform along the lines of a typical 'external 3-stage regulator'.  (Ones that monitors only voltage - not Volts and Amps as this controller does).  Notice the red triangle at the top left, the Unused Capacity?   It is an outcome of Amp control / limit being left to the self limiting nature of an alternator and only pulling back as battery voltage rises.   Given that a system needs to be sized to where peak alternator watts align with the peak capability of the driving engine -  we end up with unused excess engine capacity before the peak load point is reached.   In the 1st graph Amps are driven higher during the initial charging period - fully matching watts delivered to the capability of the driving engine.  As battery voltage raises the Amps are reduced - maintaining  a constant load to the engine.
 
More to do,  will be looking into those Spikes next and refining the Field PWM algorithm as it takes into account Battery Volts, Amps, Watts load to the engine, and  EGT (which seems to be a fair proxy for relative engine loading - and may lead to 'self optimizing' management of engine loading).  Then debugging the speed control - matching  speed to load (slowing down the engine as the battery charges and watts delivered are reduced).  And who knows, maybe even connecting this to the REAL Kubota / DC Generator!

And maybe it is OK to solder in C6 and C8, seeing as the INA-220's are working well!

Fun, Fun, Fun!

-al-









Title: Re: Worlds Smallest Diesel DC Generator! (And some results).
Post by: thomasonw on January 19, 2013, 01:54:28 AM
Quote from: Lloyd on January 19, 2013, 12:03:13 AM
Thomas,

I think I must need a little more info. Like a key to the graphed data.

It's all fun and games to test the board...but I also want to see a real engine driving a real alternator, into a real discharged bat bank. For this board test how did you model the engine, the alternator, and the bat bank.

Thanks for your work. I will be curious to see how your systems work in comparison to mine using the Balmar regulator with DBW speed control to match amps to engine load. I have the parts now just need to find sometime to finish the install.

Lloyd


That will come, just need to be patient.  All journeys start with the 1st steps!  Once I am happy with how the regulator / controller performs on the test jig will install it on our existing DC generator / house battery.  But before I take that step I am going to wring out as many issues as I can 'on the bench'. 

And yes, will be interesting to see how this works compared to the assembled off-the self solution.  One thing I will say:  In searching before I  had only located one other alternator regulator which monitored both Volts and Amps for adjusting the field - and it was only available as part of their very expensive DC generator solution.  Perhaps there are some out there, but I was unable to locate one!

-al-


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 19, 2013, 05:17:03 AM
First class work on the software development and simulation effort, William.  There's no point in abusing an engine and alternator until you're satisfied with your software operation, controlling algorithms and logic.  It's an important step, one that I guess only other programmers can truly appreciate.

Congratulations on your rapid progress!




Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: veggie on January 19, 2013, 07:47:43 PM

+1 for BruceM's comment.
Very impressive simulation !
This gives you ability to test the bulk of the system logic in a comfortable controlled environment, then tweak the remaining details on the live system later.

Looking forward to your report on the initial "live" trials.
... and of course a YouTube video showing the start-up sequence and operation  ;)

cheers,
veggie
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 19, 2013, 09:23:05 PM
Quote from: veggie on January 19, 2013, 07:47:43 PM

+1 for BruceM's comment.
Very impressive simulation !
This gives you ability to test the bulk of the system logic in a comfortable controlled environment, then tweak the remaining details on the live system later.

Looking forward to your report on the initial "live" trials.
... and of course a YouTube video showing the start-up sequence and operation  ;)

cheers,
veggie

Ha!  Been thinking of a You-tube of the micro generator!  (always new fin things to try).  Today I debugged the auto throttle matching.  Think our camera will  take videos.

The effort is going well, I might be ready to do a real-run soon, but to be honest had been hoping for the weather to warm up a bit 1st  ::)

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: RJ on January 20, 2013, 05:02:05 AM
Very interesting project, how hard would it be to modify this to control an alternator with a 24v field that is controlled on the negative side?

Randy
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 20, 2013, 09:24:18 AM
Quote from: RJ on January 20, 2013, 05:02:05 AM
Very interesting project, how hard would it be to modify this to control an alternator with a 24v field that is controlled on the negative side?

Randy

To operate on 24v would be a small change - the main inductor in the switching power supply should be changed, and the I2C regulators would need to be watched for heat - though so little current is used in them I suspect there would be little issue.   Then of course the resister divider ratios and crow-bar would need to be adjusted.

This would allow for full operation on 24v - controller, remote, powering 24v devices (starters, field, throttle control motor, etc..)

Directly driving LOW side would be more difficult - though mounting some FETs on an external heat sink could be used to convert the high-side drive to a low-side drive.  (Interesting there was a lot of early talk about High side vs. Low side drive early on... :(  )


Have also looked at using this controller with a 48v system, and that brings in different issues.  Many of the logic devices have Vmax limits around 40v.  However, if one is able to power the controller from a 12/24v source and drive 12/24v devices (throttle controller, etc) and a 12/24v Field this will work well.  And one could also look to add an external Field FET pack to drive a 48v field if needed.

Have been working with some one looking to do a 48v alternator that uses 12v for the 'system' (starter, throttle, etc.) as well as a 12v Field.    If you are interested in 24v verion  I can look into that in more details.  Let me know.  And into the idea of an external FET pack, to get the LOW side drive . . . .  Thinking perhaps an opto-isolated connection would allow for a 'universal' high or low side driver...

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 20, 2013, 10:36:21 AM
Perhaps it's easier to just make a version of the board for low side drive?

One feature to add for a public version might be some sort of over battery voltage crowbar on the PWM signal. That way if there was a sudden large load drop, and the battery is modest in size you wouldn't get a brief overvoltage before the software gets around to adjusting the PWM signal.  It would also be a good safety backup in case of processor or software glitch.  (I was thinking of someone else's software mods, of course, not yours, William!  :) )

Another thought would be to consider elimination of the buck converter for 5V supply.  The board use of power is so low that a linear regulator might end up saving power, especially if a low noise LDO regulator was used.  (I've found this to be true on my battery bank controller.) Secondary benefit would be less noise problems on current and voltage conversions.  I know for your own use you have other 5V things planned but for public use the linear approach is smaller, cheaper, bullet proof.

Congrats on your outstanding work!
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 20, 2013, 01:47:00 PM
Quote from: BruceM on January 20, 2013, 10:36:21 AM
Perhaps it's easier to just make a version of the board for low side drive?

One feature to add for a public version might be some sort of over battery voltage crowbar on the PWM signal. That way if there was a sudden large load drop, and the battery is modest in size you wouldn't get a brief overvoltage before the software gets around to adjusting the PWM signal.  It would also be a good safety backup in case of processor or software glitch.  (I was thinking of someone else's software mods, of course, not yours, William!  :) )

Another thought would be to consider elimination of the buck converter for 5V supply.  The board use of power is so low that a linear regulator might end up saving power, especially if a low noise LDO regulator was used.  (I've found this to be true on my battery bank controller.) Secondary benefit would be less noise problems on current and voltage conversions.  I know for your own use you have other 5V things planned but for public use the linear approach is smaller, cheaper, bullet proof.

Congrats on your outstanding work!
Bruce

Bruce,

Thanks for the ideas.  I do have the crow-bar on there, but it currently takes down the whole controller - perhaps just taking out the Field drive would be a better approach.  And yes, the Switch reg looks fun, but given the low amps draw I see you point.  And am thinking there should be a way to make a 'universal' high / low driver design - with jumpers to select. 

Anyone else have ideas for changes /  improvements?

-al-


Title: Youtubes
Post by: thomasonw on January 20, 2013, 10:24:26 PM
Here are a couple of You-tubes,  the 1st one showing a trial run of the controller with the UNO based generator simulator:  http://www.youtube.com/watch?v=4zDpfDg4biY (http://www.youtube.com/watch?v=4zDpfDg4biY)


And here is walk-through of the system at this point:  http://www.youtube.com/watch?v=80CcIWkqnqM (http://www.youtube.com/watch?v=80CcIWkqnqM)

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: RJ on January 21, 2013, 08:33:26 AM
Quote from: thomasonw on January 20, 2013, 09:24:18 AM

To operate on 24v would be a small change - the main inductor in the switching power supply should be changed, and the I2C regulators would need to be watched for heat - though so little current is used in them I suspect there would be little issue.   Then of course the resister divider ratios and crow-bar would need to be adjusted.

This would allow for full operation on 24v - controller, remote, powering 24v devices (starters, field, throttle control motor, etc..)

Directly driving LOW side would be more difficult - though mounting some FETs on an external heat sink could be used to convert the high-side drive to a low-side drive.  (Interesting there was a lot of early talk about High side vs. Low side drive early on... :(  )


Have also looked at using this controller with a 48v system, and that brings in different issues.  Many of the logic devices have Vmax limits around 40v.  However, if one is able to power the controller from a 12/24v source and drive 12/24v devices (throttle controller, etc) and a 12/24v Field this will work well.  And one could also look to add an external Field FET pack to drive a 48v field if needed.

Have been working with some one looking to do a 48v alternator that uses 12v for the 'system' (starter, throttle, etc.) as well as a 12v Field.    If you are interested in 24v verion  I can look into that in more details.  Let me know.  And into the idea of an external FET pack, to get the LOW side drive . . . .  Thinking perhaps an opto-isolated connection would allow for a 'universal' high or low side driver...

-al-


My engine controls will operate off of 12v, starter, throttle control, etc. I have  attached a diagram on how my alternator is hooked up. It's a large brushless 6 phase alternator rated at 400a at 28v and 50a at 12v, however the 12v is derived from the regulator and not directly from the alternator.

Take a peak and see what you think. Talking with C.E. Niehoff the max field current draw is nearly 28a although speaking with them typically it would be half that.

-Randy

Title: Systems other then 12v - -
Post by: thomasonw on January 22, 2013, 07:12:08 AM
Quote from: RJ on January 21, 2013, 08:33:26 AM

My engine controls will operate off of 12v, starter, throttle control, etc. I have  attached a diagram on how my alternator is hooked up. It's a large brushless 6 phase alternator rated at 400a at 28v and 50a at 12v, however the 12v is derived from the regulator and not directly from the alternator.

Take a peak and see what you think. Talking with C.E. Niehoff the max field current draw is nearly 28a although speaking with them typically it would be half that.

-Randy


Randy,  Yes - that is quite the beast of an alternator!  In thinking about 'other voltages' over the past couple of days, I think it can be framed in three broad catagories:

1) Voltage of accessories:  Fuel Pump, Throttle Control, etc.
2) Voltage of alternator Output and Battery
3) Voltage of Field Drive.

With regards to this controller in its current form:  In a 12v world all three above are the same and all is good.  In a 24v world, this would still be true - though some small change to the +5v regulator is needed  as well as resister values in the voltage dividers.


However, in a pure 48v world there are issue in that many components (ala the H-Bridge for the throttle controller, VBat input to INA-220's etc) are limited to a V-Max of around 35v-40v.   In a PURE 48v world this design would not work as is.

------------------------------------------------------------

Now, if all the above voltages are NOT the same, for example if the Battery and alternator output is 48v (Item 2 above) while all the accessories are 12v (or 24v) - this design will work with simple resister modifications to pre-scale the 48v sampling lines down.   AND if by chance the Field is also 12v (or 24v) (Item 3 above) all is well!  (This is how "yellowhead" is looking to run his system).


BUT:   If the Field Voltage (Item #3 above) needs to be 48v, or the Field needs to be driven from the LOW side- the current layout will not work.  Either an external FET daughter board would be needed, or the design modified to accommodation a low side drive.  I am planning on revising the artwork once I bring up this board and have it running on the actual Kubota/DC generator we have, and can look into making those design changes.  So, THAT issue can be solved.

-----------------------------------------------------------

NOW:  To your alternator / system:  Sounds like you would be running in a 12v Accessory standpoint (Item #1 above), so that is no problem.  24v output (Item #2) is easly handled via resister changes, and item #3 (The LOW side drive) could be handled either with the current PCB artwork via an external FET driver, or with revised artwork.

But I am wondering what you are looking to do about the 12v charging output?  I located this doc from Ce Niehoff: http://www.ceniehoff.com/Documents/Ctrl_Hyperlink/TG0014D_uid12172009224052.pdf (http://www.ceniehoff.com/Documents/Ctrl_Hyperlink/TG0014D_uid12172009224052.pdf)  which describes how an SCR pack is used to reflect the 12v output and at the same time regulate it to 12v.  If you wanted to retain that feature, I think it would be a bit much to support with this project:  managing both the 24v and 12v outputs of the alternator.  However, if you are looking to only bring out 24v from this alternator, and get the 12v replenished via some other means - a 2nd small alternator or perhaps a 12v 'battery charger' then with something to handle the LOW side field issue I think this project would work fine.  (And I think the 28A Field current can be easily handled with FETs, it is just a case of getting them to drive from the LOW side)

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: RJ on January 22, 2013, 02:36:29 PM
I'm not terribly concerned with retaining the 12v feature of the regulator. I can charge the starter battery with either a traditional charger or simply leave the system manual start, I could run the controls through a DC/DC converter to bring the voltage back down to 12v. Everything is still in the planning and collecting parts stage at this point. The only real reason I wanted to maintain 12v for the controls was the more abundant supply or 12v parts. Things can be changed to 24v as long as I can get the parts needed. Ideally I would like to go to 48v, but I have not had the time to try my hand at taking the alternator apart to see if that is something that can be done. I'll need Bob's help with that. The phases are currently wired in delta, connecting them in WYE would get my voltage up there right around 48v. Testing would then need to be done to see how fast I would need to spin it, and also what my field requirements would be. I'm working on building a test bed to drive the alternator off a small motor for testing purposes.

The only need for the 24/48v would be to charge the batter bank. So it sounds like this system would work for my application with some minor tweaks.

Title: Design revisions
Post by: thomasonw on January 25, 2013, 09:53:26 AM
Quote from: RJ on January 22, 2013, 02:36:29 PM

<snip>
The only need for the 24/48v would be to charge the batter bank. So it sounds like this system would work for my application with some minor tweaks.



Sounds like it would.  I have been revising the artwork and moved to a LOW feed to that will simplify supporting field voltages that are different then the controller voltage.  Still bothered by why almost 100% of other controllers I have seen drive High. . .   But at this point low simplifies support for the mixed voltages so no choice.




Quote from: BruceM on January 20, 2013, 10:36:21 AM

<SNIP>

Another thought would be to consider elimination of the buck converter for 5V supply.  The board use of power is so low that a linear regulator might end up saving power, especially if a low noise LDO regulator was used.  (I've found this to be true on my battery bank controller.) Secondary benefit would be less noise problems on current and voltage conversions.  I know for your own use you have other 5V things planned but for public use the linear approach is smaller, cheaper, bullet proof.



I have been looking into using cascaded liner regulators (to spread the heat load).  1st regulating down to 9v and then to 5.  Doing the math I come up with a Tj on the 9v regulator of 75c while operating in a Ta of 120f.  Reasonable, however if going to a 24v 'system' supply voltage (and using 15v intermediate) we get a Tj of 108c.  The spec calls for Tj-max 150c, but I always worked under the thought of Tj <100c as a magic number.  Would be very interested in hearing others opinions:  Is it worth / reasonable to run at Tj = 108c?  Or is that getting too much on the edge?

Thanks
-al-

(detail math here: http://smartdcgenerator.blogspot.com/2013/01/looking-at-5v-regulator.html (http://smartdcgenerator.blogspot.com/2013/01/looking-at-5v-regulator.html))
(And BTW:  I have been posting links for the TMI level of stuff as opposed to placing it directly in this forum, is this an acceptable practice?  Or, is the custom to Fill The Posts Up and not link to an outside forum?? )
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 25, 2013, 12:29:40 PM
Hi William,
I reviewed your note on linear vs PWM regulation.  How did the controller draw get to 450ma? My PIC processors draw about 2ma at 5V (I'm assuming Atmel is competative), your ina's are about 2 ma each, so where's the 5V power hog?

I was assuming that your board was drawing about 50ma on average, not 10x that. At 450 ma I'd stick with the buck converter.

I'd be looking carefully to find out where all that power is going.  Something must be wrong, or I'm out to lunch, again.

Best Wishes,
Bruce


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 26, 2013, 10:13:14 AM
Quote from: BruceM on January 25, 2013, 12:29:40 PM
Hi William,
I reviewed your note on linear vs PWM regulation.  How did the controller draw get to 450ma? My PIC processors draw about 2ma at 5V (I'm assuming Atmel is competative), your ina's are about 2 ma each, so where's the 5V power hog?

I was assuming that your board was drawing about 50ma on average, not 10x that. At 450 ma I'd stick with the buck converter.

I'd be looking carefully to find out where all that power is going.  Something must be wrong, or I'm out to lunch, again.

Best Wishes,
Bruce




Well Bruce, the answer is simple:  I was being lazy, and am a bit embarrassed.  Being lazy in that with all the wires associated with the test jig, I just did not want to risk disturbing things.  So instead of unsoldering L2 and taking the 5V current draw there I measured the overall "+12v" feed. Used an assumed efficiency ratio for the switching regulator.  Then subtracted out the spec sheet draw of the LCD.   Going back it seems the LCD draws more then the Spec sheet.  And there is more more:  I had unplugged the USB cable to the simulator UNO - and as a result it was drawing +5 from the controller as well....  So there you are:  Lazy, and embarrassed.

Today I did the work I should have done in the 1st place - the controllers +5 draw is  22mA at idle when measured via L2.  Peaking at 26mA while 'under way'.  Redoing the calcs gives a max Tj of 53c in a 24v system with a big heat-sink, and only 77c if no heat-sink is used.   Looks like a simple PCB based heat-pad area (like on the LCD controller) will be just fine.

Thank you Bruce for getting me out of the heat. . . :)


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 26, 2013, 12:12:06 PM
William, glad your power consumption is where it should be. 

26ma is more like what I expected, and there's no buck converter that's going to be efficient at that current, so you might as well keep it simple and use a linear regulator for your public version.








Title: Re: Design revisions
Post by: mike90045 on January 28, 2013, 07:30:49 PM
Quote from: thomasonw on January 25, 2013, 09:53:26 AM
I have been looking into using cascaded liner regulators (to spread the heat load).  1st regulating down to 9v and then to 5.  Doing the math I come up with a Tj on the 9v regulator of 75c while operating in a Ta of 120f.  Reasonable, however if going to a 24v 'system' supply voltage (and using 15v intermediate) we get a Tj of 108c.  The spec calls for Tj-max 150c, but I always worked under the thought of Tj <100c as a magic number.  Would be very interested in hearing others opinions:  Is it worth / reasonable to run at Tj = 108c?  Or is that getting too much on the edge? 

Unless you need ultra clean DC (sn -120dbc) don't stack regulators, look into a switcher that is clean enough, or use a big honking resistor to dissipate some of the heat, near the expected current level.
Or look into the LDO (low drop out) regulators, they drop less voltage across them and dissipate less heat.

Tj of 108c is fine, as long as you make it easy to replace the fried regulators. (and whatever else downstream fries with it)

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on January 28, 2013, 09:41:55 PM
The LDO linear regulators do have about .5 ma or less to ground idle current, vs about 3ma+ for the standard linear regulators.  In William's case of starting with a 12V battery source, with generator power, either would be fine, he only needs one and won't need a heatsink, as he has stated. 

The only problem with series linear regulators (with plenty of voltage drop) is stability, but if you're willing to watch that re: matching the regulator's specs with caps you can do it as William proposed (when he thought his current was much higher than it is.)

If the starting voltage is too high for a 78xx regulator or LDO type I use a PNP darlington transistor with a small zener to base for a pre-regulator, you only need about 0.5 ma of current to ground to adequately stabilize a 1/4 watt zener.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on January 29, 2013, 08:27:29 AM
Thank you all for the continued comments on the regulators, still have time to revise it as I am not looking to 'release' a revised design until after the current controller is tested on an actual generator.  One thing I keep in mind:  the 'source' voltage for this project is really related to the voltage being used by the peripherals, ala the Fuel pump, Starter key-switch, throttle control module.   Even if the driven alternator is 24v, or 48v -   I suspect many deployment will end up being 12v, just because 12v 'parts' are so really available.  And in any case - supplying the controller with more than 24v nominal will cause issues with other components, like the H-Bridge and the FET drivers - all of which have 30-35v Vmax ratings.

On other news,today  have reached a kind of mile-stone.  I posted the next release of the Source (v0.1.5) with has major edits as a result of bench testing using the simulator.  And have come to a transition point - I think I have gone as far as I can with bench-testing.  Need to get this thing connected to actual hardware!  Given our generator is outside the weather will play a little in there.  And we have guests coming this weekend, so I suspect progress will take a short breather.  (Plus, I think my Wife is getting a bit tired of seeing me hunched over the computer staring into the screen and muttering things to myself).   (Look under the Source tab on: http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/))

As an overview, here is a run down of the key features of this project (It has grown a little on scope - after all many things are 'just a few lines of code'!)

Overall Features:

Engine Management:


Alternator Management:



Fault Detection:



And some likely future enhancements will include:




There is one PCB board left if anyone is interested in it, two of the other ones have been spoken for.  Just drop me an Email or Message via the board.

And again, thank you to everyone who has given input and comments, there will still be opportunity for more  - but I want all to know how much I really do appreciate the inputs and ideas I have received here. 
Next step will be connecting this to our existing generator / watemaker: http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator (http://mvvikingstar.blogspot.com/search/label/Kubota%20DC%20Generator)
Title: Co-Gen feature? What to consider when enabling the coolant pump?
Post by: thomasonw on February 03, 2013, 09:51:02 AM
It occurred to me last night that I am not being true to this forum.  Yes, am using a small engine to drive a generator (DC in this case) as many people here seem to do.  And the inclusion of a Watermaker pump does bring in more then one purpose, but to call that co-gen is perhaps stretching it a bit.
.
It also occurred to me that to repurposing the Watermaker clutch output to drive a water circulation pump instead would just be a "small matter of programming".   So a question:  Aside from engine coolant temperate, would be be good to take anything else into account when deciding to enable a heat extraction water circulation pump/valve?   Hold-off periods during warm up? (Let the engine run at full temp for some time to heat-soak, as opposed to just look at current coolant temp?)    Current load?  (Ala, on reduced load, stop circulating in anticipation of engine cooling?)    Anything else?

With so much being monitored in this design (Engine load, Coolant temp, EGT, engine RPMs) there are opportunities to go beyond simple engine temp. But to be honest I am not sure if there is really a need to, or  just look at coolant temperature with perhaps some type of hysteresis between the On and Off triggers and be done with it.

Thanks
-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: veggie on February 05, 2013, 02:23:06 PM
One thing to consider is an auxiliary set of contacts for some form of a load dump.

For instance:
If the system is to be used for co-gen, then there should be a way of producing heat (from a loaded engine) even after the batteries are charged.
If the battery charging cycle is short due to minimal discharge, then the heating portion of the CHP may be useless (too short of a run cycle to do any good).
However, if the load can be transferred to something like a heating element (to assist heating) once the batteries reach full charge, then the full HP and cooling BTU output of the system can be utilized.

Adding CHP capability does open a can of worms on the programming side because there are so many variables and ways to achieve the same result.
Such as... how long do I dump the load into the heating element after the batteries are charged to "x" voltage.

just a thought,
veggie
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Lloyd on February 06, 2013, 01:15:34 AM
One thing to consider about feature creep. If turns out all systems are controlled with a single controller with no ability for manual over ride for each of the subsystems, then a controller failure can render the whole system caput until a new controller can be had/installed.

Don't mean to be negative, but you must allow for limp home.

Lloyd
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 06, 2013, 06:13:07 AM
Since this controller is doing alternator regulation, I don't think any sort of manual reversion is practical.  Instead, I think having a couple of fully tested spares on hand would be best, after the design is fully tested.  My various PIC based boards have proven to be so reliable, even the non-pcb prototypes, that I wouldn't mind an integrated solution like William's. I expect the AVR processors will also be robust.

To combat feature creep, I think I'd just have some spare I/O and perhaps bring the 2- I2C serial buss pins to a connector or header. Then someone using his open design hardware and software could always add on almost anything externally.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on February 07, 2013, 05:11:43 PM
Hello, thank you for the thoughts and input.  In reading the past three email I might offer:

In terms or reliability, failures often can be categorized in two broad groups:  Component failure (often to stressed design points, or miss-use in application and/or instillation) and design / coding failures.  On Viking Star I look for failure modes and how to work around them.  Often a spare is needed for a function, and when practical I carry a different design in case the issue is systemic in nature (e.g., our two inverters are purposely different designs).  In the case of failure for this DC generator controller the fall back would be the manual start/stop switches already in place, with the reintroduction of a simple regulator.  (Or, use the backup Honda generator we carry).  And when looking at automation, there is a valid reason for dividing and concerning, however being too granular also introduces their own issues ala integration - as I am sure you live through in your project Lloyd.  Plus, with additional components the probability of hardware failures increase, and by not having a tightly coupled system (specifically the Regulator and throttle control) a level of system wide efficiency can not be achieved.

But your point is well taken, with any automation system one needs to consider the failure modes and their plans:  Use a different system?  Fall back to manual / limp mode?  Have a spare of the same design on hand?  Each approach has its advantage and deterrent.  And I again, on our boat we carry a wide array of approaches for each and every major system failure. (ala two different inverters, but two of the same starters for the main motor  ;) )

On expandability, that is already covered.  There is an Expansion Header in place that brings out the I2C and One-Wire bus, +5v and Ground, and the unused Amtel pins - about 4 of them.   Plus the stand offs are positioned to support a daughter card. (And anyone is welcome to the KiCad files to get the locations exactly right-on)  I have in mind being able to add on a daughter card if needed for other functions.  (and am already working with someone around a potential WaterMaker automation add-on, not just clutch control, but pressure regulation as well).  Also the Cat-5 cable that runs between the controller and the LCD uses a buffered I2C that can be tapped into for more distance functions.  As well as carruing a limited +battery voltage for power.    One could expand either directly controlled by  the controller or enabling some master/slave mode to a separate controller  (CAN buss would have been fun to implement. . ) .

And this is how I would likely approach doing a load dump function.  Use the I2C bus to drive an expander (perhaps a PWM expander would be even better).  Given the potential for surges, I think it might be best to locate that on the buffered I2C bus (CAT-5 line) and maybe even opto-isolate it in the resistive load-dump ckt.  I think it would not be difficult to modify the source to accommodate this - as the watts delivered via the alternator are reduced, increase the load dump PWM to match the overall load to the engine capability.  Of course, in that case the adaptive throttle control would keep the RPMs high (while currently in lower load situations, the throttle control will slow down the engine). 
Title: 1st run!
Post by: thomasonw on February 09, 2013, 03:24:31 PM
Yahoo!

Yesterday I placed the needed senders around the generator and boat, and today I hooked up the controller to give her a try.   Here is a raw video:

   http://youtu.be/fdajf2C2fuw (http://youtu.be/fdajf2C2fuw)

I did not talk much during the middle as I figure no one would be able to hear anything anyway, but this is basicly what you are watching:


Most things worked well, I need to look at the RPM sensing a but more - see if the ckt can be improved, plus I need some software enchantments.  For example I kept faulting out while at idle before the alternator was started - the ckt was triggering on noise and measuring 7,000+ RPMs.  Just need to add a trap to not measure RPMs unless the field drive is active.

Also found another Phantom Power path, back in via the low-drive for the starter relay.

Over the next few days I am going to tighten up the RPM ckt / program, work on smoothing out the throttle bumps (they seem a but course right now), and other timing variables / configurations. 

But it mostly worked!

(Note, I could not get the embedded You-tube to work - keeps saying Invalid Link)
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 09, 2013, 04:50:48 PM
Congratulations on your first live run William!  You're on the home stretch now. 

Your board expansion design is great, and should cover any feature creep that someone else might want.

Good luck on your continued check out and refinement.

Best Wishes,
Bruce


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on February 10, 2013, 07:02:58 PM
Day two brought another overcast day and no rain.  Just right for setting up 'Shop' out back and being able to read the laptops screen!

Instability with RPMs measurements has been resolved, simplified input to 1K resister and a 0.1uF cap to ground forming a RC low-pass filter (along with the current clipping diodes).  This eliminated the 'noise' induced wild RPMs that were measured at one time as things ramp up, and by eliminating the voltage divider RPMs could be sampled at a much lower field drive point.

In these last runs I noticed a level of hunting in the PWM adjustment, and more so in the throttle control.  Need to look more to see if this was impacted by the verbose amount of data being spit out to the debug screen and thereby impacting the main loop throughput, or if I need to add additional criteria into the offset algorithms (ala look back and rate of change parameters) to go beyond the current point-in-time offset calculation.

Rain is forecasted for the next few days, so will likely not be able to make any more trial runs for a while...  Maybe will just go ahead an enhance the offset algorithms while I am sitting waiting for the skys to clear...


Title: Got in a few runs this morning! Throttle hunting issue resolved!
Post by: thomasonw on February 11, 2013, 10:35:43 AM
Last night I found a bug in the code that sometimes would  prevent updating of measured watts. Given that the throttle control is based off of measured watts it is easy to see how things went downhill yesterday. 

And even better:  This morning I was able to sneak in 3 runs before the rain hit.   And it works well!  No more hunting of the throttle.  Also refined my warm-up and cool-down stepping timing /  configuration values (this will need to be futzed with for each motor/throttle control setup..)

So, it looks like the major problems are resolved!   Well, at lease on these three very short runs.  But each run did go through:

These were very short runs as the batteries are fully charged, but was able to step through several engine / alternator phases and see the systems work well.

Later today I will look over the debug data and see if anything new pops out.  Then I will post an update to the source code on the blog.

Rain is predicted for a few days.  Once that clears up I will be able to make some longer runs and go from there.   

-al-
Title: Full Run data
Post by: thomasonw on February 13, 2013, 09:16:33 PM
Today I completed a 30 minute run of the DC generator with the controller in fully automated mode.  Before starting I pulled the house batteries down about 150Ah, to give the generator something to do.  Here is the resulting debug data graph:

(http://2.bp.blogspot.com/-wlSUbDnc3Os/URxixxlvh4I/AAAAAAAAJkw/gF9lLUIoacI/s1600/Run+Graph+2-13-2013.PNG)

Two things to notice:

This is the result of the key goal for the project - maintaining a constant load on the driving engine.  As the battery voltage increases we need to lower the Amps delivered in order to maintain a constant Watts load delivered (and pulled from the Kubota engine)

One can also see the engine RPMs being managed - as the battery approached full charge, the amps dropped off quickly and the resulting load on the engine was reduce.  So we slowed the engine down.

Of concern to me is the large amount of hunting in the Field Drive during the Acceptance Phase.  I will be working on the algorithms to smooth this out.  Until then I posted version 0.0.6 of the source to the blog.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 13, 2013, 11:16:23 PM
Sweet project, William.  I'm sure you'll get the field drive algorithm sorted soon. 

What debug package gives you those great plots?

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on February 14, 2013, 12:08:30 AM
Quote from: BruceM on February 13, 2013, 11:16:23 PM
Sweet project, William.  I'm sure you'll get the field drive algorithm sorted soon. 

What debug package gives you those great plots?



I have a DEBUG switch  in the source (#define DEBUG)  When DEBUG is defined (enabled) the firmware will send a wide range of information to an attached serial terminal (same port used to upload firmware, via the USB port).  To get this graph I copied the 2,000 or so lines of status that was sent to the counsel, placed them into excel.  Then made a graph from the Volts, Amps, etc. data.  Adding words and notes via Paintbrush completed the job.


Here is an example of the raw data - 1st boot up is shown:

8   28   Verion   0.0.6   -   Free   RAM   =   1311                                                                                                
Start/stop:   G/g   Gen;   W/w   WaterM;   A/a   AutoGen   mode                                                                                                   
n   -   Next   Screen;   s   -   Stop   All,   S   -   Stop   NOW                                                                                       
                                                                                                                        
   READY!!!                                                                                                                     
                                                                                                                        
15191   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.06   A=   0   W=   0   RPM=   0   EGT=   -73   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1023   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15322   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.07   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1020   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15437   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.06   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1022   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15551   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.04   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1023   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15664   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.06   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1022   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15778   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.05   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1020   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
15892   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.05   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1023   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160
16006   A/E/W-Stat=   1   4   1,   PWM=   0   V=   12.07   A=   0   W=   0   RPM=   0   EGT=   -74   OneWire-E/A/S/Ex/B   0   0   0   0   0   FETs=   1020   Booleans:Oil/Water/AG-flags   1   1   0   :Ve   -160   Ae   240   We   140   Te   0   Ta   0   =   -160


And when running:
1352524   A/E/W-Stat=   12   7   1,   PWM=   102   V=   14.66   A=   69   W=   1011   RPM=   2221   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   0   Ae   102   We   38   Te   0   Ta   0   =   2               
1353661   A/E/W-Stat=   12   7   1,   PWM=   107   V=   14.72   A=   76   W=   1119   RPM=   2206   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   88   We   28   Te   0   Ta   0   =   -1               
1354758   A/E/W-Stat=   12   7   1,   PWM=   97   V=   14.7   A=   67   W=   984   RPM=   2212   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   106   We   41   Te   0   Ta   0   =   -1               
1355902   A/E/W-Stat=   12   7   1,   PWM=   108   V=   14.71   A=   76   W=   1117   RPM=   2198   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   88   We   28   Te   0   Ta   0   =   -1               
1356999   A/E/W-Stat=   12   7   1,   PWM=   98   V=   14.7   A=   70   W=   1029   RPM=   2213   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1022   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   100   We   37   Te   0   Ta   0   =   -1               
1358096   A/E/W-Stat=   12   7   1,   PWM=   106   V=   14.7   A=   74   W=   1088   RPM=   2191   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1022   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   92   We   31   Te   0   Ta   0   =   -1   >>i=   1   ,   2100   <<
1359206   A/E/W-Stat=   12   7   1,   PWM=   96   V=   14.63   A=   67   W=   980   RPM=   2198   EGT=   -74   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   0   Ae   106   We   42   Te   0   Ta   0   =   2   >>i=   -1   ,   2300   <<
1360308   A/E/W-Stat=   12   7   1,   PWM=   101   V=   14.7   A=   72   W=   1058   RPM=   2184   EGT=   -74   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1022   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   96   We   34   Te   0   Ta   0   =   -1               
1361402   A/E/W-Stat=   12   7   1,   PWM=   103   V=   14.68   A=   72   W=   1057   RPM=   2198   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   96   We   34   Te   0   Ta   0   =   -1               
1362516   A/E/W-Stat=   12   7   1,   PWM=   99   V=   14.65   A=   67   W=   981   RPM=   2206   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   0   Ae   106   We   41   Te   0   Ta   0   =   2               
1363612   A/E/W-Stat=   12   7   1,   PWM=   101   V=   14.7   A=   71   W=   1043   RPM=   2176   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   -1   Ae   98   We   35   Te   0   Ta   0   =   -1               
1364704   A/E/W-Stat=   12   7   1,   PWM=   100   V=   14.64   A=   69   W=   1010   RPM=   2198   EGT=   -75   OneWire-E/A/S/Ex/B   -99   -99   -99   -99   -99   FETs=   1023   Booleans:Oil/Water/AG-flags   0   0   0      :Ve   0   Ae   102   We   39   Te   0   Ta   0   =   2               


-al-
Title: High Drive, Low Drive - How about Any Drive???
Post by: thomasonw on February 14, 2013, 06:27:33 PM
OK, with the rain today I have been doing a bit of CAD work - updating the schematics with the changes noted over the controller bringup.

This High Drive vs. Low drive thing still bothered me, seeing as almost the whole world uses High drive (though we still do not know why), but we have a very very compelling reason for using Low Drive (namely to drive 48v fields).  So I have been thinking on how to make a configuraable drive.  One that could be selected either by stuffing options, or perhaps by floating the FETs.  And today I think I came up with something - using Stuffing options:

(http://1.bp.blogspot.com/-WQkKp8uuSeo/UR2Kih7dUSI/AAAAAAAAJlE/aIId37Bijjc/s1600/Universal+Drive.PNG)


What makes this workable is that the P and N FETs keep the same 'pins' for D, G,  and S.  And it so happens that  D always connects to the Field, and S always connect to the voltage that the non-driven end of the Field  (the end back on the alternator) is not.

And here is an example of it 'configured' for Low Drive (I did a little moving around in the CAD to make it read easier, but it is the same as the above - I think   ;)  ) 

(http://3.bp.blogspot.com/-PMmvVaQPrNY/UR2LHcwnRyI/AAAAAAAAJlU/ikDZuf9fylY/s1600/Low+Drive+Config.PNG)

And here it is configed for High Drive:

(http://1.bp.blogspot.com/-YQNVBeT7xm4/UR2LCNjWw_I/AAAAAAAAJlM/uwGJjuYWFHo/s1600/High+Drive+Config.PNG)


Note that the FET driver is not shown, and that it too is configed as a non-inverting driver to an inverting driver depending on a Low or High Drive.  OK, does this look like I got it right?

-al-

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 14, 2013, 10:13:52 PM
Hi William,
That seems like a nice high/low side drive solution, and your schematic looks OK to me though I didn't check the N vs P-chMosfet pinouts for compatibility.

The 100 ohm gate drive is  probably OK for your modest load and selected Mosfets.  I'd give the mosfets a finger temperature test to be sure.  If they're a bit warm then I'd reduce to 50 ohms or less. 

Classy job on the plots via excell!

Best Wishes,
Bruce













Title: Re: High Drive, Low Drive - How about Any Drive???
Post by: Lloyd on February 15, 2013, 12:12:41 AM
Quote from: thomasonw on February 14, 2013, 06:27:33 PM
OK, with the rain today I have been doing a bit of CAD work - updating the schematics with the changes noted over the controller bringup.

This High Drive vs. Low drive thing still bothered me, seeing as almost the whole world uses High drive (though we still do not know why), but we have a very very compelling reason for using Low Drive (namely to drive 48v fields).  So I have been thinking on how to make a configuraable drive.  One that could be selected either by stuffing options, or perhaps by floating the FETs.  And today I think I came up with something - using Stuffing options:

-al-


Hi Al,

I'm not an EE, nor software designer.

But most digital control designs I see using low side, use V-/com isolated.

V- bat might lead to noise, caused by other system loads.

Lloyd
Title: Re: High Drive, Low Drive - How about Any Drive???
Post by: Lloyd on February 15, 2013, 12:36:31 AM
Quote from: Lloyd on February 15, 2013, 12:12:41 AM
Quote from: thomasonw on February 14, 2013, 06:27:33 PM
OK, with the rain today I have been doing a bit of CAD work - updating the schematics with the changes noted over the controller bringup.

This High Drive vs. Low drive thing still bothered me, seeing as almost the whole world uses High drive (though we still do not know why), but we have a very very compelling reason for using Low Drive (namely to drive 48v fields).  So I have been thinking on how to make a configuraable drive.  One that could be selected either by stuffing options, or perhaps by floating the FETs.  And today I think I came up with something - using Stuffing options:

-al-


Hi Al,

I'm not an EE, nor software designer.

But most digital control designs I see using low side, use V-/com isolated.

V- bat might lead to noise, caused by other system loads.

Lloyd

Maybe, you're just leading, not lagging.

Look her at IR http://www.irf.com/product-info/cic/fsgatedriverics.html (http://www.irf.com/product-info/cic/fsgatedriverics.html)

Lloyd
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: SPSInc on February 15, 2013, 04:05:11 PM
HI. I've enjoyed reading your posts. Very interesting project. How would you do the gate drive on the high side drive? Would you use zener diodes to clamp the gate voltage to an acceptable value? A low side drive is much easier to do as you can reference the gate drive to gnd. When you do a high side you have to reference the gate drive to +Batt voltage. When you drive the gate you have to keep it offset from ground to be within the limits of the devices gate-source voltage. +/-25V for the device you have chosen. If you have a 35V battery rail you can't just drive the gate to gnd. The high side would be fine for 12V system but anything over that will require more components in the gate drive. The low side drive can drive any voltage within the limits of the FET as the gate drive is referenced to gnd.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 15, 2013, 06:24:16 PM
Thanks spsinc, I screwed up, you're absolutely right.   The schematic is only ok for 12V high side drive. 
For the 24 and 48V high side you'd have to add an npn transistor and zener to limit gate to say 15V below the high rail.




Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on February 16, 2013, 11:10:05 AM
Quote from: SPSInc on February 15, 2013, 04:05:11 PM
HI. I've enjoyed reading your posts. Very interesting project. How would you do the gate drive on the high side drive? Would you use zener diodes to clamp the gate voltage to an acceptable value? A low side drive is much easier to do as you can reference the gate drive to gnd. When you do a high side you have to reference the gate drive to +Batt voltage. When you drive the gate you have to keep it offset from ground to be within the limits of the devices gate-source voltage. +/-25V for the device you have chosen. If you have a 35V battery rail you can't just drive the gate to gnd. The high side would be fine for 12V system but anything over that will require more components in the gate drive. The low side drive can drive any voltage within the limits of the FET as the gate drive is referenced to gnd.

Ah, yes - that is a problem. Am using the IXP-602 series of gate drivers, but their high side version does not clip the voltage.

OK, so:  Is still a 'universal' driver, just that the High Side can only be used in a 12v system, not a 24v or greater system.  Was already limited from 36v or greater systems due  to Vcc max on the driver chip. 

And maybe that is OK?  Leave the Hi Drive stuff to us simple 12 guys, and once one gets into the higher voltages go Low!   

I do wonder just how many 24v systems there are - in shore based systems i would think most folks would lean towards 48v once they departed 12v land - not stop at 24v..  So question back:  In trying to make this a bit more universal, how important will it be to keep the High Side drive for 24v and greater systems?  if so, can look into other level shifting drivers - but noted a lot of them depend on a PWM duty cycle to drive their internal charge pumps, and would not work at low field drive levels, nor high field drive levels.

And/or back to the drawing board - see what I can dig up for a true high/low drive driver solution - independent of voltage.

Thank you all again for the help!

And fyi:  yesterday I tried a modified source code run -got rid of the Fuzzies in the Field drive during acceptance phase!

-al-


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mike90045 on February 16, 2013, 09:00:10 PM
I'll vote for a 48V capable version.
Title: 48V alternator vs. 48v system.
Post by: thomasonw on February 19, 2013, 11:27:20 AM
I have been spending some time over the past few days trying to come up with a design that will work not only supporting a 48v alternator (and potential 48v field), but ALSO support a full 48v system.  And by 'system' I mean:


It is the H-Bridge for the Throttle Controller Motor I have having difficulty solving.  To date all the integrated H-bridges I can find are limed to 35v or so max with the step into industrial controlling (which will support 60-70v+) being just too much.   A pieces-part H-bridge driver is a possibility, though am starting to run into extra costs associated with all the components and that many of the 'driver' chips will not work outside a duty cycle of 10-90%, unless one adds even more parts.  And adding in a break function just makes this worst.

So, before I go on much more I really need input from folks who have  a 48v (or 36v  :) ) DC Generator:   Is your starter 48v?  Would you use a 48v throttle control unit?  Is the Glow Plug 48v?    OR - is it more likely that the alternator/Field is 48v, but the rest of the 'system' is 12v (or maybe 24v).

As I have not found a readily identifiable solution for a true 48v system I really want to ask:  Is this truly a need?

And again - to be clear - this is NOT talking about the alternator / field.  48v there is done.   This is talking about 'the rest of the story'.


And on other news:  The other day I conformal coated my board.  Next week will install / wire it in a neat way back near the generator.  The Firmware is working well enough at this point that I am ready to start giving it 'real life' field runs over the summer.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on February 19, 2013, 12:52:44 PM
Yep, a discrete H-bridge is a pain because of the delay logic and "glue" (resistors, capacitors) to prevent "shoot through". (Brief shorting during switching.)

I think it's more practical to require all these accessories be 12V. 

Great project, I hope the sea trials will be fun and uneventful!

Best Wishes,
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: mike90045 on February 19, 2013, 04:45:13 PM
There are FEW 48v accessory components.

There are soon going to be a lot of 24V & 36V gear, as auto makers start abandoning the 12V standard much as 6V fell long ago.

Title: Version 0.2.1 Schematics posted
Post by: thomasonw on February 24, 2013, 11:19:11 AM
All,

This morning I posted a revised copy of the controller design:  http://smartdcgenerator.blogspot.com/2013/02/version-021-schematics-posted.html (http://smartdcgenerator.blogspot.com/2013/02/version-021-schematics-posted.html)

This is intended to easy assemble (ala, using through hole diodes instead of the SMT ones, and allowing for optional daughter cards on the INA-220's), support a wider range of alternator Fields (High or Low drive, 12v to 48v) and simplicity configuration for 48v battery support by providing dedicated PCB stuffing options as opposed to the current "Replace Cx with a new resister, and run a jumper wire from xx to yy" approach :-)


(http://3.bp.blogspot.com/-pQuPgbFWc0s/USorIpqYzjI/AAAAAAAAJpo/CT7N9wINqCo/s1600/Controller+0.2.1.PNG)


A summary:



A couple of specific points that have been talked about here (BTW, thank you all so much for the input!)

FET Drivers for High Drive:  Aside from the 12v deployment, which uses an integrated drive ship, I moved to a NPN/pull up resistor driver.  My reason for this was mainly around Vdd max of the direct driver chips, which limited them 24v and under deployments (and even then would need some help around Vgs max of the FETs- thank you SPSinc).  There are a wide range of 'boot strap' driver chips which would have been nice - and allowed use of N-FETs, however they all depend on a non-zero PWM duty cycle or the addition of extra components.  Other approaches (e.g. optic coupling, transformers, etc) seemed to each have their own limitations / issues.  After looking at what was needed to deploy a modified boot-strap design I stepped back a bit - the PWM frequency being used is only 490hz, and though there is switching loss using a NPN/pull-up I calculated it at being 2-3w worst case.  Given the low cost of the NPN/pull-up, the ability to fully support duty cycles from 0 to100%, and the resulting low heat being generated, I settled on this.   But please - is my thinking reasonable, or am I missing something big.....

System voltage above 24v.  Here again I have been looking at how to address this.  Bottom line is:  the Throttle motor H-bridge selected (which is design and marketed into the Auto industry for throttle motor controlling) will not support Vdds above 40v - limiting to 24v systems.  I was unable to locate an integrated H-bridge which would support higher voltages, and a discreet approach again started to run into high parts count / costs, and reduced functionality.  Though it may change in the future, today I believe that most all starters, fuel pumps, and even throttle control motors are actually 12v - perhaps some 24v.  When (if?) the auto industry moves to 48v deployment, and things like starters, throttle motors, etc, become common in 48v I am sure there will be an integrated 48v capable throttle motor control chip - and I would say at that time the design can be revised.  But until then, 24v is the system cap.  (and do remember, this is independent of the alternator.  The design fully supports 48v alternator, even in a 12v 'system').

OK, comments please.  I am in no rush to completing this v0.2.x series of revisions, as there is little to no functional difference between the 0.1.x boards I now have built. (I am a 12v across the board deployment).   As such I am thinking this design will be 'revisable' into the summer.   But if someone needs support for field voltages other then 12v HIGH-drive I can move forward quicker.

Again, thank you to all who have given prior comments and reviews.  This project would not have happened without that.

The .pdf files are located here:

  Controller: https://docs.google.com/file/d/0B5GiaoeXCQ3vMlBGU3Y4NkExQ28/edit?usp=sharing (https://docs.google.com/file/d/0B5GiaoeXCQ3vMlBGU3Y4NkExQ28/edit?usp=sharing)
  Remote: https://docs.google.com/file/d/0B5GiaoeXCQ3vcG81clVPLTF5cjA/edit?usp=sharing (https://docs.google.com/file/d/0B5GiaoeXCQ3vcG81clVPLTF5cjA/edit?usp=sharing)
 
And this documents the configuration / stuffing options:
         https://docs.google.com/file/d/0B5GiaoeXCQ3vUTV3UUwzZllLVUE/edit?usp=sharing (https://docs.google.com/file/d/0B5GiaoeXCQ3vUTV3UUwzZllLVUE/edit?usp=sharing)



And the link at the top of this posting has more details, including a cool 3D image!  (So easy to impress this light-box / Mylar & Tape guy).


And on a status update:  The last week has been spent with the Flu...  Now that that is over, I am going to work on doing a neat install of the controller on our existing Kubota DC generator, route the CAT-5 cable forward (perhaps the biggest challenge) and mount the remote.  Due to some extra travel needs this year we have delayed our winter port departure, now looks like sometime in mid to end of March.  At that time will start 'real world' trials!

-al-

Title: Working towards a new PCB run..
Post by: thomasonw on March 05, 2013, 08:18:29 AM
This morning I posted v0.2.2 of the Controller and the Remote.    Schematics, PCB PDFs and Gbr files.  A couple of us are working towards doing a PCB fab soon - driven largely by assembly improvements in the v0.2.x design (Using through hole Diodes, and option for INA-220 daughter cards).

Note also that the Remote board has been changed to use another Amtel CPU instead of a 3rd party backpack.  This will not only reduce costs a little, but allows for a much neater physical assemble.  Plus it does not lock one into a single source for the LCD.

Schematics should be here: https://docs.google.com/folder/d/0B5GiaoeXCQ3vdm5ydEJFR0dzVkE/edit?pli=1 (https://docs.google.com/folder/d/0B5GiaoeXCQ3vdm5ydEJFR0dzVkE/edit?pli=1)

And the PCBs layouts here:  https://docs.google.com/folder/d/0B5GiaoeXCQ3vb2FJQm05Qy1jeWs/edit (https://docs.google.com/folder/d/0B5GiaoeXCQ3vb2FJQm05Qy1jeWs/edit)



Looking to go to FAB in a week or so, if anyone is either interested in one of these boards, or has a chance to look things over, speak up!

Title: Sending v0.2.3 to FAB this week.
Post by: thomasonw on March 06, 2013, 09:07:56 PM
Files for schematic, PCB layout, Config options, and BOM are posted in files section of blog.

http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/)


-al-
Title: Mocking up the Control Panel
Post by: thomasonw on March 09, 2013, 11:02:30 AM
Am getting closer to having this installed and ready to use.  Here is a mock-up of the 'Control Panel' am looking to get built:

(http://2.bp.blogspot.com/-8n3Tl3QtsqM/UTt0dqDcV3I/AAAAAAAAJw4/LBHQyWFKjd4/s1600/IMG_3760.JPG)


I use a company called Front Panel Express (www.frontpanelexpress.com/) to make up small panels like this.  They have a downloadable CAD tool that is simple to use.  Then just upload it and a week or so later you get your panel! Can even print out a sample in 1-1 scale (that is what you see above).   So Nice.

The only down side is their prices have gone up a LOT over the past few years.  This panel comes in at around $90 - - -  But I already have several others of like look, so need to keep the trend going.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on March 09, 2013, 12:03:15 PM
Wow, those are nice front panels.  Is you panel black anodized aluminum with white or no infill?  Are the powder coated or acrylic panels any cheaper?
I'm very impressed with your work!

Best Wishes,
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 09, 2013, 12:21:23 PM
Quote from: BruceM on March 09, 2013, 12:03:15 PM
Wow, those are nice front panels.  Is you panel black anodized aluminum with white or no infill?  Are the powder coated or acrylic panels any cheaper?
I'm very impressed with your work!

Best Wishes,
Bruce

Thanks.  The panels I get are black anodized aluminum with white infill.  I have used a mixture of White and Red with other panels for 'backup' selections (like 'Air' in Whilte, and 'Backup Air' in Red for the two air horn air compresses)

The company offers a wide range of finishing options, anodized, power coated, blank.  All your choice.  Plus a range of panel materials and thicknesses.  It really is a slick operation.

-al-
Title: An update, and some questions.
Post by: thomasonw on March 17, 2013, 06:52:24 AM
Well,  been busy with many thing over the past few weeks.  Including this controller project!

A FAB run of the revised PCBs are in shipping and should be here Monday, they mainly feature assembly improvements (changing SMD Diodes to through-holes / placing INA-220's on optional daughter cards), support for LOW and HIGH drive fields. And support for alternator field and battery voltages from 12v to 48v. 

Have been fine tuning the firmware, focusing largely on smooth starts and stops  (Warmup and cool-down periods for the Engine).  Gave  up on trying to get a stable RPM measurement via the stator during start-up and very early in the warm-up cycle.  Just was not able to get a level of consistency.  But the cool-down works great, and it even self-adjust how hard to drive the field by monitoring ramp-up and noting at what point the alternator starts producing amps, then uses a little lower field drive during cool down.  Will see how this works over time, worry that a very warm alternator will behave differently then a cold one in terms of min field drive to produce amps.

Also have played some with the Bluetooth - what a PITA.  Part of the challenge is that bring forward RTS is patent protected and only one company offers Bluetooth with that feature!!!  Wow, what a New, Creative idea that is so Non-Obvious:  When simulating RS-232, carry forward the RTS signal!  (Yes, I believe the Patent Office has been like a dunking sailor for the past 10 or so years...)    But do have it to where I can monitor the debug serial output.   Figure this will allow me to capture live-run data just by having the laptop in the aft stateroom, as opposed to needing to pull the hatch covers and plug in the Service USB device.  In two weeks we will be leaving port for the summer and will be nice to be able to capture more live-run data.

And I have some questions on what to expect for EGT engine temp during normal operating conditions.  But  I posted those over in a new thread in the "Perkins/Cat/Kubota/Yanmar/Isuzu " forum as it seemed a bit more inline there.

-al-

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 17, 2013, 05:09:02 PM
Today I did a 30 minute run using the latest firmware and am rather happy with it.  So much so that I 'clipped' the local jumper on the controller that allowed it to power-on w/o the remote attached.  Next week the custom remote panel will arrive and I plan to install the remote and start using this thing!  (We leave dock in two weeks and likely will need the generator for a couple of months until the Solar start to kick in)

And here is a graph from today's run:


(http://1.bp.blogspot.com/-S3w8XnEuACA/UUZEYFOO9vI/AAAAAAAAJyQ/kt26Vd5o6hU/s1600/Kubota+Arduino+30+min+run.PNG)


Note that VBat values are plotted against the left scale and are shown 10x their true reading.   (Battery voltage ranged from 13.5v to 15v, not 135 to 150v!)

You can see a full start, ramp, bulk, acceptance phase charge cycle here.  I manually stopped the generator while still in Acceptance, as I typically do not let it run after getting down to 40A or so.  No reason to listen to the noise for only 40A's...

A few things to point out:


I am very pleased with this run, it is doing all I wanted and more.  Over the next couple of months we will be using the generator a lot and I will be able to continue my monitoring.  I am also looking forward to getting the EGT installed and looking at the relationship between EGT and Load.  It is my intention to use EGT to finally decide appropriate loads on the engine (as opposed to looking for black exhaust as an indication of overloading).

On those squiggly lines, I will continue to work and see if I can desensitize the system some more to reduce hunting.  But I am also thinking over the summer I will work to upgrade the controller firmware to a proper PID algorithm.   (See http://en.wikipedia.org/wiki/PID_controller (http://en.wikipedia.org/wiki/PID_controller)).  And with that will  move from High School Algebra into Freshman Calculus.   See, my Math Teachers were right:  I will find a use for this stuff in the real world!

But for now, things look good.  Am going to post the Firmware after I review the detail data from today's run.  And start getting ready for a summer of cursing.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on March 17, 2013, 07:27:27 PM
Looking good!

It will take some experimenting to get proper dampening. 

Before looking at your algorithm, it might be wise to put an oscilloscope on the analog inputs and make sure that the PWM circuitry isn't glitching your inputs and thus causing the instability.

There is some inductive lag in the alternator response, and your sample/control interval is quite slow.  A calculated rate of change of voltage (velocity) and perhaps an acceleration term can be used to dampen (opposite direction) the calculated correction.  If you continue to have trouble send me this small bit of code and I'll write a suggestion.  I've written a couple aircraft autopilot programs, and did the same in analog circuitry for a massively filtered alternator output as well.  If your debugger allows you to adjust the scalars for your dampening terms, you can dial it in experimentally and get some lovely smooth results.  This is vastly easier with floating point arithmetic,  but I noted that you were using that ready.



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 18, 2013, 12:50:05 PM
Quote from: BruceM on March 17, 2013, 07:27:27 PM
Looking good!

It will take some experimenting to get proper dampening. 

Before looking at your algorithm, it might be wise to put an oscilloscope on the analog inputs and make sure that the PWM circuitry isn't glitching your inputs and thus causing the instability.

There is some inductive lag in the alternator response, and your sample/control interval is quite slow.  A calculated rate of change of voltage (velocity) and perhaps an acceleration term can be used to dampen (opposite direction) the calculated correction.  If you continue to have trouble send me this small bit of code and I'll write a suggestion.  I've written a couple aircraft autopilot programs, and did the same in analog circuitry for a massively filtered alternator output as well.  If your debugger allows you to adjust the scalars for your dampening terms, you can dial it in experimentally and get some lovely smooth results.  This is vastly easier with floating point arithmetic,  but I noted that you were using that ready.





Thanks Bruce, I have looked at the VBat for noise, and yes there is a noticeable amount of noise in the line - PWM switching in causes a notable amount during its transition, but it is not the only source of noise.  My DSO is rated at 10Mhz, and I would say I am able to see lots of sum 1uS noise spikes all the time - both from PWM changes, and other changes on the boat..  (Ah, but DC is DC - Right???  ;)  ).   Fortunately the pre-conditioning snubbers (R/C) before the INA-220's take ou a lot of that, and the internal smoothing function of the INA-220's handles anything that might be left.  (Gotta love the function of those INA-220s!).  And the debug data shows no indactin of 'Wild Voltages' throwing things into a tail-spin.   I do not believe it is a VBat sensing issue.


Today I spent some time looking at a short time frame of the debug data, snips below.  Before getting into it some background:

VBat is sampled every 100mS, and the PWM is adjusted at each sample.
"Debug" data was captured every 10th 'Sample', so we are seeing data about every 1 second.
Temperature compensated target voltage was 14.802v until time stamp 1,372,860mS when the target decreases to 14.785v due to battery temperate change.

There are two configuration variables which can be adjusted for VBat / PWM calculations:
    PWM_CHANGE_RATE = 100mS        (Look to change PWM value 10 time a second)
    PWM_V_SENSITIVITY = 75mV         (For every 75mV we are off, adjust the PWM 1)


OK,  here is an expanded graph segment showing the hunting:

(http://2.bp.blogspot.com/-CAuSfjglPiM/UUdEuievRUI/AAAAAAAAJyg/PzMbG7kAI2A/s1600/Run+Details+Graph.PNG)


And here is the detailed data behind it:

(http://2.bp.blogspot.com/-LW8joy2Ls4s/UUdExJ03DGI/AAAAAAAAJyo/LkxPIdG0NPs/s1600/Run+Details.PNG)


The columns are:

   mS         = Timestamp of when data was sampled. (in mS)
  Alt-State  =  12 means we are in Acceptance Mode.
  PWM       = Current PWM value being sent to Alternator Field
  VBat       =  Latest measured battery voltage from INA-220's
  Amps      =  Latest measured Alternator current from INA-220's
  Watts     =  Product of Volts * Amps - Used to decide RPMs needed.
  Ve:         = Internal calcuation of Voltage Error while looking to adjust PWM
  Ae          = Internal calcuation of Amps Error while looking to adjust PWM

The "= " column is the resulting PWM adjustment value for THAT cycle.  Remember, I only captured data every 10 cycles, so adjustments in the other 9 cycles can only be seen by looking at the current absolute PWM value.  Notes of " >>i = " is where the system decided to adjust the throttle, and the goal RPM follows.  Anytime the system decides to adjust the RPMS, a ">>i= " is displayed.

And here is a code snippet:







//------------------------------------------------------------------------------------------------------
//
//  Manage the Alternator. 
//      This function will check and change the Alternator state as well as make adjustments to the PWM Field Value
//      -- Consider Ramping
//      -- Consider how far from target we are, further away = hit change it harder.
//      --  And if overvoltage, drop it down even faster!
//
//
//------------------------------------------------------------------------------------------------------



void manage_ALT()  {

    int   PWMErrorV;            // Volts delta (Battery limited):   +  --> Drive the PWM harder    -  --> Back off the PWM some.

                            <<  SNIP    Values for Amps, Watts, etc.. >>
                  

    int   PWMError;               // Holds final PWM modification value.


   

    if (!ian220AMPWaiting || !ian220EGTWaiting ||                     // If Volts/Amps measurements are not ready,   -- OR --
       ((long)millis() - (long)(lastPWMChanged + PWM_CHANGE_RATE) <= 0L))            //   it is too soon to make a change
               return;                                    //      just skip doing anything this time around.

                  


   
   PWMErrorV  = ((targetBatVolts   - measuredBatVolts) / PWM_V_SENSITIVITY);   

      
                           <<  SNIP  >>





                                       //  If someone wants to pull things down, let them have 1st say!
                                       //  If someone critial is spot on, don't let anyone else talk him into 'just a little more?'
   PWMError = 0;                                 //  Note this is in priority order, with overvolts having 1st spot.
   if      (PWMErrorV  <= PWMError)  PWMError = PWMErrorV;                  // Over Volts, adjust down due to overvoltage.


                            <<  SNIP   - Amps, Watts, Temps, etc come next in line.  >>


   else      PWMError = PWMErrorV+PWMErrorW+PWMErrorA;                  // Else, we are Under Voltage, AMPs, Watts and temps. . . 
                                       //    . . so we can adjust up base on Volts.
                                       //    And add in the Watts and Amps delta as well!

   

                          <<  SNIP    Code that deals with mode transitions, throttling,  and bounds checking . >>>>
      




           //-----   And put out the adjusted PWM value to the Field control.
   fieldPWMvalue += PWMError;                                     
   analogWrite(FIELD_PWM_PORT,fieldPWMvalue);                  
   lastPWMChanged = millis();                           
      
}




The full code can be found at:  https://docs.google.com/folder/d/0B5GiaoeXCQ3vQU5ncXhETjQ3OGM/edit (https://docs.google.com/folder/d/0B5GiaoeXCQ3vQU5ncXhETjQ3OGM/edit)  Look for the  " void manage_ALT()" function.


In looking at the data, I am hoping making adjustments to the two variables above will help.  Looking over the detailed data, it seem MY system gives around a 20-40mV change for each 1 PWM change.  I can also see a rate of change in the 20mV/second range when presented small (1-2x) changes in the PWM value.  And as much as -80mV/sec when decreasing PWM values.  (Some of that might be external load influences, during this trial run I had shore power disabled - so refrigeration coming on could cause a load change.)

Curious Bruce, if your auto-pilot algorithm only included at-the-moment-of-time error calculations, or if you included any rate-of-change and/or direction-of-change compensation.  The more I look at this, I am thinking I need to include some type of rate-of-change awareness into the calculations, else we will just keep driving the PWM in a given direction until the Voltage FINALLY gets on target.  But by that time we likely have built up a lot of momentum and will overshoot (Just as I am seeing).  Am thinking if I increase the time from 100mS to perhaps 250mS or even 300mS, it would allow more settling time for the Alternator to respond to changes.  (There is an independent fault checking section that is NOT time based and will trap out any massive overvoltage situations - ala Load Dumps....)  Will also configure things to capture Debug information  every cycle, not every 10th.

Open to any ideas and suggestions on perhaps configuration values to try to use as well as coding hints

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on March 18, 2013, 02:51:08 PM
Autopilots  have dampening terms based on velocity, acceleration and jerk.   The error in lets say altitude demands a positive elevator change, but this is dampened by subtracting the velocity in that direction times some scaling factor, as well as subtracting acceleration times a factor, etc.  This prevents the aircraft from overshooting and wildly oscillating around the desired altitude.  Consider the desired elevator change as the aircraft is "nose up" and almost at the desired altitude. There is still a small positive error, but the elevator must go down to slow the rate of climb or an overshoot will soon result. The dampening term in this case is larger than the error term, so the elevator will go negative.  Same approach for real time control of anything with a lag in response.

The correction MUST take into consideration the current rate of change of voltage (1st derivative) and likely the acceleration ( second derivative).  In your case the rate of change (voltage velocity) is calculated by the difference between the present voltage and the last voltage.  The second derivative is the difference between the newly calculated velocity and the last calculated voltage velocity.  

After reviewing your code and data, it looks to me that you need to add dampening to the PWM error calculation. You presently seem to have none, and thus the oscillation shown is to be expected.  Sorry, I don't do 'C'.  This pseudocode assumes a fixed rate of calculations.  (every 100ms  is fine, slower is OK but it must be fixed or velocity and acceleration calculation must be adjusted for the varying time base)

'calculate battery voltage velocity and accelleration
vbattvelocity= batteryvolts-lastbatteryvolts
lastbatteryvolts=batteryvolts
vbattaccel=vbattvelocity-lastvbattvelocity
lastvbattvelocity=vbattvelocity

'calculate dampening term with scaling variables to be set by debugger- start with zero scalar2
damp= vbattvelocity*scalar1+ vbattaccel*scalar2

PWMerrorV=PWMerrorV-damp

The velocity term will limit the rate of change of voltage, the acceleration term will limit the suddeness of changes.
I don't know if you'll need acceleration at all.  When acceleration and velocity damping terms are tuned right, you get nice quick corrections with no overshoot.

I hope this helps.  Send me a PM you'd like to discuss this further.






Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 18, 2013, 04:26:26 PM
Quote from: BruceM on March 18, 2013, 02:51:08 PM
Autopilots  have dampening terms based on velocity, acceleration and jerk.   The error in lets say altitude demands a positive elevator change, but this is dampened by subtracting the velocity in that direction times some scaling factor, as well as subtracting acceleration times a factor, etc.  This prevents the aircraft from overshooting and wildly oscillating around the desired altitude.  Consider the desired elevator change as the aircraft is "nose up" and almost at the desired altitude. There is still a small positive error, but the elevator must go down to slow the rate of climb or an overshoot will soon result. The dampening term in this case is larger than the error term, so the elevator will go negative.  Same approach for real time control of anything with a lag in response.

The correction MUST take into consideration the current rate of change of voltage (1st derivative) and likely the acceleration ( second derivative).  In your case the rate of change (voltage velocity) is calculated by the difference between the present voltage and the last voltage.  The second derivative is the difference between the newly calculated velocity and the last calculated voltage velocity.  


Well, that is exactly the what  I was talking about needing to do:  to move to a PID algorithm. " proportional, integral and derivative".

I did change the sampling rate to 300mS, and that allowed sufficient time for the alternator to settle out before making more changes and mitigated the hunting.  But I still have overshoot and undershoot conditions when loads are applied and removed.  (due to no I and D component).  Because I cap the rate of change going UP, the overshoot is very minimal, but undershoot can be a bit more.  Some more info here:  http://smartdcgenerator.blogspot.com/2013/03/300ms-helped-lot.html (http://smartdcgenerator.blogspot.com/2013/03/300ms-helped-lot.html)


The current point-in-time (P) approach begin used will work fine, given the selection of the timing variables and rate change caps.   I will split off a new thread of code and start moving towards a proper PID algorithm and begin testing it in parallel.  Once I am happy with it, will move over to that code thread.

Thanks for confirmed to me the use of Rate of Change as well as Magnitude of Change.  From your prior posting I had the impression that you had found a way to accomplish Autopilot control w/o those factors . . . .

-al-
Title: Control panel installed!
Post by: thomasonw on March 18, 2013, 07:48:57 PM
The custom panel from Frontpanelexpress.com arrived.  Buy I tell you, they sure do nice work.

(http://1.bp.blogspot.com/-1yaGzANDLhw/UUfBZtUnmdI/AAAAAAAAJzQ/T3nq6qhx4kQ/s1600/IMG_3840.JPG)


Tonight I added the parts, mounted it, and took it for a test run:

(http://1.bp.blogspot.com/-okoxtw49vMM/UUfBY3SzJPI/AAAAAAAAJzI/DPHFzG8DqK4/s1600/IMG_3841.JPG)


My Wife even gave it an admiring look!  (At least, that is my story).   Am a bit disappointed with the #4 machine screws I purchased from Ace Hardware, clearly their heads are undersized (Notice the silver ring around the 4 countersunk LCD screws).  But I am not sure I want to spend the $ to get proper sized screws from McMaster!



-al-




Title: New PCBs
Post by: thomasonw on March 19, 2013, 03:42:49 PM
Getting to the short strokes, lots of 'packages' will be arrived this week and next before we head out for the summer.  Today it was the rev 0.2.3 PCBs

(http://4.bp.blogspot.com/--YmtzmqaSEI/UUjY00CgFjI/AAAAAAAAJzg/-7XB8nZilAQ/s1600/IMG_3844.JPG)


Main features:

That funny looking board to the top right is not really related to this project.  It is a small alarm board I made to monitor high water and main engine overheating and will mount to the right of the Generator controller on the remotes front panel.


Title: 20% off Front Panel Express until June 30th.
Post by: thomasonw on March 21, 2013, 08:35:06 AM
If anyone is thinking about using the company I used for the  custom panel, Front Panel Express sent me this eCoupon.  You can get 20% your 1st order.  Valid till June 30th.

(http://2.bp.blogspot.com/-FPsmqyWlIg8/UUsYu7JPTQI/AAAAAAAAJz0/7ccEMj9gxAs/s640/referralcode_3877715037643495732.png)

They do nice work, and there are a TON of options for materials / finish, etc.

http://www.frontpanelexpress.com/ (http://www.frontpanelexpress.com/)


-al-

Title: Today's run results: Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 21, 2013, 08:12:15 PM
Today I coded in a PID-lite algorithm,  PID:

   Proportional   -  Error measured at the moment       (Originally component being used)
   Integral         -  Cumulative sum of errors over time.
   Derivative      -  Rate of change of error                 (Velocity in Bruce's explanation)

What I find interesting is almost without exception all the Best Practices papers and guidance calls to use P+I for a 'PID Lite' and add in D  "If it is needed".   However, Bruce clearly pointed me to go with P+D out the door, and add in a "DD" (Acceleration) if needed - totally bypassing the I.

Well, in the sense of not bypassing Experience over Learning I did the smart thing and went with Bruce's guidance -  just use P+D .    Here is what I got after a few runs today:

Stability during Acceptance Phase:  +/- 30mV around goal battery voltage.  Absolutely no indication of 'hunting'.   And that was even after restoring the timing to a 100mS sampling / adjustment rate!

And a side benefit of not using "I":  There are about 6-7 special cases that need to be programmed for when using the Integral.  Bypassing it sure makes for simpler coding.



It goes without saying, Bruce is the Man!





I then went on and did some transition testing, by applying and removing a 500W and then a 2250W load to the battery.   


Results:
   Worst case load:  (2250W load switched quickly, around 3-4 second intervals, trying to build up momentum):
   Max transition DOWN noted:   -1.38v    dip @  -194V/s rate.   (Application of 2250w load)
   Max transition UP noted:       +460mV raise @  +284V/s rate.  (Removal of 2250w load)



System:
   6x - D85-29 industrial cells.
  Magnum ME3112 inverter
  Rated (not measured) 1500W hot water heating element
  Rated (not measured) 750w block heater heating element.
  373mcm DC cabling, under  10' total.


System Response: +445mV overshoot (above goal battery voltage), declining to +28mV in 261mS. (Two cycles)


All were 'measured' using the self reporting capability of the controller.  The INA-220 give a 1mV resolution (sampled every 50mS or less), while the system reporting / response is at a mean rate of 131mS.   I am sure that affected the rise and fall time numbers.  In the next set of runs I will connect up the DSO.  But given what I read is allowed for auto 'Load Dump' spikes; it seems to me the above is acceptable.  Does anyone see anything alarming?
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on March 22, 2013, 10:42:43 AM
I think a two cycle (200ms) rise of 0.46 volts when dumping the 2250 watt load is totally acceptable. Thanks for the complement, glad it was helpful. There are lots of ways to get good control response for specific situations, but I think using 1st and 2nd derivative damping works reliably and predictably for almost anything so I use it to save time and avoid thinking.

Adding the 2nd derivative (acceleration) term will typically shorten the response to a step change, but it does take more computation and more experimental "tuning" time.  You could try it just for entertainment.

It's academic, though, as I think your current response is very good. Congratulations on your great project. State of the art, very professional.

Best Wishes,
Bruce



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 24, 2013, 11:37:30 AM
Thank you Bruce,   

This has been a fun project - and I really am grateful for the input I have received here.  The Smart Regulator is working just as I wanted in terms of managing WATTs (not just volts) and hence managing the load on the engine.  Through a combination of recapturing underutilized capacity during the Bulk phase (the Triangle), and much tighter regulation and capping of the Amps (so as not to stall the engine) I am expecting to be able to reduce my total run times by 15-20% over when I was using a big-name external regulator.

Plus I got a cool remote start/stop button!

Going forward I will be posting the KiCAD files to the blog.  Need to finish up the firmware for an Amtel based remote vs. the current back-pack solution (Will result in tidier physical packaging and eliminate the single-source LCD).

The EGT probe should be here Monday.  I want to use it to help select the max watt set point for the system (currently I look for Black-exhaust combined with how the engine responds to throttle moments to judge overloaded conditions).   And then with that as a base point I want to experiment using different alternators to see if I can increase the alternator efficiency portion of this generator.  It is my understanding that Alternators loose efficiency as they are spun faster.  Because I am closely monitoring and regulating Amps I can install one of my spare 200A LN4800 series units, spin it slower, and then start adjusting the Amps until I get to the same baseline EGT as with the current 135A alternator.  I am hoping to pick up 5%, maybe even 10% more efficiency using this approach.

But that as they say is another story.  This story gives me the tool with which to investigate!

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Lloyd on March 24, 2013, 11:52:50 AM
Quote from: thomasonw on March 24, 2013, 11:37:30 AM
Thank you Bruce,  

This has been a fun project - and I really am grateful for the input I have received here.  The Smart Regulator is working just as I wanted in terms of managing WATTs (not just volts) and hence managing the load on the engine.  Through a combination of recapturing underutilized capacity during the Bulk phase (the Triangle), and much tighter regulation and capping of the Amps (so as not to stall the engine) I am expecting to be able to reduce my total run times by 15-20% over when I was using a big-name external regulator.

Plus I got a cool remote start/stop button!

Going forward I will be posting the KiCAD files to the blog.  Need to finish up the firmware for an Amtel based remote vs. the current back-pack solution (Will result in tidier physical packaging and eliminate the single-source LCD).

The EGT probe should be here Monday.  I want to use it to help select the max watt set point for the system (currently I look for Black-exhaust combined with how the engine responds to throttle moments to judge overloaded conditions).   And then with that as a base point I want to experiment using different alternators to see if I can increase the alternator efficiency portion of this generator.  It is my understanding that Alternators loose efficiency as they are spun faster.  Because I am closely monitoring and regulating Amps I can install one of my spare 200A LN4800 series units, spin it slower, and then start adjusting the Amps until I get to the same baseline EGT as with the current 135A alternator.  I am hoping to pick up 5%, maybe even 10% more efficiency using this approach.

But that as they say is another story.  This story gives me the tool with which to investigate!

-al-


Al,

Have a look at the Nippo-Denso 200 amp 3 phase hair pin alternator. It is the most efficient wound field alternator produced, besides the new hairpin from Remy International.

The Remy uses a patented Hairpin Stator with square wire, which equals a 100% slot fill. The hairpin designs cuts the wire lose in the stator because of the tight turns you don't have any excess wire outside of the flux zone. Along with the higher slot fill you end up with an 80% effy. Also of note the remy is a true 6 phase alternator

Lloyd


http://blog.dcpowerinc.com/category/alternators/spx-i/ (http://blog.dcpowerinc.com/category/alternators/spx-i/)
(http://blog.dcpowerinc.com/wp-content/uploads/2013/02/11214_10151461131849078_1001798680_n.jpeg)
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on March 25, 2013, 09:19:02 PM
Quote from: Lloyd on March 24, 2013, 11:52:50 AM
Al,

Have a look at the Nippo-Denso 200 amp 3 phase hair pin alternator. It is the most efficient wound field alternator produced, besides the new hairpin from Remy International.

The Remy uses a patented Hairpin Stator with square wire, which equals a 100% slot fill. The hairpin designs cuts the wire lose in the stator because of the tight turns you don't have any excess wire outside of the flux zone. Along with the higher slot fill you end up with an 80% effy. Also of note the remy is a true 6 phase alternator

Lloyd


I have recently been reading about these hair-pin alternators, did not know there was two manufactures!   I do wonder how these units survive under long time running at high amps?   I know Balmar has started sourcing them for their line, so perhaps that answers the question...    And do you know if they also show the decrees in efficiency at higher RPMs that 'traditional' alternators seem to?

And this is great timing, as today I installed the EGT probe!   (See next post).


Title: EGT! Got to love data!!!
Post by: thomasonw on March 25, 2013, 09:26:22 PM
We received our Mail Drop today, and in it was an EGT probe for the Kubota!   A little drilling, reaming, and a 1/8" MPT tap was all it took to get the probe installed:

EGT in its place.   (I positioned it about 6" from the exhaust port, and in such a way that it does not interfere with the exhaust insulation sleeve.)

(http://3.bp.blogspot.com/-OMZW4wDHgz4/UVEPgRBsA5I/AAAAAAAAJ0k/q-oPARN1O0Q/s1600/IMG_3869.JPG)

And the controller board all installed and wired up. (Less box cover)

(http://1.bp.blogspot.com/-4vXVf9RoJxo/UVEPtqZf7DI/AAAAAAAAJ0s/-JUWm-PKYOw/s1600/IMG_3870.JPG)


Using a watt cap of 1700w, and while turning 2500rpms (2650 under no load), the EGT stabilized at 890f.  And at this level of work the engine is preforming well, no indication of overload (black exhaust), and the engine responded well to small changes in the governor level position.  Alternator output was for example 133A at 12.9v  (batteries placed under heavy load for the test)

I then made a run with the system configured for 2100w.   This time the alternator produced 155A (at 13.42v) and the EGT raised to 1020f.  But there was obvious signs of overloading in the exhaust stream (Black exhaust).   And there was no engine response to governor changes.   Plus the RPMs had dropped to 2400 rpms under load.

Clearly 2100w is too much to draw out at 2400 RPMs.  At 2400 RPMs the engine is rated at 5.2hp continuous   (5.4hp for 2500 rpms). 


IF we assume 1700w at 2500 is a good max continuous load, then that turns into 42% efficiency (1700/(5.4*746))

A key question for me is:  At what EGT should I run?  It seems 900f is a good target, and clearly 1000+ is too much.  Could it be I have already hit the correct target value, and there is no room to grow (without increasing RPMs)?  What is the chance of that.....

This has also given me an idea for yet another fault check:  The max RPMs demonstrated under no load is measured during the RAMP phase.  If the RPMs fall under a definable % of that max (while in Full Throttle mode), then it would be safe to assume the engine is lugging.  For example, in the 1700w case the engine dropped 175RPMs from no load to full load, while in the overload condition the drop was 240RPMs.  Maybe a trap at -200 RPMs (7-8%) would be appropriate in this case.


And here is a question:  The above leads me to believe that 900f is a rather good target to shoot for on EGT.  But I can find NO basis for these small engines (lots of EGT talk around diesel Pickups..) to confirm that.   Does anyone have any insight into what to expect for EGT on these small Diesels?
Title: Engine Control and Regulator project - DC Alternator: Stable Code Posted
Post by: thomasonw on May 22, 2013, 11:30:41 PM
Well,

It has been a quiet past two months on this thread, though I have been quite busy.  We left Friday Harbor in late March and have been "Out There" ever since.  (Currently anchored in False Creek - downtown Vancouver, BC).   I have been refining the generator controller code and now have over 100hrs of operation on it.  This is a bit over the top for us as the Solar Panel are starting to come into their own, but I kept wanting to do Trial Runs. . .    Things have been working rather well for us, the Alternator regulator is spot on, and aside from correcting some small bugs, almost all the work I have had to do centered around active throttle control - specifically handling the late stages of charging when the engine is throttled down and a large load comes online.

(http://2.bp.blogspot.com/-x7NzVkqtis8/UZ2ot-Jy1aI/AAAAAAAAKM4/CpQePnNS77A/s1600/A+Monk+-+McQueen+at+Monk+-+McQueens.JPG)
   A Monk / Mcqueen   at  Monk's / McQueen!  (or was, before it closed last Winter)




Tonight I posted source code release v0.1.0 which I consider a stable release for operation.  http://smartdcgenerator.blogspot.com/2013/05/major-milestone-posted-v010-of.html (http://smartdcgenerator.blogspot.com/2013/05/major-milestone-posted-v010-of.html)  I even turned off DEBUG mode when loading the firmware into our controller!

I have to tell you, it has been SOOOO nice to simply press a start button when it is raining like stink outside, as opposed to going outside - opening the hatch and climbing down in the lazarett.   Only to repeat the same when stopping the generator.   So very very nice.  And one feature that has surprised me is Auto-stop.  We have found that we tend to start the generator when leaving the boat, and I find it comforting that the generator will stop itself when the batteries are properly charged.   I do not have to worry about overcharging, nor about the generator just droning on in Float mode.  Very nice and a benefit I had not anticipated when starting this project.

We also have noticed that with the active throttle control we are more inclined to just leave the generator run in later stages of charging - even when on the boat.   Before I would shut things down when the amps being delivered dropped under 80A, just did not want to listen to the generator.  But now we just let it idle away fully topping off the batteries.  With the active throttle control it really is not intrusive at these low amp final charging stages;  I do not need to baby sit it (it auto-stops when batteries are fully charged), and I am sure the batteries will be SO much happier getting a true full charge (one that is judged on the AMPs being delivered into the battery, not a pre-defined amount of time - which will almost always be wrong).

Again, thank you for all who have helped with this - it goes without saying the value of the assistance.  Over the summer I will continue to resolve bugs as they come up, and once we need to start using the Watermaker I will be looking at that portion of the code (which is untested outside of the Bench Testing done last Winter).  And now that I have an Amtel based LCD remote I may also play with some HUI hosted on the remote to allow for configuration changes, ala start up in quiet mode, or even configuration of battery parameters.  But that will be a Winter project. 

This summer I am working on a stand-alone Alternator regulator (without the integrated Engine Control).  Based on this controllers code and design, its primary feature will be using the Amps to assess the appropriate time to change charge states.  Years ago I tossed out the smart 3-stage regulator we had on the mains engine house alternator; it kept going into Float Mode prematurely - even when configured to MAX times.  I got tired of stopping the boat and main motor just to restart the regulator trying to get a full charge into the batteries.  Now just use a fixed voltage truck regulator.  Works well except on long trips where I need to manually disable it.   Of course the stand-alone regulator will still have the active management of Watts to limit the max amount of power being drawn from the engine.  Maybe not as important on a large mains engine, but if someone wants to use the regulator on a small generator project - still a handy feature.  And I located a self-powered boost FET driver (LT1910), will be trying out a single design that can support P or N type alternators with no component changes!    I am also looking at communication between two regulators for use in twin engine situations (mostly marine need I am sure :-)  )  Will release it in Open Source (non commercial use) as well - just as this controller project.


When it gets closer, will post some details on it here.  Till then, if folks are interested they can check the Blog.

-al-
Title: Stand-alone Regulator project 1st cut - DC Alternator
Post by: thomasonw on May 28, 2013, 12:15:19 PM
As mentioned, I have been taking the core of this integrated controller design and working up a stand-alone regulator-only version.  The primary reason for this is I could never get the commercial 'smart' regulators to properly charge our large house battery, they would always drop out of Acceptance phase well before charging was completed.  (I attribute this to the fact that they use a predefined fixed amount of time to decide when to exit Acceptance phase, and even when I configured them for Max Time, they would enter Float way to soon.  For a while I would stop the boat, turn off the main engine and restart to 'reset' the regulator.  I soon grew tired of this, and changed out to a simple fixed-voltage truck regulator.  This has worked well given our usage patterns, and it is only during very long trips (ala 8hrs underway) that I have to manually adjust the charge voltage once the battery is fully charged.  The second reason is:  I just want to have some more fun!

BUT:  by monitoring Amps being delivered into the battery, I can make a better decision of when to change charging states - one based on the actual needs of the battery, as opposed to an assumed pattern.  This morning I placed orders for the remaining parts and the PCB for the standalone version of the Arduino based Alternator Regulator.  Here is a 'projected' picture of what the PCB will look like:


(http://1.bp.blogspot.com/-Lm0aJmVEvK0/UaTr8drEG4I/AAAAAAAAKPY/PJtbDCLnYDA/s1600/Regulator+PCB+v0.0.2.PNG)

And the schematic can be found in the Schematic Link on the Blog (http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/).   BOM/shipping cost came in at $83 for the regulator and just under $100 for everything:  Regulator, Temp probes, Current Shunts, etc.  All but connection wire and fuses.

The basic concept for this regulator is the same as the integrated Engine Controller and Regulator, with a few differences:


It still retains the ability to monitor and manage Amps (Watts) as well as Volts.  This can be used to better decide when to change charging states (terminating the Acceptance phase based on battery need vs. pre-determined fixed amount of time), as well as doing functions to protect the Alternator, or limit the load on the engine.  I plan to have a few 'pre defined' scenarios built in and selectable via the DIP switches, and hope to have a simple user interface available via the Bluetooth (and/or Serial port) to monitor status as well as allow for additional  custom configuration of different scenarios to be saved in the Atmel EEPROM.  Of course, one could always modify the firmware and get any scenario they wanted!

I should be picking up the parts late June, early July.  Then will be building them up.  Till then, I continue to use my Fixed voltage truck regulator on the main house battery alternator, and the integrated Arduino controller on the Generator.


Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Ronmar on May 29, 2013, 09:11:09 AM
That is way cool! Looks like you are going to save me from having to figure out a standalone controller:)  With the bluetooth I/F you should be able to write an APP to look in on this thing with an Ipad/Ipod...   
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 01, 2013, 09:48:45 AM
Quote from: Ronmar on May 29, 2013, 09:11:09 AM
That is way cool! Looks like you are going to save me from having to figure out a standalone controller:)  With the bluetooth I/F you should be able to write an APP to look in on this thing with an Ipad/Ipod...   

Yes, someone is helping me out that says he can 'deal with all the Ipad stuff'.   Am hoping for a simple GUI connected either by Bluetooth, or the Serial Service Port, that will allow for monitoring of status, and basic configuration changes to be saved in FLASH. And hoping to get something for PC's, iPad and Android... . .  (Anyone else out there experts in this area??  I like to bang-bits, that HUI stuff is just a bother  ;) )   And am leaning towards using ASCII for the communications protocol, to allow other 'programs' to harvest the data in real-time w/o the issues of different binary formats.  One chap I am Emailing with is building up a whole-boat datalogger.  Will be simple for him to scrap off this stream of data and add all sorts of battery / alternator info to his 'glass screen'.

Of course, all can also be done w/o any of the Hi Tech stuff - just set the DIP switches to one of the 6 default charging profiles, and if need be use a PC to re-flash the controller with anything you want....

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 01, 2013, 10:46:06 AM
Another great project with state of the art components. Nice work, Thomasonw!
For the easily technically confused, you might want to change your typo of "booth" to "boost".  I understood. :)  

For the guys scratching their heads at talk of buck, boost, high side and low side drive:
"Buck" switching supplies can only reduce the input voltage to any set voltage or current blow the input.  "Boost" switching supplies raise the output voltage above the input.

A regulator that switches the positive voltage supply is called a "high side" switch. If N-channel mosfets are uses to do this, the gate voltage must be 9-15V above the positive voltage. Very little current is needed, and there are lots of techniques for boosting the voltage to drive the high side gate.
P-channel mosfets don't need the boosted voltage, as the gate is pulled lower than the high side voltage to turn them on.  P-channel mosfets are a bit more expensive and have lower efficiency than N-channel.  

"Low side" regulators switch the ground, and this is cheaper and more efficient as N-channel mosfets can be driven with 9-15V to the gate.

Thomasonw is doing a universal high OR low side regulator design that could be used with ANY alternator, thus he's going for the fancy boost capable mosfet driver.  

Very nice, very sophisticated.

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 11, 2013, 08:52:22 AM
Quote from: BruceM on June 01, 2013, 10:46:06 AM
For the easily technically confused, you might want to change your typo of "booth" to "boost".  I understood. :) 


Bruce, Thanks - and glad to see you doing better! 

I tried to go back and edit my typo you noted, but it seems the system only allows me to make changes for so long after a post is made..  (I can no longer see the 'Edit' button for that post.....)  Is there some way to go back and edit older posts?

Been busy drafting out the the code for the stand-alone regulator.  The core regulation function was easily lifted from the controller project, but will tell you - HUI (Human User Interface) is just a PITA!!!   It is why I always (well, when I was programming for a living) preferred embedded controls or system programming (I liked to write languages / compilers, OSes, and the thing that does something when you push down a key - like decide WHAT key you pressed down - but never 'applications'  Awk.....  8) )    BUT:  I have persevered, made a simple ASCII string based command set to allow for updating of things like charge parameters and timings to be stored in the EEPROM of the Atmel CPU.  Status is sent out via an ASCII  stream with the idea someone I am working with make some nice looking apps for PCs and perhaps PDAs to see the status and/or make changes without needing to recompile the source..

Parts are accumulating at our mail-drop - I will be picking them up at the end of the month.  Then  more and more fun!  I am really interested to see how this new FET driver ckt works, really like how it looks on paper.

And on the full controller, it continues to work well - though our actual use of the Generator is declining with increased sunny days (and the solar panels).  Of late my efforts have been with the oneWire temp sensors - dealing with restarts when they fail, and also adding in validation code to look for wako data.  ala, our last generator run faulted out with Battery Temp = 185f - well over the 140f trap.  And no, that was NOT the true battery temp!!  (185f, or more correctly 85c seems to be a defined error state of the DS18x20 onewire temp senders...)



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 11, 2013, 02:13:23 PM
Glad you're making such good progress on your standalone universal alternator regulator, Thomason.

Your HUI for setting programmable parameters is a very nice feature.  I've avoided this labor by using a three pin header to allow code/parameter updates via laptop reprogramming.  Your approach is way more professional and should make for a more marketable product.  I predict it will be very popular.

Best Wishes,
Bruce

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 11, 2013, 05:16:24 PM
Quote from: BruceM on June 11, 2013, 02:13:23 PM
Glad you're making such good progress on your standalone universal alternator regulator, Thomason.

Your HUI for setting programmable parameters is a very nice feature.  I've avoided this labor by using a three pin header to allow code/parameter updates via laptop reprogramming.  Your approach is way more professional and should make for a more marketable product.  I predict it will be very popular.

Best Wishes,
Bruce



I also intend that a PC will be used to do configuration changes via the HUI - communicating over either the Service Serial port or Bluetooth via  to-be-written fancy point-n-click application(s - idea is could support PCs, mac, iPhones, Androids, NMEA-2000??, etc..  just a small matter of programing :) - and not my me, some one is offering to do that part ).  But I elected to use clear ASCII as opposed to Binary data packets for communication to and from the external platform.  This was to allow for the use of those different external platforms without getting into issue associated with sending raw binary data, ala: how a given computer chooses to format a floating point number. . . .  (It also  makes a really hard to read sudo-HUI for those who like CLIs - Command Line Interfaces!!!)

And FYI:   I just posted up the draft of the Source (as bench-testing on a UNO, hardware will not be here till the end of the month), and a .wrd document covering the ASCII communications.  https://docs.google.com/folder/d/0B5GiaoeXCQ3vQU5ncXhETjQ3OGM/edit?docId=0B5GiaoeXCQ3vSWpZTGVPMDlpRlk (https://docs.google.com/folder/d/0B5GiaoeXCQ3vQU5ncXhETjQ3OGM/edit?docId=0B5GiaoeXCQ3vSWpZTGVPMDlpRlk)

Should also point out there is an 8-position DIP switch on the regulator that can be used to select different predefined charge profiles and system sizes.  One need only go to the ASCII stuff (and/or the nice to-be-written PC/Andrid/... apps) if they want something other than those pre-defined profiles.  (Or, one could just simply modify the source code and recompile things!!!).  Serial port is also used if one wants to see lots of numbers come out of their regulator (Vbat, Amps being produced, Bat and Alt temp, Engine RPMs, etc..). 

But in its simplest use none of the above is needed.  All one needs to do is use the DIP switches to select the charge profile for their batteries,  indicate the capacity of their batteries (again via the DIP switches) and hook up the regulator.  Before starting anything I do a raw VBat read via the Atmel A/D converter and decide what system voltage we are connected to (12v, 24v, 36v, or 48v) then make needed adjustments to the charge profiles to match.   That is it!

And one special feature (because I am a BOAT guy) is a 'sync' port:  If you have say a twin-engine boat charging the SAME battery bank, connecting a telephone cable to the two SYNC ports will allow the regulators to share information and better coordinate their activities.  Maybe this could extend to land-based as well?  - in the case of someone having two DC generators on site:  a LARGE one and a SMALL one..  Idea is to prevent them fighting each other while charging and share info to make better charge state transitions decisions.

AS this moves forward, I likely will look to migrate some of these ideas back into the fully integrated engine control and regulator.  But for now will work to proof them on the stand-alone alternator regulator.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 11, 2013, 05:35:07 PM
Very advanced and capable software features...I think it will be popular for off grid battery charging too. I'm jealous, my sophisticated software days are over.

Best Wishes,
Bruce
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: vdubnut62 on June 13, 2013, 02:40:12 PM
You two make this sound so easy! And I understand just as much as a goldfish understands nuclear fission.
But please keep up the good work. With luck I can buy one and just maybe figure out how to hook it up.
As long as the instructions are picture heavy :D
Ron
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 13, 2013, 07:22:35 PM
Quote from: vdubnut62 on June 13, 2013, 02:40:12 PM
You two make this sound so easy! And I understand just as much as a goldfish understands nuclear fission.
But please keep up the good work. With luck I can buy one and just maybe figure out how to hook it up.
As long as the instructions are picture heavy :D
Ron


Ya, it does seem like Bruce and I tend to get into Full Propeller Mode rather easy  ;D

I do hope to make this not only flexible; and being open-sourced and in public domain - very flexible -  for anyone who wants to work from this design.  But am also hoping to make the standalone regulator (the non-integrated one w/o any of the engine monitoring, starting, throttle controller, etc)  with the same easy-of-use as standard external regulators  -->  select the options you want via the 8 DIP switches and connect it up.  All the 'geek-dum' is needed only if you want to do things like:  Use your iPhone (yours, I do not have one...) to see what is happening with your system.

A question does come up about 'manufacturing'.  At this time I do not really have a vision of going into 'production', this is more of a hobby for me - plus I get a really great regulator!  But perhaps later this fall (or winter) can consider a build of a few units for folks who are interested.  But want to debug the 1st units before anything like that . . . . .
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 14, 2013, 07:13:50 PM
Quote from: vdubnut62 on June 13, 2013, 02:40:12 PM

As long as the instructions are picture heavy :D

Ron

ok Ron   ;D

Today I made up this picture:

(http://4.bp.blogspot.com/-m5O9-8duLRo/Ubu_YPoiWbI/AAAAAAAAKT4/LCfaRi0IUEQ/s640/Arduino+Regulators.png)

Had planned to anyway and am in kind of a holding pattern until I can get to our mail drop and pick up the PCB and parts.   But this shows how I intend the external regulator would be connected to an alternator.  Of special note are the the A, B, C, and D terminals.  These are used to allow the regulator to support P-type (High Drive) or N-Type (Low Drive) alternators w/o any other changes.  As shown (with the Jumper between A and B) the regulator is configured for a P-Type (High Drive) field. The Field is then connected to C/D (or in this case just C as the other end of the field is connected internally in the alternator to ground.)  To support a N-type, one would jumper C&D, and connect the Field to A/B.  (Or just B if the alternator has connected the other end of the Field to BAT+ internally).

The DIP switch is used to select built in charging profiles, while the Bluetooth (or via the Service Port) can be used to enter custom profiles.

The Battery + and Battery - connections should be made AT THE BATTERY, while the Alt + and Alt- can be made directly to the alternator.  (The reason I separated the BAT and ALT wires is to allow support for Alternators which might have a different field voltage then the charging battery.  e.g., using a converter 12v alternator to charge a 48v battery where the field is still 12v).
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: vdubnut62 on June 15, 2013, 06:33:39 AM
So simple even a Cave Man can do it.  :)
I don't have an Iphone either, I want a removable battery phone in case I want to go dark. ;)
Thanks!!
Ron.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 19, 2013, 05:29:36 PM
Made an update to the 'picture'.  Here is the revised one (I had the Current shunt + and - backwards).     Wish there was a way to go back and edit my posts - seems like that option is taken away after a few days.....


(http://1.bp.blogspot.com/-DWBPhzStl8U/UcI9g7h1NpI/AAAAAAAAKVI/nBDEHA0afBc/s640/Arduino+Regulators.png)
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: glort on June 24, 2013, 03:31:32 AM

I would to have something to control a F&P 240V generator or an induction motor Generator.

I have really been trying to follow this interesting thread but shamefully, so much of it is over my head. Please excuse my EXTREME ignorance, but I'm wondering if it would be possible to use a PC with the right connections and software to do this?
I can get any amount of desktops, Laptops and servers and would have a lot more hope setting one of those up than these other little machines I just have no knowledge of.

If that's not possible, are there any commercially made Controllers that would be OK for an induction motor as a generator?
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 24, 2013, 07:59:42 AM
Quote from: glort on June 24, 2013, 03:31:32 AM

I would to have something to control a F&P 240V generator or an induction motor Generator.

I have really been trying to follow this interesting thread but shamefully, so much of it is over my head. Please excuse my EXTREME ignorance, but I'm wondering if it would be possible to use a PC with the right connections and software to do this?
I can get any amount of desktops, Laptops and servers and would have a lot more hope setting one of those up than these other little machines I just have no knowledge of.

If that's not possible, are there any commercially made Controllers that would be OK for an induction motor as a generator?


Good morning, and please I would say no shame.  I spent +/-20 years BUILDING PCs (IBM, Epson, Intel, etc.), but just run away when I have to do much more than simple 192.168.xx.xx things. . . .

This project is really oriented towards a DC 'generator', not the AC one you are describing.  Although some features (ala start / stop engine, monitor temps and oil pressure) could be reused things like engine speed control and such might not have the precision and reaction time to allow for stable 60hz (50hz) AC power generation.  (Am thinking about the response times of the throttle motor control I am salvaging from auto cruise control units).   I just do not know. . . . . 

It MIGHT be possible to modify this project towards an AC generator head, and if someone has more experience in that area then I and wants to work on it - am always open to some more fun!   But as it is today, I would perhaps think it is not currently the best choice...

As to other products, will leave that to folks who have more expense in those areas then I.   And again, if someone can see some value in a modified version of this project - leveraging the engine control portion and making needed changes on the AC side? -  and wants to perhaps start something let me know!

-al-

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: Ronmar on June 25, 2013, 03:10:19 PM
Well an excited field generator is prettymuch an excited field generator.  A little code and a scaler for sampling 240VAC, and I could see this thing driving a ST head fairly easilly...

There is no real way to regulate an induction motor to deal with varying loads.  An induction might work OK making bulk DC that is regulated much like a solar system regulates whatever it gets from the panels...
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 25, 2013, 04:48:25 PM
It's possible to do dynamic switching (say via Triacs) of capacitors to regulate an induction motor, but I haven't seen such a beast commercially, and I think it seems a whole lot easier and more practical to use a generator head.

I have a 4 capacitor, zero cross switching circuit and board I can provide to someone who is determined to have a regulated induction motor generator, but it was designed for rectified AC so the DC mosfets and drivers need to be switched to Triacs.
It was used for my 120VDC battery charger MK I version, which I abandoned due to severe power factor related problems with my AVR when generator fired.  I switched to a dead nuts simple motorized Variac design (controlled by my Picaxe battery bank monitor), which has worked very well with great power factor since I use a 1100 watt toroidal transformer primary as a choke for DC filtering. I could have added a microcontroller chip (I'm a PIC fan) to my ST-3's homebrew AVR and done my AC battery charge regulation there, but I wanted to be able to use some AC while charging the batteries.

+1 Ronmar's comment - No reason Thomasonw's lovely state of the art open source design couldn't be slightly modified for any AC or DC generator head.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 26, 2013, 10:46:35 PM
I know for my work with the EPA and the ENERGY STAR programs, measuring AC can be a little different then DC, but there are also nice integrated chip solutions out there that could take the place of the INA-220's currently being used.  Driving the Field for Voltage Regulator would be doable I suppose, and perhaps the simple cruise control throttle control units would be responsive enough to regulate RPMS and frequency?   With all that, could leverage the whole soft start, cool-down, alarm, remote, and instrumentation capability of the controller..

If folks are interested in this as a 'next step' (once I finish the stand-alone alternator regulator project (http://www.microcogen.info/index.php?topic=3116.0 (http://www.microcogen.info/index.php?topic=3116.0)) I have been having fun!   Woudl need someone to work with me who actualy has an AC generator and would be able to use it for a test-bed, my system is all DC..   

But if there is interest in a AC verion of this integrated controller / regulator project, and someone who could assist me . . . . . .

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 27, 2013, 11:25:50 AM
I did try out one of the analog RMS AC voltage chips for my AVR.  Alas, it was too slow in conversion so my flicker compensation suffered badly and I could not tolerate my shop heat/light lamps. So I reverted back to my simplistic analog RC integrator for AC voltage measurement.  It can't handle big loads with poor PF, so I stopped trying to do that. :)

I think you are best off doing your own RMS calculation via the processor, after AC rectification and resistor scaling, as the RMS voltage can be computed every half cycle.  An analog sample every 500usecs would be dandy.



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on June 28, 2013, 12:35:46 PM
So, the INA-220's are able to do a spot 12-bit sample every 600uS or so.  Currently in the DC regulators i am asking it to average 32 of these samples over a 17mS time frame before sending the results back to the CPU.  This is to largely smooth out noise on the DC battery.   And I needed the 12-bit resolution in order to get sufficient significant bits for the tight DC voltage regulations (+/- 75mV) without doing all sorts of pre-scaling / level shifting magic.    In moving to an AC sample, I am wondering if all of this is an overkill.

Perhaps just doing sampling using the built-in Atmel 10-bit A/D and feed it into an RMS formula would be sufficient?  The Atmel A/D takes up to 260uS per conversion, and can be triggered by a fixed speed timer.  Could set up to doing a conversions every 500uS as you suggest.  Detecting zero-crossing would allow for an RMS calculation on each 1/2 wave form, and then a post 'average' of several (6 or so?) of the half-waveform RMS calculations to filter out noise???    Zero-crossing would also be a way to monitor frequency which could then be used to make small adjustments to the throttle/governor control motor...

And am not really seeing how the Amps measurement could be helpful, given there is no real way to 'regulate' Amps.  About the only thing I could see  monitoring Amps for fault detection, or to tack number of VA (or KW) produced over time...





Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 28, 2013, 01:35:10 PM
You're right, Thomasonw, 10 bit would do it.  I'd put a bit of low pass LC filtering on the AC after rectifying and scaling to filter out high frequency spikes, but your software approach is equally valid, but not as effective for high frequency transients, and potentially slow. And active analog (op amp)  filter would also be effective, and might be more compact.  The software approach has the big advantage of no filtering inductors and capacitors.





Title: Detecting Engine Started in an AC generator..
Post by: thomasonw on June 29, 2013, 12:28:05 AM
On the DC controller I sample the Amps draw of the starter (via the same shunt used to measure Alternator output) in order to decide when the engine has 'taken up' and started.

It works steller.

I am wondering for an AC generator controller what other, reliable, ways there might be to sence the engine has indeed started - and turn off the starter / glow-plug.  What are some of the ways others have used in the past???

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on June 29, 2013, 06:02:21 AM
The generator mains AC frequency (at well below normal voltage) could be a reliable start indicator.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on July 19, 2013, 06:11:39 PM
Quote from: BruceM on June 29, 2013, 06:02:21 AM
The generator mains AC frequency (at well below normal voltage) could be a reliable start indicator.

Sounds good.  Over my 'break' I researched a bit on existing RMS measurements using the Arduino / Amtel CPU.  There are many examples out there, the more appropriate ones using direct Amtel register manipulation vs. the higher overhead Arduino library calls.   Seems that one could also add a current probe and come up with figures of power factor, THD, etc...

Perhaps the fall, once I get the stand alone regulator completed - and any issues with the integrated controller as I start using the water maker this summer, I can look at an AC generator version of this project.   But still will need someone to help me, as I do not have an AC generator to play with  ;D   So, if there is someone who might be interested in this, and has a bit of tech knowledge, drop me a line....

-al-
Title: An update on the Integrated Engine Controller and Regulator
Post by: thomasonw on July 28, 2013, 07:58:58 PM
OK,

Getting back to the real project at hand, the DC generator controller which integrates engine control (starting, stopping, throttle speed management) with a  smart DC alternator regulator (which manages Amps as well as Volts).   As a 'Generator' we have  100+ hours on it now, and it is working very well.   The past week or so I have been exercising another capability of my Kubota DC generator - the Reverse Osmosis Seawater to Fresh Water-maker.

There is very little automation in the Water-maker part of this, all valves and pressure adjustments are done by hand.  But the controller does need to engage and disengage the high pressure pump clutch, and at the same time reduce the output of the Alternator to account for 2-3hp being used to power the high pressure pump.   I have been working out a few bugs in the code (mostly around transitions to and from pure generator to co-gen/watermaker), and am getting it close to having it nailed down.   At the same time I have been taking advantage of the 2nd MAJOR goal of this whole project:  being able to generator DC power WHILE also powering the high pressure watermaker pump.   Prior when using commercial regulators, there was insufficient flexibility to reduce the Alternator load so I had to turn it off.  It was a DC generator -OR-  a Watermaker.  But now, I can manage the loads more closely and am able to make around 40GPH of fresh water from the Seawater, AND deliver 50A into the batteries - at the same time.  This is turning out to be a really nice feature  - reducing overall run time and keeping my batteries much happier (nearly fully charged) in the process.

I am going to give it a couple more weeks of 'testing', and then will post the revised firmware to the blog.  I am also working on small expansion board that will monitor the pre-filters and the RO membrane pressures, sounding an alarm as they approach out of range conditions, and shutting things down when they get out of tolerance.  The pre-filters are filling up with green algae in about 2 hours of run time, and I need to watch the setting every 10-15 minutes as we had one run that went wildly out of bounds. So even if I do not do watermaker automation, I do want the controller to monitor critical pressures to protect the expensive high pressure pump as well as the RO membranes.  (and in true a Micro co-gen spirit, I added a driver port to turn on a DC pump when the engine temp goes over a set temp, to route some engine heat into the domestic hot water tank to boot!)

-al-

Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on August 04, 2013, 07:30:25 PM
Today I posted v0.1.2 of the controller source (See link in Blog:  http://smartdcgenerator.blogspot.com/ (http://smartdcgenerator.blogspot.com/)).  This resolved a few small errors (ala, the next key would not only restore backlighting on the LCD but also advance to the next screen, as opposed to only restoring backlighting), improved OneWire handling (Still think there is more to do there…), but mostly this version has been exercised using the Watermaker in conjunction with the ‘generator’. 

The capability of producing some Amps while also driving the watermaker high pressure pump was the 2nd major goal for this project.   Commercial regulators did not give me sufficient control and previously I would turn off the alternator when making water.   Now I can get 800w (50+ amps) into the batteries WHILE also running the reverse osmosis watermaker.


At this point I consider this project largely completed.   Over the next months I will continue to correct any small bugs I find, but for the core of the project it is completed.   As next steps I see three potential opportunities:

Overall I think the 1st item is critical - I currently need to watch the watermaker settings every 15-20 minutes or so to make sure they do not drift out of allowable settings when the pre-filters clog up and / or the system changes as temperatures change.   I am debating to use a simple pre-existing China I2C A/D board with some jumper wires, or to do up a small 'expansion board' that will have a bit more functionality and also better physical mounting.   But this is all a Fall project as I do not have access to mail-drops until we return to a port somewhere for the winter.

And I still have one board set left, if anyone is interested.  Thanks again to all who have helped with this project, and to those building up aboard set – looking forward to hearing about your results!

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on August 04, 2013, 07:39:26 PM
Hi Thomasonw,
Congrats on the dual mode operation.  That should be more fuel efficient and cut down on engine run time nicely. I remember this was an important goal for this project.

I know that however you add you new A/D capability for the critical water maker monitoring, that it will be done as nicely and professionally as the rest of the project.  Your work impresses!

Well done!

BruceM
Title: New controller source posted.
Post by: thomasonw on October 06, 2013, 05:15:22 PM
Today I posted v0.1.3 of the source code for the DC generator engine controller and alternator regulator.  It includes some bug fixes, a couple of new modes of operation, and a bit of work around management of temperate limits (chiefly the EGT) as well as dedicated load-dump detection.

One of the biggest changes is the addition of dedicated load-dump detection code - being more aggressive in reducing the field-drive in response to larger overvoltage situations and also looking at the voltage rate of change (dV/dT) to try and prevent them in the 1st place.  I found while debugging the stand-alone regulator that the PID logic was OK constraining smaller alternators, but could not reign in the 270A alternator on the main engine of Viking Star fast enough in response to some load-dump conditions.  At times it would overshoot the target voltage by 450mV (almost 1/2 a volt!) when say the dryer heater turned off and the battery was almost fully charged.  With the improvements I now cap load-dump overshoot to 35mV.

The other big change was looking at situations where the generator approached its running temperature limits (EGT, Engine coolant, and/or Alternator temperature).  The existing PIDs would pull things back once those limits were reached, but then the same conditions as before would again drive the system back over the line.  This was most noticeable with EGT - as I am trying to run the engine at its max continuous load to reduce total generator run time.   New code now will self-learn from any temperate limits and self-adjust to reduce the maximum load placed on the engine - preventing crossing the line again.  This self learning and adjusting is done every time the system is started as I noticed that things like sea water and air temperature had a noticeable impact on what load the engine could truly drive before reaching its target EGT.

I also added in two new modes of operation:  Quiet Mode which will limit the RPMs to a defined max, thereby running the generation in a more civilized (and quiet) way.  I also added a mode to use after changing engine oil - Prime Oil.  In this mode the starter is enabled, but not the fuel, and I watch for the engine oil pressure to come up.  This is, btw, what the Cummins Operations manual suggests to do after changing oil (or leaving the engine sit for 2 weeks or more).  It was an easy edit to modify the existing Start-Engine code.

We have several hundred hours running now and am still very happy with its performance.  See http://smartdcgenerator.blogspot.com/2013/10/v013-of-source-code-posted.html  (http://smartdcgenerator.blogspot.com/2013/10/v013-of-source-code-posted.html)  for more details on the changes and for a link to the source.

-al-



Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 06, 2013, 06:26:33 PM
I like your new quiet mode, and all the other refinements.  It's one sweet system.

The beauty of a roll-your-own is that you can get the operational characteristics exactly right for you needs...even when those needs evolve.
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: thomasonw on October 19, 2013, 10:51:18 AM
Thanks Bruce.  Yes, this has been a fun project, and always tempting to do the SMOP (See http://en.wikipedia.org/wiki/Small_matter_of_programming (http://en.wikipedia.org/wiki/Small_matter_of_programming)) with extra 'features'.  I still have stubbed in quiet-time blackout periods for the auto-generator startup mode, but have not flushed them out..

And now that we have a summer of operation under our belts and interesting usage pattern has developed.   Perhaps the key goal of this project was to reduce generator run time by manage the amount of power delivered to match the capability of the driving engine at each point in the charge cycle.  Regulating Watts to fill in the triangle I talked about it in earlier posts.  And the regulator does this very very well.  In fact, by monitoring the EGT it is able to self adjust to changing conditions of the engine and keep it at its max continuous load point.

Looking back over the summer what is interesting is our run-time per month increased as opposed to going down!!  I blame this on one simple thing:  Throttle Control.   When using my commercial 'smart' regulator I would run the generator until the battery acceptance rate dropped to say 60-70A, this equated to about the 85% recharge point for our FLA batteries.  I figured this was a good compromise vs. having to listen to the generator running while packing in those last few %'s of charge.   (It is very common for boaters to operate their batteries between the 50% and 80% charge points, balancing engine run time vs. battery life)

Well, with the active throttle control our usage pattern has totally changed.  Because the generator engine slows down under lighter loads (at that 60-70A charge point, it might have slowed down 1,000 RPMS), even to the point of almost idle speed when doing the final topping off, we now let the generator run topping off the battery.   Due to the slower engine speed it is much quieter, hardly distracting to us.  It will continue to top-off the batteries until the they are fully charged as indicated by the actual battery acceptance amps (vs. some pre-determined timeout).  I have it set up at 35A for our system - might be a little high truth be told.  Once exiting Acceptance Phase it is configured to automatically shut down (vs. continuing into Float mode).

So, what has changed is we tend to just let it run.  Bringing the batteries up to 98-100% recharge point each time.  With the throttle control the noise is not unacceptable, kind of like those Honda 2000 generators idling down under light load.  But more so, with the full instrumentation (over temp limits, cooling water flow, etc) I feel comfortable letting it run while we are off the boat.  A pattern we now have is to start the generator when we leave the boat for a few hours, knowing that when we return the batteries will be FULLY recharged, and the generator will have turned itself off.  And we tend to do a recharge cycle every couple of days as opposed to stretching it out to 4-5 days..  We now operate between 80-98% charge points vs. 50-85% points.

So ya - key goal was to reduce the total run time was not realized.  The hour meter shows it almost doubled vs. the year before.   Bit I think it is a good trade off as I am sure the batteries are MUCH happier being fully charged vs. the 80-85% point we did before.

So there - learnings from doing  ;)



ps: A bit of a delay in posting,  I tried to share my coffee with my laptop last week.   It did not like it - let out some of the Magic Smoke.  Think that might perhaps be because the coffee was Decaf??

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: BruceM on October 19, 2013, 02:37:56 PM
Hi Thomasonw,
It's sure handy to have auto shut down of a generator, I have that for my Listeroid; 10 minutes of no load shuts her down. Since I can't hear it, very important.  I have a special skill; I can forget anything in 5 minutes or less.

Next year you can implement the fuel saving mode at the expense of battery life.  :)

Thanks for sharing this great automation and control project!
Bruce



Title: Revised design posted: DC Generator and engine controller
Post by: thomasonw on June 01, 2014, 03:16:38 PM
All,

Quick note:  I have revised the DC generator controller + alternator regulator project and posted the design:  http://smartdcgenerator.blogspot.com/search/label/v0.3.x (http://smartdcgenerator.blogspot.com/search/label/v0.3.x)


(http://4.bp.blogspot.com/-tIsVbD0FNS8/U4IChhqdPqI/AAAAAAAAL7Q/jXy8ytknVh8/s1600/Kubota+Generator+Control.png)

There are two major changed:

This last item allows much of the PCB to be machine assembled and reflowed, though the high power parts (ala FETs, etc) still need hand soldering.  Not only will this increase the solder quality of the SMT parts - by eliminating hand soldering (esp those oh-so-small INA226's), but by taking advantage of high volume production lines the costs are lower (am able to source the SMT assembled board + SMT components for about what just the blank PCB was costing).

All sets but one of this run is spoken for spoken for, if anyone is interested.  And if down the road there continues to be interest I may coordinate another group build.

-al-
Title: Re: Another Engine Control and Regulator project - DC Alternator
Post by: focodiesel on June 04, 2014, 08:05:38 AM
We'll done! Keep the updates coming.