Rotary Selector Switches & Resistors
- fully_defined
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 5
16 Dec 2024 00:41 #316724
by fully_defined
Replied by fully_defined on topic Rotary Selector Switches & Resistors
Please feel free to correct me if I have gotten anything wrong here. This post is for future me, and whomever else may benefit from it. I will likely edit this if there are corrections.
I put together a circuit on a breadboard, for testing. I still have to set this all up in LinuxCNC, but at least I have a physical thing to work with. The white wire is GND, orange is switch position 1, blue 2, green 3, & red 4. I will use this for selecting axes: Off, X, Y, Z, and a similar thing on another switch to select x1, x0.1, x0.01, x0.001, although microns are probably a pipe dream on this machine.
Orange (1) has no conductivity to bit 0 or bit 1; 0:0
Blue (2) has conductivity to bit 0 and bit 1; 1:1
Green (3) has no conductivity to bit 0, but does to bit 1; 0:1
Red (4) has conductivity to bit 0, but not bit 1; 1:0
Now I have to figure out Mux8 for a mode switch. That's eight inputs for three rotary switches, so that leaves eight inputs left on P2, of which two are going to an MPG. Plus all of the P1 inputs.
I put together a circuit on a breadboard, for testing. I still have to set this all up in LinuxCNC, but at least I have a physical thing to work with. The white wire is GND, orange is switch position 1, blue 2, green 3, & red 4. I will use this for selecting axes: Off, X, Y, Z, and a similar thing on another switch to select x1, x0.1, x0.01, x0.001, although microns are probably a pipe dream on this machine.
Orange (1) has no conductivity to bit 0 or bit 1; 0:0
Blue (2) has conductivity to bit 0 and bit 1; 1:1
Green (3) has no conductivity to bit 0, but does to bit 1; 0:1
Red (4) has conductivity to bit 0, but not bit 1; 1:0
Now I have to figure out Mux8 for a mode switch. That's eight inputs for three rotary switches, so that leaves eight inputs left on P2, of which two are going to an MPG. Plus all of the P1 inputs.
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1813
- Thank you received: 733
16 Dec 2024 13:53 - 16 Dec 2024 13:54 #316756
by spumco
Replied by spumco on topic Rotary Selector Switches & Resistors
ARRGH!
Had a nice response, forum editor kicked me in the fork. I'll try again shortly.
Had a nice response, forum editor kicked me in the fork. I'll try again shortly.
Last edit: 16 Dec 2024 13:54 by spumco.
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1813
- Thank you received: 733
16 Dec 2024 16:04 - 16 Dec 2024 16:12 #316767
by spumco
Replied by spumco on topic Rotary Selector Switches & Resistors
OP –
NOTE - Yes, learning LCNC can be a challenge – I’ve experienced numerous ‘throw in the towel’ events myself. And while LCNC is fairly well documented, for beginners what’s missing – especially in the MAN pages – is context. Throw in new terminology & jargon, and a forum search tool that’s sub-optimal, and you’ve got a situation ripe for frustration.
If you search for some of my earliest posts from a few years ago you’ll run across a few of my tantrums that may feel especially familiar.
It looks like you’re making progress with your original question, but I’ll comment here in case you’ve still got some things to work out.
If I understand your original question, you wanted to know if a multi-position selector switch can be used to return discrete analog voltages to the controller (LCNC). And can those voltages be used to do something? i.e. mode select, FRO/SRO value, whatever?
I’ve seen two types of this implementation done on non-LCNC control systems:
Selector switch with resistors
Potentiometer with detents
I found the second version (pot with detents) on my Emco control system. I bought an Emco external control panel (for simulator use) and discovered that the mode and FRO selector switches were, in fact, simple potentiometers that had an external detent arrangement built in to the knob. Same pot & knob for both the 6-position mode ‘switch’ and the 15(ish) position FRO ‘switch’. Just different detent rings behind the knob.
In either hardware case, I think the HAL file magic lies in using a HAL component named wcomp. If you’re not familiar with LCNC and HAL, ‘components’ are like little mini-programs that create virtual pins with behavior specific to that component.
linuxcnc.org/docs/devel/html/man/man9/wcomp.9.html
Wcomp allows you to set an input value range/window, and then compares the input to the window. If the input value is within that window the wcomp output goes true (pin goes high). There are also ‘under’ and ‘over’ outputs available.
I think a series of wcomp instances could be created in HAL – one for each ‘position’ of the switch (pot w/detents or selector switch). 4- position selector = 4 instances of wcomp.
Once the hardware is built, you can check using halshow (a utility in LCNC that shows raw IO values) and determine the voltage at each position. The appropriate wcomp instance is given a reasonable voltage range (to account for variances in supply voltage & pot noise), and the wcomp output is connected – again in HAL – to whatever you need to trigger.
In your case, a mux component for mode or FRO would use the various wcomp ouputs to select the desired outcome.
Of course, there likely many ways to accomplish an analog-to-digital selection scheme without using wcomp - but I can't think of them right this minute.
Coincidentally, a video covering this analog-to-digital input scheme has been put on youtube quite recently.
Hope that helps a little.
NOTE - Yes, learning LCNC can be a challenge – I’ve experienced numerous ‘throw in the towel’ events myself. And while LCNC is fairly well documented, for beginners what’s missing – especially in the MAN pages – is context. Throw in new terminology & jargon, and a forum search tool that’s sub-optimal, and you’ve got a situation ripe for frustration.
If you search for some of my earliest posts from a few years ago you’ll run across a few of my tantrums that may feel especially familiar.
It looks like you’re making progress with your original question, but I’ll comment here in case you’ve still got some things to work out.
If I understand your original question, you wanted to know if a multi-position selector switch can be used to return discrete analog voltages to the controller (LCNC). And can those voltages be used to do something? i.e. mode select, FRO/SRO value, whatever?
I’ve seen two types of this implementation done on non-LCNC control systems:
Selector switch with resistors
Potentiometer with detents
I found the second version (pot with detents) on my Emco control system. I bought an Emco external control panel (for simulator use) and discovered that the mode and FRO selector switches were, in fact, simple potentiometers that had an external detent arrangement built in to the knob. Same pot & knob for both the 6-position mode ‘switch’ and the 15(ish) position FRO ‘switch’. Just different detent rings behind the knob.
In either hardware case, I think the HAL file magic lies in using a HAL component named wcomp. If you’re not familiar with LCNC and HAL, ‘components’ are like little mini-programs that create virtual pins with behavior specific to that component.
linuxcnc.org/docs/devel/html/man/man9/wcomp.9.html
Wcomp allows you to set an input value range/window, and then compares the input to the window. If the input value is within that window the wcomp output goes true (pin goes high). There are also ‘under’ and ‘over’ outputs available.
I think a series of wcomp instances could be created in HAL – one for each ‘position’ of the switch (pot w/detents or selector switch). 4- position selector = 4 instances of wcomp.
Once the hardware is built, you can check using halshow (a utility in LCNC that shows raw IO values) and determine the voltage at each position. The appropriate wcomp instance is given a reasonable voltage range (to account for variances in supply voltage & pot noise), and the wcomp output is connected – again in HAL – to whatever you need to trigger.
In your case, a mux component for mode or FRO would use the various wcomp ouputs to select the desired outcome.
Of course, there likely many ways to accomplish an analog-to-digital selection scheme without using wcomp - but I can't think of them right this minute.
Coincidentally, a video covering this analog-to-digital input scheme has been put on youtube quite recently.
Hope that helps a little.
Last edit: 16 Dec 2024 16:12 by spumco. Reason: forum editor!
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1813
- Thank you received: 733
16 Dec 2024 16:33 #316768
by spumco
Replied by spumco on topic Rotary Selector Switches & Resistors
And another thing...
Something to keep in mind is that LCNC doesn't have the same 'modes' that the Fanuc controller you posted a pic of has. Understanding how physical inputs work is important, of course, but before you tear your hair out it's be useful to understand what you need to control LCNC.
You don't need that selector switch at all to 'access' those modes. Depending on the GUI you choose, those modes are available on-screen (either via mouse, keyboard, or touchscreen). And if you want a physical button/knob, you can use one of those - either instead of or in addition to the on-screen control.
The only 'modes' you need to worry about are MANUAL, MDI, and AUTO. If you are in manual - you can jog. And you can jog continuous or incremental without switching to a different 'mode'.
Unlike the Fanuc, there is no separate 'EDIT' mode. G-code files are edited just like any other computer file and then re-loaded; the GUI you choose likely has a built-in file editor page/window.
In addition, many GUIs have scripts/functions running in the background (via python or some other computer magic) that switch between modes automatically for your convenience.
Example: You are in manual mode. You type something in the MDI entry window, and hit the 'enter' key. LCNC switches to MDI in the background, executes the command, and switches back to manual mode when the command is done so you can get back to jogging around.
Not all GUI's behave the same, but most do. And that' something else to make sure you understand: GUI's are not LCNC. LCNC is the control software, and the user interface is a separate bit of software that talks back and forth with LCNC. This is very unfamiliar to those used to Windows machines where the 'software' and user interface all feel like the same thing (even if they aren't).
LCNC's arrangement makes is fairly easy to switch between interfaces, but it can cause confusion for newcomers when a GUI does one thing, and a different GUI does something slightly (or wildly) different.
Getting back to the original premise - what do you want LCNC to do? Are you trying to duplicate the Fanuc control behavior closely, or just the concept of having a FRO with discrete values rather than a variable scale?
If you want a single input to flip between modes, a HAL component called 'multi-switch' works great. One input, and repeatedly pressing the button cycles through the three modes.
linuxcnc.org/docs/devel/html/man/man9/multiswitch.9.html
Obviously I don't need DNC, but I want to be able to access the rest of these modes with a hardware switch. That's my goal.
Something to keep in mind is that LCNC doesn't have the same 'modes' that the Fanuc controller you posted a pic of has. Understanding how physical inputs work is important, of course, but before you tear your hair out it's be useful to understand what you need to control LCNC.
You don't need that selector switch at all to 'access' those modes. Depending on the GUI you choose, those modes are available on-screen (either via mouse, keyboard, or touchscreen). And if you want a physical button/knob, you can use one of those - either instead of or in addition to the on-screen control.
The only 'modes' you need to worry about are MANUAL, MDI, and AUTO. If you are in manual - you can jog. And you can jog continuous or incremental without switching to a different 'mode'.
Unlike the Fanuc, there is no separate 'EDIT' mode. G-code files are edited just like any other computer file and then re-loaded; the GUI you choose likely has a built-in file editor page/window.
In addition, many GUIs have scripts/functions running in the background (via python or some other computer magic) that switch between modes automatically for your convenience.
Example: You are in manual mode. You type something in the MDI entry window, and hit the 'enter' key. LCNC switches to MDI in the background, executes the command, and switches back to manual mode when the command is done so you can get back to jogging around.
Not all GUI's behave the same, but most do. And that' something else to make sure you understand: GUI's are not LCNC. LCNC is the control software, and the user interface is a separate bit of software that talks back and forth with LCNC. This is very unfamiliar to those used to Windows machines where the 'software' and user interface all feel like the same thing (even if they aren't).
LCNC's arrangement makes is fairly easy to switch between interfaces, but it can cause confusion for newcomers when a GUI does one thing, and a different GUI does something slightly (or wildly) different.
Getting back to the original premise - what do you want LCNC to do? Are you trying to duplicate the Fanuc control behavior closely, or just the concept of having a FRO with discrete values rather than a variable scale?
If you want a single input to flip between modes, a HAL component called 'multi-switch' works great. One input, and repeatedly pressing the button cycles through the three modes.
linuxcnc.org/docs/devel/html/man/man9/multiswitch.9.html
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1813
- Thank you received: 733
16 Dec 2024 16:57 #316776
by spumco
Replied by spumco on topic Rotary Selector Switches & Resistors
Here's an example of what I found on the back of the Emco selector 'switch' knob. There was a spring-loaded ball inside the metal knob that engaged the ring divots.
The slot in the ring engaged with the pot anti-rotation tab and the pot clamping nut kept it in place. Knob with ball was just pressed on top - leading to a not-so-amusing self-disassembly when the knob was removed.
I like this idea so much I may actually do it on my SRO, FRO, and JRO pots, but I think it'd require a pot with a fairly long mounting thread (or a very thin mounting surface).
The slot in the ring engaged with the pot anti-rotation tab and the pot clamping nut kept it in place. Knob with ball was just pressed on top - leading to a not-so-amusing self-disassembly when the knob was removed.
I like this idea so much I may actually do it on my SRO, FRO, and JRO pots, but I think it'd require a pot with a fairly long mounting thread (or a very thin mounting surface).
Please Log in or Create an account to join the conversation.
- fully_defined
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 5
16 Dec 2024 19:19 #316795
by fully_defined
I even tried integrating the diodes into the switch body, but this was not fun to build and I think it needs clear shrink tubing because I am not 100% sure I even oriented the diodes the right way LOL. Whatever... it didn't work either - in a way that I know how to test. If there was guide - that I know how to find - I would know how to test this. Knowing what I know now, I would do this with solder lugs instead of PCB pins. The switches I already made - and function, sort of - for the EdingCNC UIO-10 have solder lugs and were so much easier to work with.
You only have it partially right. My goal is to implement a rotary switch - actually, multiple rotary switches. I don't care if it's mux4 or mux8 or series resistors! Series resistors were all I knew existed prior to the original post, but I have been convinced enough already that binary switches are at least just as good and probably better, with the loss of a few pins. Since I am using the 7i73, I have plenty to spare.
I'm going to split my responses into smaller comments. This is just the first of a few, several, or however many I end up writing.
Replied by fully_defined on topic Rotary Selector Switches & Resistors
I got some help from Mesa. PCW is a nice person, and I appreciate what help I have been given so far, but there's a long way to go. For example, the mux4 circuit I showed above doesn't actually work in any way - that I know how to test - with a multimeter, and the picture of a brutishly hacked together switch another one of the regulars here insists is enough information for me isn't enough information for me. Worse, it's the only place on the entire internet that such a thing exists... that I can find.OP –
It looks like you’re making progress with your original question, but I’ll comment here in case you’ve still got some things to work out.
If I understand your original question, you wanted to know if a multi-position selector switch can be used to return discrete analog voltages to the controller (LCNC). And can those voltages be used to do something? i.e. mode select, FRO/SRO value, whatever?
I even tried integrating the diodes into the switch body, but this was not fun to build and I think it needs clear shrink tubing because I am not 100% sure I even oriented the diodes the right way LOL. Whatever... it didn't work either - in a way that I know how to test. If there was guide - that I know how to find - I would know how to test this. Knowing what I know now, I would do this with solder lugs instead of PCB pins. The switches I already made - and function, sort of - for the EdingCNC UIO-10 have solder lugs and were so much easier to work with.
You only have it partially right. My goal is to implement a rotary switch - actually, multiple rotary switches. I don't care if it's mux4 or mux8 or series resistors! Series resistors were all I knew existed prior to the original post, but I have been convinced enough already that binary switches are at least just as good and probably better, with the loss of a few pins. Since I am using the 7i73, I have plenty to spare.
I'm going to split my responses into smaller comments. This is just the first of a few, several, or however many I end up writing.
Please Log in or Create an account to join the conversation.
- fully_defined
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 5
16 Dec 2024 19:32 #316796
by fully_defined
Replied by fully_defined on topic Rotary Selector Switches & Resistors
As an aside, I am also a little confused why PCW suggested 00, 11, 01, 10, instead of 00, 01, 10, 11. It seems more logical to me to order it like legit binary, and it's not like it's harder to connect it this way.
Granted, I have a lot to learn.
Granted, I have a lot to learn.
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
Less
More
- Posts: 1813
- Thank you received: 733
16 Dec 2024 19:33 #316797
by spumco
Replied by spumco on topic Rotary Selector Switches & Resistors
Yes, you've got a fair number of inputs available on the 7i73.
I've got a 4x8 keypad matrix, plus a 6-axis MPG w/3 increment selections, plus analog FRO/SRO/JRO pots on mine.
In case you weren't aware, on a digital-input selector switch - say for jog increment - you only need 2 input pins to have three available states.
Both inputs off = state/value #1 (just leave this switch pole disconnected)
In1 on, In2 off = state/value #2
In1 off, In2 on = state/value #3
I've got a 4x8 keypad matrix, plus a 6-axis MPG w/3 increment selections, plus analog FRO/SRO/JRO pots on mine.
In case you weren't aware, on a digital-input selector switch - say for jog increment - you only need 2 input pins to have three available states.
Both inputs off = state/value #1 (just leave this switch pole disconnected)
In1 on, In2 off = state/value #2
In1 off, In2 on = state/value #3
Please Log in or Create an account to join the conversation.
- fully_defined
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 5
16 Dec 2024 19:50 #316801
by fully_defined
I'll do some reading. Thanks!
Replied by fully_defined on topic Rotary Selector Switches & Resistors
A Google search of HAL WCOMP LINUXCNC, in any combination, returns zero results. However, I found a manual last revised in 2007 so it wasn't all for naught: linuxcnc.org/docs/2.1/HAL_User_Manual.pdfIn either hardware case, I think the HAL file magic lies in using a HAL component named wcomp. If you’re not familiar with LCNC and HAL, ‘components’ are like little mini-programs that create virtual pins with behavior specific to that component.
linuxcnc.org/docs/devel/html/man/man9/wcomp.9.html
I'll do some reading. Thanks!
Please Log in or Create an account to join the conversation.
- fully_defined
- Offline
- Senior Member
Less
More
- Posts: 51
- Thank you received: 5
16 Dec 2024 19:58 #316802
by fully_defined
Replied by fully_defined on topic Rotary Selector Switches & Resistors
I am aware, but I also need two input pins for four available states, so I don't have any practical reason to limit it to three. I hadn't originally planned to go all the way from micron to mm on the scale, I can do it with no extra work, so I will! The axis selection switch will be off + x + y+ z. That is, if that's even allowed LOL.In case you weren't aware, on a digital-input selector switch - say for jog increment - you only need 2 input pins to have three available states.
Both inputs off = state/value #1 (just leave this switch pole disconnected)
In1 on, In2 off = state/value #2
In1 off, In2 on = state/value #3
Please Log in or Create an account to join the conversation.
Time to create page: 0.085 seconds