Accelerometer

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
AlexBir
Posts: 7
Joined: Tue Apr 23, 2019 1:00 pm

Accelerometer

Post by AlexBir » Tue Apr 23, 2019 7:34 pm

Hi,

I am trying to work with the accelerometer of pyBoard.
From the values I get, I am not sure whether I do not understand something, or it does not work well.

I would expect that if the board does not move, the reading of all axes will be zero ( or close to zero).
When I will move the board I will get reading in the direction of the movement.

What I get now, that the value is depending on the location and not on the acceleration. I can get values of x,y,z: 14,12,14 and it remains the same until I change the location if the board.

Can anyone explain what I am missing?

Thanks
Alex

rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

Re: Accelerometer

Post by rhubarbdog » Wed Apr 24, 2019 8:51 am

Axis z will be 9.81G
If the pyboard is not level this will be shared into other axis

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Accelerometer

Post by OutoftheBOTS_ » Wed Apr 24, 2019 9:46 pm

Understand what an Accelerometer reads, it doesn't read acceleration but rather reads linear force so at rest it will read the force gravity exerts on it. When it accelerates it will read the resultant force of gravity plus the force created by acceleration.

Like wise the gyro isn't a gyro (gyro reads direction faced) but rather reads the angular force (reads how fast it is spinning) then it is possible to do a calculation based upon how fast it is spinning for how long to calculate what direction u are facing. Of course if the speed of the spinning isn't perfectly constant (in real world it is nver perfect constant) then there will be an slight error in they gyrop calculation of direction and this is called gyro driff

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Accelerometer

Post by pythoncoder » Thu Apr 25, 2019 8:19 am

The accelerometer on the Pyboard is primarily for detecting the orientation of the board with respect to gravity. The general idea is that you can make applications which can detect tilting or inversion of the board, or decode gestures such as shaking it. It is fine for this purpose.

For motion measurement a precision IMU (inertial measurement unit) device with a gyro and magnetometer is required. Even then achieving any level of precision for distance and direction is not easy*. Gyros drift, magnetometers are influenced by local fields and the double integration of acceleration to determine distance greatly magnifies errors. In practice the best you can get from an IMU is a good measurement of heading, pitch and roll e.g. for aircraft applications.

*Massive understatement alert
Peter Hinch
Index to my micropython libraries.

AlexBir
Posts: 7
Joined: Tue Apr 23, 2019 1:00 pm

Re: Accelerometer

Post by AlexBir » Fri Apr 26, 2019 8:38 pm

Thanks

Post Reply