Thursday, December 17, 2015

Wireless Comms in a '73 Mini

Wireless Fuel Gauge

Up to now, Jane's fuel gauge was driven by an Arduino Uno that is monitoring current via a Shunt in and out of the battery pack.  This has worked well but it require a comms wire be run from the boot to the dashboard to power the fuel gauge.  Since the fuel gauge had to be isolated from the 12V system to maintain complete isolation of the traction pack from the rest of the car.

This week's project involved replacing the wire with a wireless system.  Using two nrf24L01+ 2.4GHz radio boards that cost about $2.00 each, the system now communicates wirelessly from the current monitoring Arduino Uno to the dashboard Arduino Mega.

 nrf24L01+ board

These boards communicate over the SPI port on the Arduinos and only need 2 additional digital lines for chip select.  Using the RF24 library, it took about 15 minutes to connect these and have a two exchange between the Arduinos.  To assure reliable comms, the radios were set to 250 Kbps and maximum output power and retries.  The system has no problem communicating from the boot to the dash and these radios have a acknowledgement system, so comms are quite reliable.   The dash radio sends a request for data and the battery system send back charge level, current current and time that the system has been charging.  Since this is less than 10 bytes, it goes quite fast.

For the dashboard Mega that is also driving a Sainsmart 3.2" color LCD, an SD card, a Touchscreen and the CanBus interface for the Kelly Controller, I ended up adding a softSPI interface since connecting to the standard hardware SPI interface introduced some issues.  After a couple of hours of unsuccessful debug, it was easier just to grab 5 unused pins on the Mega and setup the greiman Soft SPI bus.   This worked great and did not interfere with the SDCard which is the only other SPI device in the system.  Also, Megas are known for noisy 3.3V supplies, so I added a simple LM317 regulator with the appropriate resistors to get a 3.3V supply from the 5V line.  The radios run between 1.9V and 3.6V so a precise supply was not critical, just a clean one which was done with a few large caps.

With the battery monitor now is communication with the dashboard computer, a new feature was added to the dashboard computer.  By touching the screen, the system will switch to a battery view which shows charge level and current battery current.  This will allow for an easy comparison between battery current and motor current.  The real test will be comparing the reported power of each which should provide some additional efficiency data.   Also, the dashboard computer will now drive both the original fuel gauge and temperature gauge, simplifying the overall system and isolating the battery system from the dashboard.

Tuesday, November 24, 2015

New Primary Gearing

The second time is the charm

Recently the primary gear (22A1493) started to make some noise and it has always been slightly non-centric.  Well this was motivation enough to make a second attempt at attaching the gear to the ME0913 motor.

In the original Mini engine, the primary gear spins on the crankshaft and couples the clutch plate to the transfer gears which go to the transmission.  Normally, the gear spins with press-fit bronze bushings which is oil fed through feeder holes in the gear.

With Jane, the primary gear is firmly attached to the electric motors shaft and transfer power to the transfer gears.  The challenge is the Primary gear has an ID of about 1.75" and the ME0913 motor's shaft is 7/8".

A shaft coupler can be used to adapt these two, however, the inside of the Primary Gear is not a consistent diameter but actually 3 different diameters.  These vary by about 0.1" by design (1.5" - 1.62").  The center section has a smaller ID (~1.504") than the outer sections.  Therefore, additional adapters (bushings) must be made to permit a press-fit between the coupler and the gear.  The two new bushings were designed to match the diameter of the inner section (shoulder) so that the coupler will have consistent contact through the length of the gear.  The gear is hardened steel and could not be easily machined.


Here the keyed shaft coupler is shown press fit in bronze-aluminum bushing pressed into the primary gear.

This is the other end of the assembly showing all three elements (Gear, bushing (bronze),  coupler (inner black)).  Note the thickness difference in the bronze bushings (Front vs. rear)


Additionally, a grade-8 bolt was installed through the gear-bushing-coupler to transfer power and hold the assembly together.  With only 40 HP, the Grade-8 bolt should provide sufficient shear strength.  The coupler was cut flush with the front of the primary gear.  The other end of the adapter fits flush with a feature on the motor and is held in place with a bolt through the shaft.

You can also see a new seal (black rubber LUF10005) installed that will keep oil from leaking along the gear.

The first time this assembly was made, the original bushings were turned to accept the coupler but since the gear is difficult to chuck-up in a lathe, it was impossible to machine the inside of the bronze bushings concentric with the outside of the gear.  This resulted in a slight acentricity and it was visible as the gear was turned by the motor.  I suspect this added to the noise coming from the primary gear.  The new custom bushings should be perfectly concentric resulting in a better fit and hopefully reduced noise.

Success

The new gear assembly is in and here is a video of it in motion.  No visible non-concentricity and it is much quieter. Also visible is the good oil circulation for the primary gear train.  


Some photos for higher details.


Saturday, November 7, 2015

Stripping Paint

Time to focus on the paint

Now that the mechanics seem to be in reasonable shape and the rains have started, it is a great time to get the body in order.  First step, strip off the paint.  Now there are many opinions on the best way to do this from chemical to sanding to wire brushes.  Not having a lot of space for chemical strip, I tried both the 3M paint strippers in an angle-grinder and 60-Grit sand painter on a orbital sander.  Both work well but progress is slow.

Best I can tell, there are at least 4-6 different paint jobs of paint the car.  Yellow, Green, Red, Green, Grey, Blue, White.  Here is a geological photo of an sanded area.  The bare steel looks great but it takes a lot of work to get down through 40 years of paint.




Then I read about using a razor blade to strip paint.  It works.   here is a video showing the stripping a a couple of layers.  The razor avoids lots of dust and chemical mess.  It  takes a lot of razors as each one lasts for about a square foot of scraping, but at $7.00/100, it is still quite economical.







At this point, about 70% of the metal is scraped but the detail work is still pending.  Several more weekends to go....

Thursday, October 15, 2015

Great Service from Kelly Controller

Bricked Controller

Well after attempting a firmware upgrade on my Kelly KHB 72701 controller, the master FW failed to program and the controller was frozen.  The team at Kelly offered to reflash my controller if I sent it to them.  I used USPS Global Express service, I was able to send the dead controller to Kelly and it arrived in about 4 business days.  Global Express is a partnership with FedEx so the box moved by USPS across the ocean but was then handed off to FedEx for the local delivery in China.  Full tracking information from both USPS and FedEx was available online.  The team at Kelly, reflashed the unit and shipped it back (2 day service from China) to me for no charge, which is quite generous since the unit is over 2 years old and a year out of warranty.  The controller arrived in great shape and came right up.  I wish all companies had this level of customer service.

Noise on the Ground

Well the new controller highlighted a problem I had with my timing advance circuit.    I'm not sure if some wiring clean-up exposed this or the new firmware has slightly different timing for the phase signals from the motor.  Either way, my timing advance system stopped working and started causing the controller to report either a non-spinning motor or a hall-phase error.  Bypassing the timing advance board cleared the problem, so it was obvious where the problem was centered.

After some sniffing around with a scope, I found there was a lot of noise on the phase sensor signals from the motor.  I could see the phase signal but a high-frequency 2V noise was riding on top of the low-frequency motor phase signals when the motor was spinning.  Looked a lot like the high-voltage PWM from the controller, though I never measured the frequency to confirm.

Two realizations:
  • The case of the controller is tied to the high-voltage motor signals through large resistors to drain residual charge once the controller is turned off.  The team at Kelly suggested that if the case was tied to chassis ground, it could be introducing some noise on the 12V ground.  Isolating the controllers case from chassis ground (with a rubber mat) improved the noise quite a bit, but there was still an issue with phase signals.
  • More digging revealed a wiring issue.  Originally, I had used the ground signals (RTN) from controller as the ground for the hall sensor in the motor.  I suspect the controller was passing some noise through the ground lines to the hall sensor.  Switching the hall sensor ground to be the sourced from the timing advance system (a good chassis ground) provided a significant reduction in the noise on the hall sensor signals.  I suspect the Kelly Controller is more tolerant of noise or has some high frequency input filters which my timing advance circuit does not.
After these two changes, the timing circuit is operational again and the controller is reporting All-Good.  Now to re-optimize the timing settings based on the new firmware.  After driving the car without the timing advance active, it will be much more fun to have it operational again given the noticeable performance boost.  More testing this weekend....



Monday, August 17, 2015

Kelly KHB 72701 Controller Settings

Kelly Controller Settings - Screen shots

The following are screen shots of the current settings in the controller.  These are delivering optimal performance with the Motenergy ME0913 motor and timing advance system.







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.