Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 |
This wheel chair is designed for the disabled who depend on others for helping them go from one place to another. This project helps them move on wheelchairs from one place to another without the help of anyone. They can control the wheel chair simply using hand gestures.
The arduino uno controls the motors of the wheelchair and the arduino nano is attached with the MPU6050 used to detect movement of the hand the data is wirelessly sent to the uno which responds according to the hand movement.
Code for wheel chair(Arduino uno)
C/C++upload this code to your arduino uno
connect the motors and NRF module
connect the motors and NRF module
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup() {
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4,OUTPUT);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address); //Setting the address at which we will receive the data
radio.setPALevel(RF24_PA_MIN); //You can set this as minimum or maximum depending on the distance between the transmitter and receiver.
radio.startListening(); //This sets the module as receiver
}
void loop()
{
char text = ""; //Saving the incoming data
radio.read(&text, sizeof(text)); //Reading the data
Serial.println(text);
switch(text)
{
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
case 'S':
Stop();
break;
/* case 'O':
Fleft();
break;
case 'N':
Fright();
break;
case 'P':
Bleft();
break;
case 'M':
Bright();
break;
*/
}
delay(20);
}
void forward()
{
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
void back()
{
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
}
void left()
{
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
}
void right()
{
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
}
void Stop()
{
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
}
/*
void Fright()
{
right();
forward();
}
void Fleft()
{
left();
forward();
}
void Bleft()
{
left();
back();
}
void Bright()
{
right();
back();
}
*/
#include <GY6050.h>
#include <Wire.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
int X=0;
int Y=0;
GY6050 gyro(0x68);
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
Serial.begin(9600);
Wire.begin();
gyro.initialisation();
delay(2500);
}
void loop()
{
X= gyro.refresh('A', 'X');
Y= gyro.refresh('A', 'Y');
if(X>-10 && X<10 && Y>-10 && Y<10)
{
const char text[] = "S";
radio.write(&text, sizeof(text));
}
if(X<-50 && Y>-10 && Y<10)
{
const char text[] = "F";
radio.write(&text, sizeof(text));
}
if(X>50 && Y>-10 && Y<10)
{
const char text[] = "B";
radio.write(&text, sizeof(text));
}
if(Y<-50 && X>-10 && X<10)
{
const char text[] = "R";
radio.write(&text, sizeof(text));
}
if(Y>50 && X>-10 && X<10)
{
const char text[] = "L";
radio.write(&text, sizeof(text));
}
if(Y<-50 && X<-30)
{
const char text[] = "N";
radio.write(&text, sizeof(text)); //right+forward
}
if(Y<-50 && X>30)
{
const char text[] = "M";
radio.write(&text, sizeof(text)); //R+B
}
if(Y>50 && X<-30)
{
const char text[] = "O";
radio.write(&text, sizeof(text)); ; //L+F
}
if(Y>50 && X>40)
{
const char text[] = "P";
radio.write(&text, sizeof(text)); //L+B
}
}
Comments