Shop OBEX P1 Docs P2 Docs Learn Events
BS2sx simultaneous 3 DC brished motor control — Parallax Forums

BS2sx simultaneous 3 DC brished motor control

mrbillholmrbillhol Posts: 2
edited 2011-03-03 11:02 in BASIC Stamp
I want to simultaneously control 3 DC brushed motors (with an external H bridge) with a single BS2sx. There is only one PWM output. Using the PAUSE command in conjunction with PULSEOUT (for 2 more PWM channels) seems to stop all program execution until it times out. While it is timing out, the 2nd motor PWM code is paused. Is it possible to simultaneously control 3 DC brushed motors (not RC synchro motors)? In other words, all three DC brushed motors need to be in motion and controlled simultaneously

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-02 20:44
    No, it's not possible with a Basic Stamp. These are single task microcontrollers. They do only one thing at a time. Sometimes they can appear to do several things at a time by interleaving several tasks like handling more than one R/C servo and some simple sensors, but controlling the speed of more than one brushed motor is beyond what this technique can accomplish with a Stamp. You could use a Propeller (like a Spin Stamp) which has 8 separate microprocessors (cogs) and assign one to each motor, then use other cogs for other tasks. Alternatively, you could use an external motor controller which usually include a special purpose microcontroller and H-Bridge. These are "set and forget" in that you send them a command with speed, direction, and ramping information and they take care of controlling the H-Bridge. Some of them can handle two motors. Pololu is one manufacturer.

    A cheap solution to an external controller would be to use something like a 555 timer to generate the PWM signal and control that with a digital pot. The BS2sx could certainly provide the direction / on-off signal for the H-Bridge as well as control the digital pot. The external circuitry would "chop" the signal from the BS2sx with the signal from the 555 timer to provide speed control
  • IAMTHEFUTUREIAMTHEFUTURE Posts: 14
    edited 2011-03-03 06:09
    I know you can control 2 12v dc motors so Im not sure why you couldnt do 3 but its def. possible to control 2 with the stamp. They were brushless though.
  • stamptrolstamptrol Posts: 1,731
    edited 2011-03-03 07:09
    You can do what you've described by using the HB-25 to drive each motor. They are controlled similar to a servo motor but don't require refreshing. From the write-up on the Parallax site:

    " The Parallax HB-25 Motor Controller is our single best solution for DC motor control. This module is dependable and highly-compatible with any microcontroller that can generate a servo compatible pulse. In the simplest sense the HB-25 allows a DC Motor to be controlled much like a Continuous Rotation Servo. While the signals are compatible, the HB-25 does not require refreshing as a servo does; a single pulse can maintain the output."

    Depending on what else the BS2sx has to do, it can probably update the HB-25's fast enough that the motors will appear to change speed simultaneously.

    There are also other motor controls on the market that allow a single serial instruction to change the speed of multiple motors at once.

    Cheers,
  • Spiral_72Spiral_72 Posts: 791
    edited 2011-03-03 11:02
    I dunno, this might be one of those "Theoretical" situations, but what is the frequency you are driving the motors at? Are all three getting the same pulse? Are all three constantly updated with new frequencies?

    What I'm getting at is if the freq is low enough, your MIGHT be able to hard code your own PULSOUT instruction, something like:

    'setup the motor #1(x), #2(y) and #3(z) output frequencies
    x=1
    y=2
    z=1

    main:
    OUT1 = 1
    pause x
    OUT1 = 0
    OUT2 = 1
    pause y
    OUT2 = 0
    OUT3 = 1
    pause z
    OUT3 = 0
    GOTO main

    It won't control three truly simultaneous but it might appear that way.... I wonder if it'll work?
Sign In or Register to comment.