Monday, July 29, 2013

Useless Machine

I've finally decided what my next project will be: a Useless Machine!

You can google either this kind of machine pretty much anywhere.  There are lots of examples.  I got intrigued by these in the early goings of my electronics revival, but was put off by the price of servo motors.  Putting a good amount of money into a servo motor just to be useless would irk me.

This blog is still under construction...

Motor

The basis will be a motor drive that I ripped out of a  printer.

I'm pretty sure this is a combination of a motor and quadrature/optosensor that controlled the page feed mechanism of an H-P printer.  (In the photo above, you can barely see the quadrature photosensor slits at the top right.)  I'm guessing it's an H-P item, because H-P printers have these quadrature things everywhere, connected to simple DC motors and used for measuring distance across the page on the printer carriage.

The motor is small and drives a wormgear.  By following the PCB tied to the motor, I found that the orange and blue wires control the DC motor, and after a bit of testing, I found that it can run at 6VDC in either direction.

In the picture above, the orange and blue wires connect to the two wide leads on the left.  They appear to cross a surface-mounted capacitor, and then connect to the big, fat blobs of solder that hook onto the actual motor.

The rest of the connection points relate to the optosensor assembly, and I'm not touching them.  I'm guessing they have Vcc and Gnd, and then the other two provide output lines that will indicate the states and transitions of the two optosensors that form the quadrature signals.  When I get there, I have to remember to test the three resistors at the top of the page to see what they do.  I'm guessing one is for preventing too much current from getting to the light-emitting (maybe IR, maybe visible) diode, and the other two are pull-up or pull-down for the return signal.

The wormgear connects to a large-diameter gear, which is fused to a spur gear on the same axis.  As such, the speed of the motor is stepped down twice, once in the wormgear motion, and a second time by the large gear-to-spur gear ratio.

I have no idea how much torque I'll get from this.  It probably could have handled a decent amount of mass in the past, but also was geared down further in the original assembly.

Switch

Most Useless Machines are based on hitting a toggle switch.  I dug around in my box o' goodies and only had one that was really beefy, and I was concerned that it would take too much force for my motor to move, especially since the spur gear would be on the losing end of leverage once it's connected to an arm.

Instead, I found this one, which seems to take less force to push.  It's a rocker switch, and I'm not sure if that will cause any other problems, like slippage when the arm hits the switch.
From the side profile, you can see into the workings of the switch.  When the switch is pressed down on one side, the metal tab is raised up on that same side, and another metal tab snaps down on the opposite side.  In the profile shot shown here, the connection is open, because the metal tab is up and visible in the left hole.

Also, in this form, the switch is only a Double Pole, Single Throw switch.   There are tabs on both sides so that when the connection is closed, there's a current flowing from the center tab to the one on the left, both front and back.  So, I could tell when the switch was "on" through two closed circuit connections, but could not tell when the switch was "off", and I'd need that to retract the motor.

What I wanted was a Double Pole, Double Throw.  Fortunately, the physical mechanics of the switch allowed for it.  I just didn't have tabs under the side that would let me know the switch was "off".  In inspecting it further, I also found there were holes under that side that might give me a shot at establishing a connection.
I dug around again through various sets of screws until I found ones of the right diameter such that I could get them to self-tap into the hole.  I also made sure they were made of a conductive material.  The first ones I chose were too long, though.  If inserted too far, they would prevent the switch from operating.  After a bit more digging, I found ones that were the right length.  I also found a green grounding wire with circular clamp connectors already wired onto them, so I could cut that in half and one for each of the sides of the switch.

Wiring

I figured the logic is just a 2x2 logic diagram like the following.  You have a double-pole, double-throw switch, and you have a contact switch (CS) to shut off the whole device when the arm is down.  The logic:
CS up (open) & switch ON = extend arm
CS down (closed) & switch ON = extend arm
CS up (open) & switch OFF = retract arm
CS down (closed) & switch OFF = do nothing, system is off and now power is being used.

This assumes the system will hit the contact switch upon full retraction of the arm; the contact switch will go into an open state as the arm is being raised; and the arm will hit the "off" switch at some point as it's being raised.  Hitting that "off" switch is the whole the idea, right?

