Go to Post Off time, at a regional? What is that? - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 05-02-2016, 18:14
Ian R. Ian R. is offline
Registered User
FRC #2283 (Panteras)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Mexico
Posts: 13
Ian R. will become famous soon enough
Re: MPU-9150 (I2C) with Labview

Quote:
Originally Posted by RyanN View Post
Sparkfun's example code does a 6-byte burst read. I just checked the AK8975's datasheet and it says is compatible with burst read:


The AK8975 returns a signed 16-bit integer, so negative numbers should return something in the MSB. That's pretty easy to replicate by rotating the sensor 180 degrees.

I'm not sure what's going on from your description. Mind sharing your current LabVIEW code?
Alright, we just rested it and we get values from 79 to -21 when rotating it a full 360 degrees. There's another problem too, the mag returns two equal values for each orientation and it's oposite. So, for instance, if the mag is pointing at 90º, it returns, say, 30. But if it's pointing at -90º, it also returns 30.

Here's the code. We are setting the mag as a slave so we can read the values from the MPU. We alsot tried reading the values directly from the mag, but it's the exact same issue:

Periodic tasks:


MPU Initialize:


Read Compass VI:


Read Burst VI:
Reply With Quote
  #17   Spotlight this post!  
Unread 06-02-2016, 09:28
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: MPU-9150 (I2C) with Labview

Man that config is long and scary...

The way you're reading the magnetometer looks fine. Just to note, it's not going to give you degrees, but rather, magnetic flux. The data sheet says the values can range from -4096 to +4095 (13-bit signed integer). 4095 represents 1229 µT, and 1 represents 0.3 µT. (micro Teslas) Unless you use a magnet, you're not going to see any readings near those extremes.

http://mythopoeic.org/magnetometer/

It's been a while since I've messed with this stuff, but there is a NOAA calculator that you can use to get an idea of how strong the magnetic flux is in your area.

http://www.ngdc.noaa.gov/geomag-web/

I wouldn't expect anything over 50 µT in our area unless an external source is applied (such as a magnet, motor, electromagnet).
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 06-02-2016 at 09:33.
Reply With Quote
  #18   Spotlight this post!  
Unread 08-02-2016, 20:42
Ian R. Ian R. is offline
Registered User
FRC #2283 (Panteras)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Mexico
Posts: 13
Ian R. will become famous soon enough
Re: MPU-9150 (I2C) with Labview

Quote:
Originally Posted by RyanN View Post
Man that config is long and scary...

The way you're reading the magnetometer looks fine. Just to note, it's not going to give you degrees, but rather, magnetic flux. The data sheet says the values can range from -4096 to +4095 (13-bit signed integer). 4095 represents 1229 µT, and 1 represents 0.3 µT. (micro Teslas) Unless you use a magnet, you're not going to see any readings near those extremes.

http://mythopoeic.org/magnetometer/

It's been a while since I've messed with this stuff, but there is a NOAA calculator that you can use to get an idea of how strong the magnetic flux is in your area.

http://www.ngdc.noaa.gov/geomag-web/

I wouldn't expect anything over 50 µT in our area unless an external source is applied (such as a magnet, motor, electromagnet).
Well, we fixed the magnetometer communication at last... But we're having a lot of trouble interpreting the data it gives back. It just doesn't make much sense, even though it reacts as it should.
Reply With Quote
  #19   Spotlight this post!  
Unread 10-02-2016, 16:36
uutzinger uutzinger is offline
Registered User
FRC #4183 (Bit Buckets)
Team Role: Mentor
 
Join Date: Dec 2014
Rookie Year: 2013
Location: Tucson
Posts: 8
uutzinger will become famous soon enough
Re: MPU-9150 (I2C) with Labview

It might be easier to use use the example Arduino code and hook the sensor up to an Arduino and communicate over serial port with Arduino which would read the sensor values and send them to your LabView program.

The 9150 has more than 100 registers and the compass on it is a separate I2C device which the 9150 accesses over its own internal I2C bus.

I recommend code from Kris Winer on github.
Also the 9150 is no longer available and got replaced with 9250 which is mostly compatible except for some of the calibration.

You can also use my code on github (uutzinger). Teensy works well as Arduino replacement.

Making USB serial communication work with RoboRIO is not trivial either.
__________________
-- Urs Utzinger, Mentor
Bit Buckets, # 4183, Tucson Arizona
Reply With Quote
  #20   Spotlight this post!  
Unread 15-02-2016, 07:51
Ian R. Ian R. is offline
Registered User
FRC #2283 (Panteras)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Mexico
Posts: 13
Ian R. will become famous soon enough
Re: MPU-9150 (I2C) with Labview

Quote:
Originally Posted by uutzinger View Post
It might be easier to use use the example Arduino code and hook the sensor up to an Arduino and communicate over serial port with Arduino which would read the sensor values and send them to your LabView program.

The 9150 has more than 100 registers and the compass on it is a separate I2C device which the 9150 accesses over its own internal I2C bus.

I recommend code from Kris Winer on github.
Also the 9150 is no longer available and got replaced with 9250 which is mostly compatible except for some of the calibration.

You can also use my code on github (uutzinger). Teensy works well as Arduino replacement.

Making USB serial communication work with RoboRIO is not trivial either.
Thanks.
At the moment we're sticking with the normal gyro, but we already had the Arduino in mind. One thing that will make that process complicated is opening a communication with the sensor AND the rio at the same time.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi