【发布时间】:2019-11-14 18:12:11
【问题描述】:
我现在测量电池的电路是 esp32、nrf24l01 和 18650。我用 18650 3.6V 标称/4.2 最大电池为 esp32 供电。运行分压器 100k、27k,然后测量点为 0.893V。在 3.6V 测量点,例如 ~0.72。
我使用内部 1.1V ADC,但为什么我只能在显示器上收到 ~3V
float battery_read()
{
//read battery voltage per %
long sum = 0; // sum of samples taken
float voltage = 0.0; // calculated voltage
float output = 0.0; //output value
const float battery_max = 4.2; //maximum voltage of battery
const float battery_min = 3.0; //minimum voltage of battery before shutdown
float R1 = 100000.0; // resistance of R1 (100K)
float R2 = 27000.0; // resistance of R2 (10K)
for (int i = 0; i < 100; i++)
{
sum += adc1_get_voltage(ADC1_CHANNEL_0);
delayMicroseconds(1000);
}
// calculate the voltage*/
voltage = sum / (float)100;
Serial.println(voltage);
voltage = (voltage *1.1) / 2047.0; //for internal 1.1v reference
// use if added divider circuit
voltage = voltage / (R2/(R1+R2));
【问题讨论】:
-
当您实际在 ADC 输入端使用精密万用表时,您看到的电压是多少?
-
我使用 VOM,然后我的 VBat 为 3.62,ADC 输入为 0.7xx。从代码中我只监控 VIN = VOUT/因子。大约是 3.0V