Gesture Control Car Using Mpu6050 and Arduino

16,425

11

47

Introduction: Gesture Control Car Using Mpu6050 and Arduino

About: An engineering student

here is a hand controller gesture control car, made by using mpu6050 and arduino. I use rf module for wireless connection.

Step 1: THINGS REQUIRED :

•1.arduino uno

•2.micro Arduino

•3.rf module(transmitter and receiver)

•3.mpu6050(accelomitter)

•4.motor driver

•5.2 dc motor

•6.robotics chassis

•7. Arduino cable

•8.one hand glapse

•9. motor driver

•10. LiPo Battery

•11. 9V battery

12.USB cable

Step 2: Connection:-

•1.connection for rf transmitter:-

•GND = GND

•DATA = 12

•VCC = 5V

•2.connection for mpu6050:-

•VCC = 3.3/5v

•GND = GND

•SCL = A3

•SDA = A2

•INT = 7

•mpu6050 need 3.5V voltage.but we can give it 5V voltage.i give here 3.5V voltage to mpu6050 because in micro arduino there

•are two voltage pin first is 5V and another one is 3.3V.rf reciever have to need 5V.so i use 5V pin for rf transmitter.and

•mpu6050 can run 3.5V.

•3.connection for rf receiver:-

•GND = GND

•DATA = 12

•VCC = 5V

•4.connection for motor driver:-

•motor one:-

•int enA = 11

•int in1 = 7

•int in2 = 6

•motor two:-

•int enB = 3

•int in3 = 5

•int in4 = 4

Step 3: Working Principal:-

1.mpu6050:-

MPU-6050 Triple Axis Accelerometer and Gyro Breakout Board.it read three angles.we can give them name X, Y, and Z, here we

use here only two angles. here we use Y and Z.Y for forward and Z for left, right.

this part of code read the angle.

•mpu-6050
reads the angles in radian, this "* 180/M_PI" make it in degree.

Step 4: ​•Rf Transmitter:-

•Rf

transmitter:-

Mpu6050 read the angles. then I make one “if” loop and make a condition.in then make two buffer.one buffer sends condition for forward. and in the second one, I send the angle, for control the speed by the angle. this part of code sends the message. And I map the angle.

Step 5: RF RECEIVER:-

•Rf receiver:-

the receiver receives the message in the buffer. Again I make a condition on the first buffer for forward. And the second one I use for control the speed. And I again map it. This part of the code is doing this work. and for the speed control, I use the second buffer and, the angles mapped (0,9), I map speed in (50,255). you can see all things in code.

Step 6: Let's Run the Car:-

  • now the time has come to run the robot.make sure that all connection is correct. now connect your glapse's micro arduino to your computer. open the serial monitor, now you can see angles reading.now send any input from the transmitter to the receiver. now your robot is ready for a run.

Step 7:

if you fill difficulty in those codes. you can use these code. I make these because I fill you will difficulty fill in the transmitter code. so I make these easy code. and you won't need to follow 6th step. just connect the power the transmitter's Arduino and your robot is in your control.

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Remote Control Contest 2017

Participated in the
Remote Control Contest 2017

Be the First to Share

    Recommendations

    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Explore Science Challenge

      Explore Science Challenge
    • Furniture Contest

      Furniture Contest

    47 Comments

    0
    Pankukapoor580
    Pankukapoor580

    Tip 1 year ago

    What should I do, please help me

    15834696031495001887799933665662.jpg
    0
    A.k.s
    A.k.s

    Reply 1 year ago

    you have to download virtualwire library

    0
    hamzaabbas2490
    hamzaabbas2490

    1 year ago

    The transmitter code is not working. I have downloaded & used the same libraries as you have but still so many errors are there.Please solve this problem quickly

    Capture.PNG
    0
    tranvanviet020495
    tranvanviet020495

    Reply 1 year ago

    have you resolved it? please share me!

    0
    A.k.s
    A.k.s

    Reply 1 year ago

    you installed wrong libraries. try to install the right library, there are some libraries that have a different name of the functions. I suggest to work with this one https://github.com/jarzebski/Arduino-MPU6050.

    0
    hamzaabbas2490
    hamzaabbas2490

    Reply 1 year ago

    I have added this library but getting same errors

    0
    A.k.s
    A.k.s

    Reply 1 year ago

    it's working on my machine.

    Screenshot from 2019-06-26 11-11-44.png
    0
    AsbnS
    AsbnS

    2 years ago

    the second code is not working its always showing error even after including the respective libraries
    these are the error messages shown
    Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"
    C:\Users\ASBN Sudhir\Desktop\motion_transmitter\motion_transmitter.ino: In function 'void setup()':
    motion_transmitter:39:14: error: 'class MPU6050' has no member named 'begin'
    while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
    ^
    motion_transmitter:39:20: error: 'MPU6050_SCALE_2000DPS' was not declared in this scope
    while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
    ^
    motion_transmitter:39:43: error: 'MPU6050_RANGE_2G' was not declared in this scope
    while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
    ^
    C:\Users\ASBN Sudhir\Desktop\motion_transmitter\motion_transmitter.ino: In function 'void loop()':
    motion_transmitter:49:3: error: 'Vector' was not declared in this scope
    Vector normAccel = mpu.readNormalizeAccel();
    ^
    motion_transmitter:52:23: error: 'normAccel' was not declared in this scope
    int pitch = -(atan2(normAccel.XAxis, sqrt(normAccel.YAxis*normAccel.YAxis + normAccel.ZAxis*normAccel.ZAxis))*180.0)/M_PI;
    ^
    Multiple libraries were found for "VirtualWire.h"
    Used: C:\Users\ASBN Sudhir\Documents\Arduino\libraries\VirtualWire
    Not used: C:\Users\ASBN Sudhir\Documents\Arduino\libraries\Updated-Arduino-VirtualWire-Library-master
    Multiple libraries were found for "MPU6050.h"
    Used: C:\Users\ASBN Sudhir\Documents\Arduino\libraries\MPU6050
    Not used: C:\Users\ASBN Sudhir\Documents\Arduino\libraries\Arduino-MPU6050-master
    exit status 1
    'class MPU6050' has no member named 'begin'
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

    2019-05-28.png
    0
    A.k.s
    A.k.s

    Reply 2 years ago

    it's mean you have "VirtualWire.h" two different libraries. delete one of them.

    0
    YazeedH
    YazeedH

    2 years ago

    Would you please send by email Transmitter & reciever codes with Ada fruit motor shield instead of Motor Driver & 433 mHz RF To
    Hassouna@yazeed@yahoo.com

    0
    YazeedH
    YazeedH

    Reply 2 years ago

    MPU6050 not working
    I checked wiring ,power and everything

    0
    A.k.s
    A.k.s

    Reply 2 years ago

    I think you just have to check the pins meaning in ada fruit motor shield... And connect them with Arduino....

    2
    SrinathS17
    SrinathS17

    Question 2 years ago on Introduction

    Why cant we directly connect the MPU6050 to RF transmitter part?

    0
    AlvanR
    AlvanR

    2 years ago

    Can i use 9v battery to power up the motor driver instead of LiPo?

    0
    A.k.s
    A.k.s

    Reply 2 years ago

    Yupe, you can use.

    0
    HossainA2
    HossainA2

    2 years ago

    I'm using uno with motornshield that control 4 motors and receiver in car
    and nano with mpu6050 with transmitter.
    what changes should I make in the code?
    can you help me with the code? I will be very grateful.Thanks in advance :)

    1
    A.k.s
    A.k.s

    Reply 2 years ago

    I don't think so that you have make any changes in code.... because motorshield and motor drive work in same way. And nano and micro also..

    0
    Hema singh
    Hema singh

    Question 3 years ago

    Can i use arduino nano instead of arduino micro

    0
    A.k.s
    A.k.s

    Answer 3 years ago

    yes u can use...