Accelerometer values to m/s^2

The accelerometer is specified as

Range: +/- 16 g
Resolution: 12 mg per digit, sign and 12 bits

with 1 g being about 0.020.

I was curious about converting this value into m/s^2, so I messed around until I found a factor that seems to work, and that factor is 512, i.e. accelerometer[2] * 512 = ~ 9.8.

Does this sound right?

It’s also quite noisy, given the 16 g scale. Do you plan on providing any way to set the accelerometer gain to 2g and 4g? I haven’t tested, but I’m not sure my application will work with this coarse resolution.


I do want to explore variable range, but would likely be a new board. Definitely something I want to implement on a Pico version w/ 6 axis accel + gyro.

It’s possible to smooth things out a bit with a filter in code in exchange for reduced responsiveness.

What are you looking to do?

I’d like to remake Flamingo. I got started with addressable LEDs and microprocessors with Flamingo, a garden flamingo totem for festivals. I used an ADXL345 accelerometer, Adafruit Pro Trinket 5 V, and an Adafruit Battery Backpack, running off a 2500 mAh Lipo. Down the stick were 3 segments of 30 cm each, so the segments could be visible from all angles.

A still from a video:

Anyway, the two most interesting programs are a damped harmonic oscillator, or mass on a spring, where a light in the middle of the strip acts as a DHO. It really tricks the brain.

The other program is a simple “ball bouncing in a tube”, which starts with a single LED lit at the bottom, and you jerk it off the “ground” and keep it bouncing. It is an incredibly real feeling, and people I’ve handed the totem to find it really interesting.

Vid here:

Anyway, I think the low accelerometer resolution might cause issues with the DHO, since you get it going with very smooth, gentle motion, building inertia.

It’s worth a test, I guess.

This is a great project! I’m now considering making something similar to go with my suit :rofl: If you do test this with the PB sensor board I’d love to hear how it goes.