Control DC motor speed via joystick

I am using the BS2SX controller and have a variable resistor joystick. I like to use the voltage output from the joystick to control the motor speed and direction of a wheel chair. I wonder if I need to gather any hardwares to faciliate the operation. In addition, I wonder if this could be done or I need another controller chip.
Tagged:

Comments

  • 11 Comments sorted by Votes Date Added
  • edited November 2010 Posts: 0Vote Up0Vote Down
    You have a number of options.

    You can use the RCTIME command (see the Help file in the programming environment) to read the joystick directly. Or you can add an A-to-D converter and read the joystick position that way.

    You will also need some sort of motor controller (perhaps the HB25 or another DC motor driver) to allow the Stamp to control the motor. You may also be able to use the PWM capabilities of the Stamp to drive the motors via a high current transistor.

    Cheers,
    Tom Sisk
    Sisk Consulting Inc.
    www.siskconsult.com
  • edited November 2010 Posts: 0Vote Up0Vote Down
    You also have the option to not use a ucontroller at all!

    attachment.php?attachmentid=74929&stc=1&d=1288726245

    Make R5 the joystick pot. and make R4 and R6 the same value as the joystick pot. Feed the output into the motor driver.

    Or you can make the BS2 control a digipot as R5
  • edited November 2010 Posts: 0Vote Up0Vote Down
    You'll find me in the new Robotics forum.
  • edited November 2010 Posts: 5Vote Up0Vote Down
    After installing the joystick to the Basic stamp, I have difficulties to gather the correct value from the readout. Attached is the Basic stamp code and its output response. When the joy stick is shift from left to right, the value gather is not linear. It is only linear from centre to right. From centre to left, the value gather seems strange. Instead of decreasing, it looks like random.
    Slide 1 and 2 shows different value when shift from centre to left.
    Slide 3 shows correct value when shift from centre to right.
  • edited November 2010 Posts: 0Vote Up0Vote Down
    When measured with a voltmeter, do the input voltages of the a/d operate as expected?

    Or, measure the resistance of the joystick pot from center terminal to left and right terminals while the stick is in known positions.
    Tom Sisk
    Sisk Consulting Inc.
    www.siskconsult.com
  • edited November 2010 Posts: 5Vote Up0Vote Down
    The voltage from the multimeter shows correct voltage. When the joystick is shifted left, it shows 0 to 2.5v while towards right shows 2.5 to 5v. However, I am still unable to decode and use the data collect in the stamp code variable result0. It is 12 binary and how could I use its value to achieve my outcome. I am unable to pull the value between 0 to 2.5v and use it to activate my motor speed. For the value between 2.5 and 5v, I have not problem by substracting the value by 2.5v and then use it to set my motor speed.
  • edited November 2010 Posts: 0Vote Up0Vote Down
    It sounds like the hardware is OK, so it has to be a software issue.

    From the code, it looks like you've got WORD variables, so that should be ok.

    Temporarily modifiy your code to read the a/d and put the results on a DEBUG screen. Let us know what you see.
    Tom Sisk
    Sisk Consulting Inc.
    www.siskconsult.com
  • edited November 2010 Posts: 5Vote Up0Vote Down
    Slide 1 shows the Debug results when the joystick is towards the left while Slide 2 shows the Debug results when the joystick is push towards the right. From the same code, the reading when the joystick is push towards the right is what we like to get.

    Also, we are puzzled that the result0 binary data is not the same though there are the same variable in Slide 1. Apparently, the last 7 values are removed.
    1500 x 1200 - 174K
    1500 x 1200 - 175K
  • edited November 2010 Posts: 0Vote Up0Vote Down
    Sorry, still not seeing the problem. The mix of BIN and DEC doesn't help.

    You don't say what a/d you're using, but I assume you have checked that the configuration nibble is right as you switch from ch0 to ch1.

    Run the a/d reading loop and show only result0, result1 in DEC, when the stick is centered, half-way left, half way right, full left and full right. Don't add or subtract or manipulate anything, just show the raw values.
    Tom Sisk
    Sisk Consulting Inc.
    www.siskconsult.com
  • edited November 2010 Posts: 0Vote Up0Vote Down
    I think I understand what he want to is to have a value that is the same one each side of center
    Let me know if if I am right about this

    What you may need to do is have result0,result1,result2,result3
    I have had to this if you want to hold a value

    You should also you a different channel for each half of the pot this should work find ( | ) = pins

    pot control

    channel0>|^|<2.5 volts>|^| <channel1

    I hope this help
    Sam
    _________________________>
    Now wanting to learn Spin Thanks for any idea that you may have and all of your time finding them
Sign In or Register to comment.