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