Shop OBEX P1 Docs P2 Docs Learn Events
motor controller: motor 2 works but motor 1 doesnt — Parallax Forums

motor controller: motor 2 works but motor 1 doesnt

NsanecomXNsanecomX Posts: 22
edited 2010-02-24 05:26 in BASIC Stamp
i have a bs2 and im using the micro dual serial motor controller to control 2 motors separetly. i have the reset on the motor controller in pin 15 and the serial out on the motor controller in pin 14 on the bs2.

im using this code for motor·two and it works:

HIGH 14···········
LOW 15············
HIGH 15
PAUSE 100
SEROUT 14,84,[noparse][[/noparse]$80,0,0,127]

it will keep spinning until i code it to stop.


im using this code for motor one and it moves for a few milliseconds then stops completely:

HIGH 14···········
LOW 15············
HIGH 15
PAUSE 100
SEROUT 14,84,[noparse][[/noparse]$80,0,2,127]


i have no idea why the second motor works just fine and the first motor bearly moves.

any ideas?

Comments

  • ercoerco Posts: 20,256
    edited 2010-02-21 23:13
    Did you properly configure the controller for 2-motor operation·with the·appropriate serial command?

    ·http://www.pololu.com/file/download/smc02b_guide.pdf?file_id=0J36

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 03:45
    ya im pretty sure. i run this code first separetly then i run the other code:

    SEROUT 14, 84,[noparse][[/noparse]$80,2,0]

    which from what i read in the manual should set it to two motor mode that controls motors 0 and 1.

    i have no idea what im not doing. the same thing is still happening

    is this even how you would configure it to control the 2 motors independantly?

    any help would be great. thanks



    p.s.
    ·if i set up the code like this:

    SEROUT 14,84,[noparse][[/noparse]$80,0,0,speed]
    ·SEROUT 14,84,[noparse][[/noparse]$80,0,2,speed]

    so that is controls both motors at the same time instead of testing each one independantly they both only run for a sec then stop completely

    Post Edited (NsanecomX) : 2/22/2010 4:29:01 AM GMT
  • ercoerco Posts: 20,256
    edited 2010-02-22 04:41
    Please attach your·full program (using the·attachment manager button, not just cut & paste)·so we can see it & try to help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 05:17
    i dont know what i did but now it pulses on and off for both motors. im confused.

    thanks for helping

    i attached the motor controlling program and the motor controller configuration program
  • Tony B.Tony B. Posts: 356
    edited 2010-02-22 13:15
    Just a quick glance, but shouldn't you have a PAUSE of something like 2000 between each FOR-NEXT loops to let the motor actually start and run and then change speed and/or direction and speed. As written the Basic Stamp would run through the code very fast and may give the results your experiencing.

    I bought a couple of these controllers last month and will pull them out and work with them if I get time today

    Tony
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 15:14
    Ok thanks.

    See the thing is that this code was working just fine with motor 2 even with the pause at 20. Ill change it and see if that does anything.
  • Tony B.Tony B. Posts: 356
    edited 2010-02-22 17:05
    Did you understand I meant for you to add a PAUSE 2000 between each for-next loop and NOT to change the Pause 20?

    Tony

    Post Edited (T Bill) : 2/22/2010 8:58:45 PM GMT
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 18:06
    Ok ya that makes sense. I'll try it this afternoon and let you know if it worked. Thanks
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 20:46
    ok so i figured out why motor 2 started messing up. i had the power source plugged in to the wrong spot. so now motor 2 works just fine. the pause 2000 makes it run better i think. thanks

    my problem is back to motor 1 now. it will work for only about 1 second whether or not i add a pause 2000. i dont know why it doesnt work right.

    since motor 2 works fine and motor 1 works for only the first second do you think it could be the configuration? since it works a little then stop would it be a power problem? i am stumped since motor 1 works without a problem.
  • Tony B.Tony B. Posts: 356
    edited 2010-02-22 21:02
    What is your power source?·

    Are the motors the same size? Maybe motor one is drawing more than the 1amp limit pure motor channel when running two motors.·

    Could you post a picture of your setup?

    Like I said I will try working with it tonight and see if I get the same results with your code. It would be great if you could also post your new code.

    Tony


    Post Edited (T Bill) : 2/22/2010 9:08:19 PM GMT
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-22 21:36
    i am using 3 AA batteries to power 2 motors that are the same size. im not sure if one is pulling more power than the other. how would i find out or code it to fix that?

    i attached the configure code and the code to run it. the top section of the code goes forward and backward for motor 2 then the second section goes forward and backward for motor 1. i also attached a pic of the bs2 set up. is that the set up you wanted to see?
  • Oper8r AlOper8r Al Posts: 98
    edited 2010-02-23 04:20
    If the #2 motor is working and the #1 motor is causing problems I would suggest switching the motors to make sure it isn't a problem with one of the motors. It should eliminate one variable and help you narrow down the problem.
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-23 06:37
    ok i switched them and its the same. no matter what motor is connected to the place for motor 1 it bearly moves then it stops altogether
  • Tony B.Tony B. Posts: 356
    edited 2010-02-23 15:44
    Using LEDs I verified your configuration and controller code to work. I will try working with motors tonight.


    EDIT - I added a DO..LOOP to the code so it would continually repeat making it easier to watch the LEDs.· I got to wondering how the motors would run it you use the attached file which is your code with a DO..LOOP added.

    Since you have switched the motors and they both work fine in motor 2 postition and the code seems correct I believe it maybe time to contact Parallax's tech support. If tech support is able to help you solve the problem it would be good to post it as a future reference for others

    Tony

    Post Edited (T Bill) : 2/23/2010 4:29:18 PM GMT
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-23 16:43
    Ya I agree. Ill try to contact them today and see what they think. If I figure out the problem ill definitely post and let everyone know what's going on

    Thanks for the help
  • Tony B.Tony B. Posts: 356
    edited 2010-02-23 19:01
    I have attached two pictures of what I call a small motor. Too my surprise it didn't work with the controller. I checked with my meter and found that it averaged near or just over 1 amp draw at start up. 1 amp is the limit for each motor channel.

    I wonderful, back to the motor size thought, if your motors are drawing too many amps and shutting down the controller? After I tried the motor I had to reset the BS2 and controller to get the LEDs to light on the second motor pins 6,7 (tried motor on pins 8,9).

    Hope this helps

    Tony
    640 x 480 - 147K
    640 x 480 - 134K
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-23 20:16
    Actually that makes sense. I contacted the tech help and while waiting for them to respond I was doing more looking around online for an answer and I came across a thread about a guy that had a similar problem and it was his motors. He was using fa-130 motors like I am and it sounds like the motors draw too much power. It sucks but I think I have to replace the motors.

    I tried some motors I had lying around and they work fine. The new ones are bigger but they must not draw as much power
  • Tony B.Tony B. Posts: 356
    edited 2010-02-24 00:20
    I would say that's about the size of the one I tried.

    I would say I'm a little surprised. I thought I had a small motor and couldn't believe it drew that much current on start up.

    You know you could hook one motor up to both channels and have 2 amps to work with. It does mean another controller, but you would only loose one pin for reset because you can run 2 controllers on one serial line. Just an idea.

    I also tested a larger motor rated 12-24 volts and it only drew about .4 amps at the highest on 6 volt battery pack. So I connected it to the controller and it works great.

    I guess the moral learned is - Never assume small means low current, test it to make sure.

    Glad you got it figured out.

    Tony

    Post Edited (T Bill) : 2/24/2010 12:26:52 AM GMT
  • NsanecomXNsanecomX Posts: 22
    edited 2010-02-24 05:26
    Ya thanks for all the help man. If I get everything working I'll try to post something
Sign In or Register to comment.