Using accelerometer to detect driving state(s)

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

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?

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 :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.

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 :fearful:

[quote author=Fabio Varesano link=topic=66882.msg493038#msg493038 date=1311196263]
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.[/quote]
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

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, 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.

Just hope not to get 1G acceleration on the Y axis, as that would mean you have been hit by a car or something :fearful:

Or you have a pretty nice car that allows for some decent cornering speeds...

Keep us posted.

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?

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.

So you will not have a deceleration greater than g.

Brick wall?

AWOL:

So you will not have a deceleration greater than g.

Brick wall?

OP was talking about braking. There is no collisions involved.

Sorry, I forgot the smiley after "brick wall"

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

AWOL:
Sorry, I forgot the smiley after "brick wall"

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

Heard now but never tried :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.

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

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...

jraskell:
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

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).

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.

liudr:
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:
Friction and Automobile Tires

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

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.).

cyclegadget:
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

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.

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.

Thanks for guiding me through this. :slight_smile:
I agree that 1g might be a theoretical value. The actual value will need some empirical foundation, I am afraid. However, I am still thinking about a way to detect an emergency braking (what's the correct expression for that?) state. One thing that came to my mind is if I will see some increasing g (or m/sec2) values due to reduced speed during ongoing braking. The stopping distance increases quadratically in relation to speed (sorry for phrasing it this way, never tried to articulate something in a foreign language). Maybe a very basic quadratic function can help me to express myself: s = (v/10)2. What are your thoughts on this?

I suppose I can neglect aerodynamical downforce since most road cars will rather produce upforce.

That might work. You monitor the time the vehicle is in a deceleration greater than a threshold to tell if a full brake was made.