Archive for category Software

ATM Error Message

Saw this after fat-fingering my PIN at a drive-up ATM:

ATM Screen Display Error Message

ATM Screen Display Error Message

That’s off-putting, isn’t it?

7 Comments

Reticle Guide for Ruler Quilting

I made the pencil guides to help Mary design ruler quilting patterns, but sometimes she must line up the ruler with a feature on an existing pattern. To that end, we now have a reticle guide:

Ruler Adapters - pencil guide and reticle

Ruler Adapters – pencil guide and reticle

The general idea is that it’s easier to see the pattern on paper through the crosshair than through a small hole. You put the button over a feature, align the reticle, put the ruler against the button, replace it with pencil guide, and away you go.

The solid model looks much more lively than you’d expect:

Ruler Adapter - reticle - Slic3r preview

Ruler Adapter – reticle – Slic3r preview

Printing up a pair of each button produces the same surface finish as before; life is good!

The OpenSCAD source code as a GitHub Gist:

, ,

8 Comments

Pencil Guides for Ruler Quilting

Mary has been doing Ruler Quilting and wanted a pencil guide (similar to the machine’s ruler foot) to let her sketch layouts before committing stitches to fabric. The general idea is to offset the pencil by 1/4 inch from the edge of the ruler:

Ruler Adapter - solid model

Ruler Adapter – solid model

That was easy.

Print three to provide a bit of cooling time and let her pass ’em around at her next quilting bee:

Ruler Adapter - Slic3r preview

Ruler Adapter – Slic3r preview

Her favorite doodling pencil shoves a 0.9 mm lead through a 2 mm ferrule, so ream the center hole with a #44 drill (86 mil = 2.1 mm) to suit:

Ruler quilting pencil guides

Ruler quilting pencil guides

The outer perimeters have 64 facets, an unusually high number for my models, so they’re nice & smooth on the ruler. Even though I didn’t build them sequentially, they had zero perimeter zits and the OD came out 0.500 inch on the dot.

The chamfers guide the pencil point into the hole and provide a bit of relief for the pencil’s snout.

If I had a laser cutter, I could make special rulers for her, too …

The OpenSCAD source code as a GitHub Gist:

,

1 Comment

Vacuum Tube LEDs: Now With Morse Code

Adding Mark Fickett’s non-blocking Morse Arduino library turns the tubes into transmitters:

21HB5A on platter - orange green

21HB5A on platter – orange green

The plate cap LED blinks the message in orange, while both LEDs continue to slowly change color as before.

You define a Morse sender object (C++, yo!) by specifying its output pin and code speed in words per minute, dump a string into it, then call a continuation function fast enough to let it twiddle the output bit for each pulse. Obviously, the rate at which the callback happens determines the timing granularity.

However, setting a knockoff Neopixel to a given color requires more than just a binary signal on an output pin. The continuation function returns false when it’s done with the message, after which you can initialize and send another message. There’s no obvious (to me, anyhow) way to get timing information out of the code.

The easiest solution: called the Morse continuation function at the top of the main loop, read its output pin to determine when a dit or dah is active, then set the plate cap color accordingly:

LEDMorseSender Morse(PIN_MORSE, (float)MORSE_WPM);
...
Morse.setup();
Morse.setMessage(String("       cq cq cq de ke4znu       "));
PrevMorse = ThisMorse = digitalRead(PIN_MORSE);
...
if (!Morse.continueSending()) {
  Morse.startSending();
}
ThisMorse = digitalRead(PIN_MORSE);
...
if (ThisMorse) {             // if Morse output high, overlay
    strip.setPixelColor(PIXEL_MORSE,MorseColor);
}
PrevMorse = ThisMorse;
strip.show();               // send out precomputed colors
...
<<compute colors for next iteration as usual>>

I use the Entropy library to seed the PRNG, then pick three prime numbers for the sine wave periods (with an ugly hack to avoid matching periods):

uint32_t rn = Entropy.random();
...
randomSeed(rn);
...

Pixels[RED].Prime = PrimeList[random(sizeof(PrimeList))];

do {
  Pixels[GREEN].Prime = PrimeList[random(sizeof(PrimeList))];
} while (Pixels[RED].Prime == Pixels[GREEN].Prime);

do {
  Pixels[BLUE].Prime = PrimeList[random(sizeof(PrimeList))];
} while (Pixels[BLUE].Prime == Pixels[RED].Prime ||
        Pixels[BLUE].Prime == Pixels[GREEN].Prime);

