IR Signal detect notes

Active today
Viewed 45 times

I am trying to record the IR codes from my projectors remote. Nothing seems to be working and I need some help.

I want to be able to directly record the IR signals that my remote is putting out when a button is pressed.

My thinking is that I just need to solder some wires to “tap” the IR LED and feed those wires into the GPIO on the Pi.

I do not have an IR receiver sensor, and dont really want to order one. At this point I want to get this idea to work as a proof of concept.

Currently I have the folliwing: Raspberry Pi 3b+ (buster) Optoma HX180X projector Projector Remote Control (random remote control model number is CN1082)

I have LIRC installed on my Pi. I used the following forum post to install it. It seems like the only legit way to install it. https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256

I soldered a wire to the + and – of the IR LED. I plugged the + wire into PIN18 GPIO of my PI. I plugged the – wire into the ground of my PI (I tried using a shard ground, no ground, floating ground… nothing seems to work).

There are three issues I am running into: 1. Some times the IR LED is “ON” 100% of the time. When everything is plugged in to the PI I can see the LED is 100% lit (using my cell phone camera). When I unplug the GPIO or the Ground it shuts off. Not sure if this is due to the GPIO outputting a voltage for some reason I have it set to input, or an issue with the LED diode voltage being exceeded, or the ground not being correct so it is… I have no clue! 2. Some times I can get it to not be “ON” 100% of the time, and then I can run mode2 in LIRC, but it just spams SPACE 2 PAUSE 2 SPACE 3 PAUSE 3 SPACE 2…. fills up the console instantly. 3. I cant even use -f with irreecord to get the non-gapped signals.

Ive tried pullup and pull down resistors, neither did anything.

Does anyone have any advice on how to make this work. I have been trying everything and feel that I am missing something super obvious.

Please help!


share  edit  follow  close   flag
 New contributor
  • 1
    @tlfong01 , Your site came up during my research, but it wasnt helpful for my specific use case. Because I am hard wired directly to the remote control IR LED. You did an awesome job documenting everything though. Do you have some time to do a zoom call and maybe help me trouble shoot? – JohnKubik yesterday
  • 1
    Ah, no problem then. Thank you for trying to help… Actually, could you try and solder the +/- leads of your remote control IR led and see if it works for you? – JohnKubik yesterday
  • 1
    So what would you suggest the circuit look like? – JohnKubik yesterday
  • 1
    Correct. I included a picture of what I want in the original post. – JohnKubik yesterday
  • 1
    OK, so I can’t arratch a picture apparently. But you are correct. I want to attach a wire to the + end of the Remote Control IR led, and read the signal of it directly from a gpio pin. – JohnKubik yesterday

2 Answers



The OP wants to read the output voltage of the IR LED output of his CN1082 remote. So he connects one wire seemingly directly to one end of the IR LED (not sure anode or cathode, he says “+”) to Rpi GPIO pin 18, another wire to Rpi Ground.

The OP had no luck. How to fix it?

cn1082 remote

/ to continue, …


Not sure if the OP’s remote uses 1.5V x 2 = 3V batteries, or a 6V button cell. If 6V is used to power the remote, then the OP’s Rpi might have already fried, because connecting the GPIO pin, whether with or without any current limiting, voltage dividing resistor, might trigger a “latching up” thing, frying the Rpi immediately, in 15 minutes, or shortening the life of the Rpi.

So assuming the poor Rpi is already fried, let us do a postmortem.

Usually an NPN or PNP BJT switch is used to switch on/off the IR LED, as show in the schematic below.

Now that we have two scenarios: NPN story and PNP story. Perhaps the OP can use a multi-meter (does he has one?) to verify the remote is using an NPN or PNP switch. If he does not have, or doesn’t know how to use any multimeter, then we can make wild guesses and do trials and errors, using other GPIO pin, because GPIO pin18 is also fried, if not the whole Rpi.

npn pnp switch

/ to continue, …


(1) Rpi3 LIRC Library and UART IR Transceiver Setup Problem

(2) How can Rpi UART control an IR Remote HDMI switcher?

(3) LM393 Low-Power, Low-Offset Voltage, Dual Comparators – TI

(4) Optoma H180X Projector 720P Home Video Projector

(5) ViewSonic CN1082 PROJECTOR Remote Control – £20

(6) ViewSonic PX700HD Full HD Home DLP Projector (3500 Lumens, 1080p, 3xFast Input, 14 options £422

(7) ViewSonic PX701HD Projector User Guide (Page 62 IR Control Table)

(8) Python IR Code Testing Program firc71.py

/ to continue, …


/ to continue, …


Fig 1 – Rpi GPIO IR LED


Fig 2 – LM293 Summary

lm293 summary

/ to continue, …

Program Listings

List 1 – Test Sending IR Code UART Transceiver Module

(8) Python IR Code Testing Program firc71.py

uart ir transciver 1

uart ir transceiver 2

uart ir transceiver 3

# *** LIRC Test Functions ***

def testSendIrCode01():
    print('\n*** Begin Test Send IR Code ***') 
    serialPort = serialPort0
    writeBytes = b'\xa1\xf1\x00\xff\x16' # Mini Remote Controller #1 Digit 1 Button code
    print('      bytes written = ', writeBytes)
    print('*** End  Test Send IR Code ***')

# firc_71_2019sep2201.py tlfong01 2019sep22hkt1154
# Rpi4B, raspbian 10 buster, python 3.7.3 Thonny

# Rpi Config serial port setup: (1) Enable serial interface, (2) Disable serial console

# Test 1   - Python string and byteArray datatype print demo
# Function - Print string and databyte variables
# Setup    - None

# Test 2   - Repeat send bytes in databyte array, using scope to display TxD signal waveform  
# Function - Repeat sending bytes, pause between bytes
# Setup    - TxD (BCM GPIO #14, Rpi PCB 40 pin connector Pin #8)

# Test 3   - Loop back TxD output to Rxd.
# Function - Send bytes to TXD, wait (Note 1), receive bytes from RXD. 
# Setup    - Connet TxD, GPIO 14, Brd Pin 8, to RxD, GPIO 15, Brd Pin 10, to form a loopback.

# Test 4   - Send IR code '\xa1\xf1\x00\xff\x16' (Mini Remote ontroller Digit 1 Button
# Function - Send IR code b'/bytes to TXD, wait (Note 1), receive bytes from RXD. 
# Setup    - Connet Rpi's TxD pin to UART Interface IR emitter/receiver module's RxD pin,
#            Connect Another IR Emitter/Receiver's TxD pin to Win10 RealTerm USB to UART TTL's
#            RxD pin.  RealTerm configures to 9600, 8N1 and display to Hex.
# Results  - (1) Rpi sends '\xa1\xf1\x00\xff\x16',
#            (2) UART Interface IR Emitter/Receiver red status LED blinks once.
#            (3) RealTerm displays "00FF16"

# Note 1
# Bolutek BlueTooth BC04 needs at least 10mS to respond, will time out if not waiting.

from   time import sleep
import serial

# *** Setup and config UART ***

# *** Setup Rpi On Board UART ***
serialPort0 = serial.Serial(port = '/dev/serial0',
        baudrate = 9600,
        parity = serial.PARITY_NONE,
        stopbits = serial.STOPBITS_ONE,
        bytesize = serial.EIGHTBITS,
        timeout= 1)

# *** Setup USB to Serial Adapter/Cable ***
# devTtyUsb0 = serial.Serial(port = '/dev/ttyUSB0',
#        baudrate = 9600,
#        parity = serial.PARITY_NONE,
#        stopbits = serial.STOPBITS_ONE,
#        bytesize = serial.EIGHTBITS,
#        timeout= 1)

# *** Serial Functions ***

# *** Set baudrate ***

def setSerialPortBaudRate(serialPort, baudrate):
    #print('      setting baudrate')
    print('      baudRate                    =', baudrate)
    serialPort.baudrate = baudrate

# *** Write bytes and repeat write bytes ***

def serialPortWriteBytes(serialPort, writeBytes):

def testSerailPortRepeatWriteBytes(serialPort, writeBytes, betweenBytePauseSeconds, repeatCount):
    #print('       Begin repeatWriteOneByte(), ...')   
    for i in range(repeatCount):
        serialPortWriteBytes(serialPort, writeBytes)                
    #print('       End   repeatWriteOneByte().')

# *** Read bytes ***

def serialPortReadBytes(serialPort, maxBytesLength):
    readBytes = serialPort.read(maxBytesLength)
    return readBytes

# *** Write-Wait-Read Bytes and Loopback ***

def serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime):
    #print('\n*** Testing LoopBack ***')
    readBytes = serialPortReadBytes(serialPort, maxBytesLength)
    print('        bytes written = ', writeBytes) 
    print('        bytes read    = ', readBytes)
    return readBytes

def serialPortLoopBack(serialPort, writeBytes, maxBytesLength, waitTime): 
    #print('\n*** Begin serialPortLoopBack() [Remember to connect Tx to Rx!] ***')
    print('    Begin serialPortLoopBack(), ...')    
    serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime)     
    print('    End   serialPortLoopBack(), ...')

# *** Test Functions ***

# *** Testing print python string and byteArray (Just printing, not using serial) ***

def testPrintString01():
    print('\n*** Begin Testing Print String ***')
    testString1 = 'abc'
    print('    testString1      =', testString1)
    testCharArray2 = ['x', 'y', 'z']
    print('    testStringArray2 =', testCharArray2)
    testString3 = testCharArray2[0] + testCharArray2[1] + testCharArray2[2]
    print('    testString3      =', testString3)
    print('*** End   Testing Print String ***')

# *** Testing bytearray ***

def testPrintByteArray01():
    print('\n*** Begin Testing Print ByteArray ***')
    testByteArray4 = b'AT\r\n'
    print('    testByteArray4   =', testByteArray4)
    testString5 = testByteArray4.decode('utf-8')
    print('    testString5      =', testString5)
    print('*** End  Testing Print ByteArray ***')

def testSerialRepeatSendBytes01():
    print('\n*** Begin Test Repeat Write Bytes ***')

    serialPort              = serialPort0
    baudrate                = 9600
    pauseSeconds            = 0.01
    repeatCount             = 100

    writeBytes = b'\x00\xff\x55\xff\x00'

    #print('    Begin repeatWriteOneByte(), ...')
    print('      Write byte                  =', writeBytes)
    print('      Pause second between writes =', pauseSeconds)
    print('      Repeat count                =', repeatCount)

    setSerialPortBaudRate(serialPort, baudrate)
    testSerailPortRepeatWriteBytes(serialPort, writeBytes, pauseSeconds, repeatCount)
    print('*** End   Test Repeat Write Bytes. ***')

def testSerialLoopbackBytes01():
    print('\n*** Begin Test Serial Port Loopback ***')
    serialPort              = serialPort0
    writeBytes              = b'abcxyz'
    maxBytesLength          = 32
    waitTime                = 0.01
    serialPortLoopBack(serialPort, writeBytes, maxBytesLength, waitTime)
    print('*** End   Test Serial Port Loopback ***')

# *** LIRC Test Functions ***

def testSendIrCode01():
    print('\n*** Begin Test Send IR Code ***') 
    serialPort = serialPort0
    writeBytes = b'\xa1\xf1\x00\xff\x16' # Mini Remote Controller #1 Digit 1 Button code
    print('      bytes written = ', writeBytes)
    print('*** End  Test Send IR Code ***')

# *** Main Tests ***

def mainTests01():
    #print('\n*** firc71_2019sep2201.py tlfong01 2019sep22hkt1206 ***\n')   

    # *** Preliminary UART Test ***

    # *** IR Signal Send/Receiver Test ***

# *** Main Tests ***


# *** End of Program ***

# *** Sample output  tlfong01 2019apr0801 ***

>>> %Run fuart71.py

*** Begin Testing Print String ***
    testString1      = abc
    testStringArray2 = ['x', 'y', 'z']
    testString3      = xyz
*** End   Testing Print String ***

*** Begin Testing Print ByteArray ***
    testByteArray4   = b'AT\r\n'
    testString5      = AT

*** End  Testing Print ByteArray ***

*** Begin Test Repeat Write Bytes ***
      Write byte                  = b'\x00\xffU\xff\x00'
      Pause second between writes = 0.01
      Repeat count                = 100
      baudRate                    = 9600
*** End   Test Repeat Write Bytes. ***

*** Begin Test Serial Port Loopback ***
    Begin serialPortLoopBack(), ...
        bytes written =  b'abcxyz'
        bytes read    =  b'abcxyz'
    End   serialPortLoopBack(), ...
*** End   Test Serial Port Loopback ***


>>> %Run fuart71.py

*** Begin Test Send IR Code ***
      bytes written =  b'\xa1\xf1\x00\xff\x16'
*** End  Test Send IR Code ***


# *** End of Sample Outputs ***

# *** End ***

/ to continue, …

share  edit   delete  flag
  • 1
    It uses 3v (2x AA). – JohnKubik 22 hours ago
  • Ah, so your Rpi is still alive. Postmortem changed to circuit analysis. Reference list updated. – tlfong01 21 hours ago   
  • 1
    You are a beast! I really like the way you do a reference list. – JohnKubik 21 hours ago
  • Thank you for your nice words. BTW, your remote might not use the stupid 2N2222. It might use LM393 or more complicated ASIC such as that for my IR Transceiver. Ah supper time! So see you late this evening, or tomorrow. Good luck. Cheers. – tlfong01 21 hours ago   


Provided you have conditioned the signal to be Pi safe (low of 0V, high of 3V3) you can read it at any GPIO.

My piscope program will allow you to view and capture the signal.

Please be aware that the signal may or may not have the (38kHz approximately) carrier wave. It depends where you are tapping off the signal at the remote controller.

share  edit  follow    flag
  • 1
    Not sure how to condition it. I took the sign directly off of the Remote as shown in the photo in the other answer. – JohnKubik 22 hours ago

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: