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

Arduino UNO-Based Smart Blind Stick with GPS, GSM, and Ultrasonic Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Blind Stick with GPS, GSM, and Ultrasonic Sensors

Blind Stick Project Documentation

Summary

This project involves the design and implementation of a smart blind stick using an Arduino UNO microcontroller. The stick integrates various sensors and modules to provide functionalities such as location tracking, communication, obstacle detection, visual alerts, audio alerts, and emergency alerts. The key components used in this project include a GPS module, GSM module, ultrasonic sensors, RGB LED, piezo buzzer, and a pushbutton.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Sim800l

    • Description: GSM/GPRS module for communication.
    • Pins: NET, RST, VCC, RXD, TXD, GND
  3. GPS NEO 6M

    • Description: GPS module for location tracking.
    • Pins: VCC, RX, TX, GND
  4. Piezo Buzzer

    • Description: Buzzer for audio alerts.
    • Pins: pin 1, pin 2
  5. RGB LED Module

    • Description: RGB LED for visual alerts.
    • Pins: +VCC Red, +VCC Green, +VCC Blue, GND
  6. HC-SR04 Ultrasonic Sensor

    • Description: Ultrasonic sensor for obstacle detection.
    • Pins: VCC, TRIG, ECHO, GND
  7. Pushbutton

    • Description: Button for emergency alerts.
    • Pins: Pin 2, Pin 1, Pin 3, Pin 4

Wiring Details

Arduino UNO

Sim800l

GPS NEO 6M

Piezo Buzzer

RGB LED Module

HC-SR04 Ultrasonic Sensor (First Instance)

HC-SR04 Ultrasonic Sensor (Second Instance)

Pushbutton

Documented Code

/*
 * Blind Stick Project
 * This code is designed for an Arduino UNO to interface with various sensors and
 * modules to create a smart blind stick. The stick includes a GPS module for
 * location tracking, a GSM module for communication, an ultrasonic sensor for
 * obstacle detection, an RGB LED for visual alerts, a piezo buzzer for audio
 * alerts, and a pushbutton for emergency alerts.
 */

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

// Pin configurations for GSM and GPS modules
SoftwareSerial gsmSerial(2, 3);  // RX, TX for GSM module
SoftwareSerial gpsSerial(4, 5);  // RX, TX for GPS module

TinyGPSPlus gps;

// Pin configuration for emergency button
const int buttonPin = A0;  // Emergency button pin

// Pin configurations for ultrasonic sensors
const int trigPin1 = 6;
const int echoPin1 = 7;
const int trigPin2 = 9;
const int echoPin2 = 8;

// Pin configurations for RGB LED
const int redPin = 12;
const int greenPin = 11;
const int bluePin = 10;

// Server URL for sending data
const char* serverURL = "https://cuboid-rigorous-red.glitch.me/";

bool buttonPressed = false;

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);   // Configure button pin as input with pull-up
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  pinMode(trigPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  gsmSerial.begin(9600);              // Initialize GSM serial communication
  gpsSerial.begin(9600);              // Initialize GPS serial communication
  Serial.begin(9600);                 // Start the serial monitor for debugging

  // Send SMS to confirm system startup
  sendSMS("System started. GPS tracking enabled.");
}

void loop() {
  // Process incoming GPS data
  while (gpsSerial.available() > 0) {
    gps.encode(gpsSerial.read());

    // Check if new GPS location is available
    if (gps.location.isUpdated()) {
      float latitude = gps.location.lat();
      float longitude = gps.location.lng();
      Serial.print("Latitude= "); Serial.print(latitude, 6);
      Serial.print(" Longitude= "); Serial.println(longitude, 6);

      // Send the location to the server
      sendLocationToServer(latitude, longitude);
    }
  }

  // Check if the emergency button is pressed
  if (digitalRead(buttonPin) == LOW) {
    buttonPressed = true;
    delay(200);  // Debounce delay
  }

  if (buttonPressed) {
    // Trigger emergency alert
    sendEmergencyAlert();
    buttonPressed = false;  // Reset button pressed flag
  }

  // Check for obstacles using ultrasonic sensors
  checkObstacle(trigPin1, echoPin1);
  checkObstacle(trigPin2, echoPin2);
}

// Function to check for obstacles
void checkObstacle(int trigPin, int echoPin) {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  long duration = pulseIn(echoPin, HIGH);
  int distance = duration * 0.034 / 2;

  if (distance < 50) {  // If obstacle is closer than 50 cm
    digitalWrite(redPin, HIGH);
    digitalWrite(greenPin, LOW);
    digitalWrite(bluePin, LOW);
  } else {
    digitalWrite(redPin, LOW);
    digitalWrite(greenPin, HIGH);
    digitalWrite(bluePin, LOW);
  }
}

// Function to send GPS location to the server
void sendLocationToServer(float lat, float lng) {
  String postData = "lat=" + String(lat, 6) + "&lng=" + String(lng, 6);
  sendHTTPPostRequest("/update-location