Thursday 26 November 2020

Finally Driving and a CAN reading Arduino

 Here is a short and sweet video of the BMW taking off in first gear. I may have held the brake down a bit too long...

 

Now that i have got the car running and driving we can begin to build up the code and test the Arduino reading from the CAN and driving the dash. While I wrote the code to run the dash initially, integrating the CAN reading function was just way above my programming level, so I got the help of a friend  to help me finish it off. 

He has been working on prototypes for a while and has uploaded the final code to GitHub here: https://github.com/Damo-Chasey/16x2-LCD-fuel-gauge-and-BMW-Dash_controller

 


Tuesday 24 November 2020

Arduino dash control

To get started with the arduino dash control I first controlled the dash using the Arduino with set values rather than values read from the CAN bus of the imiev.
This video here shows the startup sweep I made the tacho do, unfortunately there isnt a quick enough response from the temp and fuel gauges to do this to them too.

 
Here is the code I made to run the Tacho gauge, unfortunately I wasn't able the get the MPG gauge working at all and struggled to get the fuel gauge to be consistent so i wont be using them and instead will be using an LCD screen later on to display the data. The code to run the Temp gauge is in there its just not currently being used.
 
#include <Tone.h>  // "Tone by Brett Hagman" in Library Manager


//const byte E36TachPin =      2;  // Tone
//const byte E36MPGPin =       9;  // PWM  (Not valid PWM pin for Arduino UNO!)
//const byte E36FuelGagePin =  5;  // PWM
//const byte E36TempGagePin =  6;  // PWM



void setup()
{

  pinMode(5, OUTPUT); //Fuel
  pinMode(6, OUTPUT); //Temp
  pinMode(9, OUTPUT); //MPG
 
  //#####FUEL#####
   analogWrite(5, 165); //sets fuel to Full
    // 0=EMPTY, 10=E, 55=15L, 95=30L, 125=45L, 165=FULL
 
  //#####TEMP##### 
  analogWrite(6, 50); //sets temp to middle pos
   // 6=HOTFlashing 10=HighesTemp 15=HOTLightOn, 50=MID, 100=COLD
    // Use 10 - 100 for temp range, set 6 as a value for flashing HOT
 
  //#####TACH#####
    Tone E36TachTone;
    E36TachTone.begin(2);
    E36TachTone.play(31);
  //35=1k, 129=4k, 222=7k
  //28.5 31 31.53
  
  
  //RPM sweep
    for(int t=31; t<222; t++){
      E36TachTone.play(t);
      delay(2);
    }
    delay(500);
    for(int t=222; t>31; t--){
      E36TachTone.play(t);
      delay(2);
    }
    E36TachTone.play(31);
 
 
 
  //#####MPG#####
   // Tone E36MPGTone;
   // E36MPGTone.begin(9);
    //E36MPGTone.play(0);

}

void loop() {
  //#####TACH LOOP#####
    Tone E36TachTone;
 
  int RPM = 500;  //input RPM read from CAN here IF car is in ready state else stop RPM gauge
  int RPMt;
 
  RPMt = RPM/30.5;
 
  if (RPMt < 31){ //stops rpm gauge signal going below 31 Hz for idle(causes issues)
    RPMt = 31;
    }
 
  E36TachTone.play(RPMt);
 
 
 
  //#####MPG, TEMP, FUEL LOOP##### 
  //Tone E36MPGTone;
 
  //E36MPGTone.play(00);
      // analogWrite(5, 165); //Fuel
 
    //analogWrite(6, 50); //Temp
   
    //analogWrite(9, 0); //MPG

}





Monday 2 November 2020

Installing the drivetrain and getting ready for a test drive

After getting the motor coupler machined and installed its now time to put everything together to test if it will drive!

 

Here's the motor coupler before it was machined and after. Now it has the I-MiEV spline pressed into it and has two grub screws stopping it from spinning in the coupler.

 

Connecting up the AC slow charging with cables more than capable of handling the maximum 32A current allowed by the on-board charger.


Prepping and Painting the fabricated brackets.

I filed down all rough/sharp edges on the brackets and wiped them down with acetone to prep for painting. I painted the brackets with a matte black rust preventing paint.

Before installing all the brackets and drive-train you can get a really good look at the conduits running to the rear of the car. They're nothing special, just a mix of solid and flexible conduit held on with a mix of pvc and metal brackets


Installing the drive-train, brackets , and components.

First off the transmission, motor, and coupler are bolted in.

Then the battery and motor supports are installed.

After that the 12v vacuum and power steering pump are installed above the motor, although they arent that visible due to all the cables and my great camera work.


The Motor Controller and On-board Charger/DC-DC with the coolant tank bolted to it are next to go in.

Then the bottom level of batteries are bolted to the bracket and connected together. The AC charging cables have also been connected to the OBC.

Finally the top layer of batteries, the HV cables, contactors, then some coolant and we are ready for a test charge and drive!




Saturday 29 August 2020

Slowly making progress: August update

Things have been moving slowly on this project recently with Uni and two part-time jobs getting in the way, but I have managed to get some things tidied up and finished off.

I have re-installed the previous owners conduits under the car as they do not conform with current New Zealands LVVTA EV certification guidelines anymore as the old conduit was plain white and had both the positive and negative HV wires running through a single conduit which is a big no no. The new certification guidelines state positive and negative HV cables must be run through separate conduits and must be orange in colour, or obviously indicate there are HV cables inside with warning labels for example.

Old:

This is the old single conduit (folded in half), you could not see the orange cables at all when it was installed and nothing on the conduit indicated HV wires were running through it.

New:


Although the whole conduit is not orange, in my opinion it is very easy to tell HV wires run through these conduits, although I may wrap the white flexible conduit in orange electrical tape just to be sure. There are now three conduits run, one each for the positive and negative HV cables and one for the AC (slow) charging cable.

Speaking of AC charging, here is the J1772 port from the iMIEV bolted to the car with enough clearance to close the "fuel door"

This is my mock-up of the front battery setup. I am planning to have everything bolted in place with a custom shaped fiberglass mold over the top to prevent the HV terminals touching the hood if someone stands on it or something stupid. The HV cables that lead to the huge Anderson connector off to the right will eventually run through the conduits to the rear of the car where the second paralleled pack will be. 

I also mocked up the cooling hoses and decided to use the heaters coolant reservoir instead of the main one due to the more convenient size.

I have also tidied up the wiring in the engine bay by wrapping all of it in black electrical tape, if you look at previous photos of the engine bay this looks much cleaner.


Version 1 of the circuit diagram for the car. I feel like it's pretty simple for a whole electric car to be honest as I have left all the iMIEVs brains in boxes for this diagram and only shown the main circuits and ones I've actually made/altered. (Pre-charge resistor value is not correct)





Sunday 19 July 2020

Motor mounting

This is how I designed the motor mount.

First i started out by pushing a piece of paper onto the side of the motor to get an indent of where i needed to cut, then roughly cut it out and drill the appropriate holes.


After a couple test fitments and regrinding some edges it fits perfectly, a section of the motor had to be ground down and three washers were added behind the plate to clear the motor. (will get longer bolts to account for the extra thickness)
Now to start on the second plate which i already have cut out and drilled holes for in the next photo. To mount the second plate I hacked off the bushing and arm to just leave the section that bolts to the motor as a spacer for the massive bolts.

Next is to cut the square tubing to length, tack weld it in place then take it off and weld it properly.
Now to bolt the motor to the transmission and jack up the motor to the correct height and measure the length of steel to cut. I did this by holding it up to the motor/bracket and pencil tracing where i needed to cut, and cutting it, didnt turn out too bad.

Here it is fully supported by the bracket and the torque bar on the left side of the motor just to minimise any flexing.


Motor adapter plate co-ordinates

As i already had the adapter plate from the previous conversion, all i had to do was machine the holes for the iMIEVs motor into the plate.

First i measured the distance of all the bolt holes from the shaft and from each other.

Which then meant i could enter it into my CAD program and get the exact co-ordinates of the bolt holes from the center.

The co-ordinates are from top right to top left (clockwise) when looking at the face of the plate
0,0 being the center of the motor shaft
C/B is counter bored 14mm (5mm deep for alignment pins)
format: X / Y ~ hole size in mm

71.95 / 113.4 ~ 11.1mm C/B
107.4 / 0.01 ~ 11.1mm
30.24 / -103.055 ~ 11.1mm
-101.74 / -90 ~ 9mm C/B
-134.4 / 15.225 ~ 9mm
-71.95 / 113.341~ 9mm

The thread for the three 9mm bolt holes is 10x1.25mm. if you are tapping these by hand i would recommend drilling the hole 9.5mm wide as it is extremely difficult to do on a 9mm hole.

note: the pic below has all the X axis co-ords reversed as i had accidentally drawn my CAD upside down, luckily i noticed this before starting the machining process.



Using a 20mm thick adapter plate i still had to use spacers on the bolts that thread into the motor as they bottomed out with about 10mm to go.
Here's the motor bolted up to the transmission

Tuesday 9 June 2020

Learning to weld on the rear battery box

My first mig weld

I think this picture shows for itself my welding skill level, which before this, was none.

After two or three days of practicing on random bits of steel I'd gotten comfortable enough to start cutting out the metal frame lengths for the rear battery box and weld it together.
As i only had an angle grinder to cut the metal, none of my cuts were exactly perfect, but close enough to where i could weld over any small gaps.

The pictures below show the rear battery box being tack welded in place then welded in properly and the batteries being test fitted in the boot to check clearance which was perfect.



Tuesday 2 June 2020

Designing front and rear battery mounts

I will be designing the basic look and measurements of the mounts using Autodesk Fusion 360, a CAD program, the completed designs will be used to determine the approximate amount of materials needed. Then the metal will be cut and welded together and any minor changes needed will be made during that process.

So first off is to make rough CAD drawings to get the approximate amount of materials required and to measure all the clearances needed for the bonnet, frame rails, etc.

First up, and the rear battery mount for the boot
and the front battery mount for under the bonnet

Now to buy the metal needed which, with potential mistakes in mind, came to

Description
Length
Batteries 

Angle 20mm x 20mm x 3mm steel
6m
Box 20mm x 20mm x 3mm steel
6m
Box 20mm x 20mm x 3mm steel HALF
5m
Flat 20mm x 3mm steel
4m
80 bolts, 80 nuts/washers for batteries

Motor

Tube 15mmDiameter x 4mm
231mm
Flat 60mm x 5mm steel
1m
Flat 300mm x 100mm x 6mm
1m

All that, except for the nuts and bolts, came to $120NZD from STEELCUTS LTD.

Friday 3 April 2020

Testing the HV battery and charging issues solved

Here I turn on the ignition to test the dash lights up, at this point the HV battery isnt plugged in
After confirming the dash turns on I set up the HV battery to test the car will engage a "Ready" state. To set up the HV battery I have temporarily placed the batteries next to the bonnet for easy connection to the motor controller.
I have reused the HV cabling from the previous build to connect up the battery while keeping the factory contactors, fuse, and safety cut off.
After filming the startup I attempted to charge the battery and found it would not detect the charger unless the ignition was on, and because the ignition was on it would not charge, so it seemed I had some troubleshooting to do.

At first i thought it might be because the ABS was disconnected, after connecting it up although it did clear the ABS warnings on the dash it did not fix the charging issue.

After that didnt work I went into the iMIEV workshop manual and searched for the symptom i had, which i found and was described as "Charging does not start, or the charging indicator is not illuminated when the charger is connected to domestic power supply". I found this under
"54D electric motor unit and main battery - On Board Charger - Symptom Procedures"

The first step was to check the charging cable, which was fine.
The second step was to check for battery voltage at the grey no.1 pin on the C-106 EV-ECU connector, and there was no voltage present on the pin.
Finding that there was no voltage I went to
"54D electric motor unit and main battery - EV-ECU - Check at EV-ECU terminal"

Its not shown in this photo but it states the normal condition for pin no. 1 is to always show battery voltage, i must have cut something i shouldn't have, whoops, but after connecting a wire to a random positive terminal and to pin no. 1 the charging WORKED! the photos below show the battery going up a bar!
Next step is to clean up the mess of wiring that is now throughout the car and start designing up some mounts for all the batteries, motor, vacuum pump, radiator, fan, etc. Ive already got some small relays/fuses mounted in the car.

Sunday 29 March 2020

Details on the wires/connectors/components I've cut out


Ok lets have a go at going over and covering the wiring process so far

Again, the imiev being used is a Japanese imported 2012 model M spec with the 10.4Kwh pack and Toshiba modules.

regarding the imievs wiring loom:

I initially had the whole cars wiring laid out on the ground (except for the heater and A/C compressor, i still had the A/C ecu and cabin control module plugged in), one by one I followed wires and if they went nowhere (there were quite a few) I cut them.

The wires that can safely be cut without effecting the drive-train performance are:
  • All door wiring
  • Headlights/Taillights (incl. all wires that lead into the rear hatch)
  • Bonnet latch
  • Wiper Motor
  • Handbrake ground wire
  • All wires from steering wheel EXCEPT the steering wheel position sensor, and thick key position (ignition) wires (steering wheel sensor is integrated into the CAN bus and must be kept connected. The dash will also indicate that the park/headlights are on once the wires are cut)


  • Brake oil level sensor 
  • Auto headlight leveling module (if you just remove the sensors it will give a dash warning)
  •  On the interior fuse box there are a handful of wires that no longer need to be there.
    I didnt manage to get any good photos of the wires i cut before eveything was put in the BMW but here it is with no wires at all for reference. At the Top Left there is a connector that only needs one white wire out of the three wires, this leads to the A/C ecu and cabin controls.
The plug seen missing in the top part of this photo was removed completely with a plug next to it having the red wire cut, i cant remember where that lead to.
There were a whole bunch of wires on the side of this fuse box that could be cut, now i didn't get any good photos of the wires i cut, from memory there was one +12v for the dash and a ground.
When it comes to doing this on the fuse box you really just need to use common sense and follow the wires one by one to see where they lead before cutting them.

  •  The QuickCharge Chademo HV wires and signal wires can be left out without any trouble, although the slowcharger j1772 must stay connected and grounded (there is a grounding location along the wires leading to the j1772)


These will give dash warnings but wont effect the drive-train:
  • EPS
  • SRS (unplug the module not just its components or it will send a fault code and shut down the car)
  • Vacuum pressure sensor, this does not stop the car from going into a ready state, but will emit a constant beep from the dash until the sensor is plugged in and given vacuum, and the hand break dash light will either flash or stay on constantly i cant remember.
 DO NOT CUT OUT
  • Unplugging the ABS will limit the drive-train to only responding to the throttle pedal and being extremely under powered, this can be done on a fully working imiev too by unplugging the ABS module, for me at least it didn't leave any error codes behind after plugging it back in.
  • G,Yaw sensor must not be left out as this is on the CAN bus and prevent full drivetrain performance(positioned under the left front passenger seat)
  •  Steering wheel sensor is integrated into the CAN bus too and car will not engage ready without it (Positioned around the steering column, the steering wheel/airbag module will have to be removed to get it out) 
 Even though the imiev will run fine without it I have not cut anything to do with the A/C or heater systems as i want to eventually get them working in this conversion. things like the Heaters pump or A/C pressure sensors have been kept wired in, although they are on a separate loom so aren't in the car right now

Please comment and let me know if i have left a component out or want something explained in more detail.