#5160 Rotary encoder support
1 messages · Page 1 of 1 (latest)
To connect rotary encoders to your TMC5160s, you need to follow the pin configuration mentioned in the TMC5160 datasheet or the Trinamic website. You can use any of the available four quadrature encoder interfaces (ENC0, ENC1, ENC2, and ENC3) provided on the TMC5160 to connect rotary encoders.
To connect the rotary encoder, you need to connect its A and B signals to the encoder inputs of your TMC5160. Also, you need to connect the encoder's index (Z) signal to the corresponding encoder index input of the TMC5160. To use the encoder interface, you'll also need to configure the encoder interface's necessary parameters in the TMC5160 registers, such as encoder resolution count per revolution, direction, etc.
For a more detailed description, you can refer to the TMC5160 datasheet or the Trinamic website. If you face any issue while connecting or configuring the rotary encoders, feel free to ask.
wow chatgpt is good at this stuff
Yeah, seems like some manufacturers call index channel N, I thought that it's bad enough that index could be called either Z or I
I wonder what's the Index channel for here
i see ENCB_DCEN is encoder B and ENCA_CDIN is encoder A right?
just dunno what index channel is
Yep
It's separate channel with 1 pulse per revolution in case of rotational ones and it can be used eg for homing if your device operates in rotational domain
ah ok
oh
index is DC0 apparently
you also mentioned a relay when splitting the signal from the encoder? could you please elaborate on that
Now, encoders can have channels and also inverted (with – above the letter), inverted channels are worth it as then you can do differential pair on the wiring and limit the noise
Buffer if without inverted channels, comparator if with inverted channels
ah, is that dependent on the encoder i choose?
You can use buffer with one with inverted channels but it defeats the point of using inverted channels
what would be a good omron encoder for this application? if price was not important
and what would go into choosing one
Check if TMC is limiting pulse rate or CPR first
what does “software controlled” correction of step loss mean
meaning set in the register?
Hmm, I'd have to read into it, alternative version is to use cheapo encoder and just test
i think im getting ahead of myself
dc step is a “mode” or communication interface?
also found this in regards to the encoder poll rate
125us
so hears what i understand
comparator makes signal integrity better if i use inverted channels, but if the 5160 expects uninverted i need to use an inverter?
or repeater if normal channels for good signal integrity?
so i can use a repeater/comparator before i go into the wago and before it goes into the chip?
oh no i get it now
comparator converts differential signals into single ended signals, repeater amplifies signal
so i need a comparator on A1 and A2 to make A going into 5160, and B1 and B2 going into a comparator to make B
Index is just its own thing snd i need a repeater
seems like a job for a pcb!
sad waterrot didnt hook up these and i needa solder directly to the chip
Index isn't needed at all according to datasheet screenshots
would it be better with?
But yes, you use differential pair with inverted channel to have better signal integrity and right next to the input of the chip you put a comparator to filter it and make it into single signal
Nah
What's the max speed you're expecting on the printer?
1.5m/s around
but fast accelerations
its under its max of 100r/s
Ok, so 1500mm/s with 32mm/rev gives ~49rev/s, with 1800 p/r you get 88200 Hz, so whole cycle is 11.3us, pulse is 5.6us
Then 7us pulse length
yeah
That's a bit lower than 125us
too fast?
so i need a rotary encoder with less p/r?
wont is be less accurate?
around 100p/r
for ~125
Find a section that specifically tells about encoder timing as the one you sent with 125us pulse is for STEP in DcStep
8MHz gives you 0.125us so you'd be fine with 1800 ppr
the clock speed being 8MHz?
thats why its 0.125us
No, 8MHz encoder counting frequency
how would i find that
It means that as long as your encoder output frequency is below 8 MHz it'll manage
And encoder output frequency is ppr × rev/s
1800 is perfectly fine as with 37.5 rev/s you get 0.068 MHz which is lower than 8 MHz
ah
even with 60 rev/s its still far under 8MHz right? so it should be fine
in that case more resolution more better?
i can get upto 2500p/s
also, do you know of a repeater pcb that also splits into 2 outputs
I'm not sure if this style encoder is the way to go
what would you suggest?
Some magnetic ones get output with AB, have 12+ bit resolution and are cheaper, mostly Osram AMS
price doesnt really matter. Would they be more accurate?
Also why would you recommend them over this
1800 is perfectly fine for me, its already a 8th microstep
Easier to use, they don't wear out as fast
how much longer would they last over an optical encoder like this?
Optical ones usually are limited by bearing lifespan and this depends on how well you mount them
would i expect more than 10k hours on this one if mounted correctly?
This rating is usually specified in millions of rotations
You'd need a longer shaft or double sided shaft to mount though
im planning on using a coupler
Which coupler?
undecided yet
Yeah, these are usually used in different scenarios
whats the one they slap at the back of steppers? or in servos?
Couplers introduce kinematic inaccuracies which means that if you use wrong ones or use them wrong, you'll introduce errors
ah ok
Ones I know are 2 part ones so they have codewheel attached directly to the shaft and encoder unit attached to the body, thanks to this they don't require coupler, no external hardware, bearing lifespan is lifespan of the servo bearings and these are often beefy
hrmm interesting
also note i plan to not put these encoders directly on the motors
they will be belt driven
Oh no
they are for rough positioning 
1800 PPR isn't rough positioning
Then why would you plan on belt driving them?
Why do you want to do this ?
Worry not, you'll need machined parts to mount it correctly as you won't hit this spec with prints
to close the loop at high speeds, also just for fun
apparently 5160s can support rotary encoders so i wanted to ask about it since i already had some
But why do you need a closed loop? Your printer shouldn’t be dropping steps
It’s generally a myth that closed loop is better for 3D printers
for a certain fast boat race 
Are encoders allowed these? It kinda makes it into servo and these are no good
rules state “must be stepper powered” no limits on closed loop
it is powered by stepper motors
I still don’t know why you need a closed loop stepper - it’ll either step or it won’t. Closing the loop won’t help
This post has been inactive for over 1 hour and so has been closed. To reopen this post simply send another message.
if it loses steps you can detect that and move it back, in most benchy attemps it happens only once or twice during the run
when the rotor lags behind
the way dcstep works is it automatically finds the highest speed it can step back at without skipping and steps back to the desired position
the reason i set the limit at 1.5m/s is because thats the point where the phase resistance and back emf overcomes 48v and no longer makes torque (with my motors)
the way the steppers step is they appromimate a sine wave to get a motion
sometimes when the wave is off or there is a sudden back emf spike it will be too much to overcome and the motor will “skip”
see this simulation
when the peaks get to low the motor will lose steps, thats why i want to put a rotary encoder in there t
thats why the motor wont lose steps 100% of the time and just some of the time