This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5438A Universal IR remote controller

Other Parts Discussed in Thread: MSP430F5438

Hello Friends,

I'm intending to make a universal IR remote control supporting any IR protocol, my approach is to get an IR receiver "TSOP382", build its circuit, connect its output to one input pin with interrupt of the MSP430F5438, I store the time of every "1" and "0" in a large array, store it in the main program memory, then play it back when needed, the play back mechanism output a frequency of 38KHz in the time of "1's" and nothing (zero volt) in the time of "0's". (Actual 1s and 0s as they are inverted in the "TSOP382")

the system works well with my DVD, TV and satellite receiver, but it doesn't work with my Air conditioner, I have no idea why?

I did several attempts  to solve my problem such as:

1) assuming that the AC IR remote control uses other frequency other than the 38KHz, I used the oscilloscope to read the frequency and an IR diode, it was hard to confirm but the carrier frequency was about the 38KHz

2) I assumed the the IR receiver I'm using ("TSOP382") is not able to read the correct AC remote signal for any reason --> I wrote an additional part in the code to count the number of "1s" and "0s" in a key press, I got the same exact number each time I press the same key.

3) in one of my trials it worked with the AC (when the Tx LED was very close to the AC [about 1 Cm]) but then it refused to work again.

Any idea or support is highly appreciated

Thank you.

Mina

  • The TSOP382 is suppose to give you the envelop of the sub-carrier. But it has some limitations.

    The sub-carrier frequency must be somewhat close to 38 kHz.

    It takes about 10 cycles of the sub-carrier before it starts to recognize them.

    If there are more than 70 cycles continuously, the duty cycle of modulation is limited to 30% or less.

    Hence if the remote-control uses a code that violate the above, your recording will be distorted and you reply your replay will not work.


  • old_cow_yellow said:
    Hence if the remote-control uses a code that violate the above, your recording will be distorted and you reply your replay will not work.

    I'm not sure about the sub-carrier of the AC remote control but this is a good way of thinking, the "TSOP382" is working with some devices (assume it uses 38KHz) and not working with others (assume it works with different frequencies).

    I need a real universal remote control that works with ALL IR devices so maybe I can do one of the following:

    1) use other IR receiver other than "TSOP382", then I need an advice of a good part number

    2) since our assumption is about the frequency, then, I can use several IR receivers one for each frequency and store the code with its frequency, (during programming, I'll try to with each IR receiver and play back the signal, store the best working one), I need support on best part number I should use (if "TSOP382" is not good enough)

    3) use an IR diode to receive the carrier itself and write some code to let the MC to determine the envelop as well as the frequency, BUT I need a good part number of an IR diode (receiver)

    Please support me in which path of the above three should I go, or do you suggest better way to solve the problem.

    Thank you very much for the support, I appreciate your time and efforts

    Mina

  • Mina Anton said:

    ...

    3) use an IR diode to receive the carrier itself and write some code to let the MC to determine the envelop as well as the frequency, BUT I need a good part number of an IR diode (receiver)

    ...

    That is what I would do.

    Ready-made IR Receivers such as TSOP382 are designed to work with IR Controller up to 30 feet away under interference of room lighting. It is very difficult to achieve and they had to trade off with the limitations I mentioned before.

    But you do not have those requirements. During "learning", you can have the IR Controller within inches of the IR diode. And you can shield them from interference if necessary.

    Sorry, I do not know a good part number for IR diodes. You probably need an amplifier as the output is very small.

  • Come to think of it, you may be able to use the so-called "IrDA Transceiver" instead. Vishay, some Taiwan and Japaneses companies make them. The big question is where can you get it. If you find a source, I can help you on the technical side.

  • Reading about an universal infrared remote control, the one I use comes in mind as reference for a good design of this kind of device. it's the Sunwave SRC-7000. I really love it. It replaces all my IR remotes. The touch screen area is freely programmable with labels and buttons, and besides just reproducing IR codes, either from the large internal table or captured ones, it can also play sequences, including delays. Great for things like 'all devices on/off' or typical configurations or repeating tasks. (p.s.: it is of course easier to program it on PC - especially as this allows designing your own icons -  than with the touch screen, but both is possible)

    Maybe reading the manual gives you some ideas for features to add to your project.

  • old_cow_yellow said:
    That is what I would do.

    ..............

    Sorry, I do not know a good part number for IR diodes. You probably need an amplifier as the output is very small.

    Thank you, You're directing me to achieve my target.

    First This selection was my first choice, and I was expecting to receive a repeatable time durations for 1s and 0s during the frequency output "Mark period"and a long time duration during the "space period", I did a circuit, write code that include a huge array of type "int" and of length of 6000 word, the output is attached here, it was NOT logical.

    In the attached file you can see the 38KHz modulation frequency, with "high" time of about 10 counting units and "low" time of about 89 counting units (counting units is 0.5 uSec), the following problems appeared:

    1) I calibrated the output timer against my oscilloscope, to make sure that the oscillator settings is correct and the microcontroller is working properly

    2) The measured values (99 x 0.5uSec) indicates a frequency of about 20KHz not 38KHz

    3) Scrolling down in the array you'll find strange time duration such as 300 which is about 3 pulses in the modulation frequency, so it is not supposed to be "space period" also I didn't find any reason of why it happened

    So I assumed that the Photodiode I'm using is of bad quality, I couldn't get better at the current time from the local market.

    >>>>You probably need an amplifier as the output is very small<<<<

    Mentioning the amplifier, let me check again, the Circuit I built was like a voltage divider with only one resistor and one Photodiode, then an analog comparator to compare the voltage from the divider against a preset voltage value, maybe this is a wrong circuit or not the best configuration I don't know, please advice .

    I used a PT3401B-M-3B photodiode from the local market, I'm not sure it is an original part or a Chinese copy.

    I'm intending to order "PD15-21B/TR8" from Digikey, PN: 1080-1365-1-ND

  • old_cow_yellow said:
    Come to think of it, you may be able to use the so-called "IrDA Transceiver" instead. Vishay, some Taiwan and Japaneses companies make them. The big question is where can you get it. If you find a source, I can help you on the technical side.

    I didn't think about IrDA as I know that it was designed for short range data communication, so by some how it is not the correct thing for my issue.

    In fact I don't know much about the IrDA, so I may be wrong and this is a great idea from you.

    I searched "Digikey" and I found the "TFBS4711-TR3" PN "751-1067-1-ND" looks to be good from the point of range 1 meter.

    Please advice which detector I should order, the IrDA receiver or the photodiode and it'll be great if you can advice about the proper connection of the potodiode.

    Thank you "old_cow_yellow" I appreciate your time and efforts.

  • Jens-Michael Gross said:
    Reading about an universal infrared remote control, the one I use comes in mind as reference for a good design of this kind of device

    Thank you "Jens-Michael Gross" for your opinion, it is good to know your feed back about this product and use its manual to get some more ideas or enhance my product. I appreciate it.

  • If it were me, I would use the receiver of an IrDA Transceiver to do the “learning”. But this is mostly due to the fact that I do not know how to design one with photo-diodes and amplifiers. I am almost certain that the IrDA receiver can do this job if you can and will place the IR Remote Control device within inches of the IrDA receiver while attempt to learn the code.

    The photo diode used inside the TSOP382 and the IrDA receiver are probably very similar, if not identical. The main difference between the two devices is that inside TSOP382, the amplifier has a very narrow bandwidth centered around 38 kHz. This will not attenuate the 38 kHz signal but will block all the white noise outside that narrow 38 kHz bandpass. Hence the designer is able to raise the gain hundreds of times higher than that of the IrDA receiver. The IrDA receiver could not do so because the signal itself has a very wideband. The signal to noise ratio is terrible. If you raise the gain, you will just get more noise.

    Having said that, using the IrDA Transceiver has the following shortcomings.

    a. IrDA Transceivers are hard to get. (But you found one made by Vishay, a very good one.)

    b, IrDA Transceivers are very difficult to solder. The package is made from IR transparent plastic. When heated during soldering, the plastic becomes soft and the whiskers that connect the pins with the die may get damaged inside the plastic package.

    Be aware of this risk. The rest is easy.

  • old_cow_yellow said:
    If it were me, I would use the receiver of an IrDA Transceiver to do the “learning”.

    Thank you, I'll follow your recommendation and order some of the IrDA transceivers, I'll place also an order to some photodiodes, try to make a good amplifier design (after searching or consulting) also I'll be able to compare the quality of the received signal using the two methods and put the best in my upcoming product.

    The points that I got is:

    1) it is a waste of time to use receiver module such TSOP382 as this way will never lead me to make a real universal remote controller

    2) The IrDA transceivers may work also but in short distance, and I have to be careful during soldering.

    3) Getting ore data is the most efficient way to get the frequency and commands, it will work will ALL protocols including the ones that is not invented yet, thus making a real universal remote controller.

    so Thank you "old_cow_yellow" for your support.

    Mina

  • Mina,

    You are welcome.

    I am an old hobbyist. Enjoy sharing what I know with others. I think I know a lot about IR-remote. If you have other questions or problems down the road, I will be glad to answer them.

    --OCY

  • Mina Anton said:
    2) The IrDA transceivers may work also but in short distance, and I have to be careful during soldering.

    The point is that you shall use just receiver part of it. Transmit using IR LED as usual.

  • Yes, "Transmit using IR LED as usual" (quoting llmars), can be optimized to fit your specific needs. But if you are already using the receiver part of an IrDA transceiver, it is worthwhile to consider using the transmit part too. This is not optimal, but may be an acceptable compromise.

    According to the data-sheet ( http://www.vishay.com/doc?82633 ) of the IrDA transceiver you are going to use, one of the FEATURES is "Remote control - transmit distance up to 8 m".

    BTW, I found an old application note from Vishay ( http://www.vishay.com/doc?82606 ) it is very relevant to what you are doing.

    --OCY

  • old_cow_yellow said:
    BTW, I found an old application note from Vishay ( http://www.vishay.com/doc?82606 ) it is very relevant to what you are doing.

    The suggested document is very useful and it gives hope to minimize the solution size, enhance the performance.

    I didn't observe the transmit distance in the datasheet since I was focused on the receiver part of the IrDA module, and this information [8m] gives a lot of hopes

    old_cow_yellow said:
    I am an old hobbyist. Enjoy sharing what I know with others. I think I know a lot about IR-remote. If you have other questions or problems down the road, I will be glad to answer them.

    I appreciate your support, efforts and your time to write to me, in fact I wish to share more information with you about this product, I'll be happy if I can return the support to you one day or if we can develop something together one day.

    the Order from DigiKey usually takes about 10 days (I'm located in Egypt and the customs are too slow and ...). I didn't place the order as they charge me about 80USD for shipping and it is non sense to pay 80USD shipping for few dollars goods, I'm preparing a large order that I'll place within a couple of days.

    have a nice day

    Mina

  • This is my working code for IR Decode using the "TSOP328XX"

     

     

    //ccs6 written by David Whitfield

    //The program decodes an IR signal with the TSOP32438

     

    #include "msp430.h"

     

    #define LED0 BIT6 //red LED

    #define LED1 BIT7 //green LED

    #define relay1 BIT5 //relay1 for light 1

    #define relay2 BIT4 //relay2 for light 2

    #define relay3 BIT3 //relay3 for light 3

    #define relay4 BIT2 //relay4 for light 4

    #define IRrec BIT1 //connected to IR receiver for interrupt on rising edge of pulse

    #define IRrec1 BIT0 //connected to IR receiver for interrupt on falling edge of pulse

     

    int bit =0; //single bit to transmit

    int bitt =0; //single bit used to switch bits to descending order

    int count =0; //timer used to see delay between rising edge and falling edge of pulse

    int resetcount =0; //timer to reset the loopcount, modify this to change how fast bits can be read

    int loopcount=0; //the bit being decoded clocked by IR receiver edges

    int loopcountMAX=0; //max loop count, should be 66 or increase reset count timing

    int one =0; //check to see first decode value (used for debug)

    int two=0; //check to see second decode value (used for debug)

    int three =0; //check to see third decode value (used for debug)

    int four=0; //check to see fourth decode value (used for debug)

    int five=0; //check to see fifth decode value (used for debug)

    int six=0; //check to see sixth decode value (used for debug)

    int seven=0; //check to see seventh decode value (used for debug)

    int eight =0; //check to see eigth decode value (used for debug)

    int ledcount =0; //led off timer

    int odd=0; //used to read IR data

    unsigned long realdata =0; //complete data

    unsigned long rxdata =0; //uncomplete data

     

     

     

    void main(void){

     

      WDTCTL = WDTPW + WDTHOLD;                            // Stop watchdog timer

     

      P1DIR |= (relay1 + relay2 + relay3 + relay4 + LED1 + LED0);     //output direction                       // Set all pins but RXD to output

      P1OUT =0;

      P1IE |= IRrec; // P1.3 interrupt enabled

      P1IES &= ~IRrec; // P1.3 interrupt enabled

      P1IFG &= ~IRrec; // P1.3 IFG cleared

      P1IE |= IRrec1; // P1.3 interrupt enabled

      P1IES |= IRrec1; // P1.3 interrupt enabled

      P1IFG &= ~IRrec1; // P1.3 IFG cleared

     

      TA0CCTL0 |= CCIE;                             // CCR0 interrupt enabled

      TA0CTL = TASSEL_2 + MC_1 + ID_2;           // SMCLK/8, upmode

      TA0CCR0 =  20;                                                                                  //count up to 20

     

     

     

        __enable_interrupt(); // enable all interrupts                                   // Enable CPU interrupts

     

     

     

      while(1)

      {

        _delay_cycles(100);

     

        if(resetcount == 200)

        {

          loopcountMAX=loopcount;

          loopcount =0;

          realdata = rxdata >> 1;

     

        }

        if(realdata != 0) //signal present

        {

          P1OUT |=LED1;

          P1OUT &=~LED0;

          ledcount=0;

        }

        if(realdata == 0xFF17943) //remote 1 code

        {

          P1OUT ^=relay1;

          realdata =0;

        }

        else if(realdata == 0xFF46731) //remote 2 code

        {

          P1OUT ^=relay2;

          realdata =0;

        }

        else if(realdata == 0xFF9993) //remote 3 code

        {

          P1OUT ^=relay3;

          realdata =0;

        }

        else if(realdata == 0xFF9913) //remote 4 code

        {

          P1OUT ^=relay4;

          realdata =0;

        }

        if(ledcount ==2000)

        {

          P2OUT |=LED0;

          P2OUT &=~LED1;

        }

        if(ledcount == 4000)

        {

          P2OUT &=~LED0;

          P2OUT &=~LED1;

        }

        ledcount++;

        if(ledcount >5000)

        {

          ledcount =5000;

        }

        resetcount++;

        if(resetcount >1000)

        {

          resetcount =999;

        }

        if(count >1000)

        {

          count =999;

        }

     

      }

    }

     

     

     

     

    #pragma vector=PORT1_VECTOR

    __interrupt void Port_1(void)

    {

      TA0CTL |= TACLR;

     

      if(loopcount == 0)

      {

        rxdata =0;

      }

      if (loopcount == 50)

      {

        one = count;

      }

      else if (loopcount ==51)

      {

        two = count;

      }

      else if(loopcount ==52)

      {

        three = count;

      }

      else if(loopcount ==53)

      {

        four = count;

      }

      else if(loopcount == 54)

      {

        five = count;

     

      }

      else if(loopcount == 55)

      {

        six = count;

     

      }

      else if(loopcount == 56)

      {

        seven = count;

     

      }

      else if(loopcount == 57)

      {

        eight = count;

     

      }

     

      odd = (loopcount & 0x1);

      if(odd == 0)

      {

        if(count >13 && count < 24)

        {

          bit = 1;

        }

        else

        {

          bit = 0;

        }

     

        rxdata += bit;

        rxdata<<=1;

      }

     

      loopcount++;

      count=0;

      resetcount=0;

      P1IFG &= ~IRrec; // P1.3 IFG cleared

      P1IFG &= ~IRrec1; // P1.3 IFG cleared

    }

     

    #pragma vector = TIMER0_A0_VECTOR

    __interrupt void Timer0_A0 (void)

    {

      count++;

    }

     

**Attention** This is a public forum