Linuxcnc encoder control

  • tommylight
  • tommylight's Avatar Topic Author
  • Away
  • Moderator
  • Moderator
More
13 Sep 2023 12:16 #280626 by tommylight
Linuxcnc encoder control was created by tommylight

If it increases when it exceeds the maximum limit, I want its value to remain constant and if it decreases, I want its value to decrease.

Does not make sense, can you please clarify, or a drawing or logic or values or....

Please Log in or Create an account to join the conversation.

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
13 Sep 2023 13:02 - 13 Sep 2023 13:12 #280633 by Aciera
Replied by Aciera on topic Linuxcnc encoder control
Maybe try the limit1 component:
linuxcnc.org/docs/html/man/man9/limit1.9.html

[edit]
Ah, no. you want it to decrease from the maximum value no matter what the encoder position. So you may have to write your own custom component.

[edit2]
Also depends on how the encoder is being read (eg. parallel port, mesa board)
Last edit: 13 Sep 2023 13:12 by Aciera.

Please Log in or Create an account to join the conversation.

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
14 Sep 2023 07:15 #280705 by Aciera
Replied by Aciera on topic Linuxcnc encoder control
Not totally sure about this as I use potentiometers for overrides but maybe this post could be of interest to show how to use encoder counts for overrides:
162.243.45.186/38-general-linuxcnc-quest...for-overrides#179375

I presume this would handle your problem internally.

Please Log in or Create an account to join the conversation.

More
18 Sep 2023 13:04 #281073 by spumco
Replied by spumco on topic Linuxcnc encoder control
Nothing complicated is required to use an encoder & 7i73 for overrides.

Connect encoder in pin to halui.feed-override.counts (or spindle, or jog)
Set halui.feed-override.count-enable TRUE
Halui.feed-override.scale is used to determine how much each encoder count adjusts the override value (i.e. 1% per click, or 5% per click, or whatever)

Upper limit and lower limit of a particular override are set in INI file under [DISPLAY].

I'm not in front of a LCNC machine right now to check, but I believe that when the encoder is turned to the max or min values set in INI, further encoder counts past that value are ignored.  You do not need to 'unwind' the extra counts to get it to start counting down again (or the reverse).

NOTE - max velocity override is a special (and irritating) case.  Unlike all the other overrides (spindle, rapid, jog), MVO is displayed and adjusted in absolute velocity units, not a percentage of a total.

NOTE 2 - if you're using the cheap little encoders with built-in pushbuttons for overrides, you can connect the switch output to halui.rapid-override.reset for a quick reset-to-100% function.  Same for spindle & jog.  Keep in mind that the switch outputs 5vdc like the encoder, and the 7i73 encoder inputs (IN8-IN15) are the only 5v tolerant inputs.  For example, if you want three encoder inputs (JRO, RRO, SRO), that only leaves you with two remaining 5v-tolerant inputs to use as resets.

To get a third (or so forth) reset working, you'd need to add a resistor of some sort to the switch output and use one of the 3.3v inputs on the 7i73.



 

Please Log in or Create an account to join the conversation.

More
18 Sep 2023 13:07 #281074 by spumco
Replied by spumco on topic Linuxcnc encoder control

I am reading the encoder with the Mesa 7i73 card. Here I show that the axes are selected, Spindle and feedrate are selected with the encoder. I show X selection, Y selection, Z selection, A selection, B selection, Home-All Selection, Feedrate selection, Spindle Selection with encoder.

OP - did I miss your point with my last response?

Are you trying to use an encoder as a selector switch, and you want to limit the selections so that if the encoder is turned past whatever value is highest or lowest, LCNC ignores this?
 

Please Log in or Create an account to join the conversation.

More
19 Sep 2023 11:34 #281153 by spumco
Replied by spumco on topic Linuxcnc encoder control
Ok, understood.

If you still want to keep the selection encoder limited to those values, take a look at the knob2float component in the user manual.  You will probably have to convert float values to something else, but knob2float will ignore values higher or lower than some limits you can set.

Please Log in or Create an account to join the conversation.

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
24 Oct 2023 07:30 #283672 by Aciera
Replied by Aciera on topic Linuxcnc encoder control
try this, fill in your values and pins and see what you get on pin 'knob2float.0.out':
loadrt knob2float
addf knob2float.0 servo-thread

setp knob2float.0.max-out   <your maximum output value here>
setp knob2float.0.min-out   <your minimum output value here
setp knob2float.0.scale 1
setp knob2float.0.enable true

net knob_counts <= <your-encodercount-pin-here>  => knob2float.0.counts

net knob_out <= knob2float.0.out

Please Log in or Create an account to join the conversation.

Time to create page: 0.102 seconds
Powered by Kunena Forum