Author Archive

Comments No Comments »

I decided a little while back that as I approach 30, it’s appropriate to invest a bit of money in improving the quality of alcoholic beverages available to me in my house. This is where I’ve got to so far…


Having bought some nice French wine crates to use as shelves, I needed to fill them! Running along the top we’ve got an assortment of Bristol Beer Factory stouts (from their 12 stouts of Christmas), then in the top right box from left to right – Pabst Blue Ribbon (drink of choice for yesterday’s hipster), then Brooklyn Brewery Brown Ale, East India Pale Ale, Brooklyn Lager and Black Chocolate Stout (I was feeling nostalgic for my trip to America last year).

Bottom left are 3 big bottles from Brooklyn Brewery – Sorachi Ace, Local 1 and Local 2 – all pretty expensive and rare in the UK.

Bottom middle is spirits – Bruichladdich’s Laddie Ten, Dalwhinnie and lovely oily Bathtub Gin. Also there’s some sweet Kraken Rum on the far left.

Bottom right at the front is a few more of the same Brooklyns plus some Summer staples – Hoegaardens and Blue Moon.

Hidden at the back there are some classic glass Coke bottles and some Bundaberg root beer that I found in Waitrose which has an interesting flavour but doesn’t quite hit the spot compared to Mug or A&W.

There. That was self-indulgent!

Comments No Comments »

Want the Pi to do be able to do text to speech (tts) from the command line? Easy…

Eventually we’re going to have sound files (MP3) to play so I’ve installed mpg321 to do that.

Tell the Pi to use the 3.5mm audio out:
sudo amixer cset numid=3 1

For the conversion of text to speech, there are a few different options. for now I’m just gonna take advantage of a Google API call to their translate service which has a slightly hidden TTS built in. Obviously this will only work if you have a network connection. If not you’re gonna need something like eSpeak or Festival.

The call is as simple as:

For UK users that gives a male voice despite the .com address. I believe US users get a female voice. To get that in the UK, it’s possible to make the request through Google Mexico…

So to use that to say something it’s just:

wget -U Mozilla "" -O helloworld.mp3
mpg321 helloworld.mp3

(Note we need to persuade Google we’re a web browser so we add a User-Agent)

As a bonus, an easy way to achieve this without the request to Google is to get flite (based on Festival above).

sudo apt-get install flite

…and then use -t to get it to speak strings…

flite -t “hello jon. how are you today?”

(a female voice is available using the -voice option: flite -voice slt -t “hello jon. how are you today?”)


Comments 1 Comment »

Extra little update: since I bought my PoGo back in 2009, Polaroid have released a newer, bigger bluetooth printer called the Polaroid GL10 which prints on 3×4 inch zink paper. I expect everything I do here for the PoGo would also work for that. Anyway, on with the code…

Time to get down to business then. First to see if I can get the Pi to successfully send an image over bluetooth to the PoGo.

I’m using a TOPDIGI UA01 and the PoGo already has its own bluetooth hardware built in.

As an aside, the PoGo also has a USB port which you use when sending images straight from a digital camera to the printer. I’m sure it’d be possible to print from Pi to PoGo using this and maybe the cups package or similar but the advantage of bluetooth will be that in the final setup the Pi (and all its wires) can be hidden away in the corner away from the printer and the printer itself will only require a power cable, like in the setup Creature have created…

I believe Creature are using an Apple script to do the final push to the printer over bluetooth (rather than Python which the rest of their code is written in). Obviously we don’t have this luxury on the Pi so we’re going to have to do some of the bluetooth legwork ourselves…

…unfortunately the most popular bluetooth package for linux is something called Bluez which provides little to no documentation and for which most of the information on the internet is out of date. There is a way to work with Bluez through Python which I may end up switching to as I’ll probably code up the Instagram photo grabber in Python and I believe the whole process would be easier through an X GUI but for now I’m working only on the terminal.

Step 1: Download a test image file to print with something like

wget -O testimage.jpg

(Note that I think the PoGo can only cope with jpgs and is sometimes even fussy about those)

Step 2: Install some bluetooth packages. Unfortunately I’ve been playing around with lots of ways to get this up and running and don’t know exactly which of the packages I’ve downloaded are the ones making it work! I started with this…

sudo apt-get install bluetooth bluez bluez-utils ussp-push

…but have subsequently removed bluetooth and bluez-utils and it still seems to be working (?).
Once that’s all installed, it’s worth checking that the dongle is being recognised. I rebooted the Pi with it plugged in and ran “lsusb” which shows the connected devices which included “Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)” in my case).

Step 3: Do some bluetooth checking…
Is bluetooth running?

/etc/init.d/bluetooth status

Can we find bluetooth devices? (Turn on the PoGo before this step so it can be found!)

hcitool scan

At this point we should get a list with and entry for the PoGo that looks like this (where Ys and Zs are numbers specific to your device)…


Step 4: Attempt a print. I need to start again on all this with a fresh install to check exactly what’s required but it may now be as simple as these two lines…

sudo rfcomm bind /dev/rfcomm0 YY:YY:YY:YY:YY:YY 1
ussp-push /dev/rfcomm0 sourcefile.jpg destinationfile.jpg

If that says…

name=sourcefile.jpg, size=123456
Connection established

… you may be there and the PoGo may print your test picture. It does for me but that may be due to something I did and have forgotten and therefore isn’t in the steps above. If it’s not working here are some other things to try…

1. sudo rfcomm -a should show an entry for your device. If not the bind didn’t work. The binding of the device to rfcomm0 can be stored in /etc/bluetooth/rfcomm.conf which may help ensure it’s ready at start up.

2. I would expect the PoGo to require a pin code to be specified at some point along the way (it’s required when I print from my Windows laptop and is 6000 for all PoGos) but we haven’t specified one yet! I spent a long time struggling with obexftp thinking that not having specified a PIN was my problem. There’s a lot of out of date info around the web about how to provide Bluez with a PIN. The following is, I believe, the correct method now…

Create this file…


…where XX:XX:XX:XX:XX:XX is the bdaddr of your bluetooth dongle which you can get from

hciconfig hci0 -a

Now in that file we write a line for our particular device we’re trying to pair with a PIN using the format…


…where YY:YY:YY:YY:YY:YY is the MAC address of the device (PoGo/phone/etc) and 1234 is the PIN (6000 in the case of a PoGo).

3. There is some useful info here about pairing to a phone which uses some similar steps and may be of use…

Tags: , ,

Comments 2 Comments »

This thing called Instaprint caused a bit of a stir a little while back. The idea is it sits on the wall at a party/conference/whatever and then as people post photos to Instagram at the event, the printer finds and prints them automatically…


Pretty cool and it’ll cost you a cool $5000 to rent it for half a day at your event! So some people over at some other creative agency came up with a cheaper solution using a Polaroid PoGo, cunningly named Cheapstaprint


The great thing about the PoGo is that it’s designed to be wireless (unfortunately the battery life is terrible so it doesn’t really work out that way) so that you can send it photos from your mobile phone over bluetooth on the move. According to the blog post, they’re running some PHP (and maybe some Python?) on a nearby old computer (an Apple, I think) to do all the Instagram hunting and then push the photos to the PoGo over bluetooth. Simple enough and given the PoGo costs around £60, a much cheaper solution.

I’ve had the PoGo for a while and it doesn’t see a lot of use and now I have a Raspberry Pi and am looking for ways to play with it. Tiny computer + tiny printer = of course I’m gonna give it a go!

Tags: , ,

Comments No Comments »

From here (at the bottom)…

/etc/rc.local is a script on the Raspberry Pi which runs when Linux first boots. To edit it, you will need root privileges:

sudo nano /etc/rc.local

If you want to run one of your Python scripts at start-up, add this to the end of rc.local:


To stop a script running, either delete the line it is on, or comment it out (add a # at the beginning of the line).

Alternative method by creating an initialisation script in /etc/init.d and registering it using update-rc.d here.

Comments No Comments »


It’s been almost a year since I last posted anything here. If you’ve been waiting here for me you’ve missed out on a whole bunch of other stuff I’ve been up to. Oh well. Anyway, I’m back largely because I’ve bought a Raspberry Pi and want to store some of the details of things I do with in online – they may be of use to others but mostly just so I don’t lose the various random linux commands I use to get things working.

For future reference, my current setup is as follows (as bought from Amazon mostly)…

Raspberry Pi Model B 512 MB RAM Latest VERSION

Genuine Nokia N97 UK 3 Pin Mains Charger AC-10X

Protective Case / Box / Enclosure Transparent (Blue) for Raspberry Pi

Kingston SDHC 16GB Class 4 Flash Memory Card (running Raspbian)

Transcend 16GB SDHC Class 10 Memory Card (running RaspBMC)

Edimax EW-7811UN Wireless 802.11b/g/n 150Mbps Nano USB Adaptor

TOPDIGI UA01 Bluetooth USB Dongle Plug and Play

Comments No Comments »