Friday, December 6, 2013

3.3v boot-loader for Arduino

I have not done too much on this Regulator project as of late, as we have been busy with visitors and visiting too many coffee shops.  But I did play around some with solving the 3.3v boot-loader challenge.  Turns out it is really simple, and the Arduino Pro comes in a 3.3v/8Mhz version using the Amtel 328P micro-controller.

I found this Sparks-of-fun forum posting that covered ALMOST all of what was needed:, but there is one detail that bothers me:  5v to 3.3v signal levels...   As written the author is directly driving the poor target (running at 3.3v) from the 5v output pins on the hosting Uno.   I am sure for short bursts it will work OK, but it is stressing things a bit, so here is what I did:

 Just used a couple of resister dividers to bring the 5v down to 3.3v land.  Needed to do this for the MOSI (Master Out Slave In) as well as the SCK pins.   I used 470ohm and 1K ohm resisters, but you can try any 1:2 ratio resister you have around.   Note that the Reset pin does not need this, as the Amtel Reset pin is torrential to voltages 2x of Vcc!  (Which is also why there is no clipping diode on the reset circuits).

Once I had the voltages right, I fired up the Arduino ICE programming environment and:
  1. From the Menu bar, select Tools/Board and make sure it says Arduino Uno (or what matches the host board you are using)
  2. Press the Open Sketch button, scroll down and find the ArduinoISP.  Select that to upload the ISP firmware into the host board (the Uno in my case).
  3. Go back to Tools/Board, and this time select: "Arduino Pro or Pro Mini (3.3v, 8Mhz) w/ATmega 328"
  4. Select Tools/Programmer and make sure "Arduino as ISP' is checked
  5. Now, do Tools/Burn Bootloader

And that should be it!   From now on you will need to make sure you have the correct board selected (Tools/Board) as you move back and forth between the 3.3v environment use don the regulator and the 5v Uno boards.   But at this point the Arduino boot loader should in the regulators CPU, and you should be able to load sketches.  I of course always try BLINK first (adjust the port number to 8 to match where the LED is on the regulator board).

So, there you have it.  3.3v Arduino bootloader all programmed and ready to go!  I just need to finish soldering up the PCBs, and then start uploading the new firmware and testing things out.  Given we are in port though perhaps the end of February, my 'test bed' is a little unavailable.   But I expect after the 1st of the year I can start make some small runs here at Dock.

And a side note:  When I 1st tried to do the above, it did not work.  Reason being I had already loaded the Amtel CPUs with the normal (5v) bootloader, and the Brown Out fuse prevented the CPU from operating on 3.3v.  My workaround was to power the regulator from 5v vs. 3.3v.  That allowed me to load the bootloader and now all works well as 3.3v    If you are using Fresh CPUs, you you should not have this issue though.

Sunday, October 27, 2013

BOM update - V0.1.1 design

This morning I posted up a parts list and Mouser BOM  (See Parts list tab above).   And there is some good news / bad news from a cost standpoint!

Good news is:  Basic component cost for the regulator came down a whopping $13.22 (to $29.72) through a combination of the simplified design and some more careful scrubbing of components selected.  The bad news is changing from the low-cost HC-05 Bluetooth module to the RN-41 eat up all that savings, and the new combined component costs (including optional Bluetooth module) now comes to $54.67, a $6 increase...

So why again did I switch out the Bluetooth module?  Two reasons:   First and foremost is the HC-05 has no FCC certification.  And given it also has no shielding there is a great probability this things is quit noisy from an EMI standpoint.   The RN-41 not only has the FCC cert (plus other countries as well), it also has the needed shielding.  

And there is another significant benefit of the RN-41, range.  The RN-41 is a full-power Bluetooth with a range of several 100 feet, which the HC-05 is a low-power class of Bluetooth modules, with a best range of maybe 100'.   Put it into a shielded engine room and that might get even shorter...  If you do not need the extra range you can swap-out for the RN-42, it too has the FCC cert, is pin and firmware compatible, but as a short-range lower power device is $7 lower in cost...

I have real mixed feeling over the Bluetooth module.  Perhaps once I finalize the design I will make up two PCBs - one for each - modify the firmware with some #defines and let you all decide which way you want to go.  

Off course, a 3rd option is:  Just built the board as it is today, but without the RN bluetooth.  Order the HC-05 from Ebay and use jumper wires to connect it via the service port!

Saturday, October 26, 2013

3.3v it is, and ordered new batch of PCBs

I looked at what was needed to move the Arduino 'cpu' from 5v to 3.3v, and it looks doable.  the CPU certainly support 3.3v, a bit at a lower clock frequency, but there are some futzing that is needed in the boot-loader that I still need to research.   In any case - to get things moving along I revised the hardware to a pure 3.3v only design and orders PCBs today.   As soon as the Mouser BOM website starts cooperating,  I will place parts order as well.

There were a few considerations in moving the 3.3v, mainly software.  It seems the Arduino boot-loader enables a 'brownout' detection in the Amtel CPU and sets it trigger for something like 3.8v, that will need to be adjusted.  A bigger change was the need to reduce the CPU clock speed from 16Mhz to 8Mhz. - with the concern being will the firmware still work?   I did some timing tests.  It takes around 1-2mS for the current firmware to complete a 'cycle', and there is about 6mS per cycle of headroom.   Meaning I can add another 6mS of code (which I did via dummy delay(1); called) in the mainloop and things will still work well.   So, with a 6:1 buffer I feel comfortable cutting down to a 3:1 when running at 8Mhz.

While I was at it, I added a proper ISPC connector, in case I need to re-flash the boot-loader after soldering in the CPUs  (or worst case, in case I abandon the Arduino environment all together and go with a native Amtel development environment).  Needed to scrub all the resister dividers, as well as change up the Zeners.

I have already posted v0.1.1. of the schematics and PCB layout (See tabs above).  Will post a BOM in the next day or so, as soon as Mouser starts cooperating.  And I will go back in an update the Hardware Overview to reflect the new 3.3v only system.

Thursday, October 24, 2013

Posted V0.1.0 of schematic - and Where should we measure current?

Today I posted a revised version of the regulators schematic, and also completed filling in the Hardware Overview.  Some major changes between v0.0.x and v0.0.1.x of the design:

  • Usage of Liner regulators vs. switching regulators for  +5v
  • Elimination of the DUAL port
  • Update of the FET driver chip

For more complete descsiption of the hardware, see the Hardware Overview tab above (or

And to download a .pdf of the whole schematic, click on the Schematic tab above. (

Where to Measure Current?

A comment on elimination of the Dual port, as that is not really talked about anywhere else.  A group of users I am looking at for this design is Marine use, where is is common to have two engines with alternators charging a common house battery.  Given a key goal of this project is to better manage the battery's state of charge - deciding when to exit Absorption phase by MEASURING its state of charge (as indicated by its Acceptance Amps) as opposed to GUESSING its state of charge (by using a length of time), there is the need to know how many Amps are actually going into the Battery.  In a dual engine setup the amounts of amps being delivered would be the sum of each engine.   So my thinking was by measuring the Alternator Amps of each alternator, and sharing that information, the correct decisions would be made.

During trial runs it occurred to me there can easily be even more charging sources.  Generators, Solar Panels, etc..  Combine this with some amps being diverted to directly power house loads we get a situation where the Dual port was a kind of partial solution.  The real solution is:  measure battery the amps AT THE BATTERY, not the Alternator...    So I removed the Dual port and will document Best Practice is to measure the Amps via a whole-battery shunt.   

However, IF one still wants to measure Alternator production (just because they are curious, or perhaps they are using the advanced configuration options to limit the Alternator output - say by managing Watts load for a small engine DC generator), then an Acceptable deployment will be to make some guess on other charging sources and typical house loads.  Down the road there is the ability to add external communications into the regulator via either the serial port (ASCII strings), or an I2C adapter board, to receive information from say an external battery monitor, or even add a 2nd Amp Shunt port...    Will think on this problem a bit more, but for now there is sufficient flexibility in the regulator as-is to accommodate any installation approach.

Monday, September 16, 2013

Hardware update

Debugging the hardware I have IDed several areas I am not happy with.  In fact, overall I am not happy with almost the whole design and am l looking to improve each subsection.  Here is a rundown of the changes I am looking at:

Changed  out Zener diodes in overvoltage protection:  The zeners just did not work for any input which has a noticeable impedance, as the Zeners themselves are incredibly leaky and caused massive signal changes – even well before their knee.  This was most noticeable on the NTC problems.  With its  5-10K impedance the Zeners rendered this circuit unusable.  So, I have gone back to the tried-but-true two Diode approach.

Changed from Switching to Liner voltage regulator:  A key challenge in  being able to support the wide range of battery voltage – from 12v to 48v systems – is handling this wide dynamic range without hardware changes.   The expected actually battery voltage can range from 8v to over 68v and with this massive voltage range traditional Liner power supplies can have a large amount of heat disputation (upwards of 3Watts).  So I tried a Switcher – but it just is not working.   It is missing its design specs, frequency of operation, ripple, etc.   The datasheet cautions that ‘fine tuning’ of components is often needed to dial things in..   Well, I just do not have the experience to do that.   And despite the promise of 48v being ‘normal’ in automobiles (and hence there being a wide range of ICs available to support these higher voltages), we are just not there yet.  Hence the picking is slim when it comes to 48v tolerant ICs (All ICs - not just voltage regulators!).   In the end I am going back to the brute-force linear regulator.  I will use a simple zener/emitter-follower transistor for the pre-regulator to handle the bulk of power dissipation in 48v deployments finishing up with a proven reliable LM7805 to polish things off.

Changed FET driver chip:  This support for 12v to 48v systems also has been a challenge in the FET circuit.  Specifically the driver.  I found the LT1910 chip which solved a TON of issues (chiefly being able to self-generator boost voltage during 100% duty cycle) and it has worked very very well.  However, it will not withstand voltages that might occur on 48v systems.  Specifically while equalizing, and more so, specifically while equalizing in a cold temperatures where the battery voltage needs to be higher…  I wrestled with this one for a long time, as the LT1910 is such a nice solution, and it worked for all but a small corner case…  And in fact, it might have been just fine, only overrating above its max rated voltage by say 5-7v or so…    But. . . . .  it bothered me . . . .  so I have changed this design.  I could not find another fully integrated FET driver like the LT1910, and instead selected a common high voltage driver chip (IRS2127 in this case, good for up to 500v - should be sufficient!).  That left me with the challenge of how to support boost voltage generation with high duty cycle, specially:  How to keep the FETs on while at 100% / full field…   I thought about just limit field drive to say a 98% max, and that might have worked.  But in the end I added an external voltage doubler to provide boost voltage.  There are app notes about doing this using 555’s for this, with extra costs.  In the end I thing I will be able to use a 2nd PWM pin from the Amtel CPU to drive the voltage doubler.  Will see how this all works out….

Bluetooth module supplier changed:  The low cost HC-05 Bluetooth module I have been using to provide simple wireless connection has been working well, and at $5 how can one beat it!   Well, in fact I am a bit concerned that it does not carry an FCC certification.  And in looking at Bluetooth devices that do I can clearly see extra shielding.  Perhaps it is not an issue, perhaps one does not worry about FCC cert.  But, I am changing the module to one that provides the same Serial emulation functionality (SPP), has the extra shielding, and carries an FCC cert (along with other countries as well) the Roving Networks RN-41.  It is available at Mouser, but sadly costs $25. . . .  This one I am a bit troubled by, because I think there is no really engineering risk here – it is a ‘government’ thing.   IF by chance I make up a few of these to offer to others, in kit, or even some level of assembled, I worry about the FCC thing..   So – Costs Up $20 for that one.  There is one advantage though, the RN-41 is higher power and likely will keep a stable connection for over 50’ or so, while the HC-05 was a lower-power Bluetooth device designed for a few feet.   AND if one wants to lower costs, the same low-power level device is available from Roving networks as the RN-42, it is pin and software compatible, and its costs is around $15.  So only $10 up..

Upgrading the Voltage sensor chip:   Again, driven by the wide range needed to cover and the desire to not have any assembly (ala, part value selection) options to cover that.  I tried a switchable pre-scaling voltage divider in front of the INA220, but that proved to be problematic – again, and impedance thing.  In order to keep the power dissipation reasonable in the resister divider in a 48v system I needed to use somewhat high resister values, but that combined with the input impedance of the INA220 did not produce a stable design.   TI offers an upgraded part, the INA226 which not only has improved input impedance, but also a wider voltage tolerance (it can handle 24v systems directly), AND greater resolution!   So, I am going to upgrade to that part, and place a fixed voltage diver on the input to cover the range needed for 48v systems.  No more switching in/out, it will just always be there.  I will lose some precision with the pre-scaling, but will pick it back up with the improved resolution of the INA-226.  And it looks like the expected impedance input range of the INA-226 will keep total calibration errors under 0.5%.  I feel this whole thing is a bit of a compromise between precision and flexibility to cover the wide deployment range w/o hardware changes.  I looked into other approaches, ala a simple Op-amp to buffer the input impedance, but again picking are slim to cover the wide range needed (actually, I did find a jus the part I needed – the LM143.   But that simple, low cost device was taken off the market in the late 90’s.   Sigh..).  Did find native 48v sample chips, but they had too low of resolution, and insufficient speed to meet the 100mS cycle time goals.

Current Measurement:  Another benefit of upgrading the sensor chip to the INA-226 is its ability to handle voltages sufficient to allow the Current Shunt to be placed either High or Low on 12v AND 24v systems.   Giving greater deployment flexibility to those systems.  36v and 48v systems will still need to place the shunt low (in the ground) to prevent exceeding (and damaging) the INA-226.  In order to place shunts High on 36/48v systems, a simple external pre-scalar will be needed (ala, and AD8217).  I had thought to imbed the pre-scalar directly into the design, but that has the side effect of locking ALL deployments into high-shunt deployments.   So, for now, am going to simplify things with this slight restriction:  36v/48v systems must use a shunt placed low or use an external pre-scalar on a high-shunt.  As the world progresses, perhaps a new INA-22x will come out that can directly handle 48v voltages. 

Removed the Dual-sync port:  With the insight of where the shunt SHOULD be placed (or, perhaps more polite to say COULD be placed) it became clear that a dial-sync capability was not really needed.  By placing the shunt at the battery that situation is handled, and even more:  Things like a 3rd charging source (ala Solar panels) and house loads are all covered.   None of that would have been addressed with the simple dual-sync port, but placing the shunt at the battery does.   So:  With a better engineered solution available, still retaining the flexibility to place the shunt on the alternator if one wishes (and perhaps making some educated guesses at other charging sources / house loads) I have removed the dual sync logic and code.  It seemed like a needed feature, but in the end it was an incomplete solution.  There is a better one, and the better one is FREE!

Removed CAT-5 connector block:  And with these  simplifications, I can remove the stacked CAT-5 block; going back to header pins for the Service port and using simple screw connectors for the NTC temperature probes.  It not only lowers costs some, but also greatly increases the flexibility of sourcing temperature probes – several are readily available from EBay, and one could also use ones from Morning Star or even Balmar.  All made up for you!  (Will need to confirm the nominal resistance of these as being 10K, and if not you will need to change the source code #define calibration values).

OK, that is it.  I will be looking to fab up new PCBs this October, and perhaps do some assemble in November when we return to port for the winter.  Until then, I will continue to refine the firmware – currently addressing details around load-dumping, and think I about have it nailed.

Thursday, September 12, 2013

Looking at Load Dump

Load Dump is a condition when a large DC load is suddenly removed.  A common example aboard Viking Star is when the Dryer is running, it consumes 1200watts to power the heating element.  This is supplied via the inverter, and it can consume upwards of 90-100Amps to meet the need.  But when all of a sudden the Dryer decides it is at temperature, it will turn off the heating element - with a very very sudden drop in a 90A+ load:   a Load Dump.

While the heating element is operating, the Alternator will work it hardest to meet the needs of the
inverter with the remaining energy being sent to the battery for its recharging needs.  However, once that Inverter load is suddenly removed, the Alternator will take some time to spool down - and there is a risk of overvolting the battery if not done quick enough.   BTW:  In the Automobile world, there are many recognized transient situations.  Most of which are described in the graph to the right.  And yes, I am using Load Dump a little different - removal of  large load, as opposed to disconnecting the battery . . . .

The Source code is configured to update the Alternator field drive every 100mS, or 10 times a second.   And any overvoltage situation takes absolute precedence in reducing the PWM drive.  With the DC generator, and its smallish 135A alternator, the normal PID logic was able to deal with any load-dump situations.  However, with using our Mains alternator (a 270A Leece Neville monster)  I found the PID was not able to respond quickly enough.  Example, on one run I noted a max Overvoltage of 450mV, almost half a volt!

So I added in some Load Dump code:  upon detecting as little as 40mV overvoltage, we now cut down the PWM by 50%. 80mV causes another 50% pull back, and 120mV over target just turns off the Alternator.  a Primary goal is to protect the Battery.  Using this approach I was able to reduce the maximum overvoltage to 80mV.  (As a side:  the regulator normally regulates within a 25mV range around the charge profile target).

After looking at the data dumps from todays trial run, I think I can do better - by looking not only at the absolute voltage to detect a Load Dump, but by also looking at the Rate of Change of voltage.  If I see a massive Rate of Change, and we are close to the target Charge Profile voltage, then we also trigger a Load Dump pull back of 50%.

Thursday, September 5, 2013

Continued progress

Over the past several weeks I have continued to test out the Arduino based Alternator Regulator.  It has gotten to the point where I now am using it as the primary regulator and the source code is getting rather stable.  But I continue to find problems with the hardware design, today’s admission is around the high voltage switching regulator - it is just not stable.

It is operating outside its design frequency, has very poor response to transients, and is present as much as a 100mV ripple in the +5!!!   All of this is enough to zero out the Bluetooth, and I am sure lots of other things are impacted.

So, in the redesign I will be going back to a liner regulator.  Either a standard LDO with a pre-scaling transistor, or something like the TL783 form TI.   At issue here is when running with a 48v system, there will be upwards of 3w of heat displaced with a linear regulator!

But, it will be stable....  

And I have been thinking more on application - specifically the placement of the Amp shunt.  IF we are really looking to understand the condition around the battery, then I am thinking it makes more sense to place the Shunt at the BATTERY, as opposed to at the Alternator.   Doing so would allow us to know the true state of the battery, independent (and accounting for) and house loads, and/or other charging sources.  

It would however preclude managing closely the load the Alternator places on the engine.

But I think there is sufficient flexibility in the firmware to allow the user to use it for either application:   Better regulation of large alternators on a house battery, as well as doing things like limiting the load placed on an engine if one wants.

All depends on how it is hooked up and configured.

So, will continue to work through issues with the firmware and ge ready to do a hardware redesign this fall.   One open question I have is:   Should I continue to use as many Through Hole devices as I can, or give in and start moving to SMT for things like blocking Diodes, resisters, etc...


Saturday, August 24, 2013

Alive with basic functionality!

Today I posted source code version v0.0.3 on the links above, this represents a usable source stream on actual hardware.  Over the past few weeks I have been fine-tuning the PID factors, and debugging the auto-size determination.   With today's release I think the core and basic functionality works:

  • Regulator ramps up slowly
  • Will auto-size, including re-triggering when the RPMS have changed substantially
  • Regulators to Voltage, Amp, and/or Watts as configured.
  • AND - key here:  Exits Acceptance phase when the battery is actually  FULL as indicated by Amps, not time...

ASCII communications is working well, I added a "RTS;" string to indicate the regulator is resetting either due to a recoverable fault, or in response to a change to the regulator EEPROM saved configurations.

Two areas not tested / fully debugged:
  • Dual regulator synchronization and communication.
  • Temperature probes - I am not happy with the assemble method for these NTC probes.
  • Bluetooth - More thought need to be put into the initialization of this device.

I also am not happy with some of the hardware design elements, specifically the following subsections will need to be looked at more closely:
  1. Use of Zener Diodes for clamping input voltages (as opposed to discrete Diodes).  They show an impedance that impacts high impedance lines (ala the NTC probes)
  2. VBat pre-scaler - Also an impedance issue on both the INA-220's and the raw Atmel A/D. 
  3. Amps pre-scaler - Already noted, the INA-220's have a max voltage limit of 28v, so will need to use gnd based shunt, or do some pre-conditioning for allow for a high amp shunt.
  4. Switching power regulator.  I am getting issues with I2C noise and faults whenever I start the main engine, and am thinking it might be related noise coming in via the Enable line.
  5. FET Driver;  The current chip is working well, but will be a bit stressed when doing Equalization on 48v systems.  

I have ideas for each of these:
  1. Return to clamping diodes instead of zeners - might have to use SMT parts due to PCB space though . . . 
  2. There is an improved version of the INA220 called an INA226 with higher Vmax and better resolution on sampling.  I MIGHT be able to get away using resistor dividers using it, but in worst case will need to add perhaps an op-amp pre-scaler.  In any case, I am thinking of abandoning the switching ckt for the prescaler, as well as the RAW A/D sampling and just go with a fixed ckt to cover the whole voltage range.
  3. Already looking at adding an AD8217 as a level shifter for the Amps shunt.
  4. Need to scope the power-supply ckt, but one improvement idea I have is to use the Enable pin as a true Enable driving say a FET and relocate the LM5008's power source to the Alternator Alt+ line.  I figure with the heavy cables this will be much cleaner - and I can apply effective filtering to the Enable line driving the FET much easier and at lower cost than trying to filter out Enable based noise feeding the switching supply directly.
  5. Will look at other FET drivers - am going to have to break down and add an external charge pump though :-(
I also need to consider to keep the largely through-hole PCB design, or give up and switch over the SMT parts.  I am finding the Through-hole parts harder to locate, some parts not even available anymore, and at times more costly...  Have been looking at toaster-over and electric fry-pan approaches to reflowing small batch SMT boards :-)

OK, will likely lose internet connection for a few weeks - but this code-drop will give some hope to those who case!

Sunday, July 28, 2013

Just a quick note

Over the past week I installed the regulator aboard Viking Star, and have made three runs.  Two long and one with lots of starts / stops.   I have been working through issues, but still have a few to go before I can declare it has a basic level of functionality.  I am facing two right now:

  1. During startup, when I release the main engine starter button, the regulator faults  with INA-220 I2C read errors.  They are random in nature, but directly associated with the releasing of the starting button.
  2. When running with the Arduino regulator, I seem to under-read the battery voltage.  When I switch back to the standard fixed voltage regulator, the Arduino regulator correctly reports the voltage.

Both of these are making me think there might be something with how I have installed the regulator.  It is complicated in that I left the original regulator in place so I can switch back and forth easily.  But I am wondering if there is a ground loop that is causing coupling of the starter as well as loading on the line during running (causing a voltage drop, and hence under-reading of the battery voltage).   I just need to get down in the engine room with some meters and/or O-Scope, but have been working instead on the DC Generator / Watermaker as we started using the watermaker for the 1st time after installing the integrated controller / regulator...

Hopefully will get some time next week to make  progress.

ps:  some may have noticed I snuck in rev 0.0.2 of the source code, and its associated .wrd file describing the ASCII interface.  I did that to support the person who is working on a GUI for smart phones and such.  Figured it would be better for him to use the latest ASCII syntax while developing, and the code will still work in a kind of 'demo mode' on a standard Arduino as long as the "#define TESTING"  is enabled.

Friday, July 19, 2013

1st unit ready to test out!

It has been very quiet on this blog for some time now, mostly as a result of Kristi and I taking a trip back to Minnesota for her folks 60th anniversary, combined with boat travel to and from the Seattle area.  But we are back in Canada now, and I have just about finished up with the 1st build.

Top view.
Field connectors are the large ones on the top left, bottom left connects
battery voltage sensing, Alternator stator, as well as engine 'enable' line.
Top right has Feature in/out connectors and Alternator shunt, while
the bottom right has the block of RJ-45 connectors for temp probes,
service probe, and synchronization cable for twin engine install.

Bluetooth module is top center.

Bottom view.   Field Driver FETs (right hand side) will mount face down onto
the heatsink, with relief holes in the PCB to gain access to the mounting screws.
Need to use a bit more PCB cleaner to get rid of the remaining residue.

Today I did some mocking up of the assembly, just to see what parts fit and what I was missing.  Mostly it looks good, but I will need to get taller standoffs to raise the ‘cover’ up some more (Cover not shown here).

All mounted.  I need to purchase taller standoffs to support a small plastic cover
which will go over the whole unit giving it a nicer finished look, and some additional
protection beyond the conformal coating.

Also need to print up and add the stick-on labels describing the DIP switch and connectors.

A few issues I have found:  There was one design error in the FET driver, the 15v clipping zener needed to go between G and S, not G and GND.  I relocated the Zener to the back of the PCB and tacked it on.   I also am finding the NTC daughter boards a real PITA to solder up.  Partly due to their small size, partly due to I made the wire through holes a little small, and partly due to the Chinese sourced CAT-5 cables I purchased, which seem to be made from Aluminum – not copper…  Digging through our parts stash I found some unused Magnum remote cables and use them.

REALLY small PCB there, that is a CAT-5 cable coming in from the left...

And here is a photo of the 'Service Cable'.  This is used in conjunction with the Arduino programming environment to upload the Firmware to the regulator.  It can also be used to send/receive ASCII commands to existing firmware to program some of the configurable features, for those who do not wish to mess with 'C' programming, nor the Bluetooth interface:
Optional Service Cable.

My next step is to complete the mounting and then install it on Viking Star.  I am very interested to see how some of the new algorithms work (specifically the auto-alternator size determination).   I figure I will also want to wire up a remote ‘kill switch’, just in case things go really bad.  But as with the integrated Engine control / regulator project, I will be making several test runs, logging data, and making adjustments to the source.   I am not worried about the core regulator functions, it is the new stuff placed around that that I need to check out.

Friday, June 28, 2013

Charge profiles - Need help in setting the Default ones...

A new feature of the standalone regulator is built in charge profiles selectable via the DIP switches.  There are 8 positions which can be chosen.  Each charge profiles contains parameters for a series of 'stages' with items such as :
  • Limits to Battery Voltage
  • Limits to Alternator Current
  • Exit criteria to allow moving to next stage based on Time, Current, or perhaps battery voltage.
  • Battery charastics, specifically Temperature compensation
Below is what I currently have for a 'place holder', and am open to input on the profiles as to be honest - mode are largely blank...  So, is there perhaps another battery that should be added?  (ala LiPro).  Should one or two of the spaces be held over for 'future expansion' in the default profiles?  Send me Emails (or post comments here) I would kind of like to have a 'standard' set of profiles and keep them for all revisions to the source, as I really do not want to get into a massive mixture of different source configurations in the field...

Normalized Charge profiles:

Before getting to the actual profiles, we need to understand how the regulator auto-adjusted for different battery voltages.  (12, 24, 36, or 48v).  To avoid making 8 profiles for each battery voltage, I decided to make all profiles  'normalized' to a representative 12v system small (500Ah) battery.   Then at startup the regulator will make two adjustments to the working charge profile depending on:
  1. Sensed Battery voltage.
  2. User selected 'battery capacity size' on the DIP switches.

The sensed battery voltage is applied to target Voltages (increasing them) while the Battery Capacity Size DIP switches are used to increase target Amps.

Example - currently the 1st charge profile entry for  Bulk/Absorption phase has the target VBat defined as 14.1v, and the 'exit' criteria (for exiting Absorption phase when the battery is truly fully charged)  is at 10a  (2% of the 500Ah battery capacity).  Two examples:  First a 12v large battery system then  a 48v mid-sized battery:

12v 1,600Ah battery:
  • Auto-sensing system voltage = 12v, multiplier is 1x.
  • User selected DIP switches  = On-On (1,500Ah or greater battery)
The regulator will adjust the run-time charge profiles as:
  • Volts  * 1x  - based on sensed battery voltage
  • Amps * 4x  - based on user selected DIP switch

So, the 14.1v / 10A  becomes -->  14.1v, 40A  Meaning the regulator will drive BULK mode until the battery voltage reaches 14.1v, then switch to ACCEPT mode - holding VBat at 14.1v until the measured current drops below 40A at which time it will move to the next phase (float in the case).

48v,  800Ah battery bank
  • Auto-sensing system voltage =  48v, multiplier is 4x.
  • User selected DIP switches  = Off-On (500Ah - 1,000Ah battery)
The regulator will adjust the run-time charge profiles as:
  • Volts  * 4x  - based on sensed battery voltage
  • Amps * 2x  - based on user selected DIP switch

So, the 14.1v / 10A  becomes -->  56.4v, 20A  Meaning the regulator will drive BULK mode until the battery voltage reaches 56.4v, then switch to ACCEPT mode - holding VBat at 56.4v until the measured current drops below 20A at which time it will move to the next phase (float in the case).

Charge Profile States:

Each charge profile has the following basic 'stages' or modes:
  • Ramping   - Initial state where the alternator is brought online slowly
  • Bulk         - Regulator will be in Bulk mode until the battery voltage reaches the Accept voltage limit.  During Bulk phase, Amps are limited by the capability of the alternator or optionally a defined max Amps.
  • Acceptance - Voltage is regulated to the defined limit.  Will stay in Accept  until Amps drops below the defined value (indicating the battery is fully charges), or a defined time limit is exceeded.
  • Float           - After Acceptance, this is a 'keeper' stage where the volts are regulated to a lower setting.

Each of these stages or modes have criteria for regulation of Battery Voltage and Alternator Amps, they also have exit criteria (exiting that mode and moving on to the next one) based on time, volts and/or amps being delivered.   There are also some additional stages:
  • Over Charge  - Between Acceptance and Float to give a final 'kick' to some battery types
  • Post Float      - Alternator is turned off letting the battery rest rest
  • Equalize         - Selected overcharging to rebalance the batteries

Charge Profiles:

Each Charge Profile (there are 8 of them, selectable via the DIP switches) has a series of entries to allow for targets and exit criteria, as defined by this structure:  You might find it easier to copy and paste this structure into a text editor of your own, to better be able to read the long lines.  Use a fixed-space font (e.g. Courier) to preserve tabbing and alignment.

//----- This structure defines a 'profile' for battery charging.  Each stage consist of 'modes', primarily:  Bulk, Acceptance, 
// Overcharge, and Float.  Each mode has a max voltage set point, and criteria for exiting that phase (Exceeding a time limit, 
// or Amps dropping below a given value).  Of special note is the entry Float and Post Float, which have additional criteria 
// resuming charging.

ACPT_BAT_V_SETPOINT;            // Set point for Ramp, Bulk and Acceptance battery voltage.  

                                // Alternator will transition from BULK mode into Accept Mode when this voltage is reached, and then start the Accept Duration counter.
EXIT_ACPT_DURATION;             // Stay in Accept mode no longer then duration in Hours
EXIT_ACPT_AMPS;                 // If Amps being delivered falls to this level or below, exit Accept mode and go to next (Overcharge)
                                //     Set ExitAcptAmps = 0 to disable Amps based transition and only rely on timeout duration.

                                // Overcharge mode is sometimes used with AGM batteries and occurs between Acceptance and Float phase.  

OC_BAT_V_SETPOINT;              //    Set point for Over Charge battery voltage (Set this = 0 to disable)
EXIT_OC_DURATION;               //    Over Charge mode duration in Hours.  (Set this = 0 will also disable Over Charge step.)
EXIT_OC_AMPS;                   // If Amps being delivered falls to this level or below, system will exit Overcharge mode and go to Float
                                //     Set this = 0 to disable Amps based transition and only rely on timeout duration.

FLOAT_BAT_V_SETPOINT;           // Set point for Float battery voltage

EXIT_FLOAT_DURATION;            // Alternator will stay in Float mode this many hours before entering Post-Float (no charging) mode.  Set = 0 disable transition to Post-float mode.
FLOAT_TO_BULK_AMPS;             // If Amps being delivered exceeds this value, we will assume a LARGE load has been placed on the battery and we need to re-enter
                                // BULK phase.   Set this = 0 to disable re-entering BULK phase feature

EXIT_PF_DURATION;               // Only stay in Post_float mode (no charging) this amount of time.  Set = 0 to disable times based Post-float exiting and exit only on Voltage.

PF_TO_FLOAT_VOLTS;              // If during Post-Float mode VBat drops below this voltage, re-enter FLOAT mode.   
                                // Set = 0.0 to disable exit post post-float mode reverting to FLOAT Charge mode based on voltage.
                                // Config note:  If you configure the system to enter post-float mode from float-mode (by setting the time value EXIT_FLOAT_DURATION), AND you
                                // set both EXIT_PT_DURATION and PF_TO_FLOAT_VOLTS = 0, the regulator will in effect turn off the alternator once charging is completed
                                // and not restart a charge cycle until powered down and up again.  This can be useful if you truly want a one-time only charge.
                                // You could also config the FEATURE-OUT port to indicate the complete charge cycle has finished, to say power-off the driving engine?

EQUAL_BAT_V_SETPOINT;           // If Equalize mode is selected, this is the target voltage.  Set = 0 to prevent user from entering Equalization mode.

EQUAL_BAT_A_SETPOINT;           // During equalization, system will limit Amps to this value.   Set = 0 will also prevent user from entering Equalization mode.
EXIT_EQUAL_DURATION;            // Regulator will not stay in Equalization any longer then this (in Hours).  If set = 0, then Equalization mode will be disabled.
EXIT_EQUAL_AMPS;                // If Amps fall below this value during Equalization, exit equalization.     Set = 0 to disable exit by Amps and use only time.

BAT_TEMP_1F_COMP;               // Battery Temperature is compensated by this factor for every 1F temp change.  Note this is based off of BAT_TEMP_NOMINAL (77f)

MIN_TEMP_COMP_LIMIT;            // If battery temperature falls below this value (in deg-F), cap temp compensation voltage rise to prevent overvoltage in very very cold places.
BAT_MAX_CHARGE_TEMP;            // If Battery exceeds this temp (in deg-f), stop charging and force into Float Mode to protect it from over-temperature damage.

Do I need some additional parameters?  e.g., should there be a Float-to-Bulk voltage set point in addition to the Amps value?

Charge Profile Entries:

And here is the 8 entry table that I have for the current 'charge profiles':  Take note that there are a LOT of blanks, for example Post Float and OverCharge are currently disabled for all entries.  And the Temp Compensation is all set to the FLA type battery, which I suspect is not the right answer.   So - -   If you have knowledge on this area, please send me comments to:  Thanks!

   Bulk/Accpt                Overcharge              Float                 Post Float            Equalization                Temp Comp   
{14.1v, 4.5hr, 10a           0.0v, 0hr, 0a          13.1v, 0hr, 0a            0hr, 0.0v,           0.0v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Default (safe) profile.
{14.6v, 4.5hr, 10a           0.0v, 0hr, 0a          13.4v, 0hr, 0a            0hr, 0.0v,         15.5v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Standard FLA
{14.1v, 4.5hr, 10a           0.0v, 0hr, 0a          13.6v, 0hr, 0a            0hr, 0.0v,         13.6v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Standard Gell Cell
{14.3v, 4.5hr, 10a           0.0v, 0hr, 0a          13.1v, 0hr, 0a            0hr, 0.0v,         15.5v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Standard AGM (1)
{14.5v, 4.5hr, 10a           0.0v, 0hr, 0a          13.5v, 0hr, 0a            0hr, 0.0v,         14.5v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Standard AGM (2)
{14.1v, 4.5hr, 10a           0.0v, 0hr, 0a          13.1v, 0hr, 0a            0hr, 0.0v,           0.0v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Reserved for future use??
{14.1v, 4.5hr, 10a           0.0v, 0hr, 0a          13.1v, 0hr, 0a            0hr, 0.0v,           0.0v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}, // Custom #1 - Users Entry
{14.1v, 4.5hr, 10a           0.0v, 0hr, 0a          13.1v, 0hr, 0a            0hr, 0.0v,           0.0v, 0a, 0hr, 0a,         0.028*6/10, 15f, 125f}  // Custom #2 - Users Entry

Wednesday, June 26, 2013

Working through Bring Up

Have been making good progress on the bring-up, with many of the subsections tested.  So far have the hardware almost 100% 'spot checked' for no-smoke and some level of function.  Am now working through integration of hardware and software, and doing more detailed sub-section testing.

Here is a photo of the 1st board:

Notice I am using a Uno development board to provide DC power as well as communication to and from the regulator.  All those Tombstone resistors provide handy test points!

Wednesday, June 19, 2013

PCB and Parts have arrived!

Yesterday we stopped by our maildrop here in Friday Harbor and picked up a pile of parts!   PCBs look very Royle, being Purple with gold finish.

I am intending to mount the PCB in the open space of the HeatSink and place a nice looking plastic cover over it.  When combined with the PCB conformal coating, should give a well protected unit.  That small PCB the pencil is point to is actually two PCBs that will be used to hold the NTC temperature sensors and allow for soldering to CAT-5 cables.  This is a tight board, mostly because I still retained the use of through-hole parts whenever possible.  But even so, there are three SMT chips on this, including the dreaded INA-220!

Friday, June 14, 2013

Regulator Connection

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- should 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).

V0.0.0 connector location  (Original  design - no longer supported)

v0.1.x connector locations (Latest/ current through-hole design)

v0.3.x connector locations (CAN - SMT design)

Tuesday, June 11, 2013

First cut of draft Source for standalone regulator posted

Today I placed up the 1st cut of Source Code for the stand-alone regulator project.  version 0.0.1

This version is mostly complete, but has only had limited testing on a stand-alone Arduino UNO card - there is no regulator hardware available yet.  The source can be found under the SOURCE tab above, looking in the standalone regulator directory.

I also posted a .wrd file that does some initial documentation of the regulator, and in particular the ASCII strings in and out to be used to monitor status as well as optionally change configuration parameters.  Over time this document will be expanded.

Tuesday, May 28, 2013

Parts ordered for Stand-alone Arduino based Alternator Regulator

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:

And the schematic can be found in the Schematic Link above.  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:
  • Found a simplified FET boost-driver (LT1910) that has a built in Booth PS.  It should allow N-Channel FETs to be used from 12v to 48v on P or N type alternators w/o any hardware changes.  Will be interested to see how it works!
  • Have eliminated the hardware remote LCD panel, the unit will just start when power is applied and optionally communicate status via Bluetooth. (Or the built in Serial port)
  • Have on board DIP switch and LED for stand-alone configuration and operation.  Just select the battery type, size, and some other special features and connect it up.  Nothing else is needed to get it to work in its basic function.
  • Sync port to coordinate functions between two regulators charging the same battery, ala in a twin engine boat.  Mostly this is to share Amps produced, but as the firmware progresses, might find other needs for this coordination.

    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.

    Thursday, May 23, 2013

    Posted draft Stand Alone Alternator Regulator Schematics

    This morning I placed the draft schematics for the stand-alone (alternator only) version of this project to the Schematics tab above (click on the Stand Alone Regulator' folder.

    This regulator will be based on the controller project and share a lot of the code, but will not include any of the Engine control functions.  Key features of this stand-alone regulator are:

    • Active management of Alternator for both Volts and Amps (Watts)
    • Ability to use Amps as a way to judge when a battery is fully charged, as opposed to pre-defined time value (this is the key feature)
    • Paralleling ability for coordination between two regulators in a twin-engine setup (ala, marine use)
    • DIP switches to be used to select a series of pre-configured charging profiles.
    • Fully support of P or N type alternators from 12v to 48v

    It also includes a Bluetooth module, for future communication to computers, phones, etc. for status updates as well as finer control of the configuration.

    As always, it is fully programmable via a Service connector, and posted in the Public Domain.

    One major change I am excited about is the Field driver - I located a self-powered Boost driver (LT1910) that looks like it will allow for a fully configurable P or N type alternator support from 12v to 48v without any hardware changes.  Will be going to FAB in a few weeks, if anyone is interested in this let me know.