DEV Community

Cover image for Advanced TV Remote controlled robot
Rohith ND
Rohith ND

Posted on

Advanced TV Remote controlled robot

In this blog, I will show you how to build an Advanced TV Remote controlled robot with a TSOP Sensor , TV remote and an Arduino microcontroller.

circuit-arduino

Components required

  • Arudino UNO
  • TSOP Sensor
  • Gear Motors
  • IC L293D
  • TV remote

Arduino UNO

Arduino is an opensource electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor , a finger on a button , or a twitter message - and turn it into an output - activating a motor , turning on a LED , publishing something online. To do so use the Arduino programming language (based on wiring) and the Arduino Software (IDE) based on processing.

TSOP IR sensor

TSOP module is commonly found at the receiving end of an IR remote control system, such as in televisions, CD players, and so on. These modules require that the incoming data be modulated at a specific frequency and ignore any other IR signals.

tsop ir sensor

Gear Motors

It is a DC motor with a gear box for decreasing the speed and increasing the torque and power . This type of motors is commonly used for robotic applications.

IC L293D

IC L293D is a dual H-bridge motor driver integrated circuit that can drive current of up to 600mA with voltage range of 4.5 to 36 volts.

l293d

Code

int tsop = 12;
int leftmotor = 2;
int leftmotor1 = 3;
int rightmotor = 4;
int rightmotor1 = 5;
void setup() {
  Serial.begin(9600);
  pinMode(tsop, INPUT);
  pinMode(leftmotor, OUTPUT);
  pinMode(leftmotor1, OUTPUT);
  pinMode(rightmotor, OUTPUT);
  pinMode(rightmotor1, OUTPUT);

}

void loop() {
  int remote_val = remote();
  if (remote_val == 128)//no.1 in sony remote
  {
    digitalWrite(leftmotor, HIGH);
    digitalWrite(leftmotor1, LOW);
    digitalWrite(rightmotor, HIGH);
    digitalWrite(rightmotor1, LOW );
    Serial, println("forward");
  }
  if (remote_val == 129)//no.2 in sony remote
  {
    digitalWrite(leftmotor, LOW);
    digitalWrite(leftmotor1, HIGH);
    digitalWrite(rightmotor, LOW);
    digitalWrite(rightmotor1, HIGH );
    Serial, println("backward");
  }
  if (remote_val == 130)//no.3 in sony remote
  {
    digitalWrite(leftmotor, HIGH);
    digitalWrite(leftmotor1, LOW);
    digitalWrite(rightmotor, LOW);
    digitalWrite(rightmotor1, HIGH);
    Serial, println("right");
  }
  if (remote_val == 131)//no.4 in sony remote
  {
    digitalWrite(leftmotor, LOW);
    digitalWrite(leftmotor1, HIGH);
    digitalWrite(rightmotor, HIGH);
    digitalWrite(rightmotor1, LOW );
    Serial, println("left");
  }
  if (remote_val == 132)//no.5 in sony remote
  {
    digitalWrite(leftmotor, LOW);
    digitalWrite(leftmotor1, LOW);
    digitalWrite(rightmotor, LOW);
    digitalWrite(rightmotor1, LOW);
    Serial, println("stop");
  }
  int remote() {
    int value = 0;
    int time = pulseIn(tsop, LOW);
    if (time > 2000) {
      for (int counter1 = 0; counter1 < 12; counter1++) {
         if (pulseIn(12, LOW) > 1000){
        value = value + (1 << counter);
      }
    }
  }
  return value;
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)