Saturday, August 15, 2015

Power Brakes, kind-of....

New Brake Sensor

The 500 psi brake sensor worked well.  I was able to replace an existing 3/16 union with a T brass connector.  After adding a new value to the digital dash, Can Bus enabled Arduino to show the value the brake sensor A/D in the Kelly KHB 72701 controller, I realized the Mini's brake pressure goes up to about 300 psi.  The 500 psi sensor under heavy braking would generate about 2.1 volts (~110 on a 0-255 scale).  This equates to about 220 psi.  A 300 psi (0V-5V) sensor is available, so after installing this narrower scale sensor, the A/D is now reporting from 25-200 (on the 8 bit scale).  25 corresponds exactly to 0.5V which is the sensor's 0 psi value.  I could only find one reference to the actual PSI ratings on the Classic Mini brake system.  This site reports an upgraded brake system operates up to 330psi.  See here MiniMania

Pressure-transducer-or-sender-300-psi-stainless-steel-for-oil-fuel-air-water
300 PSI Stainless Steel Sensor 5V supply (0.5V- 4.5V output)
Brake Sensor installed in the brake line from the Master Cylinder



With the new sensor functioning it was time to tweak the Regen settings on the Kelly Controller.  After some experimenting, the following values provide reasonable braking with the motor providing most of the braking ahead of the mechanical brakes.  It feels like power brakes, since the amount of force needed on the brake pedal is noticeably less for the same slowing power than what is needed with the mechanical brakes alone.


  • ABS - Disabled - When this was on, the controller would pulse the regen as the car approached a stop.
  • Regeneration - Enabled
  • Brake switch - Enabled - When this is off both the switch and the sensor are ignored.
  • Release Throttle Starts Regen - Disabled - Most agree it is better to coast than to have Regen occurring when your foot is off the accelerator
  • Regen current by Brake Switch On - 5% - This is minimal value and represents how much braking is applied as soon as the brake is pressed.  A relay has been installed from the original Brake Light switch on the pedal to provide the ground signal expected by this input on the controller.
  • Max Regen Current - 70% - Not quite sure but this does scale the Regen.  At 100%, minimal brake pressure was too much braking.  So this seems to affect the transfer function from the sensor, and the best I can tell, it impacts the slope of the linear function.
  • Brake Sensor Type - 0V-5V
  • Brake Sensor Starting Point - 10%  - I think this is close to a value of 25 (10% of 255) 
  • Brake Sensor Ending Point - 70% - This should equate to about 180 (out of 255) or about 210 psi, which is fairly high pressure on the brake pedal.
The Max Current, starting point and ending point are all part of the equation that the value from the sensor is put through to determine the amount of Regen the controller applies.

A few observations
  1. Under heavy braking, the Regen cuts off as the motor slows to about 800 RPM.  It is abrupt but since the brake is already being applied, it is easy to simply increase the mechanical braking to compensate.  
  2. Under normal braking, as the motor slows to about 300 RPM, the Regen shuts off.  This is noticeable but not offensive since the car is almost at a stop anyway, less than 5 MPH.
  3. Sensor controlled regen is the only way to go.  The Kelly controller provides very smooth Regen and it is natural to use the brake pedal to control it.

Timing Breakthrough

Ever since adding the Timing advance circuit between the Motenergy ME0913 motor and the Kelly Controller, a strange behavior developed.  After coasting at speed, when the throttle was re-applied, the motor would attempt to slow the car.  Felt like regenerative braking but the controller did not register any current being generated, there was just a noticeable slowing effect until the throttle was close to matching the car's speed.  When the timing was set to zero-advance, this was not observed, however, when the timing was being advanced, the slowing effect was clearly present.

3 lines of code later, a 1 second delay was added to the timing advance activation triggered by a connection to the micro-switch on the throttle.  The micro-switch signals as soon as the throttle is slightly depressed.   When the throttle is completely off, the timing circuit goes into bypass mode.  As soon as the throttle starts to move, a 1 second timer is started, which at the end of, the timing advancement is engaged.  This 1 second delay gives the Kelly Controller time to sync up with motor while the throttle is being fully applied.  This delay solved the problem and the slow-down effect is no longer felt.  I may try to tweak the 1 second timer to see if a shorter time accomplishes the same results but at 1 second, there is no observable delay in motor power or performance.

