Project tutorial
The Motion Mobile: Gesture-Controlled Car

The Motion Mobile: Gesture-Controlled Car

Have you ever wanted to be able to control a car with your hand? Introducing the Motion Mobile!

  • 1,440 views
  • 7 comments
  • 7 respects

Components and supplies

Necessary tools and machines

About this project

The goal of the project was to make an RC car that can controlled with hand gestures using a face tracking camera.

The hand gestures are recognized by a set of code. The brain of the robot is an Arduino Uno. The gestures are recognized by an accelerometer.

This robot was designed to recognize five hand gestures. Forward, backward, left, right and stop. The accelerometer is a three-axis acceleration-measuring device. It has three axis (X, Y, and Z).

The equipment I used was an Arduino UNO, DC motors, two Arduino Nanos, an ultrasonic sensor, a servo motor, an LCD with I2C, and a glove.

The robot is divided into two parts, transmitter and receiver. The receiver circuit is the same as the one in the RC car project, and there is a small change in the transmitter circuit. In the transmitter circuit is where I program the transmitter circuit to send hand gestures as commands. I will be using Arduino as the programming platform to use hand gestures with an accelerometer sensor. I also used a servo motor and attached two ultrasonic sensors to each sensor to detect obstacles.

Code

receiver (RC Car)Arduino
this code is for rc car to receive signals
#include <VirtualWire.h> //VirtualWire library declaration
#include <AFMotor.h>
byte msg[VW_MAX_MESSAGE_LEN];//Data flow is received
byte msgLen = VW_MAX_MESSAGE_LEN;
char forward[1] = {1};

AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);

void setup()
{
  Serial.begin(9600);
  Serial.println("READY..........");
  vw_setup(2048); // set the baud rate
  vw_set_rx_pin(2);// Set up digital pins to receive signals
  vw_rx_start();// started receiving the signal
}


void loop()
{
  if (vw_get_message(msg, &msgLen)) // if the signal is transmitted
  {
    Serial.print("got transmition");
    motor1.setSpeed(255);
    motor2.setSpeed(255);
    motor3.setSpeed(255);
    motor4.setSpeed(255);
    switch (msg[0])
    {
      case '0':
        {
          motor1.run(RELEASE);
          motor2.run(RELEASE);
          motor3.run(RELEASE);
          motor4.run(RELEASE);
          break;
        }

      case '1':
        {
          motor1.run(FORWARD);
          motor2.run(FORWARD);
          motor3.run(FORWARD);
          motor4.run(FORWARD);
          break;
        }

      case '2':
        {
          motor1.setSpeed(150);
          motor2.setSpeed(150);
          motor3.setSpeed(150);
          motor4.setSpeed(150);
          motor1.run(FORWARD);
          motor2.run(FORWARD);
          motor3.run(BACKWARD);
          motor4.run(BACKWARD);
          break;
        }

      case '3':
        {
          motor1.setSpeed(150);
          motor2.setSpeed(150);
          motor3.setSpeed(150);
          motor4.setSpeed(150);
          motor1.run(BACKWARD);
          motor2.run(BACKWARD);
          motor3.run(FORWARD);
          motor4.run(FORWARD);
          break;
        }

      case '4':
        {
          motor1.run(BACKWARD);
          motor2.run(BACKWARD);
          motor3.run(BACKWARD);
          motor4.run(BACKWARD);
          break;
        }

      case '5':
        {
          motor3.setSpeed(70);
          motor4.setSpeed(70);
          motor1.run(FORWARD);
          motor2.run(FORWARD);
          motor3.run(FORWARD);
          motor4.run(FORWARD);
          break;
        }

      case '6':
        {
          motor1.setSpeed(70);
          motor2.setSpeed(70);
          motor1.run(FORWARD);
          motor2.run(FORWARD);
          motor3.run(FORWARD);
          motor4.run(FORWARD);
          break;
        }
    }



}
RCtransmitter (glove)Arduino
sends signals to rc
#include <VirtualWire.h> // VirtualWire library declaration
#include "I2Cdev.h"
#include "MPU6050.h"

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif
MPU6050 accelgyro;
int16_t ax, ay, az;//used for making programs cross platform
int16_t gx, gy, gz;//used for making programs cross platform
//#define OUTPUT_READABLE_ACCELGYRO
#define OUTPUT_BINARY_ACCELGYRO
#define LED_PIN 13
bool blinkState = false;
char text[5] = "";// array array declaration
byte i = 0;

void setup()
{
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE//communicacate between devices
  Wire.begin();
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
  Fastwire::setup(400, true);
#endif
  Serial.begin(9600);// Serial communication with baudrate 9600
  accelgyro.initialize();
  Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
  Serial.println("Ready.........");
  vw_set_ptt_inverted(true);// Requirements for RF link modules
  vw_setup(2048);// set the baud rate
  vw_set_tx_pin(8);// Set up digital pins to signal
  pinMode(LED_PIN, OUTPUT);

}

void loop()
{
  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
#ifdef OUTPUT_READABLE_ACCELGYRO
  // display tab-separated accel/gyro x/y/z values
  Serial.print("a/g:\t");
  Serial.print(ax); Serial.print("\t");
  Serial.print(ay); Serial.print("\t");
  Serial.print(az); Serial.print("\t");
  Serial.print(gx); Serial.print("\t");
  Serial.print(gy); Serial.print("\t");   //-32000
  Serial.println(gz);
  //delay(250);
#endif

#ifdef OUTPUT_BINARY_ACCELGYRO
  /*  Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
    Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
    Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
    Serial.write((uint8_t)(gx >> 8)); Serial.write((uint8_t)(gx & 0xFF));
    Serial.write((uint8_t)(gy >> 8)); Serial.write((uint8_t)(gy & 0xFF));
    Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF)); */
#endif


  if ((ay < 9000) and (ay > -9000) and (ax < 12000) and (ax > -3000))
  {
    Serial.println("Ready.........");
    text[i] = '0';
    vw_send((byte *)text, sizeof(text));// send the signal away
    vw_wait_tx();

  }

  if (ax < -3800)
  {
    if (ay < -13000)
    {
      Serial.println("to the right");
      text[i] = '5'; // to the right
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
    else if (ay > 8000)
    {
      Serial.println("to the left");
      text[i] = '6'; // to the left
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
    else
    {
      Serial.println("to the left"); 
      text[i] = '1'; //tới
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
  }

  if (ay < -13000)
  {
    if (ax < -3800)
    {
      Serial.println("to the right");
      text[i] = '5'; // to the right
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
    else
    {
      Serial.println("to the right");
      text[i] = '2'; // right
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
  }

  if (ay > 7000)
  {
    if (ax < -3800)
    {
      Serial.println("to the left");
      text[i] = '6'; // to the left
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
    else
    {
      Serial.println("to the left");
      text[i] = '3'; //  to the left
      vw_send((byte *)text, sizeof(text));// send the signal away
      vw_wait_tx();
    }
  }

  if (ax > 14000)
  {
    text[i] = '4'; //backward
    vw_send((byte *)text, sizeof(text));// send the signal away
    vw_wait_tx();
  }



  blinkState = !blinkState;
  digitalWrite(LED_PIN, blinkState);

}

Schematics

Transmitter glove
Sd ud1miksqaq
receiver (RC Car)
Sdf b8gzbkzudp
RC car Flowchart
RC car Flowchart
Fdfg mzc5ucg1em

Comments

Author

Default
mcharrison500
  • 2 projects
  • 4 followers

Additional contributors

  • Giving me the idea by Viết để biết

Published on

July 28, 2018

Members who respect this project

Space pic backround 2 qgu7i4rm5nPhotoProfilepic1383336 4825787901311 2057402136 nDefault

and 2 others

See similar projects
you might like

Similar projects you might like

Gesture-Controlled Car

Project showcase by ashish_8284

  • 3,560 views
  • 2 comments
  • 13 respects

Mobile Controlled Bluetooth Car || Easy || Simple || HC-05

Project tutorial by Team Vishal soni

  • 7,514 views
  • 2 comments
  • 10 respects

Turn your RC Car to Bluetooth RC car

Project tutorial by Prajjwal Nag

  • 11,967 views
  • 1 comment
  • 11 respects

Gesture-Controlled Robot

Project tutorial by Youssef El-Gendy and Romina Abachi

  • 4,167 views
  • 0 comments
  • 12 respects

Bluetooth Controlled Car

Project in progress by samanfern

  • 4,214 views
  • 16 comments
  • 31 respects

Arduino Uno Autonomous Car

Project tutorial by hannahmcneelyy

  • 10,442 views
  • 0 comments
  • 25 respects
Add projectSign up / Login