Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Power on/off button
#1
Hi 

with previous releases of Moode I have been using this AUDIOPHONICS PI-SPC V2 Power Management Module for Raspberry Pi: https://www.audiophonics.fr/en/raspberry...10912.html

I always followed the installation for Moode as described here: https://github.com/audiophonics/Raspberr...management 

Now with Moode 8.0.0 it seems that it does not work. Anyone can help me understand why is does not work? 

Thank you 
Bruno
Reply
#2
Did you add the two lines to /boot/config.txt as mentioned in the guide?
Reply
#3
Hi Bruno,
You don't need to change config.txt file ! GPIO settings are made by the python script.
You only need to get the script and to change restart.sh ans rc.local as described in audiophonics doc.

And remember that moOde upgrades (new image of course, and also built-in upgrade) need to check that python script is still in /home/pi, and moOde files modified as described.
Fo myself, I made a checklist (in french) to be sure PI-SPC V2 is well installed. Ask me (mp) if you need.

Philippe
Reply
#4
Hi all

Since upgrading to 8.xx i have problems installing the power management from audiophonics.

What I did so far with Moode 7.xx:


Code:
cd /home/pi
wget https://raw.githubusercontent.com/audiophonics/Raspberry-pwr-management/master/sds_moode.sh
wget https://raw.githubusercontent.com/audiophonics/Raspberry-pwr-management/master/softshutdown_moode.sh
mv sds_moode.sh sds.sh
mv softshutdown_moode.sh softshutdown.sh
sudo chmod +x sds.sh
sudo chmod +x softshutdown.sh


# Update restart.sh

sudo nano /var/local/www/commandw/restart.sh


# Update this section :

    if [[ $1 = "poweroff" ]]; then
    mpc stop
    systemctl stop nginx
    python /home/pi/softshutdown.sh
    #      poweroff
    fi

# Edit rc.local :

sudo nano /etc/rc.local
    
    # Add before exit :
    sudo bash /home/pi/sds.sh


# Reboot!



It had been working with Moode 7.xx quite easy so far.

Any idea what changed within Moode 8 for the script from Audiophonics to  not work anymore?


AtB

Martin
Reply
#5
(03-29-2022, 01:19 PM)maartin Wrote: Since upgrading to 8.xx i have problems installing the power management from audiophonics. What I did so far with Moode 7.xx:

Code:
cd /home/pi
wget https://raw.githubusercontent.com/audiophonics/Raspberry-pwr-management/master/sds_moode.sh
wget https://raw.githubusercontent.com/audiophonics/Raspberry-pwr-management/master/softshutdown_moode.sh
mv sds_moode.sh sds.sh
mv softshutdown_moode.sh softshutdown.sh
sudo chmod +x sds.sh
sudo chmod +x softshutdown.sh


# Update restart.sh

sudo nano /var/local/www/commandw/restart.sh


# Update this section :

    if [[ $1 = "poweroff" ]]; then
    mpc stop
    systemctl stop nginx
    python /home/pi/softshutdown.sh
    #      poweroff
    fi

# Edit rc.local :

sudo nano /etc/rc.local
    
    # Add before exit :
    sudo bash /home/pi/sds.sh


# Reboot!


Hi Martin, The Audiophonics python script you mentionned is indicated for Volumio. Use the "all in one" moOde dedicated script, without confit.txt changes (the script also makes GPIO settings).
Regards,
Philippe
Reply
#6
Hi guys,

On my other Pi (not moOde) I've done it as below. No python installed or scripts added to autostart needed:

1. connect one switch terminal to GPIO 3 (pin 5) and GPIO 17 (pin 11)
2. connect the other switch terminal to GND (pin 6, 9, etc)
3. add a below line to /boot/config.txt :
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up,debounce=1000
4. done

A quick explanations: GPIO 3 is a power up pin as defualt, the line added to config.txt activates GPIO 17 as a shutdown, "debounce" option adds 1000ms delay (so you have to press and hold for 1 sec) before shutdown (I added that, so it won't shutdown when coincidently pressed. I think a default debounce value (if you don't add it at all) is 200ms.

I hope it helps.
Reply
#7
(04-09-2022, 12:08 PM)greg_m Wrote: Hi guys,

On my other Pi (not moOde) I've done it as below. No python installed or scripts added to autostart needed:

1. connect one switch terminal to GPIO 3 (pin 5) and GPIO 17 (pin 11)
2. connect the other switch terminal to GND (pin 6, 9, etc)
3. add a below line to /boot/config.txt :
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up,debounce=1000
4. done

A quick explanations: GPIO 3 is a power up pin as defualt, the line added to config.txt activates GPIO 17 as a shutdown, "debounce" option adds 1000ms delay (so you have to press and hold for 1 sec) before shutdown (I added that, so it won't shutdown when coincidently pressed. I think a default debounce value (if you don't add it at all) is 200ms.

I hope it helps.

Yes Greg, it's a nice simple solution.

But with PI SPC V2 power management module, you need to add a python script.
This module provides One button for on and off, and a blinking led during boot and shutdown sequence.
Reply
#8
Looks like you may have been bitten by a change in RaspiOS between the moOde 7 serires and moOde 8. Python 2.x has been deprecated officially for some time. Now it's gone. Only Python 3.x (3.9 at the moment) is present in moOde 8.

I don't have the Audiophonics module but I just downloaded their spc_moode.py script and tried it from the command line

Code:
pi@m8zero2w:~$ python spc_moode.py
 File "/home/pi/spc_moode.py", line 57
   print "ShutDown order received, RaspBerry pi will now shutdown..."
         ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("ShutDown order received, RaspBerry pi will now shutdown...")?

The script needs to be updated to Python3.

ETA - I won't analyze the script in detail since I don't have a module to test it with, but it looks like Audiophonics has already partially edited it for Python3 syntax. However, they missed the print statements in lines 57, 87, and 90.

Regards,
Kent
Reply
#9
(04-09-2022, 02:00 PM)TheOldPresbyope Wrote: Looks like you may have been bitten by a change in RaspiOS between the moOde 7 serires and moOde 8. Python 2.x has been deprecated officially for some time. Now it's gone. Only Python 3.x (3.9 at the moment) is present in moOde 8.

I don't have the Audiophonics module but I just downloaded their spc_moode.py script and tried it from the command line

Code:
pi@m8zero2w:~$ python spc_moode.py
 File "/home/pi/spc_moode.py", line 57
   print "ShutDown order received, RaspBerry pi will now shutdown..."
         ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("ShutDown order received, RaspBerry pi will now shutdown...")?

The script needs to be updated to Python3.

ETA - I won't analyze the script in detail since I don't have a module to test it with, but it looks like Audiophonics has already partially edited it for Python3 syntax. However, they missed the print statements in lines 57, 87, and 90.

Regards,
Kent

Kent,
The available python script is already Python 3 compliant.
Header :
Code:
#!/usr/bin/python3
# Moode for Audiophonics SPC II power management board
# Initialisation of GPIO outputs 4 (SofthutDown) and 22 (BootOK) and 17 (Button shutdown)
# Script is lauched by /etc/rc.local
# Power LED stops slowly blinking and lights steadily after MoOde is ready
#
# All-in-One script
# Start it without parameter to initialise
# "spc_moode.py reboot" to reboot
# "spc_moode.py shutdown" to shutdown

Regards,
Philippe
Reply
#10
(04-09-2022, 08:38 AM)philippe05 Wrote: Hi Martin, The Audiophonics python script you mentionned is indicated for Volumio. Use the "all in one" moOde dedicated script, without confit.txt changes (the script also makes GPIO settings).
Regards,
Philippe

Thanks Philippe, that is what i did meanwhile. Except for the changes in /configt.txt, I changed them as proposed, otherwise the LED is blinking.

What is still not working is Softpower Off. Maybe due to:

Quote:The script needs to be updated to Python3
Thanks Kent for the hint.

As i do not speak any Python, maybe someone can help me sort it out. I have the module and will test it, with pleasure.

AtB
Martin
Reply


Forum Jump: