Search This Blog

Saturday, May 21, 2011

New Board and Stepper Motors

    My breakout boards for the PIC18F2455 came from BatchPCB.com on Friday.  It looks a little wider than I'd hoped, but other than that, it is great!  Better yet, they sent me two for some reason.  Maybe because it was so small or due to the layout of the panel.  Here it is front and back.  Stencil came out crisply, too.




I soldered in the headers, added a cap, resonsator, and Pic, and voila!

It is really nice to have the labeled pins right on the board, especially the power pins!

    We had e-cycling this weekend, so I had to salvage whatever parts I wanted before all that priceless junk tech went bye bye.  I ripped apart an ancient scanner.  Among the other goodies, I pulled out a stepper motor.  I've never used one, so I thought it would be fun to play with.  I read up on using stepper motors.  A good place to start is: society of robots stepper tutorial.  Here is the motor:


    I was ready for 4 wire bi-polar motors; I was ready for 6 wire uni-polar wires.  This lil' guy has five.  A lot of Googling later, I figured out that it is a variant of a uni-polar stepper.  All four magnets share a common center tap.  After a lot of fiddling, I figured out how it worked.  The center tap will have half of the resistance hooked to any other wire as any other set.  All four end leads will have the same resistance between them.
    To figure out what ends go where, you need to do the following.  Connect the center tap to ground.  I used a nice low, 5 Volt supply.  Hook one lead to Vcc.  Ground the other leads one by one.  If the motor doesn't move at all, that lead is the opposite pole to the lead hooked to positive.  If it twitches clockwise, it is the "cousin" to the positive lead.  If you call the positively hooked lead 1A, the non-moving lead is 1B.  The clockwise twitching lead is 2A.  If it twitches counter-clockwise, that is the 2B.  These letter number pairs will line up to the stepping guides in the Society of Robots tutorial mentioned above.
   Going backwards was also a bit of a trick.  You need to invert either 1A and 1B's values or 2A and 2B's.  Doing both won't get you anywhere.
    I couldn't find *any* information on this motor.  Zero.  Zip.  Nada.  So I guessed and hacked.  I eventually hooked the center tap to ground, ran at 5V, and hooked the leads to a L293D clone.  I slowly increased the frequency from 250 to 1KHz.  I got nothing but twitches at 1KHz.  I settled for 750 Hz.  Even then, I get some rotation starting points that will just twitch.  I think 500 Hz would be more accurate.  I didn't have the stones ( or desire for magic blue smoke ) to try more voltage.

    Here is the breadboard layout:












Here is some code in assembly.  It makes the motor do a full rotation forward, pause 1 sec, rotate half-way backwards, pause, rotate half way forwards, pause, full rotation backwards, loop.

    That's a long way from a home made CNC router, but it was fun.

No comments:

Post a Comment