I am playing with a salvaged electric wheelchair to see if it could easily be adapted for a robot base. The system is 24V (Two 12V U1 deep cycle batteries). Rather than build a motor controller, I thought it would be easy to adapt the controller already on the chair. My thought is to mimic the joystick using the Arduino Uno Rev 3.
The joystick is a PG Drives Technology D50800 having an 8 wire ribbon connector to the driver board. The joystick must be connected and at voltage in order for the controller to work. If the ribbon cable to the joystick is disconnected, a fault is detected and the controller ceases to function.
When mapping out the voltages on the joystick pins, Pin 1 is 5 Vcc, Pin 3 Gnd and pins 2 and 4-7 are all at 2.5V. When the joystick is moved forward, Pins 4-5 go low (1.10V) and remaining Pins remained at 2.5V. When the stick is moved back, Pins 4-5 go high (3.8V) and remaining Pins are unchanged. When the stick is moved left, Pins 2,7 go High; when moved right, Pins 2,7 go low (1.10V). Pin 6 never changed and stayed at 2.5V and I think is the source for the divided voltage across the other pins. Pin 8 is apparently not used.
If I understand this correctly, to replace the joystick with the Arduino, I need to figure out a way to keep a constant voltage (2.5V) on all pins 2-7. Then when I want the chair to move in a given direction, I write to the pin to go high or low, depending. Power (5V) is supplied by Pin 1. I thought I could use the input from Pin 6 as a reference voltage, but how. My question is how do I keep a center voltage output to all pins?
For each of the two channels (4+5:Forward and Back, 2+7: Left and Right) connect them with 10K resistors to both +5 and Ground. This will form voltage dividers that will bias the pins to 2.5V. Then connect each of the two channels through a resistor to an Arduino pin. When the Arduino pin is set to INPUT(& LOW) the output will stay at 2.5V. When the Arduino pin is OUTPUT & HIGH the voltage will go up. When the Arduino pin is OUTPUT & LOW the voltage will go down.
The resistor to the Arduino pin will determine how far the voltage swings. A 4.2K resistor should get you voltages close to 1.1 and 3.8.
John
Thanks so much for you input. It was extremely helpful and I was able to duplicate the outputs of the joystick for the most part. Still some idiosyncrasies created by the controller board that present a problem. Hopefully the attached will help in understanding.
Rather than rely solely upon autonomous control, I thought it would be nice to sometimes manually control, so I decided to try to leave the joystick in place and just connect the Arduino in parallel. I placed a switch on the power line from the joystick (5v) to turn the Arduino on and off when the joystick is in neutral and voltages across all lines are balanced.
I could not create two voltage dividers, as that created voltage imbalances all over the place except in neutral. So I have decided to rely upon the voltage divider in the joystick, and then simply provide the low and high inputs on the respective channels (2,7 and 4,5). My initial attempt was to jump pins 2,7 and pins 4,5 together, run them in parallel with their own resisters before connecting to the DigitalOut pins. When not connected to the controller board, that worked fine. However, when I connected the joystick and Arduino to the board, I receive a fault. I suspect that by shorting across pins 2,7 and 4,5, that created the error on the board. My next attempt is to place a resister on each channel (2 and 7 and 4 and 5) downstream of the jumper connection so I can put parallel outputs on each. I know that by placing the resisters in parallel, I am going to cut current so I have to be mindful of the amount of resistance.
My question is does that sound like a logical approach, or does this create more questions than options. Any thoughts would be helpful.