Search:

SOC Display

SOC display for 2011 Nissan Leaf

The first generation Leafs did not show the battery State of Charge accurately on the dash. There's the 12 blue bars on the right by the range estimate but that's all. After 2012 they added a SOC% feature to the main dash. This project replicates that feature.

Most people just use the LeafSpy app on a phone to address this shortcoming. In my case the phone I was using stopped connecting to the Bluetooth dongle I had. I also didn't like faffing about with a phone to get this basic information. The phone needs to be mounted on the dash, it needs to be kept charged, and the user interface on LeafSpy isn't great.

So my goal is to have a SOC display integrated into the dash with no extra fiddling about. It should just turn on when the car does and require zero effort on my part.

This project is based on the CANa Display for Nissan LEAF project which is beautifully simple and straightforward. All I've done is change the code to make it work with a nice OLED display that will fit inside the eyebrow dash. It is powered by the OBD2 port in such a way that it only works when the car is turned on. [Note: the dongles that are used with LeafSpy run 24/7 unless you manually turn them off - which is a security risk.]

[Note: the SOC figure shown on this display is the same as is shown on LeafSpy, which is slightly different from that shown on the dash of the 2013 Leaf! This project displays raw SOC as reported by the EV-Can bus. In my case when I do a full charge it displays 94.8%. Whereas a 2013 Leaf (and newer) will adjust the SOC displayed so that it shows 100% after a full charge - even if you've lost battery capacity. This means you can't see the slow battery degradation reflected in the stock SOC% figure, but you can on the display from this project.]

Parts list

  1. 10-16V to 5V DC-DC step down Buck converter
  2. NiRen MCP2515_CAN bus board 8MHz
  3. Arduino Pro Mini 328, 5V/16MHz version [I used a CH340 UART Serial Converter Cable to program the Arduino. Alternatively you could use a Arduino Pro Micro which has built in USB communications)
  4. OLED display 128x64 pixel monochrome OLED display (0.96 inch or 1.3 inch)
  5. OBD2 plug (male)
  6. 7-way ribbon cable
  7. 40 Pin 2.54 mm Right Angle Single Row Pin Header Male
  8. Dupont-style jumper wires
  9. a plastic box to house the electronic bits

Optional:

Note: these links are to Aliexpress - if you want the items to arrive faster search for similar items on Amazon, EBay, TradeMe, Banggood, etc.

Circuit description

Power for the system is provided from the OBD2 port - pin 4 (ground) and pin 8 (switched +12 from battery). Note pin 8 is a switched +12 on the Leaf. The OBD2 standard power is on pin 16 - but it's always on 24/7.

The power goes straight into a step down module that provides 5V for everything; the MCP2515_CAN, the Arduino Pro Mini and the OLED display.

The Leaf EV-CAN signals come via OBD2 pins 12 and 13. The OBD2 standard CAN bus signals are on pins 6 and 14 - which, in the case of the Leaf gives the Car-CAN bus.

The EV-CAN signals go into the MCP2515_CAN module - which is connected to the Arduino via 5-wire SPI.

Arduino code and STL files

The Arduino code is on Github: https://github.com/PaulKennett/LeafSOCdisplay

I've also got some STL files on Github for a 3D printed frame to hold a "standard" 0.96 inch OLED 128x64 display rotated 90 degrees (so that it becomes 64x128 pixels). I'll add more frames as I go. I'm aiming to find the biggest OLED that will fit inside the dash. You can use black electrical tape but a black 3D printed frame looks a wee bit better.

ArduinoDisplayArduino codeSTL file
Pro Mini0.96 inch OLED 128x64 SPI busYesalmost
Pro Mini0.96 inch OLED 64x128 SPI busYesYes
Pro Mini1.5 inch OLED 128x64 SPI busYes 
Pro Mini1.54 inch OLED 128x64 SPI busYesalmost
Pro Mini1.3 inch OLED 128x160 I2C bus  
Pro Mini1.5 inch OLED 128x128 I2C bus  
ArduinoDisplayArduino codeSTL file
Pro Mini1.44 inch colour TFT 128x128 SPI busIn progress 
Pro Mini1.8 inch colour TFT 128x160 SPI busIn progress 

And that's about it. I'm assuming you already know how to get code onto the Arduino.

Installation

I chose to install the OLED display over the top of the efficiency trees on the Leaf's "eyebrow" dash. The trees don't serve a critical function so it's no great loss. I stuck a piece of wide black electrical tape over the trees, then used double sided tape to stick the OLED display onto the black tape. (Note: electrical tape is usually easy to remove so you could remove all this if you needed to.)

