You infrared my mind.
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2014, 11:15
Laxkief9098 Laxkief9098 is offline
Registered User
FRC #4557
 
Join Date: Jan 2014
Location: Connecticut
Posts: 17
Laxkief9098 is an unknown quantity at this point
Connecting a Arduino to a cRio to control LEDs

We are trying to use LEDs on our robot, so we purchased the LED kit on AndyMark which includes an Arduino controller (an ATMega328). we also downloaded the Aduino library for labview. In the LED examples there were a couple terminals in the initialize VI that I had a few questions about.
1) What is the VISA resource?
2) What is a XBEE connection and where is the serial port that I can connect the Arduino to the cRio?
  #2   Spotlight this post!  
Unread 18-02-2014, 13:19
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Connecting a Arduino to a cRio to control LEDs

VISA is a communication abstraction that is most likely wrapping serial communications for your device. The example code should demonstrate how you specify the serial port to use.

Greg McKaskle
  #3   Spotlight this post!  
Unread 18-02-2014, 13:40
Laxkief9098 Laxkief9098 is offline
Registered User
FRC #4557
 
Join Date: Jan 2014
Location: Connecticut
Posts: 17
Laxkief9098 is an unknown quantity at this point
Re: Connecting a Arduino to a cRio to control LEDs

The example code only shows how to connect the arduino with the LEDs not the arduino micro-controller to the cRio. Some of my team believes that the miro-controller is not the same as an arduino controller. Would this make a difference because when we try to load the LabView base sketch onto the arduino it gives us a sync error.
  #4   Spotlight this post!  
Unread 18-02-2014, 13:41
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,389
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Connecting a Arduino to a cRio to control LEDs

We are using an Arduino Pro Mini to control a strip of 26 addressable LEDs. We we are using 4 DIO pins from the DSC to connect to 4 DIO pins on the Arduino. The strip gives our drivers a visual relative distance indication.
Although we could set up 16 different patterns, each indicating distance, we are only using 8. We have found that finer resolution of distance is just not needed.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #5   Spotlight this post!  
Unread 18-02-2014, 17:05
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 102
sparkytwd will become famous soon enough
Re: Connecting a Arduino to a cRio to control LEDs

Last year we used I2C to successfully control an Arduino.

You can see the Java command here: https://github.com/Team3574/RKellyBo...ems/Bling.java

And the Arduino code here:

https://github.com/Team3574/RKellyBo...hoot/shoot.ino

Note the address used by the cRio is 2 * the address used on the arduino.

If you choose i2c, you will also need to use the ribbon cable to connect the cRio to the digital breakout.
  #6   Spotlight this post!  
Unread 19-02-2014, 16:09
Laxkief9098 Laxkief9098 is offline
Registered User
FRC #4557
 
Join Date: Jan 2014
Location: Connecticut
Posts: 17
Laxkief9098 is an unknown quantity at this point
Re: Connecting a Arduino to a cRio to control LEDs

I still cannot figure out how to use the arduino Atmega 328 micro controller in conjunction with LabView and the cRio to control the 8.2 ft Led light string.
  #7   Spotlight this post!  
Unread 19-02-2014, 17:36
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,389
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Connecting a Arduino to a cRio to control LEDs

Quote:
Originally Posted by Laxkief9098 View Post
I still cannot figure out how to use the arduino Atmega 328 micro controller in conjunction with LabView and the cRio to control the 8.2 ft Led light string.
I have not tried using LabView with an Arduino of any flavor, although I know it is possible.

We are running our Arduino as a stand alone device that is programmed in the Arduino IDE.
We "communicate" with it by simply using the digital inputs on the Arduino connected to digital outputs on the DSC.
The Arduino code just looks at the state of the digital inputs and runs the code associated with their state(s).
The Digital Outputs from the cRio (DSC) are boolean outputs, either HIGH or LOW.
There are multiple ways to communicate with the Arduino from the cRio. Just choose a process you understand.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #8   Spotlight this post!  
Unread 19-02-2014, 21:48
MikeE's Avatar
MikeE MikeE is offline
Wrecking nice beaches since 1990
no team (Volunteer)
Team Role: Engineer
 
Join Date: Nov 2008
Rookie Year: 2008
Location: New England -> Alaska
Posts: 381
MikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond repute
Re: Connecting a Arduino to a cRio to control LEDs

Quote:
Originally Posted by billbo911 View Post
We "communicate" with it by simply using the digital inputs on the Arduino connected to digital outputs on the DSC.
The Arduino code just looks at the state of the digital inputs and runs the code associated with their state(s).
The Digital Outputs from the cRio (DSC) are boolean outputs, either HIGH or LOW.
Last year we also used digital outputs from the DSC for state and PWM outputs from the DSC to transmit continuous values. The continuous values allowed us to display wheel speed as a moving bar graph on LED strips attached to the robot. It was also a handy visual to verify that the encoders were working.
The Arduino code is on our Google Code repository

Last edited by MikeE : 19-02-2014 at 21:53. Reason: grammah
  #9   Spotlight this post!  
Unread 20-02-2014, 16:00
rben13 rben13 is offline
Registered User
FRC #1153 (Walpole Rebels)
Team Role: Coach
 
Join Date: Feb 2014
Rookie Year: 2013
Location: United States
Posts: 4
rben13 is an unknown quantity at this point
Re: Connecting a Arduino to a cRio to control LEDs

Quote:
Originally Posted by Laxkief9098 View Post
We are trying to use LEDs on our robot, so we purchased the LED kit on AndyMark which includes an Arduino controller (an ATMega328). we also downloaded the Aduino library for labview. In the LED examples there were a couple terminals in the initialize VI that I had a few questions about.
1) What is the VISA resource?
2) What is a XBEE connection and where is the serial port that I can connect the Arduino to the cRio?
We're trying to do the same thing and running into the same problem of not knowing what VISA Resource Name to use. I assume we need to know the name that indicates the RS232 port on the cRIO.

XBEE makes a series of little radios that you can communicate over as if they are RS232 Serial ports. They are commonly used in small robots to provide a link back to a controlling computer or in a mesh network.

While there are other good ways to communicate between the cRIO and the Arduino, including I2C and GPIO lines, I'd prefer to use RS232 because we're actually controlling a 32x32 array of LEDs and would like to let the cRIO send us strings to display on the array.

So, please, if anyone out there knows how to make this work, please post a reply. If I figure it out, I'll post a reply here, myself.

Ray
  #10   Spotlight this post!  
Unread 21-02-2014, 05:12
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,780
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Connecting a Arduino to a cRio to control LEDs

Try "COM1" without the quotes. That is what you would commonly use on the desktop and is the example given when you hover over a VISA refnum or terminal.

That is actually an alias for "ASRL1::INSTR", which is the full name that VISA uses to describe the serial port.

For more documentation, here is a VISA manual. http://www.ni.com/pdf/manuals/370423a.pdf

Serial ports addresses are on page 18 of chapter 9.

Greg McKaskle
  #11   Spotlight this post!  
Unread 22-02-2014, 20:04
rben13 rben13 is offline
Registered User
FRC #1153 (Walpole Rebels)
Team Role: Coach
 
Join Date: Feb 2014
Rookie Year: 2013
Location: United States
Posts: 4
rben13 is an unknown quantity at this point
Re: Connecting a Arduino to a cRio to control LEDs

I finally discovered how to get the cRIO to talk to the Arduino. Well, actually, I found someone who knew who sent me some example code that was very helpful.

The key is to use the Serial library that's in the WPI Library, not the one in the instrument library. Once you know that, it's pretty easy to figure out the rest. Set your serial port up to whatever baud rate you plan to use, configure to 8-bits, no parity, 1 stop bit. We have very short messages so had no need for flow control. To send messages from the cRIO to the Arduino, I'm sending single characters followed by a newline and then flushing the buffer.

If you're using an Arduino Uno or equivalent, you just read and write to the Serial port just as if you were doing so for the Serial Monitor in the IDE. Since we're using an Arduino Mega 2560, which also has hardware support for Serial1, Serial2, and Serial3, we're using Serial1 so we can still use Serial to send diagnostic messages to the Monitor.

I'm going to set up an Instructable or something to make this a little easier. I'll post here when that's done.

Good Luck,
Ray
Closed Thread


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 08:50.

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