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.

Category: Electronics Workbench

Electrical & Electronic gadgets

  • Failed Switch

    Switch Innards
    Switch Innards

    When I flipped this switch on, it started fizzing and emitting ozone-scented smoke while the lights it controlled flickered. This is not a nominal outcome. I toggled the switch a few times, but it continued to misbehave, so I installed a replacement switch and laid the old one out on the desk for an autopsy.

    It’s an old-school mechanism, as suits the 1930-vintage structure it came from. The lyre-shaped arch with the spring swings back and forth on its tabs, which rest in the small recesses near the middle of the switch body. The peg on the toggle handle engages the spring, thus providing the over-center snap action.

    The switch action takes place at the bottom of the arch, where those two very small tabs stick out. They wipe on the grubby-looking bottom tabs of the oddly shaped flat-brass doodads, the U-shaped ends of which surround the screws that clamp the copper wire to the switch.

    I expected to find a scorched contact or perhaps an insect in the mechanism, but nothing seemed out of the ordinary. Apart, that is, from the layer of congealed grease covering everything inside. I suspect the grease was applied in the factory to help prevent contact corrosion, but the volatiles are long gone.

    Switch Contacts
    Switch Contacts

    A closeup of the switch contacts shows (what I think is) the problem.

    All the contact points are covered in grease, but the lyre-shaped gizmo looks like it’s been painted: its contact points were black and resisted cleaning by fingernail scraping.

    As nearly as I can tell, all the current passed through a very few high spots that were wiped somewhat clean as the contacts closed. As those spots heated up, the grease melted and flowed over them, increasing the resistance and the heat.

    The switch had been working for many decades, as the BX armored cable in the box had fabric-covered rubber (stiff rubber) insulation. I managed to install the replacement switch without breaking the insulation, but it was ugly in there.

  • What’s Inside This Box?

    Digital Media Player box
    Digital Media Player box

    Got a package from halfway around the world that, I thought, corresponded to a recent eBay order. Opened the envelope and pulled out a box containing … a Digital Media Player?

    That’s odd. I don’t recall ordering one of those.

    At this point, anybody who’s read Frank Herbert’s The White Plague should get the chills. Do you or don’t you open a mysterious package from far away that seems to offer something interesting?

    Pandora might have something to say, too.

    Digital Media Player box - contents
    Digital Media Player box – contents

    Well, open it I did, and found exactly what I’d ordered: a stash of female headers pins. Of course, one can’t tell what else might have come in the package, but so it goes.

    Now I can hand Eks half a lifetime supply of the strips to replace the ones I mooched.

    One other mildly surprising part of the package: it seems we’ve gotten to the point where magnetic closures are cheap enough to replace everything else, including intricate origami tucks. There’s a small steel plate pasted under the flap. Who knew?

    Digital Media Player box - magnetic closure
    Digital Media Player box – magnetic closure
  • Failed LED

    Dead LED
    Dead LED

    Doesn’t look like much, does it? It’s an ordinary blue LED that I used for the upper colon dot in a clock. Worked fine for a few dozen power-on hours, then it turned off a bit after 6:00 pm one day. Back on an hour later, more or less, then off again by the next morning, back on again, off again.

    Might be a software error, as each colon LED is a separate TLC5916 display driver output. Might be a soldering problem, as my board doesn’t have plated-through holes. Might be (shudder) a burned-out transistor inside the TLC5916.

    When it’s off, VCC appears on both sides, within a few tens of millivolts.

    Resoldered the joints, after which it worked for a while. When it’s on, voltage measurements look normal: about 3.5 V drop across the diode and 1.5 V across the driver transistor.

    No obvious code problems, but, then, code problems are never obvious.

    Finally the thing stopped working for a few hours. I unsoldered it and there’s no continuity: it failed open. Peering deeply inside with a microscope shows nothing unusual: the flying gold wires look OK, the bonds look flat, and the chip has no burn marks.

    Just a bad LED, I suppose. It’s surplus, of course, but that doesn’t mean much these days; there’s a lot of surplus going around.

    Soldered in a replacement from the same batch and it’s all good.

    So far, anyway.

  • TLC5916 Configuration Code Setting

    TLC5916 Writing Config Code
    TLC5916 Writing Config Code

    The TLC5916 data sheet clearly shows that you write the configuration code (which controls the LED current) by shifting seven bits in, then raising LE during the 8th SCK pulse while simultaneously shifting the 8th bit.

    That makes no sense whatsoever: you couldn’t use standard SPI hardware in a chained configuration, because you’d have to blip LE while shifting.

    In fact, the chip doesn’t work that way. You set the config code in Special Mode just like you set the LED driver bits in Normal Mode: shift ’em all in, then blip LE to latch ’em into the parallel holding register.

    Here’s the code to make it happen…

    DisableSPI();                               // manual SPI control
    
     digitalWrite(PIN_DISABLE_DISPLAY,HIGH);    // initial condition
     digitalWrite(PIN_LATCH_DO,LOW);
    
     PulsePin(PIN_SCK);                         // 1
     digitalWrite(PIN_DISABLE_DISPLAY,LOW);
     PulsePin(PIN_SCK);                         // 2
     digitalWrite(PIN_DISABLE_DISPLAY,HIGH);
     PulsePin(PIN_SCK);                         // 3
     digitalWrite(PIN_LATCH_DO,HIGH);           //   sets Special Mode
     PulsePin(PIN_SCK);                         // 4
     digitalWrite(PIN_LATCH_DO,LOW);
     PulsePin(PIN_SCK);                         // 5
    
    //-- Send brightness level
    
     EnableSPI();                               // turn on SPI hardware
    
     SendRecSPI(Brightness);
     SendRecSPI(Brightness);
     SendRecSPI(Brightness);
     SendRecSPI(Brightness);
     SendRecSPI(Brightness);
    
     PulsePin(PIN_LATCH_DO);                    // latch new shift reg contents into drivers
    
    //-- put LED drivers back in Normal Mode
    
     DisableSPI();
    
     digitalWrite(PIN_DISABLE_DISPLAY,HIGH);     // initial condition
     digitalWrite(PIN_LATCH_DO,LOW);
    
     PulsePin(PIN_SCK);                          // 1
     digitalWrite(PIN_DISABLE_DISPLAY,LOW);
     PulsePin(PIN_SCK);                          // 2
     digitalWrite(PIN_DISABLE_DISPLAY,HIGH);
     PulsePin(PIN_SCK);                          // 3
     digitalWrite(PIN_LATCH_DO,LOW);             //   sets Normal Mode
     PulsePin(PIN_SCK);                          // 4
     digitalWrite(PIN_LATCH_DO,LOW);
     PulsePin(PIN_SCK);                          // 5
    
     digitalWrite(PIN_DISABLE_DISPLAY,LOW);      // turn the LEDs on again
    

    The SendRecSPI() function does exactly what you’d expect:

    byte SendRecSPI(byte Dbyte) {                // send one byte, get another in exchange
    
     SPDR = Dbyte;                      // assume it's OK to send a new byte
    
     while (! (SPSR & (1 << SPIF))) {   // wait for shift to finish
      continue;
     }
    
     return SPDR;                       // SPIF will be cleared
    }
    

    I don’t know. Maybe the chip also works the way they show in the datasheet, but I doubt it’s worth finding out.

  • TLC5916 LED Driver Current Monotonicity Hack

    TLC5916 Current Gain vs Config Code
    TLC5916 Current Gain vs Config Code

    I’m using Texas Instruments TLC5916 constant-current LED driver chips for my my friend’s Totally Featureless Clock. An 8-bit configuration value sets the output current, with the external resistor defining the maximum value as described there.

    The problem is that the current-versus-config-value curve has a non-monotonic discontinuity in the middle, where the Current Multiplier bit switches from 0 to 1. I don’t know in which alternate universe this design decision made sense, but right here and now…

    It. Does. Not.

    Why it’s a problem: the LED brightness tracks room illumination as seen by a CdS photoresistor, averaged over maybe half a minute. The brightness changes very slowly, so the jump when it goes from 0x7f to 0x80 is really eyecatching. At least to me, anyway.

    Eyeballometric measurement of the curve shows the current at 0x80 pretty much matches the current at 0x60, soooo let’s just shove the second quarter of the curve (between 0x40 and 0x7f) downward until it meets the high-current value at 0x80.

    This code does the trick:

    if ((Brightness >= 0x40) && (Brightness <= 0x7f)) {
     Brightness = 0x40 + ((Brightness & 0x3f) >> 1);
    }
    

    Basically, that maps 0x7f to 0x5f. The output current for 0x5f is pretty close to the current for 0x80, making the step pretty much a non-issue.

    You could, if you were fussy enough, work out the actual current mapping values from the data sheet equations and make the ends match up perfectly.

  • Photoresistors Aren’t Indestructable

    Delaminated photoresistor
    Delaminated photoresistor

    So while testing the routine that measures light intensity using the technique described there, I discovered that:

    • The conductive layer atop the photoresistor doesn’t bond well to the base layer
    • The transparent top coating isn’t armor plating

    I wanted to verify the extreme dark end of the response curve, where the resistance is the highest and the input voltage correspondingly the lowest. The fastest way to do that is to put a piece of black electrical tape across the photoresistor’s face; it worked perfectly.

    Unfortunately, peeling the tape off the photoresistor also peeled the coatings apart. The resistance was unchanged, but I suspect moisture inside the layers isn’t going to do them the least little bit of good.

    Drat & similar remarks…

  • 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.