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

  • 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…

  • Camera LCD Sunshade & Magnifier: Part 2

    Lens end of viewer
    Lens end of viewer

    With the bottle formed & trimmed to shape, it’s time to mount the lens. This view shows the final result, with the camera body angled upward.

    The general idea is that the bottle cap already attaches securely to the bottle, so I can just cut a rectangular hole in the lid, make it just slightly smaller than the lens, and affix the lens inside with the planar surface facing outward.

    Two motivations for making the hole slightly smaller than the lens:

    • The lens has rounded corners, as it was cut from a 38 mm diameter round lens
    • It won’t stick out, get bumped, and fall off
    Lens opening cut in bottle cap
    Lens opening cut in bottle cap

    The first step was, of course, to make a fixture: a sacrificial wood block with a raised section that fits snugly inside the cap. I found a nice maple disk in the scrap bin, chucked it in the lathe, and turned a section to fit. I don’t have a dust extraction system, so I did this one-handed with another on the shop vac to suck up the swarf. Yuch, wood is dusty!

    That simplified clamping the rather slippery lid in place. It’s probably polyethylene that would slide away under heavy cutting loads, but with a 2 mm end mill that wasn’t a problem. The origin is at the center of the cap, directly atop the convenient injection-molding sprue button.

    The lens is 34.4×22.1 mm, so I cut a 32×20 mm opening using manual CNC. Given a 1 mm cutter radius, the G-Code looked something like this:

    #1=[20/2-1]
    #2=[32/2-1]
    g0 x[0-#1] y[0-#2]
    g1 z-2 f100
    x#1
    y#2
    x[0-#1]
    y[0-#2]
    g0 z30

    That’s from memory, so it might not work quite right. Basically, store the key variables in parameters and use those instead of mistyping a digit somewhere.

    The opening even has nicely rounded 1-mm radius corners from the 2 mm cutter…

    Cutting acrylic lens holder
    Cutting acrylic lens holder

    I added a sheet of acrylic inside the lid to hold the lens in position and provide a more glue-attractive surface. The lens opening here was a slip-fit for the lens: 34.5×22.2 mm. The G-Code looks pretty much the same:

    #1=[22.2/2-1]
    #2=[34.5/2-1]
    g0 x[0-#1] y[0-#2]
    g1 z-2 f100
    x#1
    y#2
    x[0-#1]
    y[0-#2]
    g0 z10
    Trimming outside of acrylic lens holder
    Trimming outside of acrylic lens holder

    The wood disk even had a convenient hole in the middle, making it easy to re-clamp the acrylic from the center with a stack of washers. The laser aligner made alignment easy: make the nut finger-tight, put the spot on the left edge near the front, jog to the rear, twist to split the difference, iterate a few times, then snug down the nut.

    Then the origin is halfway between the edges. Knowing the opening size, find one edge and touch off by half that amount.

    The cardboard lid liner was 43 mm in diameter, so I figured that would work for the acrylic sheet. Circular interpolation makes getting a precise diameter trivially easy, after you remember that this is outside milling so you must add the cutter radius:

    #1=[43/2+1]
    g0 x[0-#1] y0
    g1 z-2 f100
    g2 i#1
    g1 z30
    Finished cap with lens
    Finished cap with lens

    What’s not shown there is the blob of acrylic that welded itself to the cutter because I was taking picures rather than dribbling water on the workpiece to keep it cool. I hate it when that happens.

    But everything pretty much worked out. The holder was a snap fit inside the cap, just like it was supposed to be.

    I glue the lens to the acrylic holder with silicone snot (aka “adhesive” or “caulk”), let it cure overnight, snapped the cap on the bottle, and iterated once to get the lens properly aligned with the opening (the acrylic sheet rotates freely inside the cap).

    Viewer attached to camera
    Viewer attached to camera

    The end result is, admittedly, ugly on a stick, but the first reports from the user community are encouraging!

    We may add a dark cloth ruffle around the bottle cap as an eye shade and eyeglass protector, but that’s in the nature of fine tuning.

  • Camera LCD Sunshade & Magnifier: Part 1

    Viewer attached to camera
    Viewer attached to camera

    Mary take her gardening pictures with our Sony DSC-F505V camera, which has one compelling advantage for the job: the lens and body pivot, so you can take pix at odd angles without groveling in the dirt or hovering over the camera staring downward. Alas, it lacks an optical viewfinder, which means she does a lot of outdoor close-up photography peering into a washed-out LCD panel in full sun. Worse, she’s far-sighted and can’t see fine details without her reading glasses or bifocals, so it’s really hard to get proper focus.

    Something must be done!

    The general notion is to put an opaque shield around the LCD with a lens that magnifies the viewfinder. If you happen to have perfect near vision, the lens is optional and you can probably use one of the commercial sunshades that attach with hook-and-loop strips. That isn’t going to work for us.

    With inspiration from that project, I retired to the Basement Laboratory. [Update: a somewhat less intricate do-it-yourself project starting with a slide viewer. I suspect it works better for normal-looking cameras, not this one.]

    Raw material: rectangular lens and opaque bottle
    Raw material: rectangular lens and opaque bottle

    Rummaging in the Bottle Supply turned up a dark brown plastic bottle made from PETE, the same stuff that makes soda bottles, with a black plastic snap-cap lid. PETE has a glass transition temperature around 75C, which means you can reshape it with a heat gun (not, alas, a hair dryer). Actually, I found two bottles, so I have a backup.

    A bit of soaking in water, followed by a generous application of xylene, got rid of the label & adhesive residue. You can get xylene in small quantities as Goof-Off adhesive remover or just buy a quart at your local big-box home-repair store. Do the xylene part outdoors and don’t toss the rags in the trash until they’re dry.

    Further rummaging in the Lens Supply turned up a 34.4×22.1 mm plano-convex rectangular lens with perhaps a 100 mm focal length. Haven’t a clue where it came from, but perhaps from the Surplus Shed optical supply shop. Pretty nearly any lens with those general specs will work, so use what you have. You do have a box of lenses, don’t you?

    Putting the flat side of the lens close to my (distance-corrected, I’m nearsighted) eyeball and looking through it at the LCD from about 75-125 mmm produces a very nicely enlarged, distortion-free image. This will work!

    Bottle cutting and forming
    Bottle cutting and forming

    The bottle is much thicker than a soda bottle, but easily cut with a razor knife and a bit of care. I removed the bottom and measured the ID as 68 mm. The circumference is, obviously, 214 mm, which is a key dimension: it must fit around the LCD’s perimeter with a bit to spare.

    I made a wood mould block that’s sized and shaped roughly like the back of the camera around the LCD: Mr Block, meet Mr Belt Sander. This avoids the prospect of melting the camera with the heat gun, as it’s largely plastic, too.

    The block is 52×57 mm, for a perimeter of 218 mm, and a totally non-critical 38 mm tall (it came from a 2×4″ chunk of lumber). The pyramidal section acts as a forcing cone to persuade the bottle to stretch around the slightly larger block and become nicely rectangular as it does.

    Wood forming block
    Wood forming block

    Position the bottle over the block, apply the heat gun all around, and ram the bottle downward as it softens. Eventually the bottle will eat the block, even though it’s not completely happy about doing so, at which point you can concentrate on heating each side separately. The bottle will settle down and stretch neatly around the block, giving it a rectangular base with a smooth transition from the round top. The cut edge tends to curl outward in the middle of each flat side, so don’t overheat it.

    Cut the corners back so there’s about one focal length from the cap to the cut, then heat the side flaps (the shape is rectangular: get this right!) and bend them back. I flattened them against the bench to remove the curve. The top and bottom flaps will fit over the top and bottom of the camera and hold the whole affair in place.

    Trim the side flaps to a few mm, as they’ll just form a light shield, and shape them to clear the controls as needed. Form the top & bottom flaps to fit snugly around the camera and trim to fit; they cover up the buttons just under the camera’s LCD, but those aren’t used in normal operation.

    I used plain old electrical tape to hold the bottle in place, as anything thicker will interfere with the lens rotation. If you have a box-shaped camera, hook-and-loop may be your friend.

    That was enough for one day. Tomorrow: a bit of CNC work on the lid