|
Re: Using an Arduino w/ a RoboRIO
We, Team 1258, used an Arduino last season to measure the distance from the target to shoot the big ball. It worked very well. It started when we were getting flakey (inaccurate) distance readings from the analog output of the Maxbotix sonar module. We wanted to measure 8 feet ... consistently and accurately for our autonomous and to assist the operator during teleop.
We mounted the Arduino and Maxbotix module in a sturdy polycarb box and powered it from a 12v branch circuit. The box was oriented toward the front of the robot. We gave up on the Maxbotix analog output and, instead, used the serial output. That complicated the Arduino code a bit but we began to get very accurate distance readings. You connect the Maxbotix serial TX output to the Arduino's RX input or pin 0. Then we used softserial for the Arduino.
Please understand that other teams claimed to get very accurate Maxbotix distance readings from the analog output. They simply connect it to the analog input of the cRIO or roboRIO and they are good to go. We did not have that experience so we used the serial output instead.
When the Arduino/Maxbotix read 8 ft, it would raise the Arduino digital I/O pin ( I choose pin 4) to high. This pin was connected to one of the cRIO's (last season, right?) digital I/O inputs, DIO1. Very important: connect the Arduino ground to the Maxbotix ground then to the DIO ground. I believe the software team created a task in the robot code to keep track of that pin, DIO 1, to "know" when the robot was 8 ft from the target for shooting the ball. We also controlled some lights (old cold cathode lights from ? 2006 target) to light when 8 ft was reached. We used Spikes to control the lights. Note: they are not LEDs. Also note that I am not on the software team. I wrote only the Arduino code.
It is very easy to add an Arduino or any other small single board computer to the robot. roboRIO connections would be the same. Be sure that all the grounds are common or connected together. No need to connect them to the 12v bus negative. Just to the roboRIO and any sensors like the Maxbotix.
The advantages of this setup are: 1. very simple communication between sensor (Maxbotix sonar) and robot controller, 2. off loads cpu cycles by keeping the Arduino busy rather than the cRIO (or roboRIO), 3. creates a module that can be moved from robot to robot in the coming seasons, 4. cheap parts and easy to purchase from multiple sources, 5. doesn't require the MXP port but our plan is to get acquainted with it for the future and lastly, 6. we won the Innovation in Control award at our first competition.
I would be happy to share the Arduino code. Also, I would be interested in similar ideas that you are willing to share.
-Larry
Team 1258 electrical mentor
|