User avatar
micksulley
Posts: 166
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Low Voltage Detection Not Working

Thu Jun 15, 2017 7:15 pm

Running a Pi3 with an official Raspi power supply, voltage measures 5.14v
I found some code

Code: Select all

#!/usr/bin/python
import RPi.GPIO as GPIO , time

redLED=35
GPIO.setmode(GPIO.BCM)
GPIO.setup(redLED, GPIO.IN)

powerlow=0
while True:
    if(GPIO.input(redLED)==0):
          print "POWER dipped below 4.63v"
          powerlow += 1
    else:
          powerlow =0
    if (powerlow  > 3):
          print "Low power for " + str(powerlow) + " seconds"
    time.sleep(1)
in this post viewtopic.php?f=29&t=82373&hilit=under+ ... l&start=75
but when I run it it immediately reports "POWER dipped below 4.63v" and continues to do so. I have had a voltmeter connected at the same time and it reads 5.14v, so the voltage is not actually low. What can cause this? How can I reliably detect low voltage?
Thanks
Mick

klricks
Posts: 6781
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Low Voltage Detection Not Working

Thu Jun 15, 2017 7:31 pm

Where are you measuring the 5V? You need to measure after the fuse and LV protection circuit such as at the GPIO pins and not at the micro USB power input or power supply.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
micksulley
Posts: 166
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Re: Low Voltage Detection Not Working

Thu Jun 15, 2017 7:40 pm

Yes measuring at GPIO.

User avatar
Burngate
Posts: 6188
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Low Voltage Detection Not Working

Fri Jun 16, 2017 8:50 am

Your code looks at GPIO-35, which on the B+ and 2B is connected to the voltage-sensing circuit.
Unfortunately on the 3B that circuit was moved onto an expander (to make room for the WiFi, etc.) so you're onto a loser.

I believe it's possible to read the GPIOs attached to that expander, using numbers around 130, but someone more knowledgeable than me could tell you more.

User avatar
micksulley
Posts: 166
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Re: Low Voltage Detection Not Working

Fri Jun 16, 2017 8:18 pm

Thanks for the info.

OK boffins, how can I do it?

Return to “Troubleshooting”