2

I have a raspberry pi zero W and a NEC PA500U projector, and am attempting to set up a semi-permanent slideshow installation. My main sticking point right now is getting the pi to communicate with the projector via RS232 control codes, in order to turn on and off the projector and set the input.

I have purchased this interface unit: https://www.amazon.com/gp/product/B00OPTOKI0/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 and hooked it up according to the wiring diagram provided. (GPIO 8 to the input of the converter, GPIO 10 to the output of the converter, 3V VCC in, and Ground to Ground).

From looking at some people who have done a similar thing, this is what I have for the code to turn the projector on and set the source to HDMI, however it is not working for me.

import sys
import serial
import time


ser = serial.Serial(
    port='/dev/ttyAMA0',
    baudrate=38400,
    bytesize=serial.EIGHTBITS,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    )

ser.close()
ser.open()
ser.isOpen()
    

ON=bytearray([0x02,0x00,0x00,0x00,0x00,0x02])
HDMI=bytearray([0x02,0x03,0x00,0x00,0x02,0x01,0x1A,0x22])

ser.write(ON)
received = ser.read(8)
print(received)
time.sleep(15)
ser.write(HDMI)
received = ser.read(8)
print(received)
ser.close

The code seems to be getting caught up on the line

ser.write(ON)

which as far as I can tell should be correct.

This is the page from the projector manual detailing the control codes

This is the page from the projector manual detailing the control codes. I am only using power on, HDMI, and Power off. I have shorted the RTS and CTS on the converter end.

Can anyone point me in the right direction as to what I may be doing wrong?

10
  • (1) Not clear if you have shorted RTS with CTS on both sides. (2) Perhaps you should try serial loopback as well.
    – tlfong01
    Oct 7, 2020 at 6:32
  • try sending only the ON command several times
    – jsotola
    Oct 7, 2020 at 6:50
  • Probably best to use /dev/serial0 rather than /dev/ttyAMA0. Is there activity on the link?
    – joan
    Oct 7, 2020 at 8:08
  • 1
    @tlfong01 I have shorted it on the converter, but am unsure how to short it on the pi. How would I try loopback?
    – Caleb West
    Oct 7, 2020 at 12:07
  • @jsotola I don't think this would help, as it is not even executing once. It gets to the write command, and simply freezes
    – Caleb West
    Oct 7, 2020 at 12:08

2 Answers 2

3

Shorting CTS / RTS lines is meaningless, you should rather leave them unconnected if you don't use flow control. Note that CTS / RTS signals are available on Pi side (pins 11 and 36, respectively), but they are rarely needed and not enabled by default.

I'd say, you have two ways of debugging:

  1. Get a USB to serial converter (and perhaps connect it to a laptop instead of the Pi) to exclude any hardware problems and debug the projector protocol.

  2. Connect your converter to a computer instead of the projector to exclude the protocol-related issues and debug the hardware by checking raw data being sent/received.

The #2 can be replaced by a loopback test (shorting the TX and RX pins on RS232 side), but bear in mind that the converter is likely to understand its own signals even if the signal amplitude and baudrate are wrong.

0

use /dev/serial0 as the port instead of /dev/ttyAMA0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.