Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #30 on: December 14, 2012, 01:01:47 pm » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #31 on: December 14, 2012, 01:24:54 pm » |
// 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
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #32 on: December 15, 2012, 02:04:57 pm » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #33 on: December 15, 2012, 04:01:08 pm » |
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
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #34 on: December 16, 2012, 12:37:07 pm » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #35 on: December 16, 2012, 03:05:26 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #36 on: December 17, 2012, 10:52:35 am » |
thnx alot dear james ....i will use it
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #37 on: December 20, 2012, 09:56:01 am » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #38 on: December 20, 2012, 12:59:32 pm » |
Use fritzing to view this file: Arduino2Jazzy.fzzEDIT: It seems GoDaddy won't host fzz files. Saved as zip.
|
|
|
|
« Last Edit: December 20, 2012, 01:07:14 pm by jameshappy »
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #39 on: December 21, 2012, 04:46:09 am » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #40 on: December 21, 2012, 12:30:19 pm » |
I have updated the file to show the hookup for the joystick as well: Arduino2Jazzy.fzzSomething 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
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #41 on: December 21, 2012, 02:34:51 pm » |
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
Newbie
Karma: 0
Posts: 37
C# Developer
|
 |
« Reply #42 on: December 21, 2012, 02:38:13 pm » |
Yes, you don't need the joystick at all for the arduino to controll the chair.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #43 on: December 22, 2012, 10:46:15 am » |
so how would be the shape of input signal ?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #44 on: December 23, 2012, 01:48:28 pm » |
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
|
|
|
|
|
|