Thursday, 24 December 2009

phone battery check over bluetooth

bash script to check the battery level via bluetooth (assumes you have bind-ed the devices in rfcomm.conf already)

#cut here =======================
#!/bin/bash
Z=$( C='';until [ "$C" == "connected" ];do C=`rfcomm show 1|cut -d ' ' -f 5`;\
done;echo "at+cbc">/dev/rfcomm1 )&

ZZ=$((while read line
do
echo $line
if [ "$line" == "OK" ]; then
break
fi
done < /dev/rfcomm1 )|grep CBC|cut -d ',' -f 2 )

echo "Battery Level = $ZZ %"

#=================================

will put this in cron with some level checks around it to turn the charger off and on.

Reading

The Pirates! in an Adventure with Scientists by Gideon Defoe

Friday, 18 December 2009

Bifferboard bluetooth RTC kludge

The Bifferboard is a tiny linux computer with low power consumption (1 Watt). It has ethernet and USB ports and some GPIO. It has been shown to run a choice of Linux distributions, I'm using Slackware. All this would make it ideal for Home Automation purposes but for the fact it doesn't have an onboard Real Time Clock (and it keeps really bad time), sure you can sync it off NTP, but then you need to leave your Internet up - a DSL modem and a router using ~20 Watts kind of spoils the low power aspect. I'd like to get a I2C RTC like the DS1307 and give that a try , I2C is supported
but I don't have that to hand right now. In the mean time I've kludged up a solution using a disused Nokia phone and a Bluetooth dongle. Following bifferos' Bluetooth instructions and also loading the openobex ,obexftp and dbus packages with slapt-get makes the phone accessible.
The following shell script is called by cron every second.(the btaddr of the phone can be found with a "hcitool scan").

#=cut here =========================
export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/
export TZ=EET-10EETDT,M10.1.0,M4.1.0/03:00:00Z
#change to tmpfs
cd /dev/shm
#get the time from the phone via bluetooth
obexftp -b btaddr_of_phone -g /telecom/rtc.txt
#reformat for date command
Z=$(cat rtc.txt)
TIMEDATE=$(echo $Z|cut --output-delimiter=: -c 10-11,12-13,14-15;\
echo $Z|cut -c 1-8)
#echo $TIMEDATE
date -s "$TIMEDATE"

#===================================

A lcd4linux compatible java app to use the phones screen via /dev/rfcomm0 is probably worth looking at as well, since the phone is there anyway.

Saturday, 12 December 2009

Tuesday, 20 October 2009

Saturday, 19 September 2009

Arrrrrrr

Scupper me bilges its ITLAPD, Arrrr.

Friday, 14 August 2009

rapid serial visual presentation

"Rapid Serial Visual Presentation (RSVP) is a method of displaying information (generally text) using a limited space in which each piece of information is displayed briefly in sequential order."... from wikipedia
Here is a simple rsvp reader written using Processing. Processing neatly hides the syntactic ugliness of Java and provides an event based loop and lots of useful functions for doing stuff. It also provides wrappers around the jar files for linux,mac and windows.

rsvp processing source
rsvp app packages linux , mac (I haven't tested this. My LC575 is not powerful enough for osx :-( ) , windows

Cobolt DP105 spec file for st2205tool

libst2205 and phack allow mini picture frames to be used as displays for lcd4linux, mplayer etc. The Cobolt DP105 mini picture frame I have doesn't seen all that common out in netland but in any case I followed the instructions in the "newhack.txt" and produced this spec file, put it in a directory as instructed and ran "assembleme". The hackfw.sh script then patched the firmware and it worked, yay.


;Spec-file for Cobolt DP105.
;Please keep the way the adresses are entered ($ to indicate a hex number,
;adresses in 4 digits) intact or the hackfw.sh script won't work anymore.
;Adresses here refer to file-adresses; in runtime these are loaded $4000
;bytes higher but that's accounted for in the hack-code itself.

CMP_VAR1=$037A
CMP_VAR2=$037B
PATCH_AT=$2DD7
EMPTY_AT=$39E7
SEND_CSW=$2C9F
LEN0=$36c
LEN1=$36d
LEN2=$36e
LEN3=$36f
CONF_XRES=128
CONF_YRES=128
CONF_BPP=24
CONF_PROTO=0

CTRTYPE=0 ;PCF8833
OFFX=0
OFFY=0

Monday, 25 May 2009

Happy Towel Day

Happy Towel Day

The Hitch Hiker's Guide to the Galaxy has a few things to say on the subject of towels...

"A towel, it says, is about the most massively useful thing an interstellar hitchhiker can have. Partly it has great practical value - you can wrap it around you for warmth as you bound across the cold moons of Jaglan Beta; you can lie on it on the brilliant marble-sanded beaches of Santraginus V, inhaling the heady sea vapours; more ... (see also the bbc )

Thursday, 21 May 2009

twithash

twithash - a shell script to search tweets (uses wget and awk)

#=cut here=======================================================
#!/bin/bash
if [ "$1" == "" ] ; then echo "Usage: twithash searchterm (nb. # added automatically)"
else wget -q -O - http://search.twitter.com/search.atom?q=%23$1|awk '/title/ { gsub("[<</]*title>","") ;text=$0} /<name>/{ gsub ("[<</]*name>",""); split($0,N);print N[1]":"substr(text,4)}'
fi
#================================================================


use with "watch" command to monitor a twitter hashtag in a shell
eg. watch -n 60 twithash qanda

example output:

armagny: #qanda Penny Wong continues to impress with self control and absence of sneer or carp.
armagny: #qanda Unethical spin spend is where you take money given for policy advisers & give to journos, or other flakes
jackwork:khas
BLOWFLYwine: Clean coal is vaporware... but if Penny doesn't sell it, the government would be concerned about losing future tax revenue #qanda
...

Monday, 18 May 2009

Tuesday, 21 April 2009

Idleness

"Idleness does not consist in doing nothing, but in doing a great deal not recognized in the dogmatic formularies of the ruling class."

Robert Louis Stevenson

Monday, 20 April 2009

Friday, 10 April 2009

Tuesday, 27 January 2009