Page 1 of 1

Setup battery handler for 18650 battery

Posted: 31 Jan 2021 17:56
by roqvist
I'm powering my Z-Uno with a (solar charged) 18650 battery on the 5V pin. Fully charged it's around 4.2V and can drop to about 3V, I'd like to configure my battery level to match this.

Is it enough to call:

Code: Select all

ZUNO_SETUP_BATTERY_LEVELS(3000, 4200);
or do I also have to specify what pin I'm using (5V power pin and not the default 3V3 pin)? Or do I need custom code/ZUNO_SETUP_BATTERY_HANDLER to accomplish this?

Thanks,

Re: Setup battery handler for 18650 battery

Posted: 01 Feb 2021 04:23
by PoltoS
If you use 5 V pin to power Z-Uno (in your case this is correct not to kill it by 4.2 V) the DC-DC will always give you 3V.

So you need to write a custom handler andeasure with ADC periodically the voltage on the battery (use voltage dividers with big R to adopt to 0-3 range and keep the current thru the divider small

Re: Setup battery handler for 18650 battery

Posted: 01 Feb 2021 04:23
by PoltoS
If you use 5 V pin to power Z-Uno (in your case this is correct not to kill it by 4.2 V) the DC-DC will always give you 3V.

So you need to write a custom handler andeasure with ADC periodically the voltage on the battery (use voltage dividers with big R to adopt to 0-3 range and keep the current thru the divider small

Re: Setup battery handler for 18650 battery

Posted: 01 Feb 2021 22:45
by roqvist
Thanks, I guess I can just divide the 4.2V in half using two resistors in series and then map battery percent between ~1.5V-2.1V?

Re: Setup battery handler for 18650 battery

Posted: 03 Feb 2021 04:16
by PoltoS
Correct. Just make sure to have them big enough not to drain your battery thru those two resistors.