Shop OBEX P1 Docs P2 Docs Learn Events
Dual Serial Motor Controller and Toy Motors — Parallax Forums

Dual Serial Motor Controller and Toy Motors

bxgirtenbxgirten Posts: 79
edited 2007-01-02 19:04 in Robotics
I'm trying to build a small robot that will randomly crawl around on a desktop but use IR to sense the edges. I'm using a Pololu Dual Serial Motor controller, 9V battery to drive the BS2 and 2 1.5v-3V hobby motors.

I've been having some trouble getting the motor controller to drive these hobby motors. Everything is fine if I swap out the 1.5V-3V motors for 6V motors. I'm not sure why I'm having trouble.

Here's some code snippet:

' {$STAMP BS2}
' {$PBASIC 2.5}

speed VAR BYTE
HIGH 4
LOW 5
HIGH 5
PAUSE 100
DEBUG "1st loop",CLS,CR
PAUSE 20
FOR speed = 0 TO 15
SEROUT 4,84,[noparse][[/noparse]$80,0,0,speed]
PAUSE 20
NEXT
DEBUG "2nd loop",CR
FOR speed = 15 TO 0
SEROUT 4,84,[noparse][[/noparse]$80,0,0,speed]
PAUSE 20
NEXT
DEBUG "3rd loop",CR
FOR speed = 0 TO 15
SEROUT 4,84,[noparse][[/noparse]$80,0,1,speed]
PAUSE 20
NEXT
DEBUG "4th loop",CR
FOR speed = 15 TO 0
SEROUT 4,84,[noparse][[/noparse]$80,0,1,speed]
PAUSE 20
NEXT

Again, I get no movement with the hobby motors (like I do if I use 6V motors).
Any ideas for improvement/configurations welcome.

Signed,

Stumped.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-01-02 09:30
    bxgirten -

    A schematic of how you have hooked up the motor controller to the motors, and the power supply, would be real helpful.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 1/2/2007 9:46:34 AM GMT
  • Dennis FerronDennis Ferron Posts: 480
    edited 2007-01-02 10:10
    Maybe your speed setting is too low? I notice you are doing 0 to 15. I have a similar small robot that uses the same motor controller, and it has been a long time since I did anything with it, but if I recall correctly, I use a value of 23 for my slowest speed setting. In your code, it seems that you are assuming speed has 15 steps, but I think actually it is a fraction over 255. That is, speed = 255 means on full power, while 15 means 15/255 or about 6% power.

    If that is the problem, your larger 6volt motors might have worked simply because they were not under load.
  • bxgirtenbxgirten Posts: 79
    edited 2007-01-02 12:50
    I'm using a 9V battery to drive the BS2 and the two 1.5V motors. The schematic is not tricky (see attached) as I'm using Pololu's configuration. Using your cue, Dennis, I'll change the test loop to increase the for/next range and the length of the pause statement to check the load.

    But theoretically, 9V *should* be enough to power the Stamp and the two 1.5V motors - right?
    408 x 300 - 27K
  • bxgirtenbxgirten Posts: 79
    edited 2007-01-02 18:11
    Since I'm using the same 9V battery to power the BS2 and the motors, would it be wise to employ a diode to control motor noise? I'm not an electronics expert but that could explain why I see the Stamp restart.
  • PARPAR Posts: 285
    edited 2007-01-02 19:04
    bxgirten said...
    Since I'm using the same 9V battery to power the BS2 and the motors, would it be wise to employ a diode to control motor noise? I'm not an electronics expert but that could explain why I see the Stamp restart.
    More likely, the Stamp is "browning out", not getting enough voltage when the motors start.

    Either a fresh battery, or a separate power supply for the Stamp (with a common ground between it and the Pololu) may remedy the problem.

    PAR
Sign In or Register to comment.