Archive for the 'Stuff I've been up to lately' Category

Logging while I sleep

For the past few nights I’ve been sleeping with…

Okay, that came out wrong.

For the past few nights I’ve been heading off to bed with a Wiimote strapped to my wrist.

It all started with reading a patent explaining how wrist and hand movement could be correlated with entering a lighter phase of sleep – lighter sleep leads to moving around. The idea is, if you’re in a lighter phase of sleep, you wake up easier, feeling more refreshed. The goal for this is to build an alarm clock for myself that makes it easier to wake up in the morning, by waking me up up to a half hour earlier if that turns out to be easier. A team at the IEEE Canada Telus Innovation Award in 2006 had done precisely this, but they used an EEG for sensors, and needed paste and electrodes. Yuck.

This whole setup using an accelerometer is already patented and available from www.sleeptracker.com, but that costs “money”.

I wanted to gather some data of my own to try and devise an algorithm for translating data from a 3-axis accelerometer into an indication of being ready to wake up. This meant logging a night’s worth of accelerometer data, importing it into something like MATLAB, and playing with the numbers. My initial idea was to make a little board with an Arduino, an SD card, an accelerometer and a battery. This would take a lot of design, building and debugging on my part, and would take money.

I then remembered that my desktop machine has Bluetooth, and that I have Wiimotes.

The Wiimote is just about ideal for this: it has a 3-axis accelerometer, it can relay the data back over Bluetooth, and runs on batteries already. It’s a little large for this application, but it already exists, works and is in my hand right now, all of which are amazing benefits over basically anything I can or would build. Why do the work yourself, when someone else has already done the work for you?

I found a program called G-Force Logger that came with C# source. It logs values on each axis from the Wiimote’s accelerometer at a user-defined rate. I modified this code to write to a comma-separated file rather than a TextBox control, and let it run overnight. I’ll discuss the results later – but I can tell you it works nicely!

Our Home Network

When we (my family and I) moved into our current house nearly 5 years ago, there were a few issues that we knew we had to take care of – the poor furnace, the lack of a proper bedroom for me, the colours of the walls, etc. One thing we’d counted on waiting to finish, though, was the wiring – while we wanted to properly network this house and avoid the “50ft patch cords through vents and tucked under baseboards” we’d used before, there were more pressing issues.

The rather strong AM reception on nearly every telephone in the house changed that pretty quick.

When we started looking into the phone wiring in the house, thing got pretty murky pretty fast. We found that some jacks were using the standard Green and Red pair, and a couple used Yellow and Black – but we could NOT find where they switched. One phone wire ran under a baseboard and under the bathroom floor – the tile bathroom floor. The phone wire was embedded in the thinset cement. Other rooms had the standard “dorm room” wiring job, holes drilled in walls for phone wire, with 4 baseboard jacks in one room alone. Fixing it was proving to be too time consuming and too difficult if we were going to be replacing it anyways, so we headed off to Sayal Electronics in Burlington and came home with two spools of CAT5E cable – Blue for Data, Grey for Voice – a spool of RG6 Coax cable, and assorted hardware (keystone jacks, keystone plates, and compression crimp cable plugs).

This upgrade had been planned for a while – we’d picked up an inexpensive compression crimper on a trip to the US since models that cheap weren’t available north of the 49th, and I’d obtained a few Leviton media panels fairly cheaply on eBay, all prior to moving in. So when the decision was made to go ahead, we were ready. We slowly started running wires to the rooms that were easiest to get to in order to get good at setting up the cables, and wound up rerouting and redoing a few runs as we went. About a year and a half after moving in we started a big basement renovation that required we be very careful with our already-installed cables, but also gave us the opportunity to pre-wire the basement for surround sound and build in a cabinet for the equipment to go. It’s this part of the story that we’re working on now – adding AV wiring from the cabinet to behind the TV so that we can clean up that area and make use of the new surround sound system we got for the basement.

(The system in question was a prize in the Rogers Customer Appreciation Event – thanks Rogers, we appreciate you too!)

The state of our home network now is a great deal better than it was when we moved in:

  • Each room has a wallplate with, at minimum, two CAT5E runs – one voice, one data – and one RG6 cable run. Most have two RG6 runs in case we want to move to satellite TV. Each of these is a keystone wallplate.
  • Every cable run is a “home run” back to a media panel in the basement. Each CAT5 cable and RG6 cable terminates at a patch panel. All of the voice jacks are on one patch panel and all of the data ones are on another – and jack 1 on the Voice panel is the same destination as jack 1 on the Data panel.
  • There are about 12 panels around the house – every bedroom, the living room, family room, study and a few in the basement.
  • Every cable run is documented as to where it goes and takes a rather direct path to get there.

A bit of a footnote on the phone wiring issue: when we were doing some further renovations, we drilled into a joist in the basement, and saw phone wire on the other side. We pulled about 30 feet out before it stopped – all of which was live. This possibly explains how our house acted as a giant antenna…

Some photos of our current setup:

IMG_0033_JPG.jpg

One of the keystone wallplates. Two coax, one RJ45 CAT5E, and one RJ11 for telephone

IMG_0016_JPG.jpg

The basement data centre: two SMC switches (ugh), the Linksys WRT54GS router (hacked), RCA cable modem. Underneath is the homemade Cable TV patch panel, and under THAT are the Leviton media centres – Ethernet on the left, Phone on the right.

IMG_0017_JPG.jpg

A different view of the same, showing a few cable runs coming in.

IMG_0018_JPG.jpg

A closeup on the Leviton media centres. We’re only using one of their splitters as that’s really all we need.

IMG_0019_JPG.jpg

See? Even our power setup is clean! My Linux server’s tiny monitor at the bottom.

Soon, I’ll talk about how we’re going crazy again, this time with home theatre wiring.

Updated Portfolio

I just updated a bunch of stuff on the Portfolio section of my site – check it out here.

Obviously there’s still a lot more to be added, but that should happen fairly soon.