printf("Primes: (%d,%d,%d)\r\n",Pixels[RED].Prime,Pixels[GREEN].Prime,Pixels[BLUE].Prime);

In the spirit of “Video or it didn’t happen”: YouTube!

The Arduino source code as a GitHub Gist:

,

2 Comments

Vacuum Tube LEDs: Improved Sockets

All the sockets now sport channels in the bottom to capture the braid to the plate cap (whether or not the tube has a plate cap) and the wiring from the Arduino:

Vacuum Tube Lights - Octal Socket - solid model

Vacuum Tube Lights – Octal Socket – solid model

The Slic3r preview shows the detail a bit better:

Vaccum Tube Lights - Octal Socket - Slic3r preview

Vaccum Tube Lights – Octal Socket – Slic3r preview

The boss around the pins is now 25 mm OD and snaps neatly into the unpunched hub hole of a hard drive platter:

0D3 Octal - 25 mm socket OD in platter

0D3 Octal – 25 mm socket OD in platter

I moved the mounting holes to 42 mm OC to give the button heads on those screws a bit more clearance from the base.

Moving the knockoff Neopixel up to the top of the pipe leading to the tube base dramatically increases the amount of light going into the tube envelope:

0D3 Octal - 25 mm socket - raised LED

0D3 Octal – 25 mm socket – raised LED

You can just barely see a strip of foam tape holding the LED PCB (loosely) into the too-large hole.

The OpenSCAD source code also produces the improved base clamp; to get a socket, just set Layout = "Socket" and away you go. It doesn’t yet have the reduced-diameter hole down the middle; that’s in the nature of fine tuning.

,

4 Comments

Improved Octal Tube Base Clamp

In order to clamp the tube in a V-block, the clamp must position the tube’s centerline so the envelope will clear the V groove, thusly:

OD3 Octal - V-block clamp

OD3 Octal – V-block clamp

The clamp now extends into the V-block and surrounds the entire Bakelite tube base:

Octal base compression clamp - Slic3r preview

Octal base compression clamp – Slic3r preview

The little divot captures the clamp screw and the slot lets the whole affair compress just enough to firmly squeeze the entire tube base.

The tube data table now includes columns for the envelope OD and the base OD, although only the 0D3 (and similar) Octal tubes in my collection have a bulging envelope and a smaller base. You can build clamps for cylindrical glass tubes if you like; I don’t vouch for the accuracy of the table contents.

For whatever it’s worth, the 6SN7GTB tube I started with has a 32 mm Bakelite base and the 0D3 tube has a 29 mm base. That should probably justify two separate entries in the table, but I’m making this up as I go along.

The OpenSCAD source code as a GitHub Gist:

, ,

7 Comments

Bulk-renaming Video Snapshots

For reasons that should be obvious by now, I review the helmet camera video from (some of) our bike rides and extract snapshots of interesting events. VLC auto-names the snapshots along these lines:

-rw-rw-r-- 1 ed ed  4.0M 2016-09-16 16:15 vlcsnap-2016-09-16-16h15m43s49.png
-rw-rw-r-- 1 ed ed  3.2M 2016-09-16 16:15 vlcsnap-2016-09-16-16h15m59s181.png
-rw-rw-r-- 1 ed ed  2.7M 2016-09-16 16:18 vlcsnap-2016-09-16-16h18m58s125.png
-rw-rw-r-- 1 ed ed  3.7M 2016-09-16 18:40 vlcsnap-2016-09-16-18h40m22s7.png
-rw-rw-r-- 1 ed ed  3.5M 2016-09-16 18:40 vlcsnap-2016-09-16-18h40m58s132.png
-rw-rw-r-- 1 ed ed  3.5M 2016-09-16 18:41 vlcsnap-2016-09-16-18h41m29s181.png
-rw-rw-r-- 1 ed ed  3.9M 2016-09-16 18:41 vlcsnap-2016-09-16-18h41m42s60.png
-rw-rw-r-- 1 ed ed  3.8M 2016-09-16 18:41 vlcsnap-2016-09-16-18h41m54s146.png
-rw-rw-r-- 1 ed ed  3.8M 2016-09-16 18:42 vlcsnap-2016-09-16-18h42m22s206.png
-rw-rw-r-- 1 ed ed  3.7M 2016-09-16 18:42 vlcsnap-2016-09-16-18h42m38s58.png

The gap in the timestamp after the first three files reveals a random errand.

First, convert to JPG format, place the results in another directory and, en passant, mash them to a reasonable size:

