[Ovmsdev] Power usage / sleep mode

Michael Balzer dexter at expeedo.de
Sun Jan 20 17:25:16 HKT 2013


Mark,

11V is normally recommended as the absolute minimum for lead acid, below 
11V sulfation may occur.

The discharge curve of the Twizy also shows it begins to drop very fast 
from 11V, so if someone misses the alert over night that could already 
hurt the battery.

I can implement a calibration for the 12V reading, but that will need 1 
byte RAM... hm... I noticed the voltage currently is an int, intentionally?
If that's not needed I could change that, so overall RAM usage will not 
change.

Regards,
Michael


Am 20.01.2013 07:22, schrieb Mark Webb-Johnson:
> Michael,
>
> I checked the Sleep() function. Turning off the SIM908 and going to 
> Sleep() seemed to bring overall usage down to 25mA.
>
> Your code for alert seems to be ok, but I think the thresholds may be 
> too high. The ADC reading is dependent on individual resistor 
> variation (it is just a voltage divider) and I doubt whether it is 
> accurate to more than 0.5V or so. It will scale linearly, but the 
> offset will be wrong. For example, my car shows 11.5V as the nominal 
> voltage.
>
> Perhaps lower the threshold to 11V?
>
> Regards, Mark.
>
> On 19 Jan, 2013, at 9:36 PM, Michael Balzer <dexter at expeedo.de 
> <mailto:dexter at expeedo.de>> wrote:
>
>> Mark,
>>
>> I just checked in the 12V alert function.
>>
>> It's straight forward and compiles ok, but I cannot test if it 
>> triggers and resets correctly under real use conditions -- I've got 
>> no power supply with adjustable voltage.
>>
>> As most 12V batteries will be standard lead acid ones, I've set the 
>> trigger thresholds to reasonable values for these: The alert will be 
>> triggered on voltage drop below 11.5 V and reset on voltage above 11.9 V.
>>
>> Regards,
>> Michael
>>
>>
>> Am 19.01.2013 11:10, schrieb Michael Balzer:
>>> Mark,
>>>
>>> for the Twizy and maybe other cars, a wakeup from activity on the 
>>> CAN bus could also be an option. I remember reading about that in 
>>> the SIM908 manual. The OVMS could generally sleep while the Twizy is 
>>> off, maybe with an optional timed wakeup every 10-15 minutes for 1-2 
>>> minutes to detect GPS position changes.
>>>
>>> Btw, the SIM908 hardware design contains detailed info on the sleep 
>>> modes and power usages:
>>> http://www.mt-system.ru/sites/default/files/sim908-c_hardware_design_v1.03.pdf
>>>
>>> Thanks for bringing the 12V monitoring to my attention.
>>>
>>> I'll now first add an SMS alert on the 12V power line getting too 
>>> low, that's easy to implement and will remind users to charge.
>>>
>>> Regards,
>>> Michael
>>>
>>>
>>> Am 19.01.2013 10:47, schrieb Mark Webb-Johnson:
>>>>
>>>> Here are the power usage figures from my bench, using v1 hardware:
>>>>
>>>>   * PIC (normal mode) on, modem powered down (by power toggle
>>>>     switch): 35mA - 42mA
>>>>   * PIC (normal mode) on, modem on, gps off: 75mA
>>>>   * PIC (normal mode) on, modem on,gps on: 120mA
>>>>   * Very short-lived bursts to 160mA at times, presumably while
>>>>     transmitting on GSM
>>>>
>>>>
>>>> Playing with AT+CSCLK=2, the modem seems to drop to almost no power 
>>>> usage (perhaps 45mA), with a CR on the async port waking it up.
>>>>
>>>> Looking at the PIC18F2685 data sheet, it seems that with an 
>>>> external 20MHz oscillator, the normal power consumption is around 
>>>> 30mA to 40mA. Switching to an internal 4MHz oscillator reduces that 
>>>> to 5.3mA, and internal 1MHz oscillator to 3mA. Sleep mode is 2µA.
>>>>
>>>> I'll play around with it. So far, it seems it is quite easy to go 
>>>> into low-power sleep mode. It is getting back out that is the 
>>>> tricky bit.
>>>>
>>>> Regards, Mark.
>>>>
>>>> On 19 Jan, 2013, at 8:50 AM, Mark Webb-Johnson 
>>>> <mark at webb-johnson.net <mailto:mark at webb-johnson.net>> wrote:
>>>>
>>>>> Michael,
>>>>>
>>>>> Urgh. Glad that you managed to recover it.
>>>>>
>>>>> The TMC forums have a few theads at the moment of Model S cars 
>>>>> with 12V battery issues, and the Tesla Roadster's little 12V 
>>>>> battery seems to need replacing every 13 to 25 months.
>>>>>
>>>>> For Roadsters, OVMS is not run off that little 12V battery, so we 
>>>>> haven't seen this issue.
>>>>>
>>>>> The good news is that we did anticipate this sort of thing (except 
>>>>> were expecting to see it more on ICE cars with OBDII monitoring). 
>>>>> We added 12V power line monitoring, through an ADC, into the v2 
>>>>> hardware. Looking at your logs for the past few days is 
>>>>> interesting (I don't think there is anything private in their 
>>>>> apart from the vehicleid and odometer, which I have obscured, so 
>>>>> hope you don't mind me posting here). The 12v line reading is the 
>>>>> second to last column:
>>>>>
>>>>>     2013-01-14 06:39:53.930886 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 128,0,0,13,17,4,0,YYYY9,28,0,-127,0,120,-1,15.0,0
>>>>>     2013-01-14 06:59:54.871517 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.7,0
>>>>>     2013-01-14 07:05:26.666203 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.7,0
>>>>>     2013-01-14 07:05:46.498420 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.7,0
>>>>>     2013-01-14 07:06:04.864927 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.7,0
>>>>>     2013-01-14 07:30:07.228738 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.6,0
>>>>>     2013-01-14 08:29:57.461316 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.5,0
>>>>>     2013-01-14 09:29:48.441380 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.4,0
>>>>>     2013-01-14 11:29:30.755176 -0500 info  main: #34 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.3,0
>>>>>     2013-01-14 15:05:36.688666 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.2,0
>>>>>     2013-01-14 16:05:35.111552 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.7,0
>>>>>     2013-01-14 16:36:35.755630 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.2,0
>>>>>     2013-01-14 18:38:18.404933 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.2,0
>>>>>     2013-01-14 21:04:47.187479 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.1,0
>>>>>     2013-01-15 02:04:22.801440 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,12.0,0
>>>>>     2013-01-15 09:03:13.233483 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.9,0
>>>>>     2013-01-15 11:02:54.400624 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.7,0
>>>>>     2013-01-15 12:02:44.724576 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.9,0
>>>>>     2013-01-15 13:02:34.285593 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.8,0
>>>>>     2013-01-15 16:02:09.372087 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.7,0
>>>>>     2013-01-15 17:02:00.235001 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.8,0
>>>>>     2013-01-15 19:01:41.695938 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.7,0
>>>>>     2013-01-16 02:00:40.126355 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.6,0
>>>>>     2013-01-16 06:00:03.073862 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.5,0
>>>>>     2013-01-16 11:59:01.907094 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.4,0
>>>>>     2013-01-16 15:58:22.520731 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:22:48.691426 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:30:10.701329 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:30:21.837740 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.2,0
>>>>>     2013-01-16 17:36:37.811552 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:46:01.164994 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:48:35.257576 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 17:56:49.565932 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:01:15.186127 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:02:46.866156 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:02:54.217581 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:10:29.930408 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:10:38.723483 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.2,0
>>>>>     2013-01-16 18:11:12.459758 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.2,0
>>>>>     2013-01-16 18:18:31.863177 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:19:03.123286 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:43:55.355803 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.3,0
>>>>>     2013-01-16 18:58:43.567326 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.2,0
>>>>>     2013-01-16 22:58:15.314101 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.1,0
>>>>>     2013-01-17 01:57:50.181011 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,11.0,0
>>>>>     2013-01-17 02:57:40.587918 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,10.9,0
>>>>>     2013-01-17 03:57:30.418056 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,10.8,0
>>>>>     2013-01-17 04:57:19.241415 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,10.6,0
>>>>>     2013-01-17 05:57:10.622186 -0500 info  main: #54 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,10.3,0
>>>>>     2013-01-17 06:32:32.593533 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,10.0,0
>>>>>     2013-01-17 07:32:23.932656 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,9.4,0
>>>>>     2013-01-17 08:32:13.374380 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,7.9,0
>>>>>     2013-01-17 09:32:03.204557 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,7.2,0
>>>>>     2013-01-17 10:31:52.551362 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,6.5,0
>>>>>     2013-01-17 11:31:41.821330 -0500 info  main: #55 C XXXXXXX rx
>>>>>     msg D 0,0,0,14,15,4,0,ZZZZ0,0,0,-127,0,0,-1,6.7,0
>>>>>     2013-01-17 12:58:48.540906 -0500 info  main: #60 C XXXXXXX rx
>>>>>     msg D 128,0,0,13,1,2,0,ZZZZ8,0,0,-127,0,120,-1,15.1,0
>>>>>
>>>>>
>>>>> It shows 15v at the start (I guess when the car is on and charging 
>>>>> it), then 12.7v at 2013-01-14 06am EST, then falls gradually to 
>>>>> 11.0v at 2013-01-17 01am EST. At that point it seems to fall 
>>>>> faster, down to the last report (just 10 hours later)  6.7v at 
>>>>> 2013-01-17 11am EST.
>>>>>
>>>>> My original thought to handle this was to have two thresholds.
>>>>>
>>>>> At the first threshold, the PIC would turn off the modem and 
>>>>> re-awake only once every 12 hours, for 2 minutes, before going 
>>>>> back to sleep.
>>>>>
>>>>> At the second threshold, the PIC would turn off the modem, and go 
>>>>> to a deep sleep itself. In this mode, once power was restored it 
>>>>> would reset itself.
>>>>>
>>>>> Exit from either mode would be the 12v power line going back above 
>>>>> the first threshold plus some safety margin.
>>>>>
>>>>> This weekend, I'll get some exact power measurements from the v2 
>>>>> hardware module, so we know what we are dealing with:
>>>>>
>>>>>   * Just the PIC (modem powered down)
>>>>>   * PIC + MODEM
>>>>>   * PIC + MODEM + GPS
>>>>>
>>>>>
>>>>> Last time I tested this, on v1 hardware without GPS, these were 
>>>>> the figures for PIC + MODEM:
>>>>>
>>>>>   * Idle: 40mA @12V
>>>>>   * Cellular Network Registration: 100mA @12V
>>>>>   * Network activity: 80mA @12V
>>>>>
>>>>>
>>>>> Regards, Mark.
>>>>>
>>>>> On 18 Jan, 2013, at 10:47 PM, Michael Balzer <dexter at expeedo.de 
>>>>> <mailto:dexter at expeedo.de>> wrote:
>>>>>
>>>>>> Mark, List,
>>>>>>
>>>>>> yesterday my Twizy was temporarily dead... because of the OVMS 
>>>>>> power usage.
>>>>>>
>>>>>> I had not driven for 5 days. The Twizy has a very small 12V 
>>>>>> battery with only 14 Ah capacity, and it only gets charged while 
>>>>>> charging the Twizy and while driving (from the main battery).
>>>>>>
>>>>>> The OVMS with GPS activated needs a constant current of ~110 mA 
>>>>>> according to my measurement, thus sucking that battery empty 
>>>>>> within 4-5 days, maybe fewer. I'll make the power warning much 
>>>>>> more prominent in the Twizy user guide.
>>>>>>
>>>>>> Have there been any considerations yet about using the sleep mode 
>>>>>> of the PIC and/or SIM chipset?
>>>>>>
>>>>>> Regards,
>>>>>> Michael
>>>>>>
>>>>>> -- 
>>>>>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>>>>>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>>>>>>
>>>>>> <dexter.vcf>_______________________________________________
>>>>>> OvmsDev mailing list
>>>>>> OvmsDev at lists.teslaclub.hk <mailto:OvmsDev at lists.teslaclub.hk>
>>>>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.teslaclub.hk
>>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>>>
>>> -- 
>>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>>>
>>>
>>> _______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.teslaclub.hk
>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>>
>> -- 
>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>> <dexter.vcf>_______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.teslaclub.hk <mailto:OvmsDev at lists.teslaclub.hk>
>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20130120/82884f10/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dexter.vcf
Type: text/x-vcard
Size: 206 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20130120/82884f10/attachment-0002.vcf>


More information about the OvmsDev mailing list