LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Interface Labview Arduino IMU 9DoF I2C

Dear all,

Actually, we can find warious IMU 9DoF on the market.

I bought one from DFRobot with the next sensors:

Accelerometer - ADXL 345

Gyroscope - ITG3200

Compas - HMC 5883L

And a pressure sensor that i don't use here.

I looked over the Labview's forums to find some informations on how to read I2C datas coming from the Arduino.

Thanks to a lot of people, i did a simple VI based on the great works of Nathan_B and some others.

This VI permit to hook all the sensors in a single VI and check some values.

Each sensor has it own loop and clock.

In a next futur, i will add some extra functions like fusion sensors, and some filters like Kalman Filter and EKF, DCM, Quaternions,...

If you use this VI, you will need to adapt the address for your own IMU.

If you need some help, please feel free with me.

My job doesn't let me with a lot of free time, but i will help you.

Sorry for my poor english...i'm french.

Cheers,

Christophe.Capture.PNGCapture1.PNGCapture2.PNG

Message 1 of 26
(20,428 Views)

Is there any particular reason why you did not use this?  I would appreciate if you tested it with your ADXL345.

Also, it is not recommended to use the Ardunio resource in parallel execution.  Doing so creates a race condition which can cause unexpected behavior (aka your data may become corrupted).

0 Kudos
Message 2 of 26
(7,778 Views)

Hello Nathan,

According to your question, i will try your solution this week with pleasure, and i will send you my feedback asap.

Sure you're right for the Arduino, the race condition is not science fiction, but i just need to try the solution on Arduino first, just because its easy to exploit some functions like EKF or DCM algorithms.

That's it, but for sure i will try your solution tomorrow on an ADLX345.

Regards,

Christophe

0 Kudos
Message 3 of 26
(7,778 Views)

Hello Nathan,

I am using a dimuelanove (Atmega 328) on a boarduino (http://www.lynxmotion.com/images/html/build185.htm) and an IMU 9DoF from DFRobot (http://www.dfrobot.com/index.php?route=product/product&product_id=818#.UdufXm2i1I0). My Labview's version is 2011.

So, after changing the address (0x53 for me), i did some quick tests and your VI works pretty well.

It would be better to indicate all the axes on the scope legend, and try to convert the values in Euler's angle, but it's just an "option" 🙂

Otherwise, the system respond quickly to tap detection and i didn't notice any kind of problem.

Next time i will check your VI and mine, i will do advanced measurment like hysteresis detection ,bandwidth test and some others.

I will tell you what are my results through a full technical report.

Because i am new in Labview, i just want  to ask you something:

Actually, i am working on Arduino/Labview to check the IMU quickly and to verify the basic datasheet values.

Would it be possible to have a specific VI to check automaticaly the I2C addresses of the IMU ?

I mean for exemple in Arduino sketch, it exist a simple code to scan all the addresses, would it be possible to do the same over Labview but with more options like R/W address,... ?

I will try today to do the basic I2C scanner and see what could be the best to help some other people to connect their Arduino to Labview without asking "what is my address ?" 🙂

So my goal is to try to build an I2C scanner with advanced options over Labview for Arduino to collect and show all the respectives I2C addresses.

Could you be interesting to help me to solve this kind of project ?

Regards,

ChristopheCapture4.PNG

Capture5.PNG

0 Kudos
Message 4 of 26
(7,778 Views)

If you have the I2C address scanner code, could you post it?  I would be interested in seeing it.  I would think that it should be possible to port it to LabVIEW.

0 Kudos
Message 5 of 26
(7,778 Views)

Hello Nathan,

Sure, this is the I2C port scanner for Arduino:

// --------------------------------------

// i2c_scanner

//

// Version 1

//    This program (or code that looks like it)

//    can be found in many places.

//    For example on the Arduino.cc forum.

//    The original author is not know.

// Version 2, Juni 2012, Using Arduino 1.0.1

//     Adapted to be as simple as possible by Arduino.cc user Krodal

// Version 3, Feb 26  2013

//    V3 by louarnold

// Version 4, March 3, 2013, Using Arduino 1.0.3

//    by Arduino.cc user Krodal.

//    Changes by louarnold removed.

//    Scanning addresses changed from 0...127 to 1...119,

//    according to the i2c scanner by Nick Gammon

//    http://www.gammon.com.au/forum/?id=10896

// Version 5, March 28, 2013

//    As version 4, but address scans now to 127.

//    A sensor seems to use address 120.

//

//

// This sketch tests the standard 7-bit addresses

// Devices with higher bit address might not be seen properly.

//

#include <Wire.h>

void setup()

{

  Wire.begin();

  Serial.begin(9600);

  Serial.println("\nI2C Scanner");

}

void loop()

{

  byte error, address;

  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;

  for(address = 1; address < 127; address++ )

  {

    // The i2c_scanner uses the return value of

    // the Write.endTransmisstion to see if

    // a device did acknowledge to the address.

    Wire.beginTransmission(address);

    error = Wire.endTransmission();

    if (error == 0)

    {

      Serial.print("I2C device found at address 0x");

      if (address<16)

        Serial.print("0");

      Serial.print(address,HEX);

      Serial.println("  !");

      nDevices++;

    }

    else if (error==4)

    {

      Serial.print("Unknow error at address 0x");

      if (address<16)

        Serial.print("0");

      Serial.println(address,HEX);

    }   

  }

  if (nDevices == 0)

    Serial.println("No I2C devices found\n");

  else

    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan

}

--------------------------------------

I think it's really easy to port it to Labview.

I will do it this week, cause actually, i don't have time to do it.

Regards,

Christophe

0 Kudos
Message 6 of 26
(7,778 Views)

Based on the code that you just posted, you cannot do it with LIFA without adding custom functions (in LabVIEW and the firmware).  This is because the value that you use to detect if a port is valid (the return value of Wire.endTransmission) is never returned to LabVIEW.

0 Kudos
Message 7 of 26
(7,778 Views)

Thanks for the repply and the informations.

I will take in account your info.

Just because i don't know well Labview, i will take a while to do it, but i will do it.

It will be usefull i think.

Could you help me with your knowledge of Labview to achieve this this week ?

Regards,

Christophe

0 Kudos
Message 8 of 26
(7,778 Views)

I will look into creating the custom firmware and functions this week.  If I don't respond by next week regarding this and you haven't gotten it working, PM me.

0 Kudos
Message 9 of 26
(7,778 Views)

Ok Nathan,

Thanks for your help.

I will work on it too.

Cheers,

Christophe

0 Kudos
Message 10 of 26
(7,778 Views)