I have two modem HATs.

HAT A is one of these: https://www.itead.cc/wireless/gsm-gprs-and-wifi/raspberry-pi-sim800-gsm-gprs-add-on-v2-0.html

HAT B is one of these: https://www.waveshare.com/product/modules/wireless/gps-gsm/gsm-gprs-gnss-hat.htm

Using both a Pi model B+ and a Pi Zero, I can successfully power on HAT A at boot by the addition of these commands to /etc/rc.local :

echo 17 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio17/direction
echo 1 > /sys/class/gpio/gpio17/value

HAT B does not power on automatically with these commands.

I've found the schematic for HAT B here: https://www.waveshare.com/w/upload/2/20/GSM-GPRS-GNSS-HAT-Schematic_.pdf.

Looking at the section in the middle at the bottom of the schematic (titled 'RPI GPIO'), it would appear that the power gpio is number 17, and so the code I have in /etc/rc.local should work (but doesn't) -- have I misunderstood the schematic? I've not dealt with gpio in the past.

Can anyone suggest a way of getting HAT B to turn on automatically at boot, please?

  • Based on the documentation wiki for that WaveShare board (waveshare.com/wiki/GSM/GPRS/GNSS_HAT) it looks like the only way to power it on is to press the PWRKey button manually. I would contact their support via email (service@waveshare.com). Please let us know if you find a way. This board looks very nice, but I wouldn't want to buy one if you have to always manually power it up on restart.
    – MrChips
    Nov 25 '17 at 4:12
  • I emailed Waveshare support and got this reply: "Hello, No, I'm sorry, it can only be powered on by hardware operation. " I'm going to persist and see if there's some way, as I bought three of these HATs ...... I should have read the wiki first ! Nov 25 '17 at 13:20
  • did you manage to get it to connect to the network? Nov 1 '18 at 18:40

I've asked the guys at WaveShare, they answered that the power on/off feature has been included in the board from some time, and simply you have to take gpio4 down for one second to turn on the board (if you do it again you'll turn it off).

The following script do the trick:

if [ ! -e /sys/class/gpio/gpio4 ]; then
    echo "File exists."
    echo "4" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio4/direction
echo "0" > /sys/class/gpio/gpio4/value
sleep 2
echo "1" > /sys/class/gpio/gpio4/value

Unluckly my board is and old one.

I've resolved the problem welding a wire from gpio4 to the end of the button on the board, is something it require some attention but it can be done (I'll done it twice with no damages).

Hope this helps

  • I dont know why this response was downvoted - that code toggles power on the Waveshare board as requested. The physical power switch PWRKEY/P4 is tied to GPIO4 (Pin 7) as well as pin 39 on the SIM868. May 27 '18 at 17:30
  • It WOULD be nice if it could outright turn it on or off, instead of just act as a toggle. When the device reboots, we have it set to turn on - so if its is on when a reboot starts, it turns it off when it goes back in! Nov 3 '18 at 11:52

In the end I was able to do this by shorting the power key (soldering a wire between two contacts), thanks to the help I received here: Establishing how to power on a HAT using GPIO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.