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)

About these ads

4 thoughts on “MQTT Joggler

  1. This is really nice, James – also very cool to learn about SqueezePlay OS. I might have to give that a shot. I like the idea of having it as an Airplay receiver especially.

    Source code for publightsensor.c? on a Github Gist or something? :-)

    • For me SqueezePlay OS is perfect for the Joggler- good jabbable UI and radio just works. Being able to get MQTT on there is a bonus.
      Will add a link if I put the source somewhere- not tried Github Gist before but looks like it’d do the job.

      • Well, I’m interested in the code, and the more examples / samples out there for people to hack on, the better.

        I assume you ssh into the Joggler for installing code of this sort?

  2. Code now available. You can enable ssh using, Settings > Advanced > Additional Features > Secure Shell.
    Btw. sorry to hear that you’re going to have to abandon all your old Apple tech to make the most of the Joggler! :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s