Rohit Anush NairCHRIS GIJIRohith SunilLAVANYA LENEESH
Published

Guide Dog for visually impaired people

A guide dog/rover for visually impaired people with obstacle detection and location tracking and plenty of room for future prospects.

IntermediateWork in progress59
Guide Dog for visually impaired people

Things used in this project

Hardware components

FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC motor (generic)
×4
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
IR Proximity Sensor
Digilent IR Proximity Sensor
×1
Battery, 3.7 V
Battery, 3.7 V
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
VS Code
Microsoft VS Code
Bambu studio

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

design of 3d model

3d print the given design and assemble the components

Schematics

screenshot_2025-09-09_235815_92ZXQDNmKX.png

Code

Guide rover for visually impaired people

Arduino
Use Arduino IDE to execute code given below and install required libraries
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP32Servo.h>

// OLED setup
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// Motor pins
#define IN1 14
#define IN2 15
#define ENA 12
#define IN3 32
#define IN4 33
#define ENB 13

// IR sensors
#define IR_LEFT 19
#define IR_RIGHT 23
#define IR_REAR 22

// Ultrasonic
#define TRIG_PIN 5
#define ECHO_PIN 18

// Servo (optional string/tail)
#define SERVO_PIN 25
Servo stringServo;

// Buzzer
#define BUZZER_PIN 4

const int motorSpeed = 180;
const int safeDistance = 50; // cm

void setup() {
  Serial.begin(115200);

  // Motor setup
  pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENA, OUTPUT);
  pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENB, OUTPUT);

  // Sensors
  pinMode(IR_LEFT, INPUT);
  pinMode(IR_RIGHT, INPUT);
  pinMode(IR_REAR, INPUT);
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);

  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(BUZZER_PIN, LOW);

  stringServo.attach(SERVO_PIN);

  // OLED
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED init failed");
    while (true);
  }
  display.setRotation(2);
  display.clearDisplay();

  // Centered "Hi!"
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  int16_t x, y;
  uint16_t w, h;
  display.getTextBounds("Hi!", 0, 0, &x, &y, &w, &h);
  display.setCursor((SCREEN_WIDTH - w) / 2, 0);
  display.println("Hi!");

  // Eyes
  display.fillCircle(60, 40, 2, SSD1306_WHITE);
  display.fillCircle(68, 40, 2, SSD1306_WHITE);

  // Smile
  display.drawLine(60, 52, 64, 56, SSD1306_WHITE);
  display.drawLine(64, 56, 68, 52, SSD1306_WHITE);

  display.display();

  stopMotors();
}

void loop() {
  int distance = getDistance();
  bool frontLeft = digitalRead(IR_LEFT) == LOW;
  bool frontRight = digitalRead(IR_RIGHT) == LOW;
  bool rearClear = digitalRead(IR_REAR) == HIGH;

  Serial.print("Ultrasonic Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  if (rearClear) {
    stopMotors();
    buzz();
    return;
  } else {
    noBuzz();
  }

  // Obstacle in front
  if (distance < safeDistance || frontLeft || frontRight) {
    if (frontLeft && !frontRight) {
      turnRight();
    } else if (!frontLeft && frontRight) {
      turnLeft();
    } else {
      stopMotors();
    }
  } else {
    moveForward();
  }

  delay(150);
}

// ========================== Functions ==========================

int getDistance() {
  digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
  long duration = pulseIn(ECHO_PIN, HIGH, 300000);
  if (duration == 0) return 1000;
  return duration * 0.034 / 2;
}

void moveForward() {
  digitalWrite(IN1, LOW);  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);  digitalWrite(IN4, HIGH);
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
}

void stopMotors() {
  digitalWrite(IN1, LOW);  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);  digitalWrite(IN4, LOW);
  analogWrite(ENA, 0); analogWrite(ENB, 0);
}

void turnLeft() {
  digitalWrite(IN1, LOW);  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
}

void turnRight() {
  digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);  digitalWrite(IN4, HIGH);
  analogWrite(ENA, motorSpeed);
  analogWrite(ENB, motorSpeed);
}

void buzz() {
  digitalWrite(BUZZER_PIN, HIGH);
}

void noBuzz() {
  digitalWrite(BUZZER_PIN, LOW);
}

Credits

Rohit Anush Nair
1 project • 1 follower
CHRIS GIJI
1 project • 1 follower
Rohith Sunil
1 project • 1 follower
LAVANYA LENEESH
1 project • 1 follower

Comments