Accelerometer

Hello Blynkers!
How can i use The Accelerometer widget and what is Number From 0 to 10 can can i calculate rotation and degrees?

You canā€™t.

An accelerometer senses motion (of your phone) along the three axis, not position. The range of 0-10 is the rate of acceleration.

1 Like

actually, with proper coding it could be possible to measure rpm, if the rotation is perpendicular to the ground.

there are some ant+ bike computers which use the same principle. it has a wireless accelerometer / gravity sensor mounted to the hub, and every time the hub makes a full circle the value (direction) of gravity becomes 0, so one can calculate rpm. i canā€™t explain so well but hope this makes senseā€¦

if the sensor can sense the magnetic azimuth, it can also be used in orizontal rpm measurement.

1 Like

But the Accelerometer widget reads the phone sensor, and I donā€™t think mounting a phone to a spinning object is quite the way to go :stuck_out_tongue_winking_eye:

And besides the math involved is not a Blynk Forum topicā€¦ is there math forums? I hope I never run into one :scream:

2 Likes

@Gunner
Continuing the discussion from Outputting Accelerometer Data to blynk app:

take alook on this topic and the sketch.

  Serial.print("X-Axis of Rotation : ");
  Serial.println(xGyro);
  Blynk.virtualWrite(V4, xGyro);
  Serial.print("Y-Axis of Rotation : ");
  Serial.println(yGyro);  
  Blynk.virtualWrite(V5, yGyro);
  Serial.print("Z-Axis of Rotation : ");
  Serial.println(zGyro);
  Blynk.virtualWrite(V6, zGyro);

What about it?.. That Topic was all about getting the data into the sketch, easily doneā€¦ What you are asking for is something totally different.

Continuing the answerā€¦ While the Phoneā€™s accelerometer does seem to detect the rough axis of rotationā€¦ it is really detecting the acceleration along the axis. The gyroscope is what detects the rotation, but even then the key work here is ā€œdetectā€, not easily measure or calculate accurate degrees of rotation in any form Blynk can currently read.

Get yourself a proper sensor and library, and use it. Or make something with a HALL effect or rotary encoder.

1 Like

Thank You Big @Gunner

1 Like

Big @Gunner, this made my day :))
sure you will have a new title, Mister Master Big @Gunner!

2 Likes

You forgot to toss in the ā€˜sirā€™ somewhere between those titles :joy:

1 Like

oh, i felt like iā€™ve missed somethingā€¦

1 Like

I knew my ears were ringing as I sleptā€¦

1 Like

:face_with_raised_eyebrow: :stuck_out_tongue_winking_eye:

https://developer.android.com/guide/topics/sensors/sensors_motion.html

So what about this?

1 Like

interesting article!

@sh.abar.mard we already know that the Accelerometer Widget will pull the float data from the phoneā€¦ and how to read it

BLYNK_WRITE(V1) {
  //acceleration force applied to axis x
  int x = param[0].asFloat(); 
  //acceleration force applied to axis y
  int y = param[1].asFloat();
  //acceleration force applied to axis y
  int z = param[2].asFloat();
}

Conceptually, an acceleration sensor determines the acceleration that is applied to a device by measuring the forces that are applied to the sensor. Measured in m/s^2 applied to x, y, z axis.


The rest of the math to calculate how many times around, or how far around in degrees, your phone has spun, assuming that can be determined with this info alone, is beyond this forum.

So with that in mind, do you have further need in understanding how to grab the X/Y/Z data from this widget?