Pages: [1] 2   Go Down
Author Topic: Using accelerometer to detect driving state(s)  (Read 4446 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody,

I am working on a project that makes use of an accelerometer to detect a car's driving state. For the start I will 'only' need to figure out if (when) there is a full braking taking place. Since this event will be used to trigger other functions the detection will have to be in realtime. So what I am looking for is a reliable and solid identification of the braking event. Here are some parameters I identified:

  • Accelerometer will be mounted to the car. So I can assume to have a constant axis (probably x)
  • Despite the constant axis there will be tilting of the car to some degree due to braking/accelerating or cornering. I am not sure how much impact this will, though. We are not talking about a race car
  • Full braking are said to produce 1 to 1.2 g's (or 9.81 to 11,77m/sec²). Airbags go off at more than 2 g's
  • I haven't figured out the minimum time for a full braking but I guess that everything longer than 2 or 3 tenth of a second should be sufficient.

So what I am actually looking for is an algorithm that is able to detect that sort of braking. Does anyone have a piece of advice on this?

Thanks in advance
« Last Edit: July 18, 2011, 08:29:42 am by knox » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26631
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you need to detect braking, why not start with the brake pedal?
Otherwise, how do you distinguish braking from, say driving up a steep hill?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi and thanks for noticing.

Making use of the brake pedal is not an option since the device should be as unobtrusive as possible. Yet, it must be very easy to install. I am planning on building a small box that
a) holds the Arduino board and the accelerometer and
b) connects to a 12 Volts power outlet to provide power for the board and allows for charging an Android handset.
There will probably be a simple push button glued to the dashboard (i.e. being reachable for the driver) to trigger a manual action.
Since we do not have many steep mountains in our tiny country we usually don't drive uphill with 1g  smiley-wink
But you might have a point here. That's why I am asking you guys. I don't have any experience in making sense of accelerometer data.
Logged

Torino, Italy
Offline Offline
Sr. Member
****
Karma: 2
Posts: 309
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Supposing you have a 3-axis accelerometer, I would point the accelerometer with the X axis to the front of the car and the Y axis to the left of the car so that the Z axis of the accelerometer is perfectly normal to the ground and car plane. This way, gravity (you know, an accelerometer is also subject to static accelerations, not only dynamic accelerations - for an explaination on this see my thesis) won't impact on anything but the Z axis.

Then, everything > that 1G acceleration on the X axis means a braking.

Just hope not to get 1G acceleration on the Y axis, as that would mean you have been hit by a car or something  smiley-eek-blue
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Supposing you have a 3-axis accelerometer, I would point the accelerometer with the X axis to the front of the car and the Y axis to the left of the car so that the Z axis of the accelerometer is perfectly normal to the ground and car plane. This way, gravity (you know, an accelerometer is also subject to static accelerations, not only dynamic accelerations - for an explaination on this see my thesis) won't impact on anything but the Z axis.
That's exactly what I am planning to do. It would result in x=0g; y=0g; z=1g for a not moving vehicle.
Now I'll start digging through your thesis

Quote
Then, everything > that 1G acceleration on the X axis means a braking.
Yes, but I am afraid that it will be a little more complicated. Assumably,
Code:
if(x>=1.0) triggerFullBraking(true);
won't be enough for a reliable and robust detection. I am thinking about how a hard braking would be printed as a graph. Wouldn't it take some tenths of a second to build up the full braking pressure, i.e. reaching the maximum deceleration? On the other hand, you could also detect if the car comes to a full stop if you were able to identify the "nodding" of the car's body.

Quote
Just hope not to get 1G acceleration on the Y axis, as that would mean you have been hit by a car or something  smiley-eek-blue
Or you have a pretty nice car that allows for some decent cornering speeds...
« Last Edit: July 21, 2011, 02:40:52 am by knox » Logged

Torino, Italy
Offline Offline
Sr. Member
****
Karma: 2
Posts: 309
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Keep us posted.
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your scenario isn't nearly as simple as it's being portrayed, and your end goal is going to dictate the best method of reading/detecting braking to accomplish that.

1.0-1.2g braking is likely max braking for most vehicles under ideal conditions.  Dirt roads, dirt on the road, rain, snow, will all have a significant impact on max braking forces.

Most normal driving will also never see anywhere near 1.0-1.2g of braking.  More likely to be around 0.5g for normal daily driving (maybe even less for some people).  So are you looking to detect any normal braking event, or are you looking to detect some sort of emergency stop situation (in which it is assumed that you are braking as hard as possible)  Are you going to be doing anything when this is detected that could be problematic if it's just a case of the person stopping really hard just for the fun of it?
Logged


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

According to simple law of physics, the static friction is only a small portion of gravity of an object, the factor is called static frictional coefficient. Unless you have some tank tracks or sticky surfaces (spider man), you will not have a static friction that exceeds gravity. So you will not have a deceleration greater than g.

Somebody has something to say about this coefficient for tire on dry road:

http://hyperphysics.phy-astr.gsu.edu/hbase/mechanics/frictire.html

As for the braking thing, I think you should ride with an accelerometer and record the entire process of a number of hard breaks, soft breaks and what not so you have data to look at. Without data, I could argue 0.5g is trigger and needs to be at 0.5g+ for 0.1 second and you say different and neither has proof this is what actually happens.
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26631
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So you will not have a deceleration greater than g.
Brick wall?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So you will not have a deceleration greater than g.
Brick wall?
OP was talking about braking. There is no collisions involved.
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26631
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I forgot the smiley after "brick wall"

Anyway, you never heard of "the other way of stopping"?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I forgot the smiley after "brick wall"

Anyway, you never heard of "the other way of stopping"?
  Heard now but never tried smiley-wink
The problem of driving where I live is the winter is too long with frequent snow. I should stop being cheap and my next car will have ABS. I wonder if someone is interested in making such a "traction lost" sensing arduino. I wonder if falconfour is interested. You would have to be able to read speedometer and tire rotation speed.
Logged


Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  Two options that I can think of.

 1)Put a pressure sensor on the brake master cylinder to detect brake pressure and send to Arduino. They make a simple on-off style switch or you could have a gauge pressure sensor if you wanted precision.

 2)If you still have your brake light switch that opens and closes by the movement of the brake pedal, you can send that signal through a voltage divider to the Arduino letting it know that you have applied the brakes.

 If the Arduino knows when the brakes are applied then, you will know when you have data that is related to braking.

Mark
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, quite a lot of answers. Somehow my email notifications got lost since I did not receive any after my last post. Sorry for taking so long to get back to you guys...

Your scenario isn't nearly as simple as it's being portrayed, and your end goal is going to dictate the best method of reading/detecting braking to accomplish that.
I never imagined it to be easy, that's why I turned to you folks

Quote
1.0-1.2g braking is likely max braking for most vehicles under ideal conditions.  Dirt roads, dirt on the road, rain, snow, will all have a significant impact on max braking forces.
Sorry I did not make that any clearer: I am talking about emergency brakings under normal (or best-case) conditions. Snow, dirt, rain, are not going to be considered in this very 1st prototype (or proof of concept).

Quote
Most normal driving will also never see anywhere near 1.0-1.2g of braking.  More likely to be around 0.5g for normal daily driving (maybe even less for some people).  So are you looking to detect any normal braking event, or are you looking to detect some sort of emergency stop situation (in which it is assumed that you are braking as hard as possible)  Are you going to be doing anything when this is detected that could be problematic if it's just a case of the person stopping really hard just for the fun of it?
As I just said above: I am interested in just those emergency stop situations. This projects aims at documenting why this particular situation required hitting the brakes so intensively. One part will be a front bumper mounted wide angle camera that takes a picture of what is going on in front of the car. To be able to capture the actual source of the situation lag should be as low as possible. Besides the camera thing we will also trigger an audio recording in the passenger compartment of the car. Moreover, drivers will be instructed to articulate the reason for their braking. Therefore, if a driver made an emergency braking just for the fun of it (who does that for fun?) all it would produce is a false positive recording. Not an issue for my scenario.



According to simple law of physics, the static friction is only a small portion of gravity of an object, the factor is called static frictional coefficient. Unless you have some tank tracks or sticky surfaces (spider man), you will not have a static friction that exceeds gravity. So you will not have a deceleration greater than g.
Somebody has something to say about this coefficient for tire on dry road:
http://hyperphysics.phy-astr.gsu.edu/hbase/mechanics/frictire.html
Now that is pretty interesting. I haven't worked through the article, yet. That's probably why I am going to make a fool out of myself now: my emergency braking is around 1g comes from a site which explains how airbags in cars work (I'd provide the link but unfortunately it is in german). However, I found a Wikipedia article about Formula 1 cars that are supposed to decelerate with up to 5.0 g. This is quite remarkable since the best street legal car, the Bugatti Veyron, is -and I quote- "claimed to be able to brake at 1.3 g" [SOURCE]
Another interesting section is to be found under Deceleration

Quote
As for the braking thing, I think you should ride with an accelerometer and record the entire process of a number of hard breaks, soft breaks and what not so you have data to look at. Without data, I could argue 0.5g is trigger and needs to be at 0.5g+ for 0.1 second and you say different and neither has proof this is what actually happens.
Generating braking samples myself is what I consider my very last option since this is going to cost me quite some money (gas, tyres, brake pads and discs, depreciation, etc.).



Two options that I can think of.
 1)Put a pressure sensor on the brake master cylinder to detect brake pressure and send to Arduino. They make a simple on-off style switch or you could have a gauge pressure sensor if you wanted precision.
Sorry, not a solution for me. This thing is going to be inserted into actual customer cars and should as easy to install as possible

Quote
2)If you still have your brake light switch that opens and closes by the movement of the brake pedal, you can send that signal through a voltage divider to the Arduino letting it know that you have applied the brakes.

 If the Arduino knows when the brakes are applied then, you will know when you have data that is related to braking.
Not really. This would allow me to detect that there is some braking while not being able to determine its severity.



Thanks for all your feedback.
« Last Edit: July 26, 2011, 08:48:00 am by knox » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your wiki source sounds right. The high g like 4.5 to 5g is a combined result of vehicle weight and a downward force generated by air pushing the car down on the spoiler and other part, and a suck from fast air flowing under the car. In this case the track has to support the car with a force several times more than the car's weight, only at very high speed. In this case friction can exceed gravity. That is if you shell several hundred thousand Euros to get a car that does that. On a mass market for rest of us, we go for a car around tens of thousand Euros so the end result is close to what I referenced, maybe up to 0.7g. If you buy a 100,000 sports car and drive it fast (highway speed limit may to too slow unless you're on some of the roads with no limits in Germany), you could get beyond 1g braking. The simple answer, typical car + highway speed = 0.7g deceleration per some actual testing.
Logged


Pages: [1] 2   Go Up
Jump to: