<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">OK, here's an update...<div><br></div><div>I went through the logs we captured, and had a look at Leaf Spy. I even purchased a copy of Leaf Spy Pro (even though I don't have a Leaf) just as a donation to say thank you to Turbo3 for pushing this approach and working out so much of the mechanics of it.</div><div><br></div><div>I spent an evening reading through the <a href="http://www.mynissanleaf.com/viewtopic.php?f=44&t=12098">"Using clone ELM327 Bluetooth OBDII adapter with Leaf" on mynissanleaf.com</a> (all 238 pages of it!), and got a good understanding of the history of where CAN decoding on the Nissan Leaf is, and where it is headed.</div><div><br></div><div>Bottom line:</div><div><br></div><div><ul class="MailOutline"><li>There are two CAN buses in the Nissan Leaf that are useful to us: the EV CAN bus and the CAR CAN bus.</li><li>The standard OVMS OBD-II cable connects to the CAR CAN bus. By passive listening on the bus, we can see some EV information, and all of the car information.</li><li>The EV CAN bus is also available on the OBD-II socket. By passive listening on the bus, we can see all the EV information, but little-to-no car information.</li><li>OVMS V2 hardware can only connect to one bus.</li><li>Someone worked out that active requests for information from the controllers (PID polling, as opposed to passive listening) are bridged. You can request information from a controller on the EV CAN bus, via the CAR CAN bus, and the car will bridge the requests between the buses. This appears to work bi-directionally.</li><li>There is a slight nasty in that if the car is off (asleep), active polling the EV controller causes it to wake up and you can hear a little 12V relay click near the front of the car each time you poll. We don't want to poll too fast when the car is asleep (off) and not charging, to avoid wearing out that relay.</li><li>The OBD-II connector has 12V power (both switched and non-switched) that we can use for OVMS, powered by an automotive 12V lead acid battery. We do need to take care because apparently that 12V battery is only charged when you drive or once every five days when the car is unplugged (and not at all when the car is plugged in). There is a CAR CAN message to show the 12V battery voltage (and OVMS V2 can also measure directly).</li><li>There is 'active discussion' in the community on how things like SOC%, battery capacity, ideal and estimated ranges, should be determined. Nissan made a mess of it, and the users are struggling to agree on a uniform approach to a correct way of doing things.</li></ul></div><div><br></div><div>I think our plan of attack should be:</div><div><br></div><div><ol class="MailOutline"><li>Use a standard V2 module, with standard OVMS OBD-II cable, to connect to the CAR CAN bus.</li><li>Use passive CAN listening, for the car information (doors, speed, on/off, etc) as much as possible.</li><li>Use active CAN polling, bridged to the EV CAN bus, for the EV information that we need.</li><li>Agree our own user-centric approach of how to represent capacity, SOC, ideal and estimated ranges.</li></ol></div><div><br></div><div>It has been quite frustrating looking at the community documentation for CAN bus messages in the Leaf. The documentation doesn't match what I am seeing, and is not at all clear. A lot of people are sharing, but some seem to be holding back and saying things like "here are some clues to what I've found, so go look for it yourself". Some closed source. Not the way I like to do things.</div><div><br></div><div>There is one very good thread on the active CAN bus polling, here:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><a href="http://www.mynissanleaf.com/viewtopic.php?f=44&t=11676">http://www.mynissanleaf.com/viewtopic.php?f=44&t=11676</a></div></blockquote></div><div><br></div><div>A good background read (34 pages) on Leaf CAN bus passive monitoring is here:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><a href="http://www.mynissanleaf.com/viewtopic.php?f=8&t=4131">http://www.mynissanleaf.com/viewtopic.php?f=8&t=4131</a></blockquote></div><div><br></div><div>and I recommend everyone involved in this to read that thread (only 12 pages) to get a good understanding.</div><div><br></div><div>There are two spreadsheets tracking Leaf CAN bus messages:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><a href="https://docs.google.com/spreadsheet/ccc?key=0AuDGAXnbchK0dDc4T05oNE04aVZtUzB6S19DT1RwaHc&authkey=CJi03v4F&hl=en_US&authkey=CJi03v4F#gid=0">https://docs.google.com/spreadsheet/ccc?key=0AuDGAXnbchK0dDc4T05oNE04aVZtUzB6S19DT1RwaHc&authkey=CJi03v4F&hl=en_US&authkey=CJi03v4F#gid=0</a></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><br></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><a href="https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5">https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5</a></blockquote></div><div><br></div><div>So, what I'm going to do now is to setup a framework in the vehicle_nissanleaf module to do passive listening on the CAR CAN bus, and active polling of the information on the EV CAN bus (bridged via CAR CAN bus). Once the framework is done, I'll test it in the local Hong Kong Leaf, and ask you guys to help.</div><div><br></div><div>I do need one or two people with the following equipment to help out:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>Good and frequent access to a Nissan Leaf</div><div>OVMS v2 Module</div><div>OVMS v2 OBD-II cable</div><div>PICKIT2 or PICKIT3 programmer</div><div>RS232-to-USB adaptor and laptop (or laptop with RS232 port)</div></blockquote></div><div><br></div><div>This is to run the framework in their car, and capture RS232 output from the DIAG port.</div><div><br></div><div>So, volunteers please.</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 19 Oct, 2013, at 11:23 pm, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div>I met up with a local Leaf owner (George) and spent a few hours in the car logging stuff off the main CAN bus. The car is a 2011 model, I think (the VIN model year is U/V, which makes no sense).<div><br></div><div>Good news it that the OVMS cables are fine. The ‘right hand’ ovms obdii cable appears to be the best for the right hand drive nissan leafs. The OBDII connector is under the steering wheel, parallel with the car direction of travel, short side on the left, so using a right-hand cable directs the cable towards the front of the car, which should be easiest for routing.</div><div><br></div><div>I managed to get quite a few log files, using a standard CAN USB adaptor at 512kbps.</div><div><br></div><div>Bad news is I am having trouble correlating lots of the messages against the published spreadsheets of Leaf can bus messages. Some messages are partially correct, but many are missing / don’t match up. The car also seems to go to sleep during charging, although the leaf spy could update the SOC ok. The 0x5b3 SOC+GIDS message wasn’t visible on the bus at all.</div><div><br></div><div>I think we are going to have to use PID polling to get the data we need.</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 16 Oct, 2013, at 10:31 pm, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div>Anyone feeling brave?<div><br></div><div>I’ve just committed a nissan leaf module (set vehicle id to NL) that will monitor the can bus and pickup the SOC%. That is all it does at the moment, but it should work.</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 16 Oct, 2013, at 2:49 pm, Nikki Gordon-Bloomfield <<a href="mailto:nikki@littlecollie.com">nikki@littlecollie.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div dir="auto"><div>I've already messages mark C. Let's hope he has it :) I know he and his husband have done a lot of logging. <br><br>Sent from my iPhone</div><div><br>On 16 Oct 2013, at 07:02, Robert Sharpe <<a href="mailto:robert.sharpe@evergreen-consulting.co.uk">robert.sharpe@evergreen-consulting.co.uk</a>> wrote:<br><br></div><blockquote type="cite">Hi Mark,<div><br></div><div>>I think the fastest way to get this done is for me to do it with a local Leaf owner.</div><div>That sounds like a good idea.</div><div><br></div><div><div>>Can someone tell me which CarCAN bus message to look for, which byte(s) to access, and how to convert to percentage SOC?</div><div>>The document at <a href="https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5" target="_blank">https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5</a> suggests ID 5B3 tracks SOH and Gids. But how to convert to percentage SOC?</div></div><div><br></div><div>Is @nufkin (Mark C) on this list? He has done some analysis of codes.</div><div>There is always the authors of the other projects that read Leaf data.</div><div><br></div><div>Regards,</div><div>Rob<br><br><br><span id="signaturePlaceholder"></span><div style="color:#898989;">On Oct 16, 2013, at 6.33AM, Mark Webb-Johnson wrote:</div><blockquote style="border-left: solid 2px #336699;padding-left: 5px; margin-left: 20px;"><div><br></div>I think the fastest way to get this done is for me to do it with a local Leaf owner.<div><br></div><div>If I can get basic support working, then perhaps someone else (or others) with better knowledge of the Leaf scene, can take over to get the advanced stuff working.</div><div><br></div><div>So, I'm going to try to get some Leaf Spy traces, as well as CAN bus logs for parked, charging and driving. Then, get the basic module working with SOC%, GPS location, door status, drive/park and charge monitor.</div><div><br></div><div>My biggest confusion at the moment is SOC% in the Leaf. There is a lot of talk about gids, etc, but I've never gone into it too deeply.</div><div><br></div><div>Can someone tell me which CarCAN bus message to look for, which byte(s) to access, and how to convert to percentage SOC?</div><div><br></div><div>The document at <a href="https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5" target="_blank">https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=5</a> suggests ID 5B3 tracks SOH and Gids. But how to convert to percentage SOC?</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 16 Oct, 2013, at 1:03 pm, Evergreen <<a href="mailto:robert.sharpe@evergreen-consulting.co.uk"><a="" _blank"="">robert.sharpe@evergreen-consulting.co.uk">target="_blank">robert.sharpe@evergreen-consulting.co.uk</a=""></a>> wrote:</div><br><blockquote><div><div>That's great news.</div><div><br></div><div>Regards,</div><div>Rob</div><div><br>On 16 Oct 2013, at 06:00, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net"><a="" _blank"="">mark@webb-johnson.net">target="_blank">mark@webb-johnson.net</a=""></a>> wrote:<br><br></div><blockquote><div><br></div><blockquote><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">P.S. I'm trying to find a friendly Leaf owner in Hong Kong to co-operate with this. There are 200+ Leafs here, and no carwings coverage at all, but most are in government service and relatively few in private hands.</div></blockquote><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br></div></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I think my fishing expedition on the forums may have come up with a bite. A Hong Kong Leaf owner who is willing to help.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I'll let you know how it pans out (over the next couple of days), but if I can get access to a local Leaf, getting the basic support working should be much faster.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Regards, Mark.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br></div><div><div>On 15 Oct, 2013, at 1:00 pm, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net"><a="" _blank"="">mark@webb-johnson.net">target="_blank">mark@webb-johnson.net</a=""></a>> wrote:</div><br><blockquote><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Barry,<div><br></div><div>Thanks for the history. I really think we can get what we need from the single car CAN bus.</div><div><br></div><div>I'll extract the relevant sections from the developers guide tonight, and post them here. The first step is to see which of those 'virtual car' pieces of information are available on the car CAN bus, and see if they match-up.</div><div><br></div><div>I really would like to see a dump (and dump) of the car CAN bus, as well as a trace from the leaf spy program. The captioned google docs spreadsheet for leaf can bus messages is quite confusing - it would be good to be able to compare that against what is actually seen on the bus.</div><div><br></div><div>Regards, Mark.</div><div><br></div><div>P.S. I'm trying to find a friendly Leaf owner in Hong Kong to co-operate with this. There are 200+ Leafs here, and no carwings coverage at all, but most are in government service and relatively few in private hands.</div><div><br></div><div><div><div>On 15 Oct, 2013, at 11:45 am, Barry Gershenfeld <<a href="mailto:gbarry42@gmail.com"><a="" _blank"="">gbarry42@gmail.com">target="_blank">gbarry42@gmail.com</a=""></a>> wrote:</div><br><blockquote><div><div>Early development assumed you had to get the EV info from the EV-CAN buss.  Somewhere during the development of Leaf Spy they kept finding desirable info on the car-CAN buss and so eventually determined that all if could be gotten from the car-CAN.  As a bonus, the ELM dongle no longer has to be modified to read the EV buss.<br>

<br></div>The original reporting efforts started with the "GID" meter, and the early work involved Gary G. building a data recorder as well as a program to analyze the logs.  I'm sure that's precisely what you have in mind as well.  There were downloadable logs--he invited others to install the analyzer and try to find meaningful messages therein.  But as it was early development, they were probably gotten from the EV-CAN.  I don't know if any more recent logs from the car CAN buss are posted.<br>

<div><br></div><div>As a matter of fact, I suspect Gary would be happy to have his analyzing program used.  It would be nice output the data into the same format that it uses.  Or at least write a converter.<br>
</div><div><br></div><div>I naturally have some interest, being a LEAF owner and PIC hacker.  I'll see if I can make head or tail of the developer's guide.<br><br> * * *<br>
<br></div><div>On Mon, Oct 14, 2013 at 7:04 PM, Mark Webb-Johnson <span><<a href="mailto:mark@webb-johnson.net"><a="" _blank"="">mark@webb-johnson.net">target="_blank">mark@webb-johnson.net</a=""></a>></span> wrote:<br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Developers guide is here:<div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<a href="https://github.com/markwj/Open-Vehicle-Monitoring-System/blob/master/docs/OVMS_Development.pdf?raw=true" target="_blank">https://github.com/markwj/Open-Vehicle-Monitoring-System/blob/master/docs/OVMS_Development.pdf?raw=true</a></blockquote>
</div><div><br></div><div>I would rather the actual development discussions take place here on this list. A lot of smart people here, with experience getting these vehicle modules working.</div><div><br></div><div>The biggest concern for me is whether we can get everything we need off one CAN bus...<br>
</div></div></blockquote></div></div>
_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk"><a="" _blank"="">OvmsDev@lists.teslaclub.hk">target="_blank">OvmsDev@lists.teslaclub.hk</a=""></a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk"><a="" _blank"="">OvmsDev@lists.teslaclub.hk">target="_blank">OvmsDev@lists.teslaclub.hk</a=""></a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></blockquote><blockquote><span>_______________________________________________</span><br><span>OvmsDev mailing list</span><br><span><a href="mailto:OvmsDev@lists.teslaclub.hk"><a="" _blank"="">OvmsDev@lists.teslaclub.hk">target="_blank">OvmsDev@lists.teslaclub.hk</a=""></a></span><br><span><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br></blockquote></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk"><a="" _blank"="">OvmsDev@lists.teslaclub.hk">target="_blank">OvmsDev@lists.teslaclub.hk</a=""></a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></blockquote><br><br></div></blockquote><blockquote type="cite"><span>_______________________________________________</span><br><span>OvmsDev mailing list</span><br><span><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a></span><br><span><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br></blockquote></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></div></blockquote></div><br></div></body></html>