Communicating with my amplifier over RS232

Hello there!

I’m trying to integrate my amplifier (Cambridge Audio CXA81) into HomeAssistant over RS232 with ESPHome. The serial control protocol is described here.

When I connect my computer to the amplifier over an USB-to-RS232 cable I’m able to send commands to the device and I do receive messages from it. (I use CoolTerm on my Mac for that.) I then connected an max3232 based adapter board (bought from AliExpress) to a D1 Mini ESP32, but the amplifier does not react to any sent commands. I tried interchanging the RX and TX connections several times and tried driving the chip both with 5V and with 3V. I also tried different adapter boards from different vendors.

When I connect the adapter board directly to my computer over an USB-UART adapter I cannot control the amplifier either. But when I connect the USB-RS232 cable to the adapter board (with the USB-UART adapter) directly and open two serial connections I can «chat» with myself. So the boards seems to be working?!

I’m lost what to troubleshoot next. Does anyone have any ideas what the issue could be?

Thank you!

GeorgesMarie

Welcome!

Probably you tried, but can you recieve any uart messages on the esp32 with debugger enabled and VERY_VERBOSE logs?

What ESPHOME configs have you tried?

Thank you very much for your input. I hadn’t had the time yet to check the logs, I hope I have the chance to this evening.

You can look at my code in this repository: GitHub - joriskdzaack/cambridgeaudiocxa81-remote: Remote control for Cambridge Audio CXA81

1 Like

Here’s the log of my device:

1 Like

Nice config. Clearly you are no beginner;) And so I probably can’t be too much help with advanced topics.

It’s not that clear to me if you had the UART debugger enabled? Could you please confirm?

I’m not completely clear on the electrical setup here: what’s the port on the amplifier? Is it a regular DB9 with +/- 12V signal levels?

Your problem here may be a lack of pull-up resistors on the TTL logic side to the Wemos. Most times I’ve done this type of interfacing I need to put 10kOhm (22kOhm can work too) resistors between Vcc and the TX and RX pins (1 resistor each) - otherwise communication just doesn’t work.

EDIT: Re-reading your post I think I get it - RS232 is on the amplifier. Your problem is almost certainly that you need pull-up resistors on the TTL lines. I suspect when you connect the USB-RS232 and USB-UART together via the adapter, the combined pull-ups are just enough to get it to work.

EDIT 2 - you roughly want to do this: