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

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

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

Circuit Documentation

Summary

The circuit in question is a complex system designed to interface an Arduino UNO, an Arduino Nano, an HC-05 Bluetooth module, an InvenSense MPU6050 accelerometer/gyroscope, an L298N DC motor driver, two DC motors, and a couple of battery power sources. The Arduino UNO is the primary microcontroller, while the Arduino Nano serves as a secondary controller interfacing with the MPU6050 and an additional HC-05 Bluetooth module. The L298N motor driver controls the two DC motors, and the system is powered by a 4 x AAA battery mount and a separate battery case.

Component List

Arduino UNO

Arduino Nano

HC-05 Bluetooth Module (x2)

InvenSense MPU6050

L298N DC Motor Driver

DC Motor (x2)

4 x AAA Battery Mount

My Battery Case

Wiring Details

Arduino UNO

Arduino Nano

HC-05 Bluetooth Module

InvenSense MPU6050

L298N DC Motor Driver

DC Motors

4 x AAA Battery Mount

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
    }
}

Arduino Nano Code (HC-05 Bluetooth Module)

/*
 * 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 (MPU6050)

/*
 * 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) {
      // Failed to connect to MPU6050
    }
  }
}

void loop() {
  // Read accelerometer data
  int16_t ax, ay, az;
  mpu.getAcceleration(&ax, &ay, &az);
  char command = 'S'; // Default command is Stop
  // Determine command based on accelerometer data
  if (ax > 10000) {
    command = 'F'; // Move forward
  } else if (ax < -10000) {
    command = 'B'; // Move backward
  } else if (ay > 10000) {
    command = 'L'; // Turn left
  } else if (ay < -10000) {
    command = 'R'; // Turn right
  }
  // Send command to main controller
  Serial.write(command);
  delay(100); // Delay to avoid spamming commands
}

This