DIY TV Remote Controlled Home Automation System, What is TSOP1738/TSOP1838?, How to Interface a two-channel Relay module with Arduino?, code for TV Remote Controlled Home Automation System, Circuit Diagram for TV Remote Controlled Home Automation System

Let's get started with this innovative Arduino tutorial in which you will learn to create your own TV/DVD/MP3 player’s IR remote controlled home Automation system. In this tutorial you will learn to interface TSOP1838 IR Receiver with an Arduino board and control home appliances like fan, Bulb, etc. using the Relay module.


Components required:


What is TSOP1738/TSOP1838?

The TSOP1738 is simply an IR receiver and TSOP1838 is the upgraded version of it, both of them function as a switch. It reacts only at 38kHz of frequency. They only have three pins that connect TSOP to other devices and allow it to be used for wireless communication. 

What is TSOP1738/TSOP1838?

Pinout Description
GND: The ground pin(-ve terminal) is only to make common ground with other devices, especially microcontrollers and ICs.
VSS/ DC 5V: It is a power input pin that is used to activate the internal decoder and IR receiver. The power should be applied in accordance with its specifications and only at the power pin. When power is applied to any pin, even if it is low, the IC begins to heat up, which can be detected by touching it. Finally, heating will harm the TSOP.
Output: The data will be output as a pulse from the output pin. With a little resistance, the output pin can be interfaced with any TTL/CMOS device. The TSOP's output data will be in voltage form.

 

Internal Block Diagram of IR Receiver

Internal Block Diagram of IR Receiver

TSOP1738 IR Receiver Features
  • It gives the IR receiver and amplifier within a single package.
  • Special frequency level makes it operate with a specific device.
  • TSOP1738 has an internal bandpass filter to avoid any ambient light, especially sunlight.
  • The internal filter gives PCM frequency for analog signals
  • It is usable with any kind of TTL/CMOS microcontroller, IC or microprocessors.
  • Even though there are multiple features in a single package the IC still has low power consumption and the power consumption only happens when it is operating. At stand by position, the power consumption becomes lower.
  • TSOP1738 can transfer 1200bits/s and can receive it at the same speed.
  • It is an active low output device.
TSOP1838 IR Receiver Features
  • Photo detector and preamplifier in one package.
  • Internal filter for PCM frequency.
  • TTL and CMOS compatibility.
  • Output active low  Improved shielding against electrical field disturbance.
  • Suitable burst length ≥6 cycles/burst

How to Interface a two-channel Relay module with Arduino?

  

How to Interface two channel Relay module with Arduino ?
 
How to Interface two channel Relay module with Arduino ?

You may want to use your Arduino to control AC-powered devices such as lamps, fans, and other household items. However, because the Arduino operates at 5 volts, it cannot control these higher voltage devices directly. So, we use Relays to control our AC-powered home appliances using microcontrollers. A relay module is an electromagnetically operated electrical switch. A separate low-power signal from a microcontroller activates the electromagnet. The electromagnet pulls to open or close an electrical circuit when activated. 

Pinout
GND: Input Ground reference
VCC: DC 5V to power the optocouplers, coil drivers, and associated circuitry
JD-VCC: Isolated power supply input pin
IN1: Input to activate relay 1
IN2: Input to activate relay 2

 

Working
The remote signal is received using a TSOP1838 sensor. When any button on the remote is pressed, the IR LED of the remote sends a unique encoded signal, which is received by the sensor and sent to the Arduino, which decodes the signal to get the code of the key pressed on the remote. After getting the codes of keys on remote, Arduino program is written in such a way, so that if the received code matches with the key pressed on remote then do on/off.

 

Circuit Diagram

Circuit Diagram of TV Remote Controlled Home Automation System

Install IRremote library from here

Before uploading the below code, Go to arduino Examples IRremote and Upload ReceiveDemo code, on serial monitor you will get the hex code for your remote control keys then change the hex codes present in the below code from yours.

Arduino Code

#include <IRremote.h>
int RECV_PIN = 11;
int LED=9;
int bulb=13;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
pinMode(LED, OUTPUT);
pinMode(bulb, OUTPUT);
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if((results.value==0x1801)||(results.value==0x1001))
{
digitalWrite(LED,HIGH);
}
else if((results.value==0x1802)||(results.value==0x1002))
{
digitalWrite(LED,LOW);
}
else if((results.value==0x1803)||(results.value==0x1003))
{
digitalWrite(bulb,HIGH);
}
else if((results.value==0x1804)||(results.value==0x1004))
{
digitalWrite(bulb,LOW);
}
else
{

}
irrecv.resume(); // Receive the next value
}
delay(100);
}

Diy projectsRelay moduleTsop1738Tsop1838

2 comments

Kapil Kumar

Kapil Kumar

@Gourav,
Yes, we have to provide a separate DC power to Arduino whether from female B-type port or female DC power Jack.

Gourav

Gourav

Do we have to provide a separate power supply to Arduino?

Leave a comment

All comments are moderated before being published