Ok, so not making much progress here sad to say. Have built a physical connector that I think is pinned correctly between the ESP32 and RJ12 connector, plugged it in and nothing exploded . Did it with a cross over setup, rx-tx and tx-rx, guess that is the right way to do it?
Interesting the ground pin is not mentioned in the ESPHome UART docs, should this NOT be used, it is standard for RS232?
Still struggling to figure out how to send and receive, so right now not even capable of figuring out is anything is actually getting to the AMP and if the pinout is correct.
Testing a simple swith to send a “power off” command (think I got it right), but can see no responses from the AMP.
This is the current config:
esphome:
name: esp-stereo
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# UART Serial interface
uart:
baud_rate: 57600
tx_pin: GPIO17
rx_pin: GPIO16
rx_buffer_size: 256
data_bits: 8
parity: NONE
stop_bits: 1
debug:
direction: BOTH
dummy_receiver: false
sequence:
- lambda: UARTDebug::log_binary(direction, bytes, ',');
# Enable Home Assistant API
api:
encryption:
key: "xxxxxx"
ota:
password: "xxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp-Stereo Fallback Hotspot"
password: "xxxxxx"
captive_portal:
#test serial hex input, request for power toggle
switch:
- platform: uart
name: "Off"
data: [0x06, 0x01, 0x00, 0x75, 0x00, 0x7C]'
And this is the log I get when toggling the switch:
INFO Reading configuration /config/esphome/esp-stereo.yaml...
INFO Starting log output from esp-stereo.local using esphome API
INFO Successfully connected to esp-stereo.local
[12:30:59][I][app:102]: ESPHome version 2022.11.3 compiled on Nov 28 2022, 09:13:40
[12:30:59][C][wifi:504]: WiFi:
[12:30:59][C][wifi:362]: Local MAC: C8:F0:9E:9E:10:4C
[12:30:59][C][wifi:363]: SSID: [redacted]
[12:30:59][C][wifi:364]: IP Address: 192.168.2.59
[12:30:59][C][wifi:366]: BSSID: [redacted]
[12:30:59][C][wifi:367]: Hostname: 'esp-stereo'
[12:30:59][C][wifi:369]: Signal strength: -35 dB ▂▄▆█
[12:30:59][C][wifi:373]: Channel: 6
[12:30:59][C][wifi:374]: Subnet: 255.255.255.0
[12:30:59][C][wifi:375]: Gateway: 192.168.2.1
[12:30:59][C][wifi:376]: DNS1: 192.168.2.1
[12:30:59][C][wifi:377]: DNS2: 0.0.0.0
[12:30:59][C][logger:293]: Logger:
[12:30:59][C][logger:294]: Level: DEBUG
[12:30:59][C][logger:295]: Log Baud Rate: 115200
[12:30:59][C][logger:296]: Hardware UART: UART0
[12:30:59][C][uart.arduino_esp32:108]: UART Bus 1:
[12:30:59][C][uart.arduino_esp32:109]: TX Pin: GPIO17
[12:30:59][C][uart.arduino_esp32:110]: RX Pin: GPIO16
[12:30:59][C][uart.arduino_esp32:112]: RX Buffer Size: 256
[12:30:59][C][uart.arduino_esp32:114]: Baud Rate: 57600 baud
[12:30:59][C][uart.arduino_esp32:115]: Data Bits: 8
[12:30:59][C][uart.arduino_esp32:116]: Parity: NONE
[12:30:59][C][uart.arduino_esp32:117]: Stop bits: 1
[12:30:59][C][uart.switch:040]: UART Switch 'Off'
[12:30:59][C][captive_portal:088]: Captive Portal:
[12:30:59][C][mdns:103]: mDNS:
[12:30:59][C][mdns:104]: Hostname: esp-stereo
[12:30:59][C][ota:093]: Over-The-Air Updates:
[12:30:59][C][ota:094]: Address: esp-stereo.local:3232
[12:30:59][C][ota:097]: Using Password.
[12:30:59][C][api:138]: API Server:
[12:30:59][C][api:139]: Address: esp-stereo.local:6053
[12:30:59][C][api:141]: Using noise encryption: YES
[12:32:16][D][switch:013]: 'Off' Turning ON.
[12:32:16][D][switch:037]: 'Off': Sending state ON
[12:32:16][D][uart.switch:020]: 'Off': Sending data...
[12:32:16][D][switch:037]: 'Off': Sending state OFF
[12:32:16][D][uart_debug:196]: >>> 0b00000110 (0x06),0b00000001 (0x01),0b00000000 (0x00),0b01110101 (0x75),0b00000000 (0x00),0b01111100 (0x7C)
I have read so many threads (including the ones you guys pointed to, thanks!), but no luck and getting more confused rather than less , the best one I have found that seemed to be close to my case is : Need Help using RS232 to control a receiver - Configuration - Home Assistant Community (home-assistant.io), if you scroll down to Nathan Carr post in that thread.
I right now would need help with the following:
- to ensure that the command I´m sending is correct according to the command code manual I linked to earlier (do not get the address thing they write about in the beginning, cannot see it in the example they include)
- be sure that my config would capture any ack comming back from the AMP is my command gets to it
Thanks for the help.
Br
/Micke