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:


Continuing the discussion from Outputting Accelerometer Data to blynk app:

take alook on this topic and the sketch.

  Serial.print("X-Axis of Rotation : ");
  Blynk.virtualWrite(V4, xGyro);
  Serial.print("Y-Axis of Rotation : ");
  Blynk.virtualWrite(V5, yGyro);
  Serial.print("Z-Axis of Rotation : ");
  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!


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:

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

  //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?