Remote Control (advanced)

From FIRE Wiki
(Redirected from Remote Control (part 2))
Jump to: navigation, search

Project Description

This multi-robot project demonstrates wireless remote control of 2 robots with robot selection . One NXT master controller is equipped with 2 touch sensors a selector switch and acts as the transmitting controller. The touch sensors wirelessly control the right and left motors of one of two NXT robot and the selector switch on the controller determines which of 2 robots will be controlled.


Topics covered in this project:

  • Use of touch sensor interfacing and calibration.
  • Use of motor encoders and understanding mathematical and mechanical relationship between encoder counts and motor position.
  • Transmitting and Receiving Data from an RS-485 Device (NXTBee)
  • Using External Libraries
  • Formatting strings

User Notes

Note: The concepts outlined in this lesson are geared towards an intermediate user of ROBOTC and C Programming languages. Students should be comfortable with all material covered in the Teaching ROBOTC for MINDSTORMS curriculum before jumping into any Multi-Robot communication lessons.

  • Remember when using Multi-Robot communications to always start the robot that is the receiver first. Otherwise, the receiving robot will not be listening when the sending robot broadcasts it's message. However since this lab introduces a continuous stream of messages being sent and received, it does not matter which program is started first.

Hardware and Software Required



  • The NXT controller (master) consists of a NXT brick with 2 touch sensors and a motor. The motor has an attached gear or lever that can be operated (turned) by the user to select one of the two robots to control. It is meant to be a handheld controller and does not have motors attached.
  • The 2 NXT slave robots are standard NXT robots with right and left motors. There are no sensors on these robots.
  • Each of the 3 devices/robots is equipped with an Xbee radio module.


  • The goal of the master controller code is to monitor the state of the touch sensors (using a loop) and also the position of the lever or gear (as determined by the encoder value) and continuously send string commands to the slave robots based on the the state of the touch sensors. If the gear or lever (motor) is turned CW from the start position, then robot 1 will be controlled by the touch sensors (and Robot 2 will not respond). Conversely, if the lever is moved CCW from the start position, then robot 2 will be controlled by the touch sensors (and Robot 1 will not respond) If the right touch sensor of the controller (master) is pressed, then the right motor of the selected slave robot will move forward. If the left touch sensor of the controller (master)is pressed, then the left motor of the selected slave robot will move forward. If both touch sensors are pressed on the controller, both the right and left motors of the selected slave robot will move forward. If neither touch sensor is pressed on the controller, then the selected slave robot stops.
  • The goal of the slave robot is to repeatedly await wireless commands from the controller (using a loop), identify the commands, determine if the received commands are designated for this particular robot, and then take the appropriate motor action based on the command received.


Master Controller Source Code

Slave Robot 1 Source Code

Slave Robot 2 Source Code

Follow-up Project - Remote control of speed and direction of a robot

Goal: Extend the remote control project above to allow the the wheel of a NXT robot to control the speed and direction of another robot. As the wheel of the controller is manually moved CW from the center position, the slave robot will move forward with a speed which is dependent on the amount the controlling wheel is turned from the center position. The more the wheel is turned, the faster the slave robot will travel. The operation is reversed (direction of robot is reversed) when the wheel of the controller robot is turned in the opposite direction from the center position. Here is a video demonstrating the project.

Video (for Follow-up Project)

More Follow-up Projects and Discussion Questions

  1. Expand control to 3 or more slave robots and observe behavior.
  2. Combine results of the main challenge and the follow-up challenge to selectively control a robot and also control its speed.
  3. What impact does a time delay in the loops of the master and slave code have on the response and performance? How can this be improved?
  4. Modify the speed (and/or direction) in one or both of the slave robots. What behavior do you expect? Test.
  5. Create, design, and test your own handheld robot controller. What features make the robot controller easy to use?
  6. Add more features to control from the master controller beyond robot motion, such as arms and actuators on the robots. Be creative.
  7. Create, test, demonstrate and share your own challenge or application based on this technology.
  8. What are some real-world applications of this technology?