facebooktwittergoogle_pluspinterestfacebooktwittergoogle_pluspinterestby feather

App: LeafViz

Published: March 2017

Most Recent Update: November 2017


LeafViz was created to visualize Leaf Spy data. Leaf Spy comes in three flavors, Lite, regular, and Pro. Lite does not log data to files, so you’ll need one of the other two to make use of this application.

Leaf Spy creates several types of logged data. LeafViz works with the TripChrgLog and the TripLog data. TripLog data can be historically reviewed, or use LeafViz in “Live” mode to monitor critical data as it becomes available. The App has tabs to select the desired data display type. “Viewer” is the visualization display.


Data can be displayed using the phone/tablet which also runs Leaf Spy, or can be viewed on a different display using a browser, such as a laptop or car display (if equipped). LeafViz has an internal web server used to serve up displays. To access, select the Server tab in the App to find the URL address:port. There is also a File browser/upload/download capability that can be enabled on that Server tab (Allow ‘…/Server’ access, example address is


The TripChrgLog and TripLog tabs are similarly constructed. At the top is a large “GO [type]” button to launch the viewer with the most recent data (“Now.csv”). This makes it easy to hit while in a car.


Also available are any older sets of data which have been logged over time (for TripChrgLog, by Quarter and Year, for TripLog, by Week of Month and Year). Simply tap a file to launch the viewer with that set. When using an external browser, it will display the last selected set. After selecting a new set, just refresh the browser display to review the new selection.

LeafViz takes the csv file data from Leaf Spy, breaks down older data into the aforementioned time period sets, except the recent data is made available in “Now.csv”. Also, if you have older data archived, you can ‘re-load’ it by uploading it into the Leaf Spy data folder. Navigate to the Leaf Spy data log folder (example below), click Choose File, select your archived csv on your laptop/PC, click Press to upload. After it completes, change LeafViz to the associated Tab and it will process the data as described, making it available to review.


Due to this design, you no longer need to transfer Leaf Spy data via Dropbox, nor separately manage the quantity of data that can be amassed. Leaf Spy does let you timestamp the filename, but then you have to manually aggregate data across that breakdown. LeafViz is designed to provide visualizations and a solution to manage the data.

LeafViz has a Maint(enance) tab. The first time you launch the App, after a few seconds it will take you to that tab, it will display the contents of the Leaf Spy data log folder (/ext/LEAF_BT_CAN/LOG_FILES or similar), and you can tell LeafViz which named csv file to use for TripChrgLog and TripLog. LeafViz will remember those selections from that point on. The tab also has a Backup and Restore functionality. Backup will separately zip up the TripChrgLog (TCL/Year/Quarter.csv) and TripLog (TL/Year/Month/Week.csv) files into TCL.zip and TL.zip. To make an off-phone backup, use the laptop browser to ‘View’ the file and it will store it to your laptop for safe keeping. You can delete excess data at any time using your phone’s File Manager. “Restore” simply unzips the TCL.zip and TL.zip file back in place.


Now, on to the data visualization displays. First, TripChrgLog.

  • TripChrgLog contains day to day charge event and trip information, including battery health, pack voltage, and trip details. Some of the charts use color to indicate condition.
    • Pack Amp Hours over time, Health (Hx) over time
    • Hx vs Amp Hours, Wh/mi over time
    • L1/L2 Events, DCQC Events
    • Starting and Ending Volts
    • Daily Total miles, Missing miles (not recorded with Leaf Spy)
    • Per Trip segment: Miles, Time, Average Speed

2017-11-18 15_32_36-Trip Charge Log

2017-11-18 15_37_28-Trip Charge Log

2017-11-18 15_39_38-Trip Charge Log

2017-11-18 15_40_48-Trip Charge Log

2017-11-18 15_41_53-Trip Charge Log

2017-11-18 15_43_00-Trip Charge Log

On the phone/tablet, the App’s Viewer can be two-finger zoomed to show the desired single or set of charts that you wish to monitor during a drive. You can also adjust that display while reviewing TripChrgLog and TripLog data as needed to make it readable. If not driving, just use a laptop browser at any scaling and with a mouse or touchscreen to not just view them but to interact with them. Turn on the “Brush” feature to let you select a subset of data on a chart and see how the other charts respond. You can also adjust the “Dot Size” larger to make it easier to see at a distance in a car, or smaller to better separate points of data. The ‘date’ related displays are not functioning as of yet. There is a “Show Page Table” checkbox that will show the data (full or selected) in a table.


Next, the TripLog data displays. There are quite a  few, and they are broken down into (presently) six slides.


  • TripLog contains per-trip data primarily on the traction battery pack, including individual cell-pair data and temperature. There is also data on tire, ambient, and motor temp. The specific displays and slide location may change as the application is refined.
    • Main
    • Cell Pairs, Advanced
    • Cell Pairs, Basic
    • Pack Data
    • Pack VxA
    • Tires

“Main” has 14 charts. Gids, a Cell-Pair chart, Hx, SOH. Motor, Pack and Ambient Temps. Max and Min V by Amps and over Time. 12V battery Volts and Amps over time, and pack KW draw over time.

Gids and the Cell-Pair difference chart labelled (Cell Pair Diff * KW) by Min V top the display. While Gids is straightforward for a LEAF owner that uses Leaf Spy — it’s how many ‘units’ of Battery capacity are left — the other display requires a bit of explanation. Leaf Spy calculates a Cell Pair difference value. It is usually helpful in knowing that the cell pairs are relatively close in voltage. This ‘diff(erence)’ is how much they are not the same, from best to worst (highest to lowest). Unfortunately they are not all sampled at the exact same time, so things like acceleration of the car (high throttle input) can induce large swings in the value. LeafViz attempts to identify and eliminate swings in the data. This chart uses the filtered data, and plots it against the Minimum Voltage Cell-Pair, but scaled by the KW-draw on the battery pack. When samples are far off the the right, that is during events like peak acceleration. But when they drop down lower and turn from green to orange or red, then one or more cells may be dropping down to an undesirable point.

2017-11-18 17_45_14-Main

If you turn on Brushing and select those points, you can see when they occurred during the trip and where they relate to Gids, for example. At a higher Gid level there’s no issue, but if Gids is very low you might be risking a turtle/shutdown if a cell drops too low.


Not all of the charts will be shown and described here as many are straight-forward. The above sample was shown to illustrate the visualization chart brushing/selection capability. Below is a bitmap that shows the lowest cell-pair voltage at each point along the trip, along with the Pack Amp draw below it, and to the right, the 12V voltage and the DC-to-DC charging rate below it. The latter could benefit from some smoothing/filtering.



TripLog slides also have a “Set” selector that TripChrgLog does not.


By default TripLog shows the most recent Set (here, 10 of 10). The data in TripLog’s “Now.csv” file is limited to the past week or so. Although many trips are separated by half a day or more (each is a separate set), some trips are “segments” of what could be called an “errand trip”, where you make several stops. These, when they are within an hour of each other, are grouped into one “set”. In the Gids chart below, 3 segments of a 2-stop errand trip are visible.


The “Sets” selector has an “All” selection. If you choose that, then all sets in the selected data are combined into the display. That can expose trends or other situations. Below are the Gids and 12V Amps charts, showing the past week or so of data. In the Gids you can see that two of the trips dropped down below the 33% point where a LEAF stops reporting changes in Hx.


In the 12V Amps chart, you can see that sometimes the solar panel equipped LEAF SL doesn’t need much of a charge in the afternoon (or in the morning if freshly charged), but at other times needed more extensive charging. To see a particular profile, select the corresponding set (1-10 from left to right).


In this set of Tire pressure difference charts, you can see there is a slow leak in one of a set, while the other set is sufficiently balanced. Time to get it fixed or at least replenish. The outliers are caused by initial sample differences when the LEAF first starts moving, it takes time to update all 4 tires in the system.


First Use

As briefly mentioned earlier, when LeafViz first starts up it will transition after a few seconds to the Maint tab to allow selection of the required TripChrgLog.csv and TripLog.csv files. First, briefly the Viewer page is displayed with the contents of the ‘home page’, which is also displayed when a laptop browser is first connected. Normally when LeafViz starts, it will show the last displayed page. This allows orientation changes and switching between apps without losing the desired choice. On the TripChrgLog, TripLog, and /Server browser pages the “Root” link refers to this initial page.


 The application menu has two choices. One, choosing a background color preference for the App web browser. And the other allows Resetting to the Install Contents – after an App upgrade, this is required to update to any html/slide/chart changes. On phones without a ‘menu’ key, fling the page up to reach this menu.

Internal Web Server

LeafViz contains a WebServer, which by default only serves up content from LeafViz. When the server is running, the IP address and port# is displayed at the top of the screen (Server tab). LeafViz has the capability to let other devices on the same network access the server. Then type [displayed ipaddr]:5555 into the web browser on any networked device. The page displayed on the laptop browser will be the same as on the LeafViz application on your phone/phablet/tablet. The advantage is a larger display screen for reviewing the data, and availability of a mouse for finer-grained selections (if brushing). IE10 or newer, Chrome, etc all work with the display. IE9 and lower does not.


There is a server option to allow access to browse/upload/download *any* files on the external drive for the device running LeafViz. To enable, just check the “Allow ‘…/Server’ access, then type [displayed ipaddr]:5555/Server into the browser on the other network device. If you have multiple devices that have LeafSpy+LeafViz, you can set the “Greeting” displayed to differentiate.

On the “/Server” pages, click on a folder name to change folders (and “../” to navigate up a folder level), on a file to download/view, or scroll to the bottom to upload a file to the current folder. Presently there is an Append functionality that allows adding onto a file; it is primarily for development purposes and is not a simple append.

In the bitmap below, you’ll see there is a mix of timestamped files and a non-timestamped file. LeafViz prefers the latter.


facebooktwittergoogle_pluspinterestfacebooktwittergoogle_pluspinterestby feather

Leave a Reply

Your email address will not be published. Required fields are marked *

eighteen − fifteen =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>