Turbo3
Gold Member
Posts: 1775
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Using clone ELM327 Bluetooth OBDII adapter with Leaf

Sat Mar 30, 2013 4:40 pm

Warning: This app will only work with original unmodified ELM327 devices connecting to the CAR-CAN.

9/12/2013 The Leaf Battery app has been renamed "Leaf Spy" and is now available on Google's Play Store. There are three versions:

* Leaf Spy Lite - https://play.google.com/store/apps/details?id=com.Turbo3.Leaf_Spy_Lite (Free)
* Leaf Spy - https://play.google.com/store/apps/details?id=com.Turbo3.Leaf_Spy1 ($9.99)
* Leaf Spy Pro - https://play.google.com/store/apps/details?id=com.Turbo3.Leaf_Spy_Pro ($14.99)

Please use the two new forum topics to discuss the Leaf Spy app. Not this one which is way too long now.

The free Lite version has only screens 1 & 2 and no logging. Use it to verify that you have the correct hardware that works with the app and your Leaf before buying either of the more advanced versions. I don't want you spending money on something that is not going to work for you.

The current version is v0.27
* Fixes bug where app would crash or do other strange things on exit (All versions)
* Lots of other small fixes (All versions)
* Battery temperature thermometer is now functional (full and Pro versions)
* New Service menu that lets you do the following: (only in Pro version)
- Change automatic door lock/unlock settings
- Read Diagnostic Trouble Codes (DTC)
- Register Tire locations, required so Leaf knows location of each tire after tire rotation or seasonal swap
- (future) Clear selected DTCs


Features/Fixes in v0.26c
* Version number is correctly reported by Android
* Touch area to cycle DTE now includes the label under the DTE value
* Tapping the lower left corner screen indicator steps to the next screen. A tap and hold will step back to the previous screen

Feature added in v0.26b
* Screen 1 second line added better labeling for QC count and L1/L2 count if the screen has the room (normally in Landscape)

Feature added in v0.26a
* Tire Pressure Alarm max value changed from 40 to 50 PSI

Features in v0.26
* Better support for OBDII ELM 327 adapters
* Screen 1 displays new Health %, VIN number, QC count and Normal Charge count
* Real GIDs are now displayed
* Screen 4 - Now displays tire Pressure with user set Alarm level for low pressure
* By tappng DTE number on screen 4 you can select remaining distance to LBW, LVBW or Reseve level. The reserve level is user defined as either percent of capacity or a fix number of Whs.

It will take a little while before the user generated documentation is updated for all the new features in this version.

Start of user generated documentation.
http://www.mynissanleaf.com/wiki/index.php?title=Leaf_Battery_Application

Screen 1 - Battery Cell Pair Voltages (red color means cell being balanced)
Image

Screen 2A - Battery Voltage Histogram
Image

Screen 2B - Battery Temperature (tap screen 2 to toggle between 2A and 2B)
Image

Screen 3 - Original Summary (no change to this old screen)
Image

Screen 4 - Summary
Image
===========================================================================
Here is what a couple of these adapters look like. The mini cost me $14.74 on eBay. They are based on the original Elm Electronics ELM327 chip that has been cloned using a PIC processor. They display firmware version 1.5 but the highest one produced by Elm Electronics was 1.4b.

Image

I was asked by a BayLeaf member last year to look into the possibility of using one of these to monitor the Leaf SOC. He even loaned me the one he had. It sat around for a few months before I had time to look into it. My first thought was that I would need to move the CAN bus monitor wires from the standard CAR-CAN to the EV-CAN. It was not obvious how to open his unit up so I decided to just buy my own so I would not damage his in the process.

As you can see in the pictures, opening it involves removing four screws covered up by the label. Rather than try to peel off the label I just punched through it. So moving the wires would not be a problem. But before I did that I decided that I need to see if I could read out the VIN number though the CAR-CAN so I did not move the wire at this time.

I needed the VIN for another project (CANary) to add to the Cell Pair Voltage log file I am creating (that is now possible due to the work of GregH and TickTock).

So far I have not had any success reading the VIN using the standard protocol but since I was play around with the commands I decided to see if I could read out the CP voltages. This is possible because in CAN traces taken by the CANary code we have seen that EV-CAN requests and responses are echoed on the CAR-CAN. So I figured that the opposite was true too and I could send the Cell Pair voltage request out the CAR-CAN and see the results on the CAR-CAN too.

My first try got me the first response packet with voltages for the first two Cell Pair (CP) voltages. Reading the ELM327 manual and changing the Flow Control message got me a second packet and 3 ½ more CP voltages. I have been stuck there for the last couple of days until I downloaded a few more specs with ISO 15765-2 holding the information I needed to make it work. The problem was that the ELM327 was not auto sending additional Flow Control messages to request the remaining packets.

The solution contained in ISO 15765-2 was I could modify the first and only Flow Control message the ELM327 is sending to request all the remaining packets. So I changed the Flow Control message to request all the data but delay each packet by 32 msec to give the ELM327 time to process it and send it out over the Bluetooth link.

So all you need to read out all 96 CP voltages in your Leaf is one of these ELM327 clone BT adapters and a terminal emulator program like HyperTerminal. It takes just 5 commands to do it. I added two more AT commands at the start to turn on displaying the message Header ID (always 7BB) and data length (always 8). I will write a little program to process a text file of the dump into the actual decimal voltages as they are dumped as two byte hex mV values.

Code: Select all

>at h1
OK

>at d1
OK

>at sh 79b
OK

>at fc sh 79b
OK

>at fc sd 30 00 20
OK

>at fc sm 1
OK

>21 02
7BB 8 10 C6 61 02 0F C6 0F CD
7BB 8 21 0F CC 0F C4 0F D5 0F
7BB 8 22 D1 0F CB 0F C4 0F D1
7BB 8 23 0F C6 0F C8 0F C4 0F
7BB 8 24 D2 0F D6 0F D2 0F D3
7BB 8 25 0F D2 0F C8 0F C8 0F
7BB 8 26 C9 0F D2 0F C8 0F CD
7BB 8 27 0F C4 0F D1 0F CD 0F
7BB 8 28 CC 0F C8 0F CD 0F D2
7BB 8 29 0F CD 0F D2 0F CF 0F
7BB 8 2A CF 0F D4 0F D2 0F C6
7BB 8 2B 0F CB 0F CB 0F C8 0F
7BB 8 2C C4 0F C4 0F C8 0F C4
7BB 8 2D 0F D1 0F CF 0F D5 0F
7BB 8 2E D1 0F CF 0F D1 0F D5
7BB 8 2F 0F C8 0F D4 0F D0 0F
7BB 8 20 D4 0F D1 0F D7 0F D2
7BB 8 21 0F C8 0F CD 0F C3 0F
7BB 8 22 D2 0F C9 0F CE 0F C4
7BB 8 23 0F CD 0F C4 0F C8 0F
7BB 8 24 CD 0F CD 0F CD 0F CD
7BB 8 25 0F CC 0F CC 0F CB 0F
7BB 8 26 C8 0F C4 0F CD 0F C3
7BB 8 27 0F C9 0F CF 0F CF 0F
7BB 8 28 D5 0F CD 0F D5 0F D1
7BB 8 29 0F DA 0F C8 0F CD 0F
7BB 8 2A CD 0F D1 0F D6 0F C8
7BB 8 2B 0F CD 0F D1 0F C1 97
7BB 8 2C CA 97 B6 FF FF FF FF


There seems to be a need for an Android app that uses ELM327 type adapters with the Leaf. Programs like Torque do not currently work and I had no luck with any of the other apps. It is not a problem with the ELM327 as I have had it do a dump all messages (filtered) to the termianl. You can filter for brake light on and see a message on the terminal.

I think these apps are looking for an engine control module and transmission control module at standard locations that do not match where the Leaf ECUs are located.

Jim
Last edited by Turbo3 on Thu Sep 12, 2013 9:18 am, edited 57 times in total.

User avatar
surfingslovak
Vendor
Posts: 3807
Joined: Mon Jun 13, 2011 1:35 pm

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Sat Mar 30, 2013 4:44 pm

Wow, this is great news, Jim. The ELM327 adapters are plentiful and cheap. Kudos!

Turbo3
Gold Member
Posts: 1775
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Sat Mar 30, 2013 4:50 pm

If you want to know the Pack temperatures (four of them) replace "21 02" with "21 04". See GregH post for format.

GregH
Posts: 856
Joined: Fri Jul 01, 2011 4:16 pm
Delivery Date: 13 Jun 2011
Leaf Number: 26967
Location: Irvine, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 9:00 am

That's pretty cool! Maybe we should be spending more time working on ELM327 bluetooth apps for our smartphones rather than new CAN display boards... hmm...
'17 blue Volt Premier w/ACC
'12 SL black Leaf
'11 SL blue Leaf
RAV4-EV 2002-2005
Gen1 & Gen2 EV1 1997-2003
PV 2.4Kw, 10kWh lithium battery SCE TOU-DA

User avatar
surfingslovak
Vendor
Posts: 3807
Joined: Mon Jun 13, 2011 1:35 pm

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 9:05 am

GregH wrote:That's pretty cool! Maybe we should be spending more time working on ELM327 bluetooth apps for our smartphones rather than new CAN display boards... hmm...

:o

User avatar
garygid
Gold Member
Posts: 12404
Joined: Wed Apr 21, 2010 8:10 am
Delivery Date: 29 Mar 2011
Leaf Number: 000855
Location: Laguna Hills, Orange Co, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 10:16 am

The ELM bluetooth might not have the bandwidth to handle
more than a selected subset of the CAN Messages, and from
one CAN bus only.

But, within those constraints, the iMiEV folks in France
have made some reasonable Android apps, using
a Basic4Android programming system. Quite nice.
See SOC/GID-Meter and CAN-Do Info
2011 LEAF, sold in 2015
2010 Prius, 2014 silver Tesla S
Nissan EVSE, mod to 240/120v 16A
PU: SDG&E
Solar PV: 33 x 225W -> 7 kW max AC
To Sell: X-treme 5000Li EV motorcycle

bradbissell
Posts: 264
Joined: Tue Mar 13, 2012 5:47 am
Delivery Date: 29 Mar 2013
Leaf Number: 404629
Location: Boston, MA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 10:23 am

What I would love to see is a simple iphone app that would show the same info as displayed by the Wattsleft meter. If this bluetooth module would allow that, all the better, since updating a phone app is much faster than building a new CAN board.
Silver/Black 2013 SV Manufactured, Leased March '13, Returned Dec '15
Silver/Dark Ash 2016 Volt LT

Turbo3
Gold Member
Posts: 1775
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 10:55 am

The limitation of the ELM327 is that it only connects to the CAR-CAN. However, it seems likely that all the requests that use message IDs in the 0x700 thru 0x7FF get echoed onto the EV-CAN. This is the case for the battery request messages. I need to look into the other three pack request messages to see if they contain SOC information. So it might be possible to make a subset of the WattsLeft type display for a smartphone but not an Apple product (iOS).

ahagge
Posts: 289
Joined: Mon Aug 30, 2010 8:38 am
Delivery Date: 02 Jul 2011
Leaf Number: 5175
Location: Northridge, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 12:28 pm

Turbo3 wrote:There seems to be a need for an Android app that uses ELM327 type adapters with the Leaf. Programs like Torque do not currently work and I had no luck with any of the other apps. It is not a problem with the ELM327 as I have had it do a dump all messages (filtered) to the termianl. You can filter for brake light on and see a message on the terminal.

I think these apps are looking for an engine control module and transmission control module at standard locations that do not match where the Leaf ECUs are located.

Jim
This may be the case. I'd asked the question in this Torque forum and it sounds like it might be possible to send a custom init string, but the way Torque is currently written, it sounds like it needs a valid response from request '0100' in order to validate there's an ECU present.

Perhaps someone knowledgeable with CAN and OBD-II could talk to the Torque devleoper in that forum to work something out. Torque certainly seems to be about the best (most customizable) Android app out there for the purpose. It'd sure be nice to be able to get SOC this way rather than a dedicated piece of hardware (at least for some of us).
Ocean Blue SL-e
Per LEAF Spy as of 03/16/17: 12 bars, 238 GIDs, 56.3 AHr on new (04/30/15) Lizard battery
Orig. battery lost 4th bar at 177 GIDs, 43.19 AHr, 44.74 Hx, 65% SOH after 45 months

ahagge
Posts: 289
Joined: Mon Aug 30, 2010 8:38 am
Delivery Date: 02 Jul 2011
Leaf Number: 5175
Location: Northridge, CA

Re: Using clone ELM327 Bluetooth OBDII adapter with Leaf

Tue Apr 02, 2013 12:30 pm

Turbo3 wrote:The limitation of the ELM327 is that it only connects to the CAR-CAN.
Wait - isn't that what you said you did with your unit - opened it up and modified it to talk on the EV-CAN bus (different pins)? Or are you saying that there's another limitation (other than the different pins)?
Ocean Blue SL-e
Per LEAF Spy as of 03/16/17: 12 bars, 238 GIDs, 56.3 AHr on new (04/30/15) Lizard battery
Orig. battery lost 4th bar at 177 GIDs, 43.19 AHr, 44.74 Hx, 65% SOH after 45 months

Return to “LEAF CANBus”