Sunday, June 30, 2013

Driving a Trapezoidal Lead Screw

With the motor shield assembled and stepper motors in hand, I ordered a number of mechanical parts and waited almost 2-3 weeks for everything to arrive. Some of the key parts in use are as follows:
It took an afternoon to cut/measure/assemble all of the parts.  Unfortunately I was thinking a bit too much in 2 dimensions when I ordered the parts, and did not account for the height differences that would come into play during final assembly.  In order to place the stepper motor and mated bearing at the correct locations, I cut down some scrap pieces of 2x4 lumber I had remaining from a different project -- a bit of a sloppy hack, but it worked fine.  The final assembly is shown below:




To drive the motor, the following code was uploaded to the Arduino board:


To my great surprise, everything worked as expected the first time the system was powered up.  The unit was a little noisier than expected, but I think that may be due to a slight misalignment of the flange nut and its associated vibrations.  In the future I'll try to track down a washer to install between the flange nut and plastic angle to reduce vibration and help compensate for the noise (building something a little more exact that a hunk of 2x4 wouldn't hurt either).

Next up will be to determine what to use for limit switches so that the unit can travel from end-to-end (and not just travel back-and-forth in a coded fixed length) - either a physical switch or a Hall-effect sensor are the likely final candidate.  I'll also need to determine some better wire quick connects to easily connect/disconnect the electronics.

Friday, June 7, 2013

Driving 12V Stepper Motors

With a motor shield fully assembled (see earlier post), it was time to connect up 2 x 12V stepper motors (purchased here) and see if the soldering job was all goodness.


The motor wires were connected in the order [RED, YELLOW, GREEN, GREY]. I guessed a bit on  the location of pin one for each of the terminal blocks.  Here is the final layout:


I drove the Arduino via USB (+5V), and the motors off of a separate lab power supply (+12V):


For the code, I kept the first scenario fairly simple;  Sample code from the vendor was borrowed and modified to alternate the motors, driving them both forward and reverse.  The code is below:


For this build, the impossible happened: everything worked the first time.  The next steps will involve figuring out some kind of drive mechanism to make the steppers do something productive (well, more productive then rotating two blue painters tape flags).  Since I have degrees in EE not ME, I'll need to spend a bit more time deciphering the right lingo for google queries (actuators, drive screws, linear bearings, etc., etc.)

Thursday, June 6, 2013

Assembling an Adafruit Motor Shield for Arduino

I guess my first clue should have been in the name "Adafruit Motor Shield Kit", but somehow my eyes rolled right over the last word.


The motor shield arrived as a PCB, 3 ICs, and a handful of passive components, meaning it was time to break out the soldering iron.  The kit assembled without too much trouble, with full assembly instructions online.  The online instructions appear to be for an earlier edition of the board, but it wasn't too hard to decipher the differences.

The only part of the directions that were unclear was a statement that "the four 'middle' pins of the L293D motor driver chips are tied to a large heat sink and thus may end up getting 'bridged' with solder as shown in the second image."  I wasn't sure if that meant you were supposed to bridge the pins, or it was just something that just may happen.  A little digging on the forums revealed that the pins in question are all GND, so it doesn't really matter whether they get bridged or not.

BEFORE


AFTER



I thought about showing you the outstanding soldering job on the back of the board, but decided instead to blame the camera for taking a poor picture, which has no relation to the high-quality soldering which actually occurred on this assembly.  I also installed a set of stacking headers in the extra provided through-holes, and cut them short on the back as they will not be used for stacking; since I've never worked with motors before, I'm guessing I'll have need of the convenient headers for debugging.

Next up will be the connection of the stepper motors and a sample sketch to get them moving, after of course reading the manual.