Mazda MX-5 EV

Upgrading the battery - Tesla pack

posted 1 Nov 2018, 07:16 by Klaas De Craemer   [ updated 1 Nov 2018, 07:32 ]

In the Mazda, we have a total of 64 prismatic 100Ah cells from Winston. It is divided into 2 packs at ~100V and is good for about 20kWh. Unfortunately, the energy/weight ratio of LiFePO4 cells is not very good compared to other Lithium chemistries. This makes the car feel quite heavy and close to its maximum allowed weight. However, at the time, these cells were affordable, obtainable and not too difficult to work with.
But we always dreamed of building a pack from better cells with a higher energy content. Common cylindrical 18650 cells are interesting and can be welded together with a spot welder and nickel strips, just like an e-bike battery. Still, sourcing such a cells, testing and assembling them is not a straightforward task.
In the summer of 2018 we started to discuss the possibility of using modules from the Tesla Model S. Several sellers offer the 25V 5.3kWh modules at prices around 1200-1300 Euro, which makes them somewhat more expensive than assembling your own pack from loose 18650 cells.
Looking for crashed Teslas, however, shows that it is possible to buy a complete pack from a car with reasonable mileage. The unused modules we could sell again...

Since we want to keep the existing drivetrain, we are constrained by the voltage range of the the controller and charger, which is around 130V. So, we can put 5 modules in the car for about 25kWh, or 10 if we again use 2 packs. But in the latter case, the weight would be even higher... Or we need to switch to a higher voltage drivetrain... but then the upgrade becomes a complete rebuild...

Several car breakers were contacted and eventuelly we bought a relatively cheap pack from a Tesla P85D with fire damage in the Netherlands, and got it transported.
As can be derived from the picture, the fire took place at the front side, under the bonnet. Out hope was that the fire just charred the front side of the pack but did no damage to the internals. Worst case, the modules in the front would be toast, but we could still use the ones in the rear.

Opening the pack involves a lot of work. Everything is glued, screwed and overall very stuck. We worked around with a hammer and chisel until the top cover came free.
First we got to look at the front 2 modules, and they must have gotten quite hot. The plastic on a lot of parts had completely melted, but the cells seemed fine, and had normal voltages on them. One line of the coolant loop had a small hole because it had touched the cover and melted. The other modules seemed completely fine.

Dashboard console

posted 7 Jan 2017, 03:19 by Klaas De Craemer   [ updated 7 Jan 2017, 09:41 ]

To show remaining battery SOC and range, and actual power output or regeneration, we wanted to have a nice screen integrated in the Mazda's dashboard. The oiginal radio, rear window defrost button and mirror adjustment controls were moved to the console between the seats.
Then we combined a Raspberry Pi 3 and the official 7 inch touchscreen, added two MCP2515 SPI CAN bus modules, an ADS1015 12-bit ADC, a DS3231 RTC and some circuitry to switch the power based on the ignition key position.

Back view of the raspberry pi 3 I/O board
On this photo you can see the two CAN modules. The MCP2515 is powered from the 3.3V of the Raspberry Pi, the transceiver from the global 5V supply.
To configure the modules, we followed the guide from the PiCan2 board.

The user interface is written in Python, using SDL for the graphical part and the python socketcan library to read and write from the CAN modules. The whole linux SocketCAN implementation is really awesome, btw. Simple widgets were written from scratch (button, graph, progressbar, etc.). On the photo below, we used 'canplayer' on one raspberry to replay logged messages to another pi, running the user interface.
Testing console application by replaying BMS logfile, from another raspberry pi.

When the ignition key is turned, the raspberry starts. When the key is turned to off, power to the Pi is kept for another ~15 secs and a GPIO pin is set. This pin is read out in the python application and initiates a clean shutdown.
The received values from the BMS are displayed in a 'rolling horizon' graph and written to a CSV file for later inspection.

Finished car and articles

posted 18 Oct 2016, 05:33 by Klaas De Craemer   [ updated 4 Nov 2016, 07:20 ]

The car is technically finished now, and we use it regularly. Still, we are improving a few small aspects: The charging system should support J1772 signalling, so that we can charge at public charging points. I'm also working on a touchscreen display for the center console. It consists of a Python/SDL application on a Raspberry Pi, joined to a CAN module and an ADC. It will take data from the BMS over CAN bus.
"Tieltenaren bouwen oude Mazda om tot elektrische wagen", Focus - WTV

EMI trouble and rebuilding the interior

posted 1 Sep 2015, 13:44 by Klaas De Craemer   [ updated 2 Sep 2015, 13:36 ]

During the summer, we spent a lot of time cleaning up the wiring in the engine bay. Also, access to the motor controller was very difficult, and required a complex sequence of unbolting various things. Now we have created a plate that holds the motor controller on one side, and a contactor box on the opposite side. We also accidently burned a hole in a battery box with just 36V of lithium cells.

Motor controller interference

However, a previously unnoticed problem popped up: when enabling the motor controller, all BMS communication would fail. Turning off the motor controller restored it. Obviously an EMI issue, as the 10kHz switching frequency of the Curtis controller was visible on every wire in the car. Although our battery boxes are aluminium all around, there is still a rubber seal on top, that could prevent proper grounding. We solved that first, but to no avail.
Next we suspected that the long communication wires, running from the front batteries to the batteries in the centre, absorb too much EMI. Thus we switched to shielded ethernet cable wire and then even coax cable. This all made no difference. We even wrapped the motor controller in aluminium foil, but it seems the noise is injected into the battery cables themselves.

Attempt at shielding the motor controller

Fortunately the Emus BMS system allows the grouping of cell modules into CAN group modules (CGM), that can contain uneven and unequal number of cells. So the solution could be to divide our front pack into 3 separate groups, each with its own CGM. This is illustrated below.
Original BMS configuration
New BMS configuration

The required changes led us having to take out all batteries in the rear to reach the bottom boxes next to the differential:
Under-car battery boxes in position

Eventually the hard work paid off and now the BMS keeps working! For a brief moment, the problem appeared again under heavy regeneration, but this was due to the rubber seals isolating the battery box covers from the chassis ground... EMI, tricky stuff to debug!

Heater core installation

Our heating system was also ready to be installed into the air-box:
The heater core in its position. The flap that mixes cold and hot air is removed, since the heater is temperature controlled.
Another look at the heater, with the connections to the two ceramic elements and the PT100 temperature sensor.
On the first picture above, you can see that the flap that allows mixing of cold and hot air is removed, since the temperature is now controlled purely by a PI-loop running on an Arduino nano.
Below you can see the connections to the two ceramic heaters, in parallel, and the wires to the PT100 temperature sensor.

Interior installation

Next up was the cleaning of the carpets, which smelled rather funny after being outside for almost two years. We rubbed them with a solution of BioTex and now they smell totally fresh and were ready to be installed:
Putting back the carpets in the car, after some thorough cleaning.

Electric power windows

The power windows in the car were very, very slow. After one year they even seized completely. Some google-fu showed that this is likely due dried-out grease in the rails in which the glass move. Thus we took them apart according to these instructions, degreased and regreased the rails, and voila, working power windows!

The electric windows were jammed, so we took them apart and regreased the rails in which the glass slides.

Now the car is getting very close to finishing, and we are ready to bring it to a professional garage to realign the wheels and lights, maybe check the brakes... and do the final adjustments to get the car approved and road-legal.

Heater core replacement

posted 28 Mar 2015, 13:35 by Klaas De Craemer   [ updated 30 Mar 2015, 05:18 ]

Since there will be no running engine making hot water, and the controller/electric motor do not produce enough heat, there is no way to defrost the windshield. Either we add a separate hot water heater that re-uses the original heater core inside the car, or we put in an electric heater and blow through it with the original fan. The Nissan Leaf uses a reversible heat pump to achieve efficient heating and cooling, but this is a step too far for us.

