Serial wired remote

I had intentions of tying into the wired remote for an older adjustable bed to add control functions in home assistant. I have an esp32 and a separate switch relay control that I was going to use. It sounded easy enough until I cracked open the wired remote and found a serial communication between it and the control box.

I searched around for schematics on the control or the remote and didn’t find anything. I did however find the control box has a port for a cable to connect 2 beds together. I assume it will use the same serial communication that the wired remote uses.

Inside the remote, I have the RX, TX, ground, 5V, and USB. It has a USB port in the end of it for charging your phone.

If I connect the TX on the remote to the RX of the esp32 along with 5v and ground, what do I need to use in esphome and home assistant to read what the remote is sending to the control box when each button is pushed? If I can read and log this info, I hope I can transmit the same info to the control from the other port to do what I want.

Forget HA for a while, esphome logs is all you need here. You can use uart debug with dummy_receiver for that but you need to find uart parameters first. Guessing and trying… Also you need level shifting if uart is 5V.

Post a good photo of the remote.

ps. another approach would be connect to button contacts

Thanks! The other side of the remote is just buttons and leds.

I have been reading a lot of the esphome documentation. Now I know what to search for and read.

Thanks,
Wayne

I obviously don’t understand all the code behind it. Here is what I came up with. I loaded it to the ESP32 and booted it. I connected to it through the browser and ESPHome Web. It gives me basic bootup logs, so it did load and boot. I probably won’t get a chance to test it on the remote until sometime this weekend. Is this going to log what I want, or am I way off?

esphome:
  name: logger
  friendly_name: logger

esp32:
  board: nodemcu-32s 
  
uart:
  baud_rate: 9600
  tx_pin: GPIO1
  rx_pin: GPIO3
  #optional
  data_bits: 8
  parity: NONE
  stop_bits: 1

  debug:
    direction: BOTH
    dummy_receiver: TRUE
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

I am also looking at the level shift to keep 5V communication from frying the 3.3V ESP32.

Thanks again for the help.

Don’t use default uart pins for this. Use 16/17 for example.

You could also copy the baudrate select example from the page i linked, so you don’t have to compile/upload every time you try new one.

You can use just simple resistor voltage divider for level shift.

I finally got some time to mess with this. I used the esp32 and just wires to ground and the tx of the remote to the rx of the esp32. Pin 16

This is the code I used.

logger:
   level: VERBOSE
   baud_rate: 0 # Disable logging to console

uart:
  rx_pin:
    number: GPIO16
    inverted: false
    mode:
      input: true
      pullup: false
      pulldown: false
  baud_rate: 2400
  debug:
    direction: RX
    dummy_receiver: true
    after:
      timeout: 3ms
    sequence:
      - lambda: UARTDebug::log_hex(direction, bytes, ' ');

I got hex logs back from it with almost all baud rate settings. I didn’t have the resistors I needed on hand to convert the 5v to 3.3v. Using a meter I was getting a solid 5V while idle and it would pull down to about 2.6v while communicating. I think I will be able to get some info worth looking at once my logic level converter comes in.

Thanks for the help. I will post back when I have more info to share.

Correct, meter reads rapid high/low pulses as average.
You don’t need any specific resistor values as long as they make about 1:2 divider and stay in low kΩ range.
1.8k/3.3k or 4k7/10k for example