mkdir /some-useful-directory/Road\ Repair/"Rt 82 and CR 29"
for f in  vlcsnap-2016-09-16* ; do convert $f -density 300 -define jpeg:extent=200KB /some-useful-directory/Road\ Repair/"Rt 82 and CR 29"/${f%%.*}.jpg ; done
cd /some-useful-directory/Road\ Repair/"Rt 82 and CR 29"

Replace the first part of the VLC-generated names with relevant identification:

rename 's/vlcsnap-/Rt 82 - /' vlcsnap-2016-09-16-16*
rename 's/vlcsnap-/CR 29 - /' vlcsnap*

The directory now contains these files:

-rw-rw-r-- 1 ed ed 193K 2016-09-19 11:36 CR 29 - 2016-09-16-18h40m22s7.jpg
-rw-rw-r-- 1 ed ed 192K 2016-09-19 11:36 CR 29 - 2016-09-16-18h40m58s132.jpg
-rw-rw-r-- 1 ed ed 193K 2016-09-19 11:36 CR 29 - 2016-09-16-18h41m29s181.jpg
-rw-rw-r-- 1 ed ed 193K 2016-09-19 11:36 CR 29 - 2016-09-16-18h41m42s60.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 11:36 CR 29 - 2016-09-16-18h41m54s146.jpg
-rw-rw-r-- 1 ed ed 196K 2016-09-19 11:36 CR 29 - 2016-09-16-18h42m22s206.jpg
-rw-rw-r-- 1 ed ed 196K 2016-09-19 11:36 CR 29 - 2016-09-16-18h42m38s58.jpg
-rw-rw-r-- 1 ed ed 195K 2016-09-19 11:36 Rt 82 - 2016-09-16-16h15m43s49.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 11:36 Rt 82 - 2016-09-16-16h15m59s181.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 11:36 Rt 82 - 2016-09-16-16h18m58s125.jpg

These bursts of Perl regex line noise replace the snapshot timestamp on those files with an ascending sequence number, with separate sequences for each group:

i=1 ; for f in CR* ; do rename -v "s/-1[68]h..m..s\d{1,3}/ - $(( i++ ))/" "$f" ; done
i=1 ; for f in Rt* ; do rename -v "s/-1[68]h..m..s\d{1,3}/ - $(( i++ ))/" "$f" ; done

And then the files make sense:

-rw-rw-r-- 1 ed ed 193K 2016-09-19 13:51 CR 29 - 2016-09-16 - 1.jpg
-rw-rw-r-- 1 ed ed 192K 2016-09-19 13:51 CR 29 - 2016-09-16 - 2.jpg
-rw-rw-r-- 1 ed ed 193K 2016-09-19 13:51 CR 29 - 2016-09-16 - 3.jpg
-rw-rw-r-- 1 ed ed 193K 2016-09-19 13:51 CR 29 - 2016-09-16 - 4.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 13:51 CR 29 - 2016-09-16 - 5.jpg
-rw-rw-r-- 1 ed ed 196K 2016-09-19 13:51 CR 29 - 2016-09-16 - 6.jpg
-rw-rw-r-- 1 ed ed 196K 2016-09-19 13:51 CR 29 - 2016-09-16 - 7.jpg
-rw-rw-r-- 1 ed ed 195K 2016-09-19 13:51 Rt 82 - 2016-09-16 - 1.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 13:51 Rt 82 - 2016-09-16 - 2.jpg
-rw-rw-r-- 1 ed ed 194K 2016-09-19 13:51 Rt 82 - 2016-09-16 - 3.jpg

The hard part, this time around, involved figuring a regex for the timestamp. The trick was to specify a single digit for the milliseconds part, with a repetition count allowing for one-to-three digits.

The Perl regex cheat sheet helped.

The double quotes around the rename search parameter allows the shell to expand the $(( i++ )) gibberish. The double quotes around the file name keep the blank-separated parts together.

At some point I must figure out how to produce leading-zero-filled sequence numbers, which will probably involve a printf.

The ride covered some roads with “2 to 4 foot” shoulders, which seems overly optimistic:

Rt 82 - 2016-09-16 - 3

Rt 82 – 2016-09-16 – 3

NYSDOT and DCDPW both believe a homeopathic strip of asphalt will cover faults in the travel lane and don’t care that the right side of the strip puts an abrupt ledge along the middle of the minimal and fissured shoulder:

Rt 82 - 2016-09-16 - 1

Rt 82 – 2016-09-16 – 1

Ah, well, it was a lovely day for a ride …

8 Comments