CubeSensors

Last summer I found out about CubeSensors, which are small cubes packed full of sensors for monitoring your indoor environment. I loved the idea but they seemed a bit pricy and they were still taking preorders, having not shipped anything yet. After a couple weeks of thinking about it I went ahead and paid the deposit to reserve my spot in the second batch and lock in the price, which was fortunate because within a couple weeks the price had gone up (to cover adding adding more features I believe). Being a new company, there were naturally delays shipping the first batch, then they wanted to incorporate changes based on feedback from the first cubes in the wild, so I finally got my cubes this last June.

Not only did the box include my cubes and base station but it’s the perfect size for my cats to hide behind when playing:
Dash Stalking

The only trouble I had setting the cubes up was user-error: I tried to connect all the cubes at once and thought one of the connected ones was the last disconnected one. They glow red when you shake them and they don’t like your environment (so with low humidity and high temperatures the one that was connected would light up red when I shook it) and they flash red when you shake them and they’re trying to connect (the expected result when adding a new cube to the network). I didn’t recognize the difference so it took me a few days to think to have it tell me which cube was which by lighting them up from the webapp, at which point it became obvious what I was doing wrong.

Here’s loft-cube in action:
Loft Cube in action

While I appreciate the raw data from the cubes I’m not really a fan of how it’s presented:
CubeStatus

First off, there’s no way to get raw data side-by-side. For example: the app doesn’t offer a plot of the temperatures of all rooms at the same time. You can click on the cube on the overview screen to see details for that room but the only way to see more than one at a time is by using multiple browsers.

Also, there’s no way to adjust the target values. I’m comfortable at a far wider range of temperatures (especially warmer) than the 73.4-78.8°F the app insists I should set my house to. That means that most of the time the overview page just tells me that it doesn’t approve of how I live, which often isn’t an indication that I should do anything about it.

Besides just the app I also have a gripes about the hardware itself: The charging circuit produces heat, so any time a cube is charging the temperature (and humidity) readings can’t be trusted. I’d hoped that leaving the cubes plugged in would result in it using the provided power to run and not needing to drain/charge the battery, but the actual result is that it drains the battery for a number of hours, then charges for a while, then drains the battery. That produces a plot with periodic temperature spikes and doesn’t really tell me about my indoor environment or provide useful data that I can mine.

None of those issues are dealbreakers so I still appreciate having the cubes and think they were worth what I paid for them, I just have to work within the limits of the cubes.

Fortunately, the app isn’t a limitation because there’s an alpha API available for use.

Of course an API doesn’t do me any good if I can’t access it, and I’d never used OAuth before. OAuth requires you to have an app key/secret pair (currently gotten by emailing the address on the API page), then do a handshake sequence that involves the user logging into the CubeSensors site to allow the app to use the account, then use the key the api provided to request data specific to the user. Searching online it was easy to find a Java library for OAuth, but it wasn’t so simple to get it to work for CubeSensors. I ended up playing with Scribe and a firefox plugin called Poster until I managed to get a signed query accepted, then I tweaked my Scribe settings until I got it working.

Once I had authentication working it was a fairly simple matter to wrap the JSON-based API in Java objects using Jackson, and at that point I went ahead and published my results on github for anyone else that wants to use Java to query CubeSensors data.

Someday (hopefully) soon I’ll be building a nicer interface for my cubes, which I’ll probably post about here as I get it working.

Pebble

I’ve needed a new watch since late last year when I finally wore through the strap on my old watch and decided to replace the entire watch rather than just the strap (for various reasons). Last week I stumbled across something about Pebble and I got to looking into smart watches. After a trip to Best Buy (since they actually have said watches in-store) I settled on an original Pebble (I like the screen, it fits my wrist without looking ridiculous, and the battery lasts a week).

Naturally, one of the first things I did was download the SDK and start playing with designing my own watch faces. My first pass was just a modification of the binary-encoded watch that came as an example in the SDK to remove the seconds display (for battery life) and change the encoding (see wikipedia for the difference between binary-coded decimal vs sexagesimal clocks). Here was the result, which I’ve been using since last Friday:
ManyBits
(10:37)

Tonight I finally sat down and worked through the process of adding a configuration page. Frankly, it’s kind of a mess in the current state of the Pebble SDK: the watch face itself is written in C, the configuration page is a web page that has to be hosted somewhere online, and you tie the two together using a specifically-named javascript file. At least between the sample code they provided and random open-source watch faces on git hub I was able to figure out how to get it all to work.

Now that my watchface is configurable (linked to here) I’m happy enough with it to publish it on the Pebble app store. This isn’t an official link, but the Pebble store doesn’t seem to be available outside their phone app so I’ll settle for a third-party site that makes it easy to install the app from the web:

It’s already available for Android but apparently publication to iOS takes a while (the developer side of the app store says something about javascript needing to be bundled). Since I downloaded (and favorited) my watchface from the app store the counter in that heart should be at least one, but it seems that doesn’t update instantly. For that matter, the screenshots show up in the app store but not in the Pebble app once I downloaded the watchface (one of the perks of having the app on the official store: screenshots are supposed to show up as icons in the phone app for selecting watchfaces). I’ll have to check on it tomorrow in the hope that it’s updated by then.

Mandelbrot Zoomer

Back in college I wrote a handful of applets that drew fractals. The last one I did was the mandelbrot set, but it didn’t have the performance I wanted and I didn’t work on it much.

A few days ago I got to thinking about it again, and figured I’d try optimizing it since I’ve been doing a lot of concurrent and parallel programming at work and I figured at worst I could just make it multi-threaded. There’s still room for improvement, but I got a basic interface down and a level based drawing pattern that does remarkably well with only two threads (one refreshing the image at ~60 fps and running the interface, the other doing the calculation):

Holding the left mouse button on a point in the applet zooms in, the right button zooms out, and the ‘r’ key resets the view.