So, we sourced two 750W 110V ceramic heaters from a Chinese supplier at Aliexpress with the idea to put them inside the original air distribution box:

Heater core substitute, with 2x 750W 110V ceramic heaters

When applying current to the heaters, they keep heating and their resistance falls, increasing the power draw even more, until the bolted-on thermostat interrupts at about 160 C. After one try, one thermostat broke already and stayed open.
Driving the heater core with PWM, using an Arduino running a PI-loop

Heater controls modification, to allow temperature setting of the new heater core

Put a sliding potentiometer in the lever's position

Modified lever, almost the same look as from the factory

Weight redistribution

posted 26 Oct 2014, 04:43 by Klaas De Craemer   [ updated 30 Mar 2015, 05:24 ]

So, we have two problems with the MX-5: Weigth distribution is wrong, and the car sits too low to the ground because of the Koni coilovers.

Springs replacement

We sourced original coilovers to fix the latter problem. Getting the old ones out proved quite a challenge; eventually we had to unbolt both front and rear subframes to clear the control arms. Of course, some rusty bolts refused to budge and snapped off... For now they have been replaced by stainless steel ones.
Eventually, the car now sits like this:

Lower rear battery boxes

Some unused space was "found" next to the differential and prop shaft. With some effort, it might be possible to fit 3+4 of the 10 cells that are currently hanging over the front axle. After building a model, from cardboard and later from riveted aluminium profiles, a drawing was made in Autodesk. With the help of our neighbour, the drawings were "converted" into very properly welded aluminium boxes:

New test drive

Second weight measurement


Test drive and weight distribution

posted 4 Oct 2014, 12:28 by Klaas De Craemer   [ updated 4 Oct 2014, 13:22 ]

After we succeeded in fitting all 64 battery cells in the car and finally getting the BMS to operate the contactors of the two separate battery packs, we were looking forward to be able to test the car on the street. This meant bringing it down carefully from the side of the house to street level...
Got the car down the ramp
But, one should remember that this particular car has low Koni shocks, which did not leave for a lot of ground clearance. Today, with all the batteries, weight has increased a little bit and the car has maybe 7cm of clearance in the front. So it scrapes one of the ramps when driving down. Clearly, new springs will be required to make this car road-legal...

Eventually we were able to test it in the street and play a bit with some motor controller settings:

It runs really nice, pulls well. Braking with the Hella UP30 vacuum pump works flawlessly. However, steering at low speed is hampered by the fact that it is now a manual rack, and there is a lot of weight on the front wheels, which are 215 wide.

Some days later we started to fear that the car might be too heavily loaded in the front to ever pass technical inspection. Mind you that Mazda has left very little room for actually "loading" this car. The '94 1.8 MX-5 weighs, depending on the options installed, around 1080~1100kg. The maximum load specified on the chassis plate is 1230kg. This means a useful capacity of less than 150kg. So a heavy driver and passenger and the MX-5 is at its maximum capacity?!
For the technical inspection, we cannot deviate too much from this weight. This is going to be a real challenge, since 64 LiFePO4 100Ah batteries weigh around 210kg, and the AC motor is about 72kg...

Related to this problem is the weight distribution. The maximum weight of 1245kg is specified to be 620kg at the front and 640kg at the rear (that adds up to 1260, but hey, that's what it says on the chassis plate).

So, since we have 10 battery cells hanging over the front axle, we suspect that we will not meet this specification. Since corner scales are very expensive, we decided to buy some cheap bathroom scales rated up to 180kg and weigh each corner separately:
Determining the weight balance with bathroom scales
The scales may not be super accurate, but the results were at least repeatable.


This result is without bumpers, dashboard, and some other accessories... So we will need to keep a close eye on the total weight, and are considering to move some of the 10 "overhang"-batteries in the front to a more central position to aid in the weight distribution. The question is... where?

To be continued :)

Rear battery box and more wiring

posted 15 Aug 2014, 02:39 by Klaas De Craemer   [ updated 5 Oct 2014, 03:03 ]

