Arduino ESP32 Code to calculate vertical displacement using MPU6050 sensor.
Budget: $10 – $30 AUD
Write code to calculate vertical displacement using MPU6050 sensor.
Code shall integrate the acceleration on the MPU6050 accelerometers to calculate distance moved in the x, y, z direction.
Code shall use the MPU6050 gyroscope to know which way is vertical (i.e. axis parallel to gravity, g).
With information from gyroscope it shall then be able to calculate distance moved in the g direction i.e. the vertical displacement .
To test the code I will:
- lift the MPU6050 1 meter off the ground - the vertical displacement shall read 1 meter.
- I will then put the MPU6050 on the ground - the vertical displacement shall read 0 meters.
- I will then lift the MPU6050 1 meter off the ground in a different orientation - the vertical displacement shall again read 1 meter.
- I will then place MPU6050 back on the ground and the vertical displacement shall again read 0 meters.
Code shall integrate the acceleration on the MPU6050 accelerometers to calculate distance moved in the x, y, z direction.
Code shall use the MPU6050 gyroscope to know which way is vertical (i.e. axis parallel to gravity, g).
With information from gyroscope it shall then be able to calculate distance moved in the g direction i.e. the vertical displacement .
To test the code I will:
- lift the MPU6050 1 meter off the ground - the vertical displacement shall read 1 meter.
- I will then put the MPU6050 on the ground - the vertical displacement shall read 0 meters.
- I will then lift the MPU6050 1 meter off the ground in a different orientation - the vertical displacement shall again read 1 meter.
- I will then place MPU6050 back on the ground and the vertical displacement shall again read 0 meters.