Category Archives: default

Raspberry Pi GPIO Audio Amp control with relays using squeezlite

I have had a project in the making for some time. We use a Raspberry Pi with a Squeezeplug image to run Squeezelight on it to do basic audio out in our bathroom. As an amp I use the Dayton DTA-1. The amp has to be manually turned on and off each time we use it. This is subobtimal, as the whole idea behind the Logitech Media Server is to be able to use an app to use it.

While researching I came across the Squeezelite RPI GPIO project. It is a drop in replacement for the squeezelight binary provided by the Squeezeplug guys. To get it to work you need to change the code in a few places.

First log into your Raspberry Pi as root.

Get the latest git version of Squeezelite RPI GPIO:
git clone
cd phermann2-squeezelite-rpi-gpio/

Then edit the Makefile:
nano Makefile

Change the CFlags to this:
notice the -DGPIO, this gives you access to the desired functions.

compile with this command

now make a backup copy of your current squeezelight binary:
cp /opt/squeezelight/squeezelight /opt/squeezelight/squeezelight.original

edit the start script of squeezelight, as we need root rights
nano /etc/init.d/squeezelite
all I did is add a
after the first fi in the file… it overrides everything it detects automatically.

restart the squeezelite service to check if it worked.

You now need to connect pin 18 on the Raspberry PI to the input on your relais.

Relais for a Raspberry Pi Squeezbox Amp control

In my case I got a board for Arduino with 5 Volt relais and 3,3 volt pins. I took an old power cable and spliced it to attach it to the fist relais and added a socket for the power source of the amp.

Config file to connect VPNC to a FritzBox

In a previous post I briefly described how to get a vpnc binary onto a tplink router. What I missed was to post the configuration file you need on the FritzBox side to get the connection running. Here it is:
* Vpnc to fritzbox config file

vpncfg {
connections {
enabled = yes;
conn_type = conntype_user;
name = "";
always_renew = no;
reject_not_encrypted = no;
dont_filter_netbios = yes;
localip =;
local_virtualip =;
remoteip =;
remote_virtualip =;
remoteid {
key_id = "nameofconnection";
mode = phase1_mode_aggressive;
phase1ss = "all/all/all";
keytype = connkeytype_pre_shared;
key = "yourpasswordhere";
cert_do_server_auth = no;
use_nat_t = yes;
use_xauth = yes;
xauth {
valid = yes;
username = "nameofconnection";
passwd = "yourpasswordhere";
use_cfgmode = yes;
phase2localid {
ipnet {
ipaddr =;
mask =;
phase2remoteid {
ipaddr =;
phase2ss = "esp-all-all/ah-none/comp-all/no-pfs";
accesslist = "permit ip any",
"permit ip any";
ike_forward_rules = "udp",

// EOF