Infrared remote control fast encoding and decoding (NEC)

Infrared remote control fast encoding and decoding NEC encoding and decoding module

Introduction to infrared remote control

Infrared remote control is composed of a transmitting part and a receiving part. The transmitting part controls the infrared light-emitting tube to emit modulated infrared rays to transmit the information to be sent. The receiving part of the circuit is emitted by the infrared receiving tube and other infrared receiving devices. The infrared light transmits the signal to the amplifier and other decoding equipment to restore the infrared emission information!

NEC code

The NEC code here is a modulation method of infrared. The transmitted infrared is specifically coded to send the information we need to send. The receiving end decodes the code at the transmitting end to restore the information. The coding method we use today is NEC. Encoding, there are other RC5, RC6 many encoding methods

Infrared codec module

If we directly encode and decode an infrared transmitting tube and an infrared receiving tube, it can be achieved through a program such as 51 single-chip microcomputer, but we use a module for encoding and decoding today, and the module has a built-in single-chip processor for convenience. Use, but also to test the module, let’s look at the module first

Figure 1 Front of NEC module
Figure 2 The back of the NEC module

The serial port communication used by the module can be controlled by the serial port of the single-chip microcomputer or connected to the computer with USB-TTL. Here, connect it to the computer to check the data of the NEC coded remote control we prepared and send it out. Refer to the table below for the description of the module pins.

Pin Features
GND Power ground
RXD Serial port receiving pin
TXD Serial port sending pin
VCC Power is positive

Wiring instructions

Here we prepare a local gold USB-TTL to connect the infrared codec module and the computer
Insert picture description here
according to the following table (other USB-TTL modules are acceptable)

USB-TTL Infrared decoding module
GND GND
RXD TXD
TXD RXD
5V VCC

It must be noted here that the two pins TX and RX are cross-wired. Below is the wiring diagram I connected.

Insert picture description here

Serial port view data

The following is the NEC coded remote control I found

Insert picture description here
After the NEC decoding module is connected to the computer and plugged into the computer, the remote control will first touch the module and press the button. At this time, the light on the module will flash to indicate that the decoding is successful. If it does not flash, the remote control may not be larger. NEC coded.
Before we made sure that the remote control was coded by NEC, and the module was fine. At this time, we open the serial port software on the computer to view the data sent by the remote control. Before viewing the data, we first check the port number of the module on the computer.
Open the computer device manager and find your own port number in the figure below. It may be different depending on the computer.
Insert picture description here
Here, my port number is COM9, COM9 is selected in the serial port software, and the parameter is set to 96n81 (if the baud rate has not been modified)

Insert picture description here

Then just click the remote control to test it, I click 1 here, the following 00 FF 0C is the data received when 1 is pressed

Insert picture description here

At this point, we can know the data sent by the remote control corresponding to button 1, and then we can simulate button 1 to send the original data to simulate button 1 pressed, enter A1 F1 00 FF 0C in the multiple sending boxes and click send , F1 is returned, the transmission is successful, A1 is the address code of the module, F1 is the data to be sent out, 00 FF 0C is the data to be sent out

Insert picture description here

data verification

Here we see the received data. Some friends need to verify that the received remote control data is correct. If the remote control is temporarily not controlled by the device to verify, then I use two infrared decoding modules here, one after the launch The other received data is the same as the data sent by the remote control, it is a success

to sum up

The process is simple to operate, and similar articles will be published for a long time. Welcome to pay attention. This issue of electronic scales is here. Please feel free to leave a message. If you need information, you can also leave a message below!

Guess you like

Origin blog.csdn.net/qq_42250136/article/details/106938775