IMU Sensor for mechanics experiments

Inertial measurement units such as the MPU6050 can be used to study the motion of mechanical systems. The following code snippet demostrates extracting 3-axis data from the accelerometer, and gyroscope of the MPU6050 sensor

from SEEL import interface            # import the module  
I=interface.connect()                 # Connect to the hardware. 
from SEEL.SENSORS import MPU6050 # A 3 axis- accelerometer + 3-axis gyroscope + temperature sensor
M = MPU6050.connect()                 #Connect to the sensor 
Ax,Ay,Az,temperature, Gx,Gy,Gz = M.getRaw()    #Read all values from the sensor
print (' Ax = %.2f,Ay = %.2f, Az = %.2f , Temperature = %.2f , Gx = %.2f , Gy = %.2f , Gz = %.2f'%(Ax,Ay,Az,temperature,Gx,Gy,Gz) )

Aim : To study the oscillations of a physical pendulum, and observe the relation of its angle to its velocity. Also calculate the value of g, given the length of the pendulum

The picture shows an MPU-6050 (3-Axis accelerometer + 3-Axis Gyroscope ) hooked up to the I2C port via thin guage copper wires designed to cause minimal perturbation to the oscillations of the pendulum.

The IC is positioned at the pivot so that the accelerometer can be used to measure the angle of the pendulum accurately using the vertical component of earth’s gravitational pull.The gyroscope’s values for the axis parallel to the pendulum’s pivot are also recorded.

Resultant data : Note that the velocity is maximum at the mean, and zero at the extremities

Making the connections

Connecting I2C sensors such as the MPU6050 featured in this experiment is rather straighforward.

The SEELablet features a 4-pin I2C port that is labelled [Vcc , GND, SCL , SDA ] . The same labels can be found on most I2C modules , and four connections with simple wires up to 1 meter long is all that is required.

Once the connections have been made, the ‘sensor quick view’ app in the ‘ test and measurement’ section can be used to auto-scan the I2C port to check if connections were made properly.

Raw data from the MPU6050 oscillated by hand

Data fitted against standard sine functions by selecting a region and executing the ‘fit’ routine

For systems where wired connections are difficult ( large distance , continuous rotation etc ) , wireless subunits may be used as a drop in replacement for the wires