From 48dd1bfc6c73f9a6fb1329ae6528e495b07b36e5 Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 3 May 2023 18:04:01 +0200 Subject: [PATCH 01/17] specify specific pip version wich works with zmq install --- installation/routines/setup_jukebox_core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/routines/setup_jukebox_core.sh b/installation/routines/setup_jukebox_core.sh index 88b65bcc0..8b48e2363 100644 --- a/installation/routines/setup_jukebox_core.sh +++ b/installation/routines/setup_jukebox_core.sh @@ -32,7 +32,7 @@ _jukebox_core_install_os_dependencies() { --allow-remove-essential \ --allow-change-held-packages - sudo pip3 install --upgrade pip + sudo pip3 install --upgrade pip==23.0.1 } _jukebox_core_configure_pulseaudio() { From b71f3c01103ac0bdc599f0be70b49b25380c2d11 Mon Sep 17 00:00:00 2001 From: Timm Date: Sat, 29 Jul 2023 17:57:53 +0200 Subject: [PATCH 02/17] add INA219 sensor --- .../batt_mon_i2c_ina219/__init__.py | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py new file mode 100644 index 000000000..6995f00c3 --- /dev/null +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -0,0 +1,94 @@ +# MIT License +# +# Copyright (c) 2021 Arne Pagel +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Contributing author(s): +# - Arne Pagel + +import logging +import jukebox.plugs as plugs +import jukebox.cfghandler +from ina219 import INA219 +from ina219 import DeviceRangeError +from components.battery_monitor import BatteryMonitorBase + +logger = logging.getLogger('jb.battmon') + +batt_mon = None + + +class battmon_ina219(BatteryMonitorBase.BattmonBase): + '''Battery Monitor based on a INA219 + + CAUTION - WARNING + ======================================================================== + Lithium and other batteries are dangerous and must be treated with care. + Rechargeable Lithium Ion batteries are potentially hazardous and can + present a serious FIRE HAZARD if damaged, defective or improperly used. + Do not use this circuit to a lithium ion battery without expertise and + training in handling and use of batteries of this type. + Use appropriate test equipment and safety protocols during development. + + There is no warranty, this may not work as expected or at all! + ========================================================================= + + This script is intended to read out the Voltage of a single Cell LiIon Battery using a board with a INA219: + + 3.3V + + + | + .----o----. + | | SDA + .-------------------------------o AIN o------ + | | INA219 | SCL + | .----------o AOUT o------ + --- | | | + Battery - Regulator + Raspi '----o----' + 2.9V-4.2V| | | + | | | + === === === + + ''' + + def __init__(self, cfg): + super().__init__(cfg, logger) + + def init_batt_mon_hw(self, num, denom): + self.adc = INA219(float(num)/1000, busnum=1) + self.adc.configure() + + def get_batt_voltage(self): + batt_voltage_mV = self.adc.voltage() * 1000.0 + return int(batt_voltage_mV) + + +@plugs.finalize +def finalize(): + global batt_mon + cfg = jukebox.cfghandler.get_handler('jukebox') + batt_mon = battmon_ina219(cfg) + plugs.register(batt_mon, name='batt_mon') + + +@plugs.atexit +def atexit(**ignored_kwargs): + global batt_mon + batt_mon.status_thread.cancel() From 4619097e09b365c8f1439a0a5f89815fee431bda Mon Sep 17 00:00:00 2001 From: Timm Date: Mon, 31 Jul 2023 16:24:10 +0200 Subject: [PATCH 03/17] average measurement for more accurate results. Use supply voltage for measurement. --- .../battery_monitor/batt_mon_i2c_ina219/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 6995f00c3..ecd4f6154 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -73,10 +73,10 @@ def __init__(self, cfg): def init_batt_mon_hw(self, num, denom): self.adc = INA219(float(num)/1000, busnum=1) - self.adc.configure() + self.adc.configure(self.adc.RANGE_16V, self.adc.GAIN_AUTO, self.adc.ADC_32SAMP, self.adc.ADC_32SAMP) def get_batt_voltage(self): - batt_voltage_mV = self.adc.voltage() * 1000.0 + batt_voltage_mV = self.adc.supply_voltage() * 1000.0 return int(batt_voltage_mV) From 4e770bb4edf7bf88a8845f63194acebdb522f628 Mon Sep 17 00:00:00 2001 From: Timm Date: Sun, 2 Jun 2024 10:10:21 +0200 Subject: [PATCH 04/17] Revert "specify specific pip version wich works with zmq install" This reverts commit 48dd1bfc6c73f9a6fb1329ae6528e495b07b36e5. --- installation/routines/setup_jukebox_core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/routines/setup_jukebox_core.sh b/installation/routines/setup_jukebox_core.sh index 8b48e2363..88b65bcc0 100644 --- a/installation/routines/setup_jukebox_core.sh +++ b/installation/routines/setup_jukebox_core.sh @@ -32,7 +32,7 @@ _jukebox_core_install_os_dependencies() { --allow-remove-essential \ --allow-change-held-packages - sudo pip3 install --upgrade pip==23.0.1 + sudo pip3 install --upgrade pip } _jukebox_core_configure_pulseaudio() { From 919ee6bde5a9c502b2c85d81565306cfca45f606 Mon Sep 17 00:00:00 2001 From: Timm Date: Sun, 2 Jun 2024 10:25:58 +0200 Subject: [PATCH 05/17] correct format --- .../components/battery_monitor/batt_mon_i2c_ina219/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index ecd4f6154..963a2a9a9 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -72,7 +72,7 @@ def __init__(self, cfg): super().__init__(cfg, logger) def init_batt_mon_hw(self, num, denom): - self.adc = INA219(float(num)/1000, busnum=1) + self.adc = INA219(float(num) / 1000, busnum=1) self.adc.configure(self.adc.RANGE_16V, self.adc.GAIN_AUTO, self.adc.ADC_32SAMP, self.adc.ADC_32SAMP) def get_batt_voltage(self): From 3e344f7e679d302670a267de5f70c2b5411a2959 Mon Sep 17 00:00:00 2001 From: Timm Date: Tue, 4 Jun 2024 23:37:32 +0200 Subject: [PATCH 06/17] Update src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py Co-authored-by: s-martin --- .../components/battery_monitor/batt_mon_i2c_ina219/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 963a2a9a9..51216b3a0 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -30,7 +30,7 @@ from ina219 import DeviceRangeError from components.battery_monitor import BatteryMonitorBase -logger = logging.getLogger('jb.battmon') +logger = logging.getLogger('jb.battmon.ina219') batt_mon = None From 4bf57e5551bf17407bebc6a5b77b7faa59726b16 Mon Sep 17 00:00:00 2001 From: Timm Date: Tue, 4 Jun 2024 23:41:35 +0200 Subject: [PATCH 07/17] Update copyright notice --- .../battery_monitor/batt_mon_i2c_ina219/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 51216b3a0..6b0e2a6b4 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -1,6 +1,7 @@ -# MIT License +# RPi-Jukebox-RFID Version 3 +# Copyright (c) See file LICENSE in project root folder # -# Copyright (c) 2021 Arne Pagel +# Copyright (c) 2021 Arne Pagel, 2024 Timm Eversmeyer # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -22,6 +23,7 @@ # # Contributing author(s): # - Arne Pagel +# - Timm Eversmeyer import logging import jukebox.plugs as plugs From c1f8eeda09fc3fb06b9647d27776644cd8c591df Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 5 Jun 2024 22:36:07 +0200 Subject: [PATCH 08/17] Update license --- .../batt_mon_i2c_ina219/__init__.py | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 6b0e2a6b4..0b7c8f381 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -1,26 +1,6 @@ # RPi-Jukebox-RFID Version 3 # Copyright (c) See file LICENSE in project root folder # -# Copyright (c) 2021 Arne Pagel, 2024 Timm Eversmeyer -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# # Contributing author(s): # - Arne Pagel # - Timm Eversmeyer From c3b1fc0de19a17705f131894b23d7590d6f310aa Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 5 Jun 2024 22:43:31 +0200 Subject: [PATCH 09/17] Update license --- .../battery_monitor/batt_mon_i2c_ina219/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 0b7c8f381..4fd2235ab 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -1,9 +1,5 @@ # RPi-Jukebox-RFID Version 3 # Copyright (c) See file LICENSE in project root folder -# -# Contributing author(s): -# - Arne Pagel -# - Timm Eversmeyer import logging import jukebox.plugs as plugs From a38a28915f6cc540291dc90356843a4c3663ba04 Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 5 Jun 2024 23:01:20 +0200 Subject: [PATCH 10/17] Document the INA219 --- .../components/power/batterymonitor.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index d57e14acb..43b050050 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -31,3 +31,60 @@ The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_i > > * the circuit is constantly draining the battery! (leak current up to: 2.1µA) > * the time between sample needs to be a minimum 1sec with this high impedance voltage divider don't use the continuous conversion method! + +# Battery Monitor based on an INA219 + +> [!CAUTION] +> Lithium and other batteries are dangerous and must be treated with care. +> Rechargeable Lithium Ion batteries are potentially hazardous and can +> present a serious **FIRE HAZARD** if damaged, defective, or improperly used. +> Do not use this circuit for a lithium-ion battery without the expertise and +> training in handling and using batteries of this type. +> Use appropriate test equipment and safety protocols during development. +> There is no warranty, this may not work as expected! + +The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py) is intended to read out the voltage of a single cell or multiple LiIon Battery using a [INA219 Board](https://www.adafruit.com/product/904): + +```text + 3.3V + + + | + .----o----. + | | SDA + .-------------------------------o AIN o------ + | | INA219 | SCL + | .----------o AOUT o------ + --- | | | + Battery - Regulator + Raspi '----o----' + 2.9V-4.2V| | | + | | | + === === === +``` + +# Configuration example + +The battery monitoring is configured in the jukebox.yml file. + +The "battmon" module has to be added to the modules setting. + +```text +modules: + named: + # Do not change the order! + publishing: publishing + ... + battmon: battery_monitor.batt_mon_i2c_ina219 +``` +The battmon module needs further configuration: + +```text +battmon: + scale_to_phy_num: 1 + scale_to_phy_denom: 0 + warning_action: + all_clear_action: +``` + +The setting "scale_to_phy_denom" does not influence the INA219. However, the scale can be adjusted to fit multiple LiIon cells. + + From 0c843da53466ed12c003524610a756a79a205174 Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 5 Jun 2024 23:10:34 +0200 Subject: [PATCH 11/17] add error handling and type safety --- .../batt_mon_i2c_ina219/__init__.py | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index 4fd2235ab..eb448f641 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -49,13 +49,24 @@ class battmon_ina219(BatteryMonitorBase.BattmonBase): def __init__(self, cfg): super().__init__(cfg, logger) - def init_batt_mon_hw(self, num, denom): - self.adc = INA219(float(num) / 1000, busnum=1) - self.adc.configure(self.adc.RANGE_16V, self.adc.GAIN_AUTO, self.adc.ADC_32SAMP, self.adc.ADC_32SAMP) - - def get_batt_voltage(self): - batt_voltage_mV = self.adc.supply_voltage() * 1000.0 - return int(batt_voltage_mV) + def init_batt_mon_hw(self, num: float, denom: float) -> None: + try: + self.adc = INA219(float(num) / 1000, busnum=1) + self.adc.configure(self.adc.RANGE_16V, self.adc.GAIN_AUTO, self.adc.ADC_32SAMP, self.adc.ADC_32SAMP) + except DeviceRangeError as e: + logger.error(f"Device range error: {e}") + raise + except Exception as e: + logger.error(f"Failed to initialize INA219: {e}") + raise + + def get_batt_voltage(self) -> int: + try: + batt_voltage_mV = self.adc.supply_voltage() * 1000.0 + return int(batt_voltage_mV) + except Exception as e: + logger.error(f"Failed to get supply voltage from INA219: {e}") + raise @plugs.finalize From 49de38ab79487c5c7db4e0b7730dd5c4ac558a23 Mon Sep 17 00:00:00 2001 From: Timm Date: Thu, 6 Jun 2024 22:32:22 +0200 Subject: [PATCH 12/17] Update batterymonitor.md --- .../components/power/batterymonitor.md | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index 43b050050..39671c5eb 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -1,14 +1,13 @@ -# Battery Monitor based on a ADS1015 - > [!CAUTION] > Lithium and other batteries are dangerous and must be treated with care. > Rechargeable Lithium Ion batteries are potentially hazardous and can -> present a serious **FIRE HAZARD** if damaged, defective or improperly used. -> Do not use this circuit to a lithium ion battery without expertise and -> training in handling and use of batteries of this type. +> present a serious **FIRE HAZARD** if damaged, defective, or improperly used. +> Do not use this circuit for a lithium-ion battery without the expertise and +> training in handling and using batteries of this type. > Use appropriate test equipment and safety protocols during development. -> There is no warranty, this may not work as expected or at all! +> There is no warranty, this may not work as expected! +# Battery Monitor based on a ADS1015 The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/__init__.py) is intended to read out the voltage of a single Cell LiIon Battery using a [CY-ADS1015 Board](https://www.adafruit.com/product/1083): ```text @@ -34,15 +33,6 @@ The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_i # Battery Monitor based on an INA219 -> [!CAUTION] -> Lithium and other batteries are dangerous and must be treated with care. -> Rechargeable Lithium Ion batteries are potentially hazardous and can -> present a serious **FIRE HAZARD** if damaged, defective, or improperly used. -> Do not use this circuit for a lithium-ion battery without the expertise and -> training in handling and using batteries of this type. -> Use appropriate test equipment and safety protocols during development. -> There is no warranty, this may not work as expected! - The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py) is intended to read out the voltage of a single cell or multiple LiIon Battery using a [INA219 Board](https://www.adafruit.com/product/904): ```text From 19b6bb7af3bc2907f495b5eafa3d25678549d023 Mon Sep 17 00:00:00 2001 From: Timm Date: Thu, 6 Jun 2024 22:35:33 +0200 Subject: [PATCH 13/17] Update __init__.py --- .../batt_mon_i2c_ina219/__init__.py | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py index eb448f641..c9b51eece 100644 --- a/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py +++ b/src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py @@ -16,34 +16,7 @@ class battmon_ina219(BatteryMonitorBase.BattmonBase): '''Battery Monitor based on a INA219 - CAUTION - WARNING - ======================================================================== - Lithium and other batteries are dangerous and must be treated with care. - Rechargeable Lithium Ion batteries are potentially hazardous and can - present a serious FIRE HAZARD if damaged, defective or improperly used. - Do not use this circuit to a lithium ion battery without expertise and - training in handling and use of batteries of this type. - Use appropriate test equipment and safety protocols during development. - - There is no warranty, this may not work as expected or at all! - ========================================================================= - - This script is intended to read out the Voltage of a single Cell LiIon Battery using a board with a INA219: - - 3.3V - + - | - .----o----. - | | SDA - .-------------------------------o AIN o------ - | | INA219 | SCL - | .----------o AOUT o------ - --- | | | - Battery - Regulator + Raspi '----o----' - 2.9V-4.2V| | | - | | | - === === === - + See [Battery Monitor documentation](../../builders/components/power/batterymonitor.md) ''' def __init__(self, cfg): From 24f1183e5954267d1702c3ccf15cbfee4896ec6e Mon Sep 17 00:00:00 2001 From: Timm Date: Fri, 7 Jun 2024 20:01:38 +0200 Subject: [PATCH 14/17] fix markdown lint for batterymonitor.md --- .../builders/components/power/batterymonitor.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index 39671c5eb..b54c12fab 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -1,3 +1,5 @@ +# Battery Monitor + > [!CAUTION] > Lithium and other batteries are dangerous and must be treated with care. > Rechargeable Lithium Ion batteries are potentially hazardous and can @@ -7,7 +9,7 @@ > Use appropriate test equipment and safety protocols during development. > There is no warranty, this may not work as expected! -# Battery Monitor based on a ADS1015 +## Battery Monitor based on a ADS1015 The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/__init__.py) is intended to read out the voltage of a single Cell LiIon Battery using a [CY-ADS1015 Board](https://www.adafruit.com/product/1083): ```text @@ -31,7 +33,7 @@ The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_i > * the circuit is constantly draining the battery! (leak current up to: 2.1µA) > * the time between sample needs to be a minimum 1sec with this high impedance voltage divider don't use the continuous conversion method! -# Battery Monitor based on an INA219 +## Battery Monitor based on an INA219 The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/__init__.py) is intended to read out the voltage of a single cell or multiple LiIon Battery using a [INA219 Board](https://www.adafruit.com/product/904): @@ -55,7 +57,7 @@ The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/\_\_in The battery monitoring is configured in the jukebox.yml file. -The "battmon" module has to be added to the modules setting. +The "battmon" module has to be added to the modules setting. ```text modules: @@ -65,6 +67,7 @@ modules: ... battmon: battery_monitor.batt_mon_i2c_ina219 ``` + The battmon module needs further configuration: ```text @@ -76,5 +79,3 @@ battmon: ``` The setting "scale_to_phy_denom" does not influence the INA219. However, the scale can be adjusted to fit multiple LiIon cells. - - From 509ed3dce7ae4d1d1ac3202f41d3ac3d5067158d Mon Sep 17 00:00:00 2001 From: Timm Date: Fri, 7 Jun 2024 20:03:38 +0200 Subject: [PATCH 15/17] fix markdown lint batterymonitor.md --- documentation/builders/components/power/batterymonitor.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index b54c12fab..ac13d7bd4 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -10,6 +10,7 @@ > There is no warranty, this may not work as expected! ## Battery Monitor based on a ADS1015 + The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/__init__.py) is intended to read out the voltage of a single Cell LiIon Battery using a [CY-ADS1015 Board](https://www.adafruit.com/product/1083): ```text @@ -53,7 +54,7 @@ The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ina219/\_\_in === === === ``` -# Configuration example +## Configuration example The battery monitoring is configured in the jukebox.yml file. From b2881ed19c0ac82cfdfdd328308176109a598d95 Mon Sep 17 00:00:00 2001 From: Timm Date: Sat, 8 Jun 2024 09:38:49 +0200 Subject: [PATCH 16/17] Update documentation/builders/components/power/batterymonitor.md Co-authored-by: s-martin --- documentation/builders/components/power/batterymonitor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index ac13d7bd4..b6e5c048b 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -71,7 +71,7 @@ modules: The battmon module needs further configuration: -```text +```yaml battmon: scale_to_phy_num: 1 scale_to_phy_denom: 0 From 9f523072b09d3b92e65aa86cb9d0eb76b2f6611c Mon Sep 17 00:00:00 2001 From: Timm Date: Sat, 8 Jun 2024 09:39:14 +0200 Subject: [PATCH 17/17] Update documentation/builders/components/power/batterymonitor.md Co-authored-by: s-martin --- documentation/builders/components/power/batterymonitor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/builders/components/power/batterymonitor.md b/documentation/builders/components/power/batterymonitor.md index b6e5c048b..151010caa 100644 --- a/documentation/builders/components/power/batterymonitor.md +++ b/documentation/builders/components/power/batterymonitor.md @@ -60,7 +60,7 @@ The battery monitoring is configured in the jukebox.yml file. The "battmon" module has to be added to the modules setting. -```text +```yaml modules: named: # Do not change the order!