[Ovmsdev] Power states clarification
Mark Webb-Johnson
mark at webb-johnson.net
Sat Mar 2 19:56:35 HKT 2019
We’ve just put in the base support in PCP (Power Controller Peripheral), and implemented it in most places. I think all the peripherals (as well as the ESP32 chip itself) implements those power control features (where possible), but there may be gaps in support.
For a place to start - a review of everything derived from PCP and ensure that they support the SetPowerMode function to do something reasonable.
That is the base support. Then, we need something on top to intelligently control power. That would call SetPowerMode() on the peripherals themselves. This would be best implemented in class pcpapp (MyPcpApp). It would monitor the state of the system (and perhaps the 12V battery), and perform tasks as directed by configuration.
Power consumption wise, the modem is the biggest culprit. That has a low power mode (supported in the SIMCOM driver we wrote), but will tear down the data connection. So that means we lose App control. In low power mode it can be woken up from an incoming USSD / SMS message (which is cool for hologram users as incoming SMS is free) - for those users, if the modem is in low power mode, when the App connects the server could talk to Hologram to wake up the modem (that is the way most other telemetry systems work).
When I thought of this originally, I thought of having different power control profiles. Each profile would be a set of configuration options defining what power control steps to take. Then the user picks a profile to use (including a custom one). The simplest profile would monitor the 12v battery and power everything down (including ESP32) if the 12v was below a critical level. But nothing like that is implemented at the moment.
Regards, Mark
> On 2 Mar 2019, at 12:38 AM, Nikolay Shishkov <nshishkov at yahoo.com> wrote:
>
> Hi Mark,
>
> I am killing batteries and I think I will have some time to look into the power consumption and sleep modes.
>
> Where should I start?
> I saw that there is some mention of NetDeepSleep and other states, as well as esp_deep_sleep in the code.
> Are they functioning or are they there but not running yet (implemented in firmware)?
> Maybe I should have implemented something in the code for the Think City?
>
> Thanks in advance,
> Nikolay
>
> On Wednesday, May 2, 2018, 2:50:50 AM GMT+2, Mark Webb-Johnson <mark at webb-johnson.net> wrote:
>
>
> Greg,
>
> Every peripheral class in the OVMS v3 system (both physical and virtual) should be derived from pcp (Power Controlled Peripheral). That base class implements the concept of a power state, as well as standardised commands to change state (and for sub-classed peripherals to implement those states).
>
> class obd2ecu : public pcp
> {
> public:
> obd2ecu(const char* name, canbus* can);
> ~obd2ecu();
>
> public:
> virtual void SetPowerMode(PowerMode powermode);
>
> At the moment, we don’t use this much. Some peripherals implement it, some don’t, and some only partially. Have a look at ::SetPowerMode() in the peripheral code itself.
>
> In general:
>
> Undefined Power mode is undefined
> On Fully powered on
> Sleep Reduced power mode (but all functions expected to be fully operational)
> DeepSleep Minimal power deep sleep mode (may turn off some functions to save power)
> Off Fully powered off
>
> This will become important later when we implement the sleep and deep sleep modes in OVMS firmware (primarily to save those little 12V batteries).
>
> Regards, Mark.
>
>> On 2 May 2018, at 8:10 AM, Greg D. <gregd2350 at gmail.com <mailto:gregd2350 at gmail.com>> wrote:
>>
>> Hi folks (mostly Mark, probably),
>>
>> I just noticed that there is a power command for OBD2ECU as well as
>> ext12v. I understand (or thought I did) what controlling the ext12v
>> power does, but how is "power" related to OBD2ECU? Is this related to
>> firing up the opened CAN bus, or is there some tie to the ext12v power?
>>
>> I have manually created scripts for vehicle.on and vehicle.off to
>> explicitly control ext12v, so that an attached HUD will follow the key.
>> We talked about having this sort of thing done automatically, but I
>> didn't think it was ever implemented, nor what the particulars would be
>> regarding some of the device corner cases. Is that what is happening here?
>>
>> Related, what do the other states do? (Sleep, deepsleep, etc.)
>>
>> Thanks,
>>
>> Greg
>>
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20190302/ad4e1010/attachment.htm>
More information about the OvmsDev
mailing list