Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Car battery voltage versus outdoor temperature

Hi,

This is really just a “thank you” for EmonCMS being useful when I’m trying to do things.

My friend and I were discussing my car, it’s battery and my new bluetooth multimeter and they asked me to see if the battery voltage varied as the outdoor temperature varied. Notably we were pondering if the voltage drop would make it harder to start the car (it’s one of those frugal diesel things).

During this analysis the car was just sat still on the drive. I believe it has an alarm fitted. Times are in UTC and I’m in England.

As you can see, the temperature went up during the first 48 hours and the voltage kept dropping. As the temperature fell during the night on 2021-01-12 the voltage stopped falling and actually rose a little bit.

I’m sure you are all much more familiar with battery chemistry and performance than I am, but I was just coming here to show how useful and flexible EmonCMS is for all sorts of random questions.

Thank you.

3 Likes

Nice work connecting your BT multimeter to Emoncms! What meter is this? How did you do connect it? It would be great if you could start a new thread to document how you did this? That’s really cool

1 Like

Oh Glynn! I wish I could live up to your expectations.

Unfortunately all I did was use the OWON OW18B to create files and then wrote yet-another-trivial-python-script to upload it to EmonCMS using the API.

Of course the wonderful thing is that the EmonCMS API allows this sort of ad-hoc integration which is why I was so happy.

There is a Bluetooth Low Energy library that someone wrote to snaffle the data from the multimeter but I’d need it to be in range of a computer to pipe it to EmonCMS. My computer doesn’t even have Bluetooth (I have to use my phone :slight_smile: ). And then you made me realise the Raspberry Pi could do this. And then I realised I just can’t devote enough time to make this happen. I can only apologize for being useless.

The crux of the code is below, just in case anyone wants it. I still haven’t dug into the bulk load API yet.

One weakness I anticipate but haven’t seen or handled is that the auto-ranging might make it record “mV” rather than “V” in some cases and it’d be sensible to re-scale that before uploading so the data didn’t jump between the “mv” and “V” input when it was uploaded to EmonCMS.

with open(readings_file) as readings:

    for reading in readings:
        # 0,	DC,	12.42,	V,	20:03:49,	01.09.2021

        parts = reading.split(",")
        parts = [part.strip() for part in parts]

        metric = parts[1] + " in " + parts[3] 

        moment = parts[5] + "T" + parts[4]
        readingDateTimeUTC = datetime.datetime.strptime(
            moment, "%m.%d.%YT%H:%M:%S"
        )

        to_post = {}
        to_post[metric] = parts[2]

        encoded_data = (
            "time="
            + str(int(readingDateTimeUTC.timestamp()))
            + "&node=multimeter&apikey=" + apikey + "&data="
            + json.dumps(to_post, separators=(",", ":"))
        )

        doPost(encoded_data)
1 Like