Super NoOb here I recently acquired full jazzy motorized wheel chair and an arduino. Im attempting to control the hbridges via hacking the joystick control. This link here - YouTube does exactly that. Right now Id be happy getting the motors to move hooked up to my computer with wireless to follow. Uploaded pic is of pcb where joystick 8 pin attaches... Can I use my arduino to read pins outputs? If so what do I do? Also notice above pin input there are 4 unused solder points on the board marked top to bottom: Gnd, on/off, +5v, and Spd+. Does that sound like a thing I can use? Any help would be much appreciated. Thanks
That's mine. I will post my research here when I get a chance.
You will need this: D50800-03.PDF
Here is the sketch for trapping data from the joystick. No connection to the chair is needed for this.
// Joystick Pins
// |8 7|
// |6 5
// |4 3
// |2 1|
// 1 = 5V
// 2 = Left_Right 1
// 3 = 0V
// 4 = Fore_Aft 1
// 5 = Fore_Aft 2
// 6 = Center
// 7 = Left_Right 2
// 8 = Not connected
// Arduino 5V -> Joystick Pin 1
// Arduino GND -> Joystick Pin 3
int Reference_In = A0; // Joystick Pin 6
int Fore_Aft_In = A1; // Joystick Pin 2
int Left_Right_In = A2; // Joystick Pin 4
int Reference_Value = 0;
int Fore_Aft_Value = 0;
int Left_Right_Value = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
Reference_Value = analogRead(Reference_In);
Fore_Aft_Value = analogRead(Fore_Aft_In);
Left_Right_Value = analogRead(Left_Right_In);
Serial.print("RV (");
Serial.print(Reference_Value);
Serial.print(") ");
Serial.print("FA (");
Serial.print(Fore_Aft_Value);
Serial.print(") ");
Serial.print("LR (");
Serial.print(Left_Right_Value);
Serial.print(")");
Serial.println();
}
Here is the sketch for controlling the chair through the stalk. No connection to the joystick is needed.
// Chair Pins
// |2 1|
// |4 3
// |6 5
// |8 7|
// 1 = 5V
// 2 = Left_Right 1
// 3 = 0V
// 4 = Fore_Aft 1
// 5 = Fore_Aft 2
// 6 = Center
// 7 = Left_Right 2
// 8 = Not connected
int Reference_PWM = 9;
int Fore_Aft_PWM = 10;
int Left_Right_PWM = 11;
int JazzyNeutral = 250; // Volts * 100
int JazzyLower = 111; // Volts * 100
int JazzyUpper = 389; // Volts * 100
int PWMLower = 0;
int PWMUpper = 255;
int VoltsLower = 0;
int VoltsUpper = 500;
void setup() {
Neutral(JazzyNeutral);
delay(5000); // Allow time to turn on the control stalk
}
void loop() {
// Forward
Fore_Aft(JazzyUpper);
delay(5000);
// Stop
Fore_Aft(JazzyNeutral);
delay(5000);
// Reverse
Fore_Aft(JazzyLower);
delay(5000);
// Stop
Fore_Aft(JazzyNeutral);
delay(5000);
// Right
Left_Right(JazzyUpper);
delay(5000);
// Stop
Left_Right(JazzyNeutral);
delay(5000);
// Left
Left_Right(JazzyLower);
delay(5000);
// Stop
Left_Right(JazzyNeutral);
delay(5000);
}
void Neutral(int Volts){
Reference(Volts);
Fore_Aft(Volts);
Left_Right(Volts);
}
void Reference(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Reference_PWM, Pulses);
}
void Fore_Aft(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Fore_Aft_PWM, Pulses);
}
void Left_Right(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Left_Right_PWM, Pulses);
}
Here is a sketch that combines the two; Pass the joystick through the arduino back to the chair.
// Jazzy Select 6
// Joystick Pins
// |8 7|
// |6 5
// |4 3
// |2 1|
// Chair Pins
// |2 1|
// |4 3
// |6 5
// |8 7|
// 1 = 5V
// 2 = Left_Right 1
// 3 = 0V
// 4 = Fore_Aft 1
// 5 = Fore_Aft 2
// 6 = Center
// 7 = Left_Right 2
// 8 = Not connected
int Reference_In = A0;
int Fore_Aft_In = A1;
int Left_Right_In = A2;
int Reference_PWM = 9;
int Fore_Aft_PWM = 10;
int Left_Right_PWM = 11;
int AnalogLower = 0;
int AnalogUpper = 1023;
int PWMLower = 0;
int PWMUpper = 255;
int VoltsLower = 0;
int VoltsUpper = 500;
int JazzyNeutral = 250;
int JazzyLower = 111;
int JazzyUpper = 389;
void setup() {
Neutral(JazzyNeutral);
Serial.begin(9600);
delay(5000);
}
void loop() {
// Pass the joystick through the arduino back to the chair
int Reference_Value = analogRead(Reference_In);
int Fore_Aft_Value = analogRead(Fore_Aft_In);
int Left_Right_Value = analogRead(Left_Right_In);
int Reference_Volts = map(Reference_Value, AnalogLower, AnalogUpper, JazzyLower, JazzyUpper);
int Fore_Aft_Volts = map(Fore_Aft_Value, AnalogLower, AnalogUpper, JazzyLower, JazzyUpper);
int Left_Right_Volts = map(Left_Right_Value, AnalogLower, AnalogUpper, JazzyLower, JazzyUpper);
Reference(Reference_Volts);
Fore_Aft(Fore_Aft_Volts);
Left_Right(Left_Right_Volts);
}
void Neutral(int Volts){
Reference(Volts);
Fore_Aft(Volts);
Left_Right(Volts);
}
void Reference(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Reference_PWM, Pulses);
}
void Fore_Aft(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Fore_Aft_PWM, Pulses);
}
void Left_Right(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Left_Right_PWM, Pulses);
}
I forgot to mention, on the PWM you will need a resistor capacitor circuit. Connect the PWM to a 1k resistor, then the positive terminal of a 16v 68uf capacitor. The negative terminal of the capacitor goes to ground. The PWM is pretty fast but the chair is super picky. The cap will keep the volts where you need them. I was unable to get this to work without the resistor capacitor circuit. The resistor and capacitor don't have to be exact, that is just what I had on hand that worked.
After I upload the sketch how should I be controlling the motors from through the arduino? joystick isn't working
impellbm:
Hey its been a few weeks since we last spoke hows everything going?What exactly is the first code supposed to do I see when I hook it up it shows me values that corresponds with the movement of my joy stick but where does the trapping come in at?
The arrows program fails to connect every time.
The third code was for joystick to arduino and back to my jazzy controller but it wont power up if I do not have the wires hooked up as they were before I cut them. I get seven blinking lights and then it powers off.
Help with any of these issues would be greatly appreciated. I'm new to this and its very disheartening to not see any results. Thanks
Okay, here goes. The joystick is powered by the arduino and no longer hooks up to the chair in any way. To control the chair the joystick is not even needed. I leave the joystick hooked up to my arduino in case I want to take over manual control from the arduino.
The 5v goes into the joystick and is passed back on three analog lines. One is a reference that never changes; it stays at 2.5v. The other two lines are the X and Y axis on the joystick. With the joystick in the untouched neutral position you should get 2.5v on each of them as well.
The arduino reads the analog line up to 5 volts (I think) this translates into a number between 0 at 0v and 1023 at 5v. 2.5v should read around 512.
The control stalk monitors the theee analog lines.
These power chairs are made for folks that can't move too well so they tend to be over-safe in their design. Any issue with the chair and they shut down.
If you turned on the chair while you were pushing on the joystick you could cause an injury. So if the stalk detects that the joystick is not in neutral then it will throw an error.
To turn on the chair you must have 2.5v on all three analog lines.
The PWM will put out up to 5v (I think) and is a range from 0 to 255 whit 0 at 0v and 255 at 5v.
To get 2.5v out of a PWM you need to send the signal 256, you may have to play with this number up or down a bit to gt it just right.
If you picture tapping a ballon into the air so that it stays afloat at eye level this is a bit like using PWM to holt a voltage. As the ballon falls you give it another tap. It will more or less stay in the same general area. This is not good enough for the Jazzy and it will detect a fault.
You must use a capacitor to act as a pool to hold power. This is more like keeping your hand under tha ballon to ensure it stays at the right level.
The capacitor will tend to float aroud a bit too as it gains or looses power. With a resistor to ground on the negative lead of the capacitor you can drain the pool at a predictable rate and level the whole thing out.
The resistor/capacitor circut is pretty common. I used a 1k resistor and a 16v 68uf capacitor. This was a completly random selection that just happened to work. (I am not an electronics person)
With the 2.5v on each analog line, and the wheel locks in the locked position you should be able to turn on your chair.
If the chair won't come on then the resistor/capacitor circut is too far out of spec or the 256 sent to the PWM needs to be adjusted a bit.
Looking at the PDF I attached you can see that X and Y have a set range. If you go out of the range the chair will show a fault and shut down.
Good luck.
hey james I couldnt seem to get past the safety features on this thing to turn my chair on. so im abandoning that ship because im to the point where my mosfets are breaking off and the joystick wont even work at all from being moved around so much i was trying to just pass the two sides out via ethernet but im afraid even that is not working anymore. Any idea where to cut out that hbridge and how to connect straight to arduino?
The mosfets are in the ECU. I never messed with that. I did everthing with a joystick bypass. I will not be able to advise you one matters of the ECU. I suggest a third party motor controller. I have had great luck with the Sabertooth 2x25. I just bypassed the ECU altogether. I do have a splice in the power lines so that I can use the built in charger though.
joystick wont even work at all from being moved around
If the joystick uses pots for stick position detection, I'd look at jumpering the stick pots out and substitute them with pots rotated by servos.
I think its the board I might have messed it up in the process I cut the ribbon wire and soldered out to get on my bread board everything was hunky dorey but since I swapped to ethernet to make the connection in attempt to close up the case and have an easy way of still getting to the breadboard I might have messed something up. I will look into that though thanks
I bought a sabertooth and wrote some simple code to get the motors moving. I swapped out to 12v motors for learning purposes. Can I see your code? Also not sure what happened with the arrow command before but is definitely working now. I think I might have had to update my java. Do you have any VERY SIMPLE examples on how to include that in the code to get it to work? Could you possibly write one small sketch to show me how up would control one motors direction? Thanks! Heres my code.
int outputValue=10;
void setup()
{
pinMode(10, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Serial.print(outputValue);
for (int i=128; i<255; i++)
{
analogWrite(10, i);
delay(75);
}
for (int i=255; i>=128; i--)
{
analogWrite(10, i);
delay(50);
}
analogWrite(10, 128);
delay(2000);
}
This is the loop I used in the video:
int iMotorA = 9;
int iMotorB = 10;
void setup()
{
pinMode(iMotorA, OUTPUT);
pinMode(iMotorB, OUTPUT);
digitalWrite(iMotorA, LOW);
digitalWrite(iMotorB, LOW);
for(int i = 1500; i <= 2000; i++) {
Go(i);
delay(20);
}
}
void loop() {
for(int i = 2000; i >= 1000; i--) {
Go(i);
delay(20);
}
for(int i = 1000; i <= 2000; i++) {
Go(i);
delay(20);
}
}
void Go(int intPWM) {
digitalWrite(iMotorA, HIGH);
digitalWrite(iMotorB, HIGH);
delayMicroseconds(intPWM);
digitalWrite(iMotorA, LOW);
digitalWrite(iMotorB, LOW);
}
thanks got that to work fine any attempts at serial communication?
I may go back to PWM. With the method I have now the chair will sometimes simply wonder off because successive commands never make it for whatever reason. PWM will act as more if a dead man swithc (I hope) so if the arduino is out of contact the morots should stop spinning. I am glad you got things working.
jameshappy:
Total noob here, just getting my feet wet. I'm trying to replicate what you have done here, but I'm unsure how to proceed. My goal is to have the Jazzy interfaced with an rc receiver through the arduino keeping the stick available if possible. Is this possible?
Second question for the pwm inputs what is the connection order for cap, resistor, etc. down the page you mention placing the resistor on the ground leg of the cap, but the circuit you built looks like it goes from the arduino pins through a resistor to the pwm input and the cap + leg, then neg cap leg to ground. Could yo clarify this for me? I think I'm dense
The last example on the page shows that you can use both the arduino and the joystick by passing joystick through arduino, than sending code to control them. The way I wired the rc circuit was from arduinos digital pin to a br bl o resistor to the capacitor from that same pin out to the circuit. Make sure to tie caps other pin, circuit, and arduino grounds together. It should work from there. Play with resistor and capacitors values to get desired response. Feel free to ask other questions and let me know how you did because I m still learning.
The last example on the page shows that you can use both the arduino and the joystick by passing joystick through arduino, than sending code to control. The way I wired the rc circuit was from arduinos digital pin to a br bl o resistor to the capacitor from that same pin out to the circuit. Make sure to tie the caps other pin, circuit, and arduino grounds together. It should work from there. Play with resistor and capacitors values to get desired response. Feel free to ask other questions and let me know how you did.
I need some help, I have the voltages right at 2.5v but still can't get the chair to come on with out it alarming out. I used the joystick pass through code and modified it to work with a RC controller. I notice the Ref voltage dosen't return 2.5v
// Jazzy Select 6
// Joystick Pins
// |8 7|
// |6 5
// |4 3
// |2 1|
// Chair Pins
// |2 1|
// |4 3
// |6 5
// |8 7|
// 1 = 5V
// 2 = Left_Right 1
// 3 = 0V
// 4 = Fore_Aft 1
// 5 = Fore_Aft 2
// 6 = Center
// 7 = Left_Right 2
// 8 = Not connected
int Reference_In = A0;
unsigned long Fore_Aft_In = 7;
unsigned long Left_Right_In = 8;
int Reference_PWM = 9;
int Fore_Aft_PWM = 10;
int Left_Right_PWM = 11;
int DigitalLower = 1000;
int DigitalUpper = 1900;
int AnalogLower = 0;
int AnalogUpper = 1023;
int PWMLower = 0;
int PWMUpper = 255;
int VoltsLower = 0;
int VoltsUpper = 500;
int JazzyNeutral = 250;
int JazzyLower = 111;
int JazzyUpper = 389;
void setup() {
pinMode(Fore_Aft_In, INPUT);
pinMode(Left_Right_In, INPUT);
pinMode(Fore_Aft_In, LOW);
pinMode(Left_Right_In, LOW);
Neutral(JazzyNeutral);
//Serial.begin(9600);
delay(5000);
}
void loop() {
// Pass the joystick through the arduino back to the chair
int Reference_Value = analogRead(Reference_In);
int Fore_Aft_Value = pulseIn(Fore_Aft_In, HIGH);
int Left_Right_Value = pulseIn(Left_Right_In, HIGH);
int Reference_Volts = map(Reference_Value, AnalogLower, AnalogUpper, JazzyLower, JazzyUpper);
int Fore_Aft_Volts = map(Fore_Aft_Value, DigitalUpper, DigitalLower, JazzyLower, JazzyUpper);
int Left_Right_Volts = map(Left_Right_Value, DigitalUpper, DigitalLower, JazzyLower, JazzyUpper);
Reference(Reference_Volts);
Fore_Aft(Fore_Aft_Volts);
Left_Right(Left_Right_Volts);
}
void Neutral(int Volts){
Reference(Volts);
Fore_Aft(Volts);
Left_Right(Volts);
}
void Reference(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
//analogWrite(Reference_PWM, Pulses);
analogWrite(Reference_PWM, 129);
}
void Fore_Aft(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Fore_Aft_PWM, Pulses);
}
void Left_Right(int Volts){
int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
analogWrite(Left_Right_PWM, Pulses);
}
PWM may make the correct volts on a multi-meter but the chair is fast enought to tell it's PWM and not DC. Did you make an RC circuit? You code has 128 hard coeded rather than use the mapped value.
Alos, is this just for chair control or do you plan to power other things from the same supply? I spent a good deal of time gettign this working only to find out that the chair would detect a power drain and shut off the ECU.
Good luck.