###############################################
#  Measure State of Charge of Alkaline Battery
#
# Author:	Dr. Giovanni Visco
# At:	La Sapienza Rome University
# Version: with Rinternal, oversample2x, apr26
# Copyright Creative Commons Public
# License under, CC BY-NC-ND 4.0 EN
# Running version :	v. 2.0
# Compiled at:	Jun  3 2026	08:15:24
> Battery: AA Energizer, yell, 12/2030
> Battery weight (g): 23.56
# Rload to measure Vbattery (ohm)
# R1= 101.30 , R2= 221.30 , R3= 69.90
# Value from battery Volt at:		14
# Relay drive to Batt meas1, meas2:	6   7
# Relay drive to Batt load1, load2:	4   5
# Number of SoC measure:		11
# Delay between SoC measures (s):	1
# SoC delay between load and meas (s):	5
# ESR delay between loads -> meas (s):	2
###############################################

##################################
# Measure Battery ESR with 3 Rload
#
# connect battery, no load
# delay ... 2s
# measure
# bytes: 870 Volts: 1.4115
# detach battery
# delay ... 14s
#
# connect battery, no load
# delay ... 2s
# measure
# bytes: 870 Volts: 1.4115
# connect R1 (ohm) = 221.30
# delay ... 2s
# measure
# bytes: 866 Volts: 1.4050
# detach battery
# delay ... 14s
#
# connect battery, no load
# delay ... 2s
# measure
# bytes: 870 Volts: 1.4115
# connect R2 (ohm) = 101.30
# delay (s) 2
# measure
# bytes: 862 Volts: 1.3985
# detach battery
# delay ... 14s
#
# connect battery, no load
# delay ... 2s
# measure
# bytes: 869 Volts: 1.4099
# connect R3 (ohm) = 69.90
# delay (s) 2
# measure
# bytes: 858 Volts: 1.3920
# detach battery
#
# end of ESR measure
# delay ... 14s
# delay ... 14s
# delay ... 14s
#
# make a chart with the following data
##################################
#  Measure Battery with no load  #
# n.	digit	Volt	not
# 1	870	1.4115	.
# 2	870	1.4115	.
# 3	870	1.4115	.
# 4	870	1.4115	.
# 5	870	1.4115	.
# 6	870	1.4115	.
# 7	870	1.4115	.
# 8	870	1.4115	.
# 9	870	1.4115	.
# 10	870	1.4115	.
# 11	870	1.4115	.
# delay ... 5s
#########################################
# Measure Battery with load ohm: 101.30
# n.	digit	Volt	I (mA)	W (mW)
# 1	865	1.4034	13.85	19.44
# 2	862	1.3985	13.81	19.31
# 3	862	1.3985	13.81	19.31
# 4	862	1.3985	13.81	19.31
# 5	862	1.3985	13.81	19.31
# 6	861	1.3969	13.79	19.26
# 7	861	1.3969	13.79	19.26
# 8	860	1.3953	13.77	19.22
# 9	860	1.3953	13.77	19.22
# 10	860	1.3953	13.77	19.22
# 11	860	1.3953	13.77	19.22
# delay ... 15s
##################################
#  Measure Battery with no load  #
# n.	digit	Volt	not
# 1	868	1.4083	.
# 2	868	1.4083	.
# 3	868	1.4083	.
# 4	868	1.4083	.
# 5	868	1.4083	.
# 6	868	1.4083	.
# 7	868	1.4083	.
# 8	868	1.4083	.
# 9	868	1.4083	.
# 10	868	1.4083	.
# 11	868	1.4083	.
# calibrate Arduino with High Quality Volt Meter, this 3.3V=2034
# END
