Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Semi-Autonomous GPS-Navigated Wheelchair with Obstacle Avoidance and Joystick Control

Image of Semi-Autonomous GPS-Navigated Wheelchair with Obstacle Avoidance and Joystick Control

Circuit Documentation

Summary

The circuit in question appears to be designed for a semi-autonomous wheelchair addon. It includes a GPS module for navigation, ultrasonic sensors for obstacle detection, a joystick for manual control, a motor driver for controlling the wheelchair's motors, and an Arduino Mega 2560 microcontroller as the central processing unit. The circuit also includes a step-down module to regulate voltage, an emergency stop mechanism, batteries for power supply, a buzzer for alerts, a push button board for additional controls, and an LCD display for user interface.

Component List

GPS NEO 6M

  • A GPS module used for obtaining geographical location data.

HC-SR04 Ultrasonic Sensor (x3)

  • Ultrasonic sensors used for measuring distances and detecting obstacles.

24v e-bike DC Motor (x2)

  • Motors used for driving the wheelchair.

MDDS30 A Cytron Motor Driver

  • A motor driver used to control the speed and direction of the motors.

Step Down Module

  • A voltage regulator that steps down the voltage to a lower level.

Adafruit Mini Analog Thumbstick

  • A joystick used for manual control of the wheelchair.

Arduino Mega 2560

  • The microcontroller that serves as the brain of the circuit, processing inputs and controlling outputs.

12V 200Ah Battery (x4)

  • Batteries that provide power to the circuit.

Emergency STOP

  • A safety feature that allows immediate stopping of the wheelchair.

Buzzer

  • An audible alert device.

8 Push Button Board PCB

  • A board with push buttons for additional input controls.

LCD Display 16x4 I2C

  • A display used for showing information to the user.

30A Motor Controller

  • A controller used for managing the power to the motors.

DC Motor (x2)

  • Additional motors that may be used for other functions in the wheelchair.

Wiring Details

GPS NEO 6M

  • VCC: Connected to 5V power supply.
  • RX: Connected to TX1 (D18) on Arduino Mega 2560.
  • TX: Connected to RX1 (D19) on Arduino Mega 2560.
  • GND: Connected to the common ground.

HC-SR04 Ultrasonic Sensor (Front)

  • VCC: Connected to 5V power supply.
  • TRIG: Connected to D26 on Arduino Mega 2560.
  • ECHO: Connected to D27 on Arduino Mega 2560.
  • GND: Connected to the common ground.

HC-SR04 Ultrasonic Sensor (Left)

  • VCC: Connected to 5V power supply.
  • TRIG: Connected to D22 on Arduino Mega 2560.
  • ECHO: Connected to D23 on Arduino Mega 2560.
  • GND: Connected to the common ground.

HC-SR04 Ultrasonic Sensor (Right)

  • VCC: Connected to 5V power supply.
  • TRIG: Connected to D24 on Arduino Mega 2560.
  • ECHO: Connected to D25 on Arduino Mega 2560.
  • GND: Connected to the common ground.

24v e-bike DC Motor (Left)

  • VCC: Connected to MLA on Cytron Motor Driver.
  • GND: Connected to MLB on Cytron Motor Driver.

24v e-bike DC Motor (Right)

  • VCC: Connected to MRB on Cytron Motor Driver.
  • GND: Connected to MRA on Cytron Motor Driver.

MDDS30 A Cytron Motor Driver

  • SIG1: Connected to D2 PWM on Arduino Mega 2560.
  • SIG2: Connected to D3 PWM on Arduino Mega 2560.
  • GND: Connected to the common ground.
  • 5V: Connected to 5V power supply.
  • VB+: Connected to 12V power supply through Emergency STOP.
  • VB-: Connected to the common ground.

Step Down Module

  • 24v IN+: Connected to Emergency STOP.
  • GND: Connected to the common ground.
  • 5v OUT+: Connected to VIN on Arduino Mega 2560.
  • 5v OUT-: Connected to the common ground.

Adafruit Mini Analog Thumbstick

  • VCC: Connected to 5V power supply.
  • YOUT: Connected to A2 on Arduino Mega 2560.
  • XOUT: Connected to A0 on Arduino Mega 2560.
  • GND: Connected to the common ground.

Arduino Mega 2560

  • GND: Connected to the common ground.
  • 5V: Connected to 5V power supply.
  • VIN: Connected to 5v OUT+ from Step Down Module.
  • Various digital and analog pins: Connected to sensors, motor driver, and other peripherals as detailed above.

12V 200Ah Battery

  • GND: Connected to the common ground.
  • 12V: Connected to the 12V power supply rail.

Emergency STOP

  • NC: Connected between the 12V power supply and the motor driver/motor controller.

Buzzer

  • PIN: Connected to D53 on Arduino Mega 2560.
  • GND: Connected to the common ground.

8 Push Button Board PCB

  • K1-K8: Connected to various digital pins (D31, D33, D35, D37, D30, D32, D34, D36) on Arduino Mega 2560.
  • GROUND: Connected to the common ground.

LCD Display 16x4 I2C

  • SCL: Connected to SCL on Arduino Mega 2560.
  • SDA: Connected to SDA on Arduino Mega 2560.
  • VCC: Connected to 5V power supply.
  • GND: Connected to the common ground.

30A Motor Controller

  • M1: Connected to pin 1 on both DC Motors.
  • M2: Connected to pin 2 on both DC Motors.
  • 12V +: Connected to 12V power supply through Emergency STOP.
  • 12V -: Connected to the common ground.
  • SW2: Connected to D52 on Arduino Mega 2560.
  • SW1: Connected to D51 on Arduino Mega 2560.

DC Motor (x2)

  • Pin 1: Connected to M1 on 30A Motor Controller.
  • Pin 2: Connected to M2 on 30A Motor Controller.

Documented Code

Arduino Mega 2560 Code

/*
 * Semi-Autonomous Wheelchair Addon
 * This code controls a wheelchair using 2 motors, 3 ultrasonic sensors, a GPS
 * module, and a joystick. The wheelchair avoids obstacles and navigates to a
 * set location using GPS. The joystick allows manual control. Safety features
 * include sensor checks before operation and interrupt-based emergency stop.
 */

#include <SoftwareSerial.h>
#include <TinyGPS++.h>

#define TRIG_LEFT 22
#define ECHO_LEFT 23
#define TRIG_RIGHT 24
#define ECHO_RIGHT 25
#define TRIG_FRONT 26
#define ECHO_FRONT 27
#define MOTOR_LEFT_SIG1 2
#define MOTOR_LEFT_SIG2 3
#define MOTOR_RIGHT_SIG1 4
#define MOTOR_RIGHT_SIG2 5
#define JOYSTICK_X A0
#define JOYSTICK_Y A2
#define GPS_RX 19
#define GPS_TX 18

TinyGPSPlus gps;
SoftwareSerial gpsSerial(GPS_RX, GPS_TX);

const double targetLat = 0.0; // Set target latitude
const double targetLon = 0.0; // Set target longitude

volatile bool obstacleDetected = false;

void setup() {
  pinMode(TRIG_LEFT, OUTPUT);
  pinMode(ECHO_LEFT, INPUT);
  pinMode(TRIG_RIGHT, OUTPUT);
  pinMode(ECHO_RIGHT, INPUT);
  pinMode(TRIG_FRONT, OUTPUT);
  pinMode(ECHO_FRONT, INPUT);
  pinMode(MOTOR_LEFT_SIG1, OUTPUT);
  pinMode(MOTOR_LEFT_SIG2, OUTPUT);
  pinMode(MOTOR_RIGHT_SIG1, OUTPUT);
  pinMode(MOTOR_RIGHT_SIG2, OUTPUT);
  pinMode(JOYSTICK_X, INPUT);
  pinMode(JOYSTICK_Y, INPUT);
  gpsSerial.begin(9600);
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(ECHO_FRONT), emergencyStop, CHANGE);
  attachInterrupt(digitalPinToInterrupt(ECHO_LEFT), obstacleInterrupt, CHANGE);
  attachInterrupt(digitalPinToInterrupt(ECHO_RIGHT), obstacleInterrupt, CHANGE);
}

void emergencyStop() {
  stopMoving();
  while (true) {
    if (digitalRead(ECHO_FRONT) == LOW) break;
  }
}

void obstacleInterrupt() {
  obstacleDetected = true;
}

long readUltrasonicDistance(int trigPin, int echoPin) {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  return pulseIn(echoPin, HIGH) / 58.2;
}

void moveForward(int speed) {
  analogWrite(MOTOR_LEFT_SIG1, speed);
  analogWrite(MOTOR_LEFT_SIG2, 0);
  analogWrite(MOTOR_RIGHT_SIG1, speed);
  analogWrite(MOTOR_RIGHT_SIG2, 0);
}

void moveBackward(int speed) {
  analogWrite(MOTOR_LEFT_SIG1, 0);
  analogWrite(MOTOR_LEFT_SIG2, speed);
  analogWrite(MOTOR_RIGHT_SIG1, 0);
  analogWrite(MOTOR_RIGHT_SIG