Joystick potentiometer on digital pins
RMCanaway
Posts: 16
in Propeller 1
I've been developing a robot controller over the past couple months, and one thing I'm having difficulty with is the joysticks. They are two 10K potentiometers and I've been using Resistive Capacitance to operate them, However they don't wanna seem to work too well, The values are quite jumpy. My question is, Would a A/D converter be useful? I'm not trying to drain too much power from the batteries, however if the converters are necessary i will take the risk of batteries dying quicker.
on the transmit side i have
repeat
rc.time(8, 1, @rv)
xbee.tx("!")
repeat 1
xbee.tx(rv & $FF)
and on the receiver I have,
repeat
repeat until xbee.rx("!")
rv := xbee.rx & $FF
if rv > 248
pst.Str(String("Servo 1 activated"))
on the transmit side i have
repeat
rc.time(8, 1, @rv)
xbee.tx("!")
repeat 1
xbee.tx(rv & $FF)
and on the receiver I have,
repeat
repeat until xbee.rx("!")
rv := xbee.rx & $FF
if rv > 248
pst.Str(String("Servo 1 activated"))
Comments
Here's a simple RC method that I used in a commercial audio player (EFX-TEK AP-8+). This code could be modified to read by channels at once by using both counters.
I have since switched to ADC and found it works much better. I used the PMC3202.
I discus this here: Pan and Tilt Servo
Mike
Again, this was for a commercial audio player, and we couldn't very well have a situation where the volume seemed to be bouncing around on its own.
I have also coded commercial camera platform controllers; another situation where we have to be a little careful with noise bits. In that particular case, I used a background cog to sample each ADC channel eight times per frame, then took a running average of those samples. The camera platform controllers, of course, use very high quality joysticks.
With the joystick I had, I had a very limited throw which required a high resolution to fit the application. I wanted a range of 1000 to 2000 and that required at least 10 bits of resolution. Dropping bits was not an option.
Mike
If you want to avoid the interfacing issues to analogue joysticks you might consider a mobile phone bluetooth joystick app. There are single and double joystick mobile phone apps widely available using bluetooth and a serial protocol. They also have options for data display and switch control.
I just found the whole analogue controller sub-project clunky with all the components - batteries, circuit boards, switches, joysticks, data display and a cable.
I used Bluetooth (BT) Joystick Commander on an Android phone as a quick robot/prototype controller for a long time, using JonnyMac's excellent coding as the basis.
That old phone is gone and the app with it, but I am thinking of reinstating the latest version of the app on my new phone.