+ Reply to Thread
Results 1 to 11 of 11

Thread: Control DC motor speed via joystick

  1. #1

    Default 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.

  2. #2

    Default Re: Control DC motor speed via joystick

    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

  3. #3

    Default Re: Control DC motor speed via joystick

    You also have the option to not use a ucontroller at all!



    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
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	user19834_pic665_1260415148.gif‎
Views:	1731
Size:	4.5 KB
ID:	74929  

  4. #4

    Default Re: Control DC motor speed via joystick


  5. #5

    Default Re: Control DC motor speed via joystick

    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.
    Attached Files Attached Files

  6. #6

    Default Re: Control DC motor speed via joystick

    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

  7. #7

    Default Re: Control DC motor speed via joystick

    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.

  8. #8

    Default Re: Control DC motor speed via joystick

    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

  9. #9

    Default Re: Control DC motor speed via joystick

    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.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Slide 1.jpg‎
Views:	153
Size:	173.6 KB
ID:	75222   Click image for larger version

Name:	Slide 2.jpg‎
Views:	85
Size:	175.0 KB
ID:	75223  

  10. #10

    Default Re: Control DC motor speed via joystick

    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

  11. #11
    sam_sam_sam's Avatar
    Location
    Propeller Proto Board........> Sunny Jacksonville FL
    Posts
    2,149
    Blog Entries
    2

    Smile Re: Control DC motor speed via joystick

    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
    Last edited by sam_sam_sam; 11-14-2010 at 06:53 PM.
    Sam
    _________________________>
    Now wanting to learn Spin Thanks for any idea that you may have and all of your time finding them

+ Reply to Thread

Similar Threads

  1. Speed control of AC motor
    By agfa in forum BASIC Stamp
    Replies: 3
    Last Post: 05-27-2008, 12:08 AM
  2. DC Motor speed control
    By Alex41 in forum General Discussion
    Replies: 8
    Last Post: 12-22-2007, 01:49 PM
  3. Ac motor speed control
    By pusink in forum General Discussion
    Replies: 3
    Last Post: 09-17-2007, 01:34 AM
  4. USB Joystick Motor Control
    By motorman in forum Robotics
    Replies: 1
    Last Post: 04-30-2006, 07:38 PM
  5. Motor speed control with R/C speed controller
    By glaso in forum BASIC Stamp
    Replies: 7
    Last Post: 10-31-2004, 11:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts