Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Al Williams

Dr. Dobb's Bloggers

Shades of Gray

January 28, 2011

One of the hardest fields related to computers, I think, is knowledge capture. That's the art of getting the knowledge about something out of someone's head for incorporation into something like an expert system. Sailing is a great example. You can read about sailing for months. You can watch videos and surf the Internet. But there's nothing like actually being on the water, watching a jib luff in the wind to teach you how to trim a sail. There's dozens of little things you do that you don't even really think about.

I once had a project to do for a museum where they had a large wheel. You'd spin the wheel and where it landed a little presentation would come up on the screen and out some speakers. If I were starting from scratch that'd be easy. But sadly some other firm had come in and done the project. They were clearly on top of the artistic part, because it looked great.

The problem is it didn't work so well. Sometimes it would randomly pick up different items than the pointer indicated. It didn't take long to find out why.

As artistic as the exhibit designer was, he or she apparently wasn't much of an embedded developer. There was a PC behind the whole thing which is OK since you had to play movie files at the end. But the interface to the wheel was a disaster.

The keyboard for the PC had a slot cut in its case and wires connected keys to 4 reed switches behind the wheel. The wheel had adhesive magnets stuck on it so that you got a different set of letters when a different part of the wheel was over the reed switches.

Overall, this is probably workable, but it requires a little bit of that "sailboat" knowledge to get it right. The original designer put the magnet pattern so that the wheel sectors were numbered 0001, 0010, 0011,... (in binary, of course). The problem, as you surely know, is that if two zones were active at once you would get bad results.

The solution to this is well known -- its called gray code (and not grey code since it is actually named after Frank Gray of Bell Labs). The idea is to make numbers sequences that only change on one bit at a time. So the wheel should have been in a sequence like 0001, 0011, 0010, 0110,...

Rearranging the magnets helped, although I eventually replaced the whole mess with a USB RFID reader and glued RFID tags to each wheel sector. Cheap, reliable, and no contacts to wear out or get dirty.

But it does illustrate how important little heuristic patterns you use as you develop embedded systems. I'm sure there are many more of them -- tricks to squeeze code into limited space, things you do when you are working with multiple power supplies, etc. Just the little things you "know" but its hard to enumerate them.

Maybe that's the knowledge capture we need -- embedded system design patterns. Hmmm... maybe that's my next book!

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.