Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerometer Love #402

Closed
lyzadanger opened this issue Jul 5, 2014 · 5 comments
Closed

Accelerometer Love #402

lyzadanger opened this issue Jul 5, 2014 · 5 comments

Comments

@lyzadanger
Copy link
Collaborator

I bought me a MMA 7361 Triple-Axis Accelerometer Breakout Board from Sparkfun and have soldered it up and wired it up. Goals being:

  • Validate existing examples work as documented
  • Update fritzing diagrams and give the Accelerometer.js and Accelerometer-pan-tilt.js examples n00b-friendly comments (I am accelerometer n00b myself)
  • Create Wiki page for Accelerometer API
  • Potentially add additional examples if relevant

First, let me say that wiring things up and running the Accelerometer example generally worked fine (beside the very minor niggle that the fritzing diagram shows different pins than the example uses). I'm getting readings from all three axes.

After looking at the example, the source code, various online docs about accelerometers, and futzing around for a good while, I am left with the following questions. Low priority on all of this, of course. It's quite possible that most of these questions are more specific to how accelerometers work than how johnny-five works, so, bear with my naivete here...I should also mention that I'm not using any capacitors in my current setup—I don't have any near enough to the recommended values right now. FWIW, the reads seem to be stable in a relative sense.

  • The zeroV opt: Comment in example is // volts in ADC. Is this the expected voltage out at zero G? If so, on which axis? The datasheet for my accelerometer suggests that this voltage will be different for the x and y axes versus the z axis. By setting the zeroV value to 560, I'm able to get very close to 0g readings on my x and y axes, but my z is an outlier. As a related aside, I'm not sure how/if AREF is supported in johnny-five/firmata. I'm using the AREF pin on my Arduino to give it 3.3V, but the raw readings off the sensor pins are still scaled to 5V. Absolute vOut for x axis at rest is 1.62V according to my multimeter. I did see the aref opt (not in the example, but in the source), and I did set it to 3.3. Computed values are affected by this, but not raw.
  • Can you help me grok the sensitivity opt? My datasheet describes sensitivity as a function of mV/g (e.g. its default sensitivity is +-1.5g, at 800mV/g), whereas the comment in the example says mV/degree/seconds, which is a unit I don't get. Am I looking at the "wrong kind" of sensitivity?
  • Is there anything I can look at to clarify the basics of the computations in the fma function? I mean, I don't think I need to understand the math at a granular level, but I presume it's calculating force/mass/acceleration stuff. I'm curious about the value 134217729. The baseline at-rest values for me tend to be around 2, so again I wonder if my inability to get things properly calibrated is problematic here.
  • orientation returns an int between -3 and 3. But what do these values mean :)?
@rwaldron
Copy link
Owner

rwaldron commented Jul 6, 2014

aref

There is no way to get this value from the board via firmata protocol, which is why I made it a constructor option to be provided by user code. 5V seemed like a reasonable default (biased in that I was using a 5V breakout).

zeroV

This is a handwavey cheat for https://code.google.com/p/mma7361-library/source/browse/AcceleroMMA7361/AcceleroMMA7361.cpp#95. When I was working on this in April/May I ordered several analog accelerometer breakout boards to refine a zero adc voltage offset algorithm. By the time they arrived I was tied up with other things—now I have them and no excuse not to work on this.

I did see the aref opt (not in the example, but in the source), and I did set it to 3.3. Computed values are affected by this, but not raw.

I'm trying to establish a convention where sensor devices always provide a raw ADC reading value via handler args and computed values via the instance's properties. This needs to be documented :\

fma

fma = "fused multiple add" http://stackoverflow.com/questions/3589418/which-algorithms-benefit-most-from-fused-multiply-add (Incidentally, while reviewing the source material, I noticed that I forgot to include the copyright for that function—this has been corrected.)

orientation

Ported from: https://code.google.com/p/mma7361-library/source/browse/AcceleroMMA7361/AcceleroMMA7361.cpp#321

@rwaldron
Copy link
Owner

rwaldron commented Jul 6, 2014

The orientation should match:

@soundanalogous
Copy link

The ability to set the analog reference voltage via Firmata may be added at some point: firmata/arduino#39

@rwaldron
Copy link
Owner

rwaldron commented Jul 7, 2014

@soundanalogous excellent :)

@stale
Copy link

stale bot commented Jul 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jul 10, 2019
@stale stale bot closed this as completed Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants