Skip to content
Christoph Schleifenbaum edited this page Feb 1, 2024 · 8 revisions

What is this

qleaf contains code to implement CCS charging on a Nissan Leaf (should also work on a Nissan e-NV200, but not tested). It supports even 3-phase-charging by using two additional TC chargers added.

Hardware needed

  • BMW LIM with CCS suppport (+matching CCS inlet, HV contactors, HV measuring board etc. pp)
  • Raspberry Pi (Pi Zero is fine)
  • Dual channel CAN bus HAT
  • A bunch of relays which can be controlled via the 3.3V GPIOs

See openinverter Wiki page for more information about the LIM

How to use this

Prerequisites

This code is intended to run on a Raspberry Pi running the default Raspbian. It needs an installation of Qt5 (QtCore + QtSerialBus). Note you need to install the developer packagages of these libraries.

Getting the code

In your home directory, do:

git clone [email protected]:cschleifenbaum/qleaf.git
cd qleaf
git submodule update --init

Compiling

cd nymea-gpio
qmake
make
make install
cd ..
qmake
make

Now you should have a qleaf binary file. Starting it will scan for CAN busses and search for devices.

Wiring things up

The software expects the Leaf EV CAN bus to be available on one of the CAN bus connections. It's a good idea to use use of the connections for the Leaf CAN bus and the other one for everything else. Connect the the other CAN bus connections to both the LIM and the Leaf's CHAdeMO port (pin 8 and 9).

The relays need to be connected the following way:

  • GPIO2 when high -> connecting LIM 4B-12 and GND (meaning charge flap open)
  • GPIO3 when high -> connecting CHAdeMO d1 (pin2) and 12V
  • GPIO4 when high -> connecting CHAdeMO proximity (pin7) and GND (simulating CHAdeMO plug inserted)
  • GPIO14 when high -> connecting CHAdeMO d2 (pin10) and CHAdeMO enable (pin4)

When splicing into the CHAdeMO connectors you can follow the wires behind the CHAdeMO connector to find a suitable spot. It is advised to first test with just putting the open cable ends into the CHAdeMO port before starting cutting into the wires. Use the fakechademo.sh script to test.

WARNING When the CHAdeMO simulation is running the HV connectors inside of the CHAdeMO port are live!

If you want the CCS inlet as a separate inlet, you're fine. If you want to replace your existing type1/2 inlet with the CCS inlet, you even need these:

  • GPIO15 when high -> connecting PP, CP and charge lock actuator wires (both) to LIM, when low to the existing onboard charger.

Note: If you have a type 1 vehicle and are replacing it with a CCS2 inlet, you will only need a new charging cable (obviously...) but you can only use cables coded for 32 or 63A! So if you want to change the contact in your existing cable (granny...) you need to put in a 220 Ohm resistor. 680 Ohm will not work and will make the on board charger believe you're pressing the button on the type 1 cable. Additionally, you can charge with an unlocked type 2 connector and pull out the cable while charging. That's bad for the connector. Don't do this. A solution for this is welcome!

The fakechademo.sh script

The fakechademo.sh script in the main directory can be used to test the CHAdeMO simulation working properly. It will close the relays in the right order and will open them again when you press Ctrl+C.

This will only work if you change the qleaf code slightly:

  • In chargingrelaycontroller.cpp, add a return right before the bool fakeChademo = ... line.
  • In leafchademoport.cpp, comment out the first two lines of the method LeafChademoport::prepareAndSendFrame()

Compile and restart the qleaf software and starting the fakechademo.sh script should result in your Leaf thinking it is being fast-charged.

WARNING: The CHAdeMO HV pins will be live!

Energy consumption

The Raspberry Pi running all the time will deplete your battery on the (not so) long run if left on with the car turned off. It should be switched off when not needed. I use this OVMS script to turn it on and off via a relay controlled by OVMS. Use an overlay filesystem to not hurt the Raspberry Pi's file system when just turned off instead of being properly shut down.