Khaled Md. SaifullahShahadat Hossain AfridiAvijit Datta
Published

Smart Wheelchair

This is a smart wheelchair

IntermediateFull instructions provided4 hours1,531
Smart Wheelchair

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
DC motor (generic)
×1
Rocker Switch, Non Illuminated
Rocker Switch, Non Illuminated
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
5 mm LED: Red
5 mm LED: Red
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Smart Industry Fritzing File

Schematics

Smart Industry Schematic Disgram

Code

Wheelchair Code

C/C++
int motorRightA = 8;    //Right Motor-clockwise
int motorRightB = 9;   //Right Motor-anticlockwise
int motorLeftA = 11;   //Left Motor-clockwise
int motorLeftB = 10;   //Left Motor-clockwise
int trigPin1 = 12;     // Trig Pin
int echoPin1 = 13;     // Echo Pin
int light = 5;
long duration1;
int distance1;
char bt = 0;            //Bluetooth Control
int trigPin2 = 7;       // Trig Pin
int echoPin2 = 6;       // Echo Pin
long duration2;
int distance2;
int buzzer = 4;
int pushButton = 3;
void setup()
{
  pinMode(motorRightA, OUTPUT);
  pinMode(motorRightB, OUTPUT);
  pinMode(motorRightB, OUTPUT);
  pinMode(motorLeftB, OUTPUT);
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  pinMode(trigPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  pinMode(light, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(pushButton, INPUT_PULLUP);
  Serial.begin(9600);
}
void loop()
{
  //Light On Off
  lightOnOff();
  //Panic Button
  panicSound();

  //  Right
  digitalWrite(trigPin1, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin1, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin1, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  duration1 = pulseIn(echoPin1, HIGH);
  // Calculating the distance
  distance1 = duration1 * 0.034 / 2;
  // Prints the distance on the Serial Monitor
  Serial.print("Distance: ");
  Serial.println(distance1);

  // Left 
  digitalWrite(trigPin2, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin2, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin2, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  duration2 = pulseIn(echoPin2, HIGH);
  // Calculating the distance
  distance2 = duration2 * 0.034 / 2;
  // Prints the distance on the Serial Monitor
  Serial.print("Distance: ");
  Serial.println(distance2);

  if (distance1 <= 20 || distance2 <= 20) {
    //Stop Wheel Chair
    digitalWrite(motorRightA, LOW);
    digitalWrite(motorRightB, LOW);
    digitalWrite(motorLeftA, LOW);
    digitalWrite(motorLeftB, LOW);
    control();
  }
  else {
    control(); // Call All the Control
  }
}

// All the Controls of the Wheel Chair
void control() {
  if (Serial.available() > 0)
  {
    bt = Serial.read();
    if (bt == 'F')       //move forwards
    {
      digitalWrite(motorRightA, HIGH);
      digitalWrite(motorLeftA,  HIGH);
    }
    else if (bt == 'B')       //move backwards
    {
      digitalWrite(motorRightB, HIGH);
      digitalWrite(motorLeftB, HIGH);
    }
    else if (bt == 'S')     //stop!
    {
      digitalWrite(motorRightA, LOW);
      digitalWrite(motorRightB, LOW);
      digitalWrite(motorLeftA, LOW);
      digitalWrite(motorLeftB, LOW);
    }
    else if (bt == 'R')    //right
    {
      digitalWrite(motorRightA, LOW);
      digitalWrite(motorRightB, LOW);
      digitalWrite(motorLeftA, HIGH);
      digitalWrite(motorLeftB, LOW);
    }
    else if (bt == 'L')     //left
    {
      digitalWrite(motorRightA, HIGH);
      digitalWrite(motorRightB, LOW);
      digitalWrite(motorLeftA, LOW);
      digitalWrite(motorLeftB, LOW);
    }
    else if (bt == 'I')    //forward right
    {
      digitalWrite(motorRightA, HIGH);
      digitalWrite(motorRightB, LOW);
      digitalWrite(motorLeftA, LOW);
      digitalWrite(motorLeftB, HIGH);
    }
    else if (bt == 'G')    //forward left
    {
      digitalWrite(motorRightA, LOW);
      digitalWrite(motorRightB, HIGH);
      digitalWrite(motorLeftA, HIGH);
      digitalWrite(motorLeftB, LOW);
    }
  }
}

void lightOnOff() {

  if (bt == 'O') {
    digitalWrite(light, HIGH);
  }
  else if (bt == 'o') {
    digitalWrite(light, LOW);
  }
}
void panicSound() {
  int val = digitalRead(pushButton);
  if (val == LOW) {
    digitalWrite(buzzer, HIGH);
  } else {
    digitalWrite(buzzer, LOW);
  }
}

Smart Industry

Credits

Khaled Md. Saifullah

Khaled Md. Saifullah

3 projects • 6 followers
Technology and robotics fascinate me a lot. I love to build up different types of projects that are related to our daily life.
Shahadat Hossain Afridi

Shahadat Hossain Afridi

1 project • 3 followers
Avijit Datta

Avijit Datta

1 project • 2 followers

Comments