MPU-6050 (I2C) Library

Can someone help me port this library?
User avatar
RogerClark
Posts: 6911
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: MPU-6050 (I2C) Library

Post by RogerClark » Fri Jul 17, 2015 10:33 am

Re; 'HardwareSerial*' in assignment
hardPort = &Serial;


Thats because USBSerial is not an instance of HardwareSerial

You'll need to change RTIMULib, try changing the defintion of RTARDULINKHAL_PORT to USBSerial instead of HardwareSerial

Actually, both HardwareSerial and USBSerial are both inherited from the Stream class, so you could try changing the library file to specify the port as Stream rather than HardwareSerial, and it may work for both. Or possibly as an instance of Print

Actually, I'd need to download and look at the code, but basically find the code that is hard coded to use HardwareSerial and change it ;-)

bdbell
Posts: 20
Joined: Tue Apr 28, 2015 7:35 am

Re: MPU-6050 (I2C) Library

Post by bdbell » Fri Jul 17, 2015 11:08 am

RogerClark wrote:You'll need to change RTIMULib, try changing the defintion of RTARDULINKHAL_PORT to USBSerial instead of HardwareSerial
that did it - thanks!

aster
Posts: 100
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: MPU-6050 (I2C) Library

Post by aster » Mon May 01, 2017 1:40 pm

hello! so is this library working with stm32f103c8? could someone send me a working copy?

Fingolin
Posts: 15
Joined: Wed May 17, 2017 1:28 pm

Re: MPU-6050 (I2C) Library

Post by Fingolin » Wed May 17, 2017 1:34 pm

Is this topic still active?
I am currentyl working on a prjoject with an quadrocopter, where I want to develop the flight controller etc all by myself.
Since the greater speed of and stm32 I switched to this board, however I am a bloody beginner.
But I made a MPU6050 library, that works for the arduino, which I am currently porting to the stm32103c8t.
The library is not yet working the same way as on the arduino, but I am looking foorward to share my results and get further inputs/tips/help whatever, since I am a beginner with stm32!

aster
Posts: 100
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: MPU-6050 (I2C) Library

Post by aster » Fri May 19, 2017 1:37 pm

Fingolin wrote:Is this topic still active?
I am currentyl working on a prjoject with an quadrocopter, where I want to develop the flight controller etc all by myself.
Since the greater speed of and stm32 I switched to this board, however I am a bloody beginner.
But I made a MPU6050 library, that works for the arduino, which I am currently porting to the stm32103c8t.
The library is not yet working the same way as on the arduino, but I am looking foorward to share my results and get further inputs/tips/help whatever, since I am a beginner with stm32!
Hi Fingolin,

The library from what roger and bdbell say works but i didn t figure out how to do it, you should replace the class for the usbSerial somewhere but i didn t had time to try it
If you manage it please attach here the library!

garindo
Posts: 8
Joined: Tue Sep 20, 2016 3:02 pm

Re: MPU-6050 (I2C) Library

Post by garindo » Sun May 21, 2017 2:03 pm

Fingolin wrote:Is this topic still active?
I am currentyl working on a prjoject with an quadrocopter, where I want to develop the flight controller etc all by myself.
Since the greater speed of and stm32 I switched to this board, however I am a bloody beginner.
But I made a MPU6050 library, that works for the arduino, which I am currently porting to the stm32103c8t.
The library is not yet working the same way as on the arduino, but I am looking foorward to share my results and get further inputs/tips/help whatever, since I am a beginner with stm32!
Hi, I have a project also of a quadcopter with stm32f103c8t6 and mpu6050, my drone fly well in acro mode, but not in autolevel, i have a pcb designed for the proyect and other with stm32f103ret6, the two pcb fly well in acro mode. my idea is add gps+magnetometer, but first autolevel is very important.
we can share information...
Bye.

garindo
Posts: 8
Joined: Tue Sep 20, 2016 3:02 pm

Re: MPU-6050 (I2C) Library

Post by garindo » Sun May 21, 2017 2:45 pm

STM32F103RET6
Image

STM32F103C8T6
Image

Fingolin
Posts: 15
Joined: Wed May 17, 2017 1:28 pm

Re: MPU-6050 (I2C) Library

Post by Fingolin » Sun May 21, 2017 2:47 pm

Hi Garindo,
I am working on a similar matter and would be very happy to share!
Currently I have auto-leveling working with arduino but I have trouble moving to the stm32 board.
If u want I can email you my code? (or post it here of course)

ag123
Posts: 742
Joined: Thu Jul 21, 2016 4:24 pm

Re: MPU-6050 (I2C) Library

Post by ag123 » Sun May 21, 2017 3:04 pm

i'm not familar with drones, in terms of drones it seem there are lots of stm32f405 boards based drones
http://www.stm32duino.com/viewtopic.php?f=39&t=1977
http://www.ebay.com/sch/i.html?_odkw=dr ... 4&_sacat=0
they seem to be the CC3D or betaflight variety
http://www.dronetrest.com/t/cc3d-flight ... -guide/830
https://github.com/betaflight/betaflight
those drone specific boards often have the mems accelerometer / gyroscope on board, the pins also seemed to be geared towards drone/motor control purposes
those stm32f405 drone boards probably won't make good generic dev boards as too few of the gpio pins are broken out but may likely be good drone boards
i think stm32f405 generally has a (whopping) 1M on chip flash

bdbell
Posts: 20
Joined: Tue Apr 28, 2015 7:35 am

Re: MPU-6050 (I2C) Library

Post by bdbell » Mon May 22, 2017 3:43 pm

I have been a busy with other projects, but finally got a chance to look at this tonight. I am attaching both the original DMP6/Teapot sketch and the latest working RTIMULib and libraries for them. I am using these with a small BT 4.0 motion controller I designed using STM32, MPU9150/9250, and MS5611 altimeter/pressure sensor (the attached sketches output to data to USB, although I have them working using Serial2 to BT). I have been using MPU9250 lately, but have also tested both these in the past with MPU9150 - I don't have MPU6050 to test but should be fine as they are both written for it also.

It's been a while since I modified the RTIMULib to work with STM32, so I can't remember exactly what I did, but if you compare the files in the libraries folder with the originals you can see there are small changes to 2 files in each library.

Please note that these are currently configured for MPU9250 on i2c address of 0x69 so you will need to change them to match your configuration.

Hope this helps!
Attachments
RTArduLinkIMU_Serial.zip
(84.57 KiB) Downloaded 25 times
MPU9250_DMP6_STM.zip
(54.62 KiB) Downloaded 33 times

Post Reply