To install the display inside the dash you'll need to remove the dash and unclip the clear plastic front. See Nissan Leaf Instrument Cluster Removal for an explanation of how to remove the dash.

I also used a craft knife to trim 1mm off edge of the dash to allow the 7-wire ribbon cable to exit cleanly. Clip the dash front back on thread the ribbon cable down past the lower dash.

Next you'll want to remove the lower dash panel, see Nissan Leaf 020 - ETC replacement options. Once that's open you can attach the OLED ribbon to the Arduino and zip-tie the electronic modules (in a plastic box maybe) somewhere where they won't rattle and then connect the OBD2 plug to the socket.

Some pictures to help:

The eye brow dash removed and separated into three parts (they just unclip apart)

Wide black electrical tape over the trees part of the display - try to avoid including any dust particles, or you'll get bumps like I did.

0.96 inch display mountain inside 3D printed frame. Held in place with double sided tape. I also cut out a small segment of the dash edging to let the wires pop out.

Clip the dash back to together and plug the display into a 60 cm long extension cable. Use whatever connectors you can find. Ideally they should clip together so they can't just wiggle loose.

Feed the extension cable down past the steering column and put the dash back in place.

In a right-hand drive Leaf partially remove the right knee panel beside/below the steering column to find your extension cable.

Plug the OBD2 plug in and carefully throw the Arduino and bits in there somewhere and slap the panel back in place. (Or you could spend more time and do a tidy job.)

Turn the car on and enjoy the extra info.

Further reading

I hope you found this helpful.

Cheers, Paul



Todo

  • Swap for 1.3 inch OLED display (still 128 x 64 pixels but larger pixels so easier to see from the drivers seat distance
  • DONE - Remove start up screens. The CAN connection error page should stay on forever though.
  • DONE - Rename variables in code so that rawGids = Gids value from EV-Can and rawSOC = SOC value from EV-Can (currently the variable for Gids is called "Soc")
  • DONE - Only start displaying numbers once they have been loaded from the CAN module , Michelle looked at the display when she started the car and saw it was zero, so assumed it was broken and therefore did not look at it again. To avoid this user confusion itís best not to show zeros during the loading period. [So only display digits when they are do not equal zero (if !=0 then display)]
  • Low SOC mode - when SOC goes below 10%
    • show Lowest cell voltage
    • DONE - indicate Gids turtle, and somehow indicate threshold of turtle mode [Turtle mode (at 8 Gids) which is now what my "0 %SOC" equals
    • DISREGARD - show SOC to 2 decimal places [even though the SOC can be presented to two decimal places it's not accurate enough to justify that level of precision. Sometimes vagueness is more truthful.]
  • what about a high temp mode - for when the temp goes above 50 degrees C?
    • show highest temp from battery pack
  • Try larger OLED or color TFT display? I have a 128x128 1.5" OLED display on order (https://www.aliexpress.com/item/33058101072.html)
  • Try connecting to the Car-CAN to access more data fields. Maybe have a separate display for this?
  • Flip the Fleet mode: show data needed for Flip the Fleet from LeafSpy. Element are:
    • SOH (%, 2 decimal places)
    • Ahr (Ahrs, 2 decimal places)
    • Hx (%, 2 decimal places)
    • QCs (whole number)
    • L1/L2 charges (whole number)
    • mV spread (mV)
    • SOC (%, 2 decimal places)
    • Temp (degrees C, 2 decimal places)
    • this would be much easier to implement if I connected to the Car-CAN instead (or switched to the car can
  • Accurate speedo? - is this only available on the Car-CAN bus?

Notes

Here's the first version with the 0.96 inch OLED 128x96 display oriented in normal "landscape" mode:

This version also used black electrical tape to hold the display in place - which works surprisingly well. The 3D printed frame looks more professional though.

Gids

  • Theoretical Max Gids: 281 Gids (In a "24" kWH 2011/2012 model Leaf)
  • My Max Gids: 235 Gids (In my 17 kWH 2011 model Leaf)
  • Low Bat Warning: 49 Gids (Range starts flashing)
  • Very Low Bat Warning: 24 Gids {Range shows three dashes)
  • Turtle: 4 to 8 Gids
  • Car stops: when lowest cell voltage drops below some 3.? Volts

Theoretically 1 Gid = 80 Wh but others say 74.73 Wh


Page last modified on 18 November 2019 at 10:53 AM