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

  • Phone Charger: PowerPole-to-USB Adapter

    I have a Virgin Mobile Kyocera Marbl phone, for reasons discussed there. It’s sufficiently nonstandard that the “fits most phones” headsets and chargers don’t. In particular, I have yet to see a charger with the proper adapter dingus for this phone.

    Fortunately, the charger is rated at 5 V @ 350 mA… that’s easy enough.

    Phone charger with Powerpoles
    Phone charger with Powerpoles

    Cut the charger’s cable in the middle, more or less, and install Anderson Powerpole connectors. The standard color code for 5 V is white / black; don’t use red / black for fear you’ll eventually plug it into a 12 V source and toast the phone.

    The charger wires are most likely a far smaller gauge than the 15 A (!) connector pins prefer, so strip the conductors twice as long, double the ’em over and perhaps add a short length of multistrand hookup wire to fill out the barrel before you crimp it.

    Check the polarity before you poke the pins in the housings: you want the +5 V pin in the white housing!

    I aligned the housings to match the ARES / RACES standard, as described there, as that’s what I’ve done with all my other Powerpole connectors. If your phone expects some weird-ass voltage, maybe you want to make certain it can’t possibly mate with anything that’ll kill it stone cold dead. Oh, and in that case pick a suitably different color. Blue seems to be the standard for 9 V, at least in the ham radio arena, for whatever that’s worth.

    Add heatshrink tubing for strain relief (it might slip over the finished pins if you forget), wrap cold-vulcanizing rubber tape around the whole connector for more strain relief, and you’re done. It’ll make your charger cable resemble an anaconda eating a pig, but that’s OK with me.

    USB charger to phone cable
    USB charger to phone cable

    Now the phone can commune with a bench power supply, a bulk 5 V supply, or nearly anything that you’ve hacked into using Powerpoles. It’s your job to make sure the voltage matches up!

    Now, if you haven’t already, make a USB-to-Powerpole adapter. Alas, even though the phone uses 5 V, it draws too much current to charge directly from a standard USB port. However, I have a Black & Decker Pocket Power battery pack with a regulated USB outlet that can allegedly supply 250 mA and seems to handle the phone just fine.

    So: cut a spare USB cable, verify that the red conductor is 5 V and the black is common (hell hath no fury like that of an unjustified assumption and we’re dealing with bottom-dollar suppliers here), crimp, align housings, add strain relief, and try it out.

    This should work for any phone with a dumb, bulk-power charger. If you cut the cable and find three conductors, solder that devil back together again; there’s no telling what’s passing along that third rail!

  • Where To Put Too Many Clamps

    Clamp storage plates on floor joist
    Clamp storage plates on floor joist

    Not in a drawer, that’s for sure…

    Whack a narrow rectangle from some random scrap of thin wood-like substance, squirt hot-melt glue along one edge, stick it to the floor joist over your tool chest, align it pretty much horizontally, take two deep breaths while the glue solidifies, then neatly affix your clamps.

    Repeat as needed when you get more clamps: you can never have enough clamps!

    The red-handled spring clamps on the far right hang from a row of nails where, this being directly in front of my tool cabinet, they don’t quite knock me on the head. I really wish the original owner of this house had sprung for one more course of concrete block; another nine inches of headroom would have been just ducky.

  • Byonics TinyTrak3+ GPS Power Control

    GPS power from MOSFET relay
    GPS power from MOSFET relay

    The Byonics TinyTrak3+ GPS encoder has a “Power Control” output that can switch the power to a radio or GPS interface. J6 provides the interface: pin 1 = common, pin 2 = high active.

    With the “Power Switch” option enabled in the config program, you can set the number of seconds to allow the GPS unit to get up to speed before the next scheduled transmission.

    I glued a surface-mount MOSFET relay to the back of the PCB with urethane adhesive; it fits neatly between the DIP microcontroller’s pins with one output lead soldered to the 5V pad of J7. The other lead goes to the center +V pad; because the relay uses back-to-back MOSFETs, the polarity doesn’t matter.

    That replaces the normal solder bridge across J7 that provides power (on pin 4) to the GPS2 plugged into the DB9 connector. When the relay’s on, it connects the GPS to the power supply. When it’s off, the GPS goes dark.

    The relay input is an LED with a forward drop of 1.3 V max and requires 4 mA to turn on: figure 3.7 V / 4 mA = 925 Ω max. I kludged an 890 Ω resistor by paralleling (stacking!) 1.5 k and 2.2 k resistors; you could probably use anything near that and it’d work fine.

    The relay is an OMRON G3VM-21GR1, part number A11171 from Electronics Goldmine, but I suspect any teeny little solid-state relay would work. The max on resistance is about 1 Ω and the receiver draws about 65 mA. I measured about 20 mV of drop, so the actual resistance is a lot lower than the spec.

    I initially set the power-on delay to 10 seconds, which seemed to be OK: the GPS (green) LED would blink a few times, then go solid. Alas, the warm-start spec for the Byonics GPS2 (see the GPS3 for details) receiver is really 38 seconds, average, and it was definitely producing bogus position data. So I set the delay to 60 seconds and we’ll see how that works; early reports indicate the coordinates still have plenty of jitter.

    [Update: 60 seconds is iffy. 90 seconds seems to work pretty well. A bit of rummaging says that the satellites broadcast their ephemeris data every 30 seconds, so 90 seconds allows for two complete update cycles. Maybe 100 seconds would be even better. Some old background info for Garmin hand-held receivers is there.]

    It’s obviously a tradeoff between accuracy and battery life. This is for use on a bicycle and, believe me, I don’t want to tote a huge battery!

    If the control signal was low-active, then you could use a cheap PNP transistor as a high-side power switch.

    The white/orange wire routes regulated 5 V through an otherwise unused pin to the homebrew interface that combines the GPS data with helmet mic audio. The tiny rectangle is a 1 µF cap that helps cut down digital noise. There’s no need for a connector on that end, as it’s wired directly to the interface circuit board inside a small enclosure.

  • Rattle-free Sherline Handwheels

    Knobless Sherline handwheel
    Knobless Sherline handwheel

    The standard Sherline mill comes with tapered plastic knobs on the handwheels, which is exactly what you want for a manual mill and what you don’t want on a CNC machine: they rattle like crazy during computer-controlled moves.

    Some folks contend the knob unbalances the handwheel, but I’m not convinced that’s a real problem. Their advice is to remove the entire knob assembly, leaving a bare shaft sticking out of the motor. Seems a bit extreme to me.

    In any event, shortly after I got the mill, I unscrewed the little retaining screw from the end of each knob, put all the parts in a ziplock bag, tucked it in my tool box, and have been rattle-free ever since.

    The metal shaft is entirely adequate for those rare occasions when I turn the knob manually, the graduated settings let me detect when if I’ve screwed up the acceleration (on a new installation) to the point where the motor is losing steps, and all is right with the world.

    Oh, that orange-barred white tape in front of the motor? That’s a reminder to keep the usual pile of crap away from the spinning knob. That little shaft can fling small objects a fair distance and makes a nasty tangle out of a misplaced red rag…

  • Arduino Library for (Old?) Optrex DMC-family LCDs

    Having determined that the existing Arduino LiquidCrystal library routine wouldn’t work for the Optrex DMC-16117 character LCD in my parts heap, I decided to modify it to meet the data and timing requirements mentioned in the datasheet. This is sufficiently slow and old that it should work for contemporary displays built around the Hitachi HD44780 and its ilk, but I certainly haven’t tested it!

    The straight dope on building an Arduino library from scratch is there, but there’s no need to work from First Principles here.

    Start by copying the library files (this FLOSS stuff is wonderful that way), renaming them, and changing all the LiquidCrystal strings to LCD_Optrex:

    cd /opt/arduino/hardware/libraries/
    cp -a LiquidCrystal LCD_Optrex
    cd LCD_Optrex
    rm LiquidCrystal.o
    rename 's/LiquidCrystal/LCD_Optrex/' LiquidCrystal.*
    for f in LCD* k*; do sed -i 's/LiquidCrystal/LCD_Optrex/g' $f; done
    cd examples
    for f in * ; do sed -i 's/LiquidCrystal/LCD_Optrex/g' $f/$f.pde
    cd -
    

    You could do that by hand with an editor if you prefer.

    Depending on how you’ve installed the Arduino files, you may need a sudo to make that work. Better, perhaps, to tweak the permissions for (at least) the LCD_Optrex directory & files therein to grant yourself write access.

    I created a sendraw4() function to send a single 4-bit nibble during the startup sequence, so add that to the private section of LCD_Optrex.h:

    private:
    void send(uint8_t, uint8_t);
    void sendraw4(uint8_t);
    

    The new code is in LCD_Optrex is shamelessly adapted from the existing send() function, minus the mode selection and 8-bit stuff:

    void LCD_Optrex::sendraw4(uint8_t value) {
      digitalWrite(_rs_pin, LOW);
      digitalWrite(_rw_pin, LOW);
    
      for (int i = 0; i < 4; i++) {
        digitalWrite(_data_pins[i], (value >> (i + 4)) & 0x01);
      }
    
      digitalWrite(_enable_pin, HIGH);
      digitalWrite(_enable_pin, LOW);
    }
    

    If I were doing this from scratch, I’d use d7 through d4 rather than d3 through d0 to match the datasheet, but that’s a stylin’ thing.

    Replace the existing LCD panel setup code with an exact mapping of the datasheet’s procedure. For the 4-bit setup, it goes a little something like this:

    delayMicroseconds(16000);       // mandatory delay for Vcc stabilization
    sendraw4(0x30);                 // set 8-bit mode (yes, it's true!)
    delayMicroseconds(5000);        // mandatory delay
    sendraw4(0x30);
    delayMicroseconds(200);
    sendraw4(0x30);
    delayMicroseconds(40);          // command delay
    sendraw4(0x20);                 // finally set 4-bit mode
    delayMicroseconds(40);          // command delay
    
    command(0x28);            // 4-bit, 2-line, 5x7 char set
    command(0x08);            // display off
    command(0x01);            // clear display
    delayMicroseconds(16000);
    command(0x06);            // increment, no shift
    command(0x0c);            // display on, no cursor, no blink
    

    It seems you cannot use the delay() function in the constructor, as interrupts and suchlike aren’t active. The delayMicroseconds() function disables & enables interrupts; I don’t know if that is a Bad Thing or not.

    The 8-bit initialization code, which I haven’t tested, doesn’t need the sendraw4() function, but does need the same alterations. Apart from enabling 4-bit mode, of course.

    Various commands have different timing requirements, as shown on page 39 of the DMC16117 datasheet. Add a delayMicroseconds(16000); to the clear() and home() functions, then add delayMicroseconds(40); to the send() function, like this:

    void LCD_Optrex::clear()
    {
      command(0x01);  // clear display, set cursor position to zero
      delayMicroseconds(16000);
    }
    
    Optrex DMC16117 Instruction Timing
    Optrex DMC16117 Instruction Timing

    With all that in place, fire up the Arduino IDE and compile one of the example programs. That will build the LCD_Optrex.o file, too. If you have such a display, either wire it up as indicated or change the example code to match your connections.

    What should happen is that the LCD should initialize correctly under all conditions… how’s that for anticlimactic?

    Here’s an OpenOffice document with LCD_Optrex.h, LCD_Optrex.cpp, and examples.txt all in one lump: LCD_Optrex Library Files.odt. Save each section as a separate flat-ASCII text file with the appropriate name in the right spot and you’re in business. I’d present a ZIP file, but WordPress isn’t up to that.

    Memo to Self: A function to write a 16-character string to the stupid 16-character DMC16117 which has a single row that’s addressed as two 8-character lines would be nice. That requires keeping track of the current cursor position, which could be tricky. Maybe I should just scrap those suckers out?

  • Sherline Collet Pusher Tweakage

    Better-fitting pin & redrilled hole
    Better-fitting pin & redrilled hole

    My simple collet pusher has been working OK, but the locking pin was a few mils too small for the hole in the spindle and eventually put a burr on the edge. The fix is straightforward, although I’ve been putting it off for far too long; I warned you about this in the original post.

    Shoemaker’s child, anyone?

    The locking hole in the spindle starts life at 0.094 inch. I grabbed a #40 drill in a pin vise and drilled it out to 0.098 by hand, which wasn’t nearly as difficult as you’d think, took out all the deformed metal, and didn’t even leave any burrs. Ditto for the hole in the collet pusher.

    My heap yielded a defunct #40 drill, from which I cut 15 mm of shank with a Dremel abrasive wheel. Chucked the shank stub in the drill press, spun it up, and applied a Dremel grindstone to put a very short taper and a nice smooth end on it.

    Pulled the old pin from the handle I built a while ago, added a dot of urethane glue to the new pin, and squished them together (tapered end out!) in a vise until cured. Done!

    No, that’s not a burr on the hole in the pusher…

  • Remote Control Button Shield

    Button shield in place
    Button shield in place

    Mary was giving one of her vegetable gardening presentations and had the projector go into Mute mode all by itself. It’s hard to debug something like that under pressure, but (as nearly as we can tell) the projector’s remote control (!) got squashed inside the tote bag and managed to tell the projector to go mute itself…

    The remote control has buttons that stand proud of the surface by about 2 mm and, worse, they’re exposed from all sides. There seems to be no way to turn the mumble thing off, other than by removing the batteries, so I conjured up a quick-and-dirty button shield. Not the fanciest thing I’ve ever made, but it’s sufficient for the purpose.

    [Update: Apologies to all you Arduino fans who think this should have something to do with a remote-control circuit board plugged atop a Diecimila, but I think the Arduino designers could have picked a more descriptive term than “shield”. Plenty of folks seem to arrive here by searching for the obvious keywords and go away unhappy. If you’re looking for Arduino stuff, click on the obvious tag in the right-side column that’ll call up everything I’ve written about on the subject… ]

    Sizing the perimeter
    Sizing the perimeter

    I thought about making a tidy form-fitting slab that would fill the entire space between the button matrix and the case, but that gets into curved edges and fussy fitting; fortunately, I came to my senses. Without wanting to make a prototype to get the second one right, I simply trimmed the outside of the polycarbonate slab to a ruthlessly rectangular 33×50 mm. That gives about 2 mm clearance on each side of the button matrix and fits with about 1 mm clearance from the case. The lengthwise dimension is what it is.

    The 29×46 mm pocket must be about 3 mm deep to clear the button tops.

    The G-Code came from the Hugomatic pocketRect2points generator, which worked just fine; normally I hammer out my own G-Code, but I was leaving on a trip the next day. The cut depth of 1 mm per pass was probably too conservative. A cutting speed of 300 mm/min with a 2000 rpm spindle worked reasonably well with water cooling.

    Pocket milling with water coolant
    Pocket milling with water coolant

    A 1/8″ end mill produced corner radii that matched the buttons fairly well, which means it took a loooong time to chew out the pocket. The picture shows the mill knee-deep in a pool of water and swarf; I vacuumed the chips out at the end of each pass and added more water.

    Double-stick tape held the polycarb & sacrificial plate to the tooling plate, which worked surprisingly well given that I just wiped the grunge off and squashed it down. A machinist’s square aligned the rectangle closely enough and, of course, I used the laser aligner to set the coordinate zero to the left-front corner.

    For lack of anything smarter, a rubber band holds the shield in place on the remote. I thought about fancy hinges and Velcro and stuff like that, but the projector is used by non-technical folks and, as nearly as I can tell, the remote control never gets used at all.

    Quick and dirty, indeed: about two hours, first doodle to snapping the rubber band, including a bit of time wasted on an ancient G-Code generator that spat out bad coordinates.

    Plus time to write this up, natch…