[Ovmsdev] OVMS - power drain
Arthur Hebert
ahebert at gmail.com
Wed Jun 11 07:17:30 HKT 2014
Hi Everyone,
I'm new to the forum, but thought I'd jump in because I recently did some
current metering of an OVMS that I've been hacking on the workbench, and I
want to share it in case it helps anyone. Here's what I've learned:
The power draw of the unit varies a lot depending on what features are
being used. After a nominal power-up with only occasional text messages,
the average 12V current draw on my unit was 120mA. With a GPRS connection
sending HTTP POSTs of about 30 bytes every 10 seconds, the average current
draw is 175mA (with peaks over 480mA).
>From a quick internet search, it seems the Leaf 12V battery has a capacity
of about 40Ah (can someone confirm this?). If there are no other loads on
the 12V system when the car is parked, then here is how long I'd expect it
to drain the battery dead:
40Ah / 0.120A = 333.3 hours = 13.9 days
40Ah / 0.175A = 228.5 hours = 9.5 days
If there was another 100mA drain on the 12V system internal to the car,
then those times would drop to 7.6 days and 6.1 days respectively. In other
words I wouldn't be surprised if the battery goes dead in a week or even a
few days, depending on other drains on the system.
The pic micro controller itself seems to be drawing about 28~30mA,
including whatever peripherals it's sourcing current to (e.g. LEDs) and
including the CAN transceiver and RS232 level shifter. I measured the 5V
current by lifting the ENABLE pin on the 4V power supply chip, effectively
turning off the SIM908 module power supply altogether. At this stage, the
pic can be put in it's own SLEEP mode, bringing the total 12V current draw
to 16mA.
Another thing to think about: the part number for the 4V supply chip on the
OVMS is using an LDO power supply, which is good if the supply voltage is
close to the operating voltage (i.e. if the battery was 5~6V), but is less
than 40% efficient with a battery supply of 12V. The SIM908 design doc
recommends an alternative to the LDO design for higher voltage sources:
[image: Inline image 1]
To estimate how *much* difference it would make, here's a back-of-the
envelope calculation based on the measurements I described above:
Let's say the 12V current draw is 120mA total, and that the 5V bus (pic,
etc.) is 30mA of that. Then, the 4V module + LDO supply is drawing 120mA -
30mA = 90mA from the 12V line.
SIM908 4V current draw = 90mA * 40% efficiency = 36mA
The LM2596 is 73% efficient at 3.3V/3A and 80% efficient at 5V/3A.
Extrapolating, let's say it's about 75% efficient for a 4V/3A supply
(perhaps better with current draw below the max of 3A?).
Current draw with switching supply = 36mA / 75% efficiency = 48mA.
So the savings in current draw from the LDO to switching supply will be
90mA - 48mA = 42mA.
42mA is 35% of the total 120mA, and it's a conservative estimate, since the
4V bus is where current jumps up to 175mA, and peaks toward 500mA when
there's GPS/GPRS activity. The improvement will likely be better than 42mA.
Bringing it all back around to the battery-drain, the device will last
noticeably longer with the 4V switching power supply instead of the LDO:
40Ah / (0.120A - 0.042A) = 512.8 hours = 21.1 days *
40Ah / (0.160A - 0.042A) = 339.0 hours = 14.1 days *
40Ah / (0.175A - 0.042A) = 300.8 hours = 12.5 days *
(*Not including other 12V power draws internal to the vehicle)
As I mentioned above, the total 12V current draw can be brought down to
16mA with the 4V disabled and the pic asleep. By connecting the 4V chip
ENABLE pin to a PIC digital output, this can be controlled in firmware.
Here's an example patch (green wire) from the ENABLE pin to DIO pin RB1:
[image: Inline image 2]
Obviously the unit doesn't function when everything is shutdown and asleep,
but it does help to protect the battery until it can receive a charge when
everything is powers up again.
-Arthur
On Tue, Jun 3, 2014 at 9:27 PM, Mark Webb-Johnson <mark at webb-johnson.net>
wrote:
>
> I've had a look at the Nissan Leaf code I have, and it is not doing any
> polling. Just passive listening on the bus. Is that what you have
> (vehicle_nissanleaf_poll0() just a stub returning TRUE)?
>
> If so, this is worrying. Any way you can put a meter on your OVMS box and
> see what sort of power consumption figures you are seeing? Even 160mA at
> 12V is just under 2watts, and I really can't see how that can be an issue
> for a reasonable lead-acid battery.
>
> Below is an eMail on this from early last year. It shows what sort of
> reading we are expecting.
>
> When I looked at this last year, I found I could bring PIC usage down to
> 25mA (from 35mA-42mA), which is not amazing. The biggest power hog is the
> modem (up to 160mA at times - particularly looking for cellular signal).
> There is a AT+CSCLK low power mode for the modem, but in my testing I was
> having problems maintaining a GPRS connection in low power mode (which is a
> non-starter).
>
> Regards, Mark.
>
> 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.
>
> Regards, Mark.
>
> On 19 Jan, 2013, at 9:36 PM, Michael Balzer <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>
> 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> 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
>
>
> On 3 Jun, 2014, at 5:09 pm, Nigel Jones <nigel at cherrybyte.me.uk> wrote:
>
> Just as a quick update I thought I'd mention that I've now disconnected
> OVMS from my Nissan Leaf in order to ascertain the cause of the 12V battery
> drain I was seeing for several days over the weekend - to the extent of
> returning after around 8 hours and being unable to even start the car
>
> More complete details are at
> https://speakev.com/threads/nissan-leaf-12v-battery-totally-dead.19/page-4
>
> I was just about to make a similar comment to the one Kevin just made in
> that thread - namely that I doubt the ovms processor per se is the cause of
> the drain since even in a tight spin loop due to a bug I can't imagine it's
> possible to take that much power? I however wouldn't be surprised if ovms
> polling the CAR bus might be keeping "things" in the car awake, which then
> causes the drain.
>
> There's also a chance it's just co-incidence.
>
> My plan is to reintroduce the OVMS at some point where the car is going to
> sit idle and not needed (working at home, or when I'm up in London by
> train) and see if the problem reoccurs. Of course it may be a particular
> sequence of events that gets the car into a state where it's bus is
> active.. tricky to pin down.
>
> regardless switching over to the EV bus is another option. The leafdd
> seems stable.
>
> Nigel.
>
> --
> ----
> Nigel Jones
> _______________________________________________
> OvmsDev mailing list
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20140610/d8bc315d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SIM908_supply_dcdc.png
Type: image/png
Size: 43667 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20140610/d8bc315d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: photo.JPG
Type: image/jpeg
Size: 208268 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20140610/d8bc315d/attachment-0001.jpe>
More information about the OvmsDev
mailing list