I have measuring wheel encoder like this one, which outputs its position using two RS422-encoded pin pairs, standard quadrature encoding. Note that these are not using the RS422 communication protocol, just the 2-pin differential encoding that RS422 uses.
This is connected to a bespoke PCB that includes a microcontroller, which was designed and programmed by some company for us, which basically counts pulses (and does a bit more which isn't relevant here)
As the software seems to have some bugs, I'd like to create a reproducible test environment, where I can simulate the wheel encoder turned at a specific rate, translating to a fixed, but configurable, frequency. My idea was an Arduino which I can write a small control program for, use the Arduino's GPIO pins to simulate the encoder's output, and connect that to the encoder input of the bespoke PCB.
As I'm not using RS422 to actually transmit bytes, just differential trigger signals, my idea is to set one GPIO pin to 1, another to 0, wait for half the pulse time, revert those signals, wait another half pulse time, and repeat from start. (Actually, I'll need 4 pins, to simulate A and B, and cycle between "set A to 1/0", "set B to 1/0", "set A to 0/1", "set B to 0/1").
A) Will this work? As far as I know, the only thing that's relevant is the differential between the two pins, and the +/- 5V between those pins should work well with the input chip of the PCB, which is a THVD2450.
B) Do I have to connect the Arduino's GND to the PCB's GND, or shouldn't I, to avoid any current loops?
1 Answer 1
A) it should work. It should also work with one GPIO pin if correctly biased. You could use Arduino, but you might have an XY problem, if you are looking for ways to test this but have already chosen to do it with Arduino. It could perhaps be simpler to get a waveform generator so you don't have to build or program anything.
B) Of course ground must be connected, or you risk exceeding common mode voltage limits.
Also do note that RS422 is a standard for electrical interface only, it is not a communication protocol and thus transmitting bytes has nothing to do with RS422 itself.
-
\$\begingroup\$ Thanks for clarifying about RS422, I thought it was a protocol like RS232. As to the XY problem: I'm a software guy, I don't have any lab hardware, and generally no use for lab hardware either; that's why I prefer an arduino and a few wires (which I have) and a 15 minutes of programming over buying a waveform generator that takes space and I'll probably never need except for this project. \$\endgroup\$Guntram Blohm– Guntram Blohm2021年03月24日 09:36:56 +00:00Commented Mar 24, 2021 at 9:36
-
\$\begingroup\$ BTW, just like RS422, RS232 is also not a protocol. \$\endgroup\$Justme– Justme2021年03月24日 10:01:22 +00:00Commented Mar 24, 2021 at 10:01