no need to explain why, but I am moving my presence from the bird to Mastodon. Find me @managementboy@skeptics.social
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 https://code.google.com/r/phermann2-squeezelite-rpi-gpio/
cd phermann2-squeezelite-rpi-gpio/
Then edit the Makefile:
nano Makefile
Change the CFlags to this:
CFLAGS ?= -Wall -fPIC -O2 $(OPTS) -DGPIO -DDSD -DLINKALL -DRESAMPLE -DFFMPEG
notice the -DGPIO, this gives you access to the desired functions.
compile with this command
make
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
USER=root
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.
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 = "your.dyn.dns.here";
always_renew = no;
reject_not_encrypted = no;
dont_filter_netbios = yes;
localip = 0.0.0.0;
local_virtualip = 0.0.0.0;
remoteip = 0.0.0.0;
remote_virtualip = 192.168.100.201;
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 = 0.0.0.0;
mask = 0.0.0.0;
}
}
phase2remoteid {
ipaddr = 192.168.100.201;
}
phase2ss = "esp-all-all/ah-none/comp-all/no-pfs";
accesslist = "permit ip any 192.168.0.0 255.255.255.0",
"permit ip any 192.168.100.0 255.255.255.0";
}
ike_forward_rules = "udp 0.0.0.0:500 0.0.0.0:500",
"udp 0.0.0.0:4500 0.0.0.0:4500";
}
// EOF
Crash of new MythTv frontend
Crash of new MythTv frontend
Skeptics in the Pub Hamburg: Nicole Heissmann Die Homöopathie-Lüge
Wie konnte eine wirkunsgslose Behandlungsmethode zu einer weit verbreiteten Therapieform werden? Wel