Uncategorized

What is Wrong with this 6DOF Joystick Circuit?

I’m having trouble with a circuit for a new product. Here’s what I’ve got. Can you tell me what I’m doing wrong?

Inspiration

For years I’ve been inspired by the great work of some other makers like InnerBreedFX’s Jonny Poole. A while back he published a video of a 6DOF joystick connected to a Rotary Stewart Platform. He could control the position and motion of the stewart platform by using the joystick. I thought this was fantastic. Now that I’ve got a platform I’m trying to do the same thing. As always, with an eye towards putting it in the store later.

Theory

I build two stewart platforms and call one a joystick. I rip the guts out of the servos in the joystick so that they work as sensors. Instead of sending a PWM signal to tell a motor where to go, the Arduino now receives a reading from the potentiometer inside the joystick sensor. In the other platform everything is normal. It could be connected to the same Arduino or another somewhere else in the universe. All that matters is the signal from the joystick gets sent to the platform so that they move the same. Later I could record and playback a movement or run platform 2 over the web. Remote surgery, anyone? Tele-operated paintball turret?

Implementation

servo to sensor

Then to prototype the workings I set up this breadboard. The screw terminals on the left receive 5v2a. The Arduino and the 5v2a share a common ground (the long blue wire).

6dof joystick circuit

Pin Function
13 joystick servo 1 signal to A0
14 joystick servo 1 5v
15 joystick servo 1 GND
16 joystick servo 2 signal to A1
17 joystick servo 2 5v
18 joystick servo 2 GND
20 joystick servo 3 signal to A2
21 joystick servo 3 5v
22 joystick servo 3 GND
23 joystick servo 4 signal to A3
24 joystick servo 4 5v
25 joystick servo 4 GND
26 joystick servo 5 signal to A4
27 joystick servo 5 5v
28 joystick servo 5 GND
29 joystick servo 6 signal to A5
30 joystick servo 6 5v
31 joystick servo 6 GND
36 RSP servo 1 PWM
37 RSP servo 1 5v
38 RSP servo 1 GND
40 RSP servo 2 PWM
41 RSP servo 2 5v
42 RSP servo 2 GND
44 RSP servo 3 PWM
45 RSP servo 3 5v
46 RSP servo 3 GND
48 RSP servo 4 PWM
49 RSP servo 4 5v
50 RSP servo 4 GND
52 RSP servo 5 PWM
53 RSP servo 5 5v
54 RSP servo 5 GND
56 RSP servo 6 PWM
57 RSP servo 6 5v
58 RSP servo 6 GND

Then I write a little code on the Arduino. There are many milestones on this road. The first is to read a sensor value from a modified servo. Here’s the code to read all six at once.

[code lang=”c”]void setup() {
Serial.begin(57600);
}

void loop() {
Serial.print(analogRead(0)); Serial.print(‘\t’);
Serial.print(analogRead(1)); Serial.print(‘\t’);
Serial.print(analogRead(2)); Serial.print(‘\t’);
Serial.print(analogRead(3)); Serial.print(‘\t’);
Serial.print(analogRead(4)); Serial.print(‘\t’);
Serial.print(analogRead(5)); Serial.print(‘\n’);
delay(100);
}[/code]

Results

When I plug in the servo on pins 13-15 and open the serial window in Arduino I see this:
[code]1023 1023 998 979 957 939
1023 1023 997 974 958 937
1023 1023 1003 981 957 939
1023 1023 1014 994 971 953
1023 1023 1023 1007 987 968
1023 1023 1023 1009 986 971
1023 1023 1017 1002 979 965
1023 1023 1004 986 965 950
1023 1023 997 977 956 939
1023 1023 997 975 957 937
1023 1023 1003 982 957 941
1023 1023 1014 996 972 956
1023 1023 1022 1006 987 968
1023 1023 1022 1008 985 970
1023 1023 1016 1000 978 963
1023 1023 1004 986 964 949
1023 1023 997 976 958 939
1023 1023 998 976 956 938
1023 1023 1005 983 958 942
1023 1023 1017 999 973 958
1023 1023 1022 1006 988 969
[/code]
Each column is the value read from an analog pin on the Arduino. columns 2-5 should be random and changing because the value is floating – there’s nothing giving a signal to those pins so they’re delivering garbage data. The first column should be deliverying the signal from pin 13 – I turn the servo horn, the potentiometer changes, the value goes between 0 and 1023.

…except that isn’t happening. Turning the servo horn does nothing, it stays at 1023. I thought at I was getting full blast because the GND line for the servo was not working, forcing the electricity to follow the only remaining path. My multimeter says the GND line is fine and the solder connection looks good so I don’t think that’s it.

I don’t know if I fried the potentiometer or if I’m missing something else. Do I need pull-up resistors at each servo or something? I’m out of my depth when it comes to electrical engineering.

If you have an idea, please comment below. I’d love to learn from your electronic mastery.