A Distance Test

With the Regen and timing working well now, it was time for a range test.   Headed out in 3rd gear (the only gear to use for 0-50 MPH around town driving) and covered 21.5 miles 

Below is a screen shot from the Digital Dashboard GPS  app on my phone.  The area graph at the bottom is speed and the line graph is altitude.  There was a large climb near the end which is when one of the cells started to drop.  The rest were holding steady between 3.0 and 3.1 volts but one cell was down to 2.7.  This cell is also the first to fill-up during charge cycles so it is clearly degraded from the over-discharge event from several months ago.  I suspect that there was still a few more miles in the pack so after I swap out this one weak cell, it will be time for another range test.  

Tuesday, August 4, 2015

Kelly KHB Controller & Brake Sensors

Brake Sensor Error

After some under the hood work (more on this to come), I was testing some rewiring and powered up the Kelly controller.  It indicated an error condition with the blinking red LED of 3,3 "Hall throttle is open or short-circuit".    30 minutes of debug of the Throttle sensor yielded no apparent issues.  Then I remembered having turned on the Brake Sensor setting in Kelly configuration software previously.    Since the brake sensor wiring needed some extensions, I had yet to connect the sensor to the controller.

Key lesson:  The controller reports the 3,3 error for both the throttle or the brake sensor.  Once I connected the brake sensor, the error cleared.   This is a great undocumented feature.


Tuesday, June 30, 2015

It's been a while... Small Improvements

Bad Luck

The Motenergy ME0913 motor started making a strange sound one day.  Kind of a brushing sound at low speed.  Careful listening indicated it was coming from the center of the motor.  Upon removing the fan cowl, a small bolt fell out.  It appeared to come from inside the motor.  Then with a flashlight, I saw a second bolt sitting on the interior coils.  This raised the mystery factor even further.  Then looking into the motor, I could see two empty holes in the center rotor where it attached to the hub that secured it to the main shaft.  There were still two bolts in place.  These are M6x12 flat head Philips bolts.  Well with a tweezers and a screw driver and some thread lock, two new screws went back in, the other two were tightened and the motor re-assembled.  Good advise from John at Motentery to not pull apart the motor housing/casing without first marking the alignment between the two halves since this assures the coils are aligned.  Luckily, I didn't have to separate the casing.

This reduced the brushing sound but there is still something not right.   One of the bolts that was fairly bent up and I suspect it dislodged one of the magnets in the rotor which is now rubbing as it spins.  Not too terrible sounding but not quite right.

Good news

Well with the motor back together, the timing advance circuit is working very well.  Currently, the circuit is advancing the timing from the motor as follows

<300 rpm - 0 degrees
300-600 rpm - 10 degrees
600-1200 rpm - 20 degrees
>1200 rpm - 40 degrees

This is in addition to some mechanical advance achieved by rotating the fan cowl.  The mechanical advance is limited to keep reverse functional since electric reverse is a nice feature for EVs.

The motor is running smooth but the 20-40 degree shift is barely detectable as a slight motor miss.  The next goal is to add a few more steps to lessen the amount of incremental shift per rpm band.

Regen

After some additional testing with regen, it has become evident that variable regen is a must and the best way to control this is tying into the braking system.  Found this stainless steel 500 psi pressure switch:
 stainless steel 500 psi Pressure transducer or sender for oil/fuel/air/water

The goal will be to tee this into a brake line and use it to signal the magnitude of regen for the Kelly KHB 72701 controller.  Using a switch on the brake pedal was too jarring since the controller was all or nothing with its regen efforts.  With this transducer, a 0.5V - 4.5V signal will be provided to the controller indicating the level of break pressure being applied.  By tweaking the controller, it should be able to supplement the mechanical brakes quite well and transparently.

Saturday, February 7, 2015

12V System Enhancements

12 Volts

After the challenges with the traction battery pack, I also noticed that the 12V-120V inverter that powers the cooling fan for the main motor was shutting off when the 12 Battery would start to sag below 12V.  Jane had a larger starter battery (the original from the the gas days) powering the 12V system along with 220V-12V charger to top it off at every charge.

However, under full loads, the 12V battery would run down and thus cascade into other problems.

Upgrades

First was to replace the 12V Starter battery with a DC-DC Converter that would step down the 84V traction battery to around 13V.  After checking the current draw of all of the 12V subsystems (headlights, blowers, radio, wipers, horn, driving lights, BMS) the maximum draw if everything was on at once would be approximately 30A or about 360W.  To provide plenty of headroom, I selected the Meanwell SD-500H-12


This is a 500W 40A DC DC converter that costs around $130.  It is not sealed, but since it will be in the Jane's truck, there was no concerns about dirt or moisture.  

To provide power for the radio when the ignition is off, a small 12V AGM 4.5AH battery is used.  The radio pulls about 3mA when off to maintain the settings, so this will run for months with issue.  Also, it is important that the hazard lights be operational when the key is off along with the horn.
After connecting the system, there was about a 50mA draw on the battery when everything was off which was traced to the DC-DC converter.  Apparently, it has a small load on the 12V battery side even when off.  This necessitated adding a 40A 12V relay between the DC-DC Converter and the rest of the 12V system.   This relay engages when ever the DC DC converter is active.  50mA equates to about 1.2AH per day so the 12V battery would have been drained in 3-4 days.  My goal is to be able to leave the car idle for at least a month without having to disconnect systems.

Also, to control the DC-DC convert, another contactor was added on the high-voltage side.  This contactor is activated anytime the BMS is on (running, charging or manual switch).


Testing

So once everything was connected back, it was time to test.  First just one system at a time.  The core electronics pull about 10A on the 12V system (Cooling blower, controllers, dashboard).  Then adding one system at a time:  Low beams (5A), wipers (4A), heater blower (4A), horn, hazard flashers, BMS (1A).  The current draw peaked at about 28A, well within the comfort zone of the DC-DC converter.

Benefits of the new setup:
1) Weight reduction - The old starter battery weighed about 30 lbs, which in a 1,000 car is 3%.  The new battery and DC-DC converter weigh less than 5 lbs so this should result in a small improvement to the running of the car.
2) Reliability - Since 12V system is now powered by the traction pack, it's run-time is directly linked to the overall run-time of the car.  
3) Proper Voltage on the 12V system.  A standard lead-acid starter battery has a resting voltage of around 12.6V but under load and given the losses in a car, at the fuse panel, the voltage was never much above 11.5V as shown on the dash volt-meter.  The DC-DC Converter is adjustable, so it is set at about 13.5V which is ideal for charging the AGM battery and yields about 12.9V at the fuse panel. This results in brighter headlights and the Blower Inverter having plenty of power.  

With this and the replaced LiFePO4 cells, I went for a test drive last night and everything looks to be operational.  Next steps - Finish up the timing advance system and rebalance the traction pack since it seems to be a bit off but with the relay boards providing full isolation, at least it should not drift out of balance any further.

Side Note: The DigiKey Scheme-It schematic design tool is really easy to use.  It is intuitive and flexible.  I am in the process of capturing an overall schematic for Jane and will post it here once done.

Tuesday, November 25, 2014

CellLogs 8M and Current Draw

Getting to the bottom of the imbalance

The CellLog 8M is a great little device for $15.  When configured properly and wired up, they can provide both HVC and LVC alarming.  However, their front-end design though clever, leads to some severe current imbalance (draw) from the cells.

Currently, the confirguation is 7 cells connected to a CellLog, set to alarm at 2.5V and 3.5V and if the pack goes above 25V (or below 21V though 20.5 may be a better set-point to detect Cell #7 is disconnected: 7 x 3.3 = 23.1, 6 x 3.3=19.8, and 7 x 2.5 = 17.5.  The trick here is to alarm under 6 cells with no load but not under nominal load with 7 cells.

After measuring the current draw from each cell with both the the ground (Pin 1) connected and disconnected, here is the data in mA.

Pin Cell #(+) Pin-1 On Pin-1 Off
1 Cell 1(-) 33.00 0.00
2 1 0.03 0.30
3 2 0.04 0.26
4 3 0.03 0.22
5 4 -13.00 4.40
6 5 -0.03 0.03
7 6 0.38 0.45
8 7 -20.00 -5.00

From this data is became obvious the CellLogs are shuttling current between the different packs.  This CellLog as the D4-D5 current mod connecting Cell 7/8 to Cell 5/6 internally. I ran the same test with an unmodified (hacked) CellLog and the Cell 5 and Cell 7 currents were unchanged.  The one strange thing is the modified CellLog Mod powers up even with Pin 1 unconnected.  There appears to be insufficient power to fully boot up the device and make measurements, but the back-light does illuminate and the text is visible on the screen, though all of the voltages show zero on the screen.

The off-state current is the most worrisome since the device spends 95% of the time off (23 hours out the day).  So a 7mA draw for 95% of the month equates to about 5AH per month of imbalance.  Way too much and this explains why after 6 months, I was seeing a dramatic difference across the 60AH cells.  The 5% of on-time imbalance will still result in 0.7AH of drift per month or 8AH per year.  This is close to 10% of the pack capacity so perhaps annual balancing is the best strategy for now.

Without a full schematic for the CellLog it is tough to understand if the current deltas are a result of relative voltage levels or if it is a function of the overall design.

Next Steps - Full isolation while off, not just turning off Pin-1.  
Using 2 of these will allow for full isolation for the battery when the not charging or running.

Sainsmart 16 channel 12V relay module

$20 per 16 channels - 2 boards will provide full cut off of the 27 signals, though it probably isn't necessary to switch the ground, but for the sake of completeness and since there are extra channels, I go ahead.  There is not need to rebalance the pack until the isolation system is up and running, so until then, it will be prudent to just limit driving range and frequently check the cells.


Sunday, November 23, 2014

BMS and the CellLog

It is tougher than it should be...

The other day I was driving back from work and the battery alarm started going off.  Now this was just after I had rewired the battery monitor cables to CellLogs so I thought there must have been a bad wire somewhere causing the alarm and that the batteries could not be alarm since I had just charged them this morning and it had only been about 3 miles.

New harness setup....


Turns out the alarm was working just fine and the pack had become so imbalanced that a few of the cells were barely charged.

Here is my best guess of what has happened.

1) The CellLog interface board from Electric Porsche opens up the (-)negative on the first cell in each subpack.  This shuts off the CellLogs but there is still some residual draw from the other cells (besides #1).  A quick measurement and measured 30mA on the Battery 1 negative.  Others have reported in this range with about about 0.5mA when off on most of the pins except battery 1.

2) From the factory, the CellLogs treat batteries 7&8 differently and don't pull current from them to power the CellLog itself, only for measurement purposes.

Proof of the problem.

1) The 26 cell pack is divided into 2 six cell and 2 seven cell subpacks
2) On all 4 subpacks, cell 5 is consistently the lowest OCV (open cell voltage) cell and #5 were all alarming during the earlier drive.
3) On the 7 cell subpacks, #7 is the highest OCV.  Using a CellLog 8S (which logs voltages over time), I monitored a recent charging cycle and here is what it looked like.  Clearly near the end of the charge cycle, Cell 7 is becoming full and triggering the charger to shut-off before the others have a chance to top off.  The data at the beginning of the graph is from driving around a bit.  Cell 5 is the lowest line.
4) After draining the 2 #7s a bit, all four #1 cells were reporting at the highest OCV.  Please note that the packs are fairly well balance and there is only a 20-30mV difference between the highest and lowers cells.


Some Math....

No Driving Scenario

1) Cell 1 current draw=0; rest of cells current draw = 0.5mA.
2) Over 6 months (180 days) = 2.2 AH of difference.  In a 60AH battery, this is about 4%.  Not a lot since I am trying to run the batteries between 10%-90% of the operating range.
3) I think this explains why the #1s are all reporting a little high, but not a lot.

While Driving

1) Celllog pulls about 30mA while operating, this is divided amount the first 6 cells, is 5mA/cell.
2) Assume driving for 1 hour/day for 100 days.
3) this equates to about 0.5AH of difference for Cell 7 which is not see a draw.

Plan going forward

