WLED/usermods/battery_status_basic
Maximilian Mewes f04c9d101e
Added usermod "battery status basic" (#2127)
* added usermod battery_status_basic

* test.. something is wrong

* Squashed commit of the following:

commit 0f845527c53f838e2c68d50ec3e9d6c68c4cee46
Author: itCarl <mewes.maximilian@gmx.de>
Date:   Tue Aug 10 18:35:15 2021 +0200

    updated readme and added image showing info modal

commit 055579fcf71796519d00566452030f31798121d0
Author: itCarl <mewes.maximilian@gmx.de>
Date:   Mon Aug 9 20:53:07 2021 +0200

    small map function fix

commit 811614cf9e73f4731acb234d0d210a7b19565e9a
Author: itCarl <mewes.maximilian@gmx.de>
Date:   Mon Aug 9 19:35:21 2021 +0200

    updated ui

commit cadf2e23b7
Author: itCarl <mewes.maximilian@gmx.de>
Date:   Mon Aug 9 16:07:32 2021 +0200

    added usermod battery_status_basic

* updated readme, changed USERMOD_BATTERY_MIN_VOLTAGE default to 2.6 volt

* fixed readme image file naming

* added usermod settings for runtime changes

* fixed copy and paste mistake

* undo ui changes

* reworked addToJsonInfo() to make it compatible with the standard Info page.

* removed images from readme

* added ESP32 support

* updated readme
2021-08-20 20:42:46 +02:00
..
readme.md Added usermod "battery status basic" (#2127) 2021-08-20 20:42:46 +02:00
usermod_v2_battery_status_basic.h Added usermod "battery status basic" (#2127) 2021-08-20 20:42:46 +02:00

🔋 Battery status/level Usermod 🔋

This Usermod allows you to monitor the battery level of your battery powered project.

You can see the battery level in the info modal right under the estimated current.

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).

If you have a esp32 board it is best to connect the positive side of the battery to ADC1 (GPIO32 - GPIO39)

Installation

define USERMOD_BATTERY_STATUS_BASIC in my_config.h

Define Your Options

  • USERMOD_BATTERY_STATUS_BASIC - define this (in my_config.h) to have this user mod included wled00\usermods_list.cpp
  • USERMOD_BATTERY_MEASUREMENT_PIN - defaults to A0 on esp8266 and GPIO32 on esp32
  • USERMOD_BATTERY_MEASUREMENT_INTERVAL - the frequency to check the battery, defaults to 30 seconds
  • USERMOD_BATTERY_MIN_VOLTAGE - minimum voltage of the Battery used, default is 2.6 (18650 battery standard)
  • USERMOD_BATTERY_MAX_VOLTAGE - maximum voltage of the Battery used, default is 4.2 (18650 battery standard)

All parameters can be configured at runtime using Usermods settings page.

Important ⚠️

  • Make sure you know your battery specification ! not every battery is the same !
  • Example:
Your battery specification table Options you can define
Capacity 3500mAh 12,5 Wh
Minimum capacity 3350mAh 11,9 Wh
Rated voltage 3.6V - 3.7V
Charging end voltage 4,2V ± 0,05 USERMOD_BATTERY_MAX_VOLTAGE
Discharge voltage 2,5V USERMOD_BATTERY_MIN_VOLTAGE
Max. discharge current (constant) 10A (10000mA)
max. charging current 1.7A (1700mA)
... ... ...
.. .. ..

Specification from: Molicel INR18650-M35A, 3500mAh 10A Lithium-ion battery, 3.6V - 3.7V

Change Log

2021-08-15

  • changed USERMOD_BATTERY_MIN_VOLTAGE to 2.6 volt as default for 18650 batteries
  • Updated readme, added specification table

2021-08-10

  • Created