Interfacing of RGB with IR sensor

Students Projects

Electronics

Arduino

Interfacing of RGB with IR sensor

Interfacing of RGB with IR sensor

Created By

  • Roshan Baig

    Roshan Baig

    My name is Roshan; I am 13 years old and I am in 7th standard. My hobbies are horse riding, robotics, and computer programming.

About This Project

Interfacing of RGB with IR sensor objective is to On, Off and fading RGB led from remote place using IR Remote.

The TSOP 1738 is one type of receiver which receives IR. It consists of a PIN diode and a pre amplifier which are embedded into a single package. The output of TSOP is active low and it gives +5V in off state. When IR waves, from a source, with a centre frequency of 38 kHz incident on it, its output goes low.

Components Required

  • Arduino UNO
  • RGB Diffused Common Cathode
  • IR receiver
  • Breadboard
  • Resistor 1K Ohm

Schematics

In this image all the components with the connections are given

Code Of Project

#include<IRremote.h>
int red=11;
int green=10;
int blue=9;
int RECV_PIN=8;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume();
if(results.value==0xFD08F7)
{
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
}
if(results.value==0xFD8877)
{
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
digitalWrite(blue, LOW);
}
if(results.value==0xFD48B7)
{
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, HIGH);
}
if(results.value==0xFD28D7)
{
analogWrite(11, 255);
analogWrite(9, 255);
analogWrite(10, 0);
}
if(results.value==0xFDA857)
{
analogWrite(11, 0);
analogWrite(9, 255);
analogWrite(10, 255);
}
}
delay(100);
}
Share