PART II : IR CARRIER PULSE
You guys!We continue our journey in Infra Red (IR) communication in more practical approach. From the previous introduction article, IR pulse frequency play important role in determining the TSOP IR detection sensitivity level. How do we start?? Below is how we calculate the timing. Lets go!
From the calculation above, we need to light on the IR LED for 12.5us and turn it off for 12.5us. This is for a period/cycle. Repeating this cycle will generate IR LED pulse oscillator of 40kHz!
Go grab your Microcontroller (uC) or any IC that can generate pulse like we discussed. *I prefer uC as I can easily tune the frequency by modifying my code and not my hardware.
Eg : Carrier pulse 40kHz using mikroC and PIC12F629(cute and small uC). We can't set 12.5us delay as the input x to the function delay_us(x) as x should be round integer and not floating number.
While(1)//forever loop IR LED on and off producing oscillating pulse!
{
GPIO = 0xFF; //IR LED on
delay_us(12); //wait 12us
GPIO = 0x00; //IR LED off
delay_us(13); //wait 13us
}
The actual result : Use oscilloscope to probe at output pins.
Off time(Delta) = 12.01us
Period/cycle = (on time + off time) = 24.41us ;
1/Period = frequency = 40.9668kHz(Good enough!)
Oscilloscope helps a lot. From my experience, when the frequency is not exactly at the right specification (error = +/-1kHz), the TSOP sensitivity decrease! Some cases, I need to place the IR LED extremely close to the TSOP receiver to make it detectable!!! (T^T). Please verify your frequency pulse generated. Don't 100% trust on the code you write(especially high level coding) for timing restriction coding unless you use assembly language with precise calculation.