1
\$\begingroup\$

I am running out of time and seeking a proper solution.

What I am willing to achive is getting the position of the encoder / motor shaft. To keep track of the movement. (Currently I am running 10 turn pots, but hey are going to wear out eventually and if there is a built in encoder why not to use it?)

The configuration is the following:

HiWin Motor (Builtin 13Bit encoder) -> HiWin D2 Drive -> A A' B B' Z and Z' lines coming form the drive.

They are differencial +-5V

The link for the motor controller: http://www.hiwin.com/pdf/d2_drive_user_manual.pdf

Manual says:

Output pulse of feedback (buffered encoder or emulated encoder)

RS422

The waveform of signal "A":

The waveform of signal "A"

I have got the following parts on hand:

  • SP3495EEN-L
  • SP3496EEN-L
  • ST485ECDR
  • ST485CDR

These are transcievers with various speeds from EXAR and STM.

I would like to get this work either an Arudino or a TM4C microcontroller (which has a built in Quadrature Encoder Interface).

My questions are:

  • Are any of these parts will do the trick?
  • As this is a serial communication I will simply receive a message containing the position?
  • What would be a better solution (Some other ICs to get? Maybe a different approach?)?

Edit: *typo

\$\endgroup\$
  • \$\begingroup\$ What is a "Microncontroller"? (See title.) Is it a brand as suggested by the capital 'M' or is it a pair of typos? \$\endgroup\$ – Transistor Sep 24 '17 at 0:19
  • \$\begingroup\$ @Transistor typo ;) \$\endgroup\$ – Zoszko Sep 24 '17 at 16:23
3
\$\begingroup\$

All of your parts will "work", in the sense that they will allow simple communication between the encoder and your Arduino. They will not, however, do what you want.

The labels on the encoder lines establish that they are quadrature encoded with a home line which will become active once per revolution. This is not serial communication in the same sense as, for instance, RS232. Instead, a transition on either the A or B lines indicate that the encoder has moved by 1/(2^13) revolution.

It is entirely possible to use such a protocol directly. What you do is feed both the receiver A and B lines into IO lines of the Arduino. Monitor both lines and if either changes determine the direction from the state of the other line and update the shaft position.

Of course, you may or may not be able to keep up with the computation requirements. If the shaft is turning at 60 RPM, or 1 rps, then you'll get a change every 125 usec. Furthermore, if you're doing anything else with your Arduino, and you're monitoring the encoders by polling, you'll risk missing a transition while performing those other tasks. You can get around this by setting the two lines as interrupts. See, for instance, here or here

There are dedicated quadrature encoder chips, but I'll leave such fundamental search tasks to you.

\$\endgroup\$
  • \$\begingroup\$ Hello! Thanks for this @WhatRoughBeast. However the Arduino Mega is till not fast enough if the motor moves at full speed (3000 1/min). But I have noticed that there is some weird noise on the line when there is no movement. (~3 KHz peaks same amplitude as the signal itselt, so the floating comes from this.) I have managed to get a separated ground for just the encoder outputs and now this is gone. Moving forward for the TM4C which should be way faster than Arduino, also it has a buildin QEI as I have mentioned in the OP. \$\endgroup\$ – Zoszko Sep 24 '17 at 7:55
  • \$\begingroup\$ TM4C Works like charm. \$\endgroup\$ – Zoszko Sep 24 '17 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.