Jessica Pereira (CC BY 2.0)

The most important rule of Diet Club is don’t talk about Diet Club

I am breaking one of the most important rules of my weight loss program. Ray Cronise popularized the ruleThe most important rule of Diet Club is don’t talk about Diet Club. It sounds against one’s instinct and intuition. It even seems to contradict some scientific studies that seemed to show that telling your friends that you will loose weight would keep you honest. But that’s not correct. Telling friends and family does the oposite. Although well intentioned, your friends will keep you from completing your goal. First they will give you instant gratification by praising your new goal. This is shown to keep you from achieving it, as your brain will now be happy without having to do the hard work. Even if you could keep that from influencing you, your friends and family will actively or passively make it hard for you to diet. As soon as you tell them, they will want to know why? How? How long? Why again? All this will erode your willpower. My advice: keep your dieting plans to yourself

yoppy (CC BY 2.0)

Calorie counting as gamification of your weight loss

I have been successfully using both the app as well as the website from myfittnesspal to loose weight. Some of the features are that you can add friends kind of like on facebook to your account, who will like your achievements. What I have been missing a true gamification. Give me 1.000 points for staying under my kcal maximum. Give me 50.000 points for loosing a 1kg of weight. You get the point.

As part of the gamification of weight loss I would also like to suggest you get either a step counting app like Google Fit, a smart watch or a fitness band. All these also lack the point and merit based rewards required for true gamification. All I did is give myself a goal (12.000 steps a day, less than 1.000 kcal a day) and reward myself for it (pat on the shoulder).

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.

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.

LogicMachine script to turn on off Epson projector

Today I created a small script in a KNX object to turn my Epson projector on off via a serial link.

require('serial')
-- device on the LogicMachine connected to the Epson projector
-- ttyUSB0 is typical for a USB RS-232C
-- tested with adapter based on FT232 or CP210x chip.
device = '/dev/ttyUSB0'
-- opens a serial port using the sugested values of Epson manual
-- https://support.math.unipd.it/sites/default/files/epson_emp_835.pdf
port = serial.open(device, { baudrate = 9600, parity = 'none', stopbits = 1  })

-- get value of KNX object
value = event.getvalue()

if (value == true) then
 -- send power on command with returns to make them stick
 char = "PWR ON\r\n"  
 port:write(char)
else
 -- send power off command
 char = "PWR OFF\r\n"  
 port:write(char)
end

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