Jump to: navigation, search

Leaf Battery Application


Overview

LEAF Spy, formerly the Leaf Battery Application, is a software program that runs on most Android phones. The program displays information from the CAR-CAN bus. The information is read using a Bluetooth OBDII scanner plugged into the Leaf's OBD port and a Bluetooth connection to the phone. The software was written by Jim Pollock (Turbo3 on the mynissanleaf forum). The latest version can be downloaded here. 3 versions are available. One is free and gives the basic battery info.


The program provides:

  • Gids as a raw number or a percentage of 281 (the usual maximum reading of a new Leaf)
  • The percentage state of charge (SOC)
  • Information on the voltage of each of the 96 cell pairs in the battery pack
  • Which cells have their shunts currently active (this is the battery balancing) - there is some disagreement about which setting correctly shows which cells have shunts active. Gary Giddings believes it is 4812, GregH is sure it is 8421. You can choose which order is used on the Settings Screen of the application.
  • The maximum difference in cell pair voltages (tells you whether the pack is well balanced or not)
  • The voltage of your 12 volt battery (requires calibration with a voltmeter)
  • The readout from each of the temperature sensors in the battery pack (4 sensors for 2011-2012, 3 for 2013)
  • Tire pressures with optional warning if they get below a set value

Additional calculated values:

  • kWh remaining in the Leaf battery pack
  • Watt hours used by the Leaf since you last reset it
  • Temperature difference between highest and lowest temperature reading from battery pack sensors
  • Distance to empty based on your personal settings for efficiency (miles per kWh) and the amount of energy you want to leave as an emergency reserve

In addition, there is a logging function so you can monitor the change in parameters every one minute to one hour (time interval can be set by user). The log file can then be imported to a spreadsheet so you can graph the changes over time.

Required Hardware and Software

In order to use the Leaf Battery Application, you will need the following:

Android Phone or Tablet

You need an Android phone or tablet with Bluetooth and WiFi capability, and one which has Google Play to get applications (or you can use a wireless connection with your phone and a wireless router or other connection to get the application). An iphone will not work.

Note: the phone does NOT need to be activated to use the Leaf Battery Application which means you can use "prepaid" Android phones and not activate them.

The following phones and tablets have been specifically tested and reported to work, but nearly any Android device with Bluetooth that can "side-load" an app will work:

  • Android 4 virtual machine in Parallels 8 on a Mac
  • Android 4 virtual machine in VirtualBox on Windows
  • Asus Nexus 7
  • AT&T Fusion 2
  • HP Touchpad running Android
  • HTC Droid DNA
  • HTC EVO 3D
  • HTC Vivid
  • Kindle Fire HD 8.9" tablet (must side-load the app)
  • LG Optimus Elite Virgin Mobile
  • LG Optimus V Virgin Mobile
  • LG Optimus S Sprint
  • Motorola Droid running Android 2.2
  • Samsung Galaxy Nexus
  • Samsung Galaxy S Relay 4G
  • Samsung Galaxy S2 (running Android 4.1.2)
  • Samsung Galaxy S3
  • Samsung Galaxy S4
  • Samsung Galaxy Tab II 7.0"
  • Samsung Droid Charge 4G
  • Sprint EVO 3D
  • Sony Xperia Z
  • Verizon Droid (Running CyanagenMod 7)
  • Verizon Droid X
  • Verizon Droid3
  • Verizon Droid4 (running Android 4.1.2)
  • Virgin Mobile Kyocera eVent
  • Virgin Mobile EVO V 4G
  • Vizio Android Tablet
  • Hisense Sero Pro 7 Android Tablet


See also the "Leaf Battery App Device Status" PDF file.

Clone ELM327 Bluetooth Scanner

There are a number of different ELM327 Bluetooth scanners available on the internet for $10-25. While most are likely to work with your phone, in a few cases a user had to buy a second one from a different source, either because of an incompatibility between the scanner and the phone, or in one case because the product was defective. There are two reports that the ELM327 scanner from the eBay seller "newlauch" did not work. Some scanners using v2.1will not work with the app. Turbo3 is suggesting to stay away from all scanners using v2.1.

The following ELM327 products have been reported to work:

The Simvalley that has the on and off switch and Newest ELM 327 do NOT work with the HTC One S. Using the Turbo 3 app.


The Vgate ELM327 can be modified to switch it from "always on" to only on when car is in On mode or Ready mode (although from the testing LEAFfan has done, this does not appear to be necessary):


To convert the "stubby" dongle to operate off of the switched 12v power, rather than always on, just:

0. Fully test the unmodified dongle first.

1. Cut out or remove the label to expose the 4 screws. I cut out 4 small disks of the label, one over each screw, as is shown on the first post of this thread.

2. Remove the 4 screws with a medium Philips screwdriver. Clean the extra plastic out of each screw's threads.

3. Lift the lid straight up and off the bottom. Removing the OBD connector from the bottom might make the next step easier. I usually unplug the wire's connector from the board.

4. Carefully un-solder the wire from pin 16, and solder it to pin 8. Inspect your work.

5. Reassemble. Replace the OBD connector (if removed), making sure that the wires are well clear of the Bluetooth antenna.

6. Replace the top, and the 4 screws, turning the screw counterclockwise until it clicks, and then clockwise to screw it in (not too tight).

7. Mark or label the dongle to indicate what modification you made.

8. Test the modified dongle, and mark it as tested.

Extension Cable or Splitter Cable

You probably want to use an extension cable or splitter cable so that you don't have to keep plugging and unplugging the OBDII Scanner because:

  • The Leafs OBD port is not designed for frequent use, so you want to plug in a cable which can be replaced if the socket at the end where the scanner is plugged in wears out
  • You don't want to damage your OBD port, which is also used by Nissan Service during the Battery Pack check and probably to diagnose and repair other problems
  • If you plan to run a Gid Meter or similar device simultaneously with the Leaf Battery Application you will need the splitter cable. Otherwise, an extension cable will work fine. If the end of the cable that plugs into the OBD port has the cable coming straight down the cable may interfere with your access to the pedals. Use caution here. A better option would be to have the cable come out the side of the socket as is done with the original Gid meter. If you are unable to locate a splitter with a right side plug, a good option would probably be to combine an extension cable with a right side plug along with a splitter cable. The combination would provide better clearance where the extension cable plugs into the OBD port, and less extra cable to deal with after the split. If you don't need the splitter, the short extension cable alone will help to protect your OBD port from frequent plugging and unplugging.

JPWhite reminds us that good cable management is important for both aesthetics and safety. The 3.3 feet extension cable listed below that he purchased has a right angled cable connection at the OBD interface (which keeps it away from his feet) and can be attached to the underside of the drivers side dash using Ativa Cable Clips. See the following routing he did from the OBDII outlet to the center console where he keeps the ELM327 in a cup holder:


Cable Clips 1.png

Cable Clips 2.png


The cable can be inserted and removed from the clip multiple times. So if you are concerned the dealer service dept will question having a cable plugged into the ODB Port, the cable, ELM327 and Android phone can all be removed from the car in 30 seconds and they are none the wiser.

Right angle OBDII male to female 16 pin extension cables

  • Generic 100 CM/3.3 feet - Fulfilled by Amazon - $9.47 - Tested by JPWhite; optimal because the cable exits toward the front of the car, away from your legs. This cable is also thinner and thus more pliable which helps with cable routing.


Note: other cable extensions removed from this list as they either have thick cables which are difficult to route or the cable exits the OBD connecter in a direction that interferes with the safe operation of the Leaf

OBDII male to female 16 pin splitter/Y cables

  • Generic 1 foot - Fulfilled by Amazon - $10.10 - Tested by Stoaty; he recommends this splitter cable along with the extension cable tested by JPWhite
  • ZITrades branded 3 feet - Fulfilled by Amazon - $20.35 - Tested by Stoaty

Optional Phone Holder

You may want to get a holder for your phone so you can attach it in a convenient and visible place. One possible piece of equipment suggested by a forum member is here. While the photos are better on that site, a cheaper price is here.

Leaf Battery Application

The latest version of the application. Note that the version with "FS" at the end is the fullscreen version (no android menu at top of screen (that is the only difference).

Setup

Download and Install the Leaf Battery Application

If you have a cell phone that is activated and has WiFi active, you can go straight to the dropbox account and get the latest version. Otherwise, you will need wireless access through a wireless router or at a business that has WiFi. Make sure that WiFi is active on your phone (press Settings button--lower left button on Fusion 2 phone--then select Settings -> Wireless and Networks -> check box for Wi-Fi). Click on Wi-Fi Settings and select a Wi-Fi Network to connect to. If the connection is Secured, you will have to enter a password. If you need more detailed information on getting started with an Android phone see this thread.

Pairing

1. Plug in the ELM327 device to the OBD connector, and turn the car On as if to drive it (to Ready mode).

2. Power on the phone, open Settings, Wireless and Networks, tap Bluetooth, and turn Bluetooth On.

3. Under Bluetooth Settings make sure the Device is Discoverable. If there is an option for how long to make the device discoverable, set 5 minutes so you will have time to make the connection

4. If your device is not listed, Search For Devices (at the bottom of the screen).

NOTE: Since the ELM327 device MIGHT only be discoverable for a minute or so after it is plugged in, you might have to unplug it and plug it in again. Yes, some do wobble after they are plugged in, but that might just be the socket in the car, and it is normal, I think.

5. After being discovered, attempt to Pair with the device. When it asks for the pairing code, first try 1234, even if the instructions say 0000 (some instructions are incorrect). If that doesn't work, try it again, and even a third time. Finally try the other less common codes, the 0000 and then the 6789. Keep trying until you have a successful pairing here. Some have reported 6-8 tries to get a successful pairing, even using the correct pairing code.

6. Once it is Discovered and Paired here by the phone, it should show up in the Select OBDII list (from the "Menu" icon) in the app. Note: the pairing only needs to be done once.


More information on troubleshooting pairing problems can be found in this thread.

Precautions

There are several precautions you should observe when using the Leaf Battery Application with the ELM327 Bluetooth scanner:

  • As mentioned above, avoid plugging and unplugging the ELM327 scanner multiple times, as you could damage your OBD port
  • Be careful with the routing of any extension/splitter cables as your feet could get caught in them and cause an accident
  • Be extra careful when driving and looking at the phone to see data. One forum participant who thought he was being careful almost rear-ended another car. Turning on logging and analyzing the data later is safest.
  • While the application has been successfully used while driving by several testers (and no problems were encountered with operation of the Leaf) use at your own risk
  • There is conflicting information about whether leaving the ELM327 scanner plugged in draws enough current to run down the 12 volt battery. There are a couple of reports of batteries going down to 8 volts when the scanner was plugged in overnight. However, one of the reporters did more testing and concluded that the problem was related to having the ELM327 plugged in and having the phone on with the Leaf Battery Application running and communicating with the scanner. When he exited the Leaf Battery Application, he found no significant decrease in voltage for the 12 volt battery. Since then several other people have reported leaving the ELM327 plugged in for days to weeks at a time without changes in battery voltage. It is recommended that you only do this if you will be charging on most days (that is when the 12 volt battery will be charged). Unplug the ELM327 (or turn off if you have modified yours to allow this) if you will be leaving your Leaf for a longer period of time.
  • W A R N I N G for those who have a modified ELM that connects to the EV-CAN instead of the CAR-CAN. Version 0.26 and higher will not work on an ELM modified to run on the EV-CAN. It will get stuck at step 15 and not go to the CONNECTED state.
  • The LeafDD cannot be used simultaneously with the Leaf Battery App. You should not have two active devices on the same OBDII CAN at the same time even if they are on different CANs (EV,CAR). Remove one of them. WattsLeft is totally passive so is not a problem when using this app.

Instruction Manual

Overview

The Leaf Battery Application can receive data from the Leaf under either of two conditions:

  • Leaf is in Ready Mode (i.e., you can drive it)
  • One or more of the three dash charge lights is on/flashing (i.e., during charging or for about 5 minutes after you have set a charging timer)

You can get the Leaf into ready mode by:

  • Foot on brake and press ON button (key in car)
  • Foot off brake and press ON button twice

You can get the dash status lights to go active by:

  • Pressing timer override button
  • Unplugging and replugging charge cable
  • Timer charge starts or remote charge activation

The application has 4 data screens and a settings screen:

  • Screen 1 displays the cell pair voltages and battery pack temperature sensors
  • Screen 2 can be toggled between two different screens (2A and 2B). Screen 2A displays a histogram of the cell pair voltages showing the number of cell-pairs at each specific voltage. It should be shaped approximately like a bell curve. Screen 2B displays a color coded bar graph of the 4 temperature sensors. Select Screen 2A by tapping on the top half of the screen; select Screen 2B by tapping on the bottom half of the screen.
  • Screen 3 displays SOC%, Gids, usable kWh remaining in the pack, energy used since last reset, battery pack temperature (choice of minimum, maximum, or average), and distance to empty (DTE) based on your selected efficiency
  • Screen 4 displays approximately the same information as screen 3, except that it uses graphical elements and shows the individual battery pack temperature sensor readings. It also has motor RPM and readings from the four tire pressure sensors
  • The Settings Screen allows you to customize the application - select imperial or metric units, set screen colors, lock to portrait or landscape mode if desired, enable logging, calibrate the 12 volt battery voltage, and debug.

Navigation

  • When you start the Leaf Battery Application, the application will attempt to connect with the ELM327 that you paired with during setup. You will see a sequence of messages during the process: "Waiting 4 BT..." (if Bluetooth was not already enabled on your phone or tablet) => "Waiting 4 ELM" => "Service Start" => " Waiting 4 Leaf" => "Connected". If this is the first time the app has tried to connect to an ELM there will be a message "Select OBDII".
  • There is also "Offline" mode. To enter Offline mode:
  1. Start app and make sure "Auto Enable Bluetooth" checkbox is not checked on Settings/System panel
  2. Exit app
  3. On Phone/Device turn off Bluetooth
  4. Start app and you will get the message "Do you want to Enable Bluetooth?"
  5. Answer "No"
  6. You are now in "Offline" mode. Since Bluetooth was off and you did not allow the app to turn it on the app can not communicate with the ELM.
  • The four screens are represented by four small dots in the lower left hand corner of the screen. The open circle indicates the currently selected screen. To change to the screen to the right of the current screen, swipe the screen horizontally from right to left with your finger. A left to right swipe moves to the screen to the left of the current screen. Note that the swiping wraps around from last screen to first screen or vice versa. Alternatively, tapping the screen indicator in the lower left corner of the screen steps to the next screen. A tap and hold will step back to the previous screen.
  • Screen 2 can be set to one of two choices: Voltage Histogram or Battery Pack Temperature bar graph. Tap the screen to toggle between them.
  • To access the Settings Screen, press the Settings button on your phone (usually the lower left button), then tap Settings. To leave the Settings Screen, press the back button on your phone (usually the second button from the right).
  • The Back button will exit the application if pressed from Screens 1, 2 3 or 4.
  • When you restart the Leaf Battery Application, the last values from the previous session are displayed until you connect to the ELM327 scanner and receive new data.

Screen 1

The red bars represent those cell pairs that have the shunt active to bleed off some of the stored energy and balance the battery pack. This is still a work in progress.

The Approximate Remaining Battery Capacity % (the value in parenthesis between the AHrs value and the Battery Health value at the top of the screen) is just the AHr rating divided by a constant that the user can modify in Settings to represent what a new battery would have. Each Leaf is a little different so you can not use one constant for all. However, there must be a value used for this calculation, so the default is the value where most gen 1 Leafs would be <=100%.

Screen 1.png

Screen 2A

Screen 2A.png

Screen 2B

Screen 2B.png

Screen 3

Screen 3.png

Screen 4

Screen 4.png

Settings Screen

Screen is scrollable, shown below in several different portions with phone in landscape orientation

Settings Screen 1.png

Logging

  • You do not need a micro SD card installed in the phone in order to do logging
  • The log file can be accessed using the File Explorer app on your phone. It will be in a folder named "LEAF_BT_CAN" and will be named "BatLog.txt"
  • One way to transfer the log file to your computer is to install the free Dropbox application through the Google Play app on your phone. If phone is not activated, you will need a WiFi connection (such as through your wireless router)
  • The full resolution SOC and AHr are saved in the log file. For example, the log shows SOC=800065 after a charge to 80% and a AHr=616115. You need to divide each of them by 10,000 to get SOC% and AHr.


The Leaf EV-CAN bus must be active and the app must receive good data to a pack voltage request for a log event to take place (given that the selected interval has occurred or the force logging button was pressed).


The EV-CAN bus is active when:

  • One or more of the three dash charge lights is on/flashing.
  • Leaf is in Ready mode


You can get the dash status lights to go active by:

  • Pressing timer override button
  • Unplugging and replugging charge cable
  • Timer charge starts or remote charge activation


You can get the Leaf into ready mode by:

  • Foot on brake and press ON button (key in car)
  • Foot off brake and press ON button twice


Here is a screenshot of the log data imported into a spreadsheet. Note that the columns for Pack Temperatures 2 and 3, and the columns for Cell Pairs 2-95 have been removed to make it easier to see the data structure:


BatLog.png



Settings Screen 2.png


Settings Screen 3.png