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

Voice and Touch-Controlled Wheelchair with Obstacle Detection

View and Edit Project In Cirkit DesignerImage of Voice and Touch-Controlled Wheelchair with Obstacle Detection

Circuit Documentation

Summary

This circuit is designed to control a wheelchair using voice commands received via Bluetooth and a touch switch. It features obstacle detection using ultrasonic sensors and provides an audible indication through a buzzer when an obstacle is detected. The core of the circuit is an Arduino UNO microcontroller, which interfaces with an L298N DC motor driver to control four gearmotors, two HC-SR04 ultrasonic sensors, an HC-05 Bluetooth module, a buzzer, and an I2C module connected to a 16x2 I2C LCD for display purposes.

Component List

Wiring Details

L298N DC Motor Driver

Arduino UNO

HC-05 Bluetooth Module

HC-SR04 Ultrasonic Sensors

Buzzer

Gearmotor DC Wheels

I2C Module

16x2 I2C LCD

Documented Code

// Voice & Touch Control Wheelchair with Obstacle Sensor and Indicator
// This code controls a wheelchair using voice commands via Bluetooth and a touch switch.
// It also uses ultrasonic sensors to detect obstacles and a buzzer to indicate them.

#include <AFMotor.h>

// Motor driver pins
#define IN1 3
#define IN2 4
#define IN3 5
#define IN4 6

// Ultrasonic sensor pins
#define TRIG 9
#define ECHO 10

// Buzzer pin
#define BUZZER 13

// Bluetooth commands
char command;

// Motor objects
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); // Bluetooth baud rate
  pinMode(TRIG, OUTPUT);
  pinMode(ECHO, INPUT);
  pinMode(BUZZER, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

void loop() {
  if (Serial.available() > 0) {
    command = Serial.read();
    Stop(); // Initialize with motors stopped
    switch (command) {
      case 'F':
        forward();
        break;
      case 'B':
        back();
        break;
      case 'L':
        left();
        break;
      case 'R':
        right();
        break;
    }
  }
  checkObstacle();
}

void forward() {
  motor1.setSpeed(255);
  motor1.run(FORWARD);
  motor2.setSpeed(255);
  motor2.run(FORWARD);
  motor3.setSpeed(255);
  motor3.run(FORWARD);
  motor4.setSpeed(255);
  motor4.run(FORWARD);
}

void back() {
  motor1.setSpeed(255);
  motor1.run(BACKWARD);
  motor2.setSpeed(255);
  motor2.run(BACKWARD);
  motor3.setSpeed(255);
  motor3.run(BACKWARD);
  motor4.setSpeed(255);
  motor4.run(BACKWARD);
}

void left() {
  motor1.setSpeed(255);
  motor1.run(BACKWARD);
  motor2.setSpeed(255);
  motor2.run(BACKWARD);
  motor3.setSpeed(255);
  motor3.run(FORWARD);
  motor4.setSpeed(255);
  motor4.run(FORWARD);
}

void right() {
  motor1.setSpeed(255);
  motor1.run(FORWARD);
  motor2.setSpeed(255);
  motor2.run(FORWARD);
  motor3.setSpeed(255);
  motor3.run(BACKWARD);
  motor4.setSpeed(255);
  motor4.run(BACKWARD);
}

void Stop() {
  motor1.setSpeed(0);
  motor1.run(RELEASE);
  motor2.setSpeed(0);
  motor2.run(RELEASE);
  motor3.setSpeed(0);
  motor3.run(RELEASE);
  motor4.setSpeed(0);
  motor4.run(RELEASE);
}

void checkObstacle() {
  long duration, distance;
  digitalWrite(TRIG, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG, LOW);
  duration = pulseIn(ECHO, HIGH);
  distance = (duration / 2) / 29.1;
  if (distance < 20) {
    digitalWrite(BUZZER, HIGH);
    Stop();
  } else {
    digitalWrite(BUZZER, LOW);
  }
}

This code is responsible for the operation of the wheelchair, including motor control and obstacle detection. It initializes the motors, sets up the ultrasonic sensors, and reads Bluetooth commands to control the wheelchair's movement. The checkObstacle function uses the ultrasonic sensors to detect obstacles and activates the buzzer if an obstacle is within 20 cm.