|
| 1 | +# :battery: Battery status/level Usermod :battery: |
| 2 | + |
| 3 | +This Usermod allows you to monitor the battery level of your battery powered project. |
| 4 | + |
| 5 | +You can see the battery level in the `info modal` right under the `estimated current`. |
| 6 | + |
| 7 | +For this to work the positive side of the (18650) battery must be connected to pin `A0` of the d1mini/esp8266 with a 100k ohm resistor (see [Useful Links](#useful-links)). |
| 8 | + |
| 9 | +If you have a esp32 board it is best to connect the positive side of the battery to ADC1 (GPIO32 - GPIO39) |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +define `USERMOD_BATTERY_STATUS_BASIC` in `my_config.h` |
| 14 | + |
| 15 | +### Define Your Options |
| 16 | + |
| 17 | +* `USERMOD_BATTERY_STATUS_BASIC` - define this (in `my_config.h`) to have this user mod included wled00\usermods_list.cpp |
| 18 | +* `USERMOD_BATTERY_MEASUREMENT_PIN` - defaults to A0 on esp8266 and GPIO32 on esp32 |
| 19 | +* `USERMOD_BATTERY_MEASUREMENT_INTERVAL` - the frequency to check the battery, defaults to 30 seconds |
| 20 | +* `USERMOD_BATTERY_MIN_VOLTAGE` - minimum voltage of the Battery used, default is 2.6 (18650 battery standard) |
| 21 | +* `USERMOD_BATTERY_MAX_VOLTAGE` - maximum voltage of the Battery used, default is 4.2 (18650 battery standard) |
| 22 | + |
| 23 | +All parameters can be configured at runtime using Usermods settings page. |
| 24 | + |
| 25 | +## Important :warning: |
| 26 | +* Make sure you know your battery specification ! not every battery is the same ! |
| 27 | +* Example: |
| 28 | + |
| 29 | +| Your battery specification table | | Options you can define | |
| 30 | +| :-------------------------------- |:--------------- | :---------------------------- | |
| 31 | +| Capacity | 3500mAh 12,5 Wh | | |
| 32 | +| Minimum capacity | 3350mAh 11,9 Wh | | |
| 33 | +| Rated voltage | 3.6V - 3.7V | | |
| 34 | +| **Charging end voltage** | **4,2V ± 0,05** | `USERMOD_BATTERY_MAX_VOLTAGE` | |
| 35 | +| **Discharge voltage** | **2,5V** | `USERMOD_BATTERY_MIN_VOLTAGE` | |
| 36 | +| Max. discharge current (constant) | 10A (10000mA) | | |
| 37 | +| max. charging current | 1.7A (1700mA) | | |
| 38 | +| ... | ... | ... | |
| 39 | +| .. | .. | .. | |
| 40 | + |
| 41 | +Specification from: [Molicel INR18650-M35A, 3500mAh 10A Lithium-ion battery, 3.6V - 3.7V](https://www.akkuteile.de/lithium-ionen-akkus/18650/molicel/molicel-inr18650-m35a-3500mah-10a-lithium-ionen-akku-3-6v-3-7v_100833) |
| 42 | + |
| 43 | +## Useful Links |
| 44 | +* https://lazyzero.de/elektronik/esp8266/wemos_d1_mini_a0/start |
| 45 | +* https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/ |
| 46 | + |
| 47 | +## Change Log |
| 48 | + |
| 49 | +2021-08-15 |
| 50 | +* changed `USERMOD_BATTERY_MIN_VOLTAGE` to 2.6 volt as default for 18650 batteries |
| 51 | +* Updated readme, added specification table |
| 52 | + |
| 53 | +2021-08-10 |
| 54 | +* Created |
| 55 | + |
0 commit comments