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

  • Palm Zire 71 USB Cradle Charging Current Indicator

    Modified USB cradle with bargraph
    Modified USB cradle with bargraph

    The first time my first Zire 71 crapped out, I hacked this charging current display into the cradle so I could see when the mumble thing was actually charging. It turns out that the PDA makes its happy “I’m charging!” beep and overlays the charging indicator on the battery symbol even when there’s no +5 V connection to the PDA: you can leave it in the cradle all night and wake up to a dead battery in the morning.

    I hate it when that happens…

    The charging current meter is a classic LM3914 LED display driver and a surplus HP (from back when they were HP) 10-LED bargraph module.

    Here’s the schematic, such as it is, reverse-engineered from the as-built gadget…

    Charge current bargraph circuit
    Charge current bargraph circuit

    [Update: Something went wrong with the upload for that sketch; I think it’s OK now.]

    The general idea is to insert a 1-Ω resistor in the common return from the Zire’s charging contacts. The total current through the Zire, which is mostly battery charging current when it’s off, generates a voltage across the resistor. That voltage feeds the LM3914’s input, so the LEDs directly indicate the charging current.

    Fairly obviously, that resistor drops the external voltage by a smidge. As nearly as I can tell, the drop adds up to maybe a third of a volt, so the charging voltage is a tad lower than they expect. Seems to work just fine; the maximum charging voltage for a 3.7 V Li-Ion cell is pretty close to 4.2 V, so they’ve still got half a volt to play with.

    The two resistors and the trimpot add up to 1240 Ω, which sets the LED current to about 10 mA. The trimpot sets the voltage at the top of the LM3914’s internal resistor string to about 290 mV, although I measure the all-LEDs-on current at about 380 mA.

    Current meter overview
    Current meter overview

    Here’s what it looks like inside.

    The sense resistor hangs off the power input jack’s common pin, with the common lead from the PDA contact pins and the LM3914 input lead connected to the other end. The LM3914 common goes directly to the power supply common, not the hot end of the sense resistor.

    The 5.1 V lead from the power input jack still goes directly to the PDA contact pins, as well as the LM3914. I put a 22 Ω resistor in series with the LEDs to cut their power dissipation a bit. They’re plenty bright at 10 mA, so you might want to cut that down.

    Bargraph display detail
    Bargraph display detail

    The LED bargraph module fits neatly in a rectangular hole painstakingly drilled, sawed, and filed into the case, then held in place with a generous dollop of JB Weld epoxy. I taped it in place to keep the epoxy from oozing out while it was curing.

    The LM3914 is soldered directly to the display module, with flying wires and components soldered to the remaining pins.

    If I recall correctly, I held the Zire in position on the connector strip, got it charging, and then tweaked the trimpot until the display showed full scale.

    This was done in an absolute white-heat frenzy with the PDA’s battery going dead, but at least the exterior looks pretty good. The circuitry inside is a genuine hairball that has been working fine ever since, which makes it Good Enough.

  • Sherline Tool Length Probe: Adding a Jack

    Probe jack and switch
    Probe jack and switch

    I’ve been mulling over adding a tool length probe for a while and finally decided that the simplest approach might be the best: a momentary-contact pushbutton switch that pulls a parallel port input pin to ground.

    The motivation is that a simple switch seems to be repeatable enough for tool length probing and it’s cheap enough that I won’t form a deep emotional bond to it. When a probe crashes the switch, I can just pop another one in place without any heartache or putzing around for a day or three to build another over-elaborate probe station.

    The catch is that the Sherline motor driver box doesn’t include connections for any of the parallel port input pins.

    The choices seem to boil down to:

    • Adding a breakout board between the parallel port and the driver box or
    • Hacking the driver box to get access to the port pins

    Well, I’ve already pretty well hacked up my controller, as I wrote up in Circuit Cellar magazine (Aug & Oct 2004), so I don’t have much to lose… and the box is already in the shop!

    Probe to port pin 15
    Probe to port pin 15

    This picture shows the connection to pin 15 of the parallel port on the Sherline driver PCB. The driver doesn’t use that input pin (or any of the others, for that matter), which means the PCB doesn’t have a trace leading anywhere convenient. I ran the new wires through the connector mounting hole, rather than around the edge, and soldered them directly to the connector pins on the bottom of the board.

    The jack is an ordinary 1/8″ (3.5 mm, these days) stereo (3 conductor) jack, with lah-dee-dah gratuitous gold-flavored flashed plating; anything similar will work just fine.

    Connections:

    • Sleeve -> driver box
    • Ring -> circuit ground (pin 19 is convenient)
    • Tip -> pin 15, the probe input

    The cable shield connects only at the plug into the driver box, not at the switch end. That ensures there’s no current flowing through it and it can do a marginally better job of shielding the two conductors within. I’m reasonably sure that makes no difference whatsoever in this application.

    The cable got chopped out of an AV-interconnect dingus with all sorts of fancy connectors on the other end. It’s a surplus find, cost maybe a buck, and has the redeeming feature of sporting molded plugs that I don’t have to solder.

    The switch connections are soldered and insulated with heat stink shrink tubing. The general idea is that the driver box provides all the power, there’s no electrical contact with the mill table or spindle, and thus no reason to use fancy circuitry to solve a problem that’s not there.

    I did not add a capacitor across the switch contacts, figuring that I’d solve that problem when it happened. The common practice of putting a honkin’ big cap across switch contacts is bad practice: it effectively shorts the power supply across the contacts for a brief moment every time the switch closes. Some stored energy is good (it keeps the contacts clean), too much simply burns them away. ‘Nuff said.

    Probe jack - inside
    Probe jack – inside

    I marked a hole on the front panel symmetric with the LED, eased the circuit board out of the case and wrapped it in a shop rag to keep the swarf out, propped the case on the drill press table, and rammed a 1/4″ hole through the spot marked X with a step drill. Yeah, hand-held on the table, just like you’re never supposed to do.

    The force is strong with me…

    The (well, my) Sherline.hal file connects pin 15 to the probe sense input (maybe I defined that when I set things up; I don’t recall now), but it assumes the pin will be high when active. The parallel port pin has a built-in pullup resistor and a switch to ground makes it active when low. These two lines in my custom_postgui.hal file disconnect the high-active pin signal and connect the low-active pin signal.

    unlinkp parport.0.pin-15-in
    net probe-in parport.0.pin-15-in-not
    

    You do it that way to avoid changing the Sherline.hal file, which will be overwritten if you ever run the automagic configuration program again.

    If you’re doing this from scratch, just configure the whole thing using the configuration tool, it’ll set the HAL file properly and you won’t need any of that fiddling around.

    Tweak the Sherline.ini file to add support for tool changing with the G30 command:

    [EMCIO]
    TOOL_CHANGE_AT_G30 = 1
    

    Button everything up, then do a quick

    G91 G38.2 Z-10 F10

    and poke the button while the Z axis is in motion. The Z axis should stop instantly. If not, check your wiring.

    Now, some Orc Engineering is in order: I need a low-budget fixture to put the switch in harm’s way.

  • Bicycle Reflector Adaptor Bushing

    Reflector on bushing
    Reflector on bushing

    After replacing the seat strut screws, I found a Round Tuit lying there on the workbench, right next to the rear reflectors I’ve been meaning to install for a truly embarrassing period.

    Recumbents don’t have the usual assortment of standard-sized tubing in the usual road-bike places, making common items like reflectors difficult to attach. The ideal spot on our bikes is at the base of the VHF/UHF antennas, right next to the white blinky LEDs, but, alas, that’s 20 mm in diameter and the reflector clamp barely shrinks down to a bit under 28.

    Turns out that a chunk of 1.5 inch PVC pipe has a 4 mm wall thickness, so wrapping a layer of that around the antenna base will do the trick. I whacked off a length of pipe, faced off both ends in the lathe, and put a shallow recess around the middle of the ring to capture the reflector clamp.

    By another rare coincidence, 1.5 inch PVC pipe has an ID of exactly 40 mm… so cutting the ring exactly along a diameter produces the right length. The catch is that the pipe isn’t flexible at all, but brandishing a heat gun in a threatening manner solves that problem.

    Reshaped bushing on mandrel
    Reshaped bushing on mandrel

    A random hunk of 3/4-inch aluminum rod is about 19 mm in diameter, so I chucked that in the lathe and shaped the saggy strip around it… wearing thick leather gloves.

    It springs out to 20 mm with no problem, slides right on, and grips reasonably well. I may add a strip of tapeless sticky (think double-sided tape without the tape: just the adhesive!) under the bushing if it wants to walk away.

    I made two of ’em, of course, and put a reflector on Mary’s bike while I was at it. Our young lady’s bike already has a reflector, although I should upgrade that bushing as well… it’s a layer of self-vulcanizing rubber tape that works perfectly, so this may take a while.

    I suppose I should buy a length of gray or black PVC pipe, but that’s in the nature of fine tuning.

  • X10 PHC02 Maxi Controller: Green LED

    PHC02 Circuit Board
    PHC02 Circuit Board

    Got the replacement X10 controller from the usual eBay source and it works fine, except it has a red LED that’s on unless it’s sending an X10 command.

    That’d be OK, except that I’ve spent the last few months associating a red LED at that spot on the dresser with a jammed X10 controller.

    Not to mention that red LEDs are sooo 20th Century…

    Four screws hold the baseplate in place; it takes a bit of prying to release the stiffening collars around the front screws and remove the baseplate. One more screw holds the circuit board in place.

    Surprisingly, they used the same metal-dome switch plates!

    Anyhow, with the board out, it’s easy to unsolder the red LED and replace it with a green one from my bag o’ mixed LEDs. It’s not quite the same shape and doesn’t have a big shoulder to keep it in place, but it’s good enough for me.

    New green LED
    New green LED

    The heat of soldering melted the thermoplastic glue that held the original LED in place. The new one isn’t quite as firmly bonded, but I don’t intend to jam a paperclip into the hole after shoving the LED out of the way.

    That was easy…

  • EMC2 Gamepad Pendant: Joystick Axis Lockout

    Nothing like sleeping on a problem. It turns out that a chunk of HAL code can do a nice job of locking out an inactive joystick axis.

    The general idea:

    • A priority encoder selects one axis when both go active simultaneously
    • The prioritized outputs set flipflops that remember the active axis
    • The active axis locks out the other one until they’re both inactive

    That way, you can start to jog either axis on a knob without worrying about accidentally jogging the other axis by moving the knob at a slight diagonal. I hate it when that happens.

    The other tweak is that the quartet of buttons on the right act as a “hat” for the Z and A axes, jogging them at the current maximum speed.

    Because it’s tough to accidentally push two buttons at once, there’s no need to lock them out. So you can jog diagonally by deliberately pushing adjoining buttons, but you must want to do that.

    Rather than dumping the whole program again, here are the key parts…

    Figuring out if a joystick axis is active uses the window comparators. It seems the idle counts value varies slightly around 127, so I relaxed the window limits. Should the window comparator go active with the knob centered, the buttons for that axis won’t produce any motion.

    net		x-jog-count-int	input.0.abs-x-counts	conv-s32-float.0.in
    net		x-jog-count-raw	conv-s32-float.0.out	wcomp.0.in
    setp	wcomp.0.min		125
    setp	wcomp.0.max		130
    net		X-inactive		wcomp.0.out				not.0.in
    net		X-active		not.0.out
    

    The priority encoder is just a gate that prevents Y (or A) from being selected if X (or Z) is simultaneously active. Here’s a sketch for the ZA knob:

    Axis priority encoder
    Axis priority encoder

    The active and inactive signals come from the window detectors. The sketch gives the K-map layout, although there’s not a whole lot of optimization required.

    The corresponding code:

    net		Z-inactive		and2.5.in0
    net		A-active		and2.5.in1
    net		A-select		and2.5.out				# select A only when Z inactive
    
    net		Z-inactive		and2.6.in0
    net		A-inactive		and2.6.in1
    net		ZA-Deselect		and2.6.out				# reset flipflops when both inactive
    
    net		Z-active		and2.7.in0				# set Z gate when knob is active
    net		A-gate-not		and2.7.in1				# and A is not already gated
    net		Z-set			and2.7.out					flipflop.2.set
    
    net		ZA-Deselect		flipflop.2.reset		# reset when neither is active
    net		Z-gate			flipflop.2.out				not.6.in
    net		Z-gate-not		not.6.out
    
    net		A-select		and2.8.in0				# set A gate when knob is active
    net		Z-gate-not		and2.8.in1				# and Z is not already gated
    net		A-set			and2.8.out					flipflop.3.set
    
    net		ZA-Deselect		flipflop.3.reset		# reset flipflop when both inactive
    net		A-gate			flipflop.3.out				not.7.in
    net		A-gate-not		not.7.out
    

    The flipflops remember which axis went active first and lock out the other one. When both axes on a knob return to center, the flipflops reset.

    The quartet of buttons produce binary outputs, rather than the floats from the Hat, so a pair of multiplexers emit -1.0, 0.0, or +1.0, depending on the state of the buttons, for each axis.

    setp	mux2.6.in0	0.0
    setp	mux2.6.in1	-1.0
    net		A-btn-neg		input.0.btn-trigger		mux2.6.sel
    net		A-btn-neg-value	mux2.6.out				sum2.1.in0
    
    setp	mux2.7.in0	0.0
    setp	mux2.7.in1	1.0
    net		A-btn-pos		input.0.btn-thumb2		mux2.7.sel
    net		A-btn-pos-value	mux2.7.out				sum2.1.in1
    
    net		A-jog-button	sum2.1.out
    
    net		A-btn-neg		or2.1.in0
    net		A-btn-pos		or2.1.in1
    
    net		A-btn-any		or2.1.out				or2.2.in0
    net		A-gate			or2.2.in1
    net		A-motion		or2.2.out
    

    The A-motion signal is true when either of the A jog buttons or the A joystick axis is active. That gates the MAX_ANGULAR_VELOCITY value to halui.jog-speed, rather than the default MAX_LINEAR_VELOCITY. Or, depending on the state of the toggle from the two joystick push switches, 5% of that maximum. A mere 5% may be too slow for the A axis, but it’ll take some experience to determine that.

    With that in hand, the final step is gating either the knob or the button values to halui.jog.*.analog.

    net		Z-jog-button	mux2.8.in0
    net		Z-jog-knob-inv	mux2.8.in1
    net		Z-gate			mux2.8.sel
    net		Z-jog			mux2.8.out				halui.jog.2.analog
    
    net		A-jog-button	mux2.9.in0
    net		A-jog-knob		input.0.abs-z-position	mux2.9.in1
    net		A-gate			mux2.9.sel
    net		A-jog			mux2.9.out				halui.jog.3.analog
    

    The complete source file (Logitech Dual Action Gamepad – joystick axis lockout – custom_postgui-hal.odt) is over on the G-code and Suchlike page, so you can download it as one lump. It’s an OpenOffice document because WordPress doesn’t allow plain text files.

    I loves me my new joggy thing!

  • Improved Sherline Way Bellows

    What with all the milling going on lately, I decided to replace the crusty bellows on the Sherline mill. The previous design worked reasonably well, but I’ve had a few tweaks in mind for a while.

    Herewith, a PDF file with some Sherline Bellows – Improved:

    • Color coded lines so you know which way to fold them!
    • Unlined side up for a neat look
    • Fits on Letter and A4 sheets
    • Taping cuts and hints

    The PDF page size is about 8×10 inches; call it 204×280 mm. Print it without scaling and it should just barely squeak onto the sheet. If you don’t have a full-bleed printer, the tips of the sides may get cropped off, but you can extrapolate easily enough.

    Some assembly required:

    • Cut it out
    • Fold the central valleys (red) first, flatten it out again
    • Fold the central ridges (blue) next
    • Pleat the whole thing into a half-inch tall stack
    • Squash it into a neat package to harden the folds
    • Fold the tips along one side
    • Fold the tips along the other side
    • Squash the folds again
    • Make the saddle cuts & fold the tabs
    • Apply double-stick tape as noted (some on back)
    • Install on your cleaned-up mill
    • Admire!

    The tip folding is the trickiest part. Basically, flip the first tip from a ridge to a valley, then chase the little transition folds into place. Repeat for each tip along that side, then do the other side.

    It gets easier after you fumble around for a while.

    My nimble-fingered daughter has offered to fold ’em for you. Stick a few bucks in an envelope and mail it to me; we’ll mail back two folded sets (two each, front and rear bellows) for your amusement. Kid’s gotta earn her college money somehow…

    Address? Go to the QRZ.com database and search for my amateur radio callsign: KE4ZNU. Cut, paste, that was easy.

    For the do-it-yourselfers, start with the PDF file in the link above. That’s the easiest way to get the correct scaling. The tabs on the ends should be 4.0 inches across on the printed page.

    Rear Bellows
    Rear Bellows
    Front Bellows
    Front Bellows

    Here are some 300 dpi PNG files, but you’re on your own for scaling.

    If you want the original Inkscape SVG files, drop me a note.

  • TLC5916 Minimum LED Current

    The TLC5916 datasheet seems to say that the minimum regulated LED current is 5 mA, but that’s painfully bright at, say, 12:08 in the early morning. Indeed, those 3-inch blue LED digits lit up the entire house from the living room… sometimes, a high-efficiency LED isn’t what you need.

    This graph from the datasheet suggests that the current can be somewhat lower:

    TLC5916 Current vs Rext
    TLC5916 Current vs Rext

    With that in mind, I replaced the 1 KΩ resistors with 3.9 KΩ parts.

    The graph says the maximum current should be around 5 mA and, indeed, the formulas indicate 4.7 mA. The minimum current is a paltry 0.4 mA: lo and behold, the early morning illumination became bearable. After I put the LEDs behind some dark-gray polycarbonate, it’ll be just about perfect.

    If it’s too dark, I can always solder another SMD resistor atop the 3.9 KΩ chips.

    I figured out how to compute Rext somewhat more easily than the datasheet would have you believe and documented the process there.