Debian has a package called indicator-power which notebooks use to show the current power.

I have a working voltage divider and ADC wired up to my external power source, and I have correct reading from the GPIO.

Can I somehow feed the readings into the input of indicator-power or xbattbar and have it work just like how notebooks do?

I don't know if there are alternative packages, but anything that has a dynamic icon, be it numbers or a bar, on the top panel will suffice.

  • What exactly do you want to measure? The power consumption of your Raspberry Pi? – TheDiveO Jun 9 '17 at 5:07
  • Actually, the battery level. Voltage will be fed from an ADC to GPIO. – Vicary Jun 9 '17 at 5:14
  • The battery level of what? The RPi does not have an internal battery. – Moose Jun 9 '17 at 5:34
  • I have an external battery rigged up, with voltage readings available from the GPIO pins. The only thing left to do is find a way to tap into where power indicator reads and have it read my numbers instead. – Vicary Jun 9 '17 at 8:24

The Pi has no analogue inputs so you will need to buy an ADC (e.g. MCP3202) to read the voltage. That will convert the analogue voltage to a value which can be read by the Pi (in the case of the MCP3202 the value would be in the range 0-4095 and the SPI interface would be used).

A problem is that you need a stable reference voltage. The Pi's 5V line is unregulated so you would probably have to use the Pi's regulated 3V3 line. In that case you will only be able to measure voltages in the 0-3.3V range. Given that your battery is probably greater than 6V when fully charged you will need to use a voltage divider (perhaps a pair of resistors) to drop the voltage to the 0-3.3V range.

  • I have a working voltage divider and an ADC circuit, my question is about a way to integrate that reading with the panel in desktop environment of Debian. – Vicary Jun 10 '17 at 10:10
  • @Vicary You really ought to edit relevant information into your question. There is no mention of a voltage divider or an ADC. – joan Jun 10 '17 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.