The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Tag: Improvements

Making the world a better place, one piece at a time

  • WWVB Receiver Shield Enclosure

    Kapton tape over traces
    Kapton tape over traces

    The little C-Max CMMR-6P-60 WWVB receiver board is somewhat sensitive to its surroundings: putting it too close to fast-switching digital signals is a Bad Idea. Of course, when there’s an antenna connected to the thing, it’s hard to separate the effects, but I’ve been testing reception with the antenna at the end of a two-foot twisted pair: far enough away to eliminate most problems.

    Just to see what happens, I built a little shield enclosure around the receiver board. The clock board has a pair of solid planes isolated from everything else, with a header matching the receiver’s pinout, for this very purpose. The receiver has a fairly solid ground plane on the bottom, but it’s quite sensitive being snuggled up against other objects; the header holds it about 5 mm above the circuit board.

    The dark amber square is Kapton tape across the traces. If I ever do this again, I’ll put the traces on the bottom so the board is entirely shielded and the tape isn’t needed.

    Shield soldered to base
    Shield soldered to base

    Some 1-inch copper tape with adhesive on one side serves as the shield enclosure, with a layer of Kapton tape covering all but about 2 mm of the adhesive near the bottom to insulate the copper from the receiver. Bent those 2 mm strips outward, with the adhesive on the bottom, stuck it to the shield plane, and soldered it in place at the corners.

    The antenna leads poke out through one side; it’s not very elegant, but I think it’s about as good as is needed for this sort of thing.

    I cut the tape at the corners and folded it down to make a little box, stuck a square of copper tape over the top flaps, soldered the corners, and it’s cute. Admittedly, it doesn’t have perfect conduction around the joints; the next time it’s on the bench I’ll add a few solder dots at the midpoints.

    Completed shield enclosure
    Completed shield enclosure

    The immediate effect was to raise the receiver’s Glitchiness score by a factor of about four. However, that’s not entirely a bad thing; it turns out that the reciever is much less Glitchy when it’s subject to high noise levels: the receiver AGC cranks the gain down so low that only heroic pulses get through and the number of glitches drops dramatically.

    As nearly as I can tell, when there’s no WWVB signal, as during the day, a low Glitchiness count means there’s extremely high noise. Thus, a higher count means less noise and better sensitivity.

    More data collection is in order, but the receiver’s LED showing data pulses now tracks the Alpha Geek Clock‘s display almost perfectly.

  • Arduino Pro: Ceramic Resonator Frequency Compensation

    The Arduino Pro gets its 16-MHz CPU clock from a ceramic resonator, rather than a quartz crystal, which means the frequency accuracy is ±0.5% rather than pretty much spot on. I’m building one into a WWVB-based clock, so it knows the exact elapsed time between synch events.

    My clock uses a 20-ms timebase: 16 MHz prescaled by 8, then divided by (nominally) 40000 using Timer1.

    Knowing the exact time between WWVB updates, the firmware compares that with the local time interval to find the offset, finds the fractional error, and then tweaks the Timer1 period to make the answer come out right the next time.

    Here’s what three days in the life of that algorithm look like:

    Drift: TS   5268489 UTC 10006.040959 Elapsed 13920 Offset 0 Corr +0 ICR1 39840
    Drift: TS   5268805 UTC 10006.092559 Elapsed 18960 Offset 1 Corr +2 ICR1 39842
    Drift: TS   5269711 UTC 10007.003159 Elapsed 54360 Offset 0 Corr +0 ICR1 39842
    Drift: TS   5269966 UTC 10007.044659 Elapsed 15300 Offset 0 Corr +0 ICR1 39842
    Drift: TS   5270079 UTC 10007.063959 Elapsed  4920 Offset -1 Corr -8 ICR1 39834
    Drift: TS   5271157 UTC 10008.003759 Elapsed 61440 Offset 12 Corr +7 ICR1 39841
    Drift: TS   5271833 UTC 10008.115359 Elapsed 39780 Offset 1 Corr +1 ICR1 39842
    

    The UTC field is YYDDD.HHMMSS. The TS value is a simple monotonic timestamp: UTC brutally converted to minutes assuming a year is 365.25 days.

    I set ICR1 to 39840 when the program starts, having already determined the actual oscillator frequency for this particular Arduino Pro. That’s not necessary, because the firmware will adjust it automatically, but it does eliminate the first big step that would compensate the resonator’s -0.4% initial frequency error.

    As nearly as I can tell, the corrections are tracking room temperature changes, as it’s been really cold around here lately and the clock is atop a bookcase in an outside corner of the room.

    After the first +2 change, it ran for 19 hours with less than one second of error: 14 ppm. The -8 change was probably an overcorrection, as the synch interval was just over an hour, but so it goes. That caused 195 ppm error over the next 17 hours, then it’s back on track.

    There’s an obvious conflict between getting quick updates as conditions change and minimizing long-term free-run drift. The firmware currently insists on a minimum of 60 minutes between synchs, but (given an initial preset) I think I can dramatically increase that without losing anything.

    This code does the Timer1 setup:

    #define TIMER1COUNTS            39841l
    
    TCCR1B    = B00011000;            // Timer1: CTC mode = 12 high bits, TOP=ICR1, stopped with no clock source
    TCNT1 = 0;            // force count to start from scratch, CTC mode low bits
    TCCR1A = 0;            // no compare outputs to OC1A OC1B, WGM1 1:0 = 00
    TCCR1C = 0;            // no forced compares
    TIMSK1 = 1 << ICIE1;            // allow interrupt on capture event (TCNT == ICF)
    SetICR1(TIMER1COUNTS - 1);            // total counts - 1, start running
    

    The SetICR1 function makes sure the new ICR1 isn’t below the current TCNT1 value, which would cause a horrible timekeeping blip. As it is, there’s a microsecond (more or less) glitch during the update.

    
    void SetICR1(word NewICR1) {
    TCCR1B &= ~B00000111;     // turn off Timer1 by removing the clock source
    ICR1 = NewICR1;
     if (TCNT1 > NewICR1) {     // force counter below new TOP value
     TCNT1 = NewICR1 - 1;
     }
    TCCR1B |= B00000010;     // turn on clock with prescaler
    }
    

    When the firmware does a WWVB synch, it then checks to see if enough time has passed since the last synch and, if so, tweaks ICR1. The variables hold what you’d expect and are all long ints to hold the expected values…

    if ((UTCRightNow.SyncAge != SYNC_UNSYNC) && (UTCRightNow.SyncAge > SYNC_MINDRIFT)) {
     WWVB_Elapsed = 60l * (WWVBToMinutes(&WWVB_Time_Predicted) - WWVBToMinutes(&WWVB_Time_Sync));
     TimeOffset = (60l * (long int)(UTCRightNow.SyncAge - 1)) + (long int)UTCRightNow.Second - WWVB_Elapsed;
     DriftTicks = (int)((FetchICR1() * TimeOffset) / WWVB_Elapsed);
     if (DriftTicks) {
      SetICR1(FetchICR1() + DriftTicks);
     }
    }
    

    The FetchICR1 function reads ICR1 without disabling interrupts, doing it twice to be sure nothing’s whacked the magic hardware that allows atomic two-byte register reads.

    One failure mode: if something goes badly wrong, ICR1 can become so far off the correct value that the clock will never synch again. I must add a bit of defensive code to SetICR1 that ensures the new value is never more than, say, 1% off the nominal value.

    All in all, this works a whole lot better than I expected…

    The catch is that most Arduino applications don’t know the exact time interval and, without that, there’s no way to tweak the oscillator on an ongoing basis. However, for any particular Arduino Pro, I think you could very accurately compensate the initial frequency error by measuring the actual oscillator frequency and then hardcoding the adjustment value.

  • Sears Craftsman Radial Saw Elevation Knob Handle

    Broken Knob
    Broken Knob

    Mary’s folks visited us for Christmas and her father brought along a shelf that needed cutting; their apartment doesn’t have room for his shop equipment, alas. I cleared the crap off the radial saw, grabbed the elevation knob to crank the blade up to get it set for ripping, and … the handle broke off.

    That’s not the first time this has happened, so I wasn’t entirely surprised. The knob is large enough that I could complete the mission just by grabbing the rim, but it was a near thing.

    The handle is made of some wonderful engineering plastic that doesn’t solvent-bond well with anything in my armory, although Plastruct had enough bite to make me think it would work. That repair actually lasted several years of admittedly low-duty-cycle use, but obviously this couldn’t continue.

    Stress raiser
    Stress raiser

    The problem seems to be built into the handle design. This pic shows that the fracture spans a high-stress part of the handle: between the inside right-angle corner (upper left) that rests on the outside of the knob, across the handle’s web, to the corner of the recess in the flange at the bottom of the picture.

    The red hoodickie is the latch that secures the handle in its deployed position, wherein it sticks out at exactly crotch height for average human males. That accounts for the fluorescent red tape around the handle.

    Broken surface
    Broken surface

    You can see how the latch recess triggered the crack: that notch where the latch wraps around must be the highest-stress part of the handle. I suspect the original design didn’t have the latch (or had something different) and the fat web near the round feature on the left extended all the way to the angled flange on the right.

    That would work!

    I epoxied a pair of rectangular brass tubes across the fracture inside the web, where they fit neatly below the latch. I roughed up the web with an awl to give the epoxy more surface to grab.

    Incidentally, this is one of those cases where you might think a cyanoacrylate adhesive would work. It won’t: too much shock, too much pressure. I used it to hold the parts together while the epoxy cured, but that’s about as far as I’d trust it.

    I’d like to add something to the notch, but I’m not convinced a right-angle brass flange and some epoxy will have enough grip to make any difference. It would certainly require changing the latch, perhaps by thinning the left side, which would make that weaker. On the other paw, I can probably eke out a miserable existence without the latch.

    Brass internal reinforcement
    Brass internal reinforcement

    The picture shows the clamping in operation. A snippet of polypropylene (from some random consumer packaging) under the tip of the clamp prevents it from becoming one with the project; the clamp tip is slippery plastic, but you never know.

    Perhaps this fix will last for a few more years…

    Y’know, I’m beginning to believe that finite-element analysis will be the death of us all. Obviously this handle was modeled to a fare-thee-well, with only enough material to meet the expected stresses in the expected directions. Unfortunately, the real world doesn’t cooperate: the forces are always larger, the conditions always worse, and the materials always weaker than the design anticipated. A “safety factor” of three or four or maybe even ten just isn’t enough!

  • HP54602 Oscilloscope Trace Conversion Tweakage

    The script (writeups there and there) I use to convert the HPGL screen dumps from my HP54602 into PNG images produced a transparent background. I put the files into an OpenOffice mockup of my Circuit Cellar columns and the background turns white, so I figured it worked OK.

    Turns out that the workflow at Circuit Cellar Galactic HQ turns the background black. A bit of digging showed that the ImageMagick convert program produced an alpha channel that selected only the traces and left everything else unselected. Why that produces white here and black there is a mystery, but there’s no point in putting up with such nonsense.

    Another wrestling match produced this revision (the two changed lines are highlighted), which has no alpha channel and a white background. That ought to simplify things: an image shouldn’t depend on where it’s dropped to look right.

    #!/usr/bin/kermit +
    # Fetches screen shot from HP54602B oscilloscope
    # Presumes it's set up for plotter output...
    # Converts HPGL to PNG image
    
    set modem none
    set line /dev/ttyUSB0
    set speed 19200
    set flow rts/cts
    set carrier-watch off
    
    # Make sure we have a param
    if not defined \%1 ask \%1 {File name? }
    
    set input echo off
    set input buffer-length 200000
    
    # Wait for PRINT button to send the plot
    echo Set HP54602B for HP Plotter, FACTORS ON, 19200, DTR
    echo Press PRINT SCREEN button on HP54602B...
    
    log session "\%1.hgl"
    
    # Factors On
    input 480 \x03
    
    close session
    close
    
    echo Converting HPGL in
    echo --\%1.hgl
    echo to PNG in
    echo --\%1.png
    
    # Factors Off
    #run hp2xx -q -m png -a 1.762 -h 91 -c 14 "\%1.hgl"
    #run mogrify -density 300 -resize 200% "\%1.png"
    
    # Factors On
    run sed '/lb/!d' "\%1.hgl" > "\%1-1.hgl"
    run hp2xx -q -m eps -r 270 -a 0.447 -c 14 -f "\%1.eps" "\%1-1.hgl"
    run rm "\%1-1.hgl"
    run convert "\%1.eps" -alpha off -resize 675x452 "\%1.png"
    
    echo Finished!
    
    exit 0
    
  • Whirlpool Refrigerator Shelf: Drawer Slide Repair

    Refrigerator shelf bracket - inside
    Refrigerator shelf bracket – inside

    The bottom glass shelf in our Whirlpool refrigerator (the “Crisper Cover”) rests on an elaborate plastic structure that includes slides for the two Crisper drawers. Perhaps we store far more veggies than they anticipated, we’re rough on our toys, or the drawer slides came out a whole lot weaker than the designers expected. I’m betting on the latter, but whatever the cause, the two outside slides broke some years ago.

    I don’t know what function the rectangular hole above the flattened part of the slide might serve, but it acted as a stress raiser that fractured the column toward the front. With that end broken loose, another crack propagated toward the rear, so the entire front end of the slide drooped when the drawer slid forward.

    The minimum FRU (Field Replacement Unit) is the entire plastic shelf assembly, a giant plastic thing that fills the entire bottom of the refrigerator. You could, of course, buy a whole new shelf assembly, perhaps from www.appliancepartspros.com, but it’s no longer available. Back when it was, I recall it being something on the far side of $100, which made what you see here look downright attractive.

    My first attempt at a repair was an aluminum bracket epoxied to the outside of the slide, filling the rectangular opening with JB Industro-Weld epoxy to encourage things to stay put. The plastic cannot be solvent-bonded with anything in my armory, so I depended on epoxy’s griptivity to lock the aluminum into the shelf. That worked for maybe five years for the right side (shown above) and is still working fine on the left side.

    Refrigerator shelf bracket - bottom
    Refrigerator shelf bracket – bottom

    The right-side bracket eventually broke loose, so I did what I should have done in the first place: screw the bracket to the shelf. Alas, my original bracket remained firmly bonded to the bottom part of the shelf and secured to the block of epoxy in the rectangular hole. Remember, the broken piece didn’t completely separate from the shelf.

    So I cut another angle bracket to fit around the first, drilled holes in the shelf, transfer-punched the bracket, and match-drilled the holes. Some short(ened) stainless-steel screws and nuts held the new bracket in place and a few dabs of epoxy putty filled the gaps to make everything rigid.

    That’s been working for the last few years. The refrigerator is going on 16 years with only one major repair (a jammed-open defrost switch), so I’ll call it good enough.

  • Arduino Pro: Securing the Serial Connecor

    Epoxy backfill on Arduino Pro serial connector
    Epoxy backfill on Arduino Pro serial connector

    The surface-mount serial connector on an Arduino Pro board isn’t the most robust of devices; the FTDI USB interface and USB cable can apply far too much torque to those little pins. Even before the situation described yesterday, the pins were getting wobbly.

    The connector shell is a big part of the problem, as it doesn’t mechanically lock the pins in place. Installing and removing the FTDI USB board pushes and pulls the pins against their pads, which means the adhesive bonding the pads must handle all that stress.

    Eventually, the Reset and TX pin pads tore loose from the circuit board. At that point, they have no mechanical stability at all; you can bridge a solder blob from the pin to its trace, but the adhesive holding the copper pad in place has lost all strength.

    The fix is straightforward, if ugly.

    • Repair the pin-to-pad/trace connections with something better than a solder blob. I used small snippets of component leads.
    • Apply denatured alcohol and scrub away all the solder flux around the pads.
    • Apply enough epoxy to the back of the connector to bond it, the pins, and the circuit board into one mechanically stable unit. I worked the epoxy between the pins and slightly under the connector shell with a small screwdriver and toothpick.

    Even with this repair in place, the connector is not particularly robust. It’s much better than it was, so we’ll count it as a win.

    This Arduino Pro has survived several projects, hence the hideous solder blobs here & there. I suppose I should just throw the poor thing away, but … that’s not my nature.

  • Arduino Pro: Power Adaptation for FTDI Basic USB

    Arduino FTDI Basic on modified Arduino Pro
    Arduino FTDI Basic on modified Arduino Pro

    Some time ago, I bought a 5 V Arduino Pro board (about which you read earlier there) and a nominally compatible FTDI Basic USB-to-serial adapter. Turns out that they’re not quite a perfect match, although they do play nicely together in normal use.

    The FTDI Basic board produces a 3.3 V regulated output voltage that’s connected directly to the output of the Pro’s 5 V regulator. This doesn’t cause any particular problem, but one side effect is that you can’t shut the board’s power off: the USB power will keep the CPU alive, more or less.

    You should, of course, use a 3.3 V FTDI Basic board with a 3.3 V Pro, which would at least put two similar voltage sources head-to-head.

    The Pro is using a backup power supply that, for reasons that make perfectly good sense, backfeeds the Pro’s 5 V regulator: when the +12 V main supply Goes Away, the backup power supports VCC directly, rather than through the regulator. The regulator can take a joke like that, as witness the FTDI vs Pro situation; in my case, a diode isolates the two supplies in normal operation.

    For reasons that I don’t completely understand, some combination of voltage to the Pro regulator and the (diode isolated!) backup support voltage caused the FTDI chip to lock up with both TX and RX LEDs on solid.

    I suspect the FTDI chip’s internal 3.3 V regulator, in combination with the USB +5 V supply, in combination with the Pro board power, drove something outside its normal operation range. So I simply removed the 3.3 V pin from the connector, disconnecting that supply from the Pro’s overvoltage, and the thing now works fine.

    Side effects:

    • The FTDI board remains powered when the Pro board gets turned off, thus preventing Linux from changing the serial port device when the power comes back up again
    • I can actually turn the Pro power off, without having the FTDI supply keep it alive. Handy for soldering!

    The Pro pin labeled GND connects to the FTDI CTS line, an input that floats high when not connected. I yanked that pin and shorted CTS to GND on the FTDI board: one less pin to worry about, for reasons that you’ll see tomorrow.

    There are many different versions of the boards and USB adapters, so current production probably doesn’t match what I have. Pay attention to what you have, though…