Homepage Wiki Forum Buy
embedded Linux Gnublin

GNUBLIN picture frame with clock and weather

GNUBLIN picture frame with clock and weather

No space on your desk? Put all your modules into an picture frame. One power adapter supplied all. Now I can reach my GNUBLIN over SSH with my notebook or with my smartphone or notebook over the internal webserver.

Costs: About 10 EUR for the picture frame. The wood is an old one from the craft crate.

Update

gnublin-weather

Now I build an clock and weather forecast station. Every sconds the clock ticks and every night gnublin catches our city temperature from http://www.wetterdienst.de.

You need two files (getweather.sh and clock.sh). Get files at the end of this page. You have to modify getweather.sh and add an entry to you crontab.

If you scripts are in /root you can add the getweahter to your crontab like this:

crontab -e
30 2 * * * /root/getweather.sh

Save and dont’t forget to give the script the executable flag:

chmod +x /root/getweather.sh

Then start clock.sh from /etc/rc.local with an & (before exit 0!)

/root/clock.sh &

Or optional you can start the script in an screen. This is the way like I do it. This is an mechanism to force an console to be open also when I disconnect. After disconnect I can reattach the open console.

 

 

getweather.sh

#!/bin/bash
rm /root/index.html
cd /root
wget http://www.wetterdienst.de/Deutschlandwetter/Augsburg_Bayern/

clock.sh

#!/bin/bash

cleanup() { # Release script
gnublin-lcd -a 0x27 -d
exit
}

trap cleanup 2 # call cleanup on Ctrl-C

rdate time.fu-berlin.de
export TZ=CET

CEL=`echo -e "\xb2"`
echo $CEL

gnublin-lcd -a 0x27 -d
gnublin-lcd -a 0x27 -l 2 -o 18 -w "`echo ${CEL}C`"
gnublin-lcd -a 0x27 -l 3 -o 18 -w "`echo ${CEL}C`"
gnublin-lcd -a 0x27 -l 4 -w "www.gnublin.org"

# Blink forever
while [ "1" = "1" ]; do
gnublin-lcd -a 0x27 -l 1 -w "`date +"%m-%d-%y %T"`"
temperature=`gnublin-lm75 -b`

#offset of temperaturesensor
temperature=`expr $temperature - 1`
gnublin-lcd -a 0x27 -l 2 -w "Temperature: `echo $temperature`"
gnublin-lcd -a 0x27 -l 3 -w "Augsburg: `cat index.html | grep '<span style="color: #990000;' | sed 's/<[^>]\+>//g' | head -n 1 | sed -e 's/^\(.\{8\}\).*/\1/'`"

sleep 0.3
done

cleanup # call the cleanup routine