5.0

5.0 | 1 rating Rate this file 44 Downloads (last 30 days) File Size: 38.3 KB File ID: #43383
image thumbnail

Raspberry Pi MPU6050 SFunction with I2C Communication using WiringPiI2C

by

 

Raspberry Pi SFunction to obtain MPU6050 data using the C-library WiringPiI2C.

| Watch this File

File Information
Description

This file contains a simple single axis example and a complete 6 axis example using the DLFP (Digital Low Pass Filter) of the MPU6050.

The I2C library used is WirnigPiI2C which comes with the targetinstaller distribution of RPi.

These examples show the usage of the I2C library commands. For more capability consult Jeff Rowberg's MPU6050 code for the arduino: http://playground.arduino.cc/Main/MPU-6050, or the 6050 documentation for the register definitions.

Other device driver blocks, and the hardware it was run on is available at our website:

www.minseg.com

coming soon:
- HMC5883L magnetometer

and others!

This work is part of the Mechatronics curriculum at Rensselaer Polytechnic Institute.

Acknowledgements

Device Drivers inspired this file.

This file inspired Raspberry Pi Mpu6050 Hmc5883 L S Function With I2 C Communication Using Wiring Pi I2 C.

Required Products Simulink
MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
23 Feb 2014 Hamza

Hi !
I'm trying the SFunction but I'm getting this error message :

The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory `/home/pi/MPU6050_Gyro_Accel_rtt'
"gcc" -I"./" -O3 -D"MODEL=MPU6050_Gyro_Accel" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -c ./MPU6050_Gyro_Accel.c ./ert_main.c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c
"gcc" ./MPU6050_Gyro_Accel.o ./ert_main.o ./linuxUDP.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o -lm -ldl -lpthread -lrt -o ./MW/MPU6050_Gyro_Accel
./MPU6050_Gyro_Accel.o: In function `MPU6050_Gyro_Accel_output':
MPU6050_Gyro_Accel.c:(.text+0x34): undefined reference to `sf_MPU6050_Outputs_wrapper'
./MPU6050_Gyro_Accel.o: In function `MPU6050_Gyro_Accel_update':
MPU6050_Gyro_Accel.c:(.text+0x74): undefined reference to `sf_MPU6050_Update_wrapper'
collect2: ld returned 1 exit status
make: *** [MW/MPU6050_Gyro_Accel] Error 1
make: Leaving directory `/home/pi/MPU6050_Gyro_Accel_rtt'

The build process will terminate as a result.

Caused by:
Error executing SSH command: make: Entering directory `/home/pi/MPU6050_Gyro_Accel_rtt'
"gcc" -I"./" -O3 -D"MODEL=MPU6050_Gyro_Accel" -D"NUMST=1" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"TID01EQ=0" -D"_USE_TARGET_UDP_=" -D"_RUNONTARGETHARDWARE_BUILD_=" -c ./MPU6050_Gyro_Accel.c ./ert_main.c ./linuxUDP.c ./ext_svr.c ./ext_work.c ./rtiostream_interface.c ./updown.c ./rtiostream_tcpip.c ./rtiostream_utils.c
"gcc" ./MPU6050_Gyro_Accel.o ./ert_main.o ./linuxUDP.o ./ext_svr.o ./ext_work.o ./rtiostream_interface.o ./updown.o ./rtiostream_tcpip.o ./rtiostream_utils.o -lm -ldl -lpthread -lrt -o ./MW/MPU6050_Gyro_Accel
./MPU6050_Gyro_Accel.o: In function `MPU6050_Gyro_Accel_output':
MPU6050_Gyro_Accel.c:(.text+0x34): undefined reference to `sf_MPU6050_Outputs_wrapper'
./MPU6050_Gyro_Accel.o: In function `MPU6050_Gyro_Accel_update':
MPU6050_Gyro_Accel.c:(.text+0x74): undefined reference to `sf_MPU6050_Update_wrapper'
collect2: ld returned 1 exit status
make: *** [MW/MPU6050_Gyro_Accel] Error 1
make: Leaving directory `/home/pi/MPU6050_Gyro_Accel_rtt'

Have you an idea about the issue ?

18 Nov 2013 Baris Can

i m looking for same s function file which is usable with arduino uno, i tried to edit the file you prepared, however i couldnt succeed. Have you got any idea on what i should do ?

30 Sep 2013 Glen

Great Work Josh!

Contact us