Go Down

Topic: Arduino + Accelerometer: Tilt Detection (Read 21423 times) previous topic - next topic

evantheking

what are these values :

long xy_max = 470;
long xy_min = 550;



jezuz

Quote
what are these values :

long xy_max = 470;
long xy_min = 550;


These are the limits for the values to use in the "if" statements.

They are backwards, as you can tell (max < min), but that's really just semantics.

What happens is a set of if statements check to see if the accelerometer x and y outputs are greater than (in this case) the min, or less than the x, and light up the led's accordingly.

Gabertzz

Sir where we can buy that kind of Accelerometer? Thanks for reply

Hypermiler

Great post, thanks for sharing. I'm looking forward to trying this with an MMA3671L, which is 3-axis. I'm sort of unclear how you derived your constants (xy_max and xy_min). Were these part of the specification for your chip, or did you derive these experimentally by just tilting the board around and looking at outputs on serial? Thanks!

Hypermiler

So, I did this using just the X and Y accel pins from a 5dof board (http://www.sparkfun.com/products/9268), and had to recalibrate the xy_min and xy_max to:

long xy_max = 300;
long xy_min = 350;

...but got it working!

I did the recalibration by just examining the serial output for each pin as I moved the board in space and noting the values as I moved it:

http://www.youtube.com/watch?v=WNF8IIcEkeQ


Gabertzz

Good day! Sir can you post the schematic of your project. We will make a project like this. Thanks

jezuz

@Hypermiler

Cool, nice to see my project is still being reused.

@Gabertzz
Sorry I didn't get back to you sooner, I don't monitor this thread.

Here's the link to the accelerometer I used:

http://www.sparkfun.com/products/9269

The code is self explanatory, I think, but if anyone needs a schematic PM/email me and I'll draw one up.

vudangkhoa


Go Up