OCCRA
Go to Post I'd just give you the URL, but then you wouldn't learn to look for yourself. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 02-02-2017, 09:41 PM
darklink2458 darklink2458 is offline
Registered User
FRC #4915 (Spartronics)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2015
Location: WA
Posts: 6
darklink2458 is an unknown quantity at this point
Arduino Communication with Roborio

We have an arduino that runs the lights on our teams robot. We were wondering if there is a way to have the arduino react to commands made from the driver station. Thanks for any help you can provide.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2017, 09:47 PM
elijah1111's Avatar
elijah1111 elijah1111 is offline
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 39
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

what do you mean by the driver station commands? what you could do you could use a pwm line or dio from the roborio to the ardouino and read it there
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2017, 09:48 PM
skidad68 skidad68 is offline
Registered User
FRC #2506
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2013
Location: United States
Posts: 14
skidad68 is an unknown quantity at this point
Re: Arduino Communication with Roborio

You can have the Driver Station talk to the roboRIO, and then have the roboRIO talk to the Arduino using the serial port or I2C.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2017, 09:51 PM
elijah1111's Avatar
elijah1111 elijah1111 is offline
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 39
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

Quote:
Originally Posted by skidad68 View Post
You can have the Driver Station talk to the roboRIO, and then have the roboRIO talk to the Arduino using the serial port or I2C.
How complicated of lighting are we talking here? Would a simple PWM line or DIO not suffice. Just have the roborio output a PWM wave to the arduino to read then you could have your various lighting settings based on the PWM signals.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2017, 10:13 PM
elijah1111's Avatar
elijah1111 elijah1111 is offline
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 39
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

I would do something like this on arduino side, you could also have multiple pwm values for diffrent lights if you wanted it to.
Code:
float PWMsignal;//the signal from the roborio
void setup() {
  // put your setup code here, to run once:

PWMsignal=0;//intilizes signal

Serial.begin(9600);//syncs up serial output
}

void loop() {
  // put your main code here, to run repeatedly:
  PWMsignal=analogRead(3);//reads the pwm value for pin 3

  if(PWMsignal=42){//if its whatever pwm value you want turn pin 4 on
    digitalWrite(4,HIGH);
  }
  else{
    digitalWrite(4,LOW);
  }
Serial.println(PWMsignal);//outputs value to serial port
}
Reply With Quote
  #6   Spotlight this post!  
Unread 02-03-2017, 07:37 AM
euhlmann's Avatar
euhlmann euhlmann is offline
Alum
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Alumni
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 453
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Arduino Communication with Roborio

Quote:
Originally Posted by elijah1111 View Post
Code:
float PWMsignal;
// ...
if(PWMsignal=42)
// ...
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #7   Spotlight this post!  
Unread 02-03-2017, 11:03 AM
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,134
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Arduino Communication with Roborio

Quote:
Originally Posted by euhlmann View Post
indeed

Code:
int PWMsignal;
// ...
if (PWMsignal == 42)
// ...
I would say that using that method would be highly susceptible to problems. You're relying on some undefined capacitance on the analog pin of the Arduino, cabling, and RoboRIO's PWM pins. You can use I2C, SPI, UART, or UDP/TCP if you get an Ethernet shield.

Another dead simple way would be to use some DIO as outputs. You can have 2^n modes where n is the number of outputs you use.

From Easy to Hard (my opinion of course):
DIO, UART, TCP/UDP, I2C
__________________
Controls Mentor
@rnazaretian

Current team:
Team Appreciate, FRC 2468

Previous teams:
Team Fusion, FRC 364 (2003 - 2015)
Garnet Squadron, FRC 4901 (2015-2016)

Last edited by RyanN : 02-03-2017 at 11:08 AM.
Reply With Quote
  #8   Spotlight this post!  
Unread 10-07-2017, 03:48 PM
erit1566 erit1566 is offline
Registered User
FRC #4198
 
Join Date: Mar 2017
Location: waconia mn
Posts: 4
erit1566 is an unknown quantity at this point
Re: Arduino Communication with Roborio

what would the code be on the roborio? we are using java.
Reply With Quote
  #9   Spotlight this post!  
Unread 10-07-2017, 07:47 PM
WSiggs WSiggs is offline
Pb Programmer
FRC #4908 (Dragons)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Duxbury Massachusetts
Posts: 43
WSiggs is on a distinguished road
Re: Arduino Communication with Roborio

Quote:
Originally Posted by skidad68 View Post
You can have the Driver Station talk to the roboRIO, and then have the roboRIO talk to the Arduino using the serial port or I2C.
I would definitely recommended this - WPIs I2C wrapper is well documented, as is the Wire library for arduino. The approach I have taken before is to manually enable bits in a single byte to represent certain states like the current mode or alliance, as well as any custom flags I had set like if certain buttons were pressed on a joystick, and then simply sent that byte of data over the I2C bus and had the arduino read that data and process it in a similar way. I have an example of this on github if you would like to see this in practice.
Reply With Quote
  #10   Spotlight this post!  
Unread 10-07-2017, 08:32 PM
TylerHarmon's Avatar
TylerHarmon TylerHarmon is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Westminster, CO
Posts: 39
TylerHarmon is an unknown quantity at this point
Re: Arduino Communication with Roborio

Quote:
Originally Posted by darklink2458 View Post
We have an arduino that runs the lights on our teams robot. We were wondering if there is a way to have the arduino react to commands made from the driver station. Thanks for any help you can provide.
Honestly the easiest way would be to keep it digital. My team did this last year, and although we didn't implement it totally on the robot, it completely worked and was pretty cool.

Basically we just ran an alarm wire (4 wires + 1 ground) from the arduino to the roborio. The 4 digital pins that we used allowed 2^4 = 16 lighting modes. We could easily write to the digital pins on the roborio, and the arduino would simply react by reading the digital inputs.

Not nearly as robust as an analog/protocol system, but super simple and easy to implement.
Reply With Quote
  #11   Spotlight this post!  
Unread 10-08-2017, 12:49 AM
erit1566 erit1566 is offline
Registered User
FRC #4198
 
Join Date: Mar 2017
Location: waconia mn
Posts: 4
erit1566 is an unknown quantity at this point
Re: Arduino Communication with Roborio

Quote:
Originally Posted by TylerHarmon View Post
Honestly the easiest way would be to keep it digital. My team did this last year, and although we didn't implement it totally on the robot, it completely worked and was pretty cool.

Basically we just ran an alarm wire (4 wires + 1 ground) from the arduino to the roborio. The 4 digital pins that we used allowed 2^4 = 16 lighting modes. We could easily write to the digital pins on the roborio, and the arduino would simply react by reading the digital inputs.

Not nearly as robust as an analog/protocol system, but super simple and easy to implement.
how does one set the digital pins to high from the roborio?
Reply With Quote
  #12   Spotlight this post!  
Unread 10-08-2017, 02:28 PM
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,199
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Arduino Communication with Roborio

Quote:
Originally Posted by erit1566 View Post
how does one set the digital pins to high from the roborio?
DigitalOutput.set(true); in Java, where DigitalOutput is a properly constructed DigitalOutput object. C++ should be similar.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2017 FIRST Championship Daly Division | 2017 Seven Rivers Regional Chairman's Award | 2017 Wisconsin Regional Dean's List Finalist (Grace Fanson)

2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

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 03:56 PM.

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