From 1e02b1fa2703c4fe2863f389573fc3d8b6ccd2f3 Mon Sep 17 00:00:00 2001 From: MeatPi Electronics <94690098+meatpiHQ@users.noreply.github.com> Date: Tue, 22 Oct 2024 01:53:41 +1100 Subject: [PATCH] Create 3.New_Vehicle_Profiles.md --- .../6.Automate/3.New_Vehicle_Profiles.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 docs/content/0.Config/6.Automate/3.New_Vehicle_Profiles.md diff --git a/docs/content/0.Config/6.Automate/3.New_Vehicle_Profiles.md b/docs/content/0.Config/6.Automate/3.New_Vehicle_Profiles.md new file mode 100644 index 0000000..542d5f1 --- /dev/null +++ b/docs/content/0.Config/6.Automate/3.New_Vehicle_Profiles.md @@ -0,0 +1,110 @@ +# How to Create a New Vehicle Profile + +A vehicle profile is a JSON file that tells WiCAN how to communicate with the vehicle. It uses the ELM327 protocol instead of sending raw CAN frames, making it as user-friendly as possible. ELM327 is an AT command-based protocol used by all OBD apps and software. This is also important for creating a profile since most EVs have non-standard PIDs to request data, such as EV battery state of health and other vehicle-specific parameters. These PIDs are not publicly available; however, apps like Car Scanner and Torque have a huge database of these PIDs. + +To create a profile for a new vehicle, you should use the Car Scanner app and export the logs to get the correct initializations and try to guess the formula or expression for calculating the parameter. + +For this tutorial, we will see how to create a new profile for VW MEB (ID.3) to get the State of Charge (SoC) and Range. + +### Steps to Create a Profile + +1. Plug in WiCAN into the OBD port. + +2. Connect to WiCAN and go to the device configuration page. + +3. Select the ELM327 protocol and disable MQTT if enabled. + +4. Submit the changes and reboot. + +5. In Car Scanner, click on `Settings -> Adapter OBDII ELM327` and select WiFi. + +6. Fill in the WiCAN IP address: `192.168.80.1` and Port: `3333`. + +7. On the same page, scroll down and click on Advanced settings. + +8. Select the ECU protocol. Usually, it is CAN (11 bit ID, 500 Kbaud), but sometimes it can be a different protocol. Try different protocols until you are able to connect to the ECU. Note that the supported protocols are only CAN: + + ``` + 6) ISO 15765-4 CAN (11 bit ID, 500 Kbaud) + 7) ISO 15765-4 CAN (29 bit ID, 500 Kbaud) + 8) ISO 15765-4 CAN (11 bit ID, 250 Kbaud) + 9) ISO 15765-4 CAN (29 bit ID, 250 Kbaud) + ``` + +9. Once you are able to connect and Car Scanner is reading data, press on the SoC sensor and let it read for a few seconds. + +10. Unplug WiCAN from the OBD adapter so that the last data read by Car Scanner is the SoC data. This will make it easier to find the correct PID. + +11. In Car Scanner, go to `Settings -> Adapter OBDII ELM327 -> Export log`. + +The AT commands will usually look like this. Notice that it first starts by sending some initialization commands. You can refer to the ELM327 datasheet to understand what these commands mean. Note that some commands, such as `ATD0` and `ATH1`, will be ignored by WiCAN, so there is no need to include them in the initialization string. The most important command here is `ATSP6`, which tells WiCAN to set the protocol to 11 bit ID, 500 Kbaud. + +``` +ATD + +OK + +>ATD0 +ATD0 +OK + +>ATE0 +ATE0 +OK + +>ATH1 +OK + +>ATSP0 +OK + +>ATE0 +OK + +>ATH1 +OK + +>ATM0 +OK + +>ATS0 +OK + +>ATAT1 +OK + +>ATAL +OK + +>ATST32 +OK +``` + +12. Now in the logs, scroll down to the end of the log. You will find that `22028C1` is repeated until disconnection, indicating that this is the SoC. You should also note the value of the SoC during logging. + +13. If you scroll up a little, you'll find that some AT commands were sent to set up for the SoC read: + + ``` + >ATSHFC007B + OK + + >ATCP17 + OK + + >ATCRA17FE007B + OK + + >ATFCSH17FC007B + OK + + >ATFCSD300000 + OK + + >ATFCSM1 + OK + ``` + +14. These are the PID initialization commands (`pid_init`). + +## TBC +