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

hi jameshappy....i made a  voltage divider circuit to generate voltages same as joystick (D50800-03)...i use arduino mega2560 to control the wheelchair...it will recive signal from sensers circuit ...can i use the code below ? if yes ,to which pin i connect the outputs of the arduino?
my circuit :: sensers==>arduino==>wheelchair

waiting for reply ...thnx

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

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

Arduino 9 - > Chair Pins 6
Arduino 10 - > Chair Pins 4 & 5
Arduino 11 - > Chair Pins 2 & 7
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thnx....but tell me what are you connect to A0,A1,A2 pins? and if you  dont mind explain the following part of the code..im trying to figure out ...but need some help pls

////////////////////////////////
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);
//////////////////////////////
what is the function of map instruction here???
///////////////////////////////
and here???
/////////////
void Reference(int Volts){
  int Pulses = map(Volts, VoltsLower, VoltsUpper, PWMLower, PWMUpper);
  analogWrite(Reference_PWM, Pulses);
}
///////////////////////////////
int JazzyNeutral = 250;
int JazzyLower   = 111;
int JazzyUpper   = 389;

arduino output voltage level can be changed? or 5v standerd ?
Logged

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

That is the code for converting the feed from the chair's joystick. You don't need it unless you want to use the chair's joystick.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes,i dont need to use the chair's joystick.....but can you provide me with the code ....for my wheelchair state? if u don't mind
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 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);
}
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thnx alot dear  james ....i will use it
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear James ... my voltage divider circuit not working properly .... "a joystick fault is indicated.Make sure that the joystick is in the center position before switching on the control system" resulted  after i cut the wire of the joystick  and  soldered it to   RS232 ....
 i connect a power supply with 2.5 v and applyed it to the outputs pins but same error ocured ... i tried with alot of voltages value ... but not worked
im confused ...and i thinking to change this circuit ...
i saw your RC circuit ...is it equivalent to voltage divider circuit ... ?if not can u tell me what to do?
Logged

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

Use fritzing to view this file: Arduino2Jazzy.fzz

EDIT: It seems GoDaddy won't host fzz files. Saved as zip.
« Last Edit: December 20, 2012, 01:07:14 pm by jameshappy » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nice work thanx james ....jest tell me how is the shape of input analoge signal that control the movements on ports A0,A!,&A2 ??? my regards
Logged

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

I have updated the file to show the hookup for the joystick as well:
Arduino2Jazzy.fzz
Something that might be confusing about the fzz file is that the placement of the pins on the chair and joystick matches my pde by number but not by physical location.
« Last Edit: December 21, 2012, 01:18:05 pm by jameshappy » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it is clear now ... you  used

joystick ====>arduino =====> RC circuit ===== > wheelchair

but i dont want to use manual joystick .... !!!!
anyway ... if i use the manual joystick to mimic the wheelchair as u did ...with other 2 inputs A3,A4  (forward/back , right/left) to control the wheelchair from another circuit ...it will be helpfull ?

 
Logged

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

Yes, you don't need the joystick at all for the arduino to controll the chair.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so how would be the shape of input signal ?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

dear james ... i cut the cable between the joystick and module .... i donot remmber
how were the chair pins .... i see your work ... is it ok ??
if u have a picture of your joystick model pls show to me .. to be sure before i connect
...thnx for help

// Joystick Pins
// |8 7|
// |6 5
// |4 3
// |2 1|

// Chair Pins
// |2 1|
// |4 3
// |6 5
// |8 7|

Logged

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