Amplifier Power On/Off GPIO output

Max2Play Home Forums Max2Play Development (Ideas, Wishes) Amplifier Power On/Off GPIO output

Viewing 6 posts - 1 through 6 (of 6 total)
  • 25. Dezember 2015 at 23:10 #17482

    Hi I mainly use the Squeezeplug functionality. Could a GPIO pin be set high when audio is playing then set low roughly 30 seconds after audio stops? I could use this to turn on/off my amplifier and save power. I can then install the whole system out of reach.

    I’ve seen the IQAudio amplifier and it looks good, but the PSU is always on and I’m worried about the power consumption when left on 24/7.

    26. Dezember 2015 at 14:50 #17486

    I’ve realised this with fhem (SB_Player / SB_Server) for squeeze – very reliable.

    For shairport and DLNA I’ve did some tests with the CPU-load…. not very successfull…. but squeeze was the most important!

    5. Februar 2016 at 13:02 #18388

    Hi.
    Im hoping to achieve this too.
    May i ask – Bort – how you realised it with FHEM ?
    Asking for your scripts may be too much !? 🙂

    6. Februar 2016 at 14:23 #18393

    I’ve found a solution for this !!
    https://code.google.com/archive/p/sbnetio/

    This plugin runs on the Logitech media server and will send TCP commands to specified Squeezeboxes that are currently playing.
    ‚Commands‘ can be specified in the LMS settings for the plugin. You then need to create something executable on the players to turn on/off a GPIO pin. I wrote two .c files AmpLatchOn.c and AmpLatchOff.c and compiled them to AmpLatchOn and AmpLatchOff. The ‚commands‘ set in the plugin are simply AmpLatchOn and AmpLatchOff

    AmpLatchOn.c :

    #include <wiringPi.h>
    int main (void)
    {
      wiringPiSetup () ;
      pinMode (0, OUTPUT) ;
      digitalWrite (0, HIGH) ; delay (50);
    
      return 0;
    }

    You may also need to install wiringPi to get this working

    From the bottom of the google code page (linked above), download netio_server_client.zip
    Extract this to a new folder on each player
    Set netio_server.py to run on startup (boot) (I created a bash script to run it and added with crontab I think). This will receive the TCP commands and run the command.
    I had to modify this under “ def handle_command(self, line); “ I altered the command directory to “ Dir = ‚/home/pi/netio/./‘ “ as this is where my c-code executables are.

    Takes a bit of setup, but it worked for me!
    It’s exactly the kind of thing that could be made native to M2P/Squeezeplug

    • This reply was modified 8 years, 2 months ago by Mark One.
    2. August 2016 at 15:15 #21970

    Hallo,
    ich hoffe, dass ich nicht nur in englisch schreiben darf… und dass ich das Thema nochmal aufleben lassen kann.
    Die Anleitung von Mark One habe ich ziemlich vollständig abgearbeitet. Ich habe das Plugin im Media-Server installiert. Dann habe ich im Plugin die Werte eingetragen für Connection (IP:Port) und Einschaltkommando (test.sh). Ich habe Python und WiringPi auch erfolgreich installiert (meine ich) und habe die Dateien aus dem Archiv netio_server_client.zip in einem Unterverzeichnis von /home/pi/netio abgelegt. An der Konsole kann ich mit GPIO -v bzw. GPIO readall sehen, dass mindestens das richtig läuft. Nun wollte ich als Test beim Starten der Musikwiedergabe, dass die Datei test.sh ausgeführt wird. Die Datei enthält nur einen echo-Befehl. Irgendwie weiß ich nun nicht, wo ich noch was konfigurieren muss. Das Schalten der GPIO-Ports wollte ich auch mit einem *.sh Script erledigen. Wie erkenne ich, dass Kommandos gesendet und empfangen werden? Wenn ich sudo python /home/pi/netio/netio_server.py eingebe, passiert nichts (das sieht aus, als würde das Programm in einer Endlos-Schleife hängen)… Ich kann es mit CTRL-C abbrechen und kann erst dann wieder ein neues Kommando eingeben. Vielleicht verstehe ich das auch falsch und das Programm erwartet dann eine Eingabe? Jedenfalls wenn ich die Musikwiedergabe starte sehe ich auch keine Veränderung.
    Ich hoffe, dass mir jemand die nötigen Tipps geben kann.
    Peti

    23. Januar 2020 at 1:14 #47963

    I found decision in „Command Line Options“ of SqueezeLite Player.
    Config located on „Edit Advanced Options“ button in SqueezeLite Player settings.

    Command Line Options for Squeezelite

    Look at -G <Rpi GPIO#>:<H/L> – Specify the BCM GPIO# to use for Amp Power Relay and if the output should be Active High or Low
    My example of line -G 14:H – 14 Pin High level on Player Power On.

    • This reply was modified 4 years, 2 months ago by Ruyske.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Register here