Archive for category Electronics Workbench

Raspberry Pi vs. Avahi

It turns out that the various Avahi daemons performing the magick between whatever.local names and dotted-quad addresses for Raspberry Pi descend into gibbering madness when confronted with:

  • One name corresponding to multiple IP addresses
  • One IP address used for multiple MAC addresses
  • Multiple names for one IP address
  • Multiple names for one MAC address
  • Multiple IP addresses for one MAC address
  • Multiple MAC addresses for one IP address
  • Any and all combinations of the above at various times

The least of the confusion involved an incorrect IP address linked to a familiar name pulled from deep history by a baffled daemon doing the best it can with what it thinks it know. Despite what I concluded, rather early in the process, there’s no real error, other than what amounted to a self-inflicted fast-flux nameserver attack.

Anyhow, I devoted the better part of an afternoon to sorting out the mess, which involved labeling all the streaming radio players with their MAC addresses and rebooting them one-by-one to allow all the daemons time to recognize the current situation:

Raspberry Pi 3 - WiFi MAC address

Raspberry Pi 3 – WiFi MAC address

That label corresponds to the Pi 3’s on-board WiFi adapter.

For Pi 2 boxen, the MAC address travels with the WiFi adapter jammed into a USB port:

SunFounder WiFi Adapter - MAC address

SunFounder WiFi Adapter – MAC address

I didn’t label the (unused) Ethernet jacks, figuring I’d solve that problem after it trips me up.



Kenmore 158 Sewing Machine: Another Foot Pedal Rebuild

The pedal on Mary’s most recent Kenmore 158 lost its low-speed control, which meant I must add a few more graphite / carbon disks to the stacks:

Kenmore 158 - carbon disks

Kenmore 158 – carbon disks

The contacts needed a bit of attention, too:

Kenmore 158 - carbon contact plates - detail

Kenmore 158 – carbon contact plates – detail

Contrary to what I found in the previous rheostats, these stacks end with a double-thick graphite disk backed up by a disk of brass shimstock, all of which needed cleaning, too. No broken disks, none severely eroded, no debris, just a general shortening of the stacks; I think the disks gradually turn into carbon dioxide.

Each stack has 42 graphite disks that average 0.79 mm thick, the double-thick disks measure 1.5 mm, and the brass shims are 0.30 mm = 12 mil. The punched contacts on those brass plates stand 0.95 mm proud of the surface.

With the big graphite plugs in place, the ceramic housing had 37 mm deep holes for the disk stacks. Subtracting the 0.95 mm contact leaves about 36 mm and, seeing as how the stacks add up to just under 36 mm overall, there’s barely room for one additional disk. I added one to each stack, buttoned the pedal up, and it works perfectly again.

Good thing I have a bag of those disks from the crash test dummy machine!



Read-Only MicroSDHC Card

I iterated this sequence three times before I caught on:

  • ssh into Raspberry Pi
  • Edit /etc/rc.local, save changes
  • Reboot, observe the changes had no effect
  • cat /etc/rc.local shows no changes

Then I:

  • Edited / saved
  • Listed the file to verify the changes
  • Rebooted, observe no effect from changes
  • Listed the file again: the changes were gone


Defunct 8 GB MicroSDHC card

Defunct 8 GB MicroSDHC card

It turns out the card went read-only without warning, so I was displaying the contents of the file cache buffers after the edit, not the data stored on the card. Rebooting started with empty caches, read the previous file contents, and behaved accordingly.

The F3 utilities now live in the Ubuntu repository and no longer require compiling from source. The result:

sudo f3probe --time-ops /dev/sdb
F3 probe 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
         it can take longer. Please be patient.

Probe finished, recovering blocks... Done

