Pages: [1] 2   Go Down
 Author Topic: Using accelerometer to detect driving state(s)  (Read 3407 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 9
 « on: July 18, 2011, 08:08:24 am » Bigger Smaller 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?

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

Global Moderator
UK
Offline
Brattain Member
Karma: 238
Posts: 24353
I don't think you connected the grounds, Dave.
 « Reply #1 on: July 18, 2011, 08:29:51 am » Bigger Smaller 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
Newbie
Karma: 0
Posts: 9
 « Reply #2 on: July 18, 2011, 08:38:20 am » Bigger Smaller 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
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
Sr. Member
Karma: 2
Posts: 312
Arduino rocks
 « Reply #3 on: July 20, 2011, 04:11:03 pm » Bigger Smaller 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
 Logged

Offline
Newbie
Karma: 0
Posts: 9
 « Reply #4 on: July 21, 2011, 02:37:27 am » Bigger Smaller 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
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
Sr. Member
Karma: 2
Posts: 312
Arduino rocks
 « Reply #5 on: July 21, 2011, 04:47:45 am » Bigger Smaller Reset

Keep us posted.
 Logged

New Hampshire
Offline
God Member
Karma: 13
Posts: 779
There are 10 kinds of people, those who know binary, and those who don't.
 « Reply #6 on: July 21, 2011, 01:22:12 pm » Bigger Smaller 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
Online
Tesla Member
Karma: 64
Posts: 6896
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #7 on: July 21, 2011, 03:15:00 pm » Bigger Smaller 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.

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
Brattain Member
Karma: 238
Posts: 24353
I don't think you connected the grounds, Dave.
 « Reply #8 on: July 22, 2011, 01:31:31 am » Bigger Smaller 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
Online
Tesla Member
Karma: 64
Posts: 6896
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #9 on: July 22, 2011, 11:20:35 am » Bigger Smaller 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
Brattain Member
Karma: 238
Posts: 24353
I don't think you connected the grounds, Dave.
 « Reply #10 on: July 22, 2011, 11:32:13 am » Bigger Smaller 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
Online
Tesla Member
Karma: 64
Posts: 6896
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #11 on: July 22, 2011, 12:04:15 pm » Bigger Smaller Reset

Sorry, I forgot the smiley after "brick wall"

Anyway, you never heard of "the other way of stopping"?
Heard now but never tried
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
Edison Member
Karma: 11
Posts: 1309
Warning Novice on board! 0 to 1 chance of errors!
 « Reply #12 on: July 22, 2011, 02:45:20 pm » Bigger Smaller 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
Newbie
Karma: 0
Posts: 9
 « Reply #13 on: July 26, 2011, 08:21:52 am » Bigger Smaller 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.
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.

 « Last Edit: July 26, 2011, 08:48:00 am by knox » Logged

Central MN, USA
Online
Tesla Member
Karma: 64
Posts: 6896
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #14 on: July 26, 2011, 11:06:50 am » Bigger Smaller 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