Shop OBEX P1 Docs P2 Docs Learn Events
Help with a serial motor controller — Parallax Forums

Help with a serial motor controller

BootsyBootsy Posts: 22
edited 2010-03-04 20:52 in BASIC Stamp
Hey guys!
I'm trying to use a serial motor controller but it won't run for more than a little while and when it does run, it doesn't follow the commands I send it. Does anyone know how to use this or can anyone help me? Thanks!

Here's my code:

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

controller PIN 14
reset PIN 15
HIGH controller
LOW reset
HIGH reset

DEBUG CLS, "start"
PAUSE 150
DEBUG CLS, "Startup done"

'SEROUT 14,84, [noparse][[/noparse]$80, 0, 0, 0]
DEBUG "1"
PAUSE 25
DEBUG "2"
SEROUT 14,84, [noparse][[/noparse]$80, 0, 3, 0]

DEBUG CLS, "stopped"

'PAUSE 1000

DEBUG CLS, "GO!"

SEROUT 14,84, [noparse][[/noparse]$80, 0, 0, 127]
DEBUG "3"
PAUSE 50
DEBUG "4"
SEROUT 14,84, [noparse][[/noparse]$80, 0, 3, 0]
DEBUG CLS, "done send"
PAUSE 10000
DEBUG CLS, "done 5"
PAUSE 2000
DEBUG "stop"
END



and here's how I've configured it:
' {$STAMP BS2}
' {$PBASIC 2.5}

controller PIN 14
reset PIN 15

HIGH controller
LOW reset
HIGH reset

PAUSE 200


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

