RFID Example Project

From FIRE Wiki
Revision as of 17:07, 30 March 2011 by Tfriez (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This lab is the first example of MultiRobot Communication using ROBOTC. In this lab, we will be using two different types of robots (Arduino and NXT robots) to pass a message from one robot and have the other robot act upon that message. We will be using two Xbee Modules to communicate between the robots.

This lab’s purpose is to learn about finding a location using intelligence from the world around us. Our Arduino Robot (the Seeker) will be using an RFID sensor to find a specific RFID tag in a field and transmit the tag’s location to the NXT Robot (the Runner). The Arduino will be transmitting its telemetry (Encoder) information to the NXT, telling how far away from the starting line the RFID tag is so the NXT can travel to that location and come to a stop.

Hardware and Software Required

NXT Robot

Arduino Robot

Project Files

Teacher Notes

The concepts outlined in this lesson are geared towards a more intermediate to advanced user of ROBOTC and C Programming languages. This lesson will touch on a number of advanced topics that have not been covered in our curriculum before.

  • Sending Messages Over a Serial Connection (XBee)
  • Receiving Data from an RS-485 Device (NXTBee)
  • Receiving Data from a Serial-Based Sensor
  • Multitasking in ROBOTC
  • Working with Internal Character Buffers (Serial Ports/RS-485)
  • Using External Libraries
  • Converting Strings to Integers
  • Parsing Delimited Text

Students should be comfortable with all material covered in the Teaching ROBOTC for MINDSTORMS curriculum before jumping into any MultiRobot communication lessons. This lesson will also require students to be able to construct simple circuits. Students will be required to connect various sensors up to power supplies on the Arduino system using a breadboard. No soldering is required for this lesson, but students should still express care when working with the Arduino as incorrect wiring may render your Arduino non-functional.


Setup and Wiring

The first part of experiment is to get all of our devices connected to our Arduino Mega. In this lesson, we’ll be connecting 5 devices to the Arduino:

  • 2 VEX Robotics Quad Encoders
  • Sparkfun SerLCD Serial LCD Screen
  • Sparkfun XBee Explorer + Xbee Module
  • Parallax Serial RFID Sensor
  • Two Continuous Rotation Servos (VEX Motors)

The design of our robot is the same as the VEX Swervebot, but with only the VEX motors and VEX Encoders (no Sonar, Light, Touch, Potentiometer or VEX LCD). Instead, we’ll be replacing the VEX LCD with a breadboard.

On your breadboard, connect the encoders and motors to any non-overlapping spot on the breadboard.

Connect the regulated power (5V) and ground (GND) pins from the Arduino to the two outside rails on your Breadboard. Connect from the outside rails to all of the Black and Red ports on the Encoders and only the Black ports of the motors.

Now, connect the battery level power (Vin) to one of the motor’s Red wires, and then using a jumper, connect the powered motor’s red wire to the unpowered motor’s Red wire. Now your motors and encoders are connected to power!

The next step is to connect the signal wires of each device the Arduino. For our lesson, the wires will look as follows: Quad Encoder Right – dgtl22, dgtl23 (order does not matter yet) Quad Encoder Left – dgtl24, dgtl25 (order does not matter yet) Right Motor – dgtl2 (PWM area) Left Motor – dgtl3 (PWM area)

With the motors and encoders are connected, we can connect our serial devices.

The Xbee Explorer/Radio is pretty easy to connect. It only requires 4 wires – 5V, Ground, Serial Out, Serial In. Remember serial devices can be tricky because of the labeling of the port directions – In/Out can mean different things depending on the unit:

  • Arduino Serial 3 RX -> Xbee Explorer Serial Out
  • Arduino Serial 3 TX -> Xbee Explorer Serial In

The Sparkfun SerLCD is even easier to connect. It only requires 3 wires – 5V, Ground, Serial In – because the LCD can only receive data, not send data.

  • Arduino Serial 1 TX -> SerLCD Serial In

Lastly, the Parallax RFID sensor has 4 wires – 5v, Ground, Serial Out, RFID Enable – The RFID Enable is a digital input that enables/disables the RFID reader. This is useful because this allows us to specify when we want the reader to read, as opposed to it always sending us data.

  • Arduino Serial 2 RX -> RFID Serial Out
  • Arduino Digital Port 50 – RFID Enable Pin

Programming – Arduino

Our goal with the Arduino is to have our Arduino scan an area for a set distance and report back if it found a specific RFID tag. If it does find this specific RFID tag, it will then broadcast the location of this tag (in encoder counts traveled since it started running) to any other device listening (the NXT) by using the Xbee Radio.

Programming – NXT

Our goal with the NXT is to standby and monitor the Xbee Radio until we receive any data. Once we receive data, we’ll need to parse the serial data into useable chunks by converting and delimiting a string of data into numbers. With this parsed data, we can find out the number of encoder counts the Arduino traveled until it saw the RFID tag and have our NXT travel that same distance.



Arduino Sourcecode

Please Note: This code is under development to make it easier to use/understand. The final version of this code may not look like what is shown below.

NXT Sourcecode

Please Note: This code is under development to make it easier to use/understand. The final version of this code may not look like what is shown below.