Hi welcome to an Arduino tutorial from Robojax. in this video we are going to see how we can
decode any remote for TV Blu-ray player DVD player whatever you have so you will decode
it using Arduino get the code and after that we will send using this infrared transmitter
to control the same feature of this for example turn on the TV or turn it off you can get the
code for this project by clicking on the link of the description below which will take you
to Robojax.com/learn/arduino let's get started with this
when you send when you press any button on your remote actually it sends a code and that could
enter the eight kilohertz it's being decoded by the receiver this is one of the example of
the receiver or maybe this one which is in your TV or whatever device that remote belongs to so once
the infrared signal received there it decodes it and based on the different button that you press
it executes the command come on for example it turns off turn it on increase the volume change
the channel whatever you do to control your TV let's say you want to turn it on and off and this
if for example I have a Samsung TV at home which I'm going to test and show you the owner enough
and TV works and such that if the TV is on and it receives the power signal it will turn off and if
the TV is off it if it received the power signal it will turn on so we are using only one code to
control that and I'm going to explain it to you first step we are for example turning on and off
this TV this is a Samsung TV so we will use the power button and capture volume and others they
will have two up and down so we will use this one we will capture only one code I will show you how
to do that and after that we will run this again as a transmitter using this infrared transmitter
this is just led type it looks like an LED but this is actually infrared and we have only around
300 ohm resistor in between and it will be just execute the code for us to turn the TV on and off
so there are two types of receivers sold on eBay one is the actual receiver without a PCB
the other one is the module with the PCB and led that is related to the signal so when you
receive the signal in blanks it helps you but my test will be on this one and then this one
we have here negative this goes to the ground the metal one goes to five volts and there is
on this side it says F this goes to the signal if you want if you are getting this one this side is
flat and their side has this grid this is a VCC ground and this is the signal which you connect
up an 11 and this one the signal also goes up and another in both case if you are using this
one or this one I will suggest connecting it to pin 11 otherwise if you're changing the pin that
you're connecting make sure that it reflects it in a course now for this one you have no choice
but to connect this to pen 3 because the pen have been defied and defined in the library if
you want to change it you have to open library and change it this resistor is 300 ohm and you
can put 270 up to 320 and these values all of these will work the only difference is if you
put higher resistance the power of this will be reduced and it will work for the shorter range
but if you read you increase the power up to certain range depending on the specification
of this let's say if you reduce it the value of this the power will increase and eventually
this will be damaged if you send more voltage to this 72 300 ohm resistor will be the suitable for
the Sun otherwise consult the datasheet for the receiver and calculate the results accordingly
the first thing that you need is to download this library for the remote control I will
give you the link for that so you have to download and include it once you include it
in your library if you go and file example and then it there will be IR remote you will see all
of this if you see all of this then you have the library and we are good so this will work
automatically as soon as you have the library I think that you need to changes here which pen you
are receiving the signal from the receiver so this is 1011 if your if you want to use other
pen just change it other than that you do not change anything in this code we just using it
as a decoder so you will set the right pen here I'm using pen 11 to receive the signal from the
receiver other than that you don't do anything here and once you run it will just display that
good to you it's just connected turned on and that's the sketch let's just upload it
to send the code go to file example a lie are remote and then use this one
send raw demo open this now the code that they give you just pasted here
delete all of this inside the loop and I just left 5,000 millisecond delay I just pasted it
now you see the rod this is the array that is holding the code for the remote this long it has
so many elements already there and the name of the array is raw and it has 68 elements here we
say send raw then the array named raw and then it succeeded is the length and enter the it is
the frequency if we send this and if we connect now we don't need to have just receiver we can
remove it you want to leave it also that's fine done and if I upload it now the code is uploaded
now every 5000 millisecond or five seconds this sends a signal the TV is in the other room and we
are going to turn the TV off and then if it's on will be off and wait five seconds and turn it on
but before going to that room let's just you use the I would use another Arduino to decode
this and see if we are getting the same code I'm going to another port port eight which is
this now connected upload the code and then open serial monitor now this is sending the
signal and that one is receiving it okay so we are we are got this signal okay so
I'm just connecting it now let's see the code that we got is the same code as the other one
f-4b eight two nine eight eight and this is the code that we received exactly the way that we
press this remote now this is acting as our remote so I'm copying this I'm copying this
code that I received and I'm going to paste it and here there is some small difference
there are difference between the codes and let's test it and see how it works with TV
now I am testing it is mild we know the code is already uploaded it's connected turned on and
the receipt the transmitter is here but I've not connected this as you can see the TV is off and
here is the remote I'm going to leave it here now connecting this to pen 3 now let's see if
this turns the TV on I heard the noise the TV is on and the TV is off so it perfectly working and
now five seconds passed now it will turn the TV on again and the remote is here you can capture
any TV or any devices remote and use Arduino to control your TV or whatever device you have you
can do you can do more complicated for example you can have a satellite receiver or let's say
you have a Blu-ray player and you want to turn on the TV and then after the turn on the Blu-ray
player set the input of the TV to less HDMI 1 or HDMI 2 and then play the Blu-ray so and then set
the volume at 50% all of this can be done so for each you have to capture the code for example for
input selection press this select the input let's say in your TV for HDMI - you are pressing this
three times or two times until HDMI one HDMI - and then you capture that put it in a sequence
on your doing it to be transmitted in here and so you can have I put here I called it Samsung
power so you can have these two line again you will have Samsung input selection and after that
you can have another line for DVD player power and then DVD player play so whatever you have
we have 1020 lines you have you can have it and the Arduino can execute all this code like this
video and also you learn something from this please thumb up the video please also share
you