Saturday, April 16, 2011

Project 28 - Need Some Help - UPDATE

For those of you with access to the book and/or a better understanding of the Uno, I have a question - Figure 10-1 shows a wire running from what appears to be a numeral 9 near the 5V and GND wires at the bottom left corner of the figure. This wire goes into the positive power column/row at the top of the breadboard which then connects to the stepper motor.

On my Uno, this is labeled Vin (I think) - the author says to use external DC power for this project so I'm wondering if that's how power is being applied to the motor. It's just never been mentioned in the previous projects so I'm a bit confused.

Also... a bit of checking online reveals that the Uno wants a 9V AC-to-DC power supply adapter which I don't have... but I do have a variable one that can be set to 9V. The only problem is I cut off the end to expose the wires for the Make: Electronics book (so it can be plugged directly into the V and GND breadboard rows). I'm thinking I should be able to just plug in the Arduino to the USB for its own power needs and, while still running the 5V and GND wires from the Arduino to the breadboard for the chip's power needs (5v or less I'm guessing) I can just skip the "9" or whatever that is and provide power to the motor with my variable adapter's leads... right?

Update: And wouldn't you know I'd buy the one stepper motor that doesn't seem to have any kind of help in terms of data sheet when it comes to sorting out the six wires and what goes where! Argh...

15 comments:

  1. Although they are tied together on the Arduino and within the chip, you should also be sure to tie the grounds together on your breadboard as well...that is the ground from your wall wart and the ground plane of your Arduino should all be interconnected. This is accurately shown on the Fritzing diagram on page 208 as well. (Note the ground wire at row 19 on the diagram.)

    You want the grounds tied together because you want to equalize any stray variations in the ground potential. You want those differences to equalize through nice fat, beefy wires rather than through the tiny contacts that tie together pins 4,5, 12, and 13 in your motor driver chip.

    ReplyDelete
  2. OH, AND HRES THE DATASHEET http://www.ladyada.net/media/mshield/PF35T.pdf

    ReplyDelete
  3. Yes you are right.

    The VIN pin just transfer the direct power that you connect to the Arduino , or you can connect your power supply adapter directly to the VIN pin (+ connected to the VIN pin , and – connected to ground). If you want, you can bypass the Arduino and connect the power directly to the motor.

    ReplyDelete
  4. I think what you're trying to do is power the stepper motor through the arduino, as far as I am aware it can't do this, I haven't got the uno but I'd assume Vin is to power the arduino, what you want to do is to check out this page. See if it is any help:
    http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors
    Will

    ReplyDelete
  5. Chris, for some reason your 3rd comment got deleted - posting it here for you, but feel free to repost using your account name and I'll delete this:

    "
    OOPS, that one wont help much, see the Adafruit website for this instruction...

    "A great little stepper for small projects! This motor has a solid mounting plate, 'plain' and geared shafts, and Japanese-built construction. There are only 48 step (7.5 degree) per revolution, but the gear allows you to easily attach timing belts or a gearbox to control the resolution. A perfect first stepper motor and works well with the Motor Shield for Arduino which will let you microstep for smoother motion.

    To use with the Motor Shield, connect green and red together to ground (middle), brown and black to one motor port (say M1) and orange and yellow to the other motor port (say M2). So in order, thats: brown - black - red&green - yellow - orange. Then just use the example code that comes with the Adafruit Motor Shield library. Otherwise, you can also wire it up with some transistors and use the Arduino Stepper library"

    ReplyDelete
  6. Hi, Will.

    No, I'm actually trying to avoid powering the motor using the Arduino as the book suggests. There's a paragraph that says to use the AC adapter to feed power to the motor via the "9" port on the Arduino - I think that's an error in the diagram and is supposed to be Vin.

    Chris, thanks for that link - that's exactly what I'm looking for - once I understand the wire colors and what goes where, hopefully I can figure out the wiring of this stepper and how it all works with the chip. I had found that datasheet but, as you discovered as well, it's not that helpful.

    ReplyDelete
  7. Actually, what got deleted was part of my first post which talked about the mislabeled "Vin" pin on the Fritzing diagram on page 208. The diagram is labeled "9" instead of "Vin", I think this is an error in Fritzing that got copied over. I note that all of Mr. McRobert's Fritzing diagrams erroneously show the Vin pin labeled as "9v".

    You certainly can delete the wire running from the so-called "9" pin and connect your wall wart directly to the + rail on the top pair of the breadboard.

    OR, you can leave that wire in and still power the breadboard directly with the wallwart. In that case, the Arduino will DRAW its power from the wallwart via the breadboard, then use it's own regulator to power the uC.

    My caution about grounding referred to the fact that the top power rails should should be at Vin (your wall wart's voltage) while the lower pair of rails power the motor driver chip with 5v.

    Note that pins 4,5 and 12,13 bridge the ground rails, so technically the two ground rails are already bound, but McRoberts wisely includes a grounding bridge...the wire at row 19.

    The PF 35T seems to be a pretty common little stepper so it's weird that the data sheet is so hard to track down. I've already run it using the Adafruit motorshield, so I'd just wired it up in the order that Limor's tutorial suggests. I should have tried swapping around the brown/black and yellow/orange to see if that made any difference in the running of the motor, or if I'd just been lucky in connecting it right the first time. When I get to this project, I'll try that, but right now I've got my Arduino and breadboards tied up in something else. I need more Arduinos!

    This tiny editing window is really annoying and makes it hard to proof read before posting!

    ReplyDelete
  8. OK, I really should NOT be working on this today, but can't resist.

    I'm wiring up the chip and McRoberts shows pins 1, 9, and 16 all tied to 5v, but then he says 1 and 9 should be tied to 3.3 volts. Looking at the data sheet (I'm using the SN754410), it appears to me that the diagram is correct and that the text is in error.

    Jim I do need to thank you for keeping this blog. It has definitely shown me the value of "working in public". I am used to keeping a notebook, but by publishing notes on the web with the idea that someone else may read them, I see that the writer is forced to think through every step.

    I think I will take you up on your advice to blog my way through the Make: Home Chemistry book and the Wireless Sensor network one as well. I'll need to develop some digital photography ability first though...probably I'm the last person in the world that still uses a Pentax K1000.

    Enough, I need to make pancakes for two little kids.

    ReplyDelete
  9. I "reverse engineered" the Adafruit motor shield to match the color order above to the driver chip pins.
    This is for the SN754410 or the L293D.

    Brown Pin3 (output 1)
    Black Pin6 (output 2)

    Red and Green Pins 4,5 and 12,13 (ground)

    Yellow Pin11 (output 3)
    Orange Pin14 (output 4)

    This more or less matches Mr. McRobert's diagram, except he shows the red and green wires both going to source instead of ground. I am not sure what that's about yet. My reading of the data sheet, which is still halting at best, suggests that his drawing is wrong, but it may work both ways

    I need to enter the code now. I always type in the code so I can parse it line by line, which is slow, but it helps me understand what each bit is doing.

    ReplyDelete
  10. Thanks for all the good info, Chris.

    Yes, I'm finding that this blog works in two directions. Having readers help with comments like yours is HUGE help.

    If you're serious about blogging the Chemistry book, email me and I'll provide you some more information that I think can help.

    Jim

    ReplyDelete
  11. Glad it was helpful.

    I now have the sketch up and running.

    I stripped off the sheath from a length of 10-BaseT (ethernet) cable and used the nicely color coded wires to make jumpers from the JST on the stepper to the driver chip. I wired the motor as indicated in my post above and found that instead of rotating one turn CW and 1/4 CCW, my motor rotated 4 turns CW and 1 turn CCW, so preserving the 4:1 ratio, but multiplying both by a factor of 4.

    Reversing either the yellow-orange, or the brown-black pair reversed the rotation of the motor.

    I remained curious about grounding the red and green wires as indicated in the Adafruit tutorial, vs connecting them to Vin as indicated in the book, so I switched them out and found that actually it made no difference whether they were grounded, connected to Vin, or disconnected entirely. More experimentation is required.

    Regarding the chemistry blog, I find that I do not have your e-mail address...your e-mails to me have come from a "no reply" address at word press. Harvest this: ctdahle@gmail.com and then delete this paragraph before you approve the post.

    Cheers,

    Chris

    ReplyDelete
  12. Glad it was helpful.

    I now have the sketch up and running.

    I stripped off the sheath from a length of 10-BaseT (ethernet) cable and used the nicely color coded wires to make jumpers from the JST on the stepper to the driver chip. I wired the motor as indicated in my post above and found that instead of rotating one turn CW and 1/4 CCW, my motor rotated 4 turns CW and 1 turn CCW, so preserving the 4:1 ratio, but multiplying both by a factor of 4.

    Reversing either the yellow-orange, or the brown-black pair reversed the rotation of the motor.

    I remained curious about grounding the red and green wires as indicated in the Adafruit tutorial, vs connecting them to Vin as indicated in the book, so I switched them out and found that actually it made no difference whether they were grounded, connected to Vin, or disconnected entirely. More experimentation is required.

    ReplyDelete
  13. I'm getting no movement on the motor... I wondered about the red and green going to 9V in the figure, too... so I tried it both ways... 9V and GND. Neither is getting the motor moving. Not sure what's happening...

    ReplyDelete
  14. On a hunch I picked up the motor... it's vibrating but not turning. And I can't turn the axle manually while it's energized which is normal I believe. Odd.

    ReplyDelete
  15. Sorry, the following is the random product of insomnia and probably full of typos. But maybe it will help.

    Octuple check your wiring, the Fritzing diagram on this one is unwieldy and I found I kept making mistakes until I decided to ignore the diagram and follow the data sheets instead.

    I spent the whole afternoon fiddling and learning about steppers. Apparently there is neither rhyme nor reason to the color code on these motors. Yours could be different from mine, but it's not hard to figure out which wire does what using a multimeter, your wall wart and couple of wires on a bread board.

    See project 33 in the Platt book for a suggestion of how to work out the stepping sequence. He says you can't hurt the motor as long as you stay within the voltage parameters.

    Mr. Platt's theory discussion indicates that you actually sink current to the stepper instead of sourcing it, thus the connection of the red and green wires to Vin instead of ground. But check your motor.

    I remain puzzled that my motor ran regardless of how I connected, or disconnected the red and green wires.

    On to your problem:

    The supplied code assumes that you have a motor that moves 1.8 degrees/step, so the STEPS value is 200

    My motor from Adafruit is a 7.5 degree/step motor, so I had to change the value of STEPS to 48. Mine is also a 12 volt motor.

    The All Electronics listing for yours is a 3.6 degree/step motor, so your steps value will have to be 100. It looks to be a 7v motor.

    All that being said, the value of the STEPS variable is probably not the problem...the program just uses it to tell how many steps make a full turn and if you use the wrong value for STEPS, it should still run, it just will not run for the correct number of turns.

    You are right that the motor should be hard to turn when energized. Apparently it's also normal for the motor to get hotter than a two dollar pistol when running slowly.

    Use your multimeter to verify that the green and red wires really are ground, then swap around the other 4 wires. There are 24 permutations. Theoretically, the motor should run on 4 of them.

    Personally, I found it really hard to follow the Fritzing diagram on this one. Instead I sketched out the chip pinout and ended up creating my own breadboard circuit which is electrically the same but has much simpler topology. (I.E. FEWER WIRES!).

    Fritzing seems inclined to force the user to connect every component with a jumper which results in diagrams that look like a spaghetti factory.

    ReplyDelete