Battery: MG HS PHEV - dalathegreat/Battery-Emulator GitHub Wiki

Specifications

  • The 2018–present MG HS PHEV comes with a 16.6kWh battery. :heavy_check_mark:
  • The 2024-present 2nd Generation MG HS PHEV comes with a 24.7kWh (Same as Roewe RX5

Initial focus has been on getting the 16.6kWh battery working with Battery-Emulator (BE).

Current status

The battery is under testing but seems to be fully usable, either by bypassing the contactors, or adding a relay that can reset the BMS when it occasionally locks out.

The battery will sometimes detect an isolation failure during inverter startup and open its contactors, requiring a 12V power cycle to reset. BE can detect this and cycle the BMS using the relay within two seconds.

Battery voltage and current, min/max cell temperatures, and individual cell voltages are reported to BE. The battery appears to be balancing automatically (when the contactors are used, at least).

The latest working BE code is available on this branch: https://github.com/jonny5532/Battery-Emulator/tree/feature/mg-hs-phev-updates-testing (the main branch has yet to be made fully compatible).

Connectors

The MG HS PHEV battery has 3 separate HV connectors that require interlock to be seated (Orange), and a Low Voltage signal connector (Green). There are also two coolant ports that can be used for thermal management, left is inlet, right is outlet (optional)

image

Low voltage connector

image

mg_lv_diagram

This is the Low voltage connector plug: https://www.aliexpress.com/item/1005004815715620.html The one you need is the one with the black face. There's a non-wired version too for doing your own crimping but this looks easier to implement.

20250617_192645

Wiring diagram

Since the relay is driven directly by a 3V logic output, it should either be an SSR or have an optocoupler driver (for example, something like https://www.aliexpress.com/item/1005006579751839.html (12V version)). The NO terminals shown are the normally-open ones (connected together when the relay is energised).

For the above relay board:

  • remove the jumper
  • connect the LilyGo IO32 to IN
  • connect the LilyGo GND to CT (the center of the jumper pins)
  • connect DC- to the supply GND
  • connect NO to the 12V supply
  • connect CM to the battery 12V connections
  • connect NO to DC+ with a loop wire

If you are using a FOTEK style SSR, beware that they often won't trigger as low as 3V, despite claiming to.

Power connections

The battery needs a 12V-14V supply, and draws 600mA continuous with the contactors closed, and ~3A briefly when closing the contactors. It also needs a 12V signal to wake it up (via a 1kR resistor, or connected directly) as shown.

To reduce potential issues with the isolation measurement, it is preferable to have a 12V supply that is isolated from the grid (eg, powered from a 2-pin double-insulated adapter).

CAN connections

The battery has (at least) three CAN buses:

CAN1 is (likely) the powertrain bus, which connects the main powertrain components. The battery outputs its vital statistics (voltages, SoC and temperatures) on this bus, and listens for the messages which control the contactors. This bus outputs about 500 messages/sec.

CAN2 is (likely) the wider status/diagnostics bus. This has fewer messages (80 msgs/s), and some messages are abridged (eg, it includes a scaled SoC but not real SoC, voltage or current). OBD requests (0x7e5) work over this bus, and can be used to query for detailed statistics such as SoH.

CANHV seems to be the raw data from the HV-side controller in the BMS, and contains raw cell voltages and temperatures, and the current sensor output. This is useful for battery diagnostics, but has high rate of messages (1000 msgs/s).

A connection to CAN1 should be sufficient to use the battery (pending a Battery Emulator update). It is also possible to bridge CAN1 and CAN2 together (connecting the high/low pins in parallel). This results in incorrect termination impedance, and the BMS receiving messages it was not expecting, but seems to work, and gives control over the contactors and vital statistics whilst still being able to query over OBD for extra detail.

Battery-Emulator currently works with CAN1/CAN2 bridged, or a connection to CAN2 only and the contactors bypassed.

Bridging all three buses does partially work, but the volume of messages seems to overload the BMS, with some OBD queries then going missing and not being responded to. The additional diagnostic messages that CANHV provides are not necessary for regular operation.

Previous reverse engineering notes:

MG HS battery front panel.xlsx - this pinout map is based on continuity testing with and identification of internal battery components. There are some pins on the bottom row that go to the same chip and I'm not certain what two of them are, so have marked them as do not connect +12V in case it causes damage. I could be wrong, so please update this if you can elaborate. I have a running system based on this. I have only used one of the 4 CAN channels available through the low voltage connector (CAN2), but this is enough to run the battery emulator (although closing the HV contactors is WiP).

High Voltage Interlock (HVIL)

The HVIL connections under the MSD are bridged together by the MSD itself.

The other HVIL connections on the front panel (on each of the three HV connectors) can be left alone, as the BMS doesn't care whether they're bridged or not.

Earth leakage / isolation resistance testing

The battery has two 90nF Y capacitors inside the contactor module between each HV output terminal and the battery case. It is therefore important to ground/earth the battery case, since with a transformerless inverter these will cause an earth leakage current of >20mA which could be hazardous if an ungrounded battery is touched.

Depending on your inverter and/or RCD, this current may be too high and trip the earth leakage detection, in which case you will need to modify the capacitor circuit to reduce the leakage. Check whether this is necessary by testing with your inverter/RCD first.

The BMS seems to rely on these capacitors when checking the isolation resistance between the HV connections and the battery case - when closing the contactors, and every few seconds whilst the contactors are closed. If it decides that there is a problem, the contactors will open, and the BMS will go into error state 15. To reset it, the 12V must be removed and reapplied.

Isolation failure errors may be triggered by your inverter's own isolation tests (which are usually performed whilst it is connecting). The extent and inconvenience of this will depend on your exact inverter - a Solax X1-AC seems to only perform these tests before connecting, so as long as the inverter runs continuously without dropping out (or going into standby), it does not seem to trigger isolation failures in the BMS.

These modifications are only necessary if you are using the battery contactors (and have not bypassed them). If the contactors are never closed, then this capacitance is never switched in, and the battery never performs isolation resistance testing either.

Obligatory warning - taking the cover off a high voltage battery is dangerous. Remove the MSD first, wear insulating gloves, and check the voltage on all terminals before touching them.

The high voltages within the pack are reasonably well contained once the MSD is removed, but be careful around the orange-wrapped wires and connectors which may have ~175V between them.

Option 1: Disconnecting the capacitors from ground

The isolation resistance measuring circuit does not have a DC connection to the case - it seems to rely on these Y capacitors to conduct the AC isolation resistance measuring waveforms. It is therefore possible to disconnect the centerpoint of the capacitors from the chassis ground, leaving them as an effective 45nF capacitance between the HV terminals, and simulating an infinite isolation resistance.

This can be done by removing the ground connection from the chassis to the contactor board, which is the dangling wire here (ignore the missing capacitor!):

and reinstalling the screw without the wire, and then insulating the dangling wire with some heatshrink:

The battery should now pass its isolation resistance tests, with the battery case still grounded, and a much lower earth leakage current. However you may still have occasional isolation resistance failures (1-2/day), requiring a power cycle to reset. This is currently under investigation.

Option 2: Floating the BMS ground above the case ground

There are two connections between the battery case and the electronics within:

  • inside the contactor module (as disconnected in Option 1 above)
  • underneath one of the BMS mounting bolts to the battery case

If you disconnect both, then the BMS ground will no longer be referenced to the battery case. You can then run an extra wire between the GND screw in the contactor module (shown in the image above), and the case of the BMS, which will bypass the battery case, and keep the isolation measurement completely separate. The wire will not carry much current, but should be well insulated as it will pass close to the main battery terminals.

You will also need to use an isolated 12V power supply (a 2-pin power supply with no earth pin) to power the BMS as well as the Battery Emulator hardware (unless you are using isolated CAN), to ensure that there is no current path between the BMS case and the inverter's ground.

This has proven more reliable than Option 1 alone, with fewer isolation measurement failure trips.

Option 3: Changing the capacitors for lower values (not recommended)

You can leave the internal grounds connected and remove the capacitors instead, but they will need to be replaced with smaller value (eg, 4.7nF capacitors) to keep the isolation measurement tests from regularly failing.

This is the contactor module with the cover removed. The two problem capacitors are blue:

image

They can be removed by carefully snapping them off with pliers (they have very thin leads):

image

The battery is unstable without any Y capacitors - the contactors may drop out after 1-2 hours with an insulation resistance error. Replacing the two 90nF capacitors with two 4.7nF Y-rated capacitors seems to reduce (but not completely eliminate) these errors. This can either be done by soldering them to the wire stubs left behind after removing the old capacitors, or adding them elsewhere (eg, on the plug side of the HV connection).