Author Topic: Problems with Latching Button  (Read 2158 times)

eyeQ711

  • NewMember
  • *
  • Posts: 5
Problems with Latching Button
« on: August 08, 2020, 03:48:34 PM »
Hi,

I am a little bit confused maybe you can help me? First I ordered an ATX Raspi in 2018 and got Version 2.8
is this normal? Additionally I bought your latching button (Product ID150).

So here is my problem: I attached the ATXRaspi and installed your Software (by the way there is a problem in shutdownirq.py which was correct in python2 but nowadays with python3 you need to add parentheses around the value to be printed). The script is running and I am getting the boot message. At this time BOOT OK LED goes green.

Additional info: I soldered the latching button switch at the backside. So it is closed.

When I release the pressed button to switch the RPI off it begins to Flash. Red LED (Shutdown) on ATX Raspi blinks for one second and then RPI reboots while the Button keeps flashing. As soon as booting is finished the button stops flashing (LED now permanent on). BOOT OK is back to green. Button is in released position now, pressing it down, nothing changes. At this point we can start at beginning :-)

Pressing and Releasing it 2 times is shuting down RPI (even if the Button LED stays on).

Any ideas are welcome.

PS: Sorry that it tooks 2 years for this, but I didnt find time for the project earlier ....


eyeQ711

  • NewMember
  • *
  • Posts: 5
Re: Problems with Latching Button
« Reply #1 on: August 09, 2020, 05:57:55 AM »
Pressing and Releasing it 2 times (quickly in a row) is shuting down RPI (even if the Button LED stays on), while shutdown LED ist on.

just to clearify....

as I need no reboot feature, maybe there is a way to deactivate it in your script?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems with Latching Button
« Reply #2 on: August 10, 2020, 09:42:43 AM »
With ATXRaspi v2.8 the functionality is baked into the board. A long press is shutdown, a short press is reboot. The type of button does not matter, a latching button is just one that ... latches, otherwise it is the same as momentary - when it's pressed the switch is closed.

To disable the reboot in the script you will have to remove the reboot section and make the shutdown section activate as soon as there is a HIGH on the "SHUTDOWN" signal.
Or that should be equivalent to swapping the content of the reboot with the shutdown and remove the reboot.

eyeQ711

  • NewMember
  • *
  • Posts: 5
Re: Problems with Latching Button
« Reply #3 on: August 12, 2020, 03:24:55 PM »
thanks for your explanation, but maybe I described my issue wrong (sry I am no natural speaker).
I added an example video here

I tried both... pressing and releasing it with short or long pressure. You see no change in behaviour.
My target is simple: Just shutdown, if the latching button is released.

Here are some photos of my (poor) soldering...


/edit: maybe I soldered the button wrong? Unfortunatelly there is no manual for it. Your shop stated only
Code: [Select]
 For use with ATXRaspi you can use the following wiring: [nothing]
« Last Edit: August 12, 2020, 04:08:43 PM by eyeQ711 »

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Problems with Latching Button
« Reply #4 on: August 12, 2020, 04:46:41 PM »

/edit: maybe I soldered the button wrong? Unfortunatelly there is no manual for it. Your shop stated only
Code: [Select]
 For use with ATXRaspi you can use the following wiring: [nothing]

The link for the wiring is broken but you can see the wiring for both the momentary and latching switches here;

https://lowpowerlab.com/guide/atxraspi/?view=all

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems with Latching Button
« Reply #5 on: August 13, 2020, 04:03:29 PM »
Soldering looks decent. I would still check the wiring and the switch if you have not done so already (continuity check, that the switch works as expected - fully ON when pressed, OFF when released).

Latching mode jumper is there to help you use a slide switch. Or a latching switch (when latched or pressed, the ATXRaspi is ON), when released, the ATXRaspi will turn Pi off. In this mode reboot should not be expected, although it's still possible to trigger a reboot (by quickly releasing and re-latching the button).

eyeQ711

  • NewMember
  • *
  • Posts: 5
Re: Problems with Latching Button
« Reply #6 on: August 15, 2020, 07:00:53 AM »
Thanks so far, but it seems I continue to struggle on this:

I desoldered latching jumper (check this photo) and controlled all cables.

Bahaviour does not really change.

This is what I have:
  • One short press RPI reboots
  • One long press RPI reboots
  • Two short press RPI shutdown, but button LED not
  • Two press while its off will start it, and while boot post is still running it is shutdown and Button LED is off
I verified this behaviour with a simple momentary button - check this video for it.

For better understanding whats going on I have connected (only) the power LED from the old button too.

After some trial and error I commented out the IF for reboot section in you script:

Code: [Select]
#!/usr/bin/python
# ATXRaspi/MightyHat interrupt based shutdown/reboot script
# Script by Tony Pottier, Felix Rusu
import RPi.GPIO as GPIO
import os
import sys
import time

GPIO.setmode(GPIO.BCM).

pulseStart = 0.0
REBOOTPULSEMINIMUM = 0.2 #reboot pulse signal should be at least this long (seconds)
REBOOTPULSEMAXIMUM = 1.0 #reboot pulse signal should be at most this long (seconds)
SHUTDOWN = 7<-->      #GPIO used for shutdown signal
BOOT = 8        #GPIO used for boot signal

# Set up GPIO 8 and write that the PI has booted up
GPIO.setup(BOOT, GPIO.OUT, initial=GPIO.HIGH)

# Set up GPIO 7  as interrupt for the shutdown signal to go HIGH
GPIO.setup(SHUTDOWN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

print ("\n==============================================================")
print ("   ATXRaspi shutdown IRQ script started: asserted pins (",SHUTDOWN, "=input,LOW; ",BOOT,"=output,HIGH)")
print ("   Waiting for GPIO", SHUTDOWN, "to become HIGH (short HIGH pulse=REBOOT, long HIGH=SHUTDOWN)...")
print ("===============================================================")
try:
 while True:<--->
  GPIO.wait_for_edge(SHUTDOWN, GPIO.RISING)
  shutdownSignal = GPIO.input(SHUTDOWN)
  pulseStart = time.time() #register time at which the button was pressed
  while shutdownSignal:
   time.sleep(0.2)
   if(time.time() - pulseStart >= REBOOTPULSEMAXIMUM):
    print ("\n==============================================================")
    print ("            SHUTDOWN request from GPIO", SHUTDOWN, ", halting Rpi ...")
    print ("===============================================================")
    os.system("sudo poweroff")
    sys.exit()
   shutdownSignal = GPIO.input(SHUTDOWN)

  #if time.time() - pulseStart >= REBOOTPULSEMINIMUM:
  #<----->print ("\n==============================================================")
  #<----->print ("            REBOOT request from GPIO", SHUTDOWN, ", recycling Rpi ...")
  #<----->print ("===============================================================")
  #<----->os.system("sudo reboot")
  #<----->sys.exit()

  if GPIO.input(SHUTDOWN): #before looping we must make sure the shutdown signal went low
   GPIO.wait_for_edge(SHUTDOWN, GPIO.FALLING)
except:
 pass.
finally:
 GPIO.cleanup()

Momentary button works as expected (2s pressed -> Shutdown with Botton LED goes off).
Maybe I just buy a momentary button with LED and use it?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems with Latching Button
« Reply #7 on: August 15, 2020, 12:09:44 PM »
Something is not right. Either wiring is not correct or the ATXRaspi is damaged and no longer working correctly.
I need to see exactly how it is all wired.
The power button should be OFF when the Pi is OFF.

eyeQ711

  • NewMember
  • *
  • Posts: 5
Re: Problems with Latching Button
« Reply #8 on: August 27, 2020, 04:15:59 AM »
Hi Felix I apreciate your support. Thank you.

Wiring is allready posted in my first threads. Im not sure what else you like to see?

Actually it works with a momentary button and uncommented reboot section. But now I realised that I need an software swtich too. As far as I see this is not possible with R2.8 - correct? I am wondering to why I got R2.8 in 2018?

As the ATXRaspi seems not to be available anymore: Is the production discontinued? I'd like to thank you for the support by buying a new one R3 (and if possble I'd like to ask if you can do the soldering for me^^).

Kris

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems with Latching Button
« Reply #9 on: August 27, 2020, 09:57:09 AM »
2.8 was the version available in 2018.
Others are asking about 3.0 so I am hoping to make a new batch in the coming weeks sometime. You can sign up on the product page to get notified when it's back in stock.
Thanks for the patience.