mattg31
Posts: 79
Joined: Fri Jan 05, 2018 9:55 pm

GPIO pin turns on, then auto turns off

Fri Oct 04, 2019 9:22 pm

I am trying to troubleshoot an issue with a GPIO pin turning off automatically. Any advice would be greatly appreciated.

I have GPIO pin 4 connected to a relay: https://www.digikey.ca/products/en?keyw ... 11042-5-ND

My code is:

Code: Select all

	import RPi.GPIO as GPIO
	
	GPIO.setmode(GPIO.BCM)
	GPIO.setwarnings(False)
	GPIO.setup(4,GPIO.OUT)
	GPIO.output(4,GPIO.HIGH)
When I run this, I can hear the relay click on, then in about 1 or 2 seconds it clicks off. I put a voltmeter to confirm that it does in fact go high, then goes low automatically. Is it possible it is being overloaded or something?
Wiring diagram here: https://imgur.com/HOTH5Qq

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO pin turns on, then auto turns off

Fri Oct 04, 2019 9:25 pm

Most likely reason is you have a 1-wire bus running on GPIO4.

Check in /boot/config.txt.

mattg31
Posts: 79
Joined: Fri Jan 05, 2018 9:55 pm

Re: GPIO pin turns on, then auto turns off

Fri Oct 04, 2019 9:32 pm

Most likely reason is you have a 1-wire bus running on GPIO4.
Ahh @joan you are amazing. Thank you! I would not have found that on my own...

Andyroo

Re: GPIO pin turns on, then auto turns off

Fri Oct 04, 2019 10:07 pm

You may find this site handy https://pinout.xyz/

As well as having a handy graphic you can print it shows what pins are used for each interface and what actual pins are used by each board. The latter is handy if the HAT covers all the pins but you feel up to soldering to the back of the Pi board for a connection not used by the HAT.

Return to “Troubleshooting”