Final Report Raftaar ASME eHPVC 2023
Final Report Raftaar ASME eHPVC 2023
Vehicle Description
University name: Delhi Technological University
Vehicle name: ERAWAT
Vehicle number:
Vehicle configuration:
Upright Semi-recumbent Yes
Prone Other (specify)
Frame material: Carbon Fibre and Titanium
Fairing material(s): Carbon Fibre and Honeycomb Matrix
Number of wheels: 2
Vehicle Dimensions (m)
Length: 2.894 m
Width: 0.840 m
Height: 1.193 m
Wheelbase: 1.432 m
Weight Distribution (kg)
Front: 45%
Rear: 55%
Total Weight (kg): 28 kg
Wheel Size (m)
Front: 0.410 m
Rear: 0.673 m
2
Frontal area (m ): 0.4736 m2
Steering (Front or Rear): Front
Braking (Front, Rear, or Both): Both
Estimated Coefficient of Drag: 0.06
Introducing
ERAWAT
Team Advisor
Dr. Raghvendra Gautam
Department of Mechanical Engineering
[email protected]
Team Members
The concept of Human Powered Vehicles (HPVs) has been around for centuries. From the
earliest bicycles to modern-day velomobiles, HPVs have evolved into a viable mode of
transportation that can offer numerous benefits over traditional automobiles. In recent years,
there has been an increased interest in HPVs, driven by concerns over environmental
sustainability and the need to find alternative forms of transportation that are both eco-
friendly and affordable. This report provides an overview of Team Raftaar’s 10th Vehicle
ERAWAT, as the team strives to raise the bar in the domain of human-powered vehicles.
Building upon the strong foundation, Team Raftaar, DTU designed, tested and fabricated
ERAWAT, a fully-faired lightweight, and efficient e-HPV to compete in ASME EFX India’s
Human Powered Vehicle Competition (e-HPVC) 2023.
ERAWAT was primarily designed using SOLIDWORKS 2021. ANSYS 22 was used for structural
analysis and aerodynamic analysis of the vehicle to ensure that all safety standards set by
ASME are met. MSC ADAMS was used for Suspension Analysis and MATLAB Simulink was used
for Electrical Analysis of the vehicle. Adequate physical testing was also performed at the
necessary stages for the RPS Testing. 3 Point Bend test was done for Frame Selection and Die
Penetration Test for Weld Quality check. Wind Tunnel testing of a scaled model was done to
verify the simulated results for drag.
The team decided to use Carbon Fibre and Titanium as the frame material. The Back wheel
hybrid drivetrain was designed, keeping in mind efficiency and space constraints. The vehicle
is engineered with an adjustable seat mechanism that permits the rider with different heights
to optimize his position accordingly. The fairing for Falcon was fabricated with Carbon Fibre
and Honeycomb matrix, acknowledging the adequate number of layers of both through 12-
piece moulds. Seat belt, carbon fibre reinforced polymer roll-bar, rider alert system,
emergency power off switch and all other safety equipment, as specified by ASME, are also
incorporated.
With a host of innovative and robust features to make rider’s experience safer and more
enjoyable, ERAWAT aims to better the preceding heights achieved by Team Raftaar and
continues to pursue the idea of incorporating HPVs in everyday life with the motto, “Ride with
purpose, ride with power”.
Table of Contents
1.1 Objective
The e-HPV Team of Delhi Technological University, Team Raftaar designed and fabricated
ERAWAT during the 2022-23 academic year, guided by the team's mission statements:
“Goal: To create a revolutionary electric-Human Powered Vehicle that defies convention,
blending cutting-edge technology with exquisite aesthetics.
Vision: To offer our team a stimulating and intellectually demanding project that pushes them
to expand their existing knowledge and capabilities.
Mission: To challenge the status quo and set a new standard in human-powered
transportation.”
1.2 Background Research
Extensive research was conducted by our team, incorporating various research articles, social
media content, and past reports from ASME-HPVC participants, to gain a comprehensive
understanding of the different types of bicycles and trikes. These efforts have enabled us to
identify areas of improvement and potential mistakes in the design of our recumbent cycle.
To further enhance our knowledge of vehicle design, suspension, and steering systems, the
team members also referred to esteemed publications such as "Race Car Vehicle Dynamics"
by F. Milliken & L. Milliken. Moreover, we explored a variety of blogs, research papers and
articles to optimize the rider's comfort, drivetrain efficiency, and to develop an extensive
electrical system that aligns with our vision for ERAWAT.
1.3 Prior Work
During the previous years, Team Raftaar had conceptualized and constructed several human-
powered recumbent cycles such as Aptera, Falcon, Eurus, Kaze, Mach-4, Pegasus, and many
others, to participate in HPVC. For the academic year 2022-23, our team's latest creation,
ERAWAT, draws inspiration from the best features and mechanisms of our past vehicles.
Some of them are:
a) The ground clearance has been increased, and the seat design has been enhanced to
optimize the rider's comfort.
b) To ensure that the vehicle is lightweight and easy to drive, carbon fiber has been utilized
for the fairing, and carbon fiber rods have been incorporated into the frame.
c) To maintain consistency and improve efficiency, the team employed the same software for
simulation and design, including SolidWorks and Ansys.
d) The design of the fairing was inspired by Falcon 2020 and Aptera 2021, resulting in a sleek
and aerodynamic aesthetic that maximizes the vehicle's performance.
1.4 Organizational Timeline
The necessary tasks were stated and planned to maintain a smooth workflow. The Gantt Chart
was updated on a regular level to reflect the current and future status and also helped us in
improving productivity and making necessary changes to the speed of production.
(P1: Prototype 1) (P2: Prototype 2)
PERFORMACE 1) Demonstrate stability at 5 km/hr for 30m 1) Total Weight less than 30kg 2) Top Speed of
(fast paced walking speed). 100 kmph (0-60kmph in less than 16 sec)
2) Brake from 25 to 0 km/hr in 6 m 3) Easy rider Ingress/Egress
3) Turn within an 8 m radius (26.2 ft) 4) Minimize the overall drag experienced by the
fairing
4) Clear a speed bump with maximum
height up to 5 cm 5) Create a more efficient drivetrain for
achieving higher top speed.
6) Install adjustable seat mechanism to optimize
the rider performance.
7) Have a range of more than 35km.
SAFETY 1)Have a Roll-over Protection System (RPS) 1) The RPS at all points has a reasonable FOS > 3
that will at all points and the von – misses stress is below
the maximum tensile strength.
• Produce less than 5.1 cm of total
deformation of application of 2) The safety attachment points stay intact in the
2670 N of top load (At an angle 12 event of emergency stop, and emergency cut off
degree away from the front) is easily accessible
• Produce less than 3.8 cm of total 3) The steering system remains intact in the
deformation of application of event of a crash (Doesn’t detach and hurt the
1330 N side load. rider)
• No body contact and adequate 4) The horn, brake lever and screen are easily
abrasion resistance in the event of accessible.
a fall and slide respectively.
5) No exposed wires and all batteries are located
2) Include safety harness that holds rider to away from the rider.
vehicle during a crash
6) Use commercially available seat harness
3) Include Head/Tail light, bell or horn,
front/rear/side reflectors.
4) Field of View of at least 180 Degree.
5) Free from sharp edges, open tubes,
protruding screws or any other potential
hazards.
6) Have a fire protective covering around
battery and BMS.
RIDER 1)Log a minimum of 30 minutes of vehicle 1) Daily cycling sessions of 30 min each either on
riding experience before the event. trainer or actual cycle to build stamina and
endurance.
2) The rider must wear appropriate
clothing and properly fitting helmets with 2) Buying all protective equipment’s from
fastened straps that CPSC Safety Standard authorized stores and products with security
for Bicycle Helmet (16 CFR Part 1203) marks.
The first significant decision to be made was the vehicle configuration. For the same, the team
considered various possibilities for vehicle geometry. The most likely possibilities were
enlisted and rated according to the criteria discussed in Table 2.
Upright
Weightage Fully faired Partially Tadpole
Metric Trike Partially
(%) recumbent Faired (Recumbent)
Faired
Frame weight 15 3 4 3 5 2
Aerodynamics 17 5 4 3 1 3
Rider Comfort 15 4 4 4 3 4
Speed 15 5 4 3 2 2
Manoeuvrability 11 3 4 4 5 4
Prior Knowledge 13 5 4 3 5 2
Drivetrain Efficiency 14 4 3 3 5 3
Total 100 4.19 3.71 3.26 3.57 2.95
Table 3: Vehicle Consideration Analysis
Finally based on all the above metrics a Fully Faired Recumbent configuration was selected.
Ease of manufacturing 20 5 4 4 2 4
Cost of manufacturing 15 4 3 4 3 4
Availability of material 10 5 4 4 4 4
Weight 15 2 3 3 5 5
Total 100 2.8 3.3 3.85 4.4 4.55
Table 4: Decision Matrix for Frame Selection
As shown above, based on the results of the decision matrix a combination of titanium and
carbon fibre was selected as the frame material, using titanium at the joints and carbon fibre
for connections. The metric value of carbon fibre and the combination of carbon fibre and
titanium are close but due to the cost and ease of manufacturing in the combination, the
combination of the materials was chosen.
1. Back Wheel Front Wheel No, if the motor was switched at a different speed than the
rear wheel, at a turning point on track, the wheel would slip
and immediately lose traction. This could prove dangerous
for the rider's safety.
2. Front Wheel Front Wheel No, weight distribution of the components will be unequal.
Most of the weight will be focused on the front wheel which
will make it difficult to the steer the vehicle
3. Front Wheel Back Wheel Yes, we tried this model on the Prototype 2 of ERAWAT and
encountered issues which are mentioned below.
4. Back Wheel Back Wheel Yes, this model was selected as the most appropriate for the
safety of rider and efficiency.
Table 5: Various Possible Drivetrain Systems
Figure 3: Prototype 2
Prototype had a FWD system powered by Pedal and a RWD powered by an Electric motor.
The front wheel drive system was designed to provide the necessary power to propel the
bicycle forward while the rear wheel electric motor was intended to provide additional power
and assist the rider when needed. However, during testing, we encountered two major issues
with this system.
1) Front and rear wheels had different speeds, resulting in an unbalanced and jerky ride
experience.
2) Chain path in the FWD system limited the turn radius of the front wheel, making it difficult
to manoeuvre in tight spaces.
1.7.1. Frame
Based on the results of the decision matrix a combination of Titanium and Carbon fibre was
selected as the frame material.
Design of frame:
ERAWAT is a fully faired recumbent bicycle manufactured using Carbon Fibre and ASTM B265
Titanium Grade 2. A short wheelbase of length 1.474m was chosen to ensure good
maneuverability and a good turning radius. The ground clearance is kept as 0.19m, optimized
to have good stability and avoid breakers.
Manufacturing of frame
The manufacturing of frame involved three steps:
STEP 1: Welding of Titanium Joints.
STEP 2: Joining Carbon Fibre Rods (ID 38mm) by sliding in Titanium Joints (OD 38mm) and
using Araldite as adhesive.
STEP 3: Covering the joint with 2 Layers of Carbon Fibre Cloth (2 GSM) with Epoxy as
adhesive.
Figure 4: Various steps in the process of Frame Manufacturing
1.7.2 Fairing
The fairing of the Vehicle was made from Carbon Fiber using vacuum bagging and
conventional hand layup techniques. High emphasis was placed on the aerodynamic stability
of the Vehicle. The final fairing design was achieved after 8 iterations.
The designing process involved using a Java Applet named JAVAFOIL, on which NPL ECH and
NACA 6 series were considered for the sections of the vehicle. The ECH 2560 met the needs
of the team dimensionally for the top section of the fairing. These sections were further
modified to achieve close to the ideal fairing design as per various articles and reports that
were studied during background research.
Rib placement was given a special emphasis to form a structural member throughout the
vehicle. Ribs made of Honeycomb matrix were strategically placed along the regions which
must be cut, e.g., the front wheel and windshield cutouts, and along the RPS, where the rider’s
movement is not obstructed, and where the rider is to be seated.
The fairing's removable top hatch is mainly for the ingress/egress of the rider. Even after the
removal of the top hatch, the rider is protected by the fairing RPS in the event of a crash.
12-Piece Mold
The Team decided to change the 10-piece mould we use to a 12-piece mould. Better surface
smoothness was one of the major benefits of smaller mould sizes that outweighed its other
drawbacks. Moreover, a smaller mould size permits the infusion meshing procedure to
produce superior results.
The team fabricated a fully-faired carbon fiber fairing using six female molds on the upper
half and six female molds on the lower half fabricated of Glass Fiber (1 layer Chopped
sandwiched between 2 layers of Woven) and Gel Coat Epoxy (for smoother surface) inside
which carbon fiber was laid up. The team considered the method of infusion meshing rather
than the usual hand layup because of its several advantages of it, including better quality,
good interior finish, faster cycle time, and lower cost. The justification of the twelve-piece
mold is supported by the fact that the larger molds may not get the epoxy binder distributed
equivalently using the infusion meshing technique. The above choice was made after the
layup testing was done, using infusion meshing on the test piece. CBF (car body filler) was
used at places with severe depressions, and the molds were sanded with different grit sizes
of sandpaper ranging from 120 to 1500 to get the perfect surface finish to the molds for
Carbon Fiber Layup.
Figure 6: Shell Pattern for ERAWAT
1.7.3. Drivetrain
ERAWAT features a RWD system with a Hub Motor, replacing the BLDC motor mounted on
the cycle frame in our previous prototype. This change in design allowed for a more efficient
and streamlined system, with the motor and wheel working together seamlessly to provide a
smooth ride experience. As the rear wheel is the driven wheel, it can be powered by the pedal
and electric motor in a more synchronized manner, eliminating the speed difference issue
that was present with the front-wheel drive system. This also increased the turning radius of
the vehicle in turn increasing its manoeuvrability.
1.8 Innovation
ERAWAT has been equipped with a host of innovative features which the team
conceptualized and designed throughout the development phase. The Accident Alert System
employed in the vehicle is a low-cost solution to the problem of road accidents. The system
is designed to detect accidents and send alerts to emergency services and relatives/friends of
the victim(s) through SMS messages. The Auto Cut-off System is also incorporated in case of
a crash.
1.8.1 Accident Alert System (SOS)
The aim of this project is to design an Accident Alert System using Arduino MPU6050, GPS
and GSM module. The purpose of the system is to detect accidents and send alerts to
emergency services and relatives/friends of the victim(s) through SMS messages.
The system is easy to install and can be used in all types of vehicles. The system can save lives
and reduce the number of fatalities caused by road accidents.
2. Analysis
2.1 RPS Analysis
Objective Method Results
The analysis of the Roll-over This was undertaken in ANSYS The RPS meets the required
Protection System was aimed 2022 Composite Pre-Post and specifications with a top and
at the verification of design and subsequent FEA was side load deflection of 1.9166
ensuring rider safety in performed with the specific cm and 1.0271 cm respectively.
accordance with the ASME loading conditions as
HPVC guidelines. mentioned in the guidelines.
RPS Description and Attachment
Considering the safety of the rider to be of utmost priority, ERAWAT incorporates a
strategically designed roll bar to prevent the rider from direct contact with the road surface
and to reduce the impact of any accidental collision.
Finite Element Analysis (FEA) in ANSYS 2022 Composite Pre-Post (ACP) was used for roll bar
design in ERAWAT. The finite element model was developed using shell elements in the ACP
system. Due to the rollover protection system (RPS) being also supported by the fairing, the
analysis of the RPS was performed on ERAWAT’s fairing.
Structural Analysis on the frame using ANSYS 2022 were carried out measuring the ability of
the frame to withstand various stress scenarios which the vehicle may undergo during its
normal operation. All the forces are assumed to be below the elastic limit of the material.
(Hooke’s Law in 3D). The material of frame considered for the analysis was Titanium Grade
E2 ASTM B265.
2.2.1 Bottom Bracket Analysis
Various stresses considered on the bottom bracket include scenarios where the chain
experiences large tension force, where there is sudden obstruction leading to considerable
friction during the rotation of the pedals, etc. These situations were modeled on Carbon fiber
with titanium at joints. An automated mesh has been developed with an average orthogonal
quality of 0.856. A Remote force of 650 N was applied along the Z axis at the (0,0,150) mm
from the reference coordinate on the center of bottom bracket is shown below. The
maximum (Von-Mises) stress is 153.47 MPa was observed in the upper section of the Bottom
Bracket Coupler showing that there is a factor of safety (FOS) greater than 2.
Using CFD, the front wind analysis of the draft fairing was done in Ansys Fluent and it yielded
a drag coefficient of 0.114 (First Iteration) when the maximum speed was assumed to be 20
m/s (72 kmph). An Ansys recommended guide towards domain sizing was followed.
For CFD, high emphasis was given on the mesh, every mesh metric was checked so that any
inaccuracy can be avoided so that the entire process shouldn’t be revisited again. RANS based
K-Omega Turbulence Model in Steady State, with all y+ wall treatment was chosen as it is not
very much memory-intensive and yields good convergence even with complex geometries.
The model also proved to be stable under high under relaxation factors which also helped us
in observing faster convergence without losses in accuracy.
In the final iteration, the drag coefficient came out to be 0.06 which was much lower than the
1st Iteration.
Our Simulink model allows us to determine crucial parameters such as the range of the
vehicle, the driving power required to be extracted from the motor, as well as the vehicle's
velocity and RPM. These values are obtained through the use of variable input torque, the
mass of the vehicle (including the driver), the coefficient of drag, the frontal area of the faring,
and the coefficient of rolling resistance.
Functioning of Simulink Model
a) First, we calculate the net force required to propel the vehicle by subtracting the
aerodynamic drag and rolling resistance from the input rotating force (Torque *
Radius of the wheel).
b) Using the net force, we determine the velocity of the vehicle and connect this
velocity as an input to extract the aerodynamic drag, creating a closed loop system.
c) Next, we multiply the input force and velocity to determine the driving power
required by the motor. We operate this driving power with an auxiliary load and
derive the final power required by multiplying it with the optimum efficiency. In
our model, the auxiliary load is zero and efficiency is 1.
d) Finally, we operate the final required power with the product of battery capacity
and velocity to determine the range of the vehicle.
e) We also analyze various graphs and parameters to evaluate the performance of
the vehicle.
By following these steps, we are able to accurately determine the power and range of the
vehicle in a comprehensive manner.
(𝐵𝑎𝑡𝑡𝑒𝑟𝑦 𝐶𝑎𝑝𝑎𝑐𝑖𝑡𝑦 ×𝑉𝑒𝑙𝑜𝑐𝑖𝑡𝑦)
𝑅𝑎𝑛𝑔𝑒 = (𝐷𝑟𝑖𝑣𝑖𝑛𝑔 𝑃𝑜𝑤𝑒𝑟+𝐴𝑢𝑥 𝐿𝑜𝑎𝑑)× Driving Power=Input Force ×Velocity
To determine The Team kept track of all their incurring expenses The cost of manufacturing of
the cost of using a Money Management Software called Buxfer. vehicles (excluding student
manufacturing labour) is INR 4,99,300.
All the incurring expenses in the development of the vehicle were segregated and tabulated
as shown.
To optimize the placement of suspension for maximum shock absorption research and
analysis was conducted on our previous vehicle’s frame. Refer Appendix D for this work.
3. Testing
3.1 Frame Developmental Testing
3.1.1 Dye penetration test
This test was performed to check welding surface defects such as cracks and porosity which
may be regions of stress concentration and may lead to failure in the long run. (as observed
in Prototype 2)
Method:
Result for Titanium GR2 ASTM B265: The welding/ surface defects in titanium are much less
than that (almost negligible)
Result: The RPS meets the required specifications of top and side load deflections
3.2 Wind Tunnel Testing
This was done to verify the simulated results of drag coefficient of ERAWAT, using a scaled 3D
printed model of the vehicle.
Result: The final results of a wind tunnel experiment gave drag coefficient of 0.09 which is
close to our simulation results.
4. Conclusion
4.1 COMPARISON – DESIGN GOALS
4.2 EVALUATION
PDS criteria set by the team was regularly modified to make essential design decisions and
practical approach was followed. Most of the metrics evaluated meet or exceed the target
values. The vehicle easily meets all the constraints set forth by ASME Rule book. Each of
the manufacturing stage was accompanied by series of exhaustive testing. ERAWAT meets
the team's goal of being a fast, efficient and safer e-HPV.
4.3 RECOMMENDATION
Alternates for windshield should be developed. Timelines should be formed to provide
ample time for rider testing and taking into consideration failure of Prototypes. Extensive
available text resources should be taken into consideration to make best possible design
changes. Funding for the vehicle should be taken care well in advance.
4.4 CONCLUSION
Team Raftaar brings a solution to the problem of sustainable transportation in form of its
e-HPV. Now with extra added electric power, the fully faired vehicle is not only fast, but
also smoother due to extra added suspension system. The team takes pride in extensive
testing done behind to make this a commercially viable alternative to existing vehicle out
there.
REFERENCES
Results:-
Double Disc Brake:
Stopping Time : 1.88 sec
Stopping Distance: 4.42 meters
Single Disc Brake:
Stopping Time : 2.14 sec
Stopping Distance: 4.84 meters
Drum Brake:
Stopping Time : 2.44 sec
Stopping Distance: 5.56 meters
Discussion:-
The results clearly show that the double disc brake system provides the shortest
stopping time and stopping distance, while the drum brake system has the longest.
The single disc brake system is in between the other two. This is because the double
disc brake system provides more braking force, which is distributed evenly between
the two discs, while the drum brake system provides less braking force, which is
distributed unevenly around the circumference of the drum.
Conclusion:-
In conclusion, the choice of braking system can have a significant impact on the
stopping time and stopping distance of vehicle. The double disc brake system
provides the best performance, while the drum brake system provides the worst.
The single disc brake system is a good compromise between the two. Therefore, in
our vehicle we choose the double disc braking system based on their performance
requirements and safety standards.
Appendix B – Force, Static, thermal analysis of Braking system
Our objective was to make a type of braking system ,which will store the energy which is
dispersed or lost while braking, that is regenerative braking.
This year the braking system is different from the previous one’s. The previous teams used V-
brakes on the front wheel. This year, disc brakes are used on both the wheels. Unlike v-brakes,
the disc brakes provide greater control for braking. Disc brakes are also used as the braking
system because they are able to make quick stops during the braking. The disc brakes are
located at the axle of the wheel, which will allow the vehicle to stop quickly. In addition, the
v- brakes were located very close to the edge of the tire where dirt can accumulate and it was
harder for the friction pads to grip the rim. However, the disc brakes are centered at the
wheels and if the vehicle rolls over dirt, the disc brakes and friction pads will not be much
affected.
For Regenerative Braking, Regenerative supporting Motorcontrollers along with connecting
wires are used. During Braking, when brakes are applied microcontrollers disconnect the
battery from motor, and make the motor as generator , momentum of the wheels provide
energy to the motor thereby storing energy to battery.
Force Analysis
The rotor model heat flux is calculated for the vehicle moving with a velocity 5.5 m/s (20
kmph) and the following is the calculation.
In this log book, all the problems which were found in the vehicle while testing them has
been recorded along with the day of inspection and time when it was inspected.
Once these issues were fixed, they were entered into the different section of the same
log book along with the name of the individual who inspected and fixed it.
Appendix D: Placement of Suspension
Research:
Before making the actual vehicle, we analysed the behaviour of our previous model Falcon
under loading to determine the points having high stresses. We applied extreme loads on
the structure.
• Load applied: 2692.6 N
Conclusion of research:
From this, we discovered that seat stay is having the highest stresses and thus we decided
to mount our back suspension on the seat stay. Since we have to place suspension on seat
stay, we tried 3 possible positions of suspension on seat stay
• Load applied: 2692.6 N
Result:
Deformation comes out to be 1.09cm which is well within the constraint.
Front Suspension Analysis:
We have performed load analysis on front suspension in Ansys.
Constraints:
Angle with the vertical = 18 degree,Force is applied at the top.
Parameters: Load = 2500 N Material = Carbon Fibre
Objective
To determine the characteristic curve of a head-on collision of body for the purpose of
studying the effectivity of accident-detection module (both algorithmic as well as
hardware ) using Explicit Dynamics in ANSYS
Introduction
Method
A Head-on Collision Crash Test was simulated using Explicit Dynamics on Ansys Software
Suite. The results of these simulations gave us an insight into the working of the algorithm
of the Accident-Detection Module and also it makes it possible to select appropriate process
constants for the module.
It was assumed early in the process that it was not possible to simulate the entire frame and
fairing due to the complexity of the problem and the enormous computational resource
required to achieve this.
Thus, the following favorable properties for the alternate geometry was proposed:
Conclusion
• We observe that a sampling delay of 2ms is sufficient for successful detection even if
it gets saturated in the beginning.
• A critical value for jerk was decided to be 50m/s³
• The Algorithm which depends on cut-off above a critical jerk value would work
without issues.
Future direction
acc_x0 = 0
acc_x1 = 0
acc_y0 = 0
acc_y1 = 0
acc_z0 = 0
acc_z1 = 0
sense = 50
def cast_list(list):
while True:
if ser1.in_waiting:
packet = ser1.readline()
acc_list = cast_list(line)
acc_x0 = acc_x1
acc_y0 = acc_y1
acc_z0 = acc_z1
usleep(10)
acc_x1 = acc_list[0]
acc_y1 = acc_list[1]
acc_z1 = acc_list[2]
print("%d" %(jerk))
Appendix F - Accident alert System SOS and Auto cutoff system code
1. Accident alert system sos
//team Raftaar asme innovation project 2023
#include<LiquidCrystal_I2C.h>
#include <AltSoftSerial.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <math.h>
#include<Wire.h>
char i2cadd = 0x27
LiquidCrystal_I2C lcd( i2cadd, 16, 2);
#define BUZZER 12
#define BUTTON 11
#define xPin A1
#define yPin A2
#define zPin A3
byte updateflag;
setup() function : )
void setup()
{
pinMode(BUZZER, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
sms_status = "";
sender_number="";
received_date="";
msg="";
time1 = micros();
//Serial.print("time1 = "); Serial.println(time1);
//read calibrated values. otherwise false impact will trigger
//when you reset your Arduino. (By pressing reset button)
xaxis = analogRead(xPin);
yaxis = analogRead(yPin);
zaxis = analogRead(zPin);
}
* loop() function
void loop()
{
if(updateflag > 0)
{
updateflag=0;
Serial.println("Impact detected!!");
Serial.print("Magnitude:"); Serial.println(magnitude);
getGps();
digitalWrite(BUZZER, HIGH);
impact_detected = true;
impact_time = millis();
lcd.clear();
lcd.setCursor(0,0); //col=0 row=0
lcd.print("Crash Detected");
lcd.setCursor(0,1); //col=0 row=1
lcd.print("Magnitude:"+String(magnitude));
}
if(impact_detected == true)
{
if(millis() - impact_time >= alert_delay) {
digitalWrite(BUZZER, LOW);
makeCall();
delay(1000);
sendAlert();
impact_detected = false;
impact_time = 0;
}
}
if(digitalRead(BUTTON) == LOW){
delay(200);
digitalWrite(BUZZER, LOW);
impact_detected = false;
impact_time = 0;
}
while(sim800.available()){
parseData(sim800.readString());
}
while(Serial.available()) {
sim800.println(Serial.readString());
}
* Impact() function
void Impact()
{
xaxis = analogRead(xPin);
yaxis = analogRead(yPin);
zaxis = analogRead(zPin);
//loop counter prevents false triggering. Vibration resets if there is an impact. Don't detect
new changes until that "time" has passed.
vibration--;
//Serial.print("Vibration = "); Serial.println(vibration);
if(vibration < 0) vibration = 0;
//Serial.println("Vibration Reset!");
else
{
//if (magnitude > 15)
//Serial.println(magnitude);
//reset magnitude of impact to 0
magnitude=0;
}
parseData() function
void parseData(String buff){
Serial.println(buff);
if(buff != "OK"){
index = buff.indexOf(":");
String cmd = buff.substring(0, index);
cmd.trim();
buff.remove(0, index+2);
//Serial.println(buff);
if(cmd == "+CMTI"){
//get newly arrived memory location and store it in temp
//temp = 4
index = buff.indexOf(",");
String temp = buff.substring(index+1, buff.length());
temp = "AT+CMGR=" + temp + "\r";
//AT+CMGR=4 i.e. get message stored at memory location 4
sim800.println(temp);
}
sendSms(sms_data);
}
}
}
}
else{
//The result of AT Command is "OK"
}
}
getGps() Function
void getGps()
{
// Can take up to 60 seconds
boolean newData = false;
for (unsigned long start = millis(); millis() - start < 2000;){
while (neogps.available()){
if (gps.encode(neogps.read())){
newData = true;
break;
}
}
}
void sendAlert()
{
String sms_data;
sms_data = "Accident Alert!!\r";
sms_data += "http://maps.google.com/maps?q=loc:";
sms_data += latitude + "," + longitude;
sendSms(sms_data);
}
makeCall() function
void makeCall()
{
Serial.println("calling....");
sim800.println("ATD"+EMERGENCY_PHONE+";");
delay(20000); //delay 2 sec
sim800.println("ATH");
delay(1000); //delay 1 sec
}
sendSms() function
uint8_t x=0;
boolean answer=0;
String response;
unsigned long previous;
sim800.println(at_command);
x = 0;
previous = millis();
void setup() {
Serial.begin(9600);
Wire.begin();
mpu.initialize();
pinMode(relay_pin, OUTPUT);
}
void loop() {
mpu.getMotion6(&accelerometer_x, &accelerometer_y, &accelerometer_z,
&gyroscope_x, &gyroscope_y, &gyroscope_z);
angle_x = atan2(accelerometer_y, accelerometer_z) * 180 / M_PI;
angle_y = atan2(-accelerometer_x, sqrt(accelerometer_y * accelerometer_y +
accelerometer_z * accelerometer_z)) * 180 / M_PI;
roll = 0.98 * (roll + gyroscope_x * 0.001) + 0.02 * angle_x;
pitch = 0.98 * (pitch + gyroscope_y * 0.001) + 0.02 * angle_y;
if (pitch > tilt_threshold || pitch < -tilt_threshold || roll > tilt_threshold || roll < -
tilt_threshold) {
digitalWrite(relay_pin, HIGH);
Serial.println("Tilt angle exceeded threshold. Engine cut off.");
}
else {
digitalWrite(relay_pin, LOW);
}
delay(100);
}