Here's the initial circuit diagram sketch.  The "OFF" and "ON" labeling of the motors is a little weird, because of how the tabs under the rocker switch are opposite from the labeling.

Laying out the same diagram in a more appealing way, you get this:
As such, when the rocker switch is on, you get this:
thus connecting V+ to Orange, V- to Blue, and the motor turns.

But when the rocker switch is off, you get this:
So when the rocker switch is OFF, if the contact switch is also making a connection (switch is closed when "up"), then you get V+ to Blue, V- to Orange, and the arm retracts.  But when the arm fully retracts and causes the contact switch to open, and the circuit draws no power.

The worm gear assembly holds the arm in place so the spring force of the contact switch arm should not cause it to auto-open again.  (If needed, I can add a capacitor somewhere in here to slowly drain and still feed the motor for a little while after the contact switch closes, too.)

I've seen some diagrams showing a regulator that's used to step down some higher voltage (e.g., 12VDC) to the required range for the motor, and that could be put into the system in place of the batteries.  But for me, I think I'll go with a cheap 4-pack of AA batteries.

As such, the wired-up motor assembly looks like this.  (In this picture, the battery is disconnected, else it would run the motor since the contact switch is "up".)


Testing it by hand is a little complicated.  You have to remember to hold the contact switch in its "down"/open position, and release that switch manually after you switch the rocker to an ON position, simulating what will happen physically as the arm goes up.

Arm connection ideas

I'm intending to latch onto the spur gear in some way.  I don't think I have the full gearing assembly that would allow me to reassemble the original gears of the paper feed in the right way.  I might, but it's not worth searching.  I think I might instead laser-cut a thing I'll call the "hub" that goes around the spur gear, and then let other things join to it.

The spur gear I'll be enveloping is 9.74mm outer diameter, and has 16 teeth.  I'm using various resources to determine how to measure a laser cutter's kerf, compensate for that kerf, and generate gears with the right dimensions.

The hub can have as much as a 16.35mm outer diameter, and only needs a hole inside of it that fits snugly around the spur gear.  But, I'm also going to drill/cut holes into it so that I can attach the UM arm to it.

Since I'm laser-cutting it, I could also make the hub less massive, using four arms instead of a full cylinder.  That's how I've seen adjustable spindle mounts shown, and that's what seems to be on the end of servo motors.

The UM arm will have the same "gear hole" as the enveloping cylinder, and will have the same drill holes.  I'll probably make it out of some less massive material, but something strong enough to push the "off" button of the UM.  I think I'll either use 5mm ply or 3mm acrylic.  The front of the arm will need to have something strong attached to it, and I'm not sure how I'll get that.

I might need something simple like a rubber band strapped across the end so that it has friction to push the rocker switch.  Other UMs are pushing a simple toggle switch, so the force is more direct, and less prone to slippage.

Printed Circuit Board

I was getting all psyched to make my own PCB using laser print / iron transfer / etching.  So, I fired up Inkscape to draw the circuit.  As a quick starting point, I began with a drawing of a simple perf board, using 2mm-square copper pads, and 1mm circular holes within the pads.  It looks like this:
Pretty basic, right?  In Inkscape it's pretty easy to do, but you have to use the data entry fields to make one square exactly 2mm, then put one white circle in it, exactly 1mm x 1mm, and center them up, and group them.  Then, duplicate and set the X and Y locations specifically, 2.54mm at a time.  Keep on duplicating and offsetting sets of these, and you get a whole perfboard (and a cool optical illusion, too).

So then I started laying out the pads and labels the same way as the pencil sketches.

But after I'd done that, I realized that keeping the pads in the same positions as shown in the sketch was not necessary.  That is just forcing the physical layout of the switches and such onto the board.  So instead, I followed the connections, trying to keep the pads proximate where there are connections.  I ended up with this:
I can rotate the pin assignments counterclockwise twice, and end up with an even simpler diagram:
In the end, it's a bit of a disappointment, though.  No fancy circuit diagram here.  It's just a bunch of bridged pins.  I can just attach two 6x1 connectors to a perf board and bridge the wires and be done.  That will be easy and way less likely to stain anything, compared to etching my own PCB, but I was a little sad because I had been looking forward to doing PCB etching chemistry.

(Yes, I could just solder the wires from switches to other switches and to a battery holder, but I want the components to be pluggable.)

When all was done, I ended up doing the wiring using screw terminals so that I could undo things easily later.


Figuring Out the Hub

I spent over two hours at the Tech Shop in Menlo Park yesterday cutting lots of things, and eventually forming the basis for the hub.

In prior laser cutting, I learned about how to cut gears, and how those gears, when meshed together, weren't meshing quite accurately.  That was because of "kerf", which is the material lost to the cutting process.  It was somewhat pronounced for the wooden gears that I cut earlier.

I made a little drawing that would cut 20 lines out from some material so I could see what was being lost.  Here's an idea of how it looks.  The little strips of wood in the middle are all bunched together, and the gap (here showing about 4 or 5 mm) can be divided by the 20 strips to get a rough estimate of kerf.
Kerf measurement on Tech Shop MP Laser #1 (45watt Epilog) using 1/8" plywood


To cut gears, I was using this site:
 makezine.com/2010/06/28/make-your-own-gears/
I used Inkscape as presented, but there are additional tricks.

Then, you have to understand the term "circular pitch".   The site listed above shows "circular pitch" as the distance between teeth on one diagram, and then shows Circular Pitch (p) = PI() / Diametral Pitch (P).  Above that formula, it shows that Diametral Pitch (P) can be computed if you know the number of teeth (N) and the Outside Diameter (Do) using the formula P = (N + 2) / Do, though it says that's approximate.

In the UM spur, we have 16 teeth, and an approximate outer diameter of 9mm.  Plugging that all in, I get:
P_in_mm = (16 + 2) / 9.72mm, or 1.85185... mm.
p_in_mm = PI() / P_in_mm
p_in_mm = 3.1415926536 / 1.85185... = 1.69646 mm.
p_in_pixels = p_in_mm / (25.4mm/in) * (90pixels/in)
p_in_pixels = 6.011078857 Inkscape pixels

Inkscape's menu appears to dumb that down to 6.0, and I'm not sure if it recognizes the remaining precision.  When it's done rendering you get this:


Compensating for kerf when cutting the UM gear hub

The next trick is that you want to get an outer cut line and an inner cut line in order to adjust for kerf.  I used the second set of instructions at
http://www.instructables.com/id/Laser-cut-Marquetry/step3/Compensating-for-Laser-Kerf-2/
to figure this out.  The instructions there aren't entirely complete, I think, so here is my full set of instructions:
1.  Select the gear
2.  Duplicate it to save it somewhere else, in case you make multiple of these (optional)
3.  Select the one you want to modify.  In the bottom left, you'll see Fill: Unset and Stroke: Unset.  This is because it's still "grouped".
4.  Select the gear and choose Object / Ungroup.  Now, in the bottom left, you'll see Fill: None and Stroke: <black bar>.
5.  Set the stroke width.  Choose Object /  Fill and Stroke... and then click on the "Stroke style" tab
6.  Enter the kerf size in the Width field, and remember to choose mm as the unit.  The interface is fussy sometimes, so you have to click another tab for the value to be applied, and it's a good idea to go back and check to make sure the value you wanted is in there.  Keep trying.  Eventually it sticks.  Depending on how much you change the value, the change in the visual rendition may be subtle.
7.  Now break it apart.  Before you do that, you might select your gear and click on the tool, and you'll see the individual vectors defining the gear like this:


Select the gear now using the regular selection tool , and choose Path / Stroke to Path... Now, if you use the tool, you'll see it's been broken up quite a bit like this:

so now there's an outer edge and an inner edge.

8.  Next you separate the inner and outer edges.  Select the gear using the regular selection tool again, and choose Path / Break Apart...  The whole thing turns black, but that's because you now have two objects, both with black fill, no stroke paint.

