Report Final On Smart Helmet
Report Final On Smart Helmet
on
Mechanical Engineering
By
Adarsh Pandey 1900320400005
Navneet Srivastava 1900320400039
Amitesh Shukla 1900320400009
Nikunj Verma 1900320400040
Under the guidance of
DR. ABHISHEK PANDEY
AFFILIATED TO
DR. A.P.J. ABDUL KALAM TECHNICAL UNIVERSITY, LUCKNOW
DECLARATION
We hereby declare that this submission is our own work and that, to the best of
our knowledge and belief, it contains no material previously published or written
by another person, nor material which to a substantial extent has been accepted
for the award of any other degree or diploma by the university or other institute
of higher learning, except where due acknowledgement has been made in the text.
Signature: Signature:
Signature: Signature:
This is to certify that the Project Report entitled “ Smart helmet with Automatic
bike stand using IOT” which is submitted by Adarsh Pandey, Navneet
Srivastava , Amitesh Shukla & Nikunj Verma in the partial fulfillment of the
requirement for the award of the degree of Bachelor of Technology (Electronics
and Communication Engineering) submitted to Dr. A.P.J. Abdul Kalam
Technical University, Lucknow is a record of students’ work carriedout under my
supervision. The matter in this report has not been submitted to any University or
Institution for the award of any degree.
Supervisor:
DR ABHISHEK PANDEY
Prof., ME Department, ABESEC
ACKNOWLEDGEMENT
First and foremost I am thankful to almighty GOD for keeping me fit, healthy and
energetic during entire course.
The success and final outcome of this project required a lot of guidance and
assistance from many people and we are extremely privileged to have got this all
along the completion of our project. All that we have done is only due to such
supervision and assistance and we would not forget to thank them.
I would like to express my gratitude to Dr. Abhishek Pandey, Head of the department,
Mechanical Engineering Department, ABES Engineering College, Ghaziabad, for their
support to finish this work.
With pleasure, I would like to express my greatest gratitude to Dr. Abhishek Pandey
Mechanical Engineering Department, ABES Engineering College, Ghaziabad for their
proficient guidance, intelligent approach, constructive critique, whole hearted and ever
available help, which has been the primary impetus behind the research. Without the
wise advice and able guidance, it would have been impossible to complete the project
in this manner.
Also, I would like to extend our sincere esteems to all laboratory staff members for
their timely support.
Student’s Name
Adarsh Pandey
Navneet Srivastava
Amitesh Shukla
Nikunj Verma
ii
ABSTRACT
Road accidents are becoming very common in the country. The impact of road accidents can lead
to the loss of many lives and can also damage many body parts. This situation becomes more
serious if the riders won't wear the helmet which can be prevented by wearing the helmet and can
reduce these impacts. While riding the bike, the government made it a mandatory rule to wear the
helmet. Using this rule as a base, a smart helmet system is proposed which helps in providing
safety to the riders and prevents accidents.
A smart helmet is a type of protective headgear used by the rider which makes bike driving safer
than before. The main purpose of this helmet is to provide safety for the rider. This can be
implemented by using advanced features like alcohol detection, accident identification, location
tracking, use as a hands free device, fall detection. This makes it not only a smart helmet but also a
feature of a smart bike. It is compulsory to wear the helmet, without which the ignition switch
cannot turn ON. An RF Module can be used as wireless link for communication between
transmitter and receiver.
The system mainly consists of Arduino Uno as a processor for processing the data and alcohol
sensors as breath analyzer for the rider. The system will ensure a safe journey for riders and gives a
helping hand in case of emergency. The cost of installing the whole system onto the helmet is
affordable. Considering this area the automation of stand is taken into account for our project. This
automation is very useful at the parking the vehicle and providing safety to rider.
This automation is related to the limit switch. The system uses the two limit switch which is
placed two places of stand. When the limit switch is actuated the stand will automatically placed.
If another limit switch is actuated the side stand will automatically returns to the initial position.
When limit switch is actuated the signal is passed to the micro controller from the limit switch.
The micro controller saves the data and actuates the relay.
This relay is used to actuate the motor. Thus by the stand is placed. If another limit switch is
operated this sends the signal to the micro controller. So this actuates the relay thus the motor is
operated and the stand is return to the initial position. This automation is very useful at the time of
parking.
iv
TABLE OF CONTENTS
Declaration i
Certificate ii
Acknowledgement iii
Abstract iv
Chapter 1. Introduction 7
1.1 Introduction 7
Chapter 2. Literature Survey 8
Chapter 3. Problem Statement 9
Chapter 4. Proposed Methodology 10
Chapter 5. Hardware and Software Required
5.1 Hardware Required 11
5.1.1 NodeMCU 11
5.1.2 Microcontroller 12
5.1.3 Battery 12
5.1.4 DC Motor 13
5.1.5 Buzzer 13
5.1.6 Battery System 14
5.1.7 Voltage Regulator 14
5.1.8 Side Stand 14
5.1.9 Switch 14
5.1.10 Alcohol Sensor 15
5.1.11 RF Transmitter 15
5.1.12 RF Receiver 16
5.1.13 L293 Motor Driver IC 16
5.1.14 LED 17
1.1 INTRODUCTION
In the present scenario, the living standard was developed. Bike plays a very important role in our
life. It helps to travel from one place to another place in very short time. The bike is a widely used
vehicle in everyone life. As we know that side stand plays a very important role while the vehicle
is in the rest condition. It may cause the death of riders or maybe some bad injuries. In a country
like India, this reason causes the increment rate of the accident. This rate is increasing day by day
so it is necessary to take up some preventive measures to avoid an unwanted accident. In manual
side stand there is a possibility that the riders have been forgetting off to lift the stand and it causes
an unwanted accident. So to overcome this accident we make a project that is automatic side stand.
The automatic side stand works on the simple mechanism and no need to take extra power while
operating. So it does not affect the vehicle efficiency and also suitable for any two-wheeler
vehicles. The design of the vehicle is not affected only simple mechanism is added to the vehicle.
In the current world, technology plays a very important role so we updated our technology day by
day and it is also needs of our society.
Here are only two components are added and that is dc motor and microcontroller which is cheap in
price. So overall price after installing this idea in a vehicle is not affected. This is the new
advancement in a bike with the facility to lift the side stand automatically. This may avoid an
unnecessary accident in the day to day life. The mechanism of this project is simple that why it
does not affect the current design of the bike. This is very cheap so we can install this features in
any type of two-wheeler vehicles.
dggffs
7
CHAPTER 2. LITERATURE SURVEY
1) Ronald McDonald, 1968: Bike is a two wheeler vehicle which keep in straight position
during motion but when motion stops it fell down due to gravity. After the felling there
may be a damage in bike as well as it requires more force to stand again in straight position.
Hence a stand is required to be attached to make the bike straight in rest position. These
days bikes have stands which is opened and closed manually by rider. If the rider forgets to
close the stand it remains open during motion which is dangerous to rider. As the bike
during motion may jump on stand or it may rotate on stand axis. Both the cases may cause
serious injury to rider. Hence it is basic requirement to close the stand during riding .
2) Ramon Alarcon and Michael Starman,2016 : Two wheelers are most prone to accidents
due to their fragile nature. One of the issues of motorbike accidents is that people forget to
slide their side stands back in place on starting the bike. So here we propose an automated
side stand slider system that will automatically slide the side stand back in position when
user starts his/her bike. In this system e make a demonstration model with a demo starter
for bike and a frame used to hold starter, demo bike and side stand in position. The frame is
used to mount bile upright using frame. The starter consists of a microcontroller circuit
used to monitor the starter and then operate the stand sliding mechanism. The stand consists
of a motorized system used to operate the stand. The circuit monitors the starter, on starting
the bike the side stand is operated by the motor using a shaft to slide from a vertical
position to a
horizontal position. On turning off the key in other direction to lock bike the system moves the
motorized stand shaft in opposite direction so as to move the stand in a direction
perpendicular to the bottom frame rod which rests the motor bike on side stand. Thus we
have a fully automated side stand system for motor bikes.
3) Chad Wilson, 2016: According to the research paper in 2016 titled ‘Smart Helmet’, IN this
year the main objective of author is to force the rider to wear the helmet. In this competitive
world one of the survey says that the death trolls due to motor bike accidents are increasing
day by day out of which most of these casualties occurs because of the absence of helmet.
Traffic
police cannot cover remote roads of city. That’s why over primary objective is to make the
usage of the helmet for two wheelers compulsory. Thus, no one other than the owner
himself, who doesn’t have “password” which would have been created by the owner, can
use the bike. In this author has proposed the feature that the bike will not start unless the
bike rider does not wear the helmet. The other this module basically deals with the
checksum rider if he is wearing the helmet or not on first place to achieve this ultrasonic
sensor is been used. Based on this the signal are been sent to the next module voice
recognition module use for authentication purpose. Arduino is also used in this project
which is an open source tool for making computer that can sense.
8
CHAPTER 3. PROBLEM STATEMENT
The bike is a widely used vehicle in everyone life.As we know that side
stand plays a very important role while the vehicle is in the rest condition.
It may cause the death of riders or maybe some bad injuries.
Many people get injured in road accident more frequently because of the main
reason not wearing a helmet.
In a country like India, this reason causes the increment rate of the
accident. This rate is increasing day by day so it is necessary to take up
some preventive measures to avoid an unwanted accident.
There is a possibility that the riders have been forgetting of wearing helmet
or to lift the stand and it causes an unwanted accident.
● To overcome this accident we make a project that is automatic side stand with
smart helmet.
● The automatic side stand works on the simple mechanism and no need to take
extra power while operating.
● So it does not affect the vehicle efficiency and also suitable for any two-wheeler
vehicles.
● The design of the vehicle is not affected only simple mechanism is added to the
vehicle.
● In the current world, technology plays a very important role so we updated our
technology day by day and it is also needs of our society.
● The development in the field of IoT in the past two decades has enabled
technology visionaries to solve real-world problems very easily.
9
CHAPTER 4. PROPOSED METHODOLOGY
10
CHAPTER 5. Hardware and Software Required
Features of NodeMCU: -
● Operating Voltage: 3.0-3.6 V
● Operating Current: 80mA
● 32-bit MCU
● Integrated 10-bit ADC
● Integrated TCP/IP protocol
● 2.4 GHz Wi-Fi that supports WPA/WPA2
● It supports UART, SPI, I2C, IR remote, PWM, SDIO 2.0
● It has 20 I/O ports
11
5.1.2 Battery
A 12-volt dry cell rechargeable battery is used for electrical supply to the motor which is connected to side
stand. A dry cell uses a paste electrolyte, with only enough moisture to allow current to flow. In our project
we are using secondary type battery. It is rechargeable type. A battery is one or more electrochemical cells,
which store chemical energy and make it available as electric current. There are two types of batteries,
primary (disposable) and secondary (rechargeable), both of which convert chemical energy to electrical
energy. In isolated systems away from the grid, batteries are used for storage of excess thermal energy
converted into electrical energy. In fact, for small units with output less than one kilowatt, Batteries seem to
be the only technically and economically available storage means. Since both the TEG system and batteries
are high in capital costs, it is necessary that the overall system be optimized with respect to available energy
and local demand patter.
5.1.3 DC MOTOR
It converts direct current electrical power into mechanical power. The speed of the motor is counted in term
of rotation of the shaft per minute. Dc motor is designed for two-speed operation. It consists of three brushes
namely common, low speed, high speed. Two of the brushes will be supplied for a different mode of
operation. The DC motor does not oscillate back and forth, it rotates continuously in one direction like most
other motors. The rotational motor is converted to the back and forth wiper motion by a series of mechanical
linkage. This type of motor is called a gear head or motor ends DC motor. It has the advantage of having lots
of torque. This DC motor works on 12-volt DC battery. DC motors were the first form of motor widely used,
as they could be powered from existing direct-current lighting power distribution systems. A DC motor's
speed can be controlled over a wide range, using either a variable supply voltage or by changing the strength
of current in its field windings. Small DC motors are used in tools, toys, and appliances. The universal motor
can operate on direct current but is a lightweight brushed motor used for portable power tools and appliances.
Larger DC motors are currently used in propulsion of electric vehicles, elevator and hoists, and in drives for
steel rolling mills. The advent of power electronics has made replacement of DC motors with AC motors
possible in many applications.
.
5.1.4 Buzzer
transducer (converts electrical energy into mechanical energy) that typically operates a buzzer is in
the lower portion of the audible frequency range of 20 Hz to 20 kHz. This is A accomplished by
converting an electric, oscillating signal in the audible range, into mechanical energy, in the form
12
of audible waves. Buzzer is used in this research to warn the blind person against obstacles by
generating signals.
Fig-5.4 Buzzer
Fig-5.5 Battery
The most integral part of the design is its low cost and compact size. For both the
constraints to be fulfilled we have used a cost efficient battery which also helped in
reducing the size of the cane. The battery used here is LiPo (Lithium polymer) battery
with 1500mAh which is of less cost hence reducing the overall cost of the blind cane.
13
A voltage regulator is a system designed to automatically maintain a constant voltage. A
voltage regulator may use a simple feed-forward design or may include negative
feedback. It may use an electromechanical mechanism, or electronic components.
Depending on the design, it may be used to regulate one or more AC or DC voltages.
A Side stand is a device on a motorcycle that allows the bike to be kept upright without leaning against
another object. A kickstand is usually a piece of metal that flips down from the frame and makes contact
with the ground. The location of automatic side stand is just middle of the vehicle on a left side of the bike
from the rear.
5.1.8 Switch
A switch is an electric mechanism for ON/OFF the device, it is used to regulate the flow of electricity by
interrupting or diverting the current from one conductor to another. This switch is placed inside on top of
the helmet and it is pressed when the rider wears the helmet and it released when helmet takes off. Based
on the switch condition the bike ignition key will be ON/OFF.
14
The alcohol sensor is technically referred to as a MQ3 sensor which detects ethanol in the air. When a
drunk person breathes near the alcohol sensor it detects the ethanol in his breathe and provides an output
based on alcohol concentration. An alcohol sensor detects the attentiveness of ethanol in the air when the
drunk person breathes near this sensor, it discloses the alcohol gas in his breath and obtains the output
based on alcohol concentration. It is placed in the helmet such a way that it can easily sense the breath of
the person. The sensor technology has also been adapted for a first of its kind mouthpiece free
instrumentation for workplace and aftermarket vehicle installations. It is the next generation of alcolocks-
for sale and secure starts to each transport, with little inconvenience to the business.
5.1.10 RF transmitter
RF modules are 434 MHz transmitter and receiver components. RF transmitter is the wireless data
transmitting device. It transmits serial data to the receiver through an antenna which is connected to the 4th
pin of the transmitter. It transmits the helmet data to the bike receiver through the radio frequency signals
and microcontroller will process the received data.
5.1.11 RF receiver
15
Radio-frequency receiver is an electronic device, used to communicate between two electronic devices
which are connected wirelessly. The transmission takes place through the radio waves which are of the
form of electromagnetic radiation. The helmet module(transmitter) output data will be received by the
vehicle module(receiver) and the process will take place by wireless technology.
A push switch (button) is a momentary or non-latching switch which causes a temporary change in the state
of an electrical circuit only while the switch is physically actuated. An automatic mechanism (i.e. a spring)
returns the switch to its default position immediately afterwards, restoring the initial circuit condition.
There are two types:
A 'push to make' switch allows electricity to flow between its two contacts when held in. When the button
is released, the circuit is broken. This type of switch is also known as a Normally Open (NO) Switch.
(Examples: doorbell, computer case power switch, calculator buttons, individual keys on a keyboard)
A 'push to break' switch does the opposite, i.e. when the button is not pressed, electricity can flow, but
when it is pressed the circuit is broken. This type of switch is also known as a Normally Closed (NC)
Switch. (Examples:
Fridge Light Switch, Alarm Switches in Fail-Safe circuits)
Many Push switches are designed to function as both 'push to make' and 'push to break' switches. For these
switches, the wiring of the switch determines whether the switch functions as a 'push to make' or as a 'push
to break' switch.
L293D IC is known as a motor driver. It is a low voltage operating device like other ICs. L293D
provides the continuous bidirectional Direct Current to the Motor. The Polarity of current can change at
any time without affecting the whole IC or any other device in the circuit. L293D has an internal H-
bridge installed for two motors.
H-Bridge is an electrical circuit that enables the load in a bidirectional way. L293D bridge is controlled
by external low voltage signals. It may be small in size, but its power output capacity is higher than our
expectation. It could control any DC motor speed and direction with a voltage range of 4.5 – 36 Volts.
Its diodes also save the controlling device and IC from back EMF. To control the max 600mA amount of
current an internal “Darlington transistor sink” installed in it, which could be used to control a large
amount of current by providing a small amount of current. It has also internal “pseudo-Darlington
source” which amplifies the input signal to control the high voltage DC motor without any interception.
Features
L293D could be used to control the two motors at the same time.
• It has the ability to control the speed by using the enable pin.
• The direction is also easy to change.
• Voltage supply range is higher than other IC. Voltage range between 4.5-36 volts can easily handle
by the IC to the motor.
• The motor has a maximum continuous range of current close to 600mA but the maximum peak
current range is 1.2A
• It has an automatic shutdown system on thermal condition.
• Its working range is from 0 – 70 degree which is much higher for any small-sized IC.
16
Fig 5.10 L293 Motor Driver IC
Fig-5.11 LED
The LED has two pins called anode and cathode. The anode is the longest pin. This is the pin you
connect to the most positive voltage. The cathode is the pin you connect to the most negative
voltage. They must be connected correctly for the LED to work.
17
CHAPTER 6.
WORK DONE
POWER SUPPLY
IGNITION
SWITCH
SWITCK KEY
Rf RECEIVER
NodeMCU
D.C MOTOR
BIKE STAND
18
Fig 6.1 Block Diagram
6.2 Hardware
19
Fig 6.2 Picture of Helmet Unit
20
6.3 Node MCU Coding
#include <Servo.h>
Servo myservo;
///*******************************************************///
///*******************************************************///
/// SERVER CODE START FROM HERE ///
///*******************************************************///
///*******************************************************///
#define LOLIN_LED D4
#define PRODUCTION 1
//#define DEBUG_SERVER 1
String HOME = "/";
21
//@auto generated code
//QR Format
//WIFI:S:MySSID;T:WPA;P:MyPassW0rd;;
//hotspot config const char*
hotspot_name = "iota0211-bike";
const char* hotspot_password = "iota0211";
struct{
String message;
String message_class = "hide";
String helmet;
String helmet_class = "success";
String alcohol;
String alcohol_class = "success";
String blink;
String blink_class = "success";
String ignition;
String ignition_class = "success";
String stand;
String stand_class = "success";
} dataPacket;
22
const int BTN_BLINK = 1001;
const int BTN_HELMET =
1002;
} btnAction;
int userBtnAction = btnAction.BTN_NONE;
#ifdef PRODUCTION
String getDataJson(){
return
"{\"message\":\""+dataPacket.message+"\",\"message_class\":\""+dataPacket.message_class+"\", "
"\"helmet\":\""+dataPacket.helmet+"\",\"helmet_class\":\""+dataPacket.helmet_class+"\", "
"\"alcohol\":\""+dataPacket.alcohol+"\",\"alcohol_class\":\""+dataPacket.alcohol_class+"\", "
"\"blink\":\""+dataPacket.blink+"\",\"blink_class\":\""+dataPacket.blink_class+"\", "
"\"ignition\":\""+dataPacket.ignition+"\",\"ignition_class\":\""+dataPacket.ignition_class+"\", "
"\"stand\":\""+dataPacket.stand+"\",\"stand_class\":\""+dataPacket.stand_class+"\", "
"\"btn_alc\":\""+dataPacket.btn_alc+"\",\"btn_alc_class\":\""+dataPacket.btn_alc_class+"\", "
"\"btn_blink\":\""+dataPacket.btn_blink+"\",\"btn_blink_class\":\""+dataPacket.btn_blink_class+"
\", "
"\"btn_helmet\":\""+dataPacket.btn_helmet+"\",\"btn_helmet_class\":\""+dataPacket.btn_helmet_
class+"\"}";
}
#endif
#ifdef DEBUG_SERVER
String getTestClass(){
23
int r = random(0,4); switch
(r){
case 0: return
"primary"; case 1: return
"secondary"; case 2: return "success";
case 3: return "danger";
case 4: return "warning";
}
}
String getDataJson(){
return "{\"message\":\""+String(random(10,99))+"\",\"message_class\":\""+getTestClass()+"\", "
"\"helmet\":\""+String(random(10,99))+"\",\"helmet_class\":\""+getTestClass()+"\", "
"\"alcohol\":\""+String(random(10,99))+"\",\"alcohol_class\":\""+getTestClass()+"\", "
"\"blink\":\""+String(random(10,99))+"\",\"blink_class\":\""+getTestClass()+"\", "
"\"ignition\":\""+String(random(10,99))+"\",\"ignition_class\":\""+getTestClass()+"\", "
"\"stand\":\""+String(random(10,99))+"\",\"stand_class\":\""+getTestClass()+"\", "
"\"btn_alc\":\""+String(random(10,99))+"\",\"btn_alc_class\":\""+getTestClass()+"\", "
"\"btn_blink\":\""+String(random(10,99))+"\",\"btn_blink_class\":\""+getTestClass()+"\", "
"\"btn_helmet\":\""+String(random(10,99))+"\",\"btn_helmet_class\":\""+getTestClass()
+"\"}"; }
#endif
void handle_Home() {
server.send( 200, "text/html", getTemplate());
}
void handle_DataRequest(){
server.send( 200, "text/json", getDataJson());
}
void handle_NotFound(){
forwardTo(HOME);
}
void setUpServer()
{ delay(500);
24
WiFi.softAP(hotspot_name, hotspot_password);
WiFi.softAPConfig(local_ip, gateway, subnet);
delay(100);
server.begin();
delay(300);
Serial.println("server started.");
}
#define IR_PIN D1
#define BUZZER_PIN D2
#define SERVO_PIN D6
#define RELAY_PIN D5
// #define MRP_PIN D7
// #define MRN_PIN D8
void setUpGPIO(void);
void setup()
{ delay(500);
Serial.begin(115200);
Serial.println("\n\
nstartng...");
setUpServer();
setUpGPIO(); timestamp
= millis();
}
void setUpGPIO()
{ pinMode(LOLIN_LED,OUTPUT);
pinMode(IR_PIN,INPUT);
pinMode(BUZZER_PIN, OUTPUT);
myservo.attach(SERVO_PIN);
myservo.write(120);
pinMode(RELAY_PIN,OUTPUT
); //
pinMode(MLN_PIN,OUTPUT);
// pinMode(MRP_PIN,OUTPUT);
// pinMode(MRN_PIN,OUTPUT);
}
25
int heartRate()
{ return
random(65, 85);
} int oxigen()
{ return
random(96, 100);
}
uint32_t lcd_update_time
= 0; uint32_t
vantilation_timer = 0; int
vant_open = 0; void
loop()
{ server.handleClient();
blinkLed(500);
if(userBtnAction != btnAction.BTN_NONE){
//if(userBtnAction == btnAction.BTN_ALC )
{ dataPacket.btn_alc = dataPacket.btn_alc_cmd;
Serial.print("ALC:");
Serial.println(dataPacket.btn_alc);
if(dataPacket.btn_alc == "ON")
{ dataPacket.btn_alc_class =
26
"danger"; // dataPacket.alcohol =
"DETECTED!";
// dataPacket.alcohol_class = "danger";
}
else{
//dataPacket.alcohol = "NOT DETECTED";
dataPacket.btn_alc_class = "success";
}
//}
//if(userBtnAction == btnAction.BTN_BLINK )
{ dataPacket.btn_blink = dataPacket.btn_blink_cmd;
Serial.print("BLINK:");
Serial.println(dataPacket.btn_blink);
if(dataPacket.btn_blink == "ON")
{ dataPacket.btn_blink_class = "danger";
dataPacket.blink = "Sleeping!";
dataPacket.blink_class = "danger";
}
else{
dataPacket.btn_blink_class = "success";
dataPacket.blink = "Awake";
dataPacket.blink_class = "success";
}
//}
//if(userBtnAction == btnAction.BTN_HELMET )
{ dataPacket.btn_helmet = dataPacket.btn_helmet_cmd;
Serial.print("HELMET:");
Serial.println(dataPacket.btn_helmet);
if(dataPacket.btn_helmet == "ON"){
dataPacket.btn_helmet_class = "danger";
// dataPacket.helmet = "ON";
// dataPacket.helmet_class = "success";
}
else{
dataPacket.btn_helmet_class =
"success"; // dataPacket.helmet =
"OFF";
// dataPacket.helmet_class = "danger";
}
//}
if(dataPacket.btn_helmet =="OFF")
{ dataPacket.message = "Please weare
helmet!"; dataPacket.message_class =
"danger"; dataPacket.helmet = "OFF";
dataPacket.helmet_class = "danger";
27
}
else if(dataPacket.btn_alc == "ON")
{ dataPacket.message = "Alcohol Detected!";
dataPacket.message_class = "danger";
dataPacket.alcohol = "DETECTED";
dataPacket.alcohol_class = "danger";
}
dataPacket.stand = "ON";
dataPacket.ignition = "OFF";
dataPacket.stand_class = "danger";
dataPacket.ignition_class = "danger";
myservo.write(120);
}
els
e{
dataPacket.helmet = "ON";
dataPacket.helmet_class = "success";
dataPacket.stand = "OFF";
dataPacket.stand_class = "success";
dataPacket.ignition = "ON";
dataPacket.ignition_class = "success";
myservo.write(30);
dataPacket.message = "";
dataPacket.message_class = "hide"; }
userBtnAction = btnAction.BTN_NONE;
Serial.println("Button clicked");
if(dataPacket.blink == "Sleeping!"){
digitalWrite(BUZZER_PIN, HIGH);
}
else{
digitalWrite(BUZZER_PIN, LOW);
}
28
if(dataPacket.btn_alc == "ON" || dataPacket.btn_helmet =="OFF" )
{ digitalWrite(RELAY_PIN, LOW);
}
els
e{
digitalWrite(RELAY_PIN, HIGH);
}
dataPacket.btn_alc_class = "hide";
dataPacket.btn_blink_class = "hide";
dataPacket.btn_helmet_class = "hide";
// if(digitalRead(IR_PIN) == 0){
// dataPacket.message_class = "hide";
// dataPacket.message = "";
// dataPacket.temperature = DHT11Data.temp;
// dataPacket.humidity = DHT11Data.humidity;
// dataPacket.heartrate = heartRate();
// }
// else{
// dataPacket.message_class = "danger";
// dataPacket.message = "Finger out!";
// dataPacket.temperature = 0;
// dataPacket.humidity = 0;
// dataPacket.heartrate = 0;
// }
29
String getTemplate(){
return "<!DOCTYPE html>\n"
"<html>\n"
"<head>\n"
"<style>"
"body{\n"
"background-color: #F1FCFF;\n"
"padding:0px;\n"
"margin:0px;\n"
"text-align: center;\n"
"}\n"
"header{\n"
"height:35px;\n"
"padding:10px;\n" "text-
align:left;\n"
"display: flex;\n"
"background-color: #0093E9;\n"
"position:fixed;\n"
"width:100%;\n"
"z-index:100;\n"
"top:0;\n"
"}\n"
"footer{\n"
"padding:20px;\n"
"}\n"
"\n"
"form{\n"
"margin:15px auto 0px auto;\n"
"max-width:90%;\n"
"background-color: #AAAAAA;\n"
"padding: 15px 0 15px 0;\n"
"border-radius: 5px;\n"
"}\n"
"\n"
"button{\n"
"margin:8px auto 0px auto;\n"
"width:90%;\n"
"background-color: #AAAAAA;\n"
"padding: 10px 0 10px 0;\n"
"border-radius: 5px;\n"
"font-size: 24px;\n"
"font-weight: bold;\n"
"color:white;\n"
"border: none;\n"
"}\n"
"button:active {\n"
"width:89%;\n"
30
"padding: 10px 0 10px 0;\n"
"color:black;\n"
"}\n"
"input{\n"
"margin:8px auto 0px auto;\n"
"width:90%;\n"
"padding: 10px 0 10px 0;\n"
"border-radius: 5px;\n"
"font-size: 22px;\n"
"color:black;\n"
"border: none;\n"
"}\n"
"\n"
"label{\n"
"margin:15px auto 0px auto;\n"
"width:90%;\n"
"padding: 0px 0 0px 0;\n"
"font-size: 22px;\n"
"display:block;\n"
"}\n"
"\n"
".radio-group{\n"
"margin:15px auto 15px auto;\n"
"font-size: 24px;\n"
"width:100%;\n"
"display:flex;\n"
"flex-direction: row;\n"
"text-align:left;\n"
"}\n"
".radio-label{\n"
"margin:0px;\n"
"padding:0px;\n"
"}\n"
".radio{\n"
"width:32px;\n"
"margin:0px 10px 0px 15px;\n"
"}\n"
"\n"
".content{\n"
"margin-top:70px;\n"
"}\n"
".connection{\n"
"margin-left:20px;\n"
"color: white;\n"
"}\n"
".online{\n"
"margin: 8px 0 0 -8px;\n"
31
"font-size: 16px;\n"
"color:white;\n"
"}\n"
".card{\n"
"margin:15px auto 0px auto;\n"
"max-width:90%;\n"
"padding: 15px 0 15px 0;\n"
"border-radius: 5px;\n"
"}\n"
".primary{\n"
"background-color: #8BC6EC;\n"
"visibility: visible;\n"
"}\n"
".secondary{\n"
"background-color: #AAAAAA;\n"
"visibility: visible;\n"
"}\n"
".success{\n"
"background-color: #82c063;\n"
"visibility: visible;\n"
"}\n"
".danger{\n"
"background-color: #F76666;\n"
"visibility: visible;\n"
"}\n"
".warning{\n"
"background-color: #E3D377;\n"
"visibility: visible;\n"
"}\n"
".hide{\n"
"visibility: hidden;\n"
"}\n"
"@media only screen and (min-width: 500px) {\n"
".card {\n"
"max-width:400px;\n"
"}\n"
"button{\n"
"max-width:400px;\n"
"}\n"
"form{\n"
"max-width:400px;\n"
"}\n"
"label{\n"
"max-width:400px;\n"
"}\n"
"}\n"
"\n"
32
"h1 {\n"
"margin: 2px;\n"
"color: white;\n"
"}\n"
"h2 {\n"
"margin: 2px;\n"
"color: black;\n"
"}\n"
"</style>\n"
"<meta charset='utf-8'>\n"
"<meta http-equiv='X-UA-Compatible' content='IE=edge'>\n"
"<title>Smart Stand</title>\n"
"<meta name='viewport' content='width=device-width, initial-scale=1'>\n"
"<link rel='stylesheet' type='text/css' media='screen' href='main.css'>\n"
"\n"
"</head>\n"
"<body onload=\"liveDataAjax()\">\n"
"<header>\n"
"<span class=\"connection\" id=\"connected\">\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"currentColor\"
class=\"connected\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M15.384 6.115a.485.485 0 0 0-.047-.736A12.444 12.444 0 0 0 8 3C5.259 3 2.723
3.882.663 5.379a.485.485 0 0 0-.048.736.518.518 0 0 0 .668.05A11.448 11.448 0 0 1 8 4c2.507 0
4.827.802 6.716 2.164.205.148.49.13.668-.049z\"/>\n"
"<path d=\"M13.229 8.271a.482.482 0 0 0-.063-.745A9.455 9.455 0 0 0 8 6c-1.905 0-3.68.56-
5.166 1.526a.48.48 0 0 0-.063.745.525.525 0 0 0 .652.065A8.46 8.46 0 0 1 8 7a8.46 8.46 0 0 1 4.576
1.336c.206.132.48.108.653-.065zm-2.183 2.183c.226-.226.185-.605-.1-.75A6.473 6.473 0 0 0 8 9c-
1.06
0-2.062.254-2.946.704-.285.145-.326.524-.1.75l.015.015c.16.16.407.19.611.09A5.478 5.478 0 0 1 8
10c.868 0 1.69.201 2.42.56.203.1.45.07.61-.091l.016-.015zM9.06
12.44c.196-.196.198-.52-.04-.66A1.99
1.99 0 0 0 8 11.5a1.99 1.99 0 0 0-1.02.28c-.238.14-.236.464-.04.66l.706.706a.5.5 0 0 0 .707
0l.707.707z\"/>\n"
"</svg>\n"
"</span>\n"
"<span class=\"connection\" id=\"disconnected\">\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"currentColor\"
class=\"connected\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M10.706 3.294A12.545 12.545 0 0 0 8 3C5.259 3 2.723 3.882.663 5.379a.485.485 0 0
0-.048.736.518.518 0 0 0 .668.05A11.448 11.448 0 0 1 8 4c.63 0 1.249.05 1.852.148l.854-.854zM8
6c1.905 0-3.68.56-5.166 1.526a.48.48 0 0 0-.063.745.525.525 0 0 0 .652.065 8.448 8.448 0 0 1 3.51-
1.27L8
6zm2.596 1.404.785-.785c.63.24 1.227.545 1.785.907a.482.482 0 0 1 .063.745.525.525 0 0
1-.652.065
8.462 8.462 0 0 0-1.98-.932zM8 10l.933-.933a6.455 6.455 0 0 1
2.013.637c.285.145.326.524.1.75l.015.015a.532.532 0 0 1-.611.09A5.478 5.478 0 0 0 8 10zm4.905-
4.905.747-.747c.59.3 1.153.645 1.685
33
1.03a.485.485 0 0 1 .047.737.518.518 0 0 1-.668.05 11.493 11.493 0 0 0-1.811-1.07zM9.02
11.78c.238.14.236.464.04.66l-.707.706a.5.5 0 0 1-.707
0l-.707-.707c-.195-.195-.197-.518.04-.66A1.99
1.99 0 0 1 8 11.5c.374 0 .723.102 1.021.28zm4.355-9.905a.53.53 0 0 1 .75.75l-10.75 10.75a.53.53 0
0 1-
.75-.75l10.75-10.75z\"/>\n"
"</svg>\n"
"</span>\n"
"<span class=\"connection\">\n"
"<p class=\"online\" id=\"online\" >Online</p>\n"
"</span>\n"
"</header>\n"
"\n"
"<div class=\"content\">\n"
"<div class=\"card hide\" id=\"message\">\n"
"<span></span>\n"
"<h1></h1>\n"
"</div>\n"
"<div class=\"card primary\" id=\"helmet\">\n"
"<span>\n"
"<h3>Helmet</h3>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"blue\"
class=\"bi bi-thermometer-half\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z\"/>\n"
"</svg>\n"
"</span>\n"
"<h1>ON</h1>\n"
"</div>\n"
"<div class=\"card primary\" id=\"alcohol\">\n"
"<span>\n"
"<h3>Alcohol</h3>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"blue\"
class=\"bi bi-thermometer-half\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M12.5 2A2.5 2.5 0 0 0 10 4.5a.5.5 0 0 1-1 0A3.5 3.5 0 1 1 12.5 8H.5a.5.5 0 0 1
01h12a2.5 2.5 0 0 0 0-5zm-7 1a1 1 0 0 0-1 1 .5.5 0 0 1-1 0 2 2 0 1 1 2 2h-5a.5.5 0 0 1 0-1h5a1 1 0 0
0 0-
2zM0 9.5A.5.5 0 0 1 .5 9h10.042a3 3 0 1 1-3 3 .5.5 0 0 1 1 0 2 2 0 1 0 2-2H.5a.5.5 0 0 1-.5-.5z\"/>\n"
"</svg>\n"
"</span>\n"
"<h1></h1>\n"
"</div>\n"
"<div class=\"card primary\" id=\"blink\">\n"
"<span>\n"
"<h3>Blink</h3>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"blue\"
class=\"bi bi-thermometer-half\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-
34
2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1
14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-
.517.486l.708.709z\"/>\n"
"<path d=\"M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829
2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829
2.829z\"/>\n"
"<path d=\"M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172
8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133
2.02.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296
8.88412-12 .708-.708 12 12-.708.708z\"/>\n"
"</svg>\n"
"</span>\n"
"<h1></h1>\n"
"</div>\n"
"<div class=\"card primary\" id=\"ignition\">\n"
"<span>\n"
"<h3>Ignition</h3>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"blue\"
class=\"bi bi-water\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M7 6a1 1 0 0 1 2 0v1H7V6zM6 8.3c0-.042.02-.107.105-.175A.637.637 0 0 1 6.5
8h3a.64.64 0 0 1 .395.125c.085.068.105.133.105.175v2.4c0 .042-.02.107-.105.175A.637.637 0 0 1
9.5
11h-3a.637.637 0 0 1-.395-.125C6.02 10.807 6 10.742 6 10.7V8.3z\"/>\n"
"<path d=\"M12 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm-2
6v1.076c.54.166 1 .597 1 1.224v2.4c0 .816-.781 1.3-1.5 1.3h-3c-.719 0-1.5-.484-1.5-
1.3V8.3c0-.627.46-
1.058 1-1.224V6a2 2 0 1 1 4 0z\"/>\n"
"</svg>\n"
"</span>\n"
"<h1>OFF</h1>\n"
"</div>\n"
"<div class=\"card primary\" id=\"stand\">\n"
"<span>\n"
"<h3>Stand</h3>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"blue\"
class=\"bi bi-thermometer-half\" viewBox=\"0 0 16 16\">\n"
"<path d=\"M5.5 4.002h2.962C10.045 4.002 11 5.104 11 6.586c0 1.494-.967 2.578-2.55
2.578H6.784V12H5.5V4.002Zm2.77 4.072c.893 0 1.419-.545 1.419-1.488s-.526-1.482-
1.421.482H6.778v2.97H8.27Z\"/>\n"
"<path d=\"M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2Zm15 0a1 1
0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2Z\"/>\n"
"</svg>\n"
"</span>\n"
"<h1>ON</h1>\n"
"</div>\n"
"\n"
"\n"
35
"<div class=\"hide\">\n"
"<h3>Alcohol</h3>\n"
"<button onclick=\"onClickBtn('btn_alc')\" id=\"btn_alc\">DUMMY</button>\n"
"</div>\n"
"<div class=\"hide\">\n"
"<h3>BLINK</h3>\n"
"<button onclick=\"onClickBtn('btn_blink')\" id=\"btn_blink\">Blink</button>\n"
"</div>\n"
"<div class=\"hide\">\n"
"<h3>Helmet</h3>\n"
"<button onclick=\"onClickBtn('btn_helmet')\" id=\"btn_helmet\">DUMMY</button>\n"
"</div>\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"</div>\n"
"<footer>\n"
"\n"
"</footer>\n"
"\n"
"<script>"
"var DRT = 500;\n"
"function updateCSSClass(element, css){\n"
" if(css != 'primary')\n"
" element.classList.remove('primary');\n"
" if(css != 'secondary')\n"
" element.classList.remove('secondary');\n"
" if(css != 'success')\n"
" element.classList.remove('success');\n"
" if(css != 'danger')\n"
" element.classList.remove('danger');\n"
" if(css != 'warning')\n"
" element.classList.remove('warning');\n"
" if(css != 'hide')\n"
" element.classList.remove('hide');\n"
" element.classList.add(css);\n"
"}\n"
"\n"
"function updateData(data){\n"
"\tdocument.getElementById(\"message\").children[1].innerHTML = \"\"+data.message+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"message\"), data.message_class);\n"
"\tdocument.getElementById(\"helmet\").children[1].innerHTML = \"\"+data.helmet+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"helmet\"), data.helmet_class);\n"
"\tdocument.getElementById(\"alcohol\").children[1].innerHTML = \"\"+data.alcohol+\"\";\n"
36
"\tupdateCSSClass(document.getElementById(\"alcohol\"), data.alcohol_class);\n"
"\tdocument.getElementById(\"blink\").children[1].innerHTML = \"\"+data.blink+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"blink\"), data.blink_class);\n"
"\tdocument.getElementById(\"ignition\").children[1].innerHTML = \"\"+data.ignition+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"ignition\"), data.ignition_class);\n"
"\tdocument.getElementById(\"stand\").children[1].innerHTML = \"\"+data.stand+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"stand\"), data.stand_class);\n"
"\tdocument.getElementById(\"btn_alc\").innerHTML = \"\"+data.btn_alc+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"btn_alc\"), data.btn_alc_class);\n"
"\tdocument.getElementById(\"btn_blink\").innerHTML = \"\"+data.btn_blink+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"btn_blink\"), data.btn_blink_class);\n"
"\tdocument.getElementById(\"btn_helmet\").innerHTML = \"\"+data.btn_helmet+\"\";\n"
"\tupdateCSSClass(document.getElementById(\"btn_helmet\"), data.btn_helmet_class);\n"
"}\n"
"\n"
"function getCommand(btn_id, value){\n"
"\tif(btn_id == \"btn_alc\"){\n"
"\t\tif(value == 'ON'){\n"
"\t\t\treturn 'OFF';\n"
"\t\t}else{\n"
"\t\t\treturn 'ON';\n"
"\t\t}\n"
"\t}\tif(btn_id == \"btn_blink\"){\n"
"\t\tif(value == 'ON'){\n"
"\t\t\treturn 'OFF';\n"
"\t\t}else{\n"
"\t\t\treturn 'ON';\n"
"\t\t}\n"
"\t}\tif(btn_id == \"btn_helmet\"){\n"
"\t\tif(value == 'ON'){\n"
"\t\t\treturn 'OFF';\n"
"\t\t}else{\n"
"\t\t\treturn 'ON';\n"
"\t\t}\n"
"\t} \n"
"}\n"
"\n"
"function onClickBtn(btn_id){\n"
"\tvar val = document.getElementById(btn_id).innerHTML;\n"
"\tvar cmd = getCommand(btn_id,val);\n"
" console.log(cmd)\n"
"\tsendButtonClick('/act?'+btn_id+'='+cmd)\n"
"}\n"
"\n"
"\n"
"\n"
"function updateNetwork(connected){\n"
37
" if(connected){\n"
" document.getElementById('disconnected').style.display = 'none';\n"
" document.getElementById('connected').style.display = 'block';\n"
" document.getElementById('online').innerHTML = 'Online';\n"
" }\n"
" else{\n"
" document.getElementById('connected').style.display = 'none';\n"
" document.getElementById('disconnected').style.display = 'block';\n"
" document.getElementById('online').innerHTML = 'Offline';\n"
" }\n"
"}\n"
"\n"
"\n"
"function sendButtonClick(url){\n"
"\t\n"
" const xhr = new XMLHttpRequest();\n"
" xhr.open('GET', url, true);\n"
" xhr.onload = () => {\n"
" if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {\n"
" var data= JSON.parse(xhr.responseText);\n"
" updateData(data);\n"
" updateNetwork(true);\n"
" }\n"
" }\n"
" xhr.onerror = function()
{\n" " updateNetwork(false);\
n"
" };\n"
" xhr.send();\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"var netcount = 0;\n"
"function reconnect(){\n"
" if(netcount == 0){\n"
" console.log(\"Retrying\");\n"
" document.getElementById('online').innerHTML = 'Retrying..';\n"
" setTimeout(liveDataAjax,1000);\n"
" return\n"
" }\n"
" netcount -= 1;\n"
" console.log(\"count\",netcount);\n"
" document.getElementById('online').innerHTML = 'Offline ('+netcount+')';\n"
" setTimeout(reconnect, 1000);\n"
"}\n"
38
"function liveDataAjax(){\n"
" const xhr = new XMLHttpRequest();\n"
" xhr.open('GET', '/data.json', true);\n"
" xhr.onload = () => {\n"
" if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {\n"
" var data= JSON.parse(xhr.responseText);\n"
" updateData(data);\n"
" updateNetwork(true);\n"
" setTimeout(liveDataAjax, DRT);\n"
" }\n"
" else if (xhr.readyState === XMLHttpRequest.DONE){\n"
" updateNetwork(false);\n"
" netcount = 5;\n"
" reconnect();\n"
" }\n"
" };\n"
" xhr.onerror = function() {\n"
" updateNetwork(false);\n"
" netcount = 5;\n"
"
reconnect();\n" "
};\n"
" xhr.send();\t\n"
"}\n"
"\n"
"</script>\n"
"</body>\n"
"</html>";
}
o We observe that from the design and analysis D.C motor and another component like as
microcontroller and speed sensor, switch are occupies less space and this space is easily available
into the mechanical frame of the motorcycle. o In future, it is applicable to all type of vehicle
whether it is costly or cheaper bike. o In future there is also some advanced modification is
possible to like on the basis of the sensor. In this project, we operated mechanism of lifting off the
stand with smart helmet in the very smooth way. o This project can be modify by using
speed sensor. The KMI 15/X and KMI 16/X are magneto resistive sensor modules with an
integrated signal conditioning electronics to provide a simple and cost effective solution for
rotational speed measurement. Due to their compact design-in and therefore time to market dis-
39
significantly reduced. The KMI sensor modules consist of the magneto resistive sensor element, a
permanent magnet fixed to his sensor and the integrated signal conditioning circuit designed in
bipolar technology.
40
REFERENCES
1. Vishal Srivastava, Tejaswi Gupta, Sourabh Kumar,VinayKumar, Javed Rafiq, Satish Kumar
Dwivedi, “Automatic Side Stand”, International Journal Of Engineering and Advanced
Technology (IJEAT), ISSN: 2249-8958, Volume- 3, Issue-4, April 2014
2. Pintoo Prajapati, Vipul kr. Srivastav, Rahul kr. Yadav, Ramapukar Gon, Pintu Singh, Mr.
Sandeep, "Sprocket Side Stand Retrieve System", ISSN: 2320-8163, Volume
3. Sanjeev N K,”Bike Side Stand Unfolded Ride Lock Link”,International Journal of
Engineering Science and Research”, ISSN: 2277-9655, Volume- 2, Issue-9, September-
2013.
41