[W.I.P] Happy Leaf - ELM327 intuitive Nissan Leaf interface for Android Tablets

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

bmartin

Member
Joined
Dec 31, 2015
Messages
18
Hello Leaf community,

I've been writing an Android/iOS app that borrows interface elements from other Hybrid/EV cars to display data from a Bluetooth ELM327 OBDII device for the past month or so. It's really shaping up well, but before it's ready for the Google Play store, I have a lot of work ahead of me. I don't think I'll be able to perfect the ELM237 interaction without some insight and feedback, so without further ado, I present to you, Happy Leaf 0.2!

Happy Leaf is now on Google Play

If you would like to try the app out, please sign up for the beta. (iOS Testflight will be emailed after your Beta application)

(Updated images 05/01/17)
AHTpaowh.png

N4YsQUEh.png

KMwNKjPh.png

DQYsrUsh.png

01wXRhAh.png

mOdurloh.png

66axDXNh.png

mZqsnGxh.png


0.2

- [NEW] Battery Health notification
When the battery SOH changes a notification is triggered that displays the previous SOH, current SOH and odometer at the time of the SOH change.
- [NEW] BLE support for iOS
All BLE devices will show in "Nearby Devices"
Only tested on one model of BLE, please let me know if you can't connect. Please send OBD model.
- [NEW] Flow Manager
Dynamic message requests, based on priority. (non linear request order)
Higher priority messages will be requested more frequently than lower priority messages. Will eventually dramatically increase performance.
May be slower on some commands for now, more optimization will be required over time and future updates to fine tune the flow.
Connection/verification messages now through Flow Manager, increased reliability when trying to reconnect.
- [NEW] Wifi on/off (Android)
New in settings -> Connection -> Allow Wifi. Happy Leaf won't re-enable Wifi if this is disabled.
- [NEW] Distance / Temp unit override
New in settings, should convert units based on preference. Will still auto detect units and adjust accordingly.
Tested converting my U.S. LEAF to Km / C, seemed to work.
- Better, more efficient logging (should be no more memory leaks from logs)
- Fixed issue where newest data would be deleted, now correctly purges oldest data from memory. No longer time based, strictly based on 2,000 history limit.


0.1.8

- [NEW] Multi Language support
- [NEW] Two new notifications
Alert for rapid increase of battery temperature.
Alert for high battery output (>70kWh)
- [NEW] Setting for disabling OS notifications (on be default)
- [NEW] Offline mode
Use app without connecting to ODB device. Requires past history, so Bluetooth OBD still required for functionality. After initial connection, pressing the icon at bottom right of Welcome screen will transition to Home screen, even without Bluetooth enabled. (History still deletes after 24 hours)
- [NEW] Settings icon on Welcome screen.
- Adjusted font sizes on blue title/footer bars.
- Moved charging animation "cable" to right side of diagram, now charging voltage doesn't overlap with dropdown icon.
- Recalculated GID readings over 255. Currently untested, but may resolve GID issues where SOC > 80% but kWh remaining would be near zero (calculated from GIDs)

0.1.7

- [NEW] Save logs / history to sdcard or internal storage.
Disabled by default as this affects performance. Can be enabled from settings page.
Saves to /sdcard/Happy_Leaf/BETA/[date]-history.json and [date_time]-ODB-log.txt
These files will help me troubleshoot issues better
- [NEW] Notifications
New icon by settings, will have green badge showing unread notifications
Should send local notifications to device
Will only send the same notification after 30 minutes.
Currently has notifications for the following:
Low / High Tire pressures
Low / High Battery Temperature (-5c / 46c)
Low 12v Battery voltage
Low SOC (under 20%)
Low Hx (under 50%)
- Can now disable extra data (scrolling down), this should improve performance. (In settings)
- Updated colors, red on SOC meter not as bright, background color closer to white in light mode.
- Enlarged Motor watts / Climate usage charts. Shrunk SOC meter slightly.
- Fixed Tire layout to match reality.
- Cars using Km when manufacture set Miles should now see closer odometer reading
- Ability to delete history data, Settings -> Data
- Various checks to incoming OBD data to ensure consistency.
- Outside temp adjusted to documented spec, still doesn't match Leaf's display, but this could be due to a different thermometer being read. Found other codes that represent outside temp, but currently not implemented.

0.1.6
- [New] Dark Mode
Manually set theme via new menu button at top left of screen. (this override will persist until app is relaunched)
Automatic dark mode via Ambient light sensor on Android device
Settings for toggling light sensor, and sensor sensitivity.
Setting for Dark Mode following headlights on/off
- Better responsiveness
Most font now scales based on percentage of screen. Should look much better on any screen size, any orientation.
Fixed scaling causing app to be able to scroll sideways on smaller devices
Graph data points now average based on screen size. Smaller screens will be more readable when large amounts of data logged.
- Graph Visuals Updated
Data points are smaller now and don't have white border, much easier to read
Graph now displays kWh on left side, much easier to read
Slightly smaller legend
- If codes are failing to read, small circle at top right now turns orange. (green when retrying codes)
- Attempting to address issue where dash set units differ from manufacture units. If your odometer reading is off by ~60%, but displays the correct unit label.

C5xVUehh.png

1PK87BWh.png

0.1.3
Changed the default graph color
Added m/kw, watts/m and remaining KW%m/kw (ETA miles to absolute zero, based on trip m/kw)
Added total miles driven while app logging, and total miles today calculation.

(0.1.1 below)
nw2ZlSY.png

(Car off while charging, hence why GIDs/Kw remaining are blank)
SpoSbi4.png

zvqvdkh.png


I started writing this app midway through 2016. I chose the app framework (HTML/Angular/Phonegap/Cordova), but then came to a loss at what to send to the OBD connection to get real responses (anything but OK). Last month I came across a breakthrough in teaching myself the ELM327 + bluetooth spec, and began seeing data. This forum played a key role in forming my understanding and getting results, thank you everybody who made this possible. I'm using the spreadsheet here for CARCan/EVCan codes: https://docs.google.com/spreadsheets/d/1EHa4R85BttuY4JZ-EnssH4YZddpsDVu6rUFm0P7ouwg
Thank you TickTock, Turbo(s), Gary and others for gathering and sharing this knowledge.

In my daily life, I depend on the OBDII connection to track watts used, M/kw per trip, and occasionally diagnostic. I had so many ideas, and wanted to visualize the data deeper than currently available apps. After this breakthrough, the app started taking shape, and works better than I dreamed.

Happy Leaf's primary goal is to be a pretty interface for data, not a diagnostic tool. I created a Leaf diagram using SVG that holds tire data, SOC data, energy movement, climate usage, motor output, and headlight status. This is the meat of the app, it easily visualizes what is going on with the vehicle.

The interface runs extremely well on the two Android devices I have available to me. A $50 Kindle Fire 7" (Android 5.1.1), and a 2012 Motorola Photon Q (Android 6.0.1). Both are rooted and have custom roms, so your results may vary. I highly recommend a tablet for this interface, phones just don't have the real-estate and I haven't spent a lot of time optimizing (though the css wouldn't take long).

Charging Animation

d1Hr5VF.gif


Regen Animation

4l7S9P7.gif


Motor/Climate Usage Animation

pK5u3Cm.gif


Scroll down and see all data in real time

Rh8xYmW.png


Scroll farther, press the play button, and watch the logs

iqHAIs4.png


The app is clearly far from finished, but it's getting so close that I'm not sure how much farther I can take it alone. There's still many bugs, missing features, and currently slow query times.

If you are interested in testing this app, fill out the form here. There's still much testing/tuning to be done so it's results may vary.

If you would like to contribute to development, see the source code here

Thanks!
Happy Leaf'ing!
 
Reserved :D

I'm still unable to get certain codes, many EVCan codes I can't find or filter for, and I'm at a loss to any 792/793 codes. I can get detailed SOC with 7BB responses, but that's the extent of ATFCSH messages I'm querying for. I feel like I've read a good third of the OBD discussion on this forum, this has given me a pretty good footing, but many details of how to request certain codes, are not discussed, or my understanding isn't clear enough to make sense of what was discussed.


Here's what Happy Leaf is currently listening to:

Tire Pressures:
Headlights/Turn Signal:
SOH/GIDs: 5B3
Speed (Mph/K/h):
Climate Power usage (Watts), currently this doesn't match other apps or the OEM nav unit:
Transmission status:
Parking break status:
Motor Amps: 180
Motor Volts: 176



Here's the messages/data I need to complete the interface:

Battery current output: 1DB
Any Charging status indication (Plugged in, L2, QC): 100-109 or 5FB
Charging watts in (amps * volts): 1DC
These commands I can't seem to find, even when filtering for them directly.

At first I was reading 1 message at a time, it took over 12s to get a full round of messages (and I was only needing more and more), I discovered the use of ATCF. ATCRA, and ATCM, though ATCM isn't very useful at the moment. Now I do a loop with three or four filter/receive commands to get a second or two of message streams of various messages. At the end, I look for the 7BB SOC, and restart the cycle. In under 7 seconds I'm reading many more commands in more real time, the same message can come through ~10-20 times during that 7s block.

The Filters / Receive messages I'm experimenting with:
X and F are wildcard/don't care bytes

ATCF 5AF
ATCRA 5BX
This produces 58A, 5B3, 5A9

ATCF 62F
ATCRA 6XX
This produces 60D, 625

I then do a simple ATAR, ATCRA, ATMA to get a Buffer Full of codes. I do a few ATCM7FF, ATCF(MSG) requests for specific commands that I can't get in a mask/filter.

I still don't have the filters 100%, at this moment it is a lot of guesswork to get codes that align with interface needs. I'd really like to generate these masks/filters programmatically, but my understanding of how they are processed (Especially on the leaf) means for now I'm doing them by hand, in a linear array. I also want to be able to filter for a larger range of codes, while possibly excluding noise, and end the output before the buffer is full. I've attempted to add more bytes to ATFC, like ATFC180176(00), to attempt to filter for two or more messages, doesn't work like that. Telling the ELM to filter two or more message ranges at the same time would be golden. Maybe a complex mask?

At the moment, I've spent as much time on it as I can, and need to get feedback so I can refine the numbers. I'll be using this app daily, so will working on it in bursts. I'm willing to share source code, especially if there's anyone interested in digging into it, my end goal is to share this with others to improve their Leaf driving experience.
 
LeftieBiker said:
Looks good. A couple of suggestions:

Replace "true" and "false" with "yes" and "no."

Charge your 12 volt battery! It's near dead.

Thanks! That is an easy change.

I would love to replace that Lead Acid toxic hazard with a nice lithium pack.

DJFyEvX.png


I also added average speed to the graph, makes for some interesting visuals. (Need to change the color from that gray)
ZGXdMTc.png

oLtGQuw.png

(Battery temp isn't really 80 degrees, this isn't parsing correctly)
 
This is awesome... I have a large 6" display phone that I'd like to try it on. I've been using leafspy and it's great, not the prettiest app though.
 
I'd strongly suggest not showing GIDs by default and only show them for old timers that want to enable them from a options setting somewhere.

All that I pay attention to is %SOC, ahr, SOH%, kWh remaining (and the resultant calc of miles remaining)

Max GIDs and comparing GIDs from one car to another is a minefield as they are variable, not a fixed unit of energy.
 
claude274 said:
Had no charge amp/volts and would it be possible to put metrics? Great app! :D

Metrics should work, Km is read from the car and changes units automatically. Charging Amps/Volts may not work on 6kw charging at this time.


dhanson865 said:
I'd strongly suggest not showing GIDs by default and only show them for old timers that want to enable them from a options setting somewhere.

All that I pay attention to is %SOC, ahr, SOH%, kWh remaining (and the resultant calc of miles remaining)

Max GIDs and comparing GIDs from one car to another is a minefield as they are variable, not a fixed unit of energy.

I don't do any comparing GIDs to a "maximum value", but GIDs are actually the only way to calculate watts remaining (at least the OBD messages I can read). 1 GID = ~77.5Wh. I compare this with SOC to get SOC per GID, and fine tune watts left/watts used based on this.
 
I suggest you have an "expert mode" that enables GIDs and the graph(s). That way you have a mode that's very easy to read at a glance, and a mode that provides all data needed by more experienced EV drivers.
 
LeftieBiker said:
I suggest you have an "expert mode" that enables GIDs and the graph(s). That way you have a mode that's very easy to read at a glance, and a mode that provides all data needed by more experienced EV drivers.

The interface will be fully customizable, the cards will have the ability to move, change size, and display any data the user wants. Adding new cards coming soon. :D
 
any updates?
At the moment anyway, is not available from google play, at least not from here:
https://play.google.com/store/apps/details?id=life.brandonmartin.happyleaf&hl=en
 
The Beta App no longer appears to be available on the Google Play store via the Beta sign-up links, and it looks like the only version available right now is the Pro (pay) version. Hopefully @bmartin (aka. blandman) will have an update for us soon. Looking forward to giving it a try!
 
Sorry all for the lapse in updates. I’ve been struggling with dependencies and performance.

I’m working on my own native communication layer that will handle WiFi/Bluetooth communication to match performance of other apps.

I’m updating the google play link now
 
Back
Top