David Findlay

a man, a plan, a cake: nirvana

Spark Core Freezer Monitoring Success

After installing the Spark Core as a freezer monitor last night, I ran curl in a while loop in bash to pull the temperature reading every minute overnight and append the results to a text file. This morning, after a little bit of sed and grep tweaking, I pulled the readings into Numbers and charted them:
Freezer Temperature Chart
You can see that the temperature rises to around 3. The compressor then kicks in and lowers the temperature to around −3. The temperature then slowly rises up to around 3 again, and so on — illustrating the hysteresis of the temperature control system in the freezer.

I wrote a Python script to automate the process of grabbing the result, parsing the JSON and adding the result to the table being charted in the spreadsheet:

This isn’t particularly practical, but was interesting to see nonetheless. My main goal is monitoring, so I will drop the charting part in favour of a simple notification to my phone via
Prowl.app when the temperature gets too high.

Spark Core

Spark Core
My Spark Core modules arrived a week or so ago. I got one with a chip antenna and one with a u.FL connector, because I plan to use it in a building that’s too far from my router for the chip antenna to work. I also picked up a battery board and relay board, although I don’t have specific projects in mind for either.

The Spark Core contains an STM32F103 microcontroller (ARM Cortex M3) paired with a TI CC300 WiFi module. An iPhone app lets you easily gets your cores onto your network. They come with a bootloader that supports reflashing over WiFi. In fact Spark even provides an IDE that allows you to edit code and flash it to any of your modules from the comfort of your favourite browser.

Spark Build IDE
Spark have made the Spark Core as compatible with Arduino as they can, so many Arduino libraries should work providing they aren’t doing anything AVR-specific, although currently the IDE doesn’t support multiple files so you’ll need to copy-paste the library code. Despite the single-file limitation, which they’re working on, the IDE is pretty nice: it even supports some Emacs key bindings. The IDE also allows you to expose variables from the Spark Core; these variables can be accessed via a REST API on Spark’s servers, which mean you don’t need to configure tunneling or DynDNS for your cores.

I already had a Maxim
DS18B20 1-Wire digital thermometer chip lying around, and it took just a few minutes to get that temperature sensor working thanks to Miles Burton’s Dallas Temperature Control Library for Arduino.

The non-library part of the sketch is shown above. It registers an integer variable called
temperature in setup(), which is then populated each time around in loop().
Here’s a sample of the JSON you get back from querying that
temperature variable:

$ curl "https://api.spark.io/v1/devices/1234567abcdef/temperature?access_token=feedbeef”
{
"cmd": "VarReturn",
"name": "temperature",
"result": 3,
"coreInfo": {
"last_app": "",
"last_heard": "2014-02-03T04:30:09.921Z",
"connected": true,
"deviceID": "1234567abcdef"
}
}

Between the REST and the JSON it’s pretty trivial to digest the output programmatically. I put together a little CGI script in Python to make it easy to query the temperature:
Temp CGI
After I had the breadboarded sensor working, I prepared it for duty monitoring the temperature of the freezer in our garage, I put the DS18B20 on the end of a cable with some heat shrink over the connections and mounted the Spark Core in an old iPod touch box, with holes drilled for the sensor cable, antenna and USB power cord. Here it is, gently clamped to the top of the USB power adaptor:

Freezer Monitor

Wand

My wife has been reading the Harry Potter books to our kids. So, naturally, my son wanted the $30 crappy plastic officially licensed wand when he saw it in the book store.

Rather than buy it, I made him one from a stick that he picked out in the yard:

Carter & Wand

Construction

I dremeled a channel to run the wires from an LED at its tip to a switch and power at the base. Initially I used a 3V coin cell because it was light and not bulky. Then I remembered I had a pager motor lying around, so I added that into the mix at my son’s request. Unfortunately the coin cell wasn’t able to drive the LED and the pager motor so I switched to a 9V battery instead. (Also, I couldn’t find the coin cell holders that I know are around here somewhere…)

The 9V is a bit bulky but I think we’ll be able to fashion a housing that isn’t too obtrusive.

Power Closeup

Books

I couple of friends asked me on twitter what iOS development books I’d recommend, based on my experience building Notesy.

I grabbed a shot of the books I still had in my bedside table and sent them along with a few comments. But digging them out made me realize just how many technical books I’d managed to cram into that little Ikea cuboid.

Here’s them all hanging out on our bed:

Books!

— and that’s not counting the multiple years’ of Wood magazine I also have in there. I think it’s safe to say I’m a geek.

Pittsburgh Glass Center ||

After enjoying ourselves at the Christmas-themed “Make It Now” event at the Pittsburgh Glass Center, we knew we had to go back. They put on another event for Martin Luther King day, and this time Carter and Mary came too. All three of them made fused glass tiles:


Make It Now Glass

That’s Cameron’s tree on the left, Mary’s design in the center and Carter’s kitty-cat on the right. Mary preferred hers prior to it fusing, as she’d used a lot of zig-zag pieces of glass. I think my favourite is Carter’s cat.