Home Page Forums Raspberry Pi Shields GPRS Shield ON/OFF without pressing Power-Up button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1471

    There are ways to ON/OFF GPRS shield without pressing Power-Up button. Thanks to Michael, he shared a great solution for this need.

    In summary, Power-Up button is connected to Pin 22 = GPIO 25. If you trigger (deliver HIGH) this pin for 2 seconds, you toggle the power on the shield.

    Method 1: Confirmed
    I am using Node-Red to enable/disable GPRS Shield without pressing the POWER-UP button. I works perfectly fine.
    All you have to do is to trigger Pin22 = GPIO25 for 2 seconds.

    Below, I am sharing the Node-Red flow:

    [{“id”:”bcb77d81.4a6828″,”type”:”rpi-gpio out”,”z”:”26a23853.7e3dc”,”name”:”PIN22 = GPIO25″,”pin”:”22″,”set”:””,”level”:”0″,”out”:”out”,”x”:440,”y”:60,”wires”:[]},{“id”:”3e5dfeca.d784aa”,”type”:”trigger”,”z”:”26a23853.7e3dc”,”op1″:”1″,”op2″:”0″,”op1type”:”str”,”op2type”:”str”,”duration”:”2″,”extend”:false,”units”:”s”,”reset”:””,”name”:””,”x”:260,”y”:60,”wires”:[[“bcb77d81.4a6828”]]},{“id”:”5e11e1a8.b99128″,”type”:”inject”,”z”:”26a23853.7e3dc”,”name”:”toggle”,”topic”:””,”payload”:””,”payloadType”:”date”,”repeat”:””,”crontab”:””,”once”:false,”x”:110,”y”:60,”wires”:[[“3e5dfeca.d784aa”]]}]

    Method 2: (Belongs to Michael)
    Creating a standard BASH script, something like

    # Exports pin to userspace
    echo “25” > /sys/class/gpio/export

    # Sets pin 25 as an output
    echo “out” > /sys/class/gpio/gpio25/direction

    # Sets pin 25 to high
    echo “1” > /sys/class/gpio/gpio25/value

    Sleep 2

    # Sets pin 25 to low
    echo “0” > /sys/class/gpio/gpio25/value

    Save as a xxxxxxx.sh, make it executable, call it from the GPRS script something like inserting it….

    Sudo startgprs.sh

    Running it again will turn it off

    Starting the whole ppp0 script on boot is left as an exercise to the student…..Google is your friend…8-)


    Start GPRS mudule at boot using Python

    Make sure the module is off

    from terminal:
    1. create a startgprs.py file (touch startgprs.py)
    2. copy the following code on it:

    import RPi.GPIO as GPIO ## Import GPIO Library
    import time ## Import ‘time’ library. Allows us to use ‘sleep’

    GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
    GPIO.setup(22, GPIO.OUT) ## Setup GPIO pin 7 to OUT

    GPIO.output(22, True) ## Turn on GPIO pin 7
    time.sleep(2) ## Wait
    GPIO.output(22, False) ## Switch off GPIO pin 7

    3. makes it executable (chmod +x startgprs.py)

    4. try it! (python startgprs.py). The blue led start to flash

    5. Create auto boot (sudo crontab -e) and the add the end; @reboot python /home/pi/startgprs.py &

    That’s it!


    I have a similar script 🙂

    Is there any way though to power the shield on if it’s connected to a Pi via a USB port rather than the GIOP pins?


    No that I know. Whats the purpose thought? Do you have a specific task using the USB?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.