Need help on vhdl- accelerometer implementation. desperate!!

jjzz

Joined Mar 12, 2007
3
i am trying to use an analog accelerometer to connect to an adc and then into a xilinx spartan 3e starter kit. but i have no idea how to convert the out put of the accelerometer which is in the form of voltages to distance using vhdl. if anyone can help it is greatly appreciated.

beenthere

Joined Apr 20, 2004
15,819
Your question is a bit hard to understand. You say you're using an A to D converter at first, and then you say you have no idea how to convert the analog voltage. That's the A to D's job.

After that, acceleration times time is distance. Sample frequently, and use the difference betwen sample times and the acceleration during that period to calculate distance travelled. Keep the interval short, and treat each acceleration reading as if it were uniform during the period between samples.

Papabravo

Joined Feb 24, 2006
13,688
Your question is a bit hard to understand. You say you're using an A to D converter at first, and then you say you have no idea how to convert the analog voltage. That's the A to D's job.

After that, acceleration times time is distance. Sample frequently, and use the difference betwen sample times and the acceleration during that period to calculate distance travelled. Keep the interval short, and treat each acceleration reading as if it were uniform during the period between samples.
Ahh...acceleration times time is velocity.
Rich (BB code):
S = So + Vot + (1/2)at^2

WHERE
So is the initial position
Vo is the initial velocity
at least it was the last time I did a unit analysis.

Dave

Joined Nov 17, 2003
6,970
Ahh...acceleration times time is velocity.
Rich (BB code):
S = So + Vot + (1/2)at^2

WHERE
So is the initial position
Vo is the initial velocity
at least it was the last time I did a unit analysis.
To show acceleration times time equal velocity, you can represent it without the positional term:

v = u + at

v = Current velocity
u = Initial velocity
a = Acceleration
t = time

This clearly shows acceleration times time equal velocity.

Dave

Dave

Joined Nov 17, 2003
6,970
After that, acceleration times time is distance. Sample frequently, and use the difference betwen sample times and the acceleration during that period to calculate distance travelled. Keep the interval short, and treat each acceleration reading as if it were uniform during the period between samples.
Velocity times time gives distance, therefore by integrating the acceleration and then times by the time you would ascertain the distance.

Dave

jjzz

Joined Mar 12, 2007
3
does anyone know how to write the code for that , my adc comes out with 14bits each time the accelerometer is analysed. how does the vhdl part go to have the output as distance? thank you guys... as i do not know how to write the code for this algo.

Papabravo

Joined Feb 24, 2006
13,688
You need to understand that vhdl is not a proceedural language for implementing algorithms. It is a hardware description language that can be used to synthesize hardware which can be used to implement algorithms. Where exactly is your head at that you ask questions like you do?

jjzz

Joined Mar 12, 2007
3
frankly i am just lost on how i can do this. please aid me. i have told you what i am trying to do. can you guide me? you have already told me how it can be done. but i do not know how to implement it. my deadline is coming up soon and i am panicking like hell.. please be patient withme.

Papabravo

Joined Feb 24, 2006
13,688
Why? You've made no effort to understand the purpose and utilization of vhdl. At this point in time there is really nothing that any of us can do for you.