9.  Fix up the paint, so go back to the Fill and Stroke pane and its "Fill" tab, and choose no fill


(which makes the whole black pair of gears disappear, but don't worry...)
and then go to the "Stroke paint" panel and choose the solid box for "Flat color"

 and finally go to the "Stroke style" tab and enter a minimal stroke width, like 0.01mm


You should now see two gear edges, one inner, one outer.  Each is separately selectable.

The inner edge is the one that you use for creating a hole, and the outer one is the one you use for creating a gear.  (Same applies for other marquetry that's not related to gears, as long as you know the right kerf settings to use for different types of material.)

One thing to note at this point: Inkscape's functions for doing this are not precise, at least not precise enough for those pixel-perfect among us.  Here's a zoomed-in view of the result, and you can see some jaggedy edges that really should be smooth.


The whole thing should be governed by gear formulae, so other tools for gear generation might be better, and there probably are ways to fix Inkscape's code to generate the gear's edges in one go by taking the the Gear module source and fixing it.

The other thing to note about gear drawing is that if you save as .svg and import into CorelDraw, at least into the x5 version I was using at the Tech Shop, it would get some really ugly results.  Sometimes you'll see a quarter of the gear missing, and often you'll see vectors zooming off to distant lands.  I'm guessing gears are defined with cubic-splines, and there's a difference of opinion about how the Z (closure) code in SVG is supposed to be interpreted, but that might only explain a part of the problem.  Somewhere between Inkscape output and CorelDraw input, there's significant disagreement about the SVG standard.


Back to Laser Cutting the Gear Hub!

So at this point, I found that the wood-cut gears at this resolution were generating a lot of ash, and shifted to acrylic.  I had both 1/8" and 1/4" (6mm) acrylic to use.  So I made a pattern with a variety of kerf widths like this in Inkscape.  I had kerf measurements at this point, but opted to do some empirical testing.
I separated the inner from the outer gears, and cut both out of the 1/8" acrylic and got this:

The top edge is the set that actually cut gears out, and the bottom set is different holes that those gears could fit into.  That allowed me to test for fit to see whether any of those came close, and the 0.3mm hole fit quite snugly on the UM motor.


I then went to the 1/4" acrylic and did the same.  The intent was to create the "hub" using the thicker plastic and use some holes that could be used for attaching the arm.

From there, I went about building the hub.  That amounted to moving the 0.3mm "kerf gear hole" to the origin in Inkscape, and then building a circle around it.  I'd measured and figured a 16.3mm radius would just fit.  That allowed me to add some extra holes at specific locations within the hub as mount points.  When done, I grouped it all up and put it onto the page for cutting.  The result was a nice hub that fits nicely onto the spur gear.

At this point, I was close, but not quite done.  First, the 1/4" acrylic hub is looser than the 1/8" acrylic, even though they're using the same gear hole.  It's likely that's due to different kerf for different materials, or because I had to use two cutting passes to get through the 1/4" acrylic.  I'm not sure if I'll bother to fix that.

The second problem, though, was that the hub was running into the metal plate that covers the motor assembly.  So, I needed a little bit of room to lift the hub higher.  I resorted to the Dremel to cut out and sand down one of gear holes from my 1/8" acrylic, and formed a little spacer.  This will go under the hub.
Later, I added a few drops of epoxy to the spacer, set the hub atop it, and and held it together, so the spacer, and hub are attached.  Then, I screwed an arm onto it, so it's all held together.  The only thing left is finding a way to keep it from falling off.

The Box
I spent 2+ hours at the Tech Shop cutting up the pieces for the UM box and arm.  The handy things to know are the Corel Draw features for
- setting up specific sizes (use the data entry fields in the top left, and be sure to turn off the "maintain aspect ratio" constraint), and adjusting sizes for kerf
- adjusting for how Corel Draw likes to use the center point of objects as the object's origin -- a pain
- the "C" and "E" keys for centering objects, plus the Undo ctrl+Z if you choose the wrong one
- undoing the usual Snap To... function
- welding to build out the joining tabs (select multiple objects, choose the weld icon)
- the opposite of welding for cutting slots
- rotating 90 degrees to get exact dimensions for adjoining pieces
- mirroring objects so that you get the right material face on opposite ends of the box

Pictures:

Full box with original motor for scale.  Note that there are two test boards for containing the switch at different points, so I could test various configurations.
These are the individual pieces
Box assembled with the three-slot test board
 The way I built the box has tabs connecting the sides and bottom, but the top is loose.  I wanted to do that for a clean look, but now I'm not sure how the hinge assembly will work, unless I make the hinge visible on the exterior.

For the arm, I drew up an arm and roughly cut it with a Dremel tool before going to the laser cutter. You can see the rough pencil markings.  Definitely, this is not engineering with CAD tools.


Then, I scanned the arm in to a normal .jpg file along with a ruler so I could be sure dimensions were accurate.  I used Corel Draw's Import function to pull in the image, and then traced a polyline atop it.

I think there was one tricky part where I had to select all the segments and run the Smooth function on them, thus turning them into curves, where before I had a polyline.

Then, I overlaid a circle and welded it to the curves to get a really nice hub point.

I made a couple of copies with varying "finger" widths.

I didn't have time to laser-drill the pilot holes to match exactly with the ones I had on the hub, so I just drilled those by hand later, and found some wood screws that fit.  From there, I just had to bodge things roughly into place such that the arm could hit the Off switch somewhere in its movement path.  I also checked to make sure that in its retracted position, it would fit inside the box, including room for it to hit the contact switch.


Laser-cut arm placement with Off switch down.
The motor assembly was loose so I did end up cutting away some of the original plastic tabs, and used those holes to screw it onto an extra piece of wood that I had.  That piece of wood was actually a failed cut for the box, one where I'd not accounted for the tabs, but as it turned out, that made it the perfect size for fitting on the inside of the box.  I then glued that whole assembly to the back wall so that the motor would not fall over any more.  If I don't like it later on, I can unscrew the motor assembly and recut the boards.

For the bottom of the box, I found that I'd need to raise the contact switch up a bit, and position it about half way deep into the box.  I found a scrap piece of 1"x1" wood, cut it to length, then screwed the contact switch to it, and glued the wood to the base.

Separately, I checked and found that there's enough room for the battery pack, so I'm good there.

Final assembly(?)

Here's are the "finished" pictures.  It's not really, truly done, and I think finishing it for good will take more work than I'm willing to put into it.  The problem that remains is that the arm, though glued onto the motor gear, ends up moving the motor's main gear a bit when it gets into a strange angle, and that causes sufficient tension that stops the whole device from working.

The outer box is held together by rubber bands so I can undo things if I want.  This picture was taken before I moved the batteries inside the box.
Most of the time, the switch operates as expected, but when it fails, I end up having to wiggle the box a bit to loosen it up, and then it starts working again.  I tried various ways to add tension to keep the gears from coming loose.  I added foam to push against the system, and tried something akin to a bearing.  I tried drilling a hole in the front panel (seen in the picture above) and added an adjustable wood screw to provide an adjustable amount of tension.  But still it doesn't fully work.  It may be that using a worm gear drive just isn't the way to go for my UM.

The innards look like this.  This is the view from above.  It's a little hard to see, but I've hot-glued a chunk of foam onto the contact switch.  That makes for an earlier and more sure response from the switch.  Before I had that in place, the lowering of the arm would miss the switch sometimes, and sometimes I think it would over-compress the switch.
The next picture of a view from the back with the back panel down.

It's not shown here but I finally put the battery pack inside the box.  It's running on about 15VDC using a 9V battery in series with four AA 1.5V batteries in a pack.  I found that at lower voltages -- 9V or below -- the arm moved more slowly and didn't have enough force to click the Off switch.  I've also seen some failures at 15VDC when it would try to click the switch too close to the edge.  It works better when it clicks nearer the middle, which is a bit of a surprise for me, since I'd have thought it would have greater leverage towards the edge.  I didn't try at 12V.

I've decided I will not glue the whole assembly together because of how the system actually benefits from the looseness.  In a more precise assembly, I think I would be able to hold things together firmly.

Finally, here's a video of the machine in action.  I edited out the part where clicking the switch failed.  But I'm glad I could capture some instances where multiple clicks worked. 

<< Bummer... Blogger isn't uploading my .avi or .mp4 file! >>

Useless Machine v1 was a pretty good prototype experiment.  Some thoughts on where I might go next with it:
- Learn how to create a mold from the main gear, and how to run the injection mold machine to make copies.  With those, experiment with other ways to add tension and get consistency.
- Re-cut the front panel so I don't have the hole I started with.  Maybe engrave it with a nice logo.
- Create a v2 UM with a more solid DC motor driving a worm gear, and having the worm gear connect to a pivot arm in a more predictable build and with channels that prevent the arm from straying off course.
- Figure out a hinge mechanism
- Re-cut the top panel so that the arm moves with the grain of the material.  Right now, it moves across the grain.
- Re-cut the box using acrylic
- Make a super-sized UM

But maybe instead I'll do something else.  I'm having some thoughts about making an Arduino-based thing that gets plugged into the wall and tracks current usage, and sends a text message alert if something has been plugged in too long and is still on.

Wednesday, July 3, 2013

Laser experimentation

Following the laser driver assembly (aka DDL circuit), and load testing circuit examples at http://www.rog8811.com/laserdriver.htm

Soldered the load driver board like this:
<picture>

Learned I really don't do solder bridges well, and I really should use a different solder tip for doing soldering vs. desoldering.

I used two 1 ohm 5w resistors, wired in parallel, rather than the single 1 ohm resistor called for in the diagram.  The wattage these can handle is way higher than needed, but they were handy because I'd gotten a bunch in bulk last time I was at Halted.  But why two?  Because I measured them and they came out to be 1.7 ohms.  I put two in parallel and that brings things down to about 1.2 ohms.  This will factor into the amperage computations later on.  The way the web page describes the measurement, they figure voltage equals amperage, but that only works if the resistor is really 1 ohm.

The amperage I got was 1.7 ohms.  So by putting two in parallel, the formula is
(1 / R1) + (1 / R2) = (1  /Rtotal)

(1 / 1.7) + (1 / 1.7) = (2 / 1.7) = (1 / 1.176) = (1 / Rtotal)
thus Rtotal = 1.176 ohms.  The ohmmeter, when run across the resistors in parallel, bears that out.  I might be off by a little, since the ohmmeter isn't that precise, but it's way better than assuming 1 ohm when it's really 1.7.  Funny thing is, the bag was labeled "precision" resistors.  Maybe I just got the wrong thing in the bag.

Next: wiring the laser driver.

I got the main parts from Jameco:
LM317 part 23579 $0.35.  I don't understand why there are others of the same nature for $1.50.
100 ohm 25 turn pot = 853530 $1.75.  This is the most expensive piece of the puzzle.
RESISTOR,CARBON FILM,10 OHM,1/2 WATT,5%,(100 BAG) 659817, order 10 ($0.099 each, so say 20 cents)
16057329

I have the a 10 ohm 100V capacitor, and a spare 1N4001 diode still.  For the switch, I found something that's like an old keyboard switch in the bins at the Tech Shop, so I'll check that and should be able to use it.  Its pins are a little funny, so a little drilling might be needed.

Once I wire that up, the only thing left will be getting a 9V battery.  I also have to check the resistor -- whether I need 5 ohms or 10 ohms, depending on the kind of laser diode I'd be driving, and will have to plan space on the board accordingly.

7/3/13
Last night I built the driver circuit and the load tester circuit.
When I measured voltage across the 1 ohm resistor in the load circuit, all I got was a range from 6 mV to about 42 mV, this when driving the load across 4 diodes and the resistor.

I put the ammeter in series with the load instead, and got a reading of up to 80 mA.

Now either way, something seems amiss.  I should be able to get 125mA to 250mA, depending on the resistor (either 10 ohms or 5 ohms) that I put onto the laser driver board.  And, I should be getting matching voltage as driven amperage, but I'm getting different results.

Frustrated.  Going to mess with other things.