EckeNeutrum
Posts: 4
Joined: Tue Apr 14, 2020 2:48 pm

GPIO 4 is turning off automatical

Tue Apr 14, 2020 3:01 pm

Hello,
if i activate GPIO 4 with this script:

Code: Select all

import RPi.GPIO as GPIO
import time
 
GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.OUT)

GPIO.output(4,True)
    
It's turning on the LED but the LED is automatical getting turned of after some seconds.

If i create a clock

Code: Select all

while True:
    GPIO.output(4,True)
    time.sleep(0.1)
    GPIO.output(4,False)
    time.sleep(0.1)
The Lamp is blinking for a few seconds but then stops automatical.

Could someone please help me?

P.S.
Sorry for bad english, i am from Germany.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 3:40 pm

Is 1-wire enabled in /boot/config.txt like this?

Code: Select all

dtoverlay=w1-gpio
If so, comment out that line or disable it in raspi-config or the desktop configuration program.

The 1-wire bus will take over GPIO 4 (pin 7) by default if it is enabled.
Unreadable squiggle

EckeNeutrum
Posts: 4
Joined: Tue Apr 14, 2020 2:48 pm

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 3:47 pm

1-wire is disabled now.
Sadly it's still the same Problem.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 3:54 pm

Did you reboot after disabling it?
Unreadable squiggle

User avatar
bensimmo
Posts: 4622
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 3:59 pm

Move to a different gpio, for example gpio17 (physical pin11 ) https://pinout.xyz/
This is not a fix, just a solution.


Is it a Pi4 ?

EckeNeutrum
Posts: 4
Joined: Tue Apr 14, 2020 2:48 pm

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 4:01 pm

After a reboot it started working again.
Thank you for you solution!

EckeNeutrum
Posts: 4
Joined: Tue Apr 14, 2020 2:48 pm

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 4:03 pm

bensimmo wrote:
Tue Apr 14, 2020 3:59 pm
Move to a different gpio, for example gpio17 (physical pin11 ) https://pinout.xyz/
This is not a fix, just a solution.


Is it a Pi4 ?
Yes, it is a Pi4
Do i need that 1-wire?
Why can't i just let it disabled?

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 4:09 pm

If you don't have any 1-wire devices connected (like a DS18B20 temperature sensor, for example), then you don't need it enabled.
Unreadable squiggle

User avatar
bensimmo
Posts: 4622
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: GPIO 4 is turning off automatical

Tue Apr 14, 2020 6:28 pm

EckeNeutrum wrote:
Tue Apr 14, 2020 4:03 pm
bensimmo wrote:
Tue Apr 14, 2020 3:59 pm
Move to a different gpio, for example gpio17 (physical pin11 ) https://pinout.xyz/
This is not a fix, just a solution.


Is it a Pi4 ?
Yes, it is a Pi4
Do i need that 1-wire?
Why can't i just let it disabled?
No need to use 1-wire at all, I was just suggestin try a different pin to see if ti works :-)

Return to “Troubleshooting”