2

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?

2 Answers2

4

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:

#!/bin/bash
if [ ! -e /sys/class/gpio/gpio4 ]; then
    echo "File exists."
    echo "4" > /sys/class/gpio/export
fi
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

1

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