RS485 Communication with West Controllers

Hi,

I am new to RS485 communication and would appreciate some insights on resolving an issue. I am trying to read a value from a West 6100+ Controller using an Arduino UNO R3 and an RS485 to TTL converter. I believe my wiring is correct since I am receiving proper readings on the serial monitor. However, I am encountering square symbols along with the value, and I’m unsure why they are appearing. My goal is to remove these symbols and plot the value in real time. The square symbols is making it difficult to do so.

If anyone is interested, this is the RS485 to TTL Converter I am using. (https://www.amazon.ca/Fafeicy-MAX48...5&psc=1&mcid=fc410e1f694d3ffe81a63df27356f370)

The program I'm using for coding is Arduino IDE.
The header I'm using is ModbusMaster by Doc Walker.

Code:
#include <ModbusMaster.h>

#define RS485_DE_PIN 4  // Driver Enable pin
#define RS485_RE_PIN 5  // Receiver Enable pin

ModbusMaster node;

void preTransmission() {
  digitalWrite(RS485_DE_PIN, HIGH);  // Enable transmission mode (DE HIGH)
  digitalWrite(RS485_RE_PIN, HIGH);  // Disable reception mode (RE HIGH)
}

void postTransmission() {
  digitalWrite(RS485_DE_PIN, LOW);   // Disable transmission mode (DE LOW)
  digitalWrite(RS485_RE_PIN, LOW);   // Enable reception mode (RE LOW)
  delay(6);
}

void setup() {
  pinMode(RS485_DE_PIN, OUTPUT);
  pinMode(RS485_RE_PIN, OUTPUT);

  digitalWrite(RS485_DE_PIN, LOW);  // Start with transmission disabled
  digitalWrite(RS485_RE_PIN, HIGH); // Start with reception enabled
 
  Serial.begin(9600, SERIAL_8N1);  // Start serial communication at 9600 baud
 
 
  // Modbus communication setup
  node.begin(1, Serial);  // Set Modbus slave ID (PID controller address = 1)
  node.preTransmission(preTransmission);  // Set pre-transmission function
  node.postTransmission(postTransmission);  // Set post-transmission function
 
  Serial.println("Modbus communication initialized.");
}

void loop() {
  uint8_t result;
  uint16_t data;

  // Query the Process Variable (stored in Modbus register 1)
  result = node.readHoldingRegisters(0x01, 1);  // Query Modbus register 1 (Process Variable)

  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0x00);  // Retrieve the Process Variable value
    Serial.print("Process Variable: ");
    Serial.println(data);  // Display the Process Variable
  } else {
    Serial.print("Error: ");
    Serial.println(result, HEX);  // Print error code if communication fails
  }

  delay(1000);  // Delay before the next query
}
This is the output I am getting.
1725849850005.png
 
There is a built-in termination resistor on that TTL to RS-485 converter. Many others on here have had issues with that converter. Here are some more details:

You may need to remove R7 from that MAX485 board (and remove or disable any termination connected to the RS-485 bus). Also make sure to connect 3 wires (A, B, and GND) between the MAX485 board and the Modbus controller. Please refer to this post (and for much more details, the other post linked in my response in this post)
https://control.com/forums/threads/max485-module-ro-pin-nearing-0v.49218/

The above only applies to the RS-485 communication between your Arduino and the West 6100+ Controller, though. If your issue is solely the presence of those squares in your serial console printout, then I suggest trying to comment out some of your Serial.print and Serial.println lines to see which, if any, introduce the square characters.

Also, the obvious question, you are using a different serial port for your debug output from the serial port you're using to communicate to the Modbus controller, right? Your code seems not to call out a specific serial port, so likely just uses the default serial port (or maybe there is only one on your Arduino) for both Modbus communication and debug printing. You can't do this.
 
I think jschulze is exactly right on the serial port issue. The 8 squares are probably representing the 8 non-displayable characters that would make up the request to the West controller, which would be [01] [03] [0001] [0001] [D5CA]
 
Hi guys, thank you so much for all the help.

Update:
For my spare converter, I removed the R7 and other resistors on the RS485 side, as suggested by the website. I also tried using an idle biasing resistor, but the output remained the same with all the square symbols.

Referring back to what jschulze mentioned, the issue was related to the serial port. The Arduino Uno only has one hardware serial port, which I was using for both communication between the controller and the Arduino and debugging. This explains the square symbols that kept appearing. By using the 'SoftwareSerial.h' library, I assigned different digital pins for communication with the controller, while using the hardware serial port for debugging, since 'Serial.print' operates through the hardware serial port."

Overall, the symbol doesn't appear anymore, and the RS485 to TTL converter didn't need the resistors in the RS485 side to be removed.
 
Top