Introduction: Infrared Cloning 2.
Chapter 2:
This is the second chapter of a big series of domotics experiments. So we will be used the cloned signal that we obtain in the last chapter. Always with our goal: "keep it simple".
Please check the first part:
So let's get started.
Step 1: The Stuff
We can use an Arduino Uno or Nano. But bear in mind that I have been testing this mostly in Uno. It should work in every Arduino thought. And finally, a simple infrared led. Simple, isn't it?
Step 2: Connections.
I had some issues with this infrared led because every tutorial that I watched says that you have to add a resistance to protect the led. So did as instructed but found that the led where emitting signals but not bright. Since infrared light is not visible you can check if the led is working using the camera of your cell phone. As I was saying my configuration was not working, the light was not bright enough. After a few trials, I decided to remove the resistance. And that was it. By the way, I read somewhere that Arduino slot 13 has an integrated resistance so I started using that one, but I had to use another slot since I needed that slot and found out that it works in every digital pin. So I think the resistance might be needed if you need to turn on the led and keep it on. In our case, the infrared led will be sending signals, and means one, is not turned on constantly and two it will be blinking for very short periods of time. Not sure, am just a humble programmer.
We are connected, what is next,
Step 3: The Sketch
As you can see the program is a little bit more complex than the one to clone signals, but still is simple. No libraries in order to make it fast. The system loops waiting for input from the serial monitor. In my case I just wait for "1", not very creative sorry, it's simply because I am not. You can play around with the code to suit your needs.
Once the command sequence is started the program reads the int array, containing the cloned signal that we obtain in the last chapter, and sends it to the method pulseIR() in charge of triggering the led. Bear in mind that you will have to add a 0 at the end of the array. Don't ask me why I just don't remember why I did it that way. But again you're free to play around with the code and make it better. AND IT CAN BE WAY BETTER.
This is to take into count,
In this sketch, the baud rate is 9600 (won't go far without setting this on the serial monitor)
Add the zero at the end, or modify the code.
Step 4: What Is Next?
Next chapters I will be showing how to do the same with radio frequencies to handle radio remotes. As you might know, is now much different from the infrared signals. We will end up with an array of numbers. We will be processing them a little bit differently.
Also, I will be showing you how to normalize the signals, which is to transform the numbers into zeros and ones or true or false signals, and how to compress the whole signal in order to store it in a db or where ever, for easy handling. As you will find out, some signals are very large, like for example 400 in size or more. Also as you might imagine a compressed signal will facilitate the transference of it through different kinds of channels ;)
Not sure what will be the first thought. I am kind of lazy this day.
By you all.