One of the tools included as part of iOS6 and OS 10.8 is a simple but useful note taking app, unsurprisingly named 'Notes', which is also part of the iCould service and can be synced between devices over the internet.

I've used Notes lightly since it appears, primary to jot things down when I'm travelling (I used it a lot at Worldcon), and as a shared clipboard to move URLs and small snippets of text between my Mac and the iPad.

What isn't readily obvious when using the application in either guise, or the iCloud web service, is how the notes are stored.

It becomes apparent, however, if you use a third-party mail client to access your iCloud email account. There is a 'Notes' folder, hidden when viewed in Mail.app, which contains, as you might expect, your notes in standard e-mail message form.

Okay, so we can read notes over IMAP, can we write them? Editing existing ones works as expected, but just saving a new email message into the folder doesn't - the message is visible to the IMAP client, but note to the Notes app.

So lets look a little closer at the headers on the notes from Notes:

Subject: An uninteresting note
From: Me <me@example.com>
X-Universally-Unique-Identifier: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Content-Type: text/html;
        charset=utf-8
X-Uniform-Type-Identifier: com.apple.mail-note
Message-Id: <XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX@me.com>
Date: Wed, 25 Jul 2012 23:43:09 +0100
X-Mail-Created-Date: Wed, 25 Jul 2012 23:43:09 +0100
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (1.0)

Mostly what I would expect, apart from the X-Universally-Unique-Identifier and X-Uniform-Type-Identifier headers, which turn out to be the magic trick. Create a new message with those headers (with a new UUID in the unique-identifier one), and hey presto, it appears on iCloud and in Notes.

With a little bit of help from offlineimap and some shell glue it is not particularly hard to use this mechanism to create new notes, or edit existing ones, from the command line.

Posted Fri Jan 11 18:17:42 2013

Back in the dim and distant I wrote about collecting electricity consumption data. In the intervening time and due to some hardware changes and failures I had stopped doing this.

Recently, Graeme Thomson gave a talk at ScotLUG about the system he is using to monitor temperatures around his house, using a 1-wire sensor network. Inspired by this, I decided to revisit my monitoring efforts.

Graeme's system took advantage of the fact that his house had recently been rewired and at that time he had laid in a number of twisted pair drops into each room, which could easily be patched onto his 1-wire bus.

Not wanting to run more cable around my own flat I decided to look at the possibility of doing the same thing wirelessly, and I remembered, from my Arduino tinkering, about the JeeNode project.

JeeNodes are compact, low-power Arduino-compatible AVR microcontroller boards with onboard wireless modules. They are very versatile and ideal as a basis for all sorts of wireless sensor nodes. They are also relatively inexpensive, particularly when purchased in kit form.

After a bit of tinkering around I settled on a sensor node design consisting of a JeeNode with an AA battery based power supply, and a DS18B20 digital temperature sensor.

Assembled sensor node

I now have four of these scattered around the flat, running a simple sketch that takes a sample from the temperature sensor every minute or so and transmits it back to my central server. The 878Mhz radio system seems to comfortably cover the entire building.

Using one JeeNode per sensor is not the cheapest way of doing this, but saves me pulling cable and leaves me with a lot of flexibility should I wish to expand this system or monitor additional parameters in future.

The end result: pretty graphs, and a better understanding of how the temperature in my flat changes over time.

24 hour temperature graph

Ideas that I have for the future include replacing the node near my server with a Arduino Nano, rather than using wireless to span half a metre, and reuse the JeeNode in another room.

Posted Wed Oct 31 16:14:16 2012

With the current goings on over at LiveJournal, and the realization that I'm not really paying much attention to it any more I've decided to move my meagre creative output over to ikiwiki here. My old LJ posts will remain where they are, but I won't be updating it further.

Posted Wed Oct 31 14:40:22 2012

This blog is powered by ikiwiki.