Bad news: The device `/dev/sdb' is damaged

Device geometry:
	         *Usable* size: 0.00 Byte (0 blocks)
	        Announced size: 7.35 GB (15415296 blocks)
	                Module: 8.00 GB (2^33 Bytes)
	Approximate cache size: 0.00 Byte (0 blocks), need-reset=no
	   Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 164.4ms
 Operation: total time / count = avg time
      Read: 107.1ms / 4098 = 26us
     Write: 56.6ms / 2049 = 27us
     Reset: 0us / 0 = 0us

That card has been kicking around for a while and started out as a no-name generic in some random gadget. Of course, those fancy Sony MicroSD cards weren’t shining examples of durability, either.

I’m mildly astonished the streaming player worked perfectly with what amounts to a read-only filesystem, but that’s what caching is all about: there was no need to write the data to “disk”.



USB Gooseneck Extension Innards

The bandsaw needs more light on the blade, but a fixed lamp will certainly get in the way of something. Pondering the solution space of available parts suggests a COB LED on a flexible gooseneck, which led to some 30 cm USB extenders, then smashing one of the connectors to reveal the wiring inside:

USB Gooseneck Extender - disassembled

USB Gooseneck Extender – disassembled

It was (probably) assembled by soldering the USB terminals to the wires, mounting it in a fixture, then injection-molding the shell around everything. The injected plastic fills the end of the gooseneck and immobilizes the wires.

I’d like slightly longer wire ends, although they’re workable if I don’t make any further mistakes. Perhaps I can heatsink the gooseneck, slit 10 mm of the metal sheath with an abrasive wheel, and peel off the pieces without damaging the wires. It could happen!

Speaking of mistakes, wiring an ordinary USB connector with +12 VDC for an LED seems fraught with peril…

Leave a comment

Raspberry Pi WiFi Adapters

One might be forgiven for thinking these two USB Wifi adapters are essentially identical:

USB Wifi adapters

USB Wifi adapters

Turns out the SunFounder RT5370 (on the top, with the stylin’ curved case) has better performance than the Wifi With Antenna (on the bottom, with full-frontal chunk goin’ on), by a not inconsiderable 5 to 10 dB. Boosting the received power level in the fringe areas of our house from -70 dBm to -63 dBm makes all the difference between not working and steady streaming.

The built-in WiFi antenna on a Raspberry Pi 3 ticks along 10 dB lower, with -80 dBm (10 pW!) at the receiver making for poor communication: a Pi 3 works perfectly within reasonable line-of-sight of the router (even through our wood floor) and wakes up blind in fringe areas. Hacking an external antenna probably helps, but definitely isn’t a net win compared to ten bucks worth of USB adapter.

The wavemon utility (it’s in the Raspbian repo) comes in handy for figuring that sort of thing.

There is, of course, no way to determine anything important about the adapters from their product descriptions, which are essentially identical, right down to the price. Neither have any product identification on their cases. The back of the package for the SunFounder gadget gives some specs, none of which may mean anything (clicky for more dots):

SunFounder RT5370 USB WiFi Adapter Specs

SunFounder RT5370 USB WiFi Adapter Specs

I ordered another SunFounder adapter, Just In Case it comes in handy, with the hope that both behave the same way.



Raspberry Pi 3 Reset Switch

The (relatively) new Raspberry Pi 3 PCB layout puts the Run header in a different location than in the Pi 2, but a minute of filing gnaws a suitable opening:

Raspberry Pi 3 - Reset Switch

Raspberry Pi 3 – Reset Switch

As before, a hot-melt glue blob holds the switch in place. I’d prefer a black case, if only to hide the blob, but clear-ish is what’s available right now.

Remember those orderly shutdowns, even at the cost of a keypad button!


Leave a comment

Raspberry Pi Streaming Radio Player: Ignoring a Missing Volume Knob

The Dell AC511 USB SoundBars have volume control knobs, which this udev rule turns into the /dev/input/volume device:

ATTRS{name}=="Dell Dell AC511 USB SoundBar", SYMLINK+="input/volume"

I recently wanted to use an ordinary USB “sound card” that did not, of course, have a volume knob:

Sabrent USB Audio Adapter

Sabrent USB Audio Adapter

This hack skips the configuration that makes the knob’s events visible to the Python program:

import os.path

... snippage ...

# if volume control knob exists, then set up its events

VolumeDevice = '/dev/input/volume'

vp = select.poll()
if os.path.exists(VolumeDevice):
  v = InputDevice(VolumeDevice)
  vp.register(v.fileno(),select.POLLIN + select.POLLPRI + select.POLLERR)

It turns out that if you never register a device with the event polling interface, then the interface never reports any events and the rest of the code remains blissfully undisturbed: the non-existent knob doesn’t do anything, while the volume control buttons on the keypad continue to function as usual.

The end result of this fiddling puts a Raspberry Pi 2 Model B to work as a streaming player on my Electronics Workbench, untethering the laptop from those powered speakers:

RPi 2 Streaming Player - USB sound gadget

RPi 2 Streaming Player – USB sound gadget

It’s a shame that USB audio gadget is so big, because it crowds out standard USB plugs to the side.

The most satisfactory LED configuration for a translucent case with an external WiFi adapter seems to be:


The rest of the code remains unchanged as shown in that GitHub Gist.

Bomb the bass!