Archive for category Electronics Workbench

SK6812 RGBW Test Fixture: Row-by-Row Color Mods

The vacuum tube LED firmware subtracts the minimum value from the RGB channels of the SK6812 RGBW LEDs and displays it in the white channel, thereby reducing the PWM value of the RGB LEDs by their common “white” component. The main benefit is reducing the overall power by about two LEDs. More or less, kinda sorta.

I tweaked the SK6812 test fixture firmware to show how several variations of the basic RGB colors appear:

      for (int col=0; col < NUMCOLS ; col++) {              // for each column
        byte Value[PIXELSIZE];                              // figure first row colors
        for (byte p=0; p < PIXELSIZE; p++) {                //  ... for each color in pixel
          Value[p] = StepColor(p,-col*Pixels[p].TubePhase);
        }
        // just RGB
        int row = 0;
        uint32_t UniColor = strip.Color(Value[RED],Value[GREEN],Value[BLUE],0);
        strip.setPixelColor(col + NUMCOLS*row++,UniColor);

        byte MinWhite = min(min(Value[RED],Value[GREEN]),Value[BLUE]);

        // only common white
        UniColor = strip.Color(0,0,0,MinWhite);
        strip.setPixelColor(col + NUMCOLS*row++,UniColor);

        // RGB minus common white + white
        UniColor = strip.Color(Value[RED]-MinWhite,Value[GREEN]-MinWhite,Value[BLUE]-MinWhite,MinWhite);
        strip.setPixelColor(col + NUMCOLS*row++,UniColor);

         // RGB minus common white
        UniColor = strip.Color(Value[RED]-MinWhite,Value[GREEN]-MinWhite,Value[BLUE]-MinWhite,0);
        strip.setPixelColor(col + NUMCOLS*row++,UniColor);

        // inverse RGB
        UniColor = strip.Color(255 - Value[RED],255 - Value[GREEN],255 - Value[BLUE],0);
        strip.setPixelColor(col + NUMCOLS*row++,UniColor);

Which looks like this:

SK6812 Test Fixture - RGBW color variations - diffuser
SK6812 Test Fixture – RGBW color variations – diffuser

The pure RGB colors appear along the bottom row, with the variations proceeding upward to the inverse RGB in the top row. The dust specks show it’s actually in focus.

The color variations seem easier to see without the diffuser:

SK6812 Test Fixture - RGBW color variations - bare LEDs
SK6812 Test Fixture – RGBW color variations – bare LEDs

The white LEDs are obviously “warm white”, which seems not to make much difference.

Putting a jumper from D2 to the adjacent (on an Nano, anyway) ground pin selects the original pattern, removing the jumper displays the modified pattern:

SK6812 test fixture - pattern jumper
SK6812 test fixture – pattern jumper

For whatever it’s worth, those LEDs have been running at full throttle for two years with zero failures!

The Arduino source code as a GitHub Gist:

,

Leave a comment

Raspberry Pi Shutdown / Start Button

While adding the usual Reset button to a Raspberry Pi destined for a Show-n-Tell with the HP 7475A plotter, I browsed through the latest dtoverlay README and found this welcome surprise:

Name:   gpio-shutdown
Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.
Load:   dtoverlay=gpio-shutdown,<param>=<val>
Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.

        debounce                Specify the debounce interval in milliseconds
                                (default 100)

So I added two lines to /boot/config.txt:

dtoverlay=gpio-shutdown
dtparam=act_led_trigger=heartbeat

The fancy “Moster heatsink” case doesn’t leave much room for wiring:

RPi Shutdown Restart Switch - GPIO 3
RPi Shutdown Restart Switch – GPIO 3

The switch button is slightly shorter than the acrylic sheet, so it’s recessed below the surface and requires a definite push to activate. It’s not as if it’ll get nudged by accident, but ya never know.

I’ll eventually migrate this change to all the RPi boxes around the house, because it just makes more sense than any of the alternatives. Heck, it’ll free up a key on the streaming radio player keypads, although I must move the I²C display to Bus 0 to avoid contention on Pin 3.

For reference, the Raspberry Pi header pinout:

Raspberry Pi pinout
Raspberry Pi pinout

I don’t know if I²C Bus 0 has the same 1.8 kΩ pullups as Bus 1, though; a look at the bus currents will be in order.

,

Leave a comment

Baofeng Bike Helmet Headset Wiring Repair

The audio output wire from the Baofeng UV-5R to my bike helmet headset adapter broke after a year and a half, far longer than I expected:

Baofeng - broken spkr wire
Baofeng – broken spkr wire

It’s the green one, over on the left, pulled out of the heatstink tubing that should have provided some strain relief, having broken at the solder joint to the resistor.

A quick & easy fix, after which I reapplied even more tape to hold everything in place.

Maybe it’ll last two years this time around …

Leave a comment

Photo Lamp Mount: Moah Plastic!

One of the cold shoe mounts I made for the photo lamps cracked:

Photo Lamp Mount - fractured
Photo Lamp Mount – fractured

It’s done in PETG with my more-or-less standard two perimeter threads and 15% 3D honeycomb infill, which is Good Enough™ for most of my parts. In this case, there’s obviously not nearly enough plastic in there!

Redoing it with three perimeters and 50% infill should improve the situation, even though it looks identical on the outside:

Photo Lamp Mount - reinstalled
Photo Lamp Mount – reinstalled

I didn’t replace the other mount. If it breaks, it’ll get the same 50% infill as this one. If this one breaks, I’ll try 75%.

An easy fix!

, ,

11 Comments

Blackburn Flea Bike Headlight

A Blackburn Flea bike headlight and its USB charger emerged from the packs on our Young Engineer’s Tour Easy, but the battery was completely defunct. With nothing to lose, I applied a small screwdriver to crack the case:

Blackburn Flea - opening case
Blackburn Flea – opening case

The battery is a single cylindrical lithium cell:

Blackburn Flea - battery
Blackburn Flea – battery

The USB charger seemed defunct, as it produced only a few dozen millivolts when connected and plugged into its wall wart. Cracking its case revealed a tiny buck power supply with no obvious damage, but also no output.

So I manually charged the cell:

Blackburn Flea - external recharge
Blackburn Flea – external recharge

Definitely not recommended practice, but a bench supply set to 4.1 V and current-limited to 100 mA gets the job done: the current stays at 100 mA while the voltage rises to 4.1 V, then the current drops to just about zero over the next few hours with cell held at 4.1 V.

Unfortunately, the cell really was defunct, even after a few cycles, so I conjured a not-dead-yet lithium cell from the heap:

Blackburn Flea - measurement setup
Blackburn Flea – measurement setup

Given a good supply, the Flea still works perfectly:

Blackburn Headlight - Kyocera Li-ion - 50 mA-div
Blackburn Headlight – Kyocera Li-ion – 50 mA-div

The yellow trace shows the battery holding at 4 V while the LED current runs at 150 mA (3 div × 50 mA/div). You wouldn’t want to run ordinary 5 mm LEDs at nearly 40 mA, but Blackburn surely specified good parts.

Replacing the Flea’s internal cell seems impossible, given its peculiar form factor, and grafting the PCB to an external cell makes no sense, given that it’d then need a custom bike mount.

So another chunk of electronics goes in the e-waste box.

Ride on!

3 Comments

Alkaline Battery Packaging

Apparently, we’ve burned enough cargo aircraft and killed enough people to require careful attention to detail in battery packages:

Amazon alkaline AAA packaging
Amazon alkaline AAA packaging

These “Ships from and sold by Amazon” alkaline AA cells arrived by UPS. They now fall under reasonable requirements to prevent shorting and damage, although the cardboard box wasn’t sturdy enough to prevent them from breaking free laterally.

One might quibble about the “Health & Personal Care Item” description, but, yeah, better battery packaging seems like a good idea.

2 Comments

Scrap EEPROMs

A quartet of defunct 64 KB EEPROMs (*) emerged from a box of microscope doodads, so I stuck ’em under the stereo zoom scope for final pictures.

The oldest one, an MCM68764, came from Motorola with a 8313 date code. The next three, all TMS2764JL-25, came from TI with date codes in 84 and 85, so they have slightly different layouts.

MCM68764C EPROM
MCM68764C EPROM
TMS2764JL-25 A EPROM
TMS2764JL-25 A EPROM

This one is rotated 90° counterclockwise:

TMS2764JL-25 B EPROM
TMS2764JL-25 B EPROM
TMS2764JL-25 C EPROM
TMS2764JL-25 C EPROM

The hideous compression artifacts come from the original Pixel 3a images, because they’re (digitally) zoomed in all the way, plus bonus optical distortion from the quartz windows. The chips definitely look better in person, although the (optical) magnification isn’t nearly enough to show the tiniest details.

(*) Uh, they’re just EPROMs. It’s been so long since I’ve typed it that the extra “E” just stuttered right out. That’s my story and I’m sticking with it … at least I got the image names right!

6 Comments