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?

Caleb West
  • 21
  • 2
  • (1) Not clear if you have shorted RTS with CTS on both sides. (2) Perhaps you should try serial loopback as well. – tlfong01 Oct 07 '20 at 06:32
  • try sending only the ON command several times – jsotola Oct 07 '20 at 06:50
  • Probably best to use /dev/serial0 rather than /dev/ttyAMA0. Is there activity on the link? – joan Oct 07 '20 at 08: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 07 '20 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 07 '20 at 12:08
  • @joan I will try using serial0 and see if that works. How do I see if there is activity? – Caleb West Oct 07 '20 at 12:08
  • Something like my piscope or for a command line option try monitor.py. – joan Oct 07 '20 at 12:10
  • @Caleb West. Ah sorry, Rpi does not have RTS and CTS, unless in the very unlikely case that you somehow installed a driver which has configured some GPIO pins as CTS and RTS. In other words, just short RTS amd CTS on the other side. – tlfong01 Oct 07 '20 at 12:51
  • @Caleb West, For serial loopback, these two references might help: (1) https://medium.com/@amitasinghchauhan/serial-port-debugging-101-loopback-test-4a7e40da9055 (2) https://raspberrypi.stackexchange.com/questions/105223/how-can-rpi4b-use-uart-to-read-and-analyze-received-data-at-a-3dr-fpv-air-radio – tlfong01 Oct 07 '20 at 12:59
  • @joan dev/serial0 worked! thanks so much! – Caleb West Oct 07 '20 at 17:51

2 Answers2

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.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144
0

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

Caleb West
  • 21
  • 2