Log in

View Full Version : Simplest way to communicate Arduino to cRIO?


Fej
23-03-2014, 22:58
Question's in the title - what is the easiest and simplest way to send data from an Arduino (Uno) to a cRIO?

I've heard some about I2C, I've used it before (not in FRC) but it seems overkill just to send a few bytes.

Bit banging? It's possible. No experience there though. Might be a bit too slow (as far as I know there is no way to get time from the cRIO in increments <1ms).

Thanks guys!

geomapguy
23-03-2014, 23:00
Question's in the title - what is the easiest and simplest way to send data from an Arduino (Uno) to a cRIO?

I've heard some about I2C, I've used it before (not in FRC) but it seems overkill just to send a few bytes.

Bit banging? It's possible. No experience there though. Might be a bit too slow (as far as I know there is no way to get time from the cRIO in increments <1ms).

Thanks guys!

Depends on what you want to send.....but you could just use DIO

joeyoravec
23-03-2014, 23:12
Question's in the title - what is the easiest and simplest way to send data from an Arduino (Uno) to a cRIO?
Purchase the ethernet shield, connect using your D-Link router, and send UDP ethernet messages back-and-forth. This is what we're using for the Andy Mark LED lighting kit.

tStano
23-03-2014, 23:15
Would using several sidecar relay slots fed to inputs on the arduino work? You could use x of them to make an x-bit number. If you aren't doing complex calculations between the two, and just doing something like what light routine to run, I think that'd be good.

I suggest the relay slots because of how unlikely it is you're using all of them, but I'm not entirely sure how that signal works. I'm more sure of the DIO, but you're prolly using lots of those for other things already.

You could also use the solenoid breakout and module instead of relay channels on the sidecar, and in the same way, I'm sure that would work.

Alan Anderson
23-03-2014, 23:32
Would using several sidecar relay slots fed to inputs on the arduino work?

No, because the relay outputs are only outputs, and Arduino inputs are inputs, and that would only get data from the cRIO to the Arduino. The question is about sending data in the other direction.

The simplest way is to use as many DIO inputs on the Digital Sidecar as you need to communicate the necessary data. Sometimes that might be a single bit, giving the answer to the question "Am I facing a hot goal right now?"

Fej
24-03-2014, 11:04
I need to send around 8 bytes worth of data. Obviously, there aren't that many DIO pins available. As for communicating via ethernet, we only have one port left open on our router and it is used for tethering when needed. Other two are an RPi and an Axis camera.

I could use the Pi instead of an Arduino, but I'm not familiar with the Pi really :(

SteveGarward
24-03-2014, 11:37
I2C would likely be the easiest for 8 bytes of data. On the Arduino side, the Wire library makes it very easy. On the robot/cRIO side, the libraries provided make it simple too. You also only need 3 wires, and it frees up all your DIO for other purposes.

Mike Bortfeldt
24-03-2014, 13:36
Fej,

There are several ways I can think of to communicate between an Arduino and the cRIO. None of which are probably as easy as you would like.

1) RS-232 - Although you may need a level shifter on the signal lines
2) Ethernet (as mentioned earlier)
3) I2C - Note that the cRIO limits the message length to 7 bytes, so you would need to split up your communication into two transactions. The cRIO must also be the Master.

Mike

slibert
26-03-2014, 12:16
My 2c:

The nav6 open-source IMU (http://code.google.com/p/nav6) we developed is basically an Arduino UNO plus some ICs (gyro/accelerometer/magnetometer); after lots of experimenting during development, we found the simplest thing that could possibly work for communication was the RS-232 serial port.

This requires a USB to RS-232 converter serial cable, which is easily available.

As others have noted, I2C/SPI are also possible, but in my experience the code on the Arduino side (to be a I2C/SPI "slave" that receives messages and responds) is more complicated than receiving/responding to messages over the serial port.

Add to this that serial communication is much more easily debugged via a serial monitor like that provided in the Arduino IDE.

The only downside we found is that the WPI Library SerialPort class (in Java, specifically) had some bugs requiring some workarounds.

Next year, the advent of the RoboRIO will change this recommendation to: USB. This will provide both power and signal connections in a single, inexpensive cable, and the bandwidth should be the same or higher.