1

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!

Thanks!!

tlfong01
  • 4,665
  • 3
  • 10
  • 24
JohnKubik
  • 11
  • 1
  • perhaps search LIRC tlfong01 – tlfong01 May 25 '20 at 02:11
  • 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 May 25 '20 at 02:24
  • Ah, let me see. I can zoom Cantonese, Shanghaiese, or Mandrin, but me no spoken English. I can chat broken English over StaclExahange without any problem. – tlfong01 May 25 '20 at 02:38
  • 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 May 25 '20 at 02:41
  • You are welcome. I read your question again and found a little problem - you are connecting LED (anode or cathode) to GPIO (with or without a current protecting biasing resistor). This might be problematic, because you might be affecting LED load, (even GPIO High Z input with 50k pull up) Usually I trace the pullup NPN BJT at LED and tap the collector terminal. By the way, have you read my other IR answer: "Rpi UART control IR Remote HDMI switcher? 2019jun22 Viewed 763 times": https://raspberrypi.stackexchange.com/questions/99823/how-can-rpi-uart-control-an-ir-remote-hdmi-switcher. Cheers. – tlfong01 May 25 '20 at 03:10
  • 1
    So what would you suggest the circuit look like? – JohnKubik May 25 '20 at 03:18
  • Ah, I have not touched this stuff for a while and need to refresh my mind a bit.. I agree that my two answers do not solve your problem. I am confused myself. I need to think harder. Let me first repeat/confirm your user requirement or constraint, you don't wish to use any external IR sensor etc. *All you want is to extract two wires from inside*, to the Rpi GPIO pin directly, or indirectly with resistors or NPN BJT. Cheers. – tlfong01 May 25 '20 at 03:22
  • 1
    Correct. I included a picture of what I want in the original post. – JohnKubik May 25 '20 at 03:24
  • 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 May 25 '20 at 03:27
  • Is it something like fig 1 in my answer? – tlfong01 May 25 '20 at 03:44
  • Let use go to the chat room, where you can more easily upload your pictures. See you there. – tlfong01 May 25 '20 at 03:48
  • 1
    How do I go to the chat room? – JohnKubik May 25 '20 at 04:25

2 Answers2

1

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.

joan
  • 71,024
  • 5
  • 73
  • 106
  • 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 May 25 '20 at 08:34
0

Question

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, ...


Answer

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, ...


References

(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, ...


Appendices

/ to continue, ...


Figures

Fig 1 - Rpi GPIO IR LED

Rpi GPIO IR LED


Fig 2 - LM293 Summary

lm293 summary


Fig 3 - CN1082 IR Control Code Table

cn1082 ir code talbe

/ 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
    serialPort.flushInput()
    serialPort.flushOutput()
    writeBytes = b'\xa1\xf1\x00\xff\x16' # Mini Remote Controller #1 Digit 1 Button code
    serialPort.write(writeBytes)     
    print('      bytes written = ', writeBytes)
    print('*** End  Test Send IR Code ***')
    return

# 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
    return

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

def serialPortWriteBytes(serialPort, writeBytes):
    serialPort.write(writeBytes)
    return

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

# *** 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 ***')
    serialPort.flushInput()
    serialPort.flushOutput()
    serialPort.write(writeBytes)
    sleep(waitTime) 
    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(), ...')
    return

# *** 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 ***')
    return

# *** 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 ***')
    return

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. ***')
    return

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 ***')
    return

# *** LIRC Test Functions ***

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

# *** Main Tests ***

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

    # *** Preliminary UART Test ***
    #testPrintString01()
    #testPrintByteArray01()    
    #testSerialRepeatSendBytes01()
    #testSerialLoopbackBytes01()  

    # *** IR Signal Send/Receiver Test ***
    testSendIrCode01()

# *** Main Tests ***

mainTests01()

# *** 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, ...


tlfong01
  • 4,665
  • 3
  • 10
  • 24
  • 1
    It uses 3v (2x AA). – JohnKubik May 25 '20 at 08:33
  • Ah, so your Rpi is still alive. Postmortem changed to circuit analysis. Reference list updated. – tlfong01 May 25 '20 at 09:04
  • 1
    You are a beast! I really like the way you do a reference list. – JohnKubik May 25 '20 at 09:12
  • 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 May 25 '20 at 09:32