Go to Post While [a college FIRST competition] would be pretty fun, I think that you'll see this build season that mentoring is a heck of a lot of fun too. (except when the kids pretend to cut their fingers off to see your reaction) - Beth Sweet [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
  #1   Spotlight this post!  
Unread 23-01-2014, 20:07
bjackson2016's Avatar
bjackson2016 bjackson2016 is offline
Website
FRC #1111 (Power Hawks Robotics)
Team Role: Webmaster
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Crofton MD
Posts: 6
bjackson2016 is an unknown quantity at this point
Arduino with LabVIEW

Our team has decided to use an Arduino with a gyroscope to navigate in autonomous. We need to be able to recieve data so we wrote hello world code in arduino and tried to read it in labview using DIO, Serial, and I2C. Does anyone know read values from an arduino in labview. Thanks
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2014, 20:21
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Arduino with LabVIEW

There are LabVIEW VIs for DIO, Serial, and I2C included in the FRC Library. If you couldn't get any of them to work, it would be helpful to post your Arduino code and your LabVIEW code. Note that the cRIO only supports being an I2C master, so you would have to make the Arduino an I2C slave.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2014, 20:24
bjackson2016's Avatar
bjackson2016 bjackson2016 is offline
Website
FRC #1111 (Power Hawks Robotics)
Team Role: Webmaster
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Crofton MD
Posts: 6
bjackson2016 is an unknown quantity at this point
Re: Arduino with LabVIEW

We have the following for the Arduino and are setting it up as a Slave Sender:
#include <Wire.h>

void setup()
{
Wire.begin(2); // join i2c bus with address #2
Wire.onRequest(requestEvent); // register event
}

void loop()
{
delay(100);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent()
{
Wire.write("hello "); // respond with message of 6 bytes
// as expected by master
}

At this point we are not sure what we need to do in LabView....any assistance will be greatly appreciated.
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2014, 22:52
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Arduino with LabVIEW

The I2C functions are in the Communications function subpalette (found in the WPI Robotics Library). Each one has reasonably good built-in help. Press CTRL-H to toggle the "hover help" window on and off.

Quote:
Originally Posted by bjackson2016 View Post
Our team has decided to use an Arduino with a gyroscope to navigate in autonomous.
What kind of gyroscope? Why not connect it directly the cRIO without involving a coprocessor?
Reply With Quote
  #5   Spotlight this post!  
Unread 23-01-2014, 22:53
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: Arduino with LabVIEW

Now, in Labview, go to WPI Robotics Library > Communications > I2C and use what you need!
__________________
Per Audacia Ad Astra
Reply With Quote
  #6   Spotlight this post!  
Unread 23-01-2014, 22:58
randantor randantor is offline
Registered User
AKA: James Y
FRC #0624 (CRyptonite)
Team Role: Alumni
 
Join Date: Jun 2013
Rookie Year: 2012
Location: Katy, TX
Posts: 48
randantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of light
Re: Arduino with LabVIEW

You can find the I2C VIs under the "communications" section of the WPILib palette.

Using I2C between an arduino and LabVIEW is ...odd to say the least. It's pretty poorly documented and there are pitfalls that can cost you a lot of time just trying to get it to work. The library is set up for i2c sensors, so it has this concept of "registers".

Basically when writing to a device, you give it a "register address", which is actually just a byte that is sent before the rest of the data. For example if you told LabVIEW to send the bytes 0xFF 0xFF to register 0x01, the data that would actually be sent would be [0x01, 0xFF, 0xFF]. If you are writing to an arduino, you can treat the register as just a slot for the first byte. Additionally, you can only send 8 bytes (the register byte and 7 data bytes) at a time. Any extra bytes passed to the write VI are silently discarded.

When reading from a slave, there is again a "register". This time it is a byte array that is sent to the i2c slave right before reading from it. I believe you can simply pass it a 0-length array if you don't want to send any data before reading, though I haven't tried it.

A major thing to be aware of is the fact that an i2c address set on an arduino needs to be shifted one bit to the left when set on the cRIO. For example, in your arduino code, you have the address set to 2; you will need to set it to 4 on the cRIO code if you want them to actually communicate.

When writing to an arduino slave, you should set "CompatibilityMode" to true.

I noticed your adruino code also sent 6 bytes to the cRIO. It seems the cRIO is only capable of reading 4 bytes at a time, so you should be aware of that.
Reply With Quote
  #7   Spotlight this post!  
Unread 24-01-2014, 18:21
bjackson2016's Avatar
bjackson2016 bjackson2016 is offline
Website
FRC #1111 (Power Hawks Robotics)
Team Role: Webmaster
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Crofton MD
Posts: 6
bjackson2016 is an unknown quantity at this point
Re: Arduino with LabVIEW

Quote:
Originally Posted by Invictus3593 View Post
Now, in Labview, go to WPI Robotics Library > Communications > I2C and use what you need!
We are trying to figure out how to use those blocks, we know where they are but not how to use them to get data from an arduino.
Reply With Quote
  #8   Spotlight this post!  
Unread 24-01-2014, 18:59
bjackson2016's Avatar
bjackson2016 bjackson2016 is offline
Website
FRC #1111 (Power Hawks Robotics)
Team Role: Webmaster
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Crofton MD
Posts: 6
bjackson2016 is an unknown quantity at this point
Re: Arduino with LabVIEW

Quote:
Originally Posted by Joe Ross View Post
If you couldn't get any of them to work, it would be helpful to post your Arduino code and your LabVIEW code.
We tried all of them and could not get any to work. We want to use I2C because it looked closest to working.

Last edited by bjackson2016 : 24-01-2014 at 19:07. Reason: images did not work
Reply With Quote
  #9   Spotlight this post!  
Unread 24-01-2014, 20:05
bjackson2016's Avatar
bjackson2016 bjackson2016 is offline
Website
FRC #1111 (Power Hawks Robotics)
Team Role: Webmaster
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Crofton MD
Posts: 6
bjackson2016 is an unknown quantity at this point
Re: Arduino with LabVIEW

Quote:
Originally Posted by Alan Anderson View Post
What kind of gyroscope? Why not connect it directly the cRIO without involving a coprocessor?
It is a 2013 Pololu with 5 pins. I do not know what any of the other text means... imu02a OJ7211.
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 21:06.

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