IR Receiver Toggle Switch

IR Receiver Timing Diagram

 The IR receiver circuit featured here is basically a simple
 toggle switch that responds to IR signals from common hand
 held remote controls. It provides a means of controlling power
 to electrical appliances not equipped for remote operation,
 without needing an additional controller.

 The heart of the circuit is a 38Khz IR receiver module that
 converts the IR signals to 5 volt digital data, representing
 the particular command sent. This circuit responds to any of
 the commands and performs a toggling action to control power
 to external loads. To avoid interference, the receiver should
 be located where it will not respond to unwanted signals. It
 may be necessary to add some sort of shielding to the IR
 lens to narrow the coverage angle.

Video Demonstration in WMV format (1.1 Meg)


 Along with the IR receiver module, the circuit employs a
 CMOS dual D flip flop (CD4013) with one section wired as a
 monostable flip flop, and the second section used as a
 bi-stable, or toggle flip flop.

 In the idle state, the 470nF capacitor will be charged,
 producing a logic "1" to the data input of the first stage
 on pin 5, and the output of the IR module will be high,
 producing a low level from the transistor to the clock
 input at pin 3.

 When an IR signal is received, the IR module output moves
 to a low level, supplying a rising clock signal to pin 3 and
 loads a logic "1" into the first FF stage and begins the
 monostable output at pin 1. This also provides a rising
 edge to the clock input at pin 11 of the second stage,
 and causes a toggling action at pin 13.

 As the incoming IR data train continues, the 470nF capacitor
 discharges through the 10K resistor and diode until the
 level is low enough to clock a "0" into the first stage,
 ending the cycle at pin 1. When the incoming data stream ends,
 the capacitor begins charging to a high level through the
 1 Meg resistor for maybe a second, and the circuit is ready
 for the next toggling action. The circuit will not re-toggle
 without some recovery time of around 1 second.

 There seems to be several different IR remote control protocols
 which all appear to use some sort of pulse width modulation
 (PWM) to define the difference between data "1" and data "0".
 Transmission usually begins with a long start pulse used
 to adjust the receiver AGC, followed by possibly 32 data bits
 of about 2mS each for a total transmission time of about 60mS.
 This may vary somewhat depending on the complement of ones and
 zeros, since they are not of equal time. The timing diagram
 illustrates a typical IR transmission from a hand held remote
 control, and relationship to the toggle circuit activity.

 Parts List                         Allied Part Number

 CD4013   Dual D Flip Flop                735-1325
 2N3904   Transistor  (2)                 568-0292
 2N2219A  Transistor                      248-2077
 1N914    Diode       (2)                 431-0618
 78L05    5 Volt Regulator                288-0630
 Relay    12 volt SPST                    788-1268
 0.1uF    Capacitor                       613-0619
 0.47uF   Capacitor                       852-0212
 10uF     Capacitor                       852-7023
 1 Meg    Resistor                        895-0889
 100K     Resistor                        895-0775
 10K      Resistor    (2)                 895-0633
 1K       Resistor                        840-0399
 240 Ohm  Resistor                        840-0082

 Additional Parts:

 38KHz IR Receiver Module          (Radio Shack 276-640)
 12 Volt DC Power Supply


4 Decoded Toggle Switches
From Hand Held IR Remote Controls
Using the PIC12F629

  The circuit above illustrates using the IR receiver module along
  with a PIC12F629 microcontroller to decode 5 individual IR remote
  control keys so the circuit will only toggle one of the 4 outputs
  when a particular key is pressed. The 5th key is assigned to the
  master clear function that toggles off the 4 outputs. Works with
  most hand held IR remote controls that send a single data stream.
  However, some remotes send multiple groups of data and only the
  first set of 40 bits or less will be recognized. This may result
  in the circuit responding to more than one key, or a single key
  may control more than one toggle switch. In most cases this problem
  can be resolved by selecting an alternate function on the remote
  such as (TV, DVD, SAT, AUX, Etc.). Circuit power supply is not
  critical and should operate on any voltage from 2 to 5 volts DC.
  I use a single 3.6 volt recharageable lithium battery such as
  found in cell phones.

  Setup instructions to program the controller and record the desired keys.

  Step 1 -  Remove power and install a jumper wire from the input
            (pin 4) to ground.

  Step 2 -  Turn on 5 volt power to the circuit and the activity
            LED will flash 3 times and remain on.

  Step 3 - Remove the jumper from pin 4 and the activity LED should
           flash three more times and remain on.

  Step 4 - Press the desired keys in sequence to record the keys.
           The first key must be pressed twice to allow the program
           to establish the timing on the first press. So to program
           keys 1 to 5 you would press 1,1,2,3,4,5. At each keypress,
           the indicator should flash 3 times and remain on.

  Step 5 - At this point, the indicator light should be out and
           you can test each key to verify it toggles the correct
           output. The data is stored in no-volitile EEPROM so
           when the circuit is re-booted without the jumper it
           should be ready to use with the existing programed data.
           For test purposes, you may want to install LEDs and resistors
           on the 4 outputs to verify correct operation.

----------------------- PIC12F629 HEX File ----------------------



Back to Homepage