Posted on
• Hi there,
For a project with the Bangle.js, I need to read the acceleration-sensor. I was able to achieve this with

``````Bangle.on('accel', function(xyz) { ... });
``````

However, this doesn't really measure the acceleration, but the tilt of the watch. Is it possible to read the raw values from the accelerometer, so that it would be possible, for example, to measure how fast a car is accelerating?

• These are usually the raw values. Try to subtract 9.81 from the acceleration vector.

• Ok, thanks for the info. Substracting g probably won't solve my problem... In my opinion an accelerometer should return 0 when it's not moving. This isn't the case with the bangle.js though :/

• Well all acc-sensors I have seen so far do return the earth acceleration when not moving. Also they are usually not accurate enough to measure any other acceleration that is a lot smaller then 1G.

If you want to know the acceleration of your car I would try the GPS. You should be able to get enough satellites in your car.

• Yes, so I thought too. As the earth doesn't accelerate it should return 0. Maybe the term "accelerometer" is not 100% accurate (@Gordon)?
Sadly I can't use GPS in my use-case, but I will try if I can use the tilt-values from the accelerometer.

• Accelerometer would measure zero in every axis if there was no force acting for any axis. When you dont move you have the gravity force pulling you down and accelerometer measures that (if you are not floating in space). Try applying any acceleration (fast movements) in any axis and you will see that too. Here you have app for banglejs plotting accelerometer so will be easier to see that https://kristosb.github.io/WebBangle/
If you want to sample fast, accelerometer will be better option than GPS. Accelerometers have different ranges. Some are better for measuring earths gravity (low range) other better for high forces like in an airbag. It depends whats your application.

• There are two types of accelerometer you can get, DC coupled and AC coupled. I haven't looked into it but the Bangle likely has a DC coupled accelerometer and these types measure the acceleration due to gravity. An AC coupled accelerometer is what is used for forced vibration tests and they won't measure low frequency acceleration such as gravity only the higher frequency dynamic acceleration.

• Thank you both for your answers. WebBangle turned out to be really useful. Thank you @kri100s. I will try to measure and substract the tilt during the movement so that the data is more precise and / or use TF and try to train a model.
@Taffaz Thanks for the explanation. I just assumed the accelerometer of the BangleJS would be of the same type like those built into smartphones.

• I just assumed the accelerometer of the BangleJS would be of the same type like those built into smartphones.

It should be identical. In fact if you try https://intel.github.io/generic-sensor-dÂ­emos/sensor-info/build/bundled/ on your phone (choose + then accelerometer) you will see sensor values that include gravity too.

It's measuring gravity because that is an acceleration it is experiencing - if you were to throw it in the air then while it was in freefall you should see a proper 0 accelaration value.

If you want to try and remove the effect of gravity then for the car acceleration case I'd just take a reading when the user presses the 'start measuring' button and then subtract it from what you get next time.

However, actually getting a proper 0 value when the watch is on your arm is harder than it seems - realistically you need a gyro as well (which Bangle.js doesn't have) so the Bangle can keep track of what angle it is in in 3D space and then subtract the effect of gravity.