Shop OBEX P1 Docs P2 Docs Learn Events
potentiometer throttle — Parallax Forums

potentiometer throttle

FRC2370FRC2370 Posts: 128
edited 2013-01-06 20:11 in Accessories
On my go-kart robot thingy (don't have a name yet) I'm trying to have a foot operated throttle pedal to drive the motors. How would I have a potentiometer rigged up to a pedal?
«1

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-12-30 16:35
    You could use a chain or a belt from the pedal to the pot. You could also mount the pot in line with the pedal axis and use a flexible coupling (ex. rubber tube) to connect to the pot.
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-30 16:39
    A little elaboration? I'm kinda confused on how this is assembled
  • kwinnkwinn Posts: 8,697
    edited 2012-12-30 17:36
    FRC2370 wrote: »
    A little elaboration? I'm kinda confused on how this is assembled

    Here are two methods.
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-30 17:53
    So basically have a string that moves the potentiometer ?
  • Mike CookMike Cook Posts: 829
    edited 2012-12-30 18:08
    You might want to check out this manual for the old '80s arcade game "Pole Position". Starting on page 3-18 there is a mechanical diagram describing the accelerator pedal. Might give you a few ideas.

    http://www.arcade-museum.com/manuals-videogames/P/Pole_Position_TM218_7th_Printing.pdf
  • Mike CookMike Cook Posts: 829
    edited 2012-12-30 20:07
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-30 20:15
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2012-12-30 20:40
    I hate to be a OSHA buzz Kill . but ......
    Perhaps a COTS " Pot Box " is safe way to go ?
    Curtis makes them for EV conversions and are about 50 USD if you look around.


    http://images.search.yahoo.com/search/images;_ylt=A0oGdUPOFuFQTjEAJxNXNyoA?p=curtis+potbox&fr=moz35&fr2=piv-web


    http://www.electroauto.com/catalog/potbox.shtml


    ( curtis also makes all in one foot pedles too that you can just mount and wire .
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-31 06:36
    All seem like good ideas, but I need it to a USB2 connector so it can plug into the computer running the bot
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-31 08:26
    FRC2370 wrote: »
    All seem like good ideas, but I need it to a USB2 connector so it can plug into the computer running the bot

    Like this one.

    http://www.amazon.com/HDE®-Video-Game-Racing-Foot-Pedal/dp/B0098PLPOI/ref=sr_1_12?ie=UTF8&qid=1356927781&sr=8-12&keywords=pedal+switch

    Of course anything can be made to have a USB connection by adding a microcontroller with a USB interface.

    I'm pretty sure any USB2 port will read a USB1 device.
  • Mike CookMike Cook Posts: 829
    edited 2012-12-31 08:31
  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-31 08:33
    If you need a USB connection to a PC, that makes the whole thing more complicated since you need a USB-compatible controller and an I/O driver on the PC end of things. You would need an analog to digital converter of some sort and a power supply (to control the power from USB). For an example of what's available ready-made, look at this.
  • ercoerco Posts: 20,255
    edited 2012-12-31 08:54
    This is becoming quite a calliope. Just get a cheap USB joysick and hack it.
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-31 09:02
    Well i have a set of Fanatec CSR pedals (http://us.fanatec.com/Pedals?product_id=178) sitting around, but those have a PS/2 connector, so could i use a PS/2 to USB adapter? Im using it with a Texas Instruments 335x starter kit running Android OS (http://www.ti.com/tool/tmdssk3358) which uses WiFi to send commands to the Arduino which has a RobotOpen shield (http://www.team221.com/robotopen/). The whole thing wont function without a USB device so would my Fanatec pedals with an adapter work?
  • SRLMSRLM Posts: 5,045
    edited 2012-12-31 09:35
    FRC2370 wrote: »
    Well i have a set of Fanatec CSR pedals (http://us.fanatec.com/Pedals?product_id=178) sitting around, but those have a PS/2 connector, so could i use a PS/2 to USB adapter? Im using it with a Texas Instruments 335x starter kit running Android OS (http://www.ti.com/tool/tmdssk3358) which uses WiFi to send commands to the Arduino which has a RobotOpen shield (http://www.team221.com/robotopen/). The whole thing wont function without a USB device so would my Fanatec pedals with an adapter work?

    IIRC, the PS/2 to USB adapters are only electrical, not programatical. So, they only work on devices that have built in support for the USB protocol (which older and custom devices are not likely to have).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-31 09:38
    FRC2370 wrote: »
    so would my Fanatec pedals with an adapter work?

    Short answer no.

    The mice and keyboards that can use those adapters (generally USB to PS/2) detect which type of signal they're connected and make the change in protocol internally.

    You could make a PS/2 to USB adaptor but it would have enough brains to convert the protocols. I'm counting on others to correct me if I'm wrong. Not too hard if you can get by with a serial connection through a FTDI adapter.
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-31 09:56
    So in short I'm not able to use those pedals?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-02 07:40
    Fanatec (via the link you provided) mentions that you can connect the pedals via USB to a PC. You might contact them to see how that's done.
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-02 12:23
    It says the CSR pedals can be connected via USB?? I thought only the CSR Elite could
  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-02 12:38
    Like I said, you might contact Fanatec about their product. If they say no, then you'd need some kind of PS/2 to USB interface. It sounds like you don't have enough experience to build one yourself at this point, but it's doable and you'd learn a lot of useful skills.
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-02 16:12
    Just wrote an email to Fanatec, and tried using an adapter, and there wasn't any response from the robot. none of the motors moved :(
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-02 18:59
    As Mike suggested (and I suggested earlier), you could have a microcontroller interface with the pedals using the PS/2 protocol and then send the information to the computer via a serial to USB converter.

    I don't know if a Basic Stamp would be able to read the PS/2 signal but a Propeller could do this. One of the many Propeller boards with a USB connection should be able to be used as a converter. I thin a QuickStart would be your least expensive option. The new Propeller project board would also be a good choice.
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-02 19:11
    Well how much is this gonna run me cost wise? and how much power is it gonna use?
  • SRLMSRLM Posts: 5,045
    edited 2013-01-02 19:34
    FRC2370 wrote: »
    Well how much is this gonna run me cost wise? and how much power is it gonna use?

    You won't know until you try it out.
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-02 19:59
    Also, I have no clue as to what the code would look like for a Propeller. So it should be able to take the PS/2 protocol from the pedals, convert it to USB, and send that on to the computer?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-02 20:05
    FRC2370 wrote: »
    Well how much is this gonna run me cost wise? and how much power is it gonna use?

    A QuickStart costs $25. You'll proably want a PS/2 connector if you don't want to cut the pedal's wire. You might be able to salvage a PS/2 connector from an old PC or you could buy the connector from Parallax, SparkFun, etc. You'll also need a couple of resistors for the PS/2 bus.

    You can power the QuickStart with 5V and my guess is it will draw around 50mA. I don't know how much current your pedals will draw but they probably need 5V power.
    FRC2370 wrote: »
    Also, I have no clue as to what the code would look like for a Propeller. So it should be able to take the PS/2 protocol from the pedals, convert it to USB, and send that on to the computer?

    I'd start with a keyboard demo to see how to read the PS/2 line. I'm not sure, but I think there's a keyboard demo that displays to a serial terminal. (Edit: The demo uses a TV object. I'll attach a serial version in a soon to be made post.) You'll need both a PS/2 object and a serial object (such as Parallax Serial Terminal (PST) or FullDuplexSerial (there are lots of others)). You'd use this same serial object to send your data to the PC in your final program.

    I think the main unknown is what kind of data the pedals send. You could just print (I'd use the hexadecimal value ("hex" method in the serial objects)) whatever data comes out of them to the terminal to see what the codes are.

    The Propeller is a great (IMO best) microcontroller for robotics. This would be a great reason to start learning how to use it. People are really helpful on the Propeller forum so you can easily get help if you have trouble.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-02 20:39
    The keyboard demo uses a TV terminal object.

    It was very simple to change it to use the object "Parallax Serial Terminal".

    I also added a "$" to the hexidecimal displayed and added a constant "CODES_PER_LINE" to let you easily change how many codes to display on a line.

    Here's the code:
    CON
      _clkmode        = xtal1 + pll16x
      _xinfreq        = 5_000_000
       
      SERIAL_BAUD = 115_200
      CODES_PER_LINE = 32
      DATA_PIN = 26                 ' Should be pulled high to 3.3V with 10K resistor.
                                    'As used on Demo Board
      CLOCK_PIN = 27                ' Should be pulled high to 3.3V with 10K resistor.
                                    'As used on Demo Board
                                    
    OBJ
      Term : "Parallax Serial Terminal"
      Kb : "keyboard"
     
    PUB Start
      'start the tv terminal
      Term.Start(SERIAL_BAUD)
      Term.Str(string("Keyboard Demo...", Term#NL))
      'start the keyboard
      Kb.Start(DATA_PIN, CLOCK_PIN)
      'echo keystrokes in hex
      repeat
        repeat CODES_PER_LINE 
          Term.Char("$") ' hex indicator in Spin
          Term.hex(Kb.Getkey, 4)
          Term.Char(" ")
        Term.Char(Term#NL)
    

    Warning, I haven't tested this code myself. I'll do so once I find my PS/2 keyboard (probably tomorrow).
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-03 10:48
    So i just need the quick start board and the human interface add-on (has a PS/2 connection) and then how far does that code get me into getting this to work?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-01-03 11:20
    FRC2370 wrote: »
    So i just need the quick start board and the human interface add-on (has a PS/2 connection) and then how far does that code get me into getting this to work?

    The code example sends the PS/2 data to the PC. Instead of having it displayed in a terminal program you could have your control program receive it and take appropriate action based on the incoming code.

    You might want the Propeller to add some additional formatting aids and delimiters to make it easier for the PC program to use the data. For example, you may want to add carriage returns to the end of a transmission or add commas or tabs between data fields.

    I lot will depend on how the PC program whats the data formatted.
  • FRC2370FRC2370 Posts: 128
    edited 2013-01-03 18:33
    Well right now this is the code the robots running on (runs on an Arduino).

    #include <SPI.h>
    #include <Ethernet.h>
    #include <RobotOpen.h>




    /* I/O Setup */
    USBJoystick usb1('0'); // Assign the logitech USBJoystick object to bundle 0




    void setup()
    {
    /* Initiate comms */
    RobotOpen.begin();
    }




    /* This is your primary robot loop - all of your code
    * should live here that allows the robot to operate
    */
    void enabled() {
    // Constantly update PWM values with joystick values
    int leftDrive = usb1.makePWM(ANALOG_RIGHTY, INVERT) - (127 - usb1.makePWM(ANALOG_RIGHTX, NORMAL));
    int rightDrive = usb1.makePWM(ANALOG_RIGHTY, INVERT) + (127 - usb1.makePWM(ANALOG_RIGHTX, NORMAL));

    if (leftDrive > 255)
    leftDrive = 255;
    else if (leftDrive < 0)
    leftDrive = 0;
    if (rightDrive > 255)
    rightDrive = 255;
    else if (rightDrive < 0)
    rightDrive = 0;

    RobotOpen.setPWM(SIDECAR_PWM1, 255 - leftDrive);
    RobotOpen.setPWM(SIDECAR_PWM2, rightDrive);
    }




    /* This is called while the robot is disabled
    * You must make sure to set all of your outputs
    * to safe/disable values here
    */
    void disabled() {
    // PWMs are automatically disabled
    }




    /* This loop ALWAYS runs - only place code here that can run during a disabled state
    * This is also a good spot to put driver station publish code
    * You can use either publishAnalog, publishDigital, publishByte, publishShort, or publishLong
    * Specify a bundle ID with a single character (a-z, A-Z, 0-9) - Just make sure not to use the same twice!
    */
    void timedtasks() {
    RobotOpen.publishAnalog(ANALOG0, 'A'); // Bundle A
    RobotOpen.publishAnalog(ANALOG1, 'B'); // Bundle B
    RobotOpen.publishAnalog(ANALOG2, 'C'); // Bundle C
    RobotOpen.publishAnalog(ANALOG3, 'D'); // Bundle D
    RobotOpen.publishAnalog(ANALOG4, 'E'); // Bundle E
    RobotOpen.publishAnalog(ANALOG5, 'F'); // Bundle F
    }




    /* This is the main program loop that keeps comms operational
    * There's no need to touch anything here!!!
    */
    void loop() {
    RobotOpen.pollDS();
    if (RobotOpen.enabled())
    enabled();
    else
    disabled();
    timedtasks();
    RobotOpen.outgoingDS();
    }


    And the driver station application waits for a signal from the USB port. So all I need the Propeller to do is translate the PS/2 protocol to USB. Thats do-able right? And its being sent to the USB on an Android based device if that helps
Sign In or Register to comment.