1) It appears that simply opening up cell #1 in each subpack is not sufficient to limit the CellLogs slowly pulling the pack out of balance.  
2) Modify the two cell logs to add the D5-D4 jumper to help balance the draw from Cell 7.
3) Create a new CellLog board which completely isolates the CellLogs when power is off.  It will have 8 4PDT relays which will only energize during driving and charging.
4) This will also allow a optimization of the charger cut-off circuit by integrating with the rest of the CellLog interface. 

BLDC Timing Advance Update

The timing advance circuit is working well.  Lots of tuning lately and finally landed on a advance scheme that is smooth yet provides the additional boost above 1,000 RPM.  Noticeable current decline when the shifter is timing phase activated 

BLDC Motor Timing

BLDC Motors and Timing Adjustments


BLDC motors have a timing adjustments which governs how the controller relates the hall sensor signals to managing the commutation of the drive voltages.

The internal combustion engine (ICE) analogy is close but not exact.  Most distributors (or ignition systems) will vary the timing of the spark based on the speed of the engine and possibly the load (vacuum advance).  The theory being that as the engine speeds up the spark needs to occur earlier in the combustion cycle so that the fuel combustion has time to prior to the Top-Dead-Center (TDC) or the optimal combustion point.   This adjustment is done either electronically or by mechanically rotating the distributor so that the spark is advanced relative to the piston position in the cycle.

With BLDC motors, there is a similar situation, especially if the controller is not designed to advance the timing as load and RPMs increase.  The Kelly KHB72701 does not have such capability where controller costing 2x-3x more do.

After some mechanical testing by rotating the hall sensors mounted in the fan cowl of the Motenery ME0913 two observations were made
1. The motor ran quieter and smoother at lower RPMs
2. At higher RPMs (2K-3K), there was more power available as evident by better acceleration in the 20-35 MPH range in 3rd gear.  This an only be explained by increased efficiency of the motor.
3) In second gear, a top speed increase was observed, increasing from 31 MPH to close to 36 MPH.

The physics behind this is simple:  By energizing the phase coils when the rotating magnets are at the optimal point, will result in the maximum torque being generated by the motor for a given current. Energize too soon and the generated field is opposing the magnets,  Energize too late and the magnets are past their optimal position and thus some of the field is wasted.

The challenge comes in how to best control this timing across the operating range of RPMs.

As inspiration, I saw the board Burtie created called Timing Adjuster which does the necessary phase shifting of the hall signals with great success.  It is a excellent device but he has sold out of the units.  This lead to the need to create one from scratch.

Interface Circuit


This was built on the Uno Prototype shied and placed in a project box along with connectors to intercept the  timing signals coming from the motor to the controller.  A KiCad version will be coming soon.

ChipKit Uno32



Optimal Timing

The software running on the 80MHz Uno took a while to refine and optimize and ended up being fairly straightforward.  The code need to be fast enough so that the board could shift the edges of the timing signals a few microseconds.  Though the absolute shift is in 100s of  microsecond ramge. the board still need to be able to effect the transitions with reasonable accuracy.  In the end, the board is reporting about 1 microsecond accuracy based on loop time with the ability to change the shift time every 10,000 cycles (~10 ms).

Getting the timing right has been a interesting challenge.
1) There is about 2-3 mechanical degrees of shift in the motor's cowl which probably equates to about 10% electrical shift.  Kelly reports the motor has a 6 degree error tolerance, so absolute shift is not know.
2) The shifting scheme is the following
- No shift below 1,000 RPM
- Starting at 1,000 start shifting toward a 30 degrees electrical advance.  Using a smoothing algorithm, this ramps ups slowly and hits about 30 degrees around 2,000 RPM.
- A switch on the dash allows the driver to select different shifts ramps and turn of the shifter all together.
3) The only feedback is a rumbling that is audible with the timing to too advanced.
4) Testing will continue to seek the "best" curve for shifting across all RPMs.
5) Special Note.  When shifting is employed, it also improves the efficiency of the regenerative braking, so the braking had to be turned down since it was quite abrupt at the high phase shifts.  It may be worth trying to link the accelerator switch to the timing shift to turn off all shifting when the accelerator is released and braking starts.  The assumption is the timing will be able to adjust back quickly (currently adjustments are made every 100ms or so) so the driver does not perceive this change.