Archive for July, 2010

Monthly Aphorism: On Debugging

  • Whenever you find a problem, fix it

Mad Phil taught me an absolutely fundamental rule for debugging electronic gadgets: when you find something unexpected, it’s either:

  • part of the problem you’re trying to solve
  • another problem you haven’t discovered yet

In either case, ignoring evidence that something was just a little off or that you didn’t quite understand or that didn’t seem important was a sure recipe for missing the cause of the problem.

That algorithm could trigger a depth-first search that distracts you from the real problem, which was where Mad Phil’s magic came in: he knew where the problem was and simply carved his way through the underbrush toward it.


Leave a comment

Pin Spanner for 3.5 mm Audio Jack Nut

The external antenna jack on the Totally Featureless Clock is, by necessity, recessed way down in a hole (because I can’t get to the inside of the now-finished half-inch-thick case to gnaw it out from there). Perforce, that puts the locking nut out of reach.

Solution: a pin spanner wrench. I’m sure they’re available commercially, but what’s the fun in that?

The male threaded part of the jack is 0.230 inch OD, the nut is 0.313 OD, and the notches are 0.030 wide and 0.020 deep. Raw material is about two inches of 5/16-inch air-hardening drill rod, not that I’m actually going to heat treat it for this application.

Face off the end and drill the guts out with a 15/64-inch drill.

Drilling central recess

Drilling central recess

Grab it in the 3-jaw chuck bolted firmly to the table, then mill off anything that isn’t a pin. Don’t grab it in the milling vise, which doesn’t have enough oomph to hold a slick steel cylinder in place; don’t ask how I know this.

Milling pins in 3-jaw chuck

Milling pins in 3-jaw chuck

Set Z=0 at the top surface of the spanner-to-be and XY = 0 on the axis of the cylinder, of course.

Manual CNC, feeding the commands into EMC2’s MDI slot and then mouse-clicking the stored commands to avoid reduce typing errors. For my setup, Y=±0.171 to produce the 30-mil pin and  X=±0.4 to clear on both sides.

After cutting the first side at 3 k RPM, feed 2 inches/min, and 10 mils per pass, I whacked the other side off in one giant 20-mil bite. I’m such a sissy…

A bit of heatshrink tubing improves the griptivity and it’s all good.

Finished spanner engaged in nut

Finished spanner engaged in nut

This is the sort of thing you do once, drop in the baggie with the rest of the connector nuts, and use for years thereafter. I should’a done it years ago, but I’ve been able to not quite butcher the nuts with a needle-nose pliers…

[Update: It turns out a commercial nut driver was available, at least in one special shop in one special place, but no longer. For my delicate uses, that shaft into the jack isn’t really needed.]



Sherline CNC Mill: Limited Headroom Thereof

Cramped Headroom

Cramped Headroom

I had to drill a 1/4-inch hole in the Totally Featureless Clock’s case for the antenna jack. Fortunately, I have a 1/4-inch collet, because there was nowhere near enough room for the Jacobs chuck in there.

Removing the tooling plate wouldn’t help: the chuck setup needed another inch!

In truth, the headroom is rarely the limiting factor. Another inch or two of throat distance and maybe that much more Y travel would be nicer, while we’re at it.

Ah, well, it’s all a matter of tradeoffs. If the mill were much bigger, I’d just want to make bigger projects, right?



IRQ Troubles on Razor

The Dell Dimension 4560, a.k.a. razor, that controls my Sherline CNC mill woke up without network support. That’s a showstopper, because all the G-Code files live on the server across the basement.

All my boxes have a network function dipstick test: the desktop background is an image on that same file server. When the NFS share wakes up dead, then the screen shows the default Ubuntu background: brown = down! (At least in Ubuntu 8.04 LTS, which is what EMC2 is built on right now.)


  • NFS share isn’t mounted
  • … and can’t be mounted
  • ifconfig shows eth0 up & active
  • can’t ping the server
  • can’t ping razor from the server
  • Link lights on network switch nailed to floor joist overhead are green
  • Link light on NIC on back panel
  • Activity lights on switch & NIC blink occasionally (??)
  • Swapping ports on the switch = no change
  • Laptop works fine plugged into switch = switch OK

So whatever is busted, is busted in the 4560. Drat!

(Should have checked cable between switch and NIC. Sometimes you get a data failure without affecting the link & activity lights. Weird, but stuff happens.)

Looking in dmesg shows that a bogus IRQ 11 occurred during startup:

[   44.439932] irq 11: nobody cared (try booting with the  irqpoll" option)
... time passes ...
... bad IRQ log dump gibberish ...
[   44.440440] Disabling IRQ #11

Fairly obviously, after that point nothing about the NIC or anything else on IRQ 11 will work: the hardware setup may be OK, you can write to it and read from it, but no actual data gets through.

A reboot didn’t cure the problem. Reboots in Linux rarely solve a problem; you’ve got to actually find the root cause and fix it, rather than shake the dice to see if a better combination comes up.


Restarted to get into Dell’s attenuated BIOS configuration routine, changed the NIC to IRQ 3 (just because it was first on the list), saved, restarted, and everything works. The bogus interrupt is gone, the NIC is running, NFS shares are OK.

It absolutely beats me. But at least this is written down so the next time it happens, I’ll remember what I did.

Oh, yeah. The Sherline CNC mill uses stepping motors and uses cutters, so it’s a Steppin’ Razor, of course, and is therefore named razor. I suppose I could have called it molly, but that’d be a stretch.


Leave a comment

Cutting Thin Rings: Homebrew Punches

The Totally Featureless Clock is back for a refit: its preferred location turned out to have essentially no RF at all, so I must move the antenna out of the clock case on the end of a cable.


I put the ferrite bar inside a length of PVC pipe, turned down to make it less ugly, with white plastic end plugs. Rather than fiddle around with complex mountings, I cushioned the fragile bar in closed-cell foam, which meant I needed some way to cut a bunch of foam rings.

Some rummaging produced a thinwall brass tube with about the same ID as the PVC pipe. A brief trip to the lathe put a reasonably sharp edge on one end.

Sharpening the brass tube

Sharpening the brass tube

That edge is more keen than it looks; while it’s not razor-sharp, it’s plenty good enough. I didn’t use it as a punch, just grabbed it in a rag to cushion my palm and rotated it through the foam against a plywood scrap.

That produced a bunch of foam cookies.

Foam cutouts

Foam cutouts

The bar diameter was close enough to a standard hole punch that I didn’t have to make one. Centering by eye and rotating by hand turned the cookies into donuts.

Punched holes

Punched holes

And then they fit just fine…

Cushioned ferrite bar antenna

Cushioned ferrite bar antenna

I made more donuts to swaddle the bar from end to end inside the PVC tube. I slipped the antenna in from the left, then pushed the donuts over the bar with Yet Another Brass Tube. The end result is an antenna compression-packed in foam, which ought to keep it in good condition through at least a minor oops.

Finished antenna housing

Finished antenna housing

The screws pass through the end plugs to hold them against the pressure from the foam cookies at the bar ends. The holes are slightly counterbored on the top to blend the screw heads into the curve of the tube. There’s a 3/8-inch flat along the bottom that will eventually settle against the underside of a shelf.



I had our daughter solder up some circuit boards for me (as part of a clever scheme to get her trained up on circuitry) and we were discussing the projects. I used the term capsaspitator and she gave me a blank look … as well she might, because even Google doesn’t know what they are.

A long time ago, back on the IBM Video Disc project, Mad Phil and HH were chasing the gremlins out of a particularly tricky bit of RF-oid analog / digital circuitry. This task required a prodigious quantity of bypass caps and, at some point, Mad Phil announced that he’d had it up to there with those [obscene gerund] capsaspitators!

The term immediately caught on and I use it to this day in reference to any particularly obscure capacitor, particularly  bypass caps that seem useless and are actually vital.

It’s pronounced caps-ASS-pi-tator, of course, and now everybody can find it on The Web…


OpenOffice 3.2 Graphic File Link Hackage

OpenOffice normally stores graphic file links relative to the location of the ODT document file. It’s an option at Tools -> Options -> Load/Save -> General, where you check Save URLs relative to file system.

That generally works well, as long as you keep all the graphics either in the same directory or in a subdirectory, which is our general practice. Note that this doesn’t apply if you embed the image files into the document, which works fine for one-pagers and dies horribly for lengthy graphics-intense documents.

(Yes, I know OOo is not a page layout program. Sometimes other considerations get in the way. Work with me on this, OK?)

It’s easy to confuse the program: copy the ODT file somewhere else and, shazam, the links either break or get weird. In a recent case, the links somehow wound up holding the entire path from the root directory through /home, down through an NFS mount, and out to the actual file. Not only was it un-pretty, the links basically didn’t work from any other account on any other machine because you really can’t reach through another user’s account to your files.

This is tedious, at best, to fix up within OpenOffice, because you can’t do a find-and-replace on the file names.


In OOo, click through Tools -> Options -> Load/Save -> General. Uncheck the Size optimization for ODF format option to force the XML file to become human-readable. Otherwise, OO stores everything as one huge line. While you’re there, make sure Save URLs relative to file system is checked.

Save the file again to get readable XML.

Create /tmp/work, copy the ODT file therein, apply unzip to it. That extracts the contents, including the all-important  content.xml containing your document’s text & links.

Edit content.xml with the text editor (not a word processor like OOo!) of your choice. Bulk-change the garbage paths to something meaningful. For example, we had all the images in Tweaked, a subdirectory below the document directory, so the desired file links looked like ../Tweaked/image-file-name.jpg.

Save the file and stuff it back into the ODT file using zip -vi document.odt content.xml

That produced some odd error messages that didn’t seem to have any effect:

	zip warning: undefined bits used in flags = 0x0808: layout-cache
	zip warning: undefined bits used in flags = 0x0808: content.xml
	zip warning: undefined bits used in flags = 0x0808: styles.xml
	zip warning: undefined bits used in flags = 0x0808: Thumbnails/thumbnail.png
	zip warning: undefined bits used in flags = 0x0808: settings.xml
	zip warning: undefined bits used in flags = 0x0808: META-INF/manifest.xml
updating: content.xml
	zip warning: Local Entry CRC does not match CD: content.xml
	(in=54496) (out=7765) (deflated 86%)
total bytes=91294, compressed=17644 -> 81% savings

OOo stores the file timestamps within the ODT file in UTC, confusing the daylights out of zip, which assumes they’re in local time. Being at UTC-4 right now, I couldn’t simply freshen or update a recently created ODT file.

Copy the modified ODT file back where it came from, make sure the graphic files are where you promised they’d be, and open the document.

Everything should be just fine.

1 Comment