Hello
i post my mpu6050 in board and want to now when i tap in the board the distance between the zone of tap and the mpu form the acceleration raw ?
any help
danielsemaan:
Hello
i post my mpu6050 in board and want to now when i tap in the board the distance between the zone of tap and the mpu form the acceleration raw ?
I think you need to explain what you mean better.
Could you put the question differently?
Does this link help you:
http://playground.arduino.cc/Main/MPU-6050
i have project to put the mpu6050 in board and work in acceleration mode
the goal of my project is when i tap in my hand in any point in the board calculate the distance between my hand and the position of the sensor. mpu is posted and z=1g and x=0 , y=0g
Use a touch sensor. The accelerometer can't work out how far away you hit it because it doesn't know how hard you hit it to begin with. Like measuring the distance to stars in the sky - stars that appear bright might be closer or they might be a really big star further away.
danielsemaan:
when i tap in my hand in any point in the board calculate the distance between my hand and the position of the sensor.
It sounds like you may need at least two (three?) sensors placed at distant points, and then compare the signals to calculate the difference... Just a vague idea...
i want 3 sensor each sensor posted in board and tap over board and calculation the distance
any help?
If you are trying to do a seismic analysis on the arrival time at each sensor then you have chosen the wrong sensors.
Find out the speed of sound in PCB material. Then work out the timing differences required to resolve the tap position accurately enough. Can you measure those microseconds with an Arduino?
when i get the speed of sound ! what it the formula for get the distance
danielsemaan:
when i get the speed of sound ! what it the formula for get the distance
You can find out both from google, with a bit of effort.
It may be more complex than that. In a solid material there are two speeds, for longitudinal and transverse waves. When I worked in the coal mines, I could tell how far away a blast was by the arrival time of the two different waves shaking the office walls.
Speed = Distance / Time
You can't get a much simpler formula than that.
i have write code for get the distance but not work !
a=sqrt(axax+ayay);
t=v/a;
t=t/1000;
x=(att)/2;
It sort of looks like code because you put semicolons (
at the end of each line. It may even compile. But how does it not work? What information did you get from the system which brought you that realization?
How did you expect it to work?
my work it get acceleration and for acceleration i want know the distance
in axis z is posted in z=1g because is posted in the board so i work in value of acceleration in axis x and y
i get the speed of sound in breadboard v=2230 m/s
this is complete code
#include <I2Cdev.h>
#include <MPU6050.h>
#include <Wire.h>
MPU6050 accelgyro;
int16_t ax,ay,az,gx,gy,gz;
float Ax,Ay,Az;//Unit g(9.8m/s^2)
float x,y;
float d=0;
int v=2230;
void setup()
{
Wire.begin();
Serial.begin(9600);
accelgyro.setFullScaleAccelRange(0);
Serial.println("Initializing I2C device.....");
accelgyro.initialize();
accelgyro.setXAccelOffset(-1554);
accelgyro.setYAccelOffset(2083);
accelgyro.setZAccelOffset(1146);
// -1554 2083 1146 67 -65 -14
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful":"MPU6050 connection failure");
}
void loop()
{
accelgyro.getMotion6(&ax,&ay,&az,&gx,&gy,&gz);//get the gyro and accelerator
Ax=ax/16384.00;//to get data of unit(g)
Ay=ay/16384.00;//to get data of unit(g)
Az=az/16384.00;//to get data of unit(g)
a=sqrt(ax*ax+ay*ay);
t=v/a;
t=t/1000;//ms to s
d=(a*t*t)/2;
Serial.println("d.....");
Serial.print(d);
Serial.println("Acce data.....");
Serial.print(Ax+Ax_offset);
Serial.print(" ");
Serial.print(Ay+Ay_offset);
Serial.print(" ");
Serial.println(Az+Az_offset);
Serial.println("Accelll.....");
Serial.print(ax);
Serial.print(" ");
Serial.print(ay);
Serial.print(" ");
Serial.println(az);
Serial.println("dis.....");
Serial.println(d);
x=Ax;
y=Ay;
delay(1000);
}
the value is distance is below
d.....
nan
d.....
0.02
d.....
nan
d.....
0.02
d.....
0.01
d.....
0.04
d.....
nan
d.....
nan
d.....
nan
d.....
0.02
d.....
0.04
d.....
0.04
d.....
0.01
d.....
0.02
d.....
nan
when i tap in zone the distance not change !
What does this represent?
int v=2230;
a is the magnitude of acceleration in the X-Y plane. But then what does t represent?
t=v/a;
Then you do this:
delay(1000);
That means that absolutely nothing happens for one second and it's only allowed to listen for taps in just one microsecond among millions. The thing could not possibly work the way you think with this delay.