dadrake3
Posts: 1
Joined: Thu Oct 11, 2018 2:34 am

Waking and halting the raspi

Thu Oct 11, 2018 2:41 am

I am using an LED matrix which requires the use of GPIO 6 so I cannot use this pin to sleep the device. But I believe that since the matrix is not in use while the pi is sleeping I could in theory still use this pin to wake the device if I were to only short the pin momentarily. I believe there is a way to use transistors such that when the pi is sleeping and the button is pressed it momentarily shorts pin 6, then switches immediately such that when the pushbutton is unlicked a different pin catches the falling edge and sleeps the pi. What I am primarily looking to do is build a circuit which momentarily sends a grounding signal to GPIO 6 and then adds high impedance to 6 and effectively disconnects, something of a tristate buffer. Thanks

klricks
Posts: 5923
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Waking and halting the raspi

Fri Oct 12, 2018 2:09 am

dadrake3 wrote:
Thu Oct 11, 2018 2:41 am
I am using an LED matrix which requires the use of GPIO 6 so I cannot use this pin to sleep the device. But I believe that since the matrix is not in use while the pi is sleeping I could in theory still use this pin to wake the device if I were to only short the pin momentarily. I believe there is a way to use transistors such that when the pi is sleeping and the button is pressed it momentarily shorts pin 6, then switches immediately such that when the pushbutton is unlicked a different pin catches the falling edge and sleeps the pi. What I am primarily looking to do is build a circuit which momentarily sends a grounding signal to GPIO 6 and then adds high impedance to 6 and effectively disconnects, something of a tristate buffer. Thanks
I think you have mixed up pin and GPIO numbers .........
By default momentarily shorting pin 5 (GPIO 3) to pin 6 (GND) will start the RPi from as shutdown state regardless of what is connected.

If the following is added to /boot/config.txt:

Code: Select all

dtoverlay=gpio-shutdown
Then pin 5 (GPIO3) and pin 6 can also be used to initiate a safe shutdown.

If you plan to use the I2C interface or are using GPIO 3 for something else then you will need to change the shutdown function to a different pin.
For example to change the shutdown pin from the default GPIO 3 (pin 5) to GPIO 26 (physical pin 37), add this to /boot/config.txt

Code: Select all

dtoverlay=gpio-shutdown,gpio_pin=26
Pin 39 (GND) could then be used as it is conveniently located next to GPIO 26 (pin 37)
So changing from default will require 2 buttons.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

Return to “Advanced users”