Simulate RS422 signal

Hey,

For a project I need to read data from an incremental encoder directly into my PC (using .NET Framework and the serial port). The output signal of this encoder is RS422.

Before I order this encoder (quite expensive) I would like to test if my software can handle the RS422 protocol correctly.

So I was wondering is it possible to setup a RS422 communication between an Arduino One and my PC?

Then I can test the software by a simple, cheap encoder.

Like to hear.

RapiD

Before I order this encoder (quite expensive) I would like to test if my software can handle the RS422 protocol correctly.

RS422 is not a protocol but a physical interface standard.

So I was wondering is it possible to setup a RS422 communication between an Arduino One and my PC?

I doubt your PC has an RS422 interface (only very old Macs had one of these).

Pylon,

Thanks for your reply.

I am a mechanical engineer who is discovering the possiblities of IT and electrical engineering for my designs. So I am quite new with this.

But I can read the RS422 serial signal with a USB port (using a connector RS422 -> USB) right?

So what I am actually looking for is a way to simulate a serial signal according the RS422 interface using the Arduino. I would like to check if my software can read this and do something with this.

RapiD

You can simulate it entirely on your PC using a full duplex USB/RS422 adaptor with a Tx/Rx loopback connection, or two half duplex USB/RS422 adaptors connected back to back with Tx/Rx crossover wiring.

If you go for a cheap quadrature encoder connected to a microcontroller with RS422 output then you first need to check if the likely data rate from the encoder is within the processing capabilities of the microcontroller. This may involve some actual experimentation, using an oscilloscope etc.

I figured out that is not possible to read a RS422 encoder directly to a PC, because the signal that the encoder produce is not actually a serial signal. It just uses the RS422 interface to transmit the pulses of the encoder.

So I need an Arduino between my encoder and PC to create a usefull signal for my PC

I found this usefull article that solved my problem:
https://create.arduino.cc/projecthub/hwhardsoft/how-to-use-incremental-encoders-f82068

Thank you for your replies.

Use that code example with caution. On an 8 bit micro reading a 16 bit number isn't an atomic operation therefore the number could be half modified by an interrupt while you are in the middle of reading it.

I figured out that is not possible to read a RS422 encoder directly to a PC, because the signal that the encoder produce is not actually a serial signal. It just uses the RS422 interface to transmit the pulses of the encoder.

An RS422 is a serial interface, it's actually an UART compatible signal just the electrical values are different than for example an RS232 or TTL-UART signal.

But I can read the RS422 serial signal with a USB port (using a connector RS422 -> USB) right?

Correct. In most cases a better available RS485-to-USB might do the job as well (RS422 and RS485 are very similar).

So what I am actually looking for is a way to simulate a serial signal according the RS422 interface using the Arduino. I would like to check if my software can read this and do something with this.

Sure you can do that but writing the simulator software on Arduino might be more work than writing the handling software on the PC. Why do you think this simulator is necessary?

pylon:
Sure you can do that but writing the simulator software on Arduino might be more work than writing the handling software on the PC. Why do you think this simulator is necessary?

I wouldn't bother writing the simulator software unless the hardware being simulated is expensive.

Last summer I wrote some some firmware for the Arduino to simulate certain specific functions thought not all functions of a complicated PCB.

.