WheelChair
This is an WheelChair controled by arduino with single joystick for 2 DC motor of 24 Volts. Only need more specialwork in control the speed.
Components and supplies
1
Arduino UNO
1
Relay Module (Generic)
Apps and platforms
1
Arduino IDE
Project description
Code
DcMotorRelayControl
arduino
Contro DC motor with module relay
1/* 2 This example code is in the public domain. 3 */ 4 5#define PortM1 7 // CW is defined as pin #7// 6#define PortM10 8 // CW is defined as pin #8// 7 8#define PortM2 6 // CW is defined as pin #7// 9#define PortM20 5 // CW is defined as pin #8// 10 11int inByte = 0; // incoming serial byte 12 13// the setup routine runs once when you press reset: 14void setup() { 15 // initialize serial communication at 9600 bits per second: 16 Serial.begin(9600); 17 //if receive serial value 18 19 pinMode(PortM1, OUTPUT); //Set CW as output 20 pinMode(PortM10, OUTPUT); //Set CW as output 21 //Orientations 22 pinMode(PortM2, OUTPUT); //Set CW as output 23 pinMode(PortM20, OUTPUT); //Set CW as output 24} 25 26// the loop routine runs over and over again forever: 27void loop() { 28 29 if (Serial.available() > 0) { 30 //Run instruction 31 inByte = Serial.read(); 32 } 33 34 35 //MOTOR ADVANCE 36 if(inByte == 'W'){ 37 //A W D S 38 //First Motor Right 39 digitalWrite(PortM1,LOW); //Motor Runs Clockwise 40 digitalWrite(PortM10,HIGH); //Motor Runs Clockwise 41 // Second Motor Left 42 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 43 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 44 //delay(2000);//For 1 second 45 } 46//MOTOR REVERSE 47 if(inByte == 'S'){ 48 49 //First Motor Right 50 digitalWrite(PortM1,HIGH); //Motor Runs Clockwise 51 digitalWrite(PortM10,LOW); //Motor Runs Clockwise 52 // Second Motor Left 53 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 54 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 55 //delay(2000);//For 1 second 56 } 57 // MOTOR LEFT 58 if(inByte == 'A'){ 59 60 //First Motor 61 digitalWrite(PortM1,LOW); //Motor Runs Counter-Clockwise 62 digitalWrite(PortM10,HIGH); //Motor Runs Counter-clockwise 63 // Second Motor 64 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 65 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 66 //delay(2000);//For 1 second 67 } 68 69 // MOTOR RIGHT 70 if(inByte == 'D'){ 71 //First Motor 72 digitalWrite(PortM1,HIGH); //Motor Runs Counter-Clockwise 73 digitalWrite(PortM10,LOW); //Motor Runs Counter-clockwise 74 // Second Motor 75 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 76 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 77 //delay(2000);//For 1 second 78 } 79 //MOTOR STOP 80 if(inByte == 'Q'){ 81 //first motor 82 digitalWrite(PortM1,LOW); 83 digitalWrite(PortM10,LOW);//Motor stops// 84 //second motor 85 digitalWrite(PortM2,LOW); 86 digitalWrite(PortM20,LOW);//Motor stops// 87 } 88 89} 90
DCMotor Control
arduino
DC motor control a pair of motors to move rigth left, up down
1/* 2 This example code is in the public domain. 3 */ 4 5#define PortM1 7 // CW is defined as pin #7// 6#define PortM10 8 // CW is defined as pin #8// 7 8#define PortM2 6 // CW is defined as pin #7// 9#define PortM20 5 // CW is defined as pin #8// 10 11int inByte = 0; // incoming serial byte 12 13// the setup routine runs once when you press reset: 14void setup() { 15 // initialize serial communication at 9600 bits per second: 16 Serial.begin(9600); 17 //if receive serial value 18 19 pinMode(PortM1, OUTPUT); //Set CW as output 20 pinMode(PortM10, OUTPUT); //Set CW as output 21 //Orientations 22 pinMode(PortM2, OUTPUT); //Set CW as output 23 pinMode(PortM20, OUTPUT); //Set CW as output 24 // stopmotor(); 25} 26 27// the loop routine runs over and over again forever: 28void loop() { 29 30 if (Serial.available() > 0) { 31 //Run instruction 32 inByte = Serial.read(); 33 } 34 35 //MOTOR MOVEMETNTS ADVANCE REVERSE LEFT RIGHT 36 if(inByte == 'W'){ 37 advance(); 38 } 39 if(inByte == 'S'){ 40 reverse(); 41 } 42 if(inByte == 'A'){ 43 left(); 44 } 45 if(inByte == 'D'){ 46 right(); 47 } 48 else if(inByte == 'Q') { 49 stopmotor(); 50 } 51 52} 53 54void advance(){ 55 //First Motor Right 56 digitalWrite(PortM1,LOW); //Motor Runs Clockwise 57 digitalWrite(PortM10,HIGH); //Motor Runs Clockwise 58 // Second Motor Left 59 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 60 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 61} 62 63void reverse(){ 64 //First Motor Right 65 digitalWrite(PortM1,HIGH); //Motor Runs Clockwise 66 digitalWrite(PortM10,LOW); //Motor Runs Clockwise 67 // Second Motor Left 68 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 69 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 70 //delay(2000);//For 1 second 71} 72 73void left(){ 74 //First Motor 75 digitalWrite(PortM1,LOW); //Motor Runs Counter-Clockwise 76 digitalWrite(PortM10,HIGH); //Motor Runs Counter-clockwise 77 // Second Motor 78 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 79 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 80 //delay(2000);//For 1 second 81} 82 83void right(){ 84 //First Motor 85 digitalWrite(PortM1,HIGH); //Motor Runs Counter-Clockwise 86 digitalWrite(PortM10,LOW); //Motor Runs Counter-clockwise 87 // Second Motor 88 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 89 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 90 //delay(2000);//For 1 second 91} 92void stopmotor(){ 93 digitalWrite(PortM1,LOW); 94 digitalWrite(PortM10,LOW);//Motor stops// 95 //second motor 96 digitalWrite(PortM2,LOW); 97 digitalWrite(PortM20,LOW);//Motor stops// 98} 99 100
controljoysticMotor
arduino
Control Dc motors with Joystick using a Relay module
1/* 2 This example code is in the public domain. 3 */ 4 5#define PortM1 7 // CW is defined as pin #7// 6#define PortM10 8 // CW is defined as pin #8// 7 8#define PortM2 6 // CW is defined as pin #7// 9#define PortM20 5 // CW is defined as pin #8// 10 11int inByte = 0; // incoming serial byte 12 13// the setup routine runs once when you press reset: 14void setup() { 15 // initialize serial communication at 9600 bits per second: 16 Serial.begin(9600); 17 //if receive serial value 18 19 pinMode(PortM1, OUTPUT); //Set CW as output 20 pinMode(PortM10, OUTPUT); //Set CW as output 21 //Orientations 22 pinMode(PortM2, OUTPUT); //Set CW as output 23 pinMode(PortM20, OUTPUT); //Set CW as output 24} 25 26// the loop routine runs over and over again forever: 27void loop() { 28 29 if (Serial.available() > 0) { 30 //Run instruction 31 inByte = Serial.read(); 32 } 33 34 35 //MOTOR ADVANCE 36 if(inByte == 'W'){ 37 //A W D S 38 //First Motor Right 39 digitalWrite(PortM1,LOW); //Motor Runs Clockwise 40 digitalWrite(PortM10,HIGH); //Motor Runs Clockwise 41 // Second Motor Left 42 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 43 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 44 //delay(2000);//For 1 second 45 } 46//MOTOR REVERSE 47 if(inByte == 'S'){ 48 49 //First Motor Right 50 digitalWrite(PortM1,HIGH); //Motor Runs Clockwise 51 digitalWrite(PortM10,LOW); //Motor Runs Clockwise 52 // Second Motor Left 53 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 54 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 55 //delay(2000);//For 1 second 56 } 57 // MOTOR LEFT 58 if(inByte == 'A'){ 59 60 //First Motor 61 digitalWrite(PortM1,LOW); //Motor Runs Counter-Clockwise 62 digitalWrite(PortM10,HIGH); //Motor Runs Counter-clockwise 63 // Second Motor 64 digitalWrite(PortM2,LOW);//Motor Runs Counter-Clockwise 65 digitalWrite(PortM20,HIGH);//Motor Runs Counter-Clockwise 66 //delay(2000);//For 1 second 67 } 68 69 // MOTOR RIGHT 70 if(inByte == 'D'){ 71 //First Motor 72 digitalWrite(PortM1,HIGH); //Motor Runs Counter-Clockwise 73 digitalWrite(PortM10,LOW); //Motor Runs Counter-clockwise 74 // Second Motor 75 digitalWrite(PortM2,HIGH);//Motor Runs Counter-Clockwise 76 digitalWrite(PortM20,LOW);//Motor Runs Counter-Clockwise 77 //delay(2000);//For 1 second 78 } 79 //MOTOR STOP 80 if(inByte == 'Q'){ 81 //first motor 82 digitalWrite(PortM1,LOW); 83 digitalWrite(PortM10,LOW);//Motor stops// 84 //second motor 85 digitalWrite(PortM2,LOW); 86 digitalWrite(PortM20,LOW);//Motor stops// 87 } 88 89} 90
Downloadable files
Diagram Wheel Chair
Control DC motors
Diagram Wheel Chair
Control DC Motor
electronic to made by yourself
Control DC Motor

Comments
Only logged in users can leave comments