LOW reset
PAUSE 1000
END

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-05 23:58
    You need to tell us what controller you're using. They're all different. If it's a Parallax controller, indicate the part number. If it's someone else's, you at least have to provide a link to the documentation.
  • BootsyBootsy Posts: 22
    edited 2010-02-06 00:01
    The controller is linked above (click "serial motor controller"). But I think the part number is 30052.

    Thanks, though.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-06 00:08
    OK, it's the Pololu Micro Dual Serial Controller. How do you have it hooked up? If it works properly for a little while, there's probably a power problem. Have you looked at the troubleshooting tips in the documentation?
  • BootsyBootsy Posts: 22
    edited 2010-02-06 00:25
    I don't have it in front of me, so I can't make up a diagram, but I will post one shortly.
    I suspect as well that it is a power problem, but why would that make it not respond to my commands and persist in running the motors at full forward at all times. The troubleshooting tips just said to check if it was overheating for these symptoms, but it isn't warm at all.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-06 02:32
    It all depends on how it's all hooked up. If the controller or the Stamp doesn't have adequate power, it may reset.
  • BootsyBootsy Posts: 22
    edited 2010-02-06 04:17
    Ok, I'll have a diagram on Monday when I'm back at school.
  • BootsyBootsy Posts: 22
    edited 2010-02-18 19:06
    Sorry for the delay, here's how it's hooked up. I have a feeling that you're right about not having adequate power.

    _________________________________
    | |
    | Serial Controller |
    | |
    | 1 2 3 4 5 6 7 8 9 |
    | | | | | | | | |
    Power VDD P14 P15 Motor1 Motor2
    + - + - - +

    Thanks!
  • BootsyBootsy Posts: 22
    edited 2010-02-18 19:09
    That totally didn't work. : (
    Pin 1 -> Battery +
    Pin 2 -> Battery -
    Pin 3 -> VDD
    Pin 4 -> P14
    Pin 5 -> P15
    Pin 6 -> Motor 1 +
    Pin 7 -> Motor 1 -
    Pin 8 -> Motor 2 -
    Pin 9 -> Motor 2 +

    I am using only one battery pack for the stamp, controller and motors. Is that an issue? If I never want to reset the controller, could Pin 5 -> VDD too?
    Thanks!
  • JDJD Posts: 570
    edited 2010-02-19 01:49
    Bootsy,

    Do you think you could take a picture of your setup and put it up? From the connections you have described it sounds correct, the syntax would need all 4 bytes sent to control the Pololu; $80, 0 is always needed, and then the next two bytes are motor/direction and speed. The reset pin is nice to have in operation so I would suggest connecting it to Vdd.

    Pololu Sample:
    ·· SEROUT CONTROLLER, 84, [noparse][[/noparse]$80, 0, motor_and_direction, speed]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • BootsyBootsy Posts: 22
    edited 2010-02-22 19:24
    Ok, photos attached. I hope they work, its hard to take good pictures of tiny things.
    Thanks, guys (and/or girls)!
    1632 x 1232 - 520K
    1632 x 1232 - 530K
    1632 x 1232 - 415K
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-22 20:13
    It's always a dicey proposition using the same battery pack for motors and controllers (unless it's a really big battery). Motors put a large peak drain on the battery and, if the battery has anything other than a really low internal resistance, the output voltage will sag under load, maybe enough to cause the Stamp or motor controller to reset. Motors also generate a lot of electrical noise which gets back into the power supply and can cause an attached Stamp or motor controller to reset. It's possible to add some filtering to the power going to the Stamp and motor controller to filter out the noise and maybe protect against transient drops in supply voltage, but, in the end, it all depends on battery capacity.
  • JDJD Posts: 570
    edited 2010-02-22 20:50
    Bootsy,

    Unfortunately those pictures didn't help a great deal; but Mike brings up a really good point. What type of battery do you have?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • BootsyBootsy Posts: 22
    edited 2010-02-22 22:34
    Yeah, the pictures weren't the best quality. I'm currently using a 4XAA pack for powering the entire setup. I'm going to switch the motors over to their own 9V battery and see if that helps.

    Thanks as always.
  • JDJD Posts: 570
    edited 2010-02-22 23:50
    Bootsy,

    Good idea; if that doens't work, swap the 9V and the 4 AA supplies. The 4 AA's have more juice than the 9V battery, the motor will pull more current than the BS2 circuit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • BootsyBootsy Posts: 22
    edited 2010-03-02 21:59
    Ok, so we now have Pin 1 on the serial controller connected to the + on a 9V and Pin 2 to the -, but it still does not respond. Now, however, it does not move at all.
    Checking with the volt-meter, we are getting 4.18 volts on the reset pin. Is that low enough to cause it do drop?
    Thanks!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-03-02 22:32


    [noparse][[/noparse]Are the Grounds/V_ss/Batt- all connected together?]
  • BootsyBootsy Posts: 22
    edited 2010-03-02 22:45
    Since I'm using two battery packs, VSS is connected to the stamp ground which is part of the AA pack circuit. The ground from Pin 2 is going to the Batt - on the 9V circuit.
    Other than that, I'm sorry but I don't quite understand your question.
  • JDJD Posts: 570
    edited 2010-03-02 23:41
    Bootsy,

    The question was to verify that you had a common ground amongst all the power supplies. Which would mean, do you have all the grounds connecting together? That would give the project a reference to ground regardless if the source is from the 4-AA or 9V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • BootsyBootsy Posts: 22
    edited 2010-03-03 03:40
    So, I should connect the ground to VSS to both Bat - ?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-03-03 12:53
    Aye.·

    All battery packs and power sources should be connected to the same Ground.
  • BootsyBootsy Posts: 22
    edited 2010-03-03 13:21
    Ok, thanks, that might do it.
  • BootsyBootsy Posts: 22
    edited 2010-03-03 22:08
    Thanks a lot! It now runs when we tell it to, and stops when we tell it to. But it doesn't turn for us.
    We've established that it is configured in one motor mode by commenting out one serout command. It follows motor 0 and 1, but outputs to both motors.
    We tried running the configuration program with an LED connected like they recommend to see if it's being configured right, but the LED does not light up when plugged in either way on either Pin 8 or 9.
    Any ideas?
    Thanks a bunch, though, you guys have been a huge help already.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-03-03 22:39
    So, it was a missing Ground.· Thought so.· It's always (always) The Fundamentals.

    I'm not a Pololu-meister, somebody else may have an insight on your Ops question/s.
  • JDJD Posts: 570
    edited 2010-03-03 23:16
    Bootsy,

    The variable for the motor/direction should range from 0 - 3; giving a motor and direction selection for each motor. Replace the command that is sent to the Pololu with the following command, and what are your results?

    SEROUT IOPIN, 84, [noparse][[/noparse]$80, 0, 0, 127]
    SEROUT IOPIN, 84, [noparse][[/noparse]$80, 0, 1, 127]
    SEROUT IOPIN, 84, [noparse][[/noparse]$80, 0, 2, 127]
    SEROUT IOPIN, 84, [noparse][[/noparse]$80, 0, 3, 127]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • BootsyBootsy Posts: 22
    edited 2010-03-04 20:52
    Thanks for all of your help. I've got it working now. I don't know why it wasn't turning before. I may have had a glitch in the code that I fixed. I think that's all I need for now. Everyone here has been very helpful and very supportive.
    Thanks!
Sign In or Register to comment.