Voltage divider resistors - using different resistor values
mitchdes last edited by
Hi everyone - Okay this is my first time with mysensors and really excited to get started. I’ve built a gateway with an ESP which seems to be working fine. It’s recognised in the Mozilla Webthings controller and the serial output all seems okay.
I am making a sensor test board with which i can try out different sensors before building into standalone devices and just needing a bit of help with measuring the battery voltage using a voltage divider. The mysensors sketch uses a 1m and 470k resistors for the voltage divider.
My issue is that I only have a 1m resistor and a 480k rather than the 470k and want to know if the sketch can be modified to work with this 480k resistor.
My sensor will be powered with a single 18560 cell as I have lots freely available and boosted to 5v for my mini pro (again because i have quite a few of these). So max battery voltage will be 4.2v and minimum voltage around 2.7v.
Divider using 470k resistor: 1.343v (Vbatt=4.2v) and 0.863v (Vbatt=2.7v)
Divider using 480k resistor: 1.362v (Vbat=4.2v) and 0.876v (Vbatt=2.7v)
Is as simple as altering the math in the sketch to account for the different readings?
Welcome to the forum @mitchdes
Yes, you are correct.