How to Build an IR Remote Control Switch with Detailed Circuit Design

ir remote control switch circuit diagram

For a functional IR-based activator, pair a VS1838B receiver module (38 kHz carrier frequency) with a 555 timer IC in monostable configuration. Set the pulse width to 1.1 * R * C–use a 10 kΩ resistor and 100 µF capacitor for a 1.1-second output cycle. This ensures stable toggling without false triggers from ambient noise.

Connect the receiver’s output to a BC547 transistor to drive a SRD-05VDC-SL-C relay rated for 250VAC/10A. The relay’s coil requires 5V; verify compatibility with your setup’s voltage before soldering. A 1N4007 diode across the relay coil prevents voltage spikes from damaging the circuit.

Use a TSOP1738 as an alternative if the VS1838B is unavailable–both share identical pinouts but differ in sensitivity. Test the receiver’s signal with an oscilloscope; expect a clean 3.3V high pulse when detecting a valid IR burst. Avoid ambient light interference by shielding the receiver with a tubular plastic sleeve.

Power the board with a 7805 voltage regulator if the source exceeds 5V. Add a 1000 µF electrolytic capacitor at the input to stabilize fluctuations. For extended range, replace the emitter’s current-limiting resistor with a 220 Ω component and ensure line-of-sight alignment within 5 meters.

Fabricate the PCB using a single-sided copper board; etching solution (ferric chloride) typically takes 15–20 minutes for clean traces. Drill 0.8 mm holes for IC pins and 1.2 mm holes for through-hole components. Apply solder flux before reflow to prevent cold joints.

Label all connections: VCC (5V), GND, OUT (to relay), and SIG (from IR receiver). For debugging, probe the 555 timer’s output pin (pin 3)–a missing pulse indicates a faulty resistor or capacitor. Replace the 555 with a CD4017 decade counter if sequential toggling is needed.

Building a Wireless Signal-Activated Power Toggle

Start with an infrared receiver module like the VS1838B, configured for 38 kHz carrier frequency. Pair it with an ATtiny85 microcontroller to decode incoming signals–this combo consumes under 5 mA in standby. For the emitter, use an IR LED with a 940 nm wavelength and a 100 Ω current-limiting resistor; this ensures 3-5 meter range without overheating.

Wire the receiver’s output to the microcontroller’s input pin via a 10 kΩ pull-down resistor. Program the ATtiny85 to recognize a specific 32-bit NEC protocol sequence–this prevents false triggers from ambient light or other devices. Flash the firmware using a USBasp programmer; pre-compiled binaries simplify the process for beginners.

Use a logic-level N-channel MOSFET (e.g., IRLZ44N) to handle the load. Connect its gate to a microcontroller pin through a 220 Ω resistor to avoid voltage spikes. The source ties to ground, while the drain links to the appliance’s live wire. A flyback diode (1N4007) across the load safeguards against inductive kickback.

Component Part Number Max Rating Cost (USD)
Microcontroller ATtiny85 5V, 20 MHz 1.20
IR Receiver VS1838B 5V, 3 mA 0.50
MOSFET IRLZ44N 55V, 47A 0.85
IR LED 940 nm 100 mA 0.30

Power the setup with a 5V regulated supply–either a USB wall adapter or a linear regulator like the LM7805. Add a 1000 μF capacitor across the input to smooth voltage dips during switching. For AC loads above 100W, replace the MOSFET with a solid-state relay (e.g., MOC3021) to isolate high-voltage circuits.

Test signal decoding first. Point any NEC-compatible transmitter (e.g., Air Conditioner remote) at the receiver and monitor the microcontroller’s output with a logic analyzer or LED. Adjust the firmware’s pulse-width thresholds if the signal isn’t recognized–most NEC remotes send 560 μs start pulses followed by 1.68 ms data bursts.

Enclose the assembly in a non-conductive case, ensuring the IR receiver’s window isn’t obstructed. Solder joints should withstand 2A; use thicker gauge wire (22 AWG or lower) for the load path. For battery-powered variants, replace the ATtiny85 with an ESP8266 to add Wi-Fi feedback, though this increases standby current to ~80 mA.

Selecting an Optimal IR Sensor for Signal-Based Activation

ir remote control switch circuit diagram

Prioritize receivers with a 38 kHz carrier frequency–most consumer transmitters operate within this range, ensuring broad compatibility without additional calibration. Models like the TSOP38238, VS1838B, and HS0038B offer reliable capture within 2 meters under moderate ambient light, balancing sensitivity and noise rejection. Avoid generic variants lacking specified pulse-width tolerance, as they may misinterpret commands or fail under weak signals.

Key specifications to match include:

  • Modulation tolerance: ±2 kHz deviation from 38 kHz prevents false triggers from ambient interference (e.g., LED flicker or sunlight).
  • Supply voltage: 2.5–5.5V allows direct interfacing with microcontrollers; bypass capacitors (10 µF) stabilize performance in noisy environments.
  • Output logic: Open-drain or totem-pole configurations dictate pull-up resistor requirements (typically 4.7–10 kΩ for 5V systems).
  • Angle of reception: Narrow ±30° sensors (e.g., TSOP4838) reduce unintended captures, while wide-angle ±45° units (e.g., VS1838B) suit multi-directional setups.

Ambient conditions critically impact receiver choice. Indoors, standard modules suffice, but outdoor or high-glare environments demand AGC (Automatic Gain Control)-enabled sensors like the TFMS5360 or GP1UX511QS, which dynamically adjust sensitivity to filter sunlight or fluorescent noise. For battery-powered systems, prioritize low-power receivers (e.g., TSOP75338,

Verify signal protocol compatibility before finalizing a sensor. NEC, RC-5, and Sony formats dominate consumer electronics, but industrial variants may use Manchester coding or custom pulse trains. The TSOP348xx series supports multiple protocols out-of-the-box, while simpler receivers (e.g., HS0038B) require firmware decoding of raw pulses. For long-range applications (>5 meters), pair a high-gain lens-equipped receiver with a 940 nm IR emitter, but note that increased sensitivity heightens vulnerability to stray reflections.

Step-by-Step Assembly of an IR-Enabled Relay Board

Begin by soldering the TSOP1738 infrared receiver to the PCB, aligning its pinout with the labeled pads: OUT to the microcontroller input, GND to ground, and VCC to the 5V rail. Use a 220Ω resistor in series with the power line to limit current spikes during signal detection. Position the receiver at the edge of the board, ensuring a clear line of sight for the signal–avoid obstructing components like capacitors or bulky resistors within 2 cm of its lens. Test continuity between the receiver’s output and the microcontroller pin before proceeding.

Integrating the Microcontroller and Power Stage

ir remote control switch circuit diagram

Program the ATtiny85 with the firmware prior to installation, configuring pin PB0 as the IR signal input and PB1 as the relay driver output. Flash the chip using a USBasp programmer with the pre-compiled hex file, then insert it into the socket, matching the notch to the board’s silkscreen marking. Attach the relay module next–connect its coil terminals to PB1 via a 2N2222 transistor (base: 1kΩ resistor; emitter: ground), with a flyback diode (1N4007) across the coil to suppress voltage transients. Power the board via a 9V DC adapter, regulated to 5V by an LM7805, and verify operation by aiming a standard TV IR emitter at the receiver; the relay should toggle within 500 ms.

Programming an Arduino for IR Signal Decoding and Activation

Begin by installing the IRremote library via the Arduino IDE Library Manager–search for “IRremote” by shirriff and install version 3.6.1 or later. Connect the IR receiver module to pin 11 (or another digital pin) with the data line, ensuring proper grounding and VCC (3.3V–5V). Use the IRrecvDemo example sketch to capture raw signal data from your transmitter, pressing each button while monitoring the serial output at 115200 baud. Record the hexadecimal values for each command, noting protocol differences (e.g., NEC, Sony, RC5) as they dictate bit length and handling requirements.

Define button-specific values in an array or switch-case structure, mapping signals to actions (e.g., 0xFFA25D → toggle pin 5). For activation, use digitalWrite() or pulse-width modulation for dimmable outputs, incorporating 200ms debounce delays to prevent false triggers. Test edge cases: verify repeat codes (common in NEC) trigger only a single action, and separate distinct compressors (e.g., holding a button) from discrete on/off commands. Optimize memory by declaring constants with PROGMEM if storing more than 20 signal-action pairs.

Common Troubleshooting Tips for IR Signal Interference

Check for direct sunlight or bright halogen bulbs near the receiver. Infrared wavelengths from natural or artificial sources can mimic command pulses, causing false activations. Position the sensor behind a dark, non-reflective filter or rotate the device 30–45 degrees away from light sources to reduce ambient noise.

Replace Aging Batteries

Weak emitter cells lose modulation strength, leading to unreliable transmission. Test with fresh alkaline cells (1.5V+ per cell) or lithium-ion replacements (3.7V nominal). If the issue persists, measure the output current–healthy emitters should deliver 20–40mA during peak transmission; values below 15mA indicate degradation.

Inspect the PCB for oxidized contact points or cracked solder joints. Infrared receivers operate at 38kHz with narrow tolerance margins, and even minor corrosion can skew signal decoding. Use isopropyl alcohol (90%+) and a soft-bristle brush to clean contacts, then reflow joints with a temperature-controlled soldering station set to 320°C.

Verify protocol compatibility using an oscilloscope or logic analyzer. Many devices rely on NEC, RC-5, or Sony SIRC standards–ensure the transmitter’s carrier frequency (e.g., 36kHz, 38kHz, 40kHz) matches the decoder’s expectations. If cross-talk occurs between adjacent units, introduce a 25% duty cycle adjustment to the emitter’s PWM settings.