Discussion about Cancelling Alert message temporarily/permanently and about using sensors to detect sudden increase in speed after short term rest or less movement?

I guess, if we check the stability of the speed then we can differentiate if a person 'started to drive' from his/her 'other actions'. This can be done by using accelerometer sensor itself, I guess.

And, I found an error, there are x axis, y axis and z axis values for accelerometer. In this example, I set the x axis value. That is Forward movement of phone. But, while driving people may keep their phone in different position. So, I am going to create blocks to detect speed in any direction and then say 'You Started to Drive'. Yes, there will be the disadvantage that you mentioned.

I have a doubt about sensors. If we use sensors like accelerometer, we can see options like x axis, y axis and z axis directions in both forward and backward, up and down etc. My question is that will the direction reading for x axis got changed when user change the position of his phone? ie, if a phone is kept on a table by facing the display up, then there will be default x axis (x accel), right? My question is if I put the phone upside down, will the x axis position also get changed or the sensors can maintain the x axis direction even if user change the position of the phone as his wish?


I saw this,


Non-visible component that can detect shaking and measure acceleration approximately in three dimensions using SI units (m/s2). The components are:

  • xAccel: 0 when the phone is at rest on a flat surface, positive when the phone is tilted to the right (i.e., its left side is raised), and negative when the phone is tilted to the left (i.e., its right size is raised).
  • yAccel: 0 when the phone is at rest on a flat surface, positive when its bottom is raised, and negative when its top is raised.
  • zAccel: Equal to -9.8 (earth’s gravity in meters per second per second when the device is at rest parallel to the ground with the display facing up, 0 when perpendicular to the ground, and +9.8 when facing down. The value can also be affected by accelerating it with or against gravity.

I think, if we create blocks in such a way to compare the 1) current latitude & longitude value with 2) past latitude & longitude, for every given time interval, we can calculate the distance and speed as well using this extension.

Let me check, how quickly the extension will provide the reading updates.

I am not satisfied with this sensor (ACCELEROMETER), because even if i kept the phone on table without moving it, it is showing values around 10 in one or two of axis. And, when I check in google to covert this value (m/s2) into km/hr, it says to multiply with 3.6. So, if we do calculation, the speed is 3.6 * 10 = 36 km/hr when I simply keeping it in table. GUIDE ME GEEKS.

UPDATE: I can guess that approximately 10 is the base value of accelerometer sensor in all positions. ie, if I keep my phone on table, y axis value is going to around 10 or -10, if i keep my phone vertically z axis values are behaving like this around -10 or + 10 and the same to x axis in other position.

UPDATE 2: If I use orientation sensor to detect the phone position, then I may be able to focus only on specific axis value of accelerometer to check the speed.

Also called gravity...


1 Like

@Taifun, just before now I started driving my two wheeler with the app ON (I was screen recording to know the raise and fall of accelerometer values x, y and z.). I was driving at around 40 km/hr speed. I don't see big raise in accelerometer values. I was expecting that the value of some axis (x or y or z) will increase when the bike speed increases.

The accelerometer can't tell if its acceleration spike is caused by you hitting a bump or pot hole in the road, versus you pressing the gas or brake pedals.

To allow such differentiation, you would need to clamp the phone to the car, pointing it correctly.

1 Like

I understood that accelerometer values stay only between -10 to +10, and it doesn't cross this values even if we increase speed of the vehichle.

yes, you can find it out by experimenting or you also could take a look into the documentation...



May I know why accelerometer sensor is also functioning like orientation sensor, ie, If I change the position/angle of phone, both sensors are showing some fixed values (even if the phone is fixed somewhere without giving any further movement). But, I expexted that accelerometer will give values based on how fast the device is moved in x or y or z axis. Right now, I can't find differences between both sensors, Both sensors are giving some fixed values for each phone position/angle.


Accelerometer sensor must be in 0 (or some initial value) when it is in rest regardless of the phone's position or angle. Now, when the phone moved in any angle, the value of that angle must go up. This is what I expected.

Or else, how can I do this using accelerometer?

  1. Check all the x values of accelerometer for 5 seconds & Find the average of all those values.

  2. Repeat step 1 again.

  3. Compare and check step 1 value and step 2 value. If Step 1 value < Step 2 value, then 'SPEED INCREASED'.

So, in 10 seconds we can give audio-alert to the driver as 'You Started Driving'.

How can I loop the 'Orientation sensor block' and 'Accelerometer sensor block', so they will check the changes each other and perform accordingly consistently.

Right now the blocks within acceleromer block are functioning only one time without repetition. ie, these blocks are not going back and checking the players named as player5Roll and player5Pitch.

How can I do this? I tried to create loop as I told above, but still not working.

Help me to do this,

  1. If phone's position is in favor to accelerometer's x value then proceed with x value - To detect the speed change.

  2. If phone's position is in favor to accelerometer's y value then proceed with y value - To detect the speed change.

That is what I tried in above blocks as a newbie.

See the answers here


I guess, the blocks that I shared recently is closer to the result. Please, look at it and give your ideas as well.

Update: Im getting result now as expected but with some errors, ie, the x and y values are getting stuck (not updating new values). This may be because of fault in clock arrangements or something else, have a look and guide me.

Accelerometer shows fixed value when we tilt the phone in different position. So, it is difficult to depend this sensor to check the speed/movement-spikes. Because, same x,y,z reading for phone tilt and phone movement. How can we differentiate the readings between phone tilt and phone movement? There is no option for that.

In case of orientation sensor, the readings will be shown only for phone tilt. But, in accelerometer sensor both values are confused and mixed/merged each other, we cannot differentiate the values as when the sensor shows reading for phone tilt and when it shows reading for phone movement. If there is a way to differentiate Phone Movement using accelerometer sensor, please share the idea here.

Is there a way to compare current accelerometer values with past accelerometer values?