Infrared Cloning 2.

Introduction: Infrared Cloning 2.

About: I am a programmer and I will be presenting my work in a form of chapters related to DOMOTICS.

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:

Infrared Cloning Chapter 1

So lets get started.

Step 1: The Stuff

We can use an Arduino Uno or Nano. But bare in mind that I have been testing this mostly in Uno. Is 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 some where 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 fount out that it works in every digital pin. So I thing the resistance might be needed if you need to turn on led an 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 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 that the one to clone signals, but still is simple. No libraries in order to make it fast. The system loops waiting an input from the serial monitor. In my case I just wait for "1", not very creative sorry, its 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 last chapter, and sends it to the method pulseIR() in charge of triggering the led. Bare in mind that I 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 your free to play around with the code and make it better. AND IT CAN BE WAY BETTER.

This to take in count,

In this sketch the baud rate is 9600 (wont go far with out 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 as the infrared signals. We will end up with an array with numbers. We will be processing them a little bit different.

Also I will be be showing you how to normalize the signals, this is to transforms the numbers in 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 handle. As you will found out, some signal 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 kind of channels ;)

Not sure what will be first thought. I am kind of lazy this days.

By you all.

Be the First to Share


    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge
    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Home and Garden Contest

      Home and Garden Contest



    4 years ago

    You should always use a limiting resistor with LEDs unless you want to push them to the limits. Without resistor it will still work but depending on the working conditions its life could be reduced dramatically or just burn it in seconds. Check the datasheet to know which is the maximum current and how long the LED can stand with this.

    Removing the resistor is normally used to save money (crappy world) or to achieve maximum intensity and increasing the LED emitting range, but always using pulsing signals below the maximum time allowed for that current (or pulsed current). It still will affect the LED over time but we are talking about years and the parts are pretty cheap...

    Unfortunately not all the datasheets provide the info or it's detailed enough. What you need is something like this (from a real datasheet):

    Peak Forward Current(Duty /10 @ 1KHZ) Ifp 100 mA

    Where you can see the maximum PEAK forward current supported is 100mA with a 1KHZ signal and a duty of... no idea how to interpret that 10% of duty cycle? duty/10?. Well you catch the idea. So, if you keep a signal under these conditions you could achieve 100mA theorically, without using a limiting resistor.

    But as I said, not all datasheet provide this information, in fact most of them don't do.

    About your passive loop waiting for "1". Just simply set a flag with the value of the port and check it later. This a simple thing (KISS), but a good improvement in performance. You get extra time to do other stuff. The time for doing any stuff should be less than the time to detect the change in pins of course, to avoid loosing them (if pin change after 100us as minimum, then you could do stuff as far as the time for this is below 100us including the loop instructions, etc):

    loop ()
    pinchange_f = pin_x
    if (pinchange_f) { something here
    clear pinchange_f
    ie: send me to sleep here to save battery (time should be less
    then the required for the next bit change)
    or/and do something here...