Sunday, November 14, 2010

Galvanic Etching

I've been working on a spring-loaded brass fan, which requires a lot of etching to be done. Normally I would do it chemically with ferric chloride, but that would get very expensive very quickly. So I decided to finally take the plunge and try out galvanic etching, generally following the guidelines here.

It has worked well enough, so far, but it's a bit of a messy process. With a bit under an inch between the work piece and the cathode, it takes 30-45 minutes to get a decent etch. Given that I have 28 pieces to do for the fan, this is only barely acceptable.

Gunk builds up on the cathode fairly quickly, which eventually bridges to the work piece and generates a short. I have to sit there with it and clean things off every 5 minutes. Possibly with a pump this could be improved. My power supply eventually blew its fuse, thanks to all the shorts.

The results are decent, but surprisingly rough in places. A ferric chloride etch would be much cleaner. Some of this seems to be the exact laser printer/glossy photo paper resist transfer process that I'm using. It starts to peel away towards the end of the etching process. The quality of the non-resist areas is really nice, though, giving a very smooth surface.

Thursday, November 4, 2010

Finished Lightsuit

As some of my cryptic Twitter updates have hinted at, I've been working on a el-wire suit. Only 10 months early for Burning Man 2011!

At its core is an Arduino Mega, a Memsic 2125 dual axis accelerometer, and 24 channels of independent el-wire control. All this is mounted on a faux-military jumpsuit. It has multiple modes of operation, including a motion-reactive setting which turns the entire thing into a bar graph showing the local acceleration.

The el-wire control is based on the circuit described here. I etched 3 circuit boards, each with 8 channels of control. I've posted the SVG file for the boards here, should you want to use it. It uses the same components as in the link above.

And what does it look like? Something like this:

The battery held up for 5+ hours without any problems. A couple strands went dead, but I kind of expected that, given how delicate el-wire joints are. I'm hoping the failure rate will drop with time as the weak ones are replaced. It was reasonably comfortable to wear, though the el-wire attachment has to be improved. They were too loose and one on the ankle broke its stitching. I need to improve the programming on the accelerometer mode, adding some smoothing and non-linear scaling to the values. But not bad!

Wednesday, November 3, 2010

Difference Engine

A couple of weeks ago I was lucky enough to be able to visit the Difference Engine at the Computer History Museum. It would be safe to say that I considered it something of a pilgrimage.

I will assume anyone reading this knows the general history of the Difference Engine. In brief, a 19th century mechanical calculator that was never built at the time, but has since been proved to be quite practical. Mostly notable because Babbage went on to design the Analytical Engine, also never built, which would have been a general purpose computer in every modern sense of the term. This is as close to real steampunk as the world ever got.

The principle behind the Difference Engine is actually pretty simple. If you take any expression f(), you can create a list of output values. f(0) = a, f(1) = b, etc. You can then look at the differences between the output values, and the differences between the differences, and so on. At some point, if f() is a polynomial, these differences will become constant. For an example, let's look at f(x) = x^2 - 5x + 10.

0 10
1 6 4
2 4 2 2
3 4 0 2
4 6 2 2
5 10 4 2

Once we're looking at the difference of the difference (or the second derivative) we're looking at a constant value of 2 (which is what we'd expect, as f(x) is a second order polynomial). Neat, but so what? Well, now that we've worked this out, we can calculate further values of f(x) just using addition. We can now work right to left, adding f(5)'' to f(5)', and then adding that to f(5) and we get f(6)!

0 10
1 6 4
2 4 2 2
3 4 0 2
4 6 2 2
5 10 4 2
6 16 6 2

So that's pretty cool. And that's exactly what the Difference Engine does.

Each of those columns is a 31 digit number. There are 9 columns, allowing 9th order polynomials to be calculated. Adding is a very simple operation mechanically -- gears turning gears at a 1:1 ratio. The complication comes from carry operations, which is what the helices on the columns in this picture do. (This is the rear of the machine.)

With the mechanism so far, you can calculate some fairly complicated expressions with a high degree of reliability. But this is the 19th century. You're not calculating them for use in a ray tracing or something, you want to generate a big book of trig tables. Which means that all these values have to be typeset. By hand. Backwords. Needless to say, this can introduce a lot of errors. If you're obsessive enough to build a Difference Engine in order to generate accurate values, this situation simply will not do. Obviously you need to design a printer as well, which is exactly what Babbage did.

It isn't enough just to print onto paper (though it does do that), because then the values would still need to be transfered to type. So it also printed into a soft plaster sheet, creating a stereotype mold from which an entire page can be cast. No chance for human error.

Now, this is all stuff that anyone slightly obsessed with the history of the Difference Engine would know. What is particularly exciting about there being real working Engines in the world is that one can talk to the people who really use them and have real working knowledge of the things. Which is absolutely what I did.

This is the base of the printer. That crank wasn't on the original plans -- it turns out that the printer jams fairly easily, at which point you need to run it backwards separate from the main Engine. So they added a crank at that end, and a little clutch to disengage the printer.

Also, notice the little cable at the bottom? That gets pulled when the printer hits the end of the page, at which point a lot of stuff needs to be reset. The cable runs the length of the machine...

...finally coming out at the main crank, where it attaches to a clutch on the bevel gear. Thus, when the printer ends a page, the crank is disengaged and the person turning it knows to stop. (This was in the original design!) What wasn't in the original design was the 4:1 reduction gear on the crank itself. It just takes too much effort to turn otherwise, not something Babbage would have been able to tell in the design phase.

Speaking of the main crank, it turns out that turning it requires a lot of training, because the Engine requires very different amounts of force at different phases of a calculation cycle. And it jams fairly easily, so you need to know when to apply a lot of force, and when it shouldn't need much force so stop immediately.

Back at the printer, it has these escapement wheels and adjustment cranks. The left escapement defines how many columns are on a page, and the one of the right sets spacing between lines -- you can just see the short-short-short-short-long spacing in the wheels, which puts a larger space between every fifth line, which is what you'd want in a table of numbers to make lookup easier. The crank adjusts the overall spacing between lines.

Other cool stuff lacking in specific pictures:

Most of the bolts worked loose while it was on the cargo plane being delivered. It was built only with mid-19th century technology, so no lock-washers or Loctite was used. Because of this they have been fighting jams and problems ever since. They recently made a series of adjustments to the angular position of the take-off gears from the main drive shaft, which determines the relative timing of various operations in a computational cycle. They managed to do this because one of the museum employees happened to be visiting London and could stop by the other Difference Engine there and take some measurements.

The printer works, but they do not normally have it set up with ink or plaster. This is mostly because period ink is water based, and would have to be cleaned off immediately to prevent corrosion. The one thing that is not rigorously period is the lubricants used. Original ones would be horrible animal-based ones and just not worth it. Originally this Engine used petroleum lubricants, with an associated machine smell. Upon encountering it, the wife of the owner (who will eventually have it installed in his living room) said that it was not acceptable. Ever since, they have used FDA-approved food equipment lubricants, which are silicone based and have no smell at all.

The thing that impressed me most of all was finding out that the 31 computational digits can be split up into multiple calculations happening in parallel, with correspondingly fewer digits of precision. The Engine as it is set up at the museum is running in a 27/4 configuration. The larger set is calculating a 7th-order polynomial for demonstration purposes. The smaller set is set up with just a 1 in the first column. Which means that the output column is incremented by 1 every cycle. In modern terms: printf("%d", ++i); It's a debug statement! A convenient little printout that helps the operators keep track of what is going on! I was utterly charmed by it -- I bet Babbage never thought about doing that. This is the kind of thing that only gets discovered when you're actually using a system. It's a delightful little look into a parallel world where Babbage didn't get quite so perfectionistic and actually got the damn thing built.

Finally, here are some videos I took: