Loading...
Pages: [1] 2 3 ... 5   Go Down
Author Topic: interfacing arduino with jazzy power chair pcb  (Read 3870 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 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 


Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That's mine. I will post my research here when I get a chance.
You will need this: D50800-03.PDF
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the sketch for trapping data from the joystick. No connection to the chair is needed for this.
Code:
// 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.
Code:
// 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.
Code:
// 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);
}
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 29, 2012, 10:50:17 pm by jameshappy » Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset




« Last Edit: January 29, 2012, 10:47:03 pm by jameshappy » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After I upload the sketch how should I be controlling the motors from through the arduino? joystick isn't working :/
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: February 11, 2012, 02:02:58 am by jameshappy » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
Tesla Member
***
Karma: 50
Posts: 6546
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
  }
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the loop I used in the video:
Code:
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);
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks got that to work fine any attempts at serial communication?
Logged

Reno Nevada USA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
C# Developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1] 2 3 ... 5   Go Up
Print
 
Jump to: