Followup and evaluation on the Chumby [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Mon 2008-05-26 12:23
Followup and evaluation on the Chumby

My plan to buy a Chumby and convert it into a somewhat over-engineered alarm clock has now come to full fruition, and appears to have been entirely successful.

I had to junk the original version of the software I wrote for it, because it turned out that the Chumby's Flash player was apparently never intended to keep running the same program for more than a few minutes at a time: every three days or so it would leak enough memory that the clock became unresponsive and had to be rebooted. So I threw the whole thing away, thus fulfilling Brooks' Nth Law, and wrote it again from scratch in C. It is now lovely and fast, it doesn't leak, and as an added bonus it's much easier to persuade it to store persistent data and make network connections.

So the clock program now does everything I originally envisaged, including tying in over the network to my existing calendar software. Yesterday was the first test of this on live data: it correctly spotted the impending bank holiday and automatically cancelled the usual weekday alarm arrangements, and it has correctly not tried to do the same thing again for tonight. Success!

So now it's working, the real question is: was it worth it? And already I'm confident that the answer is yes.

As I originally planned, I can now get up early with impunity. I can just press ALARM OFF, get out of bed, and not worry about it. Where I would previously have had to come back to the clock at 8am to stop it beeping, or remember to turn the alarm back on properly that night, I now need do nothing at all – and on the next school night, it's lit up just as it usually would be, reminding me to enable the alarm for the next morning. One irritating little weight off my mind.

But there's an additional advantage which I hadn't considered, which revolves around the snooze function. With my previous clock's snooze function, you would press the Snooze button and then be pretty much committed (on pain of thundering inconvenience if you go back on it) to staying in bed for another nine minutes. So you might as well drift back off to sleep, and then when the alarm goes bwarp again nine minutes later you're just as unwilling to get up as you were the first time.

But with my snooze function, because you can trivially cancel it at any time in the middle of the snooze interval, it's now feasible to lie in bed and gradually wake up rather than going straight back to sleep; my normal usage of the snooze function is now to hit Snooze, lie around for three or four minutes, then cancel the snooze and get up. The alarm at the end of the snooze period has now become a safety feature just in case I accidentally drift back off during this process; in normal usage it never actually goes off. It's as if my redesign has completely changed the nature of what the snooze function is fundamentally for, and the new model feels much more sensible and useful. (Of course the old usage is still available if I should want it: there's nothing stopping me hitting the snooze button and dozing straight back off).

There's always a danger, when you want something for ages and finally get it, that it will turn out not to be as good as you'd hoped, or that your imagination had not correctly envisaged the way it would be used and that it will therefore turn out not to be as useful as you had believed. Today I own an alarm clock which has well and truly avoided these traps, by not only fulfilling all my original expectations but also by turning out to be useful in extra ways. I got it right!

LinkReply
[personal profile] gerald_duckMon 2008-05-26 12:15
Oooh!

I wasn't so interested when I found you'd written all your modifications in flash, to run on top of their software edifice. Now I know you've got some C code that will hopefully be available open-source very soon to do some important things in elegant ways I'm much more interested.
Link Reply to this | Thread
[personal profile] simontMon 2008-05-26 13:23
that will hopefully be available open-source very soon

Good point; it's probably about time I moved it out into my public svn repository. I'm not yet sure it merits an actual web page of its own, since it's a pretty niche program, but as of now the code is available from svn://svn.tartarus.org/sgt/tring (or you can browse it on the web here) if you want it.

I don't know how much of my code will be directly useful to you. Probably the thing you'll find most useful is the enormous comment at the top of chumby.c which documents everything I know about the programming interfaces to the Chumby hardware from the POV of a userland application.
Link Reply to this | Parent | Thread
[personal profile] pm215Mon 2008-05-26 13:40
(from chumby.c)
    pollfds = malloc(npollfds_both * sizeof(*pollfds));
    pollfds[0].fd = touchscreen_fd;
Shouldn't there be a check for malloc failure in there?
Link Reply to this | Parent | Thread
[personal profile] simontMon 2008-05-26 13:45
Fixed :-)

(Not very important in practice: that code only runs once at program startup, and unless I'm doing debugging that's always just after a reboot so the Chumby will pretty reliably have plenty of memory to spare at that point. But thanks anyway.)
Link Reply to this | Parent
[identity profile] deliberateblank.livejournal.comMon 2008-05-26 14:11
Or switch to epoll instead?
Link Reply to this | Parent | Thread
[personal profile] simontMon 2008-05-26 14:37
Gosh, I didn't know about that. My choice of poll was mostly dictated by the ALSA library API, which provides a pre-cooked set of struct pollfds for detecting when more data needs to be sent to the sound device. I suppose I could have read those and translated their contents into my poll-equivalent of choice, but it didn't seem particularly worth doing.

epoll looks like massive overkill for a job this small, anyway!
Link Reply to this | Parent
[identity profile] senji.livejournal.comTue 2011-06-28 12:34
`` The root "tring" is unknown. ''
Link Reply to this | Parent | Thread
[personal profile] simontTue 2011-06-28 12:44
tartarus.org's ViewVC has been reorganised in the three years since I posted that. New webified SVN interface is here. (Proper svnserve interface through which you can check out is unchanged.)
Link Reply to this | Parent
[identity profile] sunflowerinrain.livejournal.comMon 2008-05-26 12:31
Very cool!

I was going to ask what colours it comes in, but was afraid you might ask if I wanted it inserted nasally.
Link Reply to this | Thread
[personal profile] simontMon 2008-05-26 13:24
*grin*

Choice of three colours. I picked basic black.
Link Reply to this | Parent | Thread
[identity profile] sunflowerinrain.livejournal.comMon 2008-05-26 18:49
Black *is* the One True Colour, as the uk.rec bikers say.
Link Reply to this | Parent
[identity profile] angoel.livejournal.comMon 2008-05-26 15:24
Sounds good; I'm almost tempted to get one myself. Possibly when I've got a bit more time so that I'd be able to fiddle it to do what *I* want it to do.
Link Reply to this
[identity profile] feanelwa.livejournal.comMon 2008-05-26 17:24
That's rather brilliant.
Link Reply to this
[identity profile] pne.livejournal.comMon 2008-05-26 18:27
That was interesting to read. Fun!

And I'm glad you came up with something so useful to you.
Link Reply to this
[identity profile] cartesiandaemon.livejournal.comTue 2008-05-27 09:22
Yay. I'm very pleased it worked out successfully. (And that you're pleased. Sometimes something that's totally wonderful to life in general but not fun is harder to appreciate how wonderful it is :))

I can just press ALARM OFF, get out of bed,

I know what you mean, it sounds like it has all _sorts_ of useful perks. However, for the record, I have to say that non-chumby behaviour has to be "get out of bed, turn alarm off" :) I do it both ways, and the latter is much less prone to suffering an interrupt and forgetting the second half of the operation :)
Link Reply to this | Thread
[personal profile] simontTue 2008-05-27 13:00
the latter is much less prone to suffering an interrupt and forgetting the second half of the operation

*grin*

I find my subconscious and half-asleep brain is less determined than some people about finding ways to go back to sleep. I can generally trust my own short-term memory not to forget what I was doing in the thirty seconds between hitting alarm-off and getting physically out of bed. Neither am I one of those people who can put the alarm clock on the far side of the bedroom and then find they've got out of bed, turned it off, and returned to bed without ever waking up :-)
Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comTue 2008-05-27 14:05
:)

In general I don't have a problem. I'm really bad at actually getting up for a firm deadline, and basically have arranged a life where I don't have to :) So if I'm asleep enough to sleep through an alarm, I probably should.

However, just occasionally, I really am genuinely interrupted by something-or-other in that thirty seconds (going to the bathroom, or an interesting thought), and then go back to bed confident that my alarm will wake me...

So it's not actually a problem, but it's like a bit of code with a potential bug in. It makes me itch to fix it, just so that the code is more robust, and if something changes later, it doesn't accidentally create a bug there :)
Link Reply to this | Parent
[identity profile] naath.livejournal.comTue 2008-05-27 12:16
That's so cool.

Now I want one. Except that I'd then need to teach it to interface with Disorder (my alarm clock is a CD player) and receive radio (it's a radio too; and sometimes I want to wake up to the news)...

But it's alarm features are enormously superior to anything else.
Link Reply to this | Thread
[identity profile] cartesiandaemon.livejournal.comTue 2008-05-27 14:00
I typically use my mobile telephone as an alarm clock (because that works, and I can't be bothered to get a separate one, and it has a basic "different alarms for different days" function). I was very impressed with what Simon described.

(For me, mostly the calendar function, because that's only occasionally useful, but very useful. The advantage of using a phone is that you _can_ take it with you when you get up, so it doesn't matter so much if it goes off later in the day.)

But in that case, surely my correct solution is to write a program for the phone that does what Simon's does on his Chumby. (Or maybe to buy a chumby, but I don't know that the benefits for _me_ really justify it.) If so I don't know if I can actually find Simon's code useful, although having a specification for what a comprehensive, well-designed alarm clock ought to do definitely would be a killer helper.
Link Reply to this | Parent
[identity profile] ex-robhu.livejournal.comTue 2008-05-27 23:35
Sorry for almost driving in to you today ^^;
Link Reply to this | Thread
[personal profile] simontWed 2008-05-28 08:12
*blinks* Gosh, was one of the people fitting that description this morning you?

Which one? :-)

eta: oh, now I see the timestamp and you mean yesterday. In that case I've already forgotten the incident, whatever it was :-)
Link Reply to this | Parent | Thread
[identity profile] ex-robhu.livejournal.comWed 2008-05-28 08:18
Last night at about 6:30-7:30 I was on Ellesmere road (?) in Arbury when I pulled out from behind a big van. I couldn't really see what was happening and I'm fairly sure it was you who had to stop.

I was driving a green VW Polo.
Link Reply to this | Parent | Thread
[personal profile] simontWed 2008-05-28 08:25
Oh, that incident. Yes, I do remember that one in fact (so yes, it was me). I tried to work out which of us had been at fault, and concluded that the answer was probably the road designer or the person who parked the van in front of you: it looked as if you had virtually no visibility there at all.
Link Reply to this | Parent | Thread
[identity profile] ex-robhu.livejournal.comWed 2008-05-28 09:09
I had no visibility, but I should have thought about that when I decided to park there! (so err, I parked behind him rather than him parking in front of me :S)
Link Reply to this | Parent
[identity profile] cartesiandaemon.livejournal.comMon 2013-01-07 11:41
Are you still using the chumby? I was thinking I rather want an alarm clock that does the same thing.
Link Reply to this | Thread
[personal profile] simontMon 2013-01-07 11:47
I am, yes, and it's still working fine for me and being a really useful kind of alarm clock. I recently updated it to let me set a different default alarm time per day of the week and configure one-off different alarm times in advance via my calendar software (previously the only configuration in advance it supported was to disable the alarm).

Unfortunately, you apparently can't buy Chumbys (er, Chumbies?) any more – I recall that [livejournal.com profile] senji tried and failed. If you can find another kind of small Linux box, my alarm clock program has a porting layer which might make it a feasible project to run it on that, but we'd probably have to discuss it at least...
Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comMon 2013-01-07 12:30
Oh cool, I'm glad it worked out long-term.

Doh! I just looked up Chumbies and saw they were being discontinued, but hoped they hadn't gone entirely.

In fact, a Chumby seemed too complicated, you really only want something with an LCD display, wireless dongle, three coloured buttons, speakers, and an ARM chip. I don't even care whether there's an operating system.

I wonder if anyone is selling a raspberry pi already embedded in an appropriate box? Again, that might be overkill, but it might be worth it.
Link Reply to this | Parent | Thread
[personal profile] simontMon 2013-01-07 12:50
My alarm clock software ties in over the network to my calendar, so I do care about having an OS – it would be a significant pain to find an embedded IP stack and rewrite that part of my code to do its HTTP by hand rather than by libcurl. (But probably nobody else will be able to use that code as-is anyway.)

A Raspberry Pi does sound like a plausible possibility, now you mention it.
Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]