Jump to content

Recommended Posts

To verify and improve our models we need your feedback.  There's many ways we could use help if you actually own one:

  • Drive a plan and compare it to the actual battery used.
  • Drive a plan with the browser active, and update your actual battery percentage in the browser.
  • Contribute data via OBD or other methods.

The best way to improve the data is to provide data directly from the car.  For the Leaf, we're working with the LeafSpy developer to add what we need to the logging.  In the meantime, you can follow these instructions to set up data logging, but you'll have to keep LeafSpy open in the foreground to log.

Thanks for providing feedback!

Link to comment
Share on other sites

Nice! Yesterday I setup Leaf Spy and ABRP for my parents 40kWh Leaf so they could contribute some OBD data. Did some short tests today.

However I had some thoughts:

What data are you using to build the consumption model? Avalible remaining energy, actual power or some of the SOC values?  Is the provided data also used to calculate the avalible energy for the car model? Because that looks a little high for the Leaf 40 kWh? What I can see you are using ~37,8 kWh for 100%? That seems high I think. My parents Leaf is new (and shows ~99,8% SOH) and the avalible energy at full charge is ~37.9 kWh. However all of that can not be used, and the car reports 0% even earlier. Have not driven the car to very low SOC yet, but see ex link below (even though the person in the film seem a little confused about how Leaf Spy works). He had 3.8 kWh remaining when car resports 0% which would mean that the avalible energy from 100%->0% in the car would be ~34kWh. Which actually more corresponds to the rate of which the % in the car drops while driving.

I have increased the battery degradation the the ABRP settings to more than the default ~11% to compensate for this.



Link to comment
Share on other sites

Interesting data points, I will have to amend the model somewhat! Going to have to adjust the consumption too, as I likely have it set too high trying to match range, assuming I can use the full 38kWh of usable battery, instead of the 34.2kWh that seems accessible.  

Perchance, do you know what the actual usable portions of the other Leafs are? Is it a similar percentage or a similar value? (IE 20kWh vs 21.5kWh for the 24kWh Leaf)

Knowing what battery percentage corresponds to actual capacity is critical to building an accurate model from live data.  For the Leaf, the server logging only provides limited data as of now.  Really, I only get AHr capacity, SoC, and position.  No speed, power, or voltage.  I'm working with the LeafSpy developer to see if we can get these parameters added.  In the meantime, those three are enough to build a rough model, and follow along the drive in the car if you have the website open.

Link to comment
Share on other sites

The strange thing is that most places I read it says 36-37 kWh usable, even in the comment section of the link i provided above. But then I assume people is talking about fully charge to when the car actually stops. 100%->0% in the instrument cluster makes more sense to define as usable energy as most people will not go below 0%,

Don't know the data for other Leafs but what I have read that there is similar behavior that there are quite some range available when the car reports 0%. Due to this it seems like that Hard core Leaf drivers use Leaf Spy to actually drive below 0% and utilize all range when doing longer trips.

Leaf Spy also calculates available energy in kWh so that might be a possibility to also store in the log? Very nice to here that you are working with the Leaf Spy developer to add more data!


Link to comment
Share on other sites

That's an added layer of complication for ABRP, since it means that what's reported by LeafSpy via the server logging is likely different what's reported in the car.  I'd prefer to have the car and telemetry in the website match up so there's no confusion on the part of the driver.

According the the User's Manual I only have SoC, AHr capacity (which is useless without the current voltage), Lat/Long, and a whole host of other fairly useless parameters.

I suspect that for simplicity's sake, they've marked 10% (actual) as 0% (displayed) for all of their vehicles.  For now, until I get some better data, I'll assume that's the case, and adjust the consumption and usable battery size accordingly.  Honestly, this is probably the better way to go, to predict routes conservatively until we get really solid driving data.

Link to comment
Share on other sites

