Power on by default

Is there a way to have the HAT power on by itself after a power failure without having to press the button?

Hi @asismorodo,

Of course, there is.
Run the following Python script:

import time
import RPi.GPIO as GPIO

POWERKEY = 24
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(POWERKEY, GPIO.OUT)

try:
    GPIO.output(POWERKEY,1)
    time.sleep(5)
    GPIO.output(POWERKEY,0)
    time.sleep(5)             
except:
    print("Error") 
finally:
    print("Clean up") 
    GPIO.cleanup()

I hate to differ, but this does not solve the issue.

Could you please explain when this script is supposed to run and what it is supposed to do.

I understand that it is setting up the GPIO in BCM (pin alias mode) to basically push the power key.

How is this supposed to power on the Pi when the Pi can’t actively run this code?

Could you please clarify?

S

@ensar,

Could you clarify where and how this code is supposed to be run?

S

Hi @shawnj007,

My apologies for the delay in responding.

This code is used to turn on the module without having to press the button for the Tracker HAT.

Thanks @ensar, that makes a lot more sense now. I missed the subforum I was in, I think.

S

1 Like

Hi @ensar
Is there a way to have the HAT power ON even without interfering with GPIO programmatically?
Is the a way to solve this need on a hardware level?
I have another HAT on RPI which interfering with GPIO and not working because I use GPIO programmatically for Cellular IoT HAT.

thanks in advance,

Hi @dima,

For the Cellular IoT HAT, you may detach the POWER Key from the GPIO24. Once it is detached you cannot control the power of the module programmatically. For details please check, Solder Jumper section of the technical documentation of the product.

Thanks.

1 Like