Set-Speed, a Solution to Speeding Vehicles.

by AV04 in Circuits > Microcontrollers

13 Views, 0 Favorites, 0 Comments

Set-Speed, a Solution to Speeding Vehicles.

unnamed.jpg
  1. This project was developed to make the bus travel safer. As this project provides a solution towards the over-speeding of any buses that can cause deadly accidents.
  2. The solution for this is our project that detects the speed of the bus and sustainably controls the speed of the bus by simply slowly cutting off the fuel supply and hence slowing down the bus until in the speed limits.
  3. Our project was enabled with IoT and Data Science which allowed us to integrate the project with our domain of study and also held us to learn new things for the completion of the project.
  4. IoT was the core part of the project and helped us in making the project to pop out than any other project by giving all the information from the bus to the authorities and even giving access to control the parameters live.
  5. The project was a fun experience with my teammates and to lead successfully as a leader of the group.
  6. This project was developed to make the bus travel safer. As this project provides a solution towards the over-speeding of any buses that can cause deadly accidents. The solution for this is our project that detects the speed of the bus and sustainably controls the speed of the bus by simply slowly cutting off the fuel supply and hence slowing down the bus until in the speed limits. Our project was enabled with IoT and Data Science which allowed us to integrate the project with our domain of study and also held us to learn new things for the completion of the project. IoT was the core part of the project and helped us in making the project to pop out than any other project by giving all the information from the bus to the authorities and even giving access to control the parameters live. The project was a fun experience with my teammates and to lead successfully as a leader of the group.


Supplies

unnamed.jpg

Components Required :-

  1. ESP 8266
  2. LEDs
  3. OLED Screen
  4. Buzzer
  5. Potentiometer

unnamed.jpg

Connect the ESP and all other components as shown in the image above.

Paste this arduino code in your ESP using the IDE.


//----------------------------------------Include the NodeMCU ESP8266 Library

//----------------------------------------see here: https://www.youtube.com/watch?v=8jMr94B8iN0 to add NodeMCU ESP12E ESP8266 library and board (ESP8266 Core SDK)

#include <ESP8266WiFi.h>

#include <WiFiClientSecure.h>

//----------------------------------------

//----------------------------------------Include the DHT Library

#include "DHT.h"

//----------------------------------------


#define DHTTYPE DHT11 //--> Defines the type of DHT sensor used (DHT11, DHT21, and DHT22), in this project the sensor used is DHT11.


const int DHTPin = 5; //--> The pin used for the DHT11 sensor is Pin D1 = GPIO5

DHT dht(DHTPin, DHTTYPE); //--> Initialize DHT sensor, DHT dht(Pin_used, Type_of_DHT_Sensor);


#define ON_Board_LED 2 //--> Defining an On Board LED, used for indicators when the process of connecting to a wifi router


//----------------------------------------SSID and Password of your WiFi router.

const char* ssid = ""; //--> Your wifi name or SSID.

const char* password = ""; //--> Your wifi password.

//----------------------------------------


//----------------------------------------Host & httpsPort

const char* host = "script.google.com";

const int httpsPort = 443;

//----------------------------------------


WiFiClientSecure client; //--> Create a WiFiClientSecure object.


String GAS_ID = ""; //--> spreadsheet script ID


//============================================================================== void setup

void setup() {

// put your setup code here, to run once:

Serial.begin(115200);

delay(500);


dht.begin(); //--> Start reading DHT11 sensors

delay(500);

WiFi.begin(ssid, password); //--> Connect to your WiFi router

Serial.println("");

pinMode(ON_Board_LED,OUTPUT); //--> On Board LED port Direction output

digitalWrite(ON_Board_LED, HIGH); //--> Turn off Led On Board


//----------------------------------------Wait for connection

Serial.print("Connecting");

while (WiFi.status() != WL_CONNECTED) {

Serial.print(".");

//----------------------------------------Make the On Board Flashing LED on the process of connecting to the wifi router.

digitalWrite(ON_Board_LED, LOW);

delay(250);

digitalWrite(ON_Board_LED, HIGH);

delay(250);

//----------------------------------------

}

//----------------------------------------

digitalWrite(ON_Board_LED, HIGH); //--> Turn off the On Board LED when it is connected to the wifi router.

//----------------------------------------If successfully connected to the wifi router, the IP Address that will be visited is displayed in the serial monitor

Serial.println("");

Serial.print("Successfully connected to : ");

Serial.println(ssid);

Serial.print("IP address: ");

Serial.println(WiFi.localIP());

Serial.println();

//----------------------------------------


client.setInsecure();

}

//==============================================================================

//============================================================================== void loop

void loop() {

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

int h = dht.readHumidity();

// Read temperature as Celsius (the default)

float t = dht.readTemperature();

// Check if any reads failed and exit early (to try again).

if (isnan(h) || isnan(t)) {

Serial.println("Failed to read from DHT sensor !");

delay(500);

return;

}

String Temp = "Temperature : " + String(t) + " °C";

String Humi = "Humidity : " + String(h) + " %";

Serial.println(Temp);

Serial.println(Humi);

sendData(t, h); //--> Calls the sendData Subroutine

}

//==============================================================================

//============================================================================== void sendData

// Subroutine for sending data to Google Sheets

void sendData(float tem, int hum) {

Serial.println("==========");

Serial.print("connecting to ");

Serial.println(host);

//----------------------------------------Connect to Google host

if (!client.connect(host, httpsPort)) {

Serial.println("connection failed");

return;

}

//----------------------------------------


//----------------------------------------Processing data and sending data

String string_temperature = String(tem);

// String string_temperature = String(tem, DEC);

String string_humidity = String(hum, DEC);

String url = "/macros/s/" + GAS_ID + "/exec?temperature=" + string_temperature + "&humidity=" + string_humidity;

Serial.print("requesting URL: ");

Serial.println(url);


client.print(String("GET ") + url + " HTTP/1.1\r\n" +

"Host: " + host + "\r\n" +

"User-Agent: BuildFailureDetectorESP8266\r\n" +

"Connection: close\r\n\r\n");


Serial.println("request sent");

//----------------------------------------


//----------------------------------------Checking whether the data was sent successfully or not

while (client.connected()) {

String line = client.readStringUntil('\n');

if (line == "\r") {

Serial.println("headers received");

break;

}

}

String line = client.readStringUntil('\n');

if (line.startsWith("{\"state\":\"success\"")) {

Serial.println("esp8266/Arduino CI successfull!");

} else {

Serial.println("esp8266/Arduino CI has failed");

}

Serial.print("reply was : ");

Serial.println(line);

Serial.println("closing connection");

Serial.println("==========");

Serial.println();

//----------------------------------------

}

//==============================================================================

Downloads