The RFID Rover can find its way around a predefined track using my RFID-reader, a light sensor and the Hitechnic compass sensor. A track consists of a number of waypoints/RFID-tag. Along with the layout of the track the direction/angle between the waypoints are descried in the Rovers program. When the RFID Rover reads a waypoint it knows where it is and which direction/angle to drive towards to reach the desired waypoint. To hold the correct direction when driving between two waypoints the RFID-Rover uses a compass sensor. Since the compass sensor is sensitive to magnetic disturbance from TV-sets, refrigerators and the likes, the RFID-tags are mounted on a black mat which the Rover can detect with the light sensor. This makes it easier for the Rover to find the RFID-tag even when the compass sensor is thrown off. Using a Bluetooth web-interface it is possible to add a task to the Rovers queue. A task simply tells which waypoint you want the Rover to go to. With the web-interface you can also remove tasks from the RFID Rover and see the Rovers queue. The system is illustrated on the image above. The web-interface is written in PHP while the program for the RFID-Rover is written in NXC - both programs are descried in more detail below. For this project I build two tracks – a track to make the Rover drive around my apartment and a square track with four waypoints. Below you will find video clips of the Rover driving around the apartment track.
Programming The Rover
The program is written in NXC and it’s flow is illustrated on the left. If there is a task in the queue the RFID-tag is read and the direction is calculated based on the target RFID-tag. Then the Rover will spin towards the direction of the next waypoint and drive forwards until it finds a waypoint. While on the waypoint the Rover will “look” for the RFID-tag either by driver strait thru or by spinning left and right. Finding the next waypoint/RFID-tag will be done over and over until the RFID-tag read equals the target RFID-tag. When this is the case the task is removed from the queue and the Rover executes the next task. If the queue is empty the Rover will turn off the RFID-antenna and light sensor while waiting for a new task.
Programming The Web-interface
The web-interface is written in PHP. Since my web-server is running on a Windows box I used the serial dll file from TheByteWorks to make PHP write and read from a serial port. To send data between the web-server and the RFID-Rover I wrote set of PHP functions that uses the NXT’s build in mailbox system. Mailbox 0 is used to send commands to the Rover while mailbox 1 is used to retrieve the queue. Each byte in the queue mailbox represents a task/waypoint that you want the Rover to go to – an empty task is represented by 0xff. The web-server can send two commands to the RFID Rover. In the table below the two commands are listed.
|Command||Byte 0||Byte 1||Action||Reply|
|Add to queue||0×01||waypoint to go to||Adds a task to the Rovers queue||Task added
|Remove from queue||0×02||task to remove||Removes a task from the Rovers queue||Task is removed
Task not found