05-13-2019, 09:39 PM
(This post was last modified: 05-13-2019, 09:50 PM by nahventure.)
Have an amp that doesn't feature auto power on/off?
Have a Raspberry Pi with GPIO? Great. All you need now is a relay.
*Note: This only works for amps which are "always on" by a switch.
--------
Requirements:
- Pi w/ a GPIO available.
- Relay compatible with the Pi and your voltage (Typically 120v or 240v)
- A way to connect your relay into the power feed of your amp, and the relay to the Pi.
- Screen package
- Python 2.7 or newer, which is included with moode. (I highly recommend python 2, otherwise you'll need to change the env at the beginning of the script)
-------
I'm using GPIO 12 for my setup, and an always running loop within python that is running within a screen session.
Now the how-to,
You're going to need screen.
Installing screen: apt install screen
I used GPIO 12 for my setup, you can change in the config what GPIO pin you'd like to use, although it doesn't really matter if you have GPIO 12 open, then it's going to be pretty much a quick install without any modification to the script.
You'll need to download my script into your home directory. (/home/pi) Otherwise you'll need to modify the crontab directory once we set that up. Here is the download to the script: https://drive.google.com/open?id=1JkVnpr...CwLQV3ndHh
Now if you choose to, you can edit the script and make the changes needed to your setup, however I've made it work for most.
That is all for now, I am currently figuring out how to get crontab or systemd to create a screen session at boot so that it auto starts.
First off, we'll have to enable crontabs.
sudo systemctl enable cron.service
Now, we're going to edit the crontab.
crontab -e
(Select nano)
add to the bottom the following:
@reboot /usr/bin/screen -dmS python /home/pi/allinone.py
(CTRL-X then y then hit enter to save and exit nano)
Now it should automagically start with your pi
Additional info:
If you don't know the default ssh login, here you go:
SSH login user: pi, pwd: moodeaudio
I am running Python 2.7 under
Have a Raspberry Pi with GPIO? Great. All you need now is a relay.
*Note: This only works for amps which are "always on" by a switch.
--------
Requirements:
- Pi w/ a GPIO available.
- Relay compatible with the Pi and your voltage (Typically 120v or 240v)
- A way to connect your relay into the power feed of your amp, and the relay to the Pi.
- Screen package
- Python 2.7 or newer, which is included with moode. (I highly recommend python 2, otherwise you'll need to change the env at the beginning of the script)
-------
I'm using GPIO 12 for my setup, and an always running loop within python that is running within a screen session.
Now the how-to,
You're going to need screen.
Installing screen: apt install screen
I used GPIO 12 for my setup, you can change in the config what GPIO pin you'd like to use, although it doesn't really matter if you have GPIO 12 open, then it's going to be pretty much a quick install without any modification to the script.
You'll need to download my script into your home directory. (/home/pi) Otherwise you'll need to modify the crontab directory once we set that up. Here is the download to the script: https://drive.google.com/open?id=1JkVnpr...CwLQV3ndHh
Now if you choose to, you can edit the script and make the changes needed to your setup, however I've made it work for most.
That is all for now, I am currently figuring out how to get crontab or systemd to create a screen session at boot so that it auto starts.
First off, we'll have to enable crontabs.
sudo systemctl enable cron.service
Now, we're going to edit the crontab.
crontab -e
(Select nano)
add to the bottom the following:
@reboot /usr/bin/screen -dmS python /home/pi/allinone.py
(CTRL-X then y then hit enter to save and exit nano)
Now it should automagically start with your pi
Additional info:
If you don't know the default ssh login, here you go:
SSH login user: pi, pwd: moodeaudio
I am running Python 2.7 under