Gesture controlled robot Imagine commanding a robot with just a tilt of your hand—no buttons, no remotes, just pure intuitive control. This robot turns your gestures into an extraordinary interactive experience.
Engineer | School | Area of Interest | Grade |
---|---|---|---|
Mohamed S | The Urban Assembly for Law and Justice | Computer Engineering | Incoming Senior |
Final Milestone
For my third and final milestone, I connected the accelerometer to the Arduino micro allowing for the controller to detect gestures. My biggest challenge was the coding aspect due to my lack of experience; my greatest triumph was honestly finishing the main project a couple of days before demo night despite having a couple of challenges. The key topics I learned were the importance of learning how to communicate with an audience as well as learning more about different types of engineering. I hope that I learn what it takes to create something truly innovative in the future.
Second Milestone
For my second milestone, I got both Bluetooth to connect. I had to ensure a stable connection and follow the correct wiring layouts for the Micro and Uno Bluetooth. What has been surprising is building this car showed me how powerful coding is. Before this program, I always viewed coding as something that’s only associated with software, however, now I know that coding makes machines move. This process was smooth and there weren’t any obstacles I faced. My next step is to get the accelerometer to work which would be the final step for building the gesture-controlled robot
First Milestone
For my first milestone, I’m working on getting the motors working. This project is a robotic car controlled by hand gestures. This project involves integrating DC motors, an H-Bridge for motor direction control, an Arduino Uno R3 for signal processing, and a Bluetooth module for wireless communication with a controller. So far, I’ve successfully set up the Arduino and H-Bridge, and I’ve made progress in programming basic motor functions. However, my main challenge was coding because I had no prior experience. Moving forward, my plan is to focus on getting the Bluetooth module operational to establish communication between the controller and the robot.
The layout of the circuit board
Code
#include <SoftwareSerial.h>
#define tx 8
#define rx 9
SoftwareSerial configBt(rx, tx);
long tm, t, d; // variables to record time in seconds
const int Aclockwise = 12;
const int AcounterClock = 13;
const int Bclockwise = 6;
const int BcounterClock = 7;
const int Cclockwise = 4;
const int CcounterClock = 5;
const int Dclockwise = 2;
const int DcounterClock = 3;
void setup() {
Serial.begin(38400);
configBt.begin(38400);
pinMode(tx, OUTPUT);
pinMode(rx, INPUT);
pinMode(Aclockwise, OUTPUT);
pinMode(AcounterClock, OUTPUT);
pinMode(Bclockwise, OUTPUT);
pinMode(BcounterClock, OUTPUT);
pinMode(Cclockwise, OUTPUT);
pinMode(CcounterClock, OUTPUT);
pinMode(Dclockwise, OUTPUT);
pinMode(DcounterClock, OUTPUT);
}
char c; // declare c as a global variable
void loop()
{
//checks for Bluetooth data
if (configBt.available()){
//if available stores to command character
c = (char)configBt.read();
//prints to serial
Serial.println(c);
}
//acts based on character
switch(c){
//forward case
case 'F':
moveForward();
break;
//left case
case 'L':
turnLeft();
break;
//right case
case 'R':
turnRight();
break;
//back case
case 'B':
moveBackward();
break;
//default is to stop robot
case 'S':
freeze();
break;
}
}
void moveForward() {
// Move forward by setting motors appropriately
digitalWrite(Aclockwise, HIGH);
digitalWrite(AcounterClock, LOW);
digitalWrite(Bclockwise, HIGH);
digitalWrite(BcounterClock, LOW);
digitalWrite(Cclockwise, LOW);
digitalWrite(CcounterClock, HIGH);
digitalWrite(Dclockwise, LOW);
digitalWrite(DcounterClock, HIGH);
}
void moveBackward() {
// Move backward by reversing motor directions
digitalWrite(Aclockwise, LOW);
digitalWrite(AcounterClock, HIGH);
digitalWrite(Bclockwise, LOW);
digitalWrite(BcounterClock, HIGH);
digitalWrite(Cclockwise, HIGH);
digitalWrite(CcounterClock, LOW);
digitalWrite(Dclockwise, HIGH);
digitalWrite(DcounterClock, LOW);
}
void turnLeft() {
// Turn left by adjusting motor directions
digitalWrite(Aclockwise, LOW);
digitalWrite(AcounterClock, HIGH);
digitalWrite(Bclockwise, LOW);
digitalWrite(BcounterClock, HIGH);
digitalWrite(Cclockwise, LOW);
digitalWrite(CcounterClock, HIGH);
digitalWrite(Dclockwise, LOW);
digitalWrite(DcounterClock, HIGH);
}
void turnRight() {
// Turn right by adjusting motor directions
digitalWrite(Aclockwise, HIGH);
digitalWrite(AcounterClock, LOW);
digitalWrite(Bclockwise, HIGH);
digitalWrite(BcounterClock, LOW);
digitalWrite(Cclockwise, HIGH);
digitalWrite(CcounterClock, LOW);
digitalWrite(Dclockwise, HIGH);
digitalWrite(DcounterClock, LOW);
}
void freeze() {
// Stationary
digitalWrite(Aclockwise, LOW);
digitalWrite(AcounterClock, LOW);
digitalWrite(Bclockwise, LOW);
digitalWrite(BcounterClock, LOW);
digitalWrite(Cclockwise, LOW);
digitalWrite(CcounterClock, LOW);
digitalWrite(Dclockwise, LOW);
digitalWrite(DcounterClock, LOW);
}
#include <Wire.h>
#define MPU6050_ADDRESS 0x68
int16_t accelerometerX, accelerometerY, accelerometerZ;
void setup()
{
Wire.begin();
Serial1.begin(38400);
// Initialize MPU6050
Wire.beginTransmission(MPU6050_ADDRESS);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU6050)
Wire.endTransmission(true);
delay(100); // Delay to allow MPU6050 to stabilize
}
void loop()
{
readAccelerometerData();
determineGesture();
delay(500);
}
void readAccelerometerData()
{
Wire.beginTransmission(MPU6050_ADDRESS);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.endTransmission(false);
Wire.requestFrom(MPU6050_ADDRESS, 6, true); // request a total of 6 registers
// read accelerometer data
accelerometerX = Wire.read() << 8 | Wire.read();
accelerometerY = Wire.read() << 8 | Wire.read();
accelerometerZ = Wire.read() << 8 | Wire.read();
}
void determineGesture()
{
if (accelerometerY >= 6500) {
Serial1.write('F');
Serial.println('F');
}
else if (accelerometerY <= -4000) {
Serial1.write('B');
Serial.println('B');
}
else if (accelerometerX <= -3250) {
Serial1.write('L');
Serial.println('L');
}
else if (accelerometerX >= 3250) {
Serial1.write('R');
Serial.println('R');
}
else {
Serial1.write('S');
Serial.println('S');
}
}
```
Bill of Materials
Part | Note | Price | Link |
---|---|---|---|
Car Chassis | Used for building a car robot | $21 | Link |
Breadboard | For building electronic circuits | $9 | Link |
Arduino Uno | Controls the motor driver and collects sensor data | $17 | Link |
L9110S Motor Driver | For controlling motors | $9 | Link |
Two HC-05 Bluetooth Modules | For wireless communication | $20 | Link |
MPU6050 Accelerometer | For measuring acceleration and orientation | $10 | Link |
Arduino Micro | Interprets gestures for robot control. | $22 | Link |
Small Screwdriver Set | For assembling the chassis | $7 | Link |