- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Using the Index Signal on an Incremental Encoder
Using the Index Signal on an Incremental Encoder
4 years 6 months ago #29534570
by morris
Using the Index Signal on an Incremental Encoder was created by morris
The "Advanced Digital Motor Controller User Manual v18" states:
"More sophisticated incremental encoders with index, and other features may be used,
however these additional capabilities will be ignored."
However, is there a way to use the index signal to "home" the motor? Here, we'd prefer not to energize the coils via the "BIND" operation. For example, could we use one of the pulse inputs to set the encoder counter on startup once the rotor is spun passed the index point?
"More sophisticated incremental encoders with index, and other features may be used,
however these additional capabilities will be ignored."
However, is there a way to use the index signal to "home" the motor? Here, we'd prefer not to energize the coils via the "BIND" operation. For example, could we use one of the pulse inputs to set the encoder counter on startup once the rotor is spun passed the index point?
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 6 months ago #29534574
by Gabriel_Isko
Replied by Gabriel_Isko on topic Using the Index Signal on an Incremental Encoder
You can try to use it in a digital input, but right now there is no way to monitor a digital input pin at high frequencies, so you will probably miss the pulse from the index signal if you are looking at it in microbasic.
You could latch on the index signal, but that could be somewhat complicated. I wouldn't really recommend BND either - it will not perform very well if your motor is loaded.
The best way to go about this will to be to use a limit switch to home.
You could latch on the index signal, but that could be somewhat complicated. I wouldn't really recommend BND either - it will not perform very well if your motor is loaded.
The best way to go about this will to be to use a limit switch to home.
Please Log in or Create an account to join the conversation.
4 years 6 months ago #29534586
by morris
Replied by morris on topic Using the Index Signal on an Incremental Encoder
Thanks Gabriel,
I ended up tying the index to a digital input, ran a script with the bind command to get the electrical angle at the increment pulse, then hardcoded that value into another script that does not perform the bind operation. On startup, the coils are left de-energized and the rotor is swept until the index is reached, the electrical angle (random) is read, and the badj register is updated with the difference between the measured angle and the hardcoded angle. Code below:
setconfig(_BPOL, 1, 4)
setconfig(_EPPR, 1, 2000)
setconfig(_BLFB, 1, 0)
setconfig(_EMOD, 1, 18)
setconfig(_BZPW, 1, 1)
setconfig(_RWD, 0)
setconfig(_EHOME, 1, 0)
setconfig(_BFBK, 1, 0)
setconfig(_BMOD, 1, 1)
setconfig(_MMOD, 1, 0)
setcommand(_EX, 1)
fixed_angle = 420
'rotate rotor
While True
result = getvalue(_D, 1)
angle = getvalue(_ANG, 1)
If result = 1 Then
offset = fixed_angle-angle
setconfig(_BADJ, 1, offset)
Print("index captured!\n")
Print("encoder angle: ", angle, "\n")
Print("fixed angle: ", fixed_angle, "\n")
Print("offset: ", offset, "\n")
Terminate
End If
End While
I ended up tying the index to a digital input, ran a script with the bind command to get the electrical angle at the increment pulse, then hardcoded that value into another script that does not perform the bind operation. On startup, the coils are left de-energized and the rotor is swept until the index is reached, the electrical angle (random) is read, and the badj register is updated with the difference between the measured angle and the hardcoded angle. Code below:
setconfig(_BPOL, 1, 4)
setconfig(_EPPR, 1, 2000)
setconfig(_BLFB, 1, 0)
setconfig(_EMOD, 1, 18)
setconfig(_BZPW, 1, 1)
setconfig(_RWD, 0)
setconfig(_EHOME, 1, 0)
setconfig(_BFBK, 1, 0)
setconfig(_BMOD, 1, 1)
setconfig(_MMOD, 1, 0)
setcommand(_EX, 1)
fixed_angle = 420
'rotate rotor
While True
result = getvalue(_D, 1)
angle = getvalue(_ANG, 1)
If result = 1 Then
offset = fixed_angle-angle
setconfig(_BADJ, 1, offset)
Print("index captured!\n")
Print("encoder angle: ", angle, "\n")
Print("fixed angle: ", fixed_angle, "\n")
Print("offset: ", offset, "\n")
Terminate
End If
End While
Please Log in or Create an account to join the conversation.
- Gabriel_Isko
4 years 6 months ago #29534595
by Gabriel_Isko
Replied by Gabriel_Isko on topic Using the Index Signal on an Incremental Encoder
Cool, that seems like an interesting solution.
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Using the Index Signal on an Incremental Encoder
Time to create page: 0.059 seconds