Sunday, November 15, 2009

Bayes and models.

This is me talking to the pumpkin (aka thinking aloud).

I have two models.
One is that everything is noise, and has a discrete distribution over a grid.
One is that there's a pattern and predicts the future location of an event.

Bayes says the posterior probability of the model is:
   P(M|E) = P(E|M)P(M) / P(E)
where
   P(E) = P(E)P(M) + P(E)P(!M)

Ahhh. I realise my mistake. P(E) is not the ideal probability of the event, but the much more restricted 'probably of event in the space the P(E|M) is measured '.

In my case, where the distance between the predicted location and a movement event is being considered, the underlying distribution is the expected distance to a movement events, independent of the model.

I.e. Have no model. Just measure the expected distance from random points to movement events to build the model. Then seperately build the same model specifically for known model conforming events. That generates P(E) and P(E|M).

Doh. For some reason that took a very long to sink in.

Thursday, July 30, 2009

HAL sucks

So you have a touchscreen, and a 'modern' X11 installation.

Your 'modern' X11 knows that actually configuring devices is something that people who live in caves do. 'Modern' X11s use HAL!

Unfortunately, the nice 'modern' X11 installation is borked. It's talking to HAL which is telling it to use inputs/event0. Which doesn't actually exist.

So the question is: How do you tell it to use /dev/inputs/event2 which is a working touchscreen?

Ahh, you might ask. What you really do is spend far too much time searching google and eventually arrive at:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
  <match key="input.product" contains="Touchscreen">
    <merge key="input.x11_driver" type="string">evdev</merge>
    <merge key="input.x11_options.SwapAxes" type="string">true</merge>
    <merge key="input.x11_options.InvertX" type="string">true</merge>
  </match>
</device>
</deviceinfo>

Which you install in /etc/hal/fdi/policy/touchscreen.fdi

Of course. it was obvious from the very start that this was the thing to do, no? And the documentation has zero mistakes or misspellings in it. A remarkable end it achieves by being non-existant.

Sunday, July 12, 2009

Rust as far as the eye can see.

Having many adventures trying to compile a new kernel for the DevKit8000

embest haven't submitted the board support to mainline and after reverse engineering their patches, it's easy to see why!

The diff is littered with random patches to random files (that aren't used), #if 0'ed code, and cruft like:


 #ifdef CONFIG_OMAP_MUX_DEBUG
-       debug = cfg->debug;
+       //debug = cfg->debug;
+       debug = 1;
 #endif
        warn = (orig != reg);
-       if (debug || warn)
+       //if (debug || warn)
                printk(KERN_WARNING
It's been about  two hours work to separate out the parts that actually do something, and port them forward to a 2.6.30 kernel.

Which brings me to a confession: I just realized it's been something like 3 years since I last ran 'make menuconfig' on a linux kernel. The rust! It burns!!

Saturday, July 11, 2009

DevKit8000


I recently ordered a DevKit8000 development board for use in an embedded image processing project I'm looking at.

My DevKit8000 arrived yesterday. I bought the "yes, I will have fries with that" version, so it has the 7" touchscreen, more cables than you can poke a stick at, 512MB sd card, a USB hub,  and 2 power wall-wart power supplies.

Total cost was $AUD420 including DHL shipping of ~ $AUD80. The price for the board board is comparable with the BeagleBoard, but the shipping was cheaper and easier from China than it would have been from DigiKey! So I'm pretty happy with the price.

One of the power supplies has a USA plug, the other is something European.
The one with the USA plug is apparently the board power supply, the other is probably the USB hub power supply (at least, the plug doesn't fit the board).

The board itself had Windows CE loaded in NAND flash out of the box, which sent me on a 4 hour trail of destruction trying to replace it with linux. This was mostly due to me not realising that the sd-card that comes with the board is junk, and in addition to being unreliable, doesn't function at the 3.3V the OMAP processor requires for it to be booted from.

Not realising that, I thought that I must be doing something wrong (which given the .. umm.. erratic number of the board documentation wasn't unlikely) and so tried all sorts of things in an effort to re-flash the NAND X-loader, cumulating in formatting the NAND flash and rendering the board entirely unbootable. Waving aside the blue air, I finally did what I should have done to start with, and use a known-good SD card. Which instantly booted correctly, taking another 2 minutes for me to reflash the x-loader, u-boot, uImage and filesystem. *&^*&^*&^&*!!!!!!!

With the board actually booting and running linux, it was much more useful. It immediately come up on the ethernet with an ifconfig+route making it a lot faster to move images around than the sd-card sneakernet I had been using.

The CD that comes with it has a port of Android which functions rather well and was useful is checking that the touchscreen actually works.

The hardware appears to be fairly close to the beagleboard, except that it also includes an on-board ethernet, and a ZIF socket for a camera input.

There's a couple of odd things: The host USB port (as opposed to the OTG USB port) appears to be missing a chip. The pattern is there for it on the board, and all the pad have solder on them, just not chip. This is not entirely unexpected: The USB Host port isn't listed in the feature list, and the BeagleBoard people have had trouble getting it reliable.


The more concerning one is that one of the power regulators (TPS73701) has a terrible soldering job done on it. It looks like there may have been a solder mask problem and FAR too much solder paste was dumped on. The tab is swimming in solder, and leads look like they didn't quite reach temperature to fully melt the paste. This is one of a two parallel regulators, and the other one is spotless, so I'm a little puzzled as to what went wrong with this one. Both are running the same temperature so it appears they're both working, it just looks terrible.

Other than that, the rest of the board looks clean and well put together.

Now I'm off to setup a cross compiler environment!

Belated files

Very belatedly getting around to posting these.

The Eagle CAD files for the relay driver board is now posted at https://sites.google.com/a/dgmo.org/home/Home/boards

Friday, April 10, 2009

Noise filter your signals!

Free advice. When there's a 200m loop of wire carrying a low voltage signal, noise filtering is a _very_ good idea.

Otherwise the doorbell may ring at 3am in the morning from induced noise...

Sunday, April 5, 2009

'Fixed' the doorbell today.

The doorbell has been a source of trouble for a while. Mostly because D is in the habit of closing every between where she is and the front door, causing it to be inaudible.

So today, I wired the doorbell between the DCD and DTR lines on the main fileserver and wrote a little C program effectively gets an interrupt when DCD changes. When triggered, this program runs wget to hit a URL on another server, that runs a cgi-bin script, that plays a .wav file through the speaker.

For some reason the name 'Reuben Garret Lucius Goldberg ' kept running through my head...

But the end result is that one can push a door near the front door, and something near the center of the house chimes, so the end goal is fully achieved!

Saturday, April 4, 2009

Clipsal C-Bus

Clipsal have decided to open the C-Bus protocol.

http://www.cbusforums.com/forums/showthread.php?t=5022

Speaking as someone with a C-Bus wired house (for reasons that were never terribly good), this is a very, very good thing.

It's rather unexpected, and I suspect a little late (there's considerably more competition around now), but it's going to make it much easier to do semi-decent integration.

Yay Clipsal!

Monday, March 16, 2009

Adventures in Switzerland.

Currently in Zurich.
R is here for first time, so wanted to do a little wandering around.

Had very vaguely hatched a plan to visit Pilatus, a mountain not too far from Zurich. The plan was to catch a train to Luzern, bus to the cable station, and then cable car up Pilastus.

The morning started off to plan: We managed to leave the hotel vaguely sort of on time, made our way to Zurich HB (Central train station), and found food at McDonalds. (hungry people do desperate things).

The first sign of trouble was attempting to buy a ticket to Luzern. This involved much fighting with the ticket machine. Firstly it didn't like anything. This was solved by actually pressing 'OK' on the screen before attempting to hand over money. Then it refused my visa card many times (in various orientations), then it wanted a pin (which I don't have), then rejected my EFTPOS card as unsupported (the pin for which I did know), R's visa card (it wanted a pin which he didn't know), and various other random pieces of plastic we attempted to feed it. Finally R found some cash and fed it that, which is liked, ate, and dispended tickets. Yay! For a train that was due to leave in 60 seconds. On a platform far, far away.

Sprinting for the platform had us there just in time to see it leaving in the distance. A 30 minute wait...

The trip to Luzern was very pleasant. The trains are very quiet and nice, and the scenery is picturesque. Did a few sudoku puzzles which R had infected me with, and we arrived in Luzern in short order.

Wandering around looking for things bearing the name 'Pilatus' had us finding the S31 bus which ran to Pilatusmarkt. Very promising. So we walked to the 6 blocks to Pilatusplatz, found a bus stop (yay), found the S31 stopped there (yay) and it was due to arrive in 6 mins (yay).

15 mins later, it was pretty clear that the S31 wasn't. The timetable insisted that all was well, but no bus. So we decide to take the S20, change to the S21 and we'd be fine. S20 was good. Actually did arrive, did travel in the right direction. Alas, we fell to talking and missed the stop. So getting off at the next stop decide to 'just walk back. Not far really'. About 15 mins of walking led us back to the stop for the S21. Which was due to arrive in a little over an hour. argh! Ok. Another change of plan. Now we'd take the S16 which looked like it also went to Pilatusmarkt and that one was only 6 mins away.

Bus arrive. We get on bus. Bus travels about 300meters to Pilatusmarkt. We get off. Find we are at deserted shopping center. Close for the sunday. Named 'Pilatus Market'. Doh! Turns that that many random things around Luzern are named after the mountain.

Now very lost, with the next bus not due to 60 mins, we decide to walk back to where we caught the S16. The horrendously unreliable map (scale optional) claimed a nearby train station.

20 mins of walking, we are at train station. We had originally intended to catch the train back toward Luzern, but there timetable had various stations marked with a cable car symbol. How exciting! Which led to R get excited about visiting Engelberg, and maybe wandering up Titlis, a 3000m high mountain.

More tickets, more fighting with ticket machine, eventually discovered that it enjoyed amex cards. Wait for train. Train takes us along a very pretty route. Alongside a lake, wending through valleys. And then turned into a cog-train for a while! Seriously steep assent led us into some stunning scenery (sorry, no photos yet) .

Engelberg was less interesting, but they really did have a cablecar up the mountain (actually, many many cable cars up many slopes). We caught one to Gerschnialp, about 1260m above sea level. Normal hairy cable car ride put us in some fairly serious snow. With us wearing jeans and tennis shoes...

We had a really good time. Walked along a snow trail for about 20 mins a small restaurant in the middle of no-where , had a fairly ordinary lunch (which cummulated with them refusing to accept anything except Amex, where the amex could only be used for bills over 50CHF [ours was 33CHF], and we had no cash left...) we then set off to walk down the mountain.

This was hugely enjoyable. A snow trail wandered down the mountain through forests et al. Most of it was fairly well packed snow so it wasn't that bad to walk on. Most of the other people we saw were wearing snowshoes, but they clearly envied our minimalist approach to snow hiking.

About 1/2 we down, we found a ski-jump! A truly terrifying affair. Seeing them on television can't convey just how insane they are. Standing at (well, near) the lip of the jump, you can't actually see any of the slope below, just the flat field far below. Actually: far, far, far below. I was having trouble with the heights just standing near the edge of the jump. I can't imagine just how certifiable you'd have to be to actually go down it on skis. Simply amazing.

It took a bit over an hour to walk down the mountain. Followed by a sprint to catch the train back to Luzern (more stunning scenery), and then the train back to Zurich, and then another train back to Stadelhofen.

Hugely enjoyable day; Now very, very tired. Goodnight.

PS: No, never did find out what happened to the S31 bus.

Sunday, March 1, 2009

Puzzle Piece


Just spent a few enjoyable hours making this exercise. "How DID the nut get on there?".

It's puzzle piece to which the photo doesn't do full justice. There's a no visible joins in the threaded piece: It looks seamless.

It's a nice exercise in lathe work with a number of tricky bits. The facing needs to be very good, threading interior sections is a generally a bitch to do, especially in stainless steel. And then finishing it all to the mirror polish (which you can somewhat see in the high fidelity reflection at the end).

I'm quite pleased with it because I pretty much got it right first time, it turned out well, and the polish came up far better than I was expecting. I keep underestimating how far the buffing wheel will cut.