Seeking guidance on infrared

Hello, all!

I'm thinking up a project which will be a kind of half-remote-control and half-communication-device. It would function as an IR remote control and have an LCD allowing the user to send and receive messages (or even share remote control profiles) between units via infrared. Now, if all I wanted to do was use this to control a TV or something, I understand there are several IR libraries which could facilitate that, but noooo... I had to go and be fancy lol

To accomplish this, my project would have a pair of infrared LEDs - a transmitter and receiver - and these should theoretically allow it to send and receive IR remote codes (to control a device or "learn" from an existing remote control, respectively) and have bidirectional inter-device communication. I made the decision to use bare LEDs as opposed to a receiving module such as the TSOP382 so that my project can make itself compatible with IR signals of any modulation frequency. While 38 kHz is the most common modulation frequency, it is by far not the only one in use, and I want my device to be able to control any infrared based component... TVs, VCRs, fans, stereo receivers... even those Bang and Olufsen units which use 450-ish kHz. Moreover, I'd love for the inter-device communication to work as speedily as possible... 6M baud sounds awesome - as long as the LEDs themselves can keep up.

In the research I've done so far I was able to find examples of folks using serial-over-infrared on the Arduino (example A, example B) but I'm unsure if that will work in the big picture of my project overall as I will be using a Teensy 4.1. Additionally, it looks like the majority of IR libraries use PWM pins to generate a modulated IR signal and, as I need basic serial to be used too, this limits me to using Serial1, Serial2, Serial3, Serial6, or Serial7 on the Teensy, since they are all normal serial Tx/Rx pins which also happen to support PWM.



I'm okay with designing circuitry as far as logic and gates go, but when it comes to the intricacies of Volts and Amps... yeah, I'm no EE! :confused: So, I have a few questions:

1. Is it even feasible to use infrared in this manner on the Teensy, or am I crazy? lol

2. Example A and Example B show differing methods of implementing serial-over-infrared; is this just a matter of taste/preference? Or would one method potentially allow for higher speeds or better reliability versus the other?

3. Since the Teensy works on 3.3V as opposed to the Arduino shown in Example A and Example B - and I'm uncertain that all IR LEDs have the same working voltage (the Amazon page for the ones I chose doesn't specify) - what resistor values would I need to make sure the Teensy doesn't over-drive them but still allows for the "brightest"/strongest signal?

4. Does anyone happen to know roughly how fast IR LEDs can be driven? Is a 6M baud serial over IR feasible?



Thanks in advance for any advice you fine folks can give! :D
 
4. Does anyone happen to know roughly how fast IR LEDs can be driven? Is a 6M baud serial over IR feasible?

According to <this> app note, turn on time for IR LEDs is in the nanoseconds range, and turn off time is in the tens of nanoseconds range. So, it looks like your 6M baud serial may not be too unreasonable.

Mark J Culross
KD5RXT
 
Don't forget you also need a fast detector on each end (as mentioned in that app note) - needs circuitry to amplify the photo detector signal and then you have to decode it somehow (in the face of noise?). The weaker the signal the more noise and less bandwidth you'll get, note. There's a reason IR remotes use lowish frequencies for modulation. If driving a fibre you have more control of the the signal level.
 
Don't forget you also need a fast detector on each end (as mentioned in that app note) - needs circuitry to amplify the photo detector signal and then you have to decode it somehow (in the face of noise?). The weaker the signal the more noise and less bandwidth you'll get, note. There's a reason IR remotes use lowish frequencies for modulation. If driving a fibre you have more control of the the signal level.

Right, and I'm sure I won't technically get the whole 6M baud of which I hear the Teensy is capable, but even maybe 4 or 5 would be awesome... *fingers crossed*
 
4. Does anyone happen to know roughly how fast IR LEDs can be driven? Is a 6M baud serial over IR feasible?

The LED won't be the limiting factor, detecting it will be.

Standard IR remotes and IR remote receivers use a protocol where a 0 is the LED off and a 1 is the LED flashing at a fixed speed, typically ~40kHz from memory.
So if you want to use IR remote type receivers then your high times must be at least a couple of cycles at 40kHz. This will limit your baud rate for any serial links.

The reason for doing this is that it makes it far easier to cope with a wide range of ambient conditions. Spotting an IR signal in a dark room is easy. Spotting it in a well lit warm room is hard, the total change in energy reaching the receiver is tiny in comparison to the background level. By modulating it at a fixed rate it's a lot easier to detect.

You can of course use a simple IR PIN diode rather than an IR remote receiver. This will give you a far faster response and allow higher data rates. But then unless you have both parts in a sealed box (you can buy that, it's called an opto isolator) it can get tricky to have reliable operation over varying lighting conditions.


In terms of generating a modulated serial link you can play some basic tricks that will modulate the output from a UART.
The best way is to set one pin as a PWM at the required rate. You then use an external AND gate to combine the PWM and the UART to give you a modulated UART signal to drive the LED.
The less parts but nastier way is to put the LED between the UART output and the PWM output. This doesn't require anything other than the resistor for the LED but means that at times the LED will be reverse biased, something that you should avoid doing. But at 3.3V you can get away with it.
 
Back
Top