Pages: 1 [2]   Go Down
Author Topic: Arduino + Accelerometer: Tilt Detection  (Read 19198 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what are these values :

long xy_max = 470;
long xy_min = 550;


Logged

New York
Offline Offline
Edison Member
*
Karma: 1
Posts: 1023
E != m*c^2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:



Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

New York
Offline Offline
Edison Member
*
Karma: 1
Posts: 1023
E != m*c^2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This project is great.
Logged

Pages: 1 [2]   Go Up
Jump to: