OCCRA
Go to Post Thats what makes FIRST so unique how culture and the time is reflected through our bots, but at the same time we all get along...with no problem. - Dan Richardson [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 01-16-2018, 10:01 PM
Destiny G. Destiny G. is offline
Registered User
FRC #1359
 
Join Date: Jan 2018
Location: Oregon
Posts: 1
Destiny G. is an unknown quantity at this point
Roborio and Arduino wiring

Hello my team is interested in adding lights to our robot using an Arduino Leonardo++. I have looked around on how to get the Roborio and Arduino to communicate and I got a variety of answers such as analog, I˛C, and serial. But I couldn't find anything on how to actually wire it up. Can you please help.

Thank you.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-16-2018, 10:18 PM
pkrishna3082's Avatar
pkrishna3082 pkrishna3082 is offline
love/hate relationship with swerve
AKA: Parthiv Krishna
FRC #3082 (Chicken Bot Pie) and FTC #13471 Mentor (Minnetonka)
Team Role: Leadership
 
Join Date: Mar 2017
Rookie Year: 2016
Location: Minnetonka, MN, USA
Posts: 831
pkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond reputepkrishna3082 has a reputation beyond repute
Re: Roborio and Arduino wiring

The wiring you use will depend on the protocol you decide to use. Have you decided whether you will use analog, digital, I2C, SPI, UART, etc? I think that digital may be the easiest to get started. However you need 4 wires to get 8 patterns (ground + 3 signal = 2^3 = 8). 5 wires to get 16, 6 wires for 32, etc.
__________________

“Courage cannot exist in the absence of fear.”
2010-2011: FLL 11083, 13873 (Minnetonka Silver) - Programmer
2016-: FRC 3082 (Chicken Bot Pie) - Engineering Captain, Driver, Programming Lead
2017-: FTC 13471 (Minnetonka) - Founding Mentor
Reply With Quote
  #3   Spotlight this post!  
Unread 01-16-2018, 10:58 PM
WSiggs WSiggs is offline
Pb Programmer
FRC #4908 (Dragons)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Duxbury Massachusetts
Posts: 50
WSiggs is on a distinguished road
Re: Roborio and Arduino wiring

Quote:
Originally Posted by Destiny G. View Post
Hello my team is interested in adding lights to our robot using an Arduino Leonardo++. I have looked around on how to get the Roborio and Arduino to communicate and I got a variety of answers such as analog, I˛C, and serial. But I couldn't find anything on how to actually wire it up. Can you please help.

Thank you.
As a project over the summer I used the I2C bus on the RoboRio to send commands to an Arduino UNO (wired via I2C ports on the UNO) which drove a strip of LEDs based on the command sent.

The I2C class in WPILib is fairly straightforward, and the Wire library for Arduino is even easier to use. The I2C pins on the Leonardo are 2 (SDA) and 3 (SCL). Connect these, the 3.3v and the ground pins from the Arduino to the I2C port on the Rio and you are all set.

Here is the code I used on the Rio's side to send the commands. It uses 1 integer as the data, and each of the 8 bits in the integer represent a state of the robot that I wish to reflect in the LEDs. For example, if the robot is on the blue alliance, it will enable the 0th bit (least significant bit), and if the robot is in teleop, it will enable to 1st bit.

The Arduino code simply catches the data integer and checks each bit, and tells the LEDs how to behave based on the parameters we have sent it.

I chose to send 1 integer of data because it was pretty straightforward, however, you can send multiple variables or stings of text over the I2C line, but it would be more difficult on both ends to program.

Hope this helps.

Last edited by WSiggs : 01-16-2018 at 11:00 PM.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-17-2018, 04:13 AM
renderos_17's Avatar
renderos_17 renderos_17 is offline
Registered User
AKA: Mr. Robot
FRC #2358 (Bearbotics)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Lake Zurich, IL
Posts: 3
renderos_17 is an unknown quantity at this point
Re: Roborio and Arduino wiring

I actually got code on the Rio working so that we could have it communicate with an Uno using serial over just a USB cable. This method is very simple, as the Arduino can both be powered by and communicate with the Rio using only one cable. Are you using the Leonardo++ from a past KoP? This one perhaps? I had some issues using it, I could never quite figure out why though. I opted for using an Uno instead (I had plenty at home that we could have used).

On the Arduino side, I just had it poll the serial buffer until something came in. Once the Rio sent it something, I had the Uno interpret that as some pre-defined sequence (for example, sending "B" made all of the LED strips turn blue).

Let me know if you were at all interested in seeing either the Arduino or Rio code. What language is your team using for your bot? We are a C++ team, but I'm sure it would function just as well on the Java side. Below is a link to the WPILib documentation on the SerialPort class that I used on the Rio.

http://first.wpi.edu/FRC/roborio/bet...erialPort.html
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 11:34 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi