Go to Post Fancy that, better robots winning matches... - DampRobot [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 04-08-2014, 22:57
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Arduino + CRIO

How can I get an arduino and a crio to communicate with each other. My goal is for the arduino to send information to the crio in some way and the crio will use the data values sent and perform tasks with the robot that correspond with the data sent. Is this able to be done through network tables or how could it be done? Thanks!
__________________
Reply With Quote
  #2   Spotlight this post!  
Unread 05-08-2014, 07:32
Gdeaver Gdeaver is online now
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Arduino + CRIO

The Arduino can be an I2C slave. Use serial or the lan UDP. Lan solution needs a lan board.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-08-2014, 10:12
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,580
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: Arduino + CRIO

I've personally never tried it. However, I know that it is possible. People use Arduino devices to control LED circuits controlled by the cRIO all the time.

Depending on what kind of information you want to send back to the cRIO I could potentially help you further. I do use Arduino a lot in my University lab classes so I'm familiar with almost all aspects of it. I2C is the first thing that would come to mind in terms of communication, and I think the LAN board solution...might work. I'll be testing both once I get the RoboRIO for future knowledge on that front as well.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #4   Spotlight this post!  
Unread 05-08-2014, 10:39
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,072
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Arduino + CRIO

Quote:
Originally Posted by JohnFogarty View Post
I've personally never tried it. However, I know that it is possible. People use Arduino devices to control LED circuits controlled by the cRIO all the time.

Depending on what kind of information you want to send back to the cRIO I could potentially help you further. I do use Arduino a lot in my University lab classes so I'm familiar with almost all aspects of it. I2C is the first thing that would come to mind in terms of communication, and I think the LAN board solution...might work. I'll be testing both once I get the RoboRIO for future knowledge on that front as well.
The RoboRIO can also act as a USB host if I recall. I'd like to hear if that works.

Pretty please with LEDs on top?
__________________




.
Reply With Quote
  #5   Spotlight this post!  
Unread 05-08-2014, 10:58
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Arduino + CRIO

When we did LEDs in 2013 we just used a few DIO pins to send different combinations to IO pins on the arduino to run different light routines.
Reply With Quote
  #6   Spotlight this post!  
Unread 05-08-2014, 14:02
RyanShoff RyanShoff is offline
Registered User
FRC #4143 (Mars Wars)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2012
Location: Metamora, IL
Posts: 147
RyanShoff is a splendid one to beholdRyanShoff is a splendid one to beholdRyanShoff is a splendid one to beholdRyanShoff is a splendid one to beholdRyanShoff is a splendid one to beholdRyanShoff is a splendid one to beholdRyanShoff is a splendid one to behold
Re: Arduino + CRIO

https://github.com/FRC-Team-4143/swerveneopixel

This sketch controls Adafruit neopixel leds over i2c. I2c is echoed over serial for debugging.

Crio code (in c++) is something like:
Code:
m_i2c = DigitalModule::GetInstance(1)->GetI2C(0x04 << 1);
RobotMap::m_i2c->Write(0x0, 50);
The first 0x0 is the command. The 50 is a parameter to the command in the sketch.

The i2c address is 0x4, but you have to shift it left on the Crio to write. That is the tricky part.
__________________
Ryan Shoff
4143 Mars/Wars
CheapGears.com

Last edited by RyanShoff : 05-08-2014 at 14:11. Reason: changed parameter to not get confused with address
Reply With Quote
  #7   Spotlight this post!  
Unread 05-08-2014, 14:27
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Arduino + CRIO

Quote:
Originally Posted by RyanShoff View Post

The 7-bit i2c address is 0x4, but you have to shift it left on the Crio to write because the cRIO code uses 8-bit I2C addressing and you're performing a write which is LSB = 0. That is the tricky part.
Added some detail about addressing for anyone curious why what Ryan posted is true.
Reply With Quote
  #8   Spotlight this post!  
Unread 06-08-2014, 13:24
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Arduino + CRIO

Would love to hear from anyone who has set up an Arduino as an I2C slave and sent info back and forth with the cRIO.

We simply used a few DIO to toggle between preset LED patterns.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #9   Spotlight this post!  
Unread 07-08-2014, 16:15
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 101
sparkytwd will become famous soon enough
Re: Arduino + CRIO

Quote:
Originally Posted by Mr. Lim View Post
Would love to hear from anyone who has set up an Arduino as an I2C slave and sent info back and forth with the cRIO.

We simply used a few DIO to toggle between preset LED patterns.
2013 our team used it. There's 2 things to look out for.

1. As people have already mentioned Arduino's i2c addressing hides the bottom bit, so you'll have slightly different addresses on the Arduino and CRIO

2. The round cable connecting the cRIO to the digital BO does not include the i2c connection, you'll need to use a ribbon cable.
Reply With Quote
  #10   Spotlight this post!  
Unread 08-08-2014, 09:43
orangelight's Avatar
orangelight orangelight is offline
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 168
orangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to behold
Re: Arduino + CRIO

Look at the LED.Java and Shooter_Lights.ino in are code from this year. We used it to control the lights on are arm.
__________________



Last edited by orangelight : 08-08-2014 at 09:46.
Reply With Quote
  #11   Spotlight this post!  
Unread 13-08-2014, 09:11
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: Arduino + CRIO

Quote:
Originally Posted by Mr. Lim View Post
Would love to hear from anyone who has set up an Arduino as an I2C slave and sent info back and forth with the cRIO.

We simply used a few DIO to toggle between preset LED patterns.

Mr. Lim,

This thread may help.

Mike
Reply With Quote
  #12   Spotlight this post!  
Unread 13-08-2014, 21:32
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Arduino + CRIO

We've used a serial connection between the arduino and the cRIO for the past two years. It's much simpler to set up and debug than I2C.

You will need a level converter between the cRIO, which is RS-232(can be a wide range of voltages, IIRC the 8 slot cRIO was +10, -5), and the arduino which is TTL (normal 5V logic).

I used this (http://www.ebay.com/itm/MAX232-RS232...-/221022603873) level converter board to plug directly into the cRIO. The level converter was powered with the 5V supply on the arduino, and works very well.

If you're interested, I can probably dig up the code for this.
Reply With Quote
  #13   Spotlight this post!  
Unread 24-08-2014, 18:05
Richard100 Richard100 is offline
Registered User
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Nov 2009
Rookie Year: 2008
Location: Southern Maryland
Posts: 79
Richard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to behold
Re: Arduino + CRIO

Jared - Interested in code and general wiring diagram, thanks.
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 13:03.

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