问题:
- ADC计数转换为电压是否取决于+5 V引脚的实际电压?
- 如果是,从板上获取该电压的可接受方法是什么?
背景/详细信息:
我有一个电路,其中有一个通过USB连接器(从集线器)运行的Arduino Nano(克隆)。Arduino的工作是测量电池上的电压,该电压将驱动Nano接通/断开的第二个电路。供参考,它是电池测试仪。
诺基亚5110屏幕上显示了以下非常简单的草图中的电压。
void setup() {
  Serial.begin(9600);
  display.begin();
  // Init done
  // You can change the contrast around to adapt the display
  // for the best viewing!
  display.setContrast(50);
  // Text display tests
  display.setTextSize(1);
  display.setTextColor(BLACK);
}
void loop() {
  display.clearDisplay();   // Clears the screen and buffer
  display.setCursor(0,0);
  display.print("Vin=");
  int rawVIN = analogRead(VIN);
  float floatVin = (rawVIN*4.75)/1023.0;
  display.println(floatVin);
  Serial.println(rawVIN);
  display.display();
  delay(1000);
}
- 我使用DVM测量了电池电压,该电压为4.13 V,但Nano报告为4.35V。
- 我在电池和Arduino之间有着共同点。
- 因为测试电压的连接可能会浮空,所以我有一个下拉电阻来阻止剧烈波动(> 10kΩ)
经过一番调查,我发现+5 V实际上是输出4.75 V,并从
float v = (rawVIN*5.0)/1024.0;
至
float v = (rawVIN*4.75)/1024.0;
现在Arduino上的电压读数是正确的。我这样做并不是因为我了解自己的所作所为,而是因为我有预感,它可能会将值更改为正确的值。



