0

How big of a file should I expect?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How big of a file should I expect?

by magician13134 on Tue May 13, 2008 7:02 pm

Ok, I want to make a speedometer for my car using the Arduino and an accelerometer... It'll basically just get acceleration and then use a physics formula (can't recall it now >.<) to determine speed (since I know time between last reading, initial velocity and acceleration, is it Vf = Vi + a*t?) And I want to store 1 value every second, the value will be in a two dimensional array like this:
values[#][0] = velocity (int)
values[#][1] = acceleration (int)
values[#][2] = number (int) (this is the number of readings taken since the device got power, since after a certain number, it will overwrite the array, then I can just order it by this dimension instead of bumping the array down with each new reading)

So that's a two digit number, a 2 digit number (maybe doubles for these actually), and another number ranging from 1 digit to 4ish, I want 1 second intervals for 30 minutes before it begins to overwrite, which would be 1800 two-dimensional arrays... I know this won't fit on the chip (will it) so I was going to get some external flash, but I'm not sure how much. Thanks
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

by adafruit on Wed May 14, 2008 11:22 am

you can store quite a bit of data (in the Kb range) on a serial EEPROM such as the 24' or 25' series

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by schill on Wed May 14, 2008 12:09 pm

You can do this project as an exercise, but don't expect to get an accurate real-time measurement of your velocity.

There are a number of issues involving accuracy. These include "simple" things like your acceleration measurement being affected by gravity (level ground vs. uphill or downhill).

Also, all of your errors will be cumulative. At each reading you will add a little more error. This is similar to the problems people run into with robots navigating by dead reckoning. Don't be surprised if you drive a few hundred feet, stop, and find out that your instrument says you are still moving forward (or are going in reverse).
schill
 
Posts: 66
Joined: Sat Dec 15, 2007 11:25 pm

by magician13134 on Wed May 14, 2008 3:07 pm

Yeah, I expected the cumulative problem, but what exactly does direction have to do with it? I mean, I know acceleration is derived from velocity, which being a vector, changes with speed OR direction, but wouldn't the accelerometer... do... something... I'm not really sure where I was going with this. I'll start work eventually and let you know how it goes (I would like a display now that I think of it, so I made need to learn about multiplexing...)

Oh, and thanks for the advice Ladyada.
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

by schill on Wed May 14, 2008 3:23 pm

If you ever intend to slow down and/or stop you will need some negative acceleration. Depending on how your calculations work out, the odds of your coming to a zero velocity when you stop are probably pretty slim. Depending on which way your errors work out (and it can change with each step), you could find your device telling you that you are going in either direction (forward or reverse) when you are physically stopped.
schill
 
Posts: 66
Joined: Sat Dec 15, 2007 11:25 pm

by magician13134 on Wed May 14, 2008 3:59 pm

Right right, I get that part, what I meant by direction was "your acceleration measurement being affected by gravity (level ground vs. uphill or downhill). "
That part...
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

by schill on Wed May 14, 2008 4:27 pm

If you park on facing uphill or downhill, you will measure an acceleration due to gravity (along your car fore-aft axis) that will fool your instrument into thinking the car is accelerating. I think you will need to remove this component. You may be able to do this using a 2-axis accelerometer with one axis oriented fore-aft and the other up-down in the car axis system. Essentially, I think you need to remove the tilt of the vehicle - or drive far enough from any planets/stars that the effect is minimized.

If you only measure the fore-aft acceleration (single axis sensor along the vehicle axis):
1) stopped on level ground, you will measure no acceleration.
2) stopped with the car facing straight up (very steep road), you will read a 1g acceleration backwards.
3) stopped with the car facing straight down, you will read a 1g acceleration forwards.
schill
 
Posts: 66
Joined: Sat Dec 15, 2007 11:25 pm

Please be positive and constructive with your questions and comments.