Great to see the new Leaf on ABRP, thank you! As the Leaf does not like to charge too often (#rapidgate) I would love to see an option to set up a minimum charge level when leaving a charger. I know the ABRP strategy is trying to charge at best possible rates, but the Leaf's battery gets very hot with this strategy. Having the option to plan to charge to a minimum of XX% (e.g. 85%) would allow Leaf drivers to reduce stops and heat build up on their trip.
Thanks again for your awesome project!

  • Thanks 1
Link to comment
Share on other sites

That's an interesting idea, you can do it somewhat manually right now, using waypoint charging, but that's not very useful if you have to go in and set your own waypoints.

Isn't the quick charging issue on the Leaf due to lack of BTCS? So it wouldn't matter if you do lots of short charges vs one long charge, you'll still generate heat each time you charge, and the heat generated will be proportional to the time spent charging.  Charging for longer less frequently would heat the battery equivalently to shorter more frequently, I would think.  In fact, I think your battery would be more likely to stay at a more even temperature, since your temperature peaks won't be as high, and the battery will stay at a more consistent temperature.

Link to comment
Share on other sites

Good point! My hope was that the charging loss become lower when the leaf starts to reduce charge speeds because of the charge level of the battery. At 80% it is typically down to about 22kW and the temperature hardly raises any more at that point.
I will drive over 800km on saturday (www.ecannonball.de) and will try to find out if charging to high levels does help. I plan to drive extremely slowly (about 90km/h) and hope that some cooling will assist me if I do not pull high amps.

Link to comment
Share on other sites

3 hours ago, elektrischIstBesser.de said:

BTW: When I try to use waypoint charging ABRP still puts chargers in between in order to keep charges in the lower range of the batteries capacity, doesn't it?

It'll only add them between chargers if required.  ABRP is time-optimized, so if it makes the route faster it'll add a charger.

Link to comment
Share on other sites

Nice! Thanks! What I can see it looks quite good. As the Leaf is my parent’s car I have limited possibilities to test, other people might have better feedback. However we used the car during the weekend to go to a shopping center. The distance was 45 km and there were charging possibilities so we started with 100% charge both on the way there and back.

I checked the trip planning with ABRP using default reference consumption and battery degradation. The reference speed and max speed was set to best effort estimation.

The actual arrival SOC according to the car display was very close to what was estimated with ABRP, very impressive. However I am not sure if I was driving exactly the same speed as in the plan, probably the speed was little lower due to the margin added on the Leaf speedometer. So on the way home I tested the driving mode (without LeafSpy connection). The estimated SOC was quite close, however I had to manually reduce the actual estimated SOC a 1-2 percent after a while in the driving mode. So the consumption seems slightly higher in our car.


So some small conclusions (however this short drive is probably not enough for making conclusions):
-Estimated arrival SOC quite close to the actual arrival SOC, impressive!
-The available energy in the model is maybe a little high still. Our car will have less energy available with 5% degradation.
-The reference consumption for our car is probably a little higher.

But in general I think it looks very good! Next step is maybe to get good data from LeafSpy uploads to improve the model?

But I have had issue with the LeafSpy upload. Last weekend when I tested I managed to get the upload working one time so that data in the drive mode was updated automatically, but after that it didn’t work. And this weekend I didn’t get it to work at all. I sometimes sees a brief fault message in LeafSpy with “java error” or something and the address to ABRP server. It is only showed for 1s or so which makes it difficult to read. What I can see I have used exactly the settings in the instructions in the blog. Tested with 2 different phones and two different ABRP accounts. Something other that needs to be considered?


  • Like 1
Link to comment
Share on other sites

Did you update the degradation input under "More Settings"?  If that's not accurate to your car, I think it defaults to 5%, then it'll overestimate charge.   All said, I'd rather underestimate charge than overestimate (IE, assume you'll use more power than you actually will).

The problem we've encountered with LeafSpy is that it only logs when it's in the foreground, so at the moment you'd only be able to follow the plan via leafspy telemetry with a second phone.  If it's any consolation, I see some leaf data in the database, which I assume is yours, and it looks valid (SoC 71.1852%, Capacity: 114.851 Ahr, Ext temp: 4.5 C). So what you're sending me is working!  I just need to figure out how to get LeafSpy to stop throwing an error message when I send my response that I got the packet.


Link to comment
Share on other sites

No the batteri degradation was not adjusted correct, will do that next time. In the future can the SOH also be included in the Leaf Spy log maybe?

I was running Leaf Spy on a seperate device so i guess it should have worked. Does something need to be done to activate that ABRP use the data from the server? While standing still I tried to leave the SOC input in ABRP blank and then it showed 90% in grey (instead of 100% that the car display showed) which I assuemed was some old data and that the upload from the Leaf Spy device did not work. So then I entered 100% SOC manually and started drivning, only got the manual drive mode with the batteri where SOC can be changed with the arrows, eg no data from server upload was used. 

Link to comment
Share on other sites

Found the bug!

LeafSpy doesn't provide speed in the server logging, so I have to work it backwards from your lat/long position between this and the last data point.  I had missed a key in the array of required telemetry that made it so that the code to work out your speed was never run, and thus your speed was missing.  Thus the required telemetry wasn't making it to the front end, and you were not seeing your telemetry on the site!

I've updated the server code, and it should work now, give it a shot and see if your telemetry appears!  When you plan a route with telemetry, it should ask you if you'd like to use your car's battery level to plan.

On the SoH, I'm not sure if that's actually included in the telemetry I get from LeafSpy, here's the full list:

  • user=xxx User ID
  • pass=xxx Password
  • DevBat=xx Device Battery %
  • Gids=xxx
  • Lat=xxx.xxxxx
  • Long=xxx.xxxx
  • Elv=xxx Elevation in meters 40
  • Seq=xx Sequence number of transfer
  • Trip=xx Trip number
  • Odo=xxx Odometer in km
  • SOC=xx.xx State of Charge
  • AHr=xx.xxxx Current AHr capacity
  • BatTemp=xx.x Average Battery Temperature
  • Amb=xx.x Ambient Temperature
  • Wpr=xx Front Wiper Status (FB)
  • PlugState=x Plug State (EL)
  • ChrgMode=x Charge Mode (EM)
  • ChrgPwr=xxxx Charge Power in watts
  • VIN=xxxxxxxxxxxxxxxx

Most of which I ignore, closest match seems to be AHr, but without live voltage from the car, I can't turn AHr into kWh (kWh = Ah * V / 1000).  I can guess, knowing what the 100% charge of the car ought to be, but it would just be a guess.  This is one of those things that's on my request list to the LeafSpy dev, when he has time to work on it.

Link to comment
Share on other sites

Ah, ok! Quick bugfix as always with ABRP, well done! Will try again as soon as possible then.

Regarding SOH, it is not included in the logged data now but might be something that could be added in the future if you are talking to the LeafSpy developer? Good for the trip planning and also when you start to get a lot of driving data from different vehicles it might be interesting to plot SOH vs Odometer mileage? :)
But perhaps it is possible to calculate the SOH from the relation between SOC and Gids (kWh)?

By the way how do you calculate the remaining “SOC” shown in the car display from the logged data?


Is there many Leafs contributing data over OBD? Do you want us to promote this in Leaf forums and facebook groups or do you prefer to wait until it is tested more and maybe also that the LeafSpy updates are available? (Do you have any idea of when the LeafSpy updates might be done?)

Edited by Jilldris
Link to comment
Share on other sites

At the moment, I am naively taking reported SoC% from LeafSpy, but it occurs to me that display SoC is going to be a little lower, and I probably need to pull 10% off of the bottom of the reported SoC% to match the displayed.

Ah, I hadn't realized Gids was a measure of kWh, is it a straight 1-1 conversion, or something else?

There are a couple, and I'd prefer to get the LeafSpy logging up to snuff before a lot of people start using it, at the very least fixing that javascript error you seem to be receiving when you log.  Sounds like the LeafSpy developer is quite busy, so it may be a few weeks before he gets around to starting on my requests, so that timetable is longer.

Link to comment
Share on other sites

Ah ok, yes and while fully charged according to display SoC the LeafSpy SoC does not reach 100% either.

I am new to the Leaf world so I might be wrong but as I understand the reason is that in the early days when the Leaf CAN bus was explored they found a signal indicating energy in the battery. As they did not know the scaling of it they used the raw value and called it Gids after the person who found it. Hard core Leaf users think in Gids and use that to know their state of charge.
Their still seems to be some different opinions about exactly how much energy 1 Gids are but a standard value what I have read is 1 Gids=77.5Wh. This is what LeafSpy use as default but it is possible to adjust in the settings.

Yes it is probably smart to wait a little until things are more tested.

Link to comment
Share on other sites

That is inconvenient... I'm sure we're going to get a lot of questions on that.  How much does it vary? If it's only a couple percent, it won't be so bad.  I assume it'll always read low? I don't suppose there's a way to view the displayed SoC in LeafSpy that mirrors the car's own display?

Link to comment
Share on other sites

In case of the Leaf, you really should think about the SOC in Gids. The SOC display in the car is based on gids. The low battery warnings in the car are based on Gids. For example Low Battery warning is at 50 GIDs. Very Low battery warning is at 25 GIDs.

If you are looking at the leafspy logs and want to know what was the SOC displayed in the car, you have to find out what is the maximum Gids for that specific car. Unfortunately, that is not logged by, and probably not even known by leafspy.

You can scan the logs and find the maximum value and use that as 100% charge, or you can use the following defaults:

When new, a 30kwh leaf has about 365 Gids. The 24kwh has 281,  and the 40kwh has about 505.

(But the battery is a bit of a lottery. My 30kwh Leaf had 363 Gids when it was new, but my friend's which was manufactured a year later had 372 )

My 30kwh Leaf has a 5% degraded battery, which means that maximum gids is currently about 344. I just finished charging for todays trip, and it sits at 293 gids, which the car displays as 85%.  (SOC as logged by leaf spy is currently displayed as 80%)

Btw. the iOS version of leafspy will log to the server even if leafspy is running in the background. As long as it is not kicked out of the memory by the OS, it will continue logging.

Edited by Gyula
Link to comment
Share on other sites

Hi all ! 

It's been two months since I took possession of my Leaf 40 and I am really interested in your route planner.

If I can be of any help, i can already tell you that I tested the very limit to when the car stops and from the attached Leafspy screenshot you can see there were 8 gids remaining and 1.8% SOC when the car had long told me I was out of energy ...

I also have the Leafspy log of my journey if you're interested in it just tell me.

Tomorrow, I will log to your server as I have a trip to do (190 km the morning and 300 km the afternoon) hope it works well.

Screenshot_20181101-200228_LeafSpy Pro.jpg

  • Like 1
Link to comment
Share on other sites

First things first, made some tweaks to the telemetry server, it should now provide you with real-time data for your car in the browser (assuming you're logging in the foreground on one device, and following on another device).  I'm still naively using the provided LeafSpy SoC%, haven't devoted the brainpower to figuring out a better way to do that using Gids yet.  I also fixed the response code that the server sends, so you shouldn't get any more error toasts in LeafSpy when server logging.

Thanks for all the information @Gyula and @Jilldris on Gids do you have any suggestions for a relatively simple way to show the in-car displayed SoC based on Gids? Based on @Jilldris's link, I suspect I could get away with simply adjusting the bottom end of the LeafSpy SoC, and it would be pretty close (top end is almost always within a few % of 100%?)

@Looksharp, absolutely test out the trip using the real-time telemetry following in the car if you can manage it, hopefully it works well!  According to the LeafSpy dev, the webserver logging is only functional when LeafSpy is running in the foreground, so you may need two devices, one to run LeafSpy, one to have ABRP open with the plan.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...