PDA

View Full Version : joystick to pwm?



Omega
02-25-2009, 06:07 PM
sup.

so, for my senior project, i need to convert joystick serial into pwm output for use with a speed controller.

I've heard of to routes -- Joystick to two OPAmps to PWM, or Joystick to Arduino. I was thinking Arduino because they're pretty easy to program and I can account for the fact that I need two PWM outputs from one joystick.

Does anybody have any info on this?

mtekk
02-25-2009, 09:56 PM
I'm assuming you're using the old analog game port type joystick.

I don't think you can get from the analog signal of the joystick to PWM using just two opamps (I assume one for each direction (x and y)).

If you are going to use a microcontroller, you'll need it to have an Analog to Digital converter (most only have one AD converter, some have more (most PIC24s and equivalent Atmel microcontrollers) which would allow multiple A->D conversions simultaneously (reducing input "lag")). PWM output wise, either you'll have to use one real PWM channel and a software PWM channel for most microcontrollers, or get a microcontroller with more than one PWM channel. For a software PWM channel you'll need an available timer of adequate precision. I guess it all depends on your project's budget (our junior design project has a $50 limit)

DaveW
02-25-2009, 10:56 PM
I'm a big fan of PIC microprocessors, but I have no idea what you're trying to do. If it is what I think it is, you're going to need a more complex system than that. Any chance of a more detailed description?

-Dave

Omega
02-26-2009, 12:27 AM
What I'm trying to do is get a single joystick to drive two motors for use with a wheelchair I'm building. I'm thinking pretty much any standard joystick that uses potentiometers. The speed controllers I'll be using take PWM input and... nothing else.

I had a friend of mine tell me about how you could use two OpAmps to get pwm output from a potentiometer. I'll have him draw me up a diagram of what he was talking about.


I want to try and make a simple, cheap reliable system to move a two-wheel drive wheelchair with a single joystick.

mtekk
02-26-2009, 12:52 AM
I had a friend of mine tell me about how you could use two OpAmps to get pwm output from a potentiometer. I'll have him draw me up a diagram of what he was talking about.

You'll need a little more than a few opamps to get PWM out of a potentiometer :). You'd have to use a opamp plus a few passive components to build an oscillator and then you'll need more circuitry to modify the duty cycle based on the clock generated by the oscillator and the resistance of the potentiometer.

Just remember with increased complexity in the circuit the chances of problems/errors/bugs increases dramatically. :dead:

It'd probably be simpler to grab something like a PIC24 with 2 PWM channels and can do 2 AD conversions at a time.