![]()
I installed the CIAOPS Labs Garage Sensor just before I took my car out for a drive. About 2 hours later I returned to basically find that the 9 volt battery I was using to power the unit was flat!
So, I put the unit back on the bench and found that during operation the unit was drawing around 0.15 amps. Feeding that into AI I laern:
Battery Life (hours) = Capacity (mAh) ÷ Current Draw (mA)
Example 1: Alkaline (500 mAh)
Battery Life = 500 mAh ÷ 150 mA = 3.33 hours
Example 2: Lithium (1200 mAh)
Battery Life = 1200 mAh ÷ 150 mA = 8 hours
Example 3: NiMH (200 mAh)
Battery Life = 200 mAh ÷ 150 mA = 1.33 hours
Given that I was using an alkaline battery (of unknown life prior) the 3.33 hours above does correlate with what I saw.
To try and reduce the power usage over time I modified the code (here)
https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R3/Garage%20distance/main.cpp
and added some logic to turn off the display and LEDs when no car has been detected for a period of time. This logic proved challenging because of the variation in the distance sensor. My idea was simply to monitor for a static distance beyond the range of the car but the challenge proved that the distance sensor constantly returns different values. Thus, I need to create an inactivity timer and then tie that to an acceptable variance returned from the distance sensor, before I shut down the displays.
After uploading the code and waiting for the timeout period I found the current had dropped to 0.05A. Unfortunately, that still only provides about 10 hours of use on a single 9 volt battery.
Thus, I am now using an AC power adapter to power the unit for now. However, I will have to look into ways that I can reduce the power consumed by the Arduino Uno I think.
