Serial Projector control with ESPHome

Hook your rs232 converter up to a serial port on a PC, a USB to serial adaptor is fine if your PC does not have a physical serial port.

Open a terminal on your PC (e.g. Putty), connect to the comm port, 9600 baud 8/N/1.

Turn your switch on and off.

Do you see the commands printed in the terminal?

To anyone who tries this and fails (like I just did). You must use double quotes when you want ESPHome’s uart component to interpret special charaters in the data field correctly. This is explained here. And yes, you find this out using the method that tom_l suggested.

I have tested the code below and it works with an Epson EMP-TW700 projector. It should work with any ESP/VP21 protocol projector (as e.g. listed here)

uart:
  tx_pin: 39  # Change these settings as needed.
  rx_pin: 37
  baud_rate: 9600
  id: projector_uart

switch:
  - platform: template
    name: "Projector Power"
    assumed_state: True
    optimistic: True
    turn_on_action:
      - uart.write:
          id: projector_uart
          data: "PWR ON\r\n"
    turn_off_action:
      - uart.write:
          id: projector_uart
          data: "PWR OFF\r\n"

Also, I suggest adding assumed_state: True to the switch. This is the correct way of handling switches that do not have a feedback. The switch icon becomes a lightning bolt, and you can turn the projector on or off multiple times without having to toggle the switch (e.g. when you forget to switch on the mains or you use the remote as well).

Cheers, AndBu

3 Likes

I have feedback.

You might too. It comes from the screen trigger output.

With the code below, the LED on the MAX3232 flashes when I turn the switch on/ off from HA. But the projector (Epson Home Cinema 3200) does not respond. So I guess the communication upto the projector is ok? Unable to think of what to do next.

uart:
  tx_pin: GPIO1  # Change these settings as needed.
  rx_pin: GPIO3
  baud_rate: 9600
  id: projector_uart

switch:
  - platform: template
    name: "Projector Power"
    optimistic: true
    turn_on_action:
      - uart.write:
          id: projector_uart
          data: "PWR ON\r\n"
    turn_off_action:
      - uart.write:
          id: projector_uart
          data: "PWR OFF\r\n"

I also tried hooking my PC with Putty on it to the projector. I connected a USB TTL device to my laptop. Tx to the MAX3232 Rx and vice versa. Selected my COM port and opened the putty window but the blank putty window that opened wouldnt let me type anything into it.

The terminal should work.

How should I troubleshoot? The putty window opens but there is no prompt, nothing. Nothing can be typed into the window either. Tried using another USB TTL device too. Same thing.

Do you need to enable the serial connection in your projector menu?

The terminal just worked for me.

Try using a straight serial to USB adapter to connect direct your PC to your projector. Something without TTL conversion as your PC and projector both work at RS232 voltages, something like this: https://www.jaycar.com.au/usb-to-db9m-rs-232-converter-1-5m/p/XC4834

From memory I had issues with Putty too. Can’t remember which terminal program I ended up using,

1 Like

I bought the cable (though not costing 40 bucks like the one in your link)

Seems to detect on the port just fine. But the result is the same, a cursor in the window which I cant type anything into. This time im using teraterm instead of putty.

What are your serial settings?

Should be 8,N,1 and none, 9600 baud.

Also check in windows Device Manager that the port driver is installed correctly.

I am trying something similar at the moment. I hooked up the UART of my ESP32 to an MAX3232 based TTL-RS232 Converter. Unfortunateley the projector is not reacting on any commands. I though can receive messages when turning on the projector with the remote.

I hooked up my oscilloscope to the Converter and can confirm that the RS232 Converter is working flawlessly. I think the problem is the MAX3232 with its +/-5.4V output levels as classical RS232 has +/-12-ish V Levels. So the projectos RS232 Controller may not correctly detect HIGH and LOW Levels. Maybe its also a bit luck regarding tolerances in the projectors RS232 controller and the MAX2323. This would explain why it’s working for some and for some dont. Also it would explain why I can receive but not transmit.

You have to send a carriage return after each command.

Does anyone know if this would work on my inFocus projector?

Just getting started with this and wondered what it would take to get information back from the projector into home assistant. I don’t see in your wiring diagram that you connect a TX pin on the Projector side yet you did define both a tx and rx pin on the uart.
I was hoping to catch the response from both the PWR? and LAMP? commands as they should return the current power mode and the lamp hours respectively or at least on my projector anyway.

See: [How to] UART read without custom component - #3 by jazzmonger

As a newbie to ESPHome, I’ve been reading thru your github info and struggling with migrating this to work with my Epson projector.

With respect to the switch portion, I’m confused what the lambda portion does. I’m assuming the Optoma returns “OK#” after each command received? The Epson seems to respond with just a colon. More importantly where does the returned true/false get used. Is that a condition checked in the included uart library, or is this published to mqtt somehow.

I’m also looking to include additional switches to set colour mode and aspect, as well as a sensor to capture power status and lamp status (hours), but I’m wondering how to set the topic and how to publish that info to mqtt

Curious if you ever got this to work. My attempt is behaving much the same way. I have already connected my computer to my projector successfully with putty and confirmed all my required commands, but can’t seem to get anywhere with my esp8266. I can turn on the switch in Home Assistant or thru the esp web interface but neither creates any serial data when connected to the putty terminal.

Nope, no headway with serial control whatsoever.

FYI, in the years that I’ve been using this without command feedback I’ve never had a command fail. Having the power state feedback from the projector screen trigger output is useful enough.

I’ve read the logger on the 8266 also uses uart0, which may or may not be part of the issue. I can’t test until tomorrow but I understand the logger settings below will at least prevent Esphome from using it

logger:
level: none
hardware_uart: UART1

I’ve also ordered a couple ESP32s to provide some additional uart options.

My trigger output is currently hardwired to my screen which retracts into the ceiling when the projector is off, so didn’t wanna mess with that.

Fair enough. Though monitoring it should not prevent it from working. The ADC input (even with the voltage divider) is quite high impedance.