Project in progress
Cab Safety System (Cabs4Cabs)

Cab Safety System (Cabs4Cabs) © GPL3+

Cabs4Cabs: Consolidated Arduino Based Sureveillance for Cabs.

  • 4,445 views
  • 6 comments
  • 18 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Screen shot 2019 03 20 at 2 38 27 pm fqndazqcx1
1Sheeld
×1
MQ3 Alcohol Sensor
×1
Push Button
×1
Resistors and LEDs
×1

About this project

So we had to create a hardware project for our final year engineering project. We decided to go into cab safety as transport related crimes in the country are at an all time high. We introduce Cabs4Cabs:Consolidated arduino Based Surveillance for Cabs. Our system is a prototype of what should be a cab safety device. The features include:

Breathalyzer

(The driver is forced to blow into the alcohol sensor and only if the value is low the UI will start)

Mishap Detection

(Using the accelerometer shield on the 1sheeld, we detect mishaps)

SOS Button

(The hardware push button sends an SMS to the emergency contact of the passenger using the SMS and GPS shield of 1Sheeld)

Route Display

(Passenger end Android app sends start and destination location while 1sheeld GPS shield maintains the current location of cab. This is display using Google Maps API)

Live Meter Reading

(As the cab travels, the fare is displayed for the distance covered)

Arrival at Destination Notification

(If the cab is less than 1km away from the destination, the passenger is notified)

Route Deviation Detection

(If the cab deviates from the route, a dismissal button will become active. In a given timeout if the passenger doesn't dimiss it, the server is notified)


We have implemented the project using Arduino, 1sheeld and ThingSpeak.

The 1sheeld+Arduino device communicates with the in-cab screen via ThingSpeak. The in-cab screen communicates with the server via ThingSpeak. Also, the passenger end app send the information to the in-cab screen via ThingSpeak. Hence, there are 3 channels.


The Passenger enters their destination in an Android App
This UI is displayed in the cab for the passenger to view
Notification Bar of UI


Code

Arduino Side CodeC/C++
The 1sheeld along with the Arduino Communicated with the ThingSpeak
#include <OneSheeld.h>

HttpRequest request ("https://api.thingspeak.com/update");
char latc[30], lonc[30], sosMessage[70], temp3[8], distancec[8];
float lon=0,lat=0,x=0,y=0,z=0,temp1=0, temp2=0;
int buttonPin = 8, startFlag=3;
bool isMessageSent, sosFlag=false, mishapFlag=false; 
int sensorPin = 0; 
int time, flag=0;  
int i;
int j;
float start_lat=0, start_lon=0, distance=0;

void setup()
{
 
  pinMode(2,OUTPUT); //Initializing pins for LED
  pinMode(3,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(buttonPin,INPUT); //Intitializing pin for SOS
 
  OneSheeld.begin();
  request.addParameter("key","xxxxxxxxxxxxx"); //ThingSpeak Channel API

  }
  

void loop()
{

///****ALCOHOL SENSOR****/
  int sensor = analogRead(sensorPin); 
  Terminal.println(sensor);
  if(sensor <= 10 && sensor >=1) //Low Value
  {  
 
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(13, HIGH);
    digitalWrite(4, LOW);
   
  }
  else if(sensor > 10 && sensor < 40) //Moderate Value
  {
    digitalWrite(2, LOW); 
    digitalWrite(3, HIGH); 
    digitalWrite(13, LOW);
    digitalWrite(4, LOW);
    
  }
  else if(sensor > 40) //High Value
  {

    digitalWrite(2, HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(13,HIGH);
    digitalWrite(4, HIGH);
  }
  else if(sensor == 0) //Default Value
  {
    digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(13, LOW); 
    digitalWrite(4, LOW);

  }
  
  
  
/****GPS****/
 if ((start_lat==0) && (start_lon==0) && (flag==0)) //Start Location Coordinates
 {
 start_lat = GPS.getLatitude();
 start_lon = GPS.getLongitude();
 if ((start_lat!=0) && (start_lon!=0))
 {
 flag=1;
 }
 }
 lat = GPS.getLatitude(); //Current Location Coordinates
 lon = GPS.getLongitude();
 dtostrf(lat, 3, 6, latc); 
 request.addParameter("field1",latc); 
 dtostrf(lon, 3, 6, lonc); 
 request.addParameter("field2",lonc);
 distance = GPS.getDistance(start_lat,start_lon);
 distance/= 1000;
 dtostrf(distance, 3, 3, distancec);
 request.addParameter("field5",distancec); //Distance between Start and Current Location
 

/****MISHAP****/
 x=AccelerometerSensor.getX();
 y=AccelerometerSensor.getY();
 z=AccelerometerSensor.getZ();
 
 if ((x>-7.0) && (z<-7.0)) //Mishap Detected
 {
   request.addParameter("field3","Y");
   //mishapFlag==true;
 }
 else
 {
   request.addParameter("field3","N"); //No Mishap
 }
 
/****SOS****/
  if(digitalRead(buttonPin) == HIGH) //SOS Button Pressed
  {
    if(!isMessageSent)
		{
                lat = GPS.getLatitude();
                lon = GPS.getLongitude();
                request.addParameter("field4","SOS");
                sosFlag=true;
                dtostrf(lat, 8, 6, latc); 
		strcat(sosMessage,"SOS! Please track my cab");
                strcat(sosMessage,"http://maps.google.com/maps?q=");
		strcat (sosMessage,latc); 
		strcat(sosMessage,",");
                dtostrf(lon, 8, 6, lonc);
		strcat (sosMessage,lonc);
		SMS.send("+91xxxxxxxxx",sosMessage); //SMS to emergency contact
		isMessageSent = true;		
		}

	else 
		{
		isMessageSent = false;
		}
  }
  else
  {
    if(sosFlag==false)
    {
    request.addParameter("field4","NOSOS");
    }
  }
 

Internet.performGet(request); 
OneSheeld.delay(5000);

}

Schematics

C4C Breadboard Arrangement
C4c

Comments

Similar projects you might like

Control your Light System Using Smart Phone

Project tutorial by Ahmed Yassin

  • 35,259 views
  • 4 comments
  • 55 respects

Home surveillance system using skype calls

Project tutorial by Manuel Miguel

  • 1,621 views
  • 0 comments
  • 3 respects

Anti-Drunk Driving Car Safety System

Project tutorial by Ashwini kumar sinha

  • 1,095 views
  • 0 comments
  • 1 respect

Control your light system with your voice

Project tutorial by Maha Raafat

  • 33,119 views
  • 22 comments
  • 147 respects

Home Management System - Control your home from a website

Project tutorial by Ahmed El-Hinidy

  • 31,399 views
  • 21 comments
  • 115 respects

SMS based Home Automation system using 1SHEELD

Project tutorial by Tanishq Jaiswal

  • 27,263 views
  • 11 comments
  • 63 respects
Add projectSign up / Login