MQTT Joggler


Spurred on by the success of getting Mosquitto working on a Raspberry Pi, I recently had a play with MQTT on the Joggler. The O2 Joggler is still a great device for hacking and I currently have SqeezePlay OS running on it.

The reason I wanted to try and get MQTT on the Joggler was to make use of its light sensor, and publish light levels over MQTT. It all turned out to be pretty simple since most of the work has already been done by other people!

First thing to do was read the light sensor and get that working with an MQTT client. I had to skip some of Andy’s instructions and just built the client code rather than attempting to get doxygen working. Once I’d mashed up the light sensor code and publish example I could compile the worlds most pointless MQTT publisher:

gcc -Wall publightsensor.c -L../bin/linux_ia32 -I../src -lmqttv3c -lpthread -o publightsensor

Next it was time to check the results. This too was quick and easy thanks to the MQTT sandbox server, which has a handy HTTP bridge. And the final result… was a completely unscientific and slightly dingy light level 4! Now I’ll be able to turn on a lamp using an unreliable RF controlled socket and see whether it worked or not!

Update: the code really is all in the existing examples but I’ve created a Github Gist in case it’s any help: mqttjogglermashup.c (11 February 2013)

Advertisement

Building Mosquitto on a Raspberry Pi


Just a few notes in case anyone wants to build the latest version of Mosquitto on a Raspberry Pi before Roger makes it even easier. Luckily there were already a couple of articles describing how to build Mosquitto, and the comments definitely saved some head scratching:

Hopefully the following steps should get MQTT on your Raspberry Pi in double quick time…

Firstly install a few packages. The unscientific list I went with were these, since Python was definitely installed already:

$ sudo aptitude update
$ sudo aptitude install build-essential quilt libwrap0-dev libssl-dev devscripts python-setuptools

Next the sneaky tweak to avoid Python 2.6 errors while building. You can edit /usr/share/python/debian_defaults by hand to move the python2.6 entry from the list of supported versions, or the following should do the trick:

$ sudo cp /usr/share/python/debian_defaults /usr/share/python/debian_defaults.orig
$ sudo sed -E -e '/^old-versions|^unsupported-versions/ s/$/, python2.6/' -e '/^supported-versions/ s/python2\.6,+ +//' /usr/share/python/debian_defaults.orig | sudo tee /usr/share/python/debian_defaults

Now it’s time to grab all the Mosquitto source and packaging files needed to run the build. These were the latest at the time of writing:

$ mkdir mosquitto-build
$ cd mosquitto-build/
$ wget http://mosquitto.org/files/source/mosquitto-1.1.tar.gz -O mosquitto_1.1.orig.tar.gz
$ tar -xvf mosquitto_1.1.orig.tar.gz
$ wget http://mentors.debian.net/debian/pool/main/m/mosquitto/mosquitto_1.1-1.debian.tar.gz
$ tar -zxf mosquitto_1.1-1.debian.tar.gz -C mosquitto-1.1/

Hopefully everything should be ready to go, so kick off the build:

$ cd mosquitto-1.1/
$ debuild -us -uc

That’s all there is to it. Assuming everything worked, just install the packages:

$ sudo dpkg -i ../*mosquitto*.deb

Update: Alternatively, you could just use the new, experimental, debian repository for mosquitto. (13 January 2013)

Recent hacktivity


This time of year seems to be hacking season and over the last few days I’ve been along to two hackdays!

Friday was IBM’s internal Social Business Hackday. There was some MQTT hacking, a z/OS hack, hacks with Lotus Connections, hacks that could be the future of Lotus Connections, and I was attempting to hack a work around for a Jazz work item. And that was just at the Hursley local event! We were able to link up with a few other labs, but over two days there were IBMers hacking around the globe. There are going to be a lot of amazing projects to choose from when it comes to voting.

(There are a few more photos from HackDay X, and previous hackdays, on the IBM hackday group on flickr.)

For round two, today was the soutHACKton hack day. By the time I arrived the soldering and drilling had already begun!! Unfortunately I wasn’t able to stay long so I’m hoping there’ll me more of these in the future. I did just about have time to try out an idea I had to hack an old doorbell to sense people using the door knocker. A while ago I had accidentally created a touch sensor with a 555 timer while attempting to build another circuit. So my cunning plan was to deliberately create a 555 touch switch and connect it to the bolt on the inside of the front door. Unfortunately the best I could manage today was a two wire touch sensor, which isn’t going to work. At least not without leaving a wire hanging out of the letter box with some instructions attached! Unless someone who knows more about electronics can suggest a plan B, I may just resort to a boring doorbell button instead!!

Geek Camp


As Jo was cheerfully telling someone on the phone on Monday, I was “at geek camp” at the start of the week, which was the second ‘camp’ I’ve been to recently. Still not entirely sure what they have to do with camping but here’s a quick summary of what they were about.

BarCamp Southampton

Southampton’s first BarCamp was held in not one, but two bars at the end of November; I think it needed two so that there was room for all the food! Chris has posted a much more detailed report, and Tony has a gallery of photos from the day, but these are the bits I remember:

And since it was more than a week ago, that’s pretty much all I can remember. Definitely a good day though, and the food and drink (plentiful tea) was excellent!

Design London

Ok, so not technically a camp, but a small detour on the way to Monday’s home camp to visit a 3D stereoscopic visualisation system. Nigel has been on secondment from IBM to Design London, and I’ve been meaning to drop in to see what he’s been up to for a while.

I have to say, I was more impressed by the 3D system than I was expecting, even with a couple of technical hitches while I was there. (I didn’t touch anything honestly!) Essentially it’s just a wall and floor screen with two (very bright) projectors each, polarising lenses and Shrek glasses. Ok, probably not Shrek glasses, as far as I know, but the same kind of thing. Actually, one of the most interesting things about the glasses was the head tracking markers which were stuck to them. These were an asymmetrical arrangement of reflective blobs on stalks, picked up by an array of infra-red cameras. They looked like an extension of the ordinary plastic frame of the glasses, but the texture gave away a 3D printer at work. A great example of the potential of 3D printing.

Nigel demonstrated a few projects that have made use of the system, and it’s immediately clear that this is more than just a 3D monitor, or even a 3D cinema screen. Particularly with the oil rig model he showed me, there’s a real sense of scale and there are some obvious advantages to really getting to know your way round a place like this before going on site. There are just so many possibilities for this technology, but moving swiftly on to the next camp…

HomeCamp 3

After Design London, and a quick stop to have a play with a Galaxy Tab (it’s soooo shiny!), it was time for some home hacking. Thanks to Mike for getting something organised before the end of the year, and thanks to all the excellent speakers as well.

It was also great to catch up with (another) Nigel and hear about the MSc he’s doing at the Centre for Alternative Technology. It sounds like there really is no such thing as a free lunch when it comes to energy, with some very interesting side effects to off shore wind farms and wave power.

It’s always good to hear what Usman and Pachube are up to. One of the things they have been up to this year was hiring Ben and I had a thought provoking chat with them about their extended tagging features. It also seems that I’m not the only one pumping data in to Pachube, but not getting much data out. Must do something about that.

Lots of other ideas floating around during the evening, including a USB 3 low voltage system with solar panels, a battery pack and some efficient AC-DC conversion which sounded interesting. Plus tablets seem like a really good way to add visuals to your elevator pitch!

The conversation didn’t slow down on the train home either, with Laura and Sophie talking about design, wire frames, nabaztag smart rabbits, exactly the kind of projects that Georgina was describing in her homesense presentation, and some very (very) cool sounding documentation automation stuff from Ana Nelson. (A bit like a micro Home Camp unleashed on a train. Maybe the Real Ale Train would be a good venue for a future event!)

So, not all that geeky really…

Update: according to Ken, that low voltage dc household power distribution system was from Moixa Technology. (23 January 2011)

Ambient ducks…


…and balls, and squares, and hearts, and stars! If you want to build your own amazing MQTT enabled duck, I spotted these LED lights in Homebase at the weekend which might be worth a try at £2.50 each:

No good if you want the full team of ducks but they look like they’d make decent ambient objects. I seem to have a collection of half finished projects already so I didn’t buy one… this time!

Recipe for a Virtual World 6: User generated content


If you even remember the previous posts, you may wonder what happened to 4 and 5. Unfortunately I got bit stuck on money (which was going to be the forth, but I never quite decided whether an economy is directly relevant to virtual worlds- my current suspicion is not) and physics (which was going to be the fifth, about the different approaches used to construct virtual worlds, rather than physics simulations), but I kept getting distracted! If it wasn’t for user generated content, I doubt I’d be the least bit interested in virtual worlds; I get bored being a spectator in computer games very quickly.

Luckily I don’t have to write a whole post about what’s so important about user generated content, because Dale’s done that already! Jonas’ “Dead Gnomes as Enterprise Collaboration Tools” post is also worth a read as it shows that the goal of content creation can often be something other than content which is produced. The content is just a means to an end, and user generated content can take care of the long tail requirements that virtual world developers would never otherwise get to. How far up the list of priorities would dead gnomes be?! And how long would you have to wait for the opinionator?! (My current all time favourite gadget in second life.) Even the opinionator is a luxury when you can just stack up cubes, but one that makes for richer interactions- you can’t have too many ideas like that to make up for the loss of real world interactions if virtual worlds are to be the next best thing.

News that professional design teams are getting tools to collaborate on content creation inside the world they are building makes things even more interesting, further blurring the lines between designers and users/producers and consumers.

UGC FTW!

(And I almost forgot to mention MQTT enabled ducks and UK energy price turbines on ReactionGrid!)

DSL, Puppy Linux, Netvoyager and CurrentCost


After some procrastination I now have a tiny home server:

Netvoyager LX-1000

The Netvoyager comes with some thin client software pre-installed, which I’m thinking of leaving alone for now, since it might turn out to be useful if I ever get a SLUG as well. (Well it is my birthday in a couple of months!!)

The first tiny hurdle was trying to boot a DSL USB stick I have. Unfortunately I discovered the BIOS is password protected so hitting Del didn’t get me very far. Luckily Netvoyager support helped out by telling me to press F8 to bring up a list of devices to boot from. I’m hoping they’ll also tell me the BIOS password to avoid having to do that every time because it got a bit annoying this weekend!

My attempts to boot using DSL were met with mixed results: booting from a USB CD drive worked a treat, but no amount of hacking got it to boot from a USB stick. It seems to be GRUB rather than DSL that’s the problem. It turns out that there is quite a bit of information about for the Netvoyager, under its Microclient and eBox-2300 aliases. Puppy Linux seemed to be the favourite option, so I had a go with that and, while being a bit slower, it’s working a treat. It had an added bonus of having a few other bits I needed that DSL didn’t. For now it’s happily publishing data for CurrentCost power graphs but I plan to break it again at some point to switch to a command line only cut down Linux install.

Definitely pleased with the Netvoyager decision so far, despite people suggesting even more alternatives since I got it! Cost, features and power use are spot on for what I wanted.

Update: Found a couple of useful Netvoyager links while playing around with new Linux distros. (24 October 2010)

RESTful house


Possibly a little premature (not sold the current house yet!) but I’ve been pondering the opportunity for playing with home automation when we find a new house.

Not even having the house yet means I have a completely blank canvas so I’m on the look out for ideas. On the hardware side, Nigel has mentioned Arduino a few times which sounds pretty interesting, plus there’s the Slug option. Laptops seem to get used too but I’d rather avoid that. On the where to start side, Andy’s house uses MQTT, is in Second Life, Twitters, and has a pretty worrying power meter graph, which should provide a few ideas! He’s not the only one- it would seem that IBMers like their home automation projects. Like Glenn, low cost is high on my list of requirements (I will have just undergone open wallet surgery buying a house!) although I suspect my idea of low is lower than Glenn’s! I also want it to be low power- very low power, so I’m pondering some sort of mesh approach to avoid any kind of server… as such… just because really! I quite like the idea of giving the house a REST interface. I don’t want any fans. So a clear set of requirements there then.

Any thoughts, suggestions, success/horror stories?