bash 测量运行 Ubuntu 的 Raspberry Pi B+ 的输入电压

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33129869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:44:18  来源:igfitidea点击:

Measure input voltage of Raspberry Pi B+ running Ubuntu

bashubunturaspberry-pihardware

提问by Falko

I just learned that a red flashing LED indicates voltage below 4.63Von a Raspberry Pi Model B+.

我刚刚了解到,在Raspberry Pi Model B+上,红色闪烁的 LED 指示电压低于 4.63V

Is there a command to determine the voltage programmatically?

是否有以编程方式确定电压的命令?

I tried vcgencmd measure_volts. But it yields 1.2000V, independent of the input source and the LED status. And it doesn't seem to be related to the 4.63V mentioned above.

我试过了vcgencmd measure_volts。但它产生 1.2000V,与输入源和 LED 状态无关。而且好像和上面提到的4.63V没有关系。

Update

更新

Let me describe the situation in a bit more detail:

让我更详细地描述一下情况:

I'm powering the Raspberry Pi with a lead-acid battery built into a moving robot. After operating the robot for a while, the voltage seams to drop below a critical minimum, causing potential damage to the file system. Therefore, I'd like to detect low voltage automatically (and trigger the robot to return to the charging station).

我正在使用内置在移动机器人中的铅酸电池为 Raspberry Pi 供电。操作机器人一段时间后,电压接缝降至临界最小值以下,从而对文件系统造成潜在损坏。因此,我想自动检测低电压(并触发机器人返回充电站)。

I'm asking here in StackOverflow, since I assume the solution not to be robotic-specific, but generally applicable to other machines.

我在 StackOverflow 中询问,因为我认为该解决方案不是特定于机器人的,但通常适用于其他机器。

采纳答案by pocjoc

Yes you can, as it is said in this topic Under-voltage warningsyou can know the low voltage reading the GPIO 35. For reading GPIO, you can refer to this topic: Python Script to read one pin

可以,正如本主题中所说的欠压警告可以知道读取GPIO 35的低电压。读取GPIO可以参考本主题: Python Script to read one pin

回答by Sebastian Stigler

Have a look at the adafruit ina219sensor https://learn.adafruit.com/downloads/pdf/adafruit-ina219-current-sensor-breakout.pdf.

看看adafruit ina219传感器https://learn.adafruit.com/downloads/pdf/adafruit-ina219-current-sensor-breakout.pdf

This sensor can be put between the battery and the raspberry and measures the current and the voltage along this connection (0-26V and max. 3.2A). It communicates via i2c bus. Together with an Arduino you can easyly build an battery watchdog for your raspberry. A sample program and the arduino driver can be found here: https://github.com/adafruit/Adafruit_INA219.

该传感器可以放在电池和覆盆子之间,并测量沿此连接的电流和电压(0-26V 和最大 3.2A)。它通过 i2c 总线进行通信。与 Arduino 一起,您可以轻松地为您的树莓构建一个电池看门狗。可以在此处找到示例程序和 arduino 驱动程序:https: //github.com/adafruit/Adafruit_INA219

回答by User404

According to https://raspberrypi.stackexchange.com/questions/7414/is-it-possible-to-detect-input-voltage-using-only-softwareit's not possible to do it on software level without other hardware.

根据https://raspberrypi.stackexchange.com/questions/7414/is-it-possible-to-detect-input-voltage-using-only-software,如果没有其他硬件,就不可能在软件级别上做到这一点。