dcsimg
Skip to end of metadata
Go to start of metadata

Infrared is used in a plethora of diverse applications. A huge portion of these applications utilize infrared for digital communication between devices. The most common use of digital infrared communication is in television remote controls. In this article, we will cover the basics of this protocol and how basic microcontrollers can be applied to send and receive infrared signals.

Table of Contents

Protocol

Infrared (IR) light is everywhere in the world and just about everything emits some type of infrared light. This creates a noisy environment in the infrared spectrum and it deems a common question: How can infrared noise be omitted? The basic answer has two parts but requires some knowledge of where infrared comes from.

Infrared is mostly non-visible to humans because the wavelength is larger than what our eyes are capable of seeing. Visible light spans from around 400 nanometers to 750 nanometers. Infrared is the next band up, spanning from 750 nanometers to 1 millimeter. The first step of filtering the noise out of an infrared signal is to squint our 'eyes' and only look at a narrow band of the infrared frequencies. This is done by picking an infrared transmitter and receiver that operate in a limited frequency band. This step alone removes a large portion of noise.

The second step in noise reduction is done with modulation. Modulation involves toggling the signal on and off rapidly to send a pulse instead of bringing the signal high the entire time. Figure 1 shows how a pulse would look when modulated at 38 kHz.

 

 

Figure 1. Closeup of Modulated Signal



The above signal would appear to be a 'one' on the receiving end after using a band-pass filter centered at 38 kHz. By using the filter, anything not modulated is excluded. Figure 2 shows a modulation signal being sent and Figure 3 shows how the inverted signal is seen on the receiving side (highlighted). The signal was transmitted over ten feet away and we were still able to obtain a very clean signal using this method. Most television remote controllers use this same exact method of transmitting the signal.

 

 

Figure 2. Modulated Transmitted Signal

 

 

Figure 3. Inverted Demodulated Received Signal after Comparator


Transmitting Example

Transmitting a digital signal requires modulation to reduce outside noise in the system. We settled on using a microcontroller to modulate and create the signal due to the ease of modification during testing. Following is our transmitter circuit along with the code we used to send a 4-bit BCD code. The infrared LED is toggled at twice the target modulation frequency.

Circuit

 

 

BOM

 

NameValueUsageDigi-Key Part Number
C1, C222 pFLoading capacitors for crystal oscillator
BC1005CT-ND
C3100 µFVoltage source smoothing capacitorP15783CT-ND
R1 (5 V)33 ΩCurrent limiting resistor for LED for 5V sourcePPC330BCT-ND
R1 (3.3 V)6.8 ΩCurrent limiting resistor for LED for 3.3V sourcePPC6.8BCT-ND

L1

-Infrared LED751-1203-ND
Q1-NPN transistor switch for infrared LEDP2N2222AGOS-ND
U1ATTiny85 MicrocontrollerGenerate modulated signalATTINY85-20PU-ND
X18 MHz

Crystal oscillator

CTX900-ND

 

Code

 

 

Download Transmitter Code for ATTiny85

 

 

 

Receiving Example

The receiving circuit is made up of an infrared receiver and a comparator. The receiver chosen contains a band pass filter as well as a comparator all in the same package. This makes the signal processing very simple. A second comparator was added after the sensor to eliminate any extra noise in the circuit, this component can be omitted in many applications when using a high-quality infrared receiver. The signal outputted from the comparator is a stable digital signal shown in Figure 3 above. This signal is then processed by a microcontroller using the finite state machine outlined below.

 

Circuit

 

BOM

NameValueUsageDigi-Key Part Number
D1-Infrared Receiver425-2528-ND
R118kVoltage Divider ResistorP18KBBCT-ND
R210kVoltage Divider ResistorCF14JT10K0CT-ND
U1-Comparator to smooth out any noise in signalMAX908CPD+-ND

 

Finite State Machine

 



Code

 

Download State Machine Code Snippet for PIC24

  • No labels