Archive for category Electronics Workbench

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!

2 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

CNC 3018XL: Adding Run-Hold Switches

Although the bCNC GUI has conspicuous Run / Hold buttons, it’s easier to poke a physical switch when you really really need a pause in the action or have finished a (manual) tool change. Rather than the separate button box I built for the frameless MPCNC, I designed a chunky switch holder for the CNC 3018XL’s gantry plate:

CNC 3018-Pro - Run Hold Switches - installed
CNC 3018-Pro – Run Hold Switches – installed

The original 15 mm screws were just slightly too short, so those are 20 mm stainless SHCS with washers.

The switches come from a long-ago surplus deal and have internal green and red LEDs. Their transparent cap shows what might be white plastic underneath:

CNC 3018-Pro - Run Hold Switches - top unlit
CNC 3018-Pro – Run Hold Switches – top unlit

I think you could pry the cap off and tuck a printed legend inside, but appropriate coloration should suffice:

CNC 3018-Pro - Run Hold Switches - lit
CNC 3018-Pro – Run Hold Switches – lit

Making yellow from red and green LEDs always seems like magic; in these buttons, red + green produces a creamy white. Separately, the light looks like what you get from red & green LEDs.

The solid model shows off the recesses around the LED caps, making their tops flush with the surface to prevent inadvertent pokery:

Run Hold Switch Mount - Slic3r
Run Hold Switch Mount – Slic3r

The smaller square holes through the block may require a bit of filing, particularly in the slightly rounded corners common to 3D printing, to get a firm press fit on the switch body. The model now has slightly larger holes which may require a dab of epoxy.

A multi-pack of RepRap-style printer wiring produced the cable, intended for a stepper motor and complete with a 4-pin Dupont socket housing installed on one end. I chopped the housing down to three pins, tucked the fourth wire into a single-pin housing, and plugged them into the CAMtool V3.3 board:

CNC 3018-Pro - Run Hold Switches - CAMtool V3.3 header
CNC 3018-Pro – Run Hold Switches – CAMtool V3.3 header

The CAMtool schematic matches the default GRBL pinout, which comes as no surprise:

CAMtool schematic - Start Hold pinout
CAMtool schematic – Start Hold pinout

The color code, such as it is:

  • Black = common
  • Red = +5 V
  • Green = Run / Start (to match the LED)
  • Blue = Hold (because it’s the only color left)

The cable goes into 4 mm spiral wrap for protection & neatness, with the end hot-melt glued into the block:

CNC 3018-Pro - Run Hold Switches - bottom
CNC 3018-Pro – Run Hold Switches – bottom

The model now includes the wiring channel between the two switches, which is so obviously necessary I can’t imagine why I didn’t include it. The recess on the top edge clears the leadscrew sticking slightly out of the gantry plate.

The LEDs require ballast resistors: 120 Ω for red and 100 Ω for green, producing about 15 mA in each LED. Those are 1/8 W film resistors; I briefly considered SMD resistors, but came to my senses just in time.

A layer of black duct tape finishes the bottom sufficiently for my simple needs.

Note: the CAMtool board doesn’t have enough +5 V pins, so add a row of +5 V pins just below the standard header. If you’ve been following along, you needed them when you installed the home switches:

3018 CNC CAMTool - Endstop power mod
3018 CNC CAMTool – Endstop power mod

A doodle giving relevant dimensions and layouts:

Run Hold Switch Mount - Layout Doodles
Run Hold Switch Mount – Layout Doodles

I originally planned to mount the switches on the other gantry plate and sketched them accordingly, but (fortunately) realized the stepper motor was in the way before actually printing anything.

The OpenSCAD source code as a GitHub Gist:

It seems bCNC doesn’t update its “Restart Spindle” message after a tool change when you poke the green button (instead of the GUI button), but that’s definitely in the nature of fine tuning.

, ,

1 Comment