Guide: How to setup power cycle for an electric vehicle

The AutoPi dongle is initially configured to be powered on when the engine of the vehicle is running. When the engine is not running, a sleep timer is created to put the dongle to sleep after 30 minutes or whatever configured.
Behind the scene this works by using engine events (http://docs.autopi.io/events/vehicle/#engine-events). Engine events are triggered based on the RPM values continuously read from the vehicle. For all non BEVs (Battery Electric Vehicle) this is setup automatically as default because they all support readout of engine RPM in exactly the same way according to the OBD-II PID standard (SAE J1979).
Unfortunately this is not as simple for BEVs. Here there is no standard and data is read out in different ways between makes and models. Two approaches are available; 1) if your vehicle is able to respond to PID requests and/or 2) if your car continuously delivers data on a CAN bus.

1A) Setup a PID logger using the rpm_motor_event trigger

This option can be used if your vehicle is able to respond to PID queries.

Precondition: A PID which on request delivers a RPM value related to the movement of the vehicle. It could be the RPM of an electric motor, a spinning wheel etc. If you do not know of such a PID for your model, you can always check the Community Library on https://my.autopi.io.

Important: The PID must be named ‘RPM’ or else the rpm_motor_event trigger will skip checking the value.

Go to Car Explorer > Loggers > Create > PID. Choose your RPM PID and be sure to select the rpm_motor_event trigger.

58

After the logger has been synced to your device, and the service has been restarted, you should start seeing motor events below Advanced > Events.
For documentation of motor events see: http://docs.autopi.io/events/vehicle/#motor-events

1B) Setup a PID logger using the communication_event trigger

This option can be used if you do not have a PID capable of delivering RPM data, but instead have another arbitrary PID that delivers data when the vehicle is moving or active. The actual content of the PID response is irrelevant for this trigger to function.

Precondition: A PID which on request delivers data when the vehicle is active and no response when the vehicle is inactive. If you do not know any PID to use, you can always check the Community Library on https://my.autopi.io.

Note: There is no restriction on specific naming of the PID.

Go to Car Explorer > Loggers > Create > PID. Choose your arbitrary PID and be sure to select the communication_event trigger.

52

For documentation of communication events see: http://docs.autopi.io/events/vehicle/#communication-events

Next step is to re-configure the sleep timer functionality to use communication events instead of the default engine/motor events. Go to Settings > Advanced > Power and change the three values:

Sleep Timer > Event Driven > Event Regex: ^vehicle/communication/disconnected

Sleep Timer > Event Driven > Reason: vehicle_communication_disconnected

Sleep Timer > Suppress > Event Regex: ^vehicle/communication/established

As shown below:

12

05

After all the changes have been synced to your device, and the service has been restarted, you should start seeing communication events and also system/sleep_timer events below Advanced > Events.

1C) Setup a PID logger using a custom trigger

Caution: This option is recommended for expert users only.

Instead of using one of the built-in triggers you can provide your own implementation which also can fire your own custom events. The setup procedure is the same as in the example above except that the trigger used is custom. See how to create a custom triggere here: https://community.autopi.io/t/custom-code-write-custom-trigger-to-play-beep-sound-when-speeding

2A) Setup a CAN logger using the rpm_engine_event trigger

This option can be used if your vehicle continuously produces data on a CAN bus while active/driving.

Note: At the time of writing this approach can only make use of the rpm_engine_event trigger and thus produce engine events: http://docs.autopi.io/events/vehicle/#engine-events

Precondition: A CAN message mapping for your specific vehicle which contains a RPM signal. If you do not know any CAN messages for your vehicle, you can always check the Community Library on https://my.autopi.io.

The following example shows how a RPM signal can be found in the Community Library for a Renault Zoe. Go to Car Explorer > Library > Community Library and specify Make and Model:

21

Click on the RPM signal and in the popup window click on the button Add to my library. You have now added the CAN message to your library and you can use it for logging.

Next step is to setup a CAN logger for the RPM signal. Go to Car Explorer > Loggers > Create > CAN and choose the RPM signal:

30

Important: The CAN signal must be named ‘RPM’ or else the rpm_engine_event trigger will skip checking the value.

After the logger has been synced to your device, and the service has been restarted, you should start seeing engine events below Advanced > Events.

Not working?

Check the log file on the device to see if there are warnings and/or errors: https://community.autopi.io/t/guide-how-to-retrieve-logs-from-your-device/

Need help?

Please visit our documentation site http://docs.autopi.io/ or contact support@autopi.io.

3 Likes

Thanks for adding this functionality and also adding this guide. This solves the problem I was having and struggling to solve with custom code. Basically, to create a “ping” event for a known PID value and start/stop trips based on the response.

Since adding the trigger to the PID, trip logging is way more reliable than trying to use voltage, or GPS movement to trigger it.

1 Like

@Henrik,

thanks for this, just what I needed. A quick question

The instructions state

Important: The PID must be named ‘RPM’ or else the rpm_motor_event trigger will skip checking the value.

In the community library I am using the PID is named RPMx. Is that a problem ? I cannot rename it.

Thanks

I actually have the same issue: the system doesn’t allow to rename “RPM” a library signal, thus the name of the logger cannot be RPM.

Is there a special way to rename it? Can we use rpm_engine_event instead, without renaming, even if we’re using an electric vehicle?

Update01: using a different name doesn’t work, as mentioned above. I’m waiting for somebody’s feedback how to rename the signal to RPM.

Cheers

Hi @Chris_Neave and @therussian,

We’ve just pushed a hotfix for the Cloud, so it should be possible to rename them now in our local library.

Let me know if it works.

best
Peter

Hi Peter,

the cloud modification actually works now, I’m able to rename the signal to RPM: I still need to check if the event logger is coherent with the movement of the vehicle.

Update01: it works like a charm, motor events are updated and work consistently.
Tomorrow I’m testing trip trigger w/ motor event rather than power event (in that way I can separate driving sessions from charging sessions).

1 Like

Peter, great many thanks - will test it in a couple of hours. Hope it “Just works”

Apologies for the delay, Ionic and I live in different cities.

It just worked - thanks

Is there any mechanism to edit the main post to add the clarification (edit the PID NAME) For future users ?

1 Like

Hi Chris,

The original PID was created by another user, who “owns” the right to change the PID. The best solution is to add your new PID to the community library also.

best
Peter

@Peter - thanks, I will do that once I get my head around that - Is there any review mechanism around adding PIDs ?

Hi @Chris_Neave,

At the moment there is no review mechanism, which is also why we recommend that you use the PID’s in the library only after testing them.

best
Peter

Does anyone have an idea on why I might not be seeing vehicle/communication/disconnected events anymore?

I verified that the logger still has “communication_event” as the trigger, and that the command itself returns “ERROR: No data received from vehicle within timeout” when the car is off.

I’m still getting “vehicle/communication/established” as expected but it doesn’t seem to be logging a disconnected event when the logger is no longer active. Just be sure I removed the trigger from one logger and set it up on another, rebooted and re-synced, but still seems the same. It seems to have started around 2/8.

Edit: Issue above seems to have been resolved by reloading AutoPi core and re-syncing.

1 Like