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?
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.
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.
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.
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.
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?
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).
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.
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.
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.
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?
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.
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.
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 BoardOBJ
Term : "Parallax Serial Terminal"
Kb : "keyboard"PUBStart'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 hexrepeatrepeat 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).
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?
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.
/* 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;
/* 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
Comments
Here are two methods.
http://www.arcade-museum.com/manuals-videogames/P/Pole_Position_TM218_7th_Printing.pdf
http://www.arcade-museum.com/manuals-videogames/G/GrandChampion.pdf
I also thought I saw one of these type of things at MPJA. I'll look around and try to find a link.
Here's a Roland pedal. There are more on Google.
Here are some more options:
http://www.amazon.com/SE-Switch-Flexible-Grinder-972FSG/dp/B000VV4SDS/ref=sr_1_5?ie=UTF8&qid=1356927781&sr=8-5&keywords=pedal+switch
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
http://www.amazon.com/Sewing-Machine-Control-Pedal-J00360051/dp/B0038RGE9S/ref=sr_1_16?ie=UTF8&qid=1356927781&sr=8-16&keywords=pedal+switch
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 .
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.
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).
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.
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.
You won't know until you try it out.
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.
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.
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).
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.
#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