With the motor and batteries in position, most of the heavy mechanical work is done. But the wiring and interconnection of all the components (BMS, emergency switches, charger, ...) is a huge task, especially considering safety requirements.
Curtis drive mounted above the motor

The throttle cable is attached to a 3-wire potbox of an electric buggy.
Throttle pot mounted and connected to pedal

We also noticed that the vacuum for the brake booster did not remain for a long time, forcing the pump (Hella UP30) to restart every 15 secs or so. Initially, we suspected the one-way valve inside the reservoir to be leaky, but after submerging the vacuum reservoir in a bucket of water, many bubbles appeared from the joint between the two screw caps. Seems like PVC glue was not able to bridge the remaining gap between the two tubes. We resealed using silicone RTV.
Second attempt at sealing the vacuum reservoir for the power brakes
After testing, the vacuum seems to hold for +10 minutes. There might still be a small leak somewhere, but at least the brakes are usable now.

Since some new wiring is needed for the motor controller and its contactor to respond on the iginition key, the whole dash was removed for easy access:
Removed dashboard for better access to wiring loom

Removed dashboard for better access to wiring loom

The wiring around the rear battery box is also complete. The Emus BMS is inside the aluminium box on the bottom right of the picture below. It drives both battery boxes' contactors when the ignition key is turned to the ACC position. Upon turning to IGN, the motor controller is enabled, which in turn closes its own contactor.
Finished rear battery box and BMS wiring

And finally, the covered rear battery box:
Finished rear battery box

Switch to AC induction motor

posted 15 Aug 2014, 02:35 by Klaas De Craemer   [ updated 6 Oct 2014, 01:50 ]

After the first testdrive, we were disappointed with the KellyController/ME0913 combination. One of the controllers kept tripping despite not even drawing its nominal current. Probably its specs are overrated. We also had a slight wobble in the rotor discs, which creates a wirring noise during driving.

Eventually, the decision was made to switch to a more powerful motor/controller combination and we stumbled upon the conversions of Heiko Fleck, from whom we sourced a rewired AC induction motor from Schwarz Elektromotoren. It is rated at 70kW peak, and we will be using it with a Curtis 1238-7601 controller. It can provide up to 650A to the motor at 100V.

Picture of the motor as delivered. It is quite difficult to move, at about 70kg... Also, the connection box on top makes it impossible to fit batteries above the motor. Therefore we had to carefully change the motor wiring.

Replacing the leads of the motor so that the connection box on the top can be omitted. Height is critical.

Eventually, a new adapter plate, spacer and coupling for the flywheel was drawn in Autodesk Inventor. The bolt patterns were then drilled using a CNC mill in a used piece of aluminium:

Finished adapter plate, spacer and flywheel coupling. The latter's diameter was made about 0.1-2mm too small so that it would fit after heating to 200C.
Clutch bolted on, ready to locate the motor onto the gearbox. We did not know if it would fit exactly at this point. At some corners only a few mm's of margin are expected.

Eventually it was time to put the motor inside the car. Because the space was so limited, the gearbox had to be moved by about 2cm to make the motor clear the steering rack. There would not be enough space to put batteries above the motor anymore...
Eventually, a slot was cut into the cooling fins on the bottom of the motor to be able to lower it some more.
Conveniently, the winch that was tied on the roof of the garage broke just when the motor was in position... We cannot get it out anymore for now.
Motor on gearbox. Piece of cake. ... Well okay we did need that hammer. Also, the gearbox had to be relocated about 2cm higher.

The front battery box also serves as a mounting point for the Curtis motor controller. In the picture below, the HV cables from the rear battery box were already installed as well.

Mounting of the Curtis 1238 drive

The HV wires are required to be orange, so that emergency services can identify them quickly. Since these cables run alongside the transmission tunnel on the bottom of the car, we wanted some additional protection. Thus the cable is pulled through transparant hose:

First testdrive

posted 15 Aug 2014, 02:31 by Klaas De Craemer

First testdrive with quad stack ME0913

1-10 of 16