How do I connect rs232 port to RPI 3 Openhabian?

Subject: Issues Connecting RS232 Port to OpenHAB on Raspberry Pi

I’ve encountered some challenges while attempting to connect an RS232 port to my OpenHAB setup on a Raspberry Pi, and I’m hopeful that someone here can provide guidance.

Hardware Details:

  • Raspberry Pi (OpenHABian):
    • Release: Raspbian GNU/Linux 11 (bullseye)
    • Kernel: Linux 6.1.21-v7+
    • Platform: Raspberry Pi 3 Model B Rev 1.2
    • OpenHAB version: 4.02
    • Linux version: openhabian 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l
  • Rego 6xx heat pump controller
  • RS232 Board: Manufacturer - Renkforce, Model - RF-4011279

Steps I’ve Undertaken:

  1. I’ve identified the serial port using dmesg | grep tty, which showed /dev/ttyS0 and /dev/ttyAMA0.
  2. Tried to connect to both /dev/ttyS0 and /dev/ttyAMA0 in OpenHAB. For /dev/ttyAMA0, I received “Serial port does not exist”, and for /dev/ttyS0, I initially got a connection but subsequently encountered an error: “Inappropriate ioctl for device in nativeavailable”.
  3. Added openhab user to dialout and tty groups.
  4. Modified boot/cmdline.txt to prevent the Raspberry Pi from using the serial port for console logging.
  5. Double-checked the connection between the add-on board/port and the RPI.

Despite these efforts, I continue to encounter error messages. An external RS232 to USB converter is an option I’m considering, but I would genuinely like to get the integrated port operational.

Additional Information:

  • The Rego 6xx device operates at 19200 bps, 8 bits, no parity, 1 stop bit.
  • A user review of my RS232 board mentioned that one must disable boot-time logging on the Raspberry Pi GPIO to function correctly.

Are there any known tweaks or adjustments that might help? Are there specific hardware components known to work better or worse with OpenHAB and Raspberry Pi? Would an RS232 to USB converter be a more reliable option to explore? Any assistance or advice would be highly appreciated!

Thank you in advance!

I’d first confirm the serial port is working outside of openHAB.

Connect Tx & Rx pins together. Open 2 terminals, in one enter cat /dev/ttyAMA0 and in the other echo "Hello World" > /dev/ttyAMA0. You should see Hello World in terminal 1.

If not check permissions on the serial port; ls -l /dev/ttyAMA0. Obviously whichever user you’re running the test commands as also needs to be in the relevant group. Running them as sudo should work as I think root should already be listed there.