RoboSlam robot with remote control

Damon and I are preparing a couple of RoboSlam robots to be exhibited at the DIT Open Day on Saturday. I decided to modify one of our bots by adding a very inexpensive IR receiver (GP1UX310QS, €0.61 from Farnell at time of writing) to facilitate rudimentary remote control using a TV remote handset.

Modified RoboSlam robot with IR receiver and remote control handset

Check out the video:

The robot basically cycles through three states:

  1. Forward: both motors forwards,
  2. Spin left: left motor forward, right motor reverse,
  3. Spin right: left motor reverse, right motor forward.

The state changes whenever an infrared carrier signal is detected, i.e. whenever you press a button on the remote control. The remote control handset I’m using is from the local 2 Euro shop.

This is the code used on the robot:

// IR remote control RoboSimo mod
// Written by Ted Burke - 4-12-2013
// Code is for MSP430G2452 or MSP430G2553
// This robot's behaviour is controlled by a simple
// 3-state model. It just cycles through the states
// moving on to the next state whenever an IR carrier
// signal is detected. Pressing any button on a TV
// remote control will trigger a state transition.
//   State 1 is forwards
//   State 2 is spin left
//   State 3 is spin right 
#include <msp430.h>
int main( void )
    // Stop watchdog timer to prevent time out reset
    // Set P2.0-4 as outputs
    // P2.0 and P2.1 control the left motor
    // P2.2 and P2.3 control the right motor
    // P2.4 controls the LED
    P2DIR = 0b00011111;
    // State loop - basically cycle through three states
    // changing state whenever an IR transmission is
    // detected. A 100ms dead time after IR detection
    // prevents a single transmission from triggering
    // more than one state transition.
    int IR;
    int state = 1;
        // IR equals 1 when the carrier signal is detected
        // and 0 the rest of the time
        IR = ((P2IN & BIT5) == 0);
        // Turn on LED when IR carrier signal is detected
        if (IR) P2OUT |= BIT4;
        else P2OUT &= ~BIT4;
        if (state == 1)
            // Both motors forward
            P2OUT = (P2OUT & ~0b1111) + 0b1010;
            if (IR)
                state = 2;
                __delay_cycles(100000); // 100ms delay
        else if (state == 2)
            // Right motor forward, left motor reverse
            P2OUT = (P2OUT & ~0b1111) + 0b1001;
            if (IR)
                state = 3;
                __delay_cycles(100000); // 100ms delay
        else if (state == 3)
            // Left motor forward, right motor reverse
            P2OUT = (P2OUT & ~0b1111) + 0b0110;
            if (IR)
                state = 1;
                __delay_cycles(100000); // 100ms delay
    return 0;

Here’s a close-up view of the breadboard circuit:

Close-up view of the modified RoboSlam breadboard circuit, including IR receiver

Modified RoboSlam robot with IR receiver and remote control handset

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s