MPU9250 Component!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

MPU9250 Component!

Post by jgu1 »

Hi all!

I have bought one of MPU9250 component. I tryed to seach in fora and look in Wiki, but no examble. Then I try to do something in a testprogram but I am not managed to get it run.
Have some of FC8 user used this component and have an examble you would share, please or can look in my testprogram.

Thank´s in advance.

Br Jorgen
Attachments
Test MPU9250.fcfx
(9.58 KiB) Downloaded 202 times

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 44 times
Been thanked: 60 times
Contact:

Re: MPU9250 Component!

Post by viktor_au »

Hello

I don't think you can use Arduino Mega2560 to read bearings.

Note: Most Arduino boards consist of an Atmel 8-bit AVR microcontroller (ATmega8, ATmega168, ATmega328, ATmega1280, ATmega2560) with varying amounts of flash memory, pins, and features.

FC8 Read_Bearing Macro note says:
Reads the current sensor compass bearing based on degrees CW from magnetic north.
Returns 0-359 where 0 = North, 90 = East, 180 = South, 270 = West
Requires the ArcTan floating point function to be available to work correctly.
Supported on AVR, 16-bit

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: MPU9250 Component!

Post by jgu1 »

Hi Victor!

Well, ok. Thank you for info. I am not so hardcore ind this component.

But I found ( maybe ) a simpler device, GY-271 HMC5883L Triple Axis Compass Magnetometer Sensor Module. Againg unfortunaly I am not able to create a component for this :( I would be gratefull If somebydy could create a FC8 component for this, please.

Br.

Br Jorgen.

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 44 times
Been thanked: 60 times
Contact:

Re: MPU9250 Component!

Post by viktor_au »

jgu1 wrote: gratefull If somebydy could create a FC8 component for this, please.
Hello Jorgen

I hope somebody will do it for you.
However I can suggest to you to dig deep in FC8 and study it more.
You can use a lot of info from Arduino (IDE) with 9250 if you Google ' arduino 9250'.
It is a great fun to 'move' the open source code into the FC8.
Check this great video - https://www.youtube.com/watch?v=mzwovYcozvI
Good luck!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MPU9250 Component!

Post by Benj »

Hello,

I've just looked at your program and it looks like the problem is the CollectXYZData macro call. You use the variable XX as the parameter but this should be either 0, 1 or 2 to specify which axis you want to read x, y or z. The return value should then be assigned to the XX variable.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: MPU9250 Component!

Post by jgu1 »

Thank´s Ben. Please, please could you give a short examble or correction in my testprogram, at least only for the compass, please.

Br jorgen

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: MPU9250 Component!

Post by stefan.erni »

Hi Jorgen

To read x,y,z axis from the compas I changed your Programm. Just move the slider from compas X in the simulation

I have a MPU9250 on my board with a PIC32. I will try how it works there.

regards


Stefan
Test MPU9250-mod.fcfx
(10.62 KiB) Downloaded 239 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: MPU9250 Component!

Post by stefan.erni »

Hi Jorgen

There is a problem in reading the value from the MPU9250 and PIC.
It's just working if I use the stopdelay in the properties. Without the delay my program is hanging
If I read accelerometer, I receive not always the correct value. I tried to read the temperature from the MPU9250 and I have the same problem.

Changing speed was not helping. On the same I2C bus is a RTCC. This is alwasy working correct.


I will have a look what's wrong.


regards

Stefan

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: MPU9250 Component!

Post by jgu1 »

Hi Stefan!

Thank you for your effort. I am glad you give it a try. Meanwhile I will continue work with it. But until now no luck. :(
Do you still mean I not can use Arduino?

Thank´s in advance.

Br Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: MPU9250 Component!

Post by jgu1 »

Hi again Stefan!

I make a test with your program. I change the delay between display print from 1mS to 1 sec before delete. The only readout I get is 0

Br Jorgen
Attachments
Test MPU9250-mod.fcfx
(11.21 KiB) Downloaded 162 times

viktor_au
Posts: 342
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 44 times
Been thanked: 60 times
Contact:

Re: MPU9250 Component!

Post by viktor_au »

Hello Jorgen

I have attached the draft version of Mega2560 with Compass9250.
Please read the notes and note that this is not a working code example. It is a draft demo of Arduino with 9250.
You need to build the Accelerometer and Gyro code to get a good results.
Please pay attention to 9250 calibration and Bias calculations (as well as tilt compensation).

P.S.
I have to stress again, do not use this code for serious project as this is draft only.
Please Google for more info - there is plenty of information how to calibrate 9250, etc.
9250 is a very complex device. If you do not have time to study it, do not do it.
To get some good results search for Arduino and 9250 (IDE projects) and use some ideas, tips, etc.
Attachments
ArdMega_MPU9250_draft_2.fcfx
(38.88 KiB) Downloaded 170 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: MPU9250 Component!

Post by jgu1 »

Hi Viktor!

Thank´s a lot. I will play with it.


Br Joorgen

Post Reply