I am trying to get an analog joystick input for any generic joystick converted into a PWM signal and I want to do this with an Arduino. I'm new to Arduinos, however, and I would like to know everything I need to buy in between the joystick and speed controller.
I'm just curious why you would want an anlog input into a pwm output? I thought the only use for pwm outputs was that it simulated an analog output.
You only need an arduino to do this if the analog input's range is from 0 to 5 v. Connect analog input to arduino analog pin and echo out the pwm output through an arduino pwm pin.
Trying to get a joystick (single joystick, two axis) to control two bi-directional DC motors.
Also, I'm not really an electronics, wiring or programming guy (I'm more of a mechanical guy).
What little electronics I am familiar with in this 'field' use PWM input (the speed controllers I'm used to, Victor 884s), and joystick input is always fed through a microcontroller before being output as a PWM signal.
I was thinking standard Arduino board and a Motorshield v3?
The motor control is not the problem; the joystick input is. Unmodified PC analog joysticks use potentiometers set up as variable resistance instead of voltage dividers. This means you need to measure resistance; if you use the joystick as half of a divider, it will be nonlinear and you'll need to do math. If you charge a capacitor through the joystick resistor....it'll be nonlinear and you'll need to do math. You also need to handle calibration
On the other hand, a lot of PC joysticks are easy to convert to voltage dividers with a little simple rewiring of the potentiometers. I've done this a few times with good results.
I would also recommend re-wiring the PC joystick into a potential divider. It's normally a 100k Ohm variable resistor, and reading it in any linear manner will be tricky. A constant-current circuit that puts a few micro-Amps through it would work, but would be more complicated than re-wiring.
If you really must use an un-modified PC-compatible joystick, let me know and we'll see if we can come up with a circuit!
The joysticks I am using are basically potentiometers for each axis. I just used a female joystick connector hooked up power (+5v) to the power joystick pins and then hooked the signal pins into the analog inputs. The potentiometers give me between 0-5v depending on their position and therefore give me 0-1023 for analog inputs using analogRead(). You may have to check if the joysticks you are using are standard game port pinouts using a volt-ohm meter.