Encoder signal through a very long wire

Discussion in 'General Electronics Chat' started by cmartinez, Sep 29, 2015.

  1. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Ok, here's the encoder's datasheet. And here's my question: Would the following adaptation of your circuit (no cap this time, for your great relief...), as shown in the figure below, be adequate to receive the signal from that encoder through a shielded wire 20m long, assuming that the frequency remains below 100 Khz?

    Capture.JPG

    Would a value for R3 of 4.7k be acceptable if the signal is a square wave of 0 to 5V, push-pull, 4ma max?

    Note: In my application, direction of rotation is not important, so I plan to XOR the encoder's two quadrature outputs to obtain a single square wave. As shown in the attached simulation.


    @ronv, @ian field, @RichardO, @strantor, @AnalogKid, @blocco a spirale
     
  2. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Correction: By using the xor circuit in the previous post, the signal would be limited to 0.5 mA, so maybe I should change R3 (in the sim) from 10K to 1K to obtain an output of 5mA?
     
  3. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,542
    1,251
    Which output(s) are you using? The datasheet recommends a min value for your R3 of approx. 10K (2 x 4.7K) "to prevent loading" of the PWM output.

    ak
     
  4. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Thanks, I'll only be using the outputs of channels A and B (pins 3 and 4) connected to the xor gate that I just mentioned. This to minimize the number of wires and additional programming, since I won't need to know direction of rotation in my application.
    My intention is to track position, not speed, so I won't be using the PWM output at all.
     
  5. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    Really, you're going to make me read the whole data sheet?

    First, if you xor you're going to have problems with noise at transition points.

    Second, does this chip operate stand-alone? Or does it require an associated mpu for programming?

    Third, no...my circuit is not applicable -- and I take no responsibility for your use of it. For short runs, properly grounded shielded wire will be preferable, and maybe with a decent interface IC/buffer/receiver. For longer runs/higher speeds, you'll need to consider rise and fall times, and reflections (transmission line effects).

    Other than this, I have no opinions -- and will not have without studying the datasheet further, which I have no inclination to do. Good luck. We are all counting on you.
     
    cmartinez likes this.
  6. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    How long is Very long wire? Can you have more than just two wires?
     
  7. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    I'll do my homework Joey, I promise you that. And NO... I never expected you to read the whole thing, that would've been rude of me.

    The datasheet states that its A and B channels are digital outputs able to deliver up to 4 mA. I'm guessing they mean they are the push-pull type, since some other pins (that will remain unused) have an open drain configuration.
    About your second point: The chip is stand alone and I'll be running it at 5V, although it can be reprogrammed to perform different functions that I'm not going to need in my application.
    And as for your third point, thank you for clarifying... I'm now examining the possibility of converting the output signal into a differential one... possibly by using an RS485 chip... though I'll also have to consider the chip's max frequency, proper line termination and all those details needed to minimize the effects that you've just mentioned.
     
  8. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Let's say 20 meters long, shielded AWG #24, and yes, I can accept more than just two wires.
    Were you considering a differential signal as well?
     
  9. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    If you just need step pulses, then I suggest you reprogram the thing for mode 2 instead of using XOR.

    I don´t really think that differential is necessary here, but sure it wouldn´t hurt to use some buffering of the 4 mA outputs. Or maybe using a current loop, but i am not too sure how much better those are at fignting induced noise.

    All said, i feel that using a 74HC125 or 126 as a buffer feeding a twisted pair line should be enough.
     
    cmartinez likes this.
  10. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Yeah, I had thought about that, but it requires writing extra code and the use of a 7.4V regulated supply and a transistor interface to the MCU... I think it's easier to just xor the outputs. As for using an HC buffer for this purpose, thanks for your suggestion, I'll consider it among the other options.
     
  11. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    You need A, B, and GND since the signals from the chip are referenced to the chip ground. You are going to have problems with the GND difference between the two systems especially if the encoder is getting it's power from a different place than the receiver. The 20 M of cable is going to look like a big capacitor to the encoder and 4 mA may not be enough to charge and discharge that much cable. Using a CMOS device with symmetrical output stages (sources as much current as it can sink) is a plus. You can test the efficacy by running a square wave of a given frequency through 20M of cable and observe the resulting waveforms,
     
    cmartinez likes this.
  12. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    I like that... nothing beats the empirical method... thanks!
     
    Last edited: Apr 9, 2016
  13. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    Pictures of the waveforms would be nice :)
     
  14. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    Sure thing, it's the least I can do for those who've been helping me... though you're going to have to wait for about a week...
    stay tuned.
     
  15. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    But since the power is already present at the decoder I suggest doing the XOR there, it will make all things much simpler.
     
  16. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    I think the datasheet say the chip is one time programabble, so you need to set this only once. Of course what you would choose depends if this is a one off project, or if you are planning to make loads of them.
     
  17. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    MaxHeadRoom and cmartinez like this.
  18. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    So you're suggesting I use a 4 wire shielded cable for this? One for +5V into the encoder, another one for ground, one for channel A, and another one for B. Use a 74HC125 buffer at the encoder side and receive at at the MCU using the circuit shown in post #1 ?.
     
  19. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,574
    2,543
    What about using a MAX488? I have quite a few of them laying around... they might just do the trick if I were to send +12V power through one of the wires, then at the encoder side bring it down and regulate it with a 7805, then XOR the encoder's outputs and send the signal back to the MCU's board through the differential lines, where another MAX488 would translate its level back to a 5V waveform.

    I'd still be using a 4 wire shielded cable:
    1. +12VDC
    2. GND
    3. Y output \ (see fig 2 in pg 8 of the datasheet)
    4. Z output /
     
    Last edited: Sep 29, 2015
    Papabravo likes this.
  20. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    If you already got those then definitely go with them. Even though you need 12V instead of 5V, and you will need to regulate that at the encoder side to 5V, it is by far the best way to get data over a long wire. An STP or F/STP ethernet cable would probably be the optimal solution. I would use one pair for data and one pair for Ground and Vcc. As the cable usally has four pairs this would still leave you enough room to expand to detecting the direction if needed.
     
    cmartinez likes this.
Loading...