Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Gesture-Controlled Wheelchair with Arduino UNO, Arduino Nano, HC-05 Bluetooth Modules, and MPU6050 Accelerometer

View and Edit Project In Cirkit DesignerImage of Gesture-Controlled Wheelchair with Arduino UNO, Arduino Nano, HC-05 Bluetooth Modules, and MPU6050 Accelerometer

Circuit Documentation

Summary

This circuit is designed to interface an Arduino Nano with an InvenSense MPU6050 accelerometer/gyroscope and an HC-05 Bluetooth module. The Arduino Nano reads the MPU6050 data to detect gestures and sends corresponding commands via Bluetooth. Additionally, an Arduino UNO is used to control a pair of DC motors through an L298N DC motor driver, receiving commands from an HC-05 Bluetooth module. The circuit is powered by a battery case connected to the Arduino boards and the motor driver.

Component List

Arduino UNO

HC-05 Bluetooth Module (2 instances)

L298N DC Motor Driver

DC Motor (2 instances)

4 x AAA Battery Mount

Arduino Nano

InvenSense MPU6050

My Battery Case

Wiring Details

Arduino UNO

HC-05 Bluetooth Module (Connected to Arduino UNO)

L298N DC Motor Driver

DC Motors

4 x AAA Battery Mount

Arduino Nano

InvenSense MPU6050

HC-05 Bluetooth Module (Connected to Arduino Nano)

My Battery Case

Documented Code

Arduino UNO Code

#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>

int x, y;
Adafruit_MPU6050 mpu;

void setup(void) {
    Serial.begin(115200);
    while (!Serial)
        delay(10);

    Serial.println("Adafruit MPU6050 test!");

    // Try to initialize!
    if (!mpu.begin()) {
        Serial.println("Failed to find MPU6050 chip");
        while (1) {
            delay(10);
        }
    }
    Serial.println("MPU6050 Found!");

    mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
    mpu.setGyroRange(MPU6050_RANGE_500_DEG);
    mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);

    Serial.println("");
    delay(100);
}

void loop() {
    sensors_event_t a, g, temp;
    mpu.getEvent(&a, &g, &temp);
    x = a.acceleration.x;
    y = a.acceleration.y;

    Serial.print("Acceleration X: ");
    Serial.print(a.acceleration.x);
    Serial.print(", Y: ");
    Serial.print(a.acceleration.y);
    Serial.print(", Z: ");
    Serial.print(a.acceleration.z);
    Serial.println(" m/s^2");

    // Rear motors control (forward and reverse)
    if (y >= 4) {
        Serial.println("Forward");
        Serial.write("F");  // Command to move forward
    } else if (y <= -4) {
        Serial.println("Backward");
        Serial.write("B");  // Command to move backward
    } else {
        Serial.println("Stop");
        Serial.write("S");  // Command to stop
    }

    // Front motors control (left and right)
    if (x >= 4) {
        Serial.println("Left");
        Serial.write("L");  // Command to turn left
    } else if (x <= -4) {
        Serial.println("Right");
        Serial.write("R");  // Command to turn right
    }
}

HC-05 Bluetooth Module Code (Connected to Arduino UNO)

/*
 * Arduino Sketch for Gesture Control Wheelchair
 *
 * This code interfaces with an HC-05 Bluetooth module to receive commands
 * and sends them to the main Arduino UNO microcontroller to control the
 * wheelchair's movement.
 */

// Pin definitions
const int bluetoothTx = 0; // TX pin of HC-05
const int bluetoothRx = 1; // RX pin of HC-05

void setup() {
  // Initialize serial communication for Bluetooth module
  Serial.begin(115200);
}

void loop() {
  // Check if data is available from Bluetooth module
  if (Serial.available() > 0) {
    char command = Serial.read();
    // Forward the received command to the main controller
    Serial.write(command);
  }
}

Arduino Nano Code

/*
 * Arduino Sketch for Gesture Control Wheelchair
 *
 * This code interfaces with an HC-05 Bluetooth module to receive commands
 * and an MPU6050 accelerometer to detect gestures. The commands are then
 * forwarded to the main Arduino UNO microcontroller to control the
 * wheelchair's movement.
 */

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;

// Pin definitions
const int bluetoothTx = 1; // TX pin of HC-05
const int bluetoothRx = 0; // RX pin of HC-05

void setup() {
  // Initialize serial communication for Bluetooth module
  Serial.begin(115200);
  // Initialize MPU6050
  Wire.begin();
  mpu.initialize();
  if (!mpu.testConnection()) {
    while (1) {
      //