RS-485 Encoder Integration Problem on T6M80-1000H2A1-M23

Hi everyone,

I'm working on a project with an Arduino and a T6M80-1000H2A1-M23 motor, which has a 23-bit magnetic encoder. I'm using an RS-485 module (max485) to interface the encoder with the Arduino, but I'm having trouble reading the position data. Despite following the technical specifications, I'm not getting any output.

I've used this code:

#include <SoftwareSerial.h>

// Pin definiti per la comunicazione RS-485
#define RO_pin 10  // Pin dove è connesso RO (Receive Output)
#define RE_DE_pin 11  // Pin per gestire RE (Receive Enable) e DE (Driver Enable)

SoftwareSerial RS485Serial(RO_pin, RE_DE_pin); // Creiamo una comunicazione seriale via software

void setup() {
  pinMode(RE_DE_pin, OUTPUT);
  digitalWrite(RE_DE_pin, LOW); // Abilita ricezione
  Serial.begin(9600); // Comunicazione seriale su PC
  RS485Serial.begin(9600); // Comunicazione seriale RS485
}

void loop() {
  if (RS485Serial.available()) {
    int pos = 0;
    // Leggi i dati inviati dall'encoder
    while (RS485Serial.available()) {
      pos = RS485Serial.read();  // Legge i dati dalla linea RS485
      Serial.println(pos);  // Visualizza i dati nel monitor seriale
    }
  }
  delay(500);  // Pausa tra letture
}

But this code cannot read position of this encoder...

Has anyone successfully interfaced this encoder or a similar one via RS-485? I would greatly appreciate any tips, code examples, or guidance on the communication protocol (baud rate, timing, resistors, etc.) needed for proper integration. I’ve double-checked the wiring and configuration, but I might be missing something.

Any help would be amazing! Thanks in advance for your support.

Best regards,
Eugenio Ciullo

Serial communication is RO and DI.
You also need to take care of DE/RE pins in your code to enable/disable data line.

1 Like

Thank you so much for your previous answer, I found it really helpful. I've made some changes to my code based on your suggestions, but I'm still having trouble getting the encoder communication to work properly.

I was wondering if you could give me some more advice on how to fix my code or point out what mistakes I might have made. Here's my updated code:

#include <SoftwareSerial.h>

// Pin definiti per la comunicazione RS-485
#define RO_pin 10   // Pin per ricezione (RO - Receiver Output)
#define DI_pin 11   // Pin per trasmissione (DI - Driver Input)
#define RE_DE_pin 12  // Pin per gestire RE (Receive Enable) e DE (Driver Enable)

SoftwareSerial RS485Serial(DI_pin, RO_pin); // Configura comunicazione seriale via software

void setup() {
  // Imposta il pin RE/DE come output
  pinMode(RE_DE_pin, OUTPUT);
  
  // Imposta RE/DE basso (ricezione inizialmente)
  digitalWrite(RE_DE_pin, LOW);
  
  // Inizializza la comunicazione seriale
  Serial.begin(9600);        // Comunicazione seriale su PC
  RS485Serial.begin(9600);   // Comunicazione seriale RS-485
}

void loop() {
  // Abilita la ricezione
  digitalWrite(RE_DE_pin, LOW);  // Imposta RE e DE su LOW per ricevere
  
  if (RS485Serial.available()) {
    int pos = 0;
    
    // Leggi i dati inviati dall'encoder
    while (RS485Serial.available()) {
      pos = RS485Serial.read();  // Legge i dati dalla linea RS-485
      Serial.println(pos);       // Visualizza i dati nel monitor seriale
    }
  }

  delay(500);  // Pausa tra letture
}



However, with this code, the Serial Monitor remains completely empty, as if it’s not receiving anything at all from the encoder.

Any feedback or suggestions on how to improve my approach would be really appreciated.

Thank you again for your time and support!

Kind regards,
Eugenio Ciullo

According to the datasheet the encoder interface is NOT RS485

1 Like

Hi,

Thank you so much for your comment.
Could you tell me which protocol I should use to read this encoder?

I have 4 wires:
VCC5V
GND
SD+
SD-

It’s a 23-bit magnetic encoder (leadshine)...

It’s driving me crazy...

Thank you so much in advance for your help!

swap those. RO goes to RX

1 Like

Why don't you use the encoder output from the driver A,B,Z?

1 Like

I thought you were refering to the driver output and not the motor output.
The motor output may well be RS485 or RS422.
The protocol as far as I can tell is async SSI
How to read the data, I'm not sure.

1 Like

Thank you very much for your reply. The problem I am facing is that I am making my own servo drive. So the servo drive that it is sold with, I will put aside. I will manage everything with Arduino at first and then move on to teenzy. So I want to read the signal directly from the encoder so I can then increment all the calculations for the Foc. Only as a last part of the project I will do the ESC part.

All I could determine is that it is an encoder SSI interface.
Google "encoder SSI"

1 Like

Thank you very much for your reply. I see that the encoders you are talking about, that is, the ssi type ones... have six cables... vcc gnd clock+ clock- data+ and data-...
in my encoder instead it has only four wires: vcc gnd sd+ and sd-...
How do I interface it with Arduino without having those two Clock cables?

It's an asynchronous SSI, they only use SD+ and SD-, there is no clock

1 Like

Thank you very much, Jim-p, for your reply! I'm now wondering what is the correct way to read the SD+ and SD- signals. I have done some research, and even when searching for 'asynchronous SSI encoder,' many results point to using RS-485, but unfortunately, I’m not getting any results from the tests I’m running. Do you have any suggestions on how to correctly read these signals?

Out of my area of expertise and leadshine doesn't see to have any good documentation on their encoders

1 Like

Did you correct your code (post#6) for serial ?

1 Like

Thank you very much, Jim-p, for your reply. You’re absolutely right, I’m also having huge difficulties with this setup. I’ve already opened a support ticket with Leadshine and I’m waiting for their response. In the meantime, I’ll keep testing and searching for possible solutions. I’ll keep you posted if I manage to solve it!

Yes, I corrected the code and ran the tests, but unfortunately, the serial is not communicating anything. I’m trying to figure out if it’s a hardware issue or if there’s some other setting I might have missed. Thanks for the suggestion anyway!

I also tried disassembling the encoder to see if I could find anything written on the chips... and I discovered that unfortunately, they were "scratched" to prevent anyone from reading them.
I noticed that there’s "38m23m" written on the encoder. Maybe this could help.

Do you have the proper test equipment so your testing can actually determine how the communication is being done?

1 Like

Look, you can post your latest code and your wiring. Maybe we can find more errors there.
If you want to try to "hack" some unknown IC on your device, you need skills and equipment.

1 Like

I am conducting tests with:

  • Arduino Micro (original)
  • MAX485 interface
  • Picoscope 2204a