Alarm Clock

The alarm clock before I started writing this article

Most alarm clocks have somewhat awkward interfaces, which may be why so many people have switched to using their mobile phones instead.  Most mophos have alarm clocks that are easy to use — just open the clock app, choose a menu item and type in the time.  Especially for people like me, who doesn’t get up at the same time each day, using a traditional alarm clock is annoying beyond endurance.  It’s an outrage!  I’ll write my congresscritter!

Anyway, where was I?  Yes.  An alarm clock needs a numeric input pad. But, of course, I find using a mopho to be annoying, too, since I wake up all the time and need to be able to see what time it is before continuing to sleep.

I’m easily annoyed and sleep unsoundly.  There’s probably no connection between the two things.

Alarm clock control device

Anyway, I wrote an Emacs-based alarm clock, which, as a bonus, shows just how cold it is outside, too.  If it’s too cold, I just ignore the alarm and keep on sleeping. And it displays the time using the Futura type face.  How could you use an alarm clock with an inferior font?

To control the thing, I thought it’d be perfect to use a wireless keypad.  It allows me to set the alarm very easily (just type 8 RET of 730 RET). However, finding a keypad that had the required range turned out to be pretty difficult.  I went through five different ones before I ended up with this one, a Logitech N305.  All the other ones either only had a two meter range, tops, or were totally unreliable.  The N305 only has a single unusable key, the “Excel” key, so I use the rest of the keys to control the volume of the music and the lights in the bedroom.

MiniGoose temperature sensor
The new alarm clock. See? Much nicer. And warmer

Writing this it occurred to me that I had a spare tiny FitPC2 computer, and a 10″ USB-powered DisplayLink monitor that I had never used.  Instead of using the (really too big) eMachines all-in-one (seen at the top there) as the alarm clock, I could perhaps use the FitPC2 instead?

And I could!

DisplayLink technology is pretty new, and there are some quirks, so in case you have a similar setup and is Googling for how to get it to work under Linux (Debian Squeeze, Linux kernel 2.6.38), the rest of this blog entry is for you.

# lsusb -v
Bus 001 Device 005: ID 17e9:0288 Newnham Research

  idVendor           0x17e9 Newnham Research
  idProduct          0x0288
  bcdDevice           f0.02
  iManufacturer           1 DisplayLink
  iProduct                2 Monztor S10
  iSerial                 3 10270020

The iMo 10″ screen comes up as a cdrom device:

[    3.408147] sr0: scsi3-mmc drive: 8x/40x writer xa/form2 cdda tray
[    3.408372] cdrom: Uniform CD-ROM driver Revision: 3.20
[    3.409760] sr 2:0:0:0: Attached scsi CD-ROM sr0

So you have to use usb_modeswitch to switch it to DisplayLink mode:

usb_modeswitch -v 0x17e9 -p 0x0288 -u 1

After doing that, the screen should go green, but X won’t work on it.  Say the following:

rmmod udlfb
modprobe udlfb fb_defio=1

and you should now be able to start Xorg on the device.

Section “Device”                                                 
   Identifier  “MimoDevice”
   Driver      “fbdev”               
   Option      “fbdev” “/dev/fb0”

Section “Screen”                                                 
   Identifier  “MimoScreen”              
   Device      “MimoDisplay”   
   Monitor     “MimoMonitor”   
   SubSection “Display”                         
     Depth       16                      
     Modes       “1024×600”

See?  It couldn’t be simpler.

The Mimo USB monitor is quite nice, by the way.  It’s also a touch screen and a USB hub, but it’s not a floor wax.   However, the contrast leaves something to be desired, and the viewing angle isn’t very good. But it’s good enough to use as an alarm clock.

An Emacs-based PVR

In the continuing story of me trying to push a few of the odds and ends of the code I’ve written for my own use, we’ve now come to the Emacs-based PVR. As usual, it may not actually be very useful code for, like, normal human beans, but why not push it out there?  Perhaps somebody will be inspired to do…  something.

So the story behind this piece of code is that I’ve never really been very fond of watching TV live.  I know, these days nobody does that any more, and everybody uses their cable company supplied (and crappy) PVRs, but back at the start of the millennium, it was a not un-novel idea.

USB TV card

And my implementation of it, based on Emacs, is probably noveller (that should be a word) than most.

So the idea is basically that we pull down the TV programme (thoughtfully provided by the XMLTV project), see what programs we want to record, and then record them.  It’s simple.  Since it’s Emacs-based, I can just ssh in to my machine from anywhere and add new programs to the list of stuff to be recorded from anywhere.  Take that, User Experience people.

The computer is hooked up to an external USB tv card that provides an MPEG stream.  So the actual recording is just “cat /dev/video0 > /tv/file”.

The nice little box running Linux

The cable company calls me sometimes and asks me if I kindly could consider switching over to digital cable, but then my PVR thingie would stop working, so that’s out of the question.  If analogue cable goes, I stop watching TV.

The only problem (for some values of “problem”) with this setup is that I can’t watch TV live easily even if I wanted to.  But I’ve been running stuff this way for a decade, and that hasn’t really tempted me more than a couple of times, so, eh, whatev.

Tellstick Redux

I was whinging a lot about the terrible Tellstick range in my last post on the issue.  Deservedly so.  It’s terrible!  However, the Telldus people have released a new version of the device:

The revolutionary new invention is the antenna!  Who would ever have thought that an antenna would give greater range?  Kids these days.

Anyway, it really does work.  I had four separate antenna-less Tellsticks that gave me 90% coverage of my apartment earlier.  With the new Tellstick, a single one gives me 100% coverage.

That’s progress.

Assange Past Revealed!

I was looking through my ~/lisp directory just now, and I found this file, saved in 1998.  I can’t recall ever using it or where I got it from, and it’s probably written by a different Julian Assange, but anyway…

Here are solid connections between Wikileaks and the sordid Emacs development environment!  I think the justice deparment should start looking into this!

Emacs Home Automation

Nexa unit

We all grow so very weary of having to switch lights on and off. Every day. On again and then off again. Will the madness never end?

Technology comes to the rescue! There are companies that sell receivers (like the one pictured to the left, plugged into a wall outlet that I now see I should have dusted before snapping the picture. Too late now!) that you can control wirelessly.

So the question then is: How do you control them without (yuck!) using remote controls and stuff? You use Emacs.

Telldus sells small blue USB devices that are called Tellsticks. These expose a USB serial interface, and uses a pretty … primitive encoding method for sending commands to the units.

The Emacs Lisp code needed to send commands via Tellstick is on github, since that where all the cool kids hang out these days.

Tellstick and one of the lamps it controls

I’ve had this thing running for about half a year, and it’s really nice to be able to switch off all the lights in the entire apartment with just on the hallway computer. The main problem is that the range of the Tellstick senders is about five meters. If there moon is in the right phase and it isn’t too windy. And you feel lucky.

Fortunately I have at least one computer in each room, so I’ve just bought a truckload of Tellsticks and have each computer control each room, and then I have the remote remote control work by using emacs-server/emacsclient. But you can probably work that stuff out yourself.

Enjoy the gift of light! No longer sitting in the dark, typing away, just because you’re too lazy to get up and switch the lamps on!