To measure a higher voltage than 3.3V using the Wemos D1 Mini's ADC port, you can create a voltage divider with 47kΩ and 4.7kΩ resistors.
The Wemos D1 Mini's ADC can read voltages between 0 and 3.3V and gives a 10-bit reading (0-1024).
To calculate the minimum precision in voltage, one need to divide the maximum voltage by the ADC resolution:
The voltage at the ADC pin is approximately 9.09% of the input voltage. When the ADC reading changes by one step (e.g., from 366 to 365), the input voltage changes by:
-
$R1 = 47kΩ$ (47000Ω) -
$R2 = 4.7kΩ$ (4700Ω) -
$V_{out} = 3.3V$ (ADC input maximum)
Plugging in the values:
To estimate the power consumption of the Wemos D1 Mini:
Assuming an average current draw of 80mA (0.08A) when performing computations and connected to Wi-Fi.
Using a 5V supply voltage:
With a 13V battery converted to 5V, taking into account the efficiency of the DC-DC converter (assumed to be 90% efficient):
If using a 13V motorcycle battery with a 6Ah (6000mAh) capacity:
Estimated Runtime:
To keep the battery above 40% charge, use only 60% of the battery's capacity:
Revised Runtime: