top of page
Writer's pictureSanskruti Ashtikar

Infrared Remote Control Using 8051 Microcontroller

Introduction


Infrared (IR) remote control systems are widely used in consumer electronics such as televisions, DVD players, and air conditioners. In this project, we will design an IR remote control system using the 8051 microcontroller. The system will be able to receive IR signals from a remote and perform corresponding actions.


Components Required


  • 8051 Microcontroller (e.g., AT89S52)

  • TSOP1738 IR Receiver

  • IR Remote (e.g., a TV remote)

  • 16x2 LCD Display (optional for displaying commands)

  • Resistors (10kΩ, 1kΩ)

  • Capacitors (33pF, 100μF)

  • Crystal Oscillator (11.0592 MHz)

  • Breadboard and Connecting Wires

  • Power Supply (5V)

  • LEDs (for visual indication)


Circuit Diagram


The IR receiver TSOP1738 is connected to the 8051 microcontroller. The received IR signals are processed by the microcontroller to perform actions such as turning on/off an LED.


+5V ----- +5V
          |
          |
         TSOP1738
         +---+
   +5V --|VCC| 
         |    |
         |OUT |------- P3.2 (8051)
         |    |
   GND --|GND | 
         +---+

Pin Connections


  • TSOP1738 IR Receiver:

  • VCC to +5V

  • GND to Ground

  • OUT to P3.2 of 8051

  • LEDs:

  • Connect LEDs to P1.0-P1.3 with 1kΩ resistors in series

  • LCD (Optional):

  • RS to P3.6 of 8051

  • RW to Ground

  • E to P3.7 of 8051

  • D4-D7 to P2.4-P2.7 of 8051


Software Implementation


The code is written in C using Keil uVision IDE. It involves configuring the 8051 to receive IR signals from the TSOP1738 and decode them.


#include <reg51.h>
#include "lcd.h"
sbit IR_RECEIVER = P3^2; // IR receiver pin
void delay(unsigned int count) {
    int i,j;
    for(i=0;i<count;i++)
        for(j=0;j<1275;j++);
}
unsigned char receive_IR() {
    unsigned char ir_data = 0x00;
    unsigned char i;
    for (i = 0; i < 8; i++) {
        while(IR_RECEIVER == 0); // Wait for high
        delay(1); // Small delay
        if (IR_RECEIVER == 1) {
            ir_data |= (0x01 << i); // Store bit
        }
        while(IR_RECEIVER == 1); // Wait for low
    }
    return ir_data;
}
void main() {
    unsigned char ir_code;
    lcd_init(); // Initialize LCD (optional)
    
    while(1) {
        ir_code = receive_IR(); // Receive IR code
        lcd_cmd(0x80); // Move cursor to first line
        lcd_write_string("IR Code: ");
        lcd_write_char(ir_code); // Display IR code
        
        // Perform action based on IR code
        switch(ir_code) {
            case 0x10:
                P1_0 = ~P1_0; // Toggle LED1
                break;
            case 0x20:
                P1_1 = ~P1_1; // Toggle LED2
                break;
            case 0x30:
                P1_2 = ~P1_2; // Toggle LED3
                break;
            case 0x40:
                P1_3 = ~P1_3; // Toggle LED4
                break;
            default:
                break;
        }
        
        delay(1000); // Small delay for debouncing
    }
}

Explanation


  1. Initialization:

  2. LCD Initialization: The lcd_init() function sets up the LCD (optional).

  3. Receiving IR Signals:

  4. The receive_IR() function reads the IR signal bit by bit and reconstructs the 8-bit code. It waits for the IR receiver to go high, reads the bit, and then waits for it to go low.

  5. Performing Actions:

  6. The main loop continuously receives IR codes and displays them on the LCD.

  7. Based on the received IR code, the program toggles corresponding LEDs.


Conclusion


This project demonstrates the use of the 8051 microcontroller to create an IR remote control system. The system can receive IR signals from a remote, decode them, and perform corresponding actions such as toggling LEDs. This project is a great way to learn about IR communication, sensor interfacing, and using microcontrollers for remote control applications.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


2 views0 comments

Related Posts

See All

Comments


bottom of page