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!

The Arduino can be an I2C slave. Use serial or the lan UDP. Lan solution needs a lan board.

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?

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.

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

Crio code (in c++) is something like:

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.

Added some detail about addressing for anyone curious why what Ryan posted is true.

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.

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.

Mr. Lim,

This thread may help.


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 ( 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.

Jared - Interested in code and general wiring diagram, thanks.