Talking to a LIS3DH via Python on a Raspberry Pi

For my latest project (details coming soon available here) I acquired a couple of LIS3DH triple-axis accelerometers. As most of the products available through Adafruit are fairly well used, I didn’t bother checking what libraries were available before buying, but unfortunately for me only a C++ library had been written. I didn’t feel like learning C just for the purpose of this project, and so the only option left was to write my own Python library!

Thankfully I had some excellent starting points with the aforementioned C++ library, as well as the Python I2C library that Adafruit have published. I found myself referring back to the manufacturer datasheet quite often as well, mainly to clarify what each register contained.

While the task initially looked rather daunting (having had zero prior experience with bit-bashing through registers) – I found that with some pre-existing code to crib from, the various functions took shape rather quickly, and within an afternoon I’d produced a library exposing all the basic functions I’m likely to need for this project. I’ve put my code on Github in the hope that people will contribute to filling in the gaps, and improving where necessary.

AlarmPi: The Raspberry Pi Smart Alarm Clock

When I left my previous job around 18 months ago, I promised myself I’d do something productive with the time I had between employment. During that time, I realised how much I hated my alarm clock going off every morning, and also how stupid and inflexible most alarm clocks are. I managed to achieve very little with that spare time between jobs, but this hatred of alarm clocks has been driven home even further since I’ve started working shifts in my new job – no alarm clock I could find had the ability to vary the alarm time based on a shift pattern (I suppose that’s a fairly niche feature!), and very few had decent internet radio connectivity to allow me to listen to music I like in the morning.

That productive feeling drew me to buy some parts from Adafruit and have a play with some electronics projects – the furthest I got was playing around with a LCD display as documented in this other blog post. More recently, my old alarm clock started to fail in rather interesting ways (ever been woken up at 3:27AM by a piercing screaming & static noise?), so I decided it was time to build my own, and the AlarmPi was born!

The core of the project is a Raspberry Pi connected up to a series of fairly basic components, all controlled by a Python script which takes input from all manner of sources, and shows information through the two front displays. I’ve put together a short video explaining some of the main features which can be viewed below, and you can read more about the AlarmPi on the project page

XBMC – My Experience

Over the Christmas holidays I got a bit bored (as you do), and decided to experiment with an old projector, turning my bedroom wall into a giant monitor!

I’ve been looking for some time to find a decent ‘10 foot UI‘, and from initial glances at the internet all fingers were point towards Apples FrontRow, however I didn’t want to sacrifice the Mac Mini to run as a media PC (although it would do a very good job – virtually silent!). I decided to go slightly off the beaten track and try XBMC (Xbox Media Centre as was).

I must say I was pleasantly surprised at how easy it was to set up and configure – within a few minutes I had a working interface that looked great, it was playing nicely with my network to drag videos off my main PC and download box (headless machine running get_iplayer and rtorrent in a cupboard, more on that in another post). My only major gripe is that the navigation is fairly awful – whether you’re using a keyboard or mouse (or a remote I presume), I can’t seem to figure out whether I’m needing to go forwards/backwards/up/down on the menus, and a lot of functionality seems to be duplicated.

The process of gathering TV and film information is pretty seamless, the scanner seems to run nicely in the background gathering data on my files, even though they’re sat on another machine. I’ve noticed a few false positives for TV shows, and you definitely need to do some config file editing to get TV files picked up.

I unfortunately don’t have the right kit at the moment to try and get live TV displayed through XBMC as well (from forum browsing it seems possible), although I have installed the iPlayer and YouTube extensions, both of which seem to be quite buggy. The iPlayer extension inparticular has some pretty major issues – trying to pause a video will cause the whole program to lock up!

Overall – I’m pretty happy with this solution for the meantime. Anyone who’s happy hacking around with setting files to get things working just how they want should be right at home, but I wouldn’t really recommend to anyone who’s after an ‘out of the box’ solution.

Last.fm Boffin

http://www.last.fm/group/Audioscrobbler+Beta/forum/30705/_/510180

Been trying out the ‘Boffin’ tool from Last.fm this evening – and I’m astounded!

Basically, it scans your PC for music, groups it by tag, and then lets you play only music with a specific tag. For instance, I’ve had “Trance” selected for a while now, and it just keeps shoving on amazing tunes I didn’t even know I had!

Obviously, its on an Alpha release, but the technology demonstrated behind it is superb. Didn’t take long to scan my entire music library, and did a pretty good job (so far) of getting the tags and grouping them.

Its also nice to see what my music library mainly consists of (hope the picture works!):

boffin

Can’t wait to see this incorporated into the main Last.fm program!