Finished project: Car battery monitoring to Xively

Last week my car didn’t start. Empty battery. Few days later again! I went to the garage, we checked the battery, we checked the alternator and if the car has some circuits staying awake at night draining the car’s battery. We found nothing. But I didn’t want to be surprised again. I wanted to be warned when the voltage falls below a threshold so that I can start the engine and let the battery charge. That’s when an Imp comes in very handy!

I powered the Imp from 4xAA batteries. I used two resistors as a voltage divider to reduce the cars battery voltage below the 3V3 that the imp tolerates. Every 15 mins the Imp wakes from deep sleep, makes a wifi connection, sends the internal 3V3 voltage and the analog reading to the agent and goes back to deep sleep. This way the Imp can run from batteries for weeks. The agent calculates the battery voltage and sends it to Xively. In the Xively feed I created a trigger that calls an URL when the battery voltage falls below 12V. On I created a webhook (URL) that e-mails me when this URL is called. So when the voltage goes below 12V Xively calls an URL from Zapier that sends me an email. Guess what? My car decided not to drain the battery anymore… Well, at least I learned about making the Imp low power and how to interact between Imp and Xively.

Yeah, I could do with this for when my 3 year old turns the interior light on…

hmm, why don’t you power your imp with the car battery???

I don’t want to drain the cars battery. In case wifi fails to connect it will draw 50-100 mA. The voltage divider draws 10uA.

Here’s the code.
It’s funny that *.nut files are not allowed to upload.
My car was almost 100ft from my Wifi network. I noticed after a 4 days that my 4xAA batteries ran out. I think that the long distance and dirsturbance from other wifi networks caused the extra current consumption when compared to bench testing.

Thanks for sharing the code. Your Imp was transmitting 96 times per day, which may explain the battery drain. It would be better to collect the data and send it once or a few times per day as in this example.

I also logged to Xively, therefore I wanted to send the data every 15 mins.

@jrsikken, cannot see the code?

Cool project, I saw someone else do this on my site maybe that is you as well?