-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of ISO 15118 to read car SOC #25
Comments
I just heard about this a few days ago. These chargers talk to the car behaving like a DC charger, over ISO 15118 you can indeed request the SOC and other parameters of the EV. The SmartEVSE v3 does not have a ISO 15118 modem. So its not possible to request this information. |
It looks like it is using powerline communication, over the CP wire. An external modem would be needed, but I see none available over the shelf. |
See this paper: https://ltu.diva-portal.org/smash/get/diva2:1546405/FULLTEXT01.pdf A workaround for the current SmartEVSE is integration with https://evcc.io to get SoC via BMW Connected Drive, MyAudi, Volvo on Call etc. |
SmartEVSE v4? :-) Just noticed the same at a Tesla Supercharger, charging my non-tesla. Also wondering: “If Tesla can read that data, then SmartEVSE should also be able to do it … right?” |
Ha! |
I added an MQTT task to the SmartEVSE (and installed Mosquitto, Node Red etc) And via Node Red I can get all information from my Zoë, including the SOC. So I can forward that information to the SmartEVSE. Not using it yet, but the option is there. |
Yeah sure, but that's not always working well. Like BMW's connected drive that from time to time doesn't work for 1-2 days. The advantage of the qualcomm chip is it can always read SoC. Ideal for cars in an underground parking lot without wifi. |
I noticed the same with Porsche's service. Not very reliable, plus on many occasions with delays. |
@mstegen Not sure what the status is, but I would be happy to help develop the firmware adaptions for this; I am one of the developers of the serkri distribution, but it would make no sense doing that work twice.... |
@mstegen are you (still) looking into this for v4? |
Thanks for the reminder, just ordered some red/yellow beet-e modules to play with. |
@mstegen any luck on testing the beet-e? |
I received the modules (Red beet/ Yellow beet and Red beet carrier board), but had no time yet to look into it. |
I am also actively looking for something that could 1. provide me with a SoC on the car and 2. authenticate the car without having to use a RFID card/manual action. It seems ISO15118 is the way to go forward. I also stumbled across the web already in my quest. One thing that was very enlightening was this; https://github.com/uhi22/pyPLC#example-flow. I also came across Python libraries supporting both SLAC (link negotiation) and the actual ISO15118 communications. It all looks pretty expansive, but very cool! I mean come on, talking over IP with your car, that's awesome! I am not sure if implementation directly inside SmartEVSE is a good idea, though. It would most likely be possible, but full integration (including the Plug&Charge stuff) would require quite a big list of 'extras', like TLS, full IPv6 stack, dynamically spawning UDP+TCP servers for communication, etc. It sounds like a lot to handle for the/a ESP32. With that in mind, I'd like to try to add ISO15118 through a separate component (e.g. Raspberry Pi) that could act as a charge-controller-controller, handling the actual powerline communication with the car and 'work together' with the SmartEVSE to control the contactor, as the basic communication over the CP/PE lines (monitoring the EVSE 'states') is still required as part of that communication flow/charging process. I was thinking of using MQTT for this, but I guess a simple/small API or even ModBus would work as well. I do hope the control signalling on the CP line (e.g. load balancing) and the PLC communication are not mutually exclusive, and can be combined; else above may not work out the way I am envisioning.. But we can at least try! I have sent a mail to the people over at CODICO to find out if that carrier board they have listed on their site containing the RED BEET (https://www.codico.com/de/red-carrier-board-e-1-1-evse) would be plug&play and allow me to get a head start. If it's what I need to get going quickly, I'll order one and see what I can find out. |
@arpiecodes I'm pretty interested in what CODICO has to say. Thanks for the link though, I hadn't spot the carrier boards before. My first plan is to setup a Raspberry PI with the board, and see if we can get some form of communication. Things I'm interested in are:
I also looked at the carrier board with a white beet instead, which has an ST32 microcontroller. However, if I understood correctly the sample code needs to be licensed, and I couldn't find sample code online. Once this all works, we could make a PCB with small microcontroller and a RED beet that acts as a modbus slave for SmartEVSE to supply information about car SoC. (or SmartEVSE v4) One thing I'm interested in to learn is how we deal with CP signal, as it is currently controlled by SmartEVSE, while pyPLC mentions that the PWM needs to be set to 5% duty cycle for a while to setup digital communication. Well, we'll see once the board arrives and things need to be wired. I usually learn these things from doing it wrong initially. |
@ArendJanKramer good to hear you took the jump and simply bought one. Maybe I should do the same. I have no reaction from Werner from CODICO yet. I am unsure if they even respond to hobby users like me. :-) If I hear anything back, will let you know. Your plan sounds nice. However, as far as I understood the beet modules only contain the components to establish the physical connection/do signal conversion. The QCA7xxx chip on-board is connected through SPI to something else. And on this something else you will have to run the full networking stack (IPv6, SLAC, UDP/TCP servers, etc.). I don't think this will be possible on a PIC as it's all pretty high level stuff. Maybe you could get it to work reliably on a dedicated ESP32 though. AFAIK it has everything on-board to do these things. Using modbus to talk with the EVSE is a nice solution. Do have to consider the SmartEVSE will remain master in this case. So it will continually have to poll the module in such case, while also making sure your module gets the CP line state updated every now and then. |
Since the SmartEVSE already controls the CP line, and already has a full tcp server running (e.g. serkri distribution), IMHO it would make most sense to connect the modem through the existing SPI interface on the SmartEVSE board, and do all low-level communication on the ESP32; it might be necessary to offload the tls and complicated encryption/decryption routines that are involved with ISO15118 to a raspberry pi, but doing ipv6 is already possible since 2019 so that shouldnt be a problem... |
Running the serkri distribution sometimes already shows slowdowns when interacting with it through REST (at least, in my case) while not doing much with it, really. I'd not like my charge controller to end up being busy with a lot of extra stuff jammed into it to the extend of that potentially causing issues with the core functionality/compromising it. It would also raise complexity even further. Besides, we would still need a way to react to stuff like 'identifying' the car, send through SoC and be able to control it from (for example) HA. The official repo doesn't support this as of this moment either. I'd much rather see something like this added to Sensorbox v3 (and have that assume the master modbus device role, also run the REST API and MQTT client for example) vs. trying to cram it all into one device. |
Well lets agree to disagree on that. Mind you that having Sensorbox V3 taking over the modbus master role is a really bad idea, since the Sensorbox is optionally. There are a lot of alternatives out there that can get the Mains currents into the SmartEVSE. |
Agreed with disagreeing. :-) I was just referring to the Sensorbox as an example. I would also not mind it becoming a totally separate module. In the near future not only your car will be talking over Homeplug GreenPHY; it will most probably become the basis for smart grid communication. So it can potentially also talk with (for example) solar inverters and other appliances like heatpumps, etc. Would be too bad if the module could not support such nice use cases. While I do agree that's out of scope (like you said with the alternatives that are there for main metering), why not consider it from the start? It would give so much more flexibility vs. making it a single-purpose solution. I also don't see why having Sensorbox as the modbus master would be such a bad idea. It has been discussed here multiple times already. Nobody loses anything w/regards to functionality vs. current situation if you make it opt-in. If done in a correct way, would only mean the SmartEVSE can act as a Modbus slave which opens up a whole lot of extra possibilities in different set-ups as well. And would allow the SmartEVSE just to focus on that one thing it does best; be a charge controller without any added fuss. Now, creating a whole different version of SmartEVSE as a whole sounds like complete overkill and would only make firmware management/updates more difficult, require everyone to replace their existing units, etc. |
You will always need the possibility to have SmartEVSE working as modbus master, so having it also making it work as a slave increases complexity (both in code and in configuration). Id rather solve the structural problem of modbus only allowing one master by having the SmartEVSE functioning as a flexible configurable gateway from modbus to REST and/or MQTT, so it can interface to HomeAssistant or other more high-level domotica systems. Just my 2 cents... |
Which is in itself definitely not a bad idea/solution. I definitely support the motion to add more connectivity (e.g. REST API/MQTT, etc) to the SmartEVSE. I just don't agree with the part where we'd add even more responsibilities/logic to the SmartEVSE's core code; including a whole new networking stack required to make GreenPHY work. |
Hey @ArendJanKramer, were you able to try it out yet? I actually never heard back from CODICO and considering buying the carrier board anyways. Thought it'd be good to reach out to check how you are fairing with it first. |
@arpiecodes I received the board. Wasn't exactly easy, they asked a lot of questions before they sent one over. Quality is really good, I'm impressed. Still working on getting a Raspberry PI, so I can actually start developing with it. |
@ArendJanKramer |
@fluppie Thanks for the offer, I think I might be able to get one freed up in my setup. The Lenovo is actually a pretty good idea though lol. Another question to the experts here is about zero-crossing and connecting the mains. You see "YT-35636 (292877)" modules used for [AC_L and AC_N] and [CP + PE]. 1 - https://www.codico.com/en/mpattachment/file/download/id/831/ section 5: Again, I'm completely new to this ISO, but I'll learn as we go. "what can possibly go wrong" |
I would also think CP + PE is the way to go. Since the AC lines are disconnected by the contactor before charging.
I also saw the earlier posted link to https://github.com/uhi22/pyPLC#example-flow which looks like interesting information |
@fluppie Great resources, thanks for them. That seems hopeful. I also read this thesis: https://ltu.diva-portal.org/smash/get/diva2:1546405/FULLTEXT01.pdf Regarding the 5% duty cycle to initiate communication, I see this in the code: Maybe @mstegen can indeed confirm if it is safe to connect the dev board in parallel on the CP signal. |
Great that you received your dev board. If you kill it somehow, let me know, and i'll replace it. Ref the 5% PWM, this is required to start digital communication with the EV. |
@mstegen Thank you for your suggestions and kind offer. Let's hope nothing breaks. Good news so far, the PI and the Red Beet are talking: I'll see if I can mount the components to some sort of board, so it's a bit less fragile. Next is modifying the firmware of SmartEVSE and then wiring. Fingers crossed |
An other potential root cause could be, that we report "DC_EVSEStatus.EVSEIsolationStatus": "1", which means "valid". On real charger, we see that they report 0, which means dinisolationLevelType_Invalid. Maybe the car expects the "Invalid" at this step. [Edit] Pushed an update: uhi22/OpenV2Gx@d0e2281. Please pull and compile the OpenV2Gx. |
As a beginner, I want to ask basic question - do you read these values directly from CP pin via TCP? You capture them, scrape and project as information? The car sends information not as coded data, but for example "The SOC is xx %"? |
The car and the charging controller use PLC communication over the CP and PE pins. It's like having those AV HomePlugs that allow you to communicate over power lines; same basic concept. The established PLC communication channel allows for your car and charge controller to talk to each other on IP level (so, indeed talk over TCP). The messages exchanged over TCP are standardised. You can read more about it here; https://ltu.diva-portal.org/smash/get/diva2:1546405/FULLTEXT01.pdf and a full overview of the whole communication flow here; https://github.com/uhi22/pyPLC#example-flow. |
@uhi22 wrote |
@Electricalfan you can download and read the communication from the text file i left above. You can see the detailed text read from Ethernet link to and from the car over a full slac session up to the point where it responds with the battery data and rated charge limitations. You open the file with wireshark. |
I tried to connect my setup to a Tesla model S 2018 (that has been converted to support NACS/CCS charging) but couldn't see any PLC comm on the wire from the EV after plugging in and setting the PWM to 5% duty cycle etc. Do I need to do anything different for Teslas v/s other CCSx vehicles? I am able to get it at least to a point of PLC comm with my setup but not for Teslas :-( any advice is appreciated. I've tried this setup with Kia EV6 as well as Chevy Bolt and although I haven't been able to get it to close contactors and get to precharge state yet (still tweaking stuff based on pyPLC codebase and v2g) but with Tesla Model S and NACS/CCS1 charger I don't even see any PLC/GreenPHY comm even when the connector locks and I apply the correct voltage as well as 5% PWM duty cycle... anyone with Tesla experience and has got something working could comment and provide insights. Thx. PS I was refered to this forum/messages by @uhi22 and thx to his repo I've been able to get so far yet... |
I've got a Model S from 2018, and it's working for me. The car should start PLC comms, after you set 5% PWM. |
In order to understand what's going on with your Tesla, it'd be great to have some log output from pyPLC doing it's job and going through all the states. It may reveal where the communication gets stuck. Also, @mstegen great work on ESP32-PLC. It seems to now contain everything we need for requesting the base SoC parameters? In that case I may be ordering an ESP32 with ModBus module soon and attempt to get my 'situation' in the electrical closet cleaned up a bit. :-) Direct connection between SmartEVSE and the PLC ESP32 would probably always be preferred with as less dependencies possible. Let's see if I can port it to ESPHome, would fit nicely next to the ESPHome-Sensorbox. |
pyPLC in EVSEmode is just waiting for the PEV - but even on wireshark I don't see any communication initiated at L2 /Homeplug GreenPHY side from the PEV. So logs on pyPLC won't help much as there is nothing inbound... a bit of a chicken and egg... I've this same setup working with CCS1 connector on Chevy Bolt as well as a Kia EV6 (but they are CCS1/CCS2 v/s Tesla is NACS - although they're actually using ISO15118 behind for the actual comm. Appreciate your help. |
Is it the EU/CCSx model or US/NACS? I have the NACS one - tried to find online help but no luck yet :-( |
I've got a 2018 EU model S with CCS upgrade. If your model S has never had a hardware modification installed by Tesla, i don't think it's capable of CCS communication. |
Yes. My car is updated with the CCS/NACS module and ECU. Got it done 2 months back. It was originally using the single wire CAN. I'll try to connect an oscilloscope and give it a shot. |
Hello guys! I have started investigating digital communications for EV charging equipment. Naturally, I discovered this thread/issue along with the relevant one on openinverter.org forum. I am interested in implementing the EVSE side - especially AC mode. Hardware-wise, I am using TP-Link TL4010(p) and I managed to get my VW ID.4 to communicate firstly using @uhi22 pyPLC. I managed to get some data out of the car... However, I only have an AC (self-made DIY) EVSE, somewhat similar to SmartEVSE (I should have discovered this project sooner:)) so the DIN schema did not help me much in terms of getting the car to charge on AC. I did however have success with the stack from SwitchEV: pyslac and iso15118. I had to modify the pyslac code to fake the SLAC attenuation values since TL4010 does not support this. Without this, the car would not connect. Then, with the iso15118 project, I managed to get an actual AC charging session going. I had to disable DIN schema to force it to talk using the ISO15118-2:2013. Here is the log of the session from iso15118 secc side:
The car responded to AC current limitation (EVSEMaxCurrent) in ChargingStatusRes messages from EVSE to PEV. @uhi22, do you have any idea, how to convince the car to report SoC during AC session? Please let me know if you need any pointers on how to set-up the pyslac/iso15118 or if you would like me to test something with my EV with iso15118. |
These are very interesting news, thanks for this. Nevertheless I have two questions:
[Edit] The message set for AC seems to be quite limited. The ISO from 2016 defines an empty request, this means the vehicle does not transfer any data to the charger while charging. This would explain, that the charger cannot know the SOC. What bullshit, they specified a large number of crazy things and forgot about the simplest. I had a look to the OpenV2X exi decoder, also there, in the DIN and in the ISO1 schema, the dinChargingStatusReqType has no content. |
I agree, I've been looking at the switchEV stack but barrier to get it setup is much higher than @uhi22 pyplc component. If I remember the Everest project I'd also moving to a newer stack away from JOSEV, correct? Hence would be great if @bssstudio can provide some steps on how you got it running. Decode the messages using the charge point v2g dissector it would help understand what messages it payload values are being sent/recv. |
Yes, it was quite finicky with lots of trial and error to get it running. Pyslac did not want to run in docker, so I managed to get it running locally on linux, but iso15118 did not want to run locally, but I got it running in docker with host mode. I will find the time to retrace my steps and try to get something useful to enable others to test it - will try to focus on getting everything running in docker so that it is more repeatable and not related to my environment. I will try to do another session today and capture the pcap on the eth interface that is connected to the modem and also try to get the iso15118 to output the raw undecoded messages. @uhi22 Is iso1 = iso15118-2 and iso2 = iso15118-20? I tried a session with only ISO15118-20_AC protocol allowed, but the EV and software failed to negotiate a protocol and the session was terminated by the software stack. I am trying to figure out if VW ID.4 actually supports iso15118-20. Maybe there is more data transmitted with the iso15118-20? I will be back soon with the traces. |
I have completed traces and logs for a few different scenarios:
I suspected since I remember reading somewhere that TLS is mandatory for ISO15118-20 (please correct me if I am wrong - I can not get a definitive answer since I don't have the ISO standard documents), that my EV is not even adding the ISO15118-20 as a possible schema because of unsecured connection (no TLS). Plug and charge definitely requires TLS - this was my reasoning that maybe ISO15118-20 also needs TLS for the car to even request it. My EV did try to establish a TLS session even when it was not specifically configured in SECC, but failed with an "unknown CA" error. That would be correct behavior since my certificates are self-signed and thus should not be trusted by definition. Does anyone know where I could get a CPO (SECC) certificate that is signed by V2G root CA or any tier1 or tier2 downstream certificates? Who even is the V2G CA for Europe? I have seen hubject has some PKI certificates for V2G. I need to investigate further. Any info much appreciated. I have also tried simulating both SECC(EVSE) and EVCC(PEV) from the iso15118 project with ISO15118-20 AC and there wasn't any mention of SoC anywhere in the communication - maybe this is just because it is a simulation and optional parts are omitted. I need to study the code to see what is going on. The DIN spec did not want to work with AC 3ph mode although it is mentioned in the XML schema (who knows?). The SECC(EVSE) sent the energy transfer mode as AC 3phase and the car happily confirmed it but later requested DC charging, ignoring what was negotiated earlier. There is however good news in all this, why it still might be worth pursuing iso15118-2 AC mode: digitally set current limit. Analog PWM mode has a bizarre 6A minimum current limit in the standard that is limiting when charging from PV systems to self-consume as much energy as possible. My EV (ID.4) communicated a minimum current limit of 1.5A. It however did not work correctly when set to 2A (it drew 2A from one phase and 0.45A from the other two). The minimum current I got to work reliably was 2.7A from all 3 phases resulting in a combined 1800W of power draw in a 3-phase system (only 400W more than 6A single phase on 230V systems). This alone is worth pursuing as it might be possible to get 1.8kW - 11/22kw range of power control from the EVSE. I might also have a theory/idea on how to get the SoC data from the EV. There might be a possibility of renegotiating energy transfer modes, essentially to trick the EV into thinking it will establish DC charging session (to tell us the SoC) but before there is any cable checks/power transfer try to renegotiate to AC 3-phase energy transfer mode and do a normal charging session. Then periodically try to renegotiate to DC to get the SoC and back to AC to charge. I am still struggling with how to make multiple charging sessions without disconnecting the cable - sometimes after a successful charging session (when EVSE sets PWM to 12V steady) the car will start another session when set to 5% PWM. Sometimes it will not and I have to disconnect and reconnect the cable. It is quite OK with the "analog mode" to restart charging when PWM reappears. I have to try terminating the session "digitally" with EVSENotification and see if this helps or setting the current to 0A to see if the car will wait in this state. This is necessary for PV self-consumption and home power management/load balancing. I have attached traces and screenshots. 2024-03-28_din_ac3ph_6_2.7amp.txt |
@bssstudio those are very good and valid questions! I don't think any of us really got this far yet. I would also really really like a signed cert to build out such a more 'total' integrated charging solution. But it seems to be largely 'managed' away from the public, behind closed doors etc (just like the standard itself). However, maybe there's mention of the third parties managing the top-level CA's in the standard docs. Maybe @mstegen could take a look there? In any case, I estimate the chance you'll get a signed cert for yourself without any commercial intent/resources to be quite small. But we can dream. :-)
This is actually what we do in the serkri fork of SmartEVSE-3 now. We first negotiate a session with the car/initiate modem communication. Get e.g. the EVCCID, SoC, max charge values from car, max battery capacity etc. After all the info has been gathered, we reset the charging session and skip the 5% PWM cycle (so no digital communication). The car will then proceed to just charge the 'normal' non-digital (analog) way, but we do have all the important information we need to make our own 'educated guesses'. These data can then all be combined to give 1) the current SoC at start session, 2) the estimated current charged SoC at any time by looking at the energy already charged with a KwH meter vs what the requested KwH amount was, 3) make a rough estimation of when it's done charging based on the current charge speeds, etc. No need to switch back to digital mode for the remainder of the session. The above should already give you the basics for the 'smart charging' decisions, but you still can't dip below 6A I'm afraid. :-( Currently the solution is kind of a 'poor man's plug 'n charge'. I'd really like to explore whether there's more reliable ways to e.g. identify the car. Maybe by initiating a SSL cert exchange and taking note of the CN, if the car sends theirs first. That would be perfect and much more reliable vs. using the EVCCID, which could in theory be spoofed. But hey.... I don't think people around my charge point at home actually have hacker-level knowledge on EV charge sessions, so the chance that ever being exploited are probably not abysmal. In the meantime, I really like the fact I can just plug in the car and it will start charging. No need to switch access on/off anymore or swipe RFID's, as it knows my car by it's ID. :) The one thing I'd like to improve in my set-up is get rid of the Raspberry Pi Zero I need now to handle the modem communication. It feels too messy to send such data over API calls. I'd rather replace it with a ESP32 that communicates with the SmartEVSE through Modbus (like the Sensorbox), or UART. Obviously it would be awesome if SmartEVSE 4 already has a modem built in, but it would also increase it's pricepoint. Having a way to include it in a modular way to existing installations would also be nice. Which is why I'm hoping to some day land on a solution that's a hybrid between Sensorbox and the Pi I currently use. It seems @mstegen has done a lot of the hard (leg) work already to get the basics ported over to run on the ESP32. Just need to put it all together now. |
I resolved all my issues with closed connection on the bmwix3 as described here |
Can someone who has this implemented make a summary of what is needed to make this work? I can't see in any documentation that this would be covered even if it is experimental. I see on @dingo35 and serkri repo's that you have #define "MODEM 0 //0 = no modem 1 = modem" so I guess the SW part should be covered with this from the SmartEVSE side. What else is needed from the HW and how the connection works? |
@bssstudio: Could you please explain what kind of modification to the pyslac code has to be done? Thanks :-) |
Sorry for the long delay to reply. Here is the commit that enabled me to use tplink 4010: commit |
Thank you very much for providing your fix :-) |
hi there, we are a startup, having produced some 11kW AC charger pcb. does anyone have experience with 15118 plc via esp? would you like to help us? on what basis? |
A starting point for reading could be this: https://github.com/uhi22/ccs32berta
|
hallo uwe, ich würde mich sehr gerne mal mit dir unterhalten, magst du mich mal anskypen? markusulrich1 |
Oh, just realized that @mstegen already integrated the EVSE side on an ESP32s3 here: https://github.com/SmartEVSE/ESP32-PLC So this is a perfect starting point for the charger side. |
At some public chargers (particularly ones by Alfen), the car can communicate with the charging station to give details about it's SOC, this is shown on the charger display. Looking around the internet this is done with the ISO 15118 standard. Having the SOC would allow some new smart additions:
The text was updated successfully, but these errors were encountered: