You are here

Madgwick- , Kalman- or DMP Filter with MPU 6050 and PSoC 1 | Cypress Semiconductor

Madgwick- , Kalman- or DMP Filter with MPU 6050 and PSoC 1

Summary: 53 Replies, Latest post by Stahldroid on 24 Jan 2016 02:59 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
joh9_1534041's picture
User
61 posts

Hello,

seeking a bit Input. I want to realize a MPU6050 Project (Vehicle: Pitch/Tilt - Application). To save up a little Time, I try to ask same Profies.

Question: With a PSoC1 (CY8C29466-24PXI) can I implement a Madgwick Filter or Kalman Filter or onboard Digital Motion Processor (DMP) for best measurement Results (MPU6050-Sensor)?

 

What I found:

Madgwick Filter: http://www.cypress.com/forum/psoc-4-architecture/mpu6050-wpsoc4-implemen...

http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/

 

Kalman Filter: http://www.psocdeveloper.com/forums/viewtopic.php?p=18174 https://github.com/TKJElectronics/KalmanFilter/blob/master/examples/MPU6...

 

DMP: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050/Exampl...

 

I am happy about Feedback :-)

 

 

user_1377889's picture
User
10803 posts

Madgwick is doable on a PSoC1 at 24MHz I got more than 50Hz update frequency, but I had to do some tricks.

Using internal buffers of the sensors, red out within an interrupt handler and averaged on-the-fly

Calculating eulers from quaternions done with a self-written sine function to save MIPs and flash

Sorry, project was done as customer's order, so no example.

I did the same fitting on a PSoC4 and there was time enough to control 8 servos with PWMs.

When you use a CY8CKIT-043 you will have full debug capabilities inherently which would  require an ICE-Cube for PSoC1.

 

Bob

joh9_1534041's picture
User
61 posts

Big THX for your super reply.

user_1377889's picture
User
10803 posts

You are always welcome!

 

Bob

BTW: Where in Germany are you located? I live near Bremen

joh9_1534041's picture
User
61 posts

Hey Bob,

I live in Frankfurt, sry for my late feedback.

I found your Project and did my Best, but it dont runs ..... and the bad thing is: I have no ICE-Cube for PSoC1 and the CY8CKIT-043 is for PSoC4 .... 

Maybe you have time and pleasure to make a overview of my Project. --> The g-values are nice, but after the Filter, all Values runs out...

Please dont shock of the disorder, i will organize it at finish, but if it is to messy for you i will organize it before ;-)

Wünsche eine schöne Woche und freue mich auf deine Antwort.

Joh

user_1377889's picture
User
10803 posts

So, what is the reason you do not switch to PSoC4??? I do noot want to say PSoC1 is outdated, but the ARM M0 is a bit more modern than the MC8 CPU. Only except is: High PCB volume numbers. But then there must be room for an ICE. Without one there is no real chance to develop such a complex project that is very tight on the available resources as SRam and flash!

 

Bob

joh9_1534041's picture
User
61 posts

Sorry but the reason is, i have no money to buy a new board..... and I get PSoC1 second hand 

To "Without one there is no real chance to develop such a complex project that is very tight on the available resources as SRam and flash!" , you said "Madgwick is doable on a PSoC1 at 24MHz I got more than 50Hz update frequency, but I had to do some tricks", so my posted Project dont get your Ok .... If I spend more time on it, should I get it run on PSoC1 or is that a extrem Challenge?

user_1377889's picture
User
10803 posts

I used an ICE-Cube to debug and I remember that I had a tough time...

Cheapest PSoC4 board with debugging capabilities is $10 and you can get it from Future electronics here in Germany. Size is quite usable in a model aircraft ;-), you'll  need some H-bridges for the servos

 

Bob

 

joh9_1534041's picture
User
61 posts

i get it run, but i dont understand the attribute of sampleFreq / Sampling rate in the Madgwick Function. Does it means that MadgwickAHRSupdateIMU() have to be called in this frequency, with an Interrupt or is that only a manipulated variable how betaDef/Kp?

joh9_1534041's picture
User
61 posts

Where can i find a function to measure the total time since my program started?

user_1377889's picture
User
10803 posts

Madgwick contains a filter and that always has got a time-factor. To answer your second question with the first:

Setup a timer that interrupts every millisecond, count the milliseconds on a volatile uint32. Measure your accell-values on that time-base. Best is to set a flag every 20ms. in main() check that flag act accordingly and reset it again.

 

Bob

Log in to post new comments.