Switch relay in a defined x position
14 Jan 2022 20:53 #231793
by mgm
Switch relay in a defined x position was created by mgm
Good evening,
Since my X axis is 2800 mm long I have built a pneumatic support. This is mounted in the middle.
What I want now is the following:
When the X axis arrives at 1000 mm, a relay should be switched to high and at 1800 mm switch back to low so that the axis can pass through.
Is there a pin or a signal that I can use for this?
Moderator: if wrong here please move
Cheers
Micha
Since my X axis is 2800 mm long I have built a pneumatic support. This is mounted in the middle.
What I want now is the following:
When the X axis arrives at 1000 mm, a relay should be switched to high and at 1800 mm switch back to low so that the axis can pass through.
Is there a pin or a signal that I can use for this?
Moderator: if wrong here please move
Cheers
Micha
Please Log in or Create an account to join the conversation.
14 Jan 2022 21:07 - 14 Jan 2022 21:08 #231796
by rodw
Replied by rodw on topic Switch relay in a defined x position
Its best to do this in a component that monitors the axis.x.pos-cmd
Here is an example that triggers a relay if the position is > a specific location set by a pin. If you added a second pin, to turn the output off, you would jjust need to change the if statement
YOu may need to change when position is set to 0 or 1 to suit your needs
Here is an example that triggers a relay if the position is > a specific location set by a pin. If you added a second pin, to turn the output off, you would jjust need to change the if statement
param rw float cutoff "Absolute axis coordinate above which disables zone change";
....
if((position > cutover) && (position < cutoff))
YOu may need to change when position is set to 0 or 1 to suit your needs
Attachments:
Last edit: 14 Jan 2022 21:08 by rodw.
Please Log in or Create an account to join the conversation.
14 Jan 2022 21:23 #231801
by mgm
Replied by mgm on topic Switch relay in a defined x position
Hello Rod,
thanks for your answer, this is exactly what I was looking for.
Please explain me now how and where I can include this.
thanks for your answer, this is exactly what I was looking for.
Please explain me now how and where I can include this.
Please Log in or Create an account to join the conversation.
14 Jan 2022 21:32 #231803
by rodw
Replied by rodw on topic Switch relay in a defined x position
sudo apt-get install downdraft.comp
and add the suggested hal connections.
Check the main docs for details on using the "hal component generator" (halcompile)
and add the suggested hal connections.
Check the main docs for details on using the "hal component generator" (halcompile)
Please Log in or Create an account to join the conversation.
14 Jan 2022 21:45 #231806
by mgm
Replied by mgm on topic Switch relay in a defined x position
Thanks for this information, will do.
Best
Micha
Best
Micha
Please Log in or Create an account to join the conversation.
16 Jan 2022 13:48 #232014
by mgm
Replied by mgm on topic Switch relay in a defined x position
Hello Rod,
I have now tried to test your suggestion.
Unfortunately, I get along with it at all.
It fails already with the fact that I cannot find the correct directory:
"Place the .comp file in the source directory linuxcnc/src/hal/ components and re-run make. Comp files are automatically detected by the build system."
I am using Linum MX and 2.9 for testing, in a VirtualBox.
I installed it according to this manual:
LinuxCNC Install using MX Linux 19.4 - Geared Toward New/Windows Users
What am I doing wrong?
I have now tried to test your suggestion.
Unfortunately, I get along with it at all.
It fails already with the fact that I cannot find the correct directory:
"Place the .comp file in the source directory linuxcnc/src/hal/ components and re-run make. Comp files are automatically detected by the build system."
I am using Linum MX and 2.9 for testing, in a VirtualBox.
I installed it according to this manual:
LinuxCNC Install using MX Linux 19.4 - Geared Toward New/Windows Users
What am I doing wrong?
Please Log in or Create an account to join the conversation.
16 Jan 2022 18:42 #232043
by rodw
Replied by rodw on topic Switch relay in a defined x position
Oops I was totally wrong above. There is no need to copy the file to any special location
For a rip build type this in the folder the comp file is in
halcompile --install downdraft.comp
For a deb install add sudo to the command above.
sudo halcompile --install downdraft.comp
See linuxcnc.org/docs/devel/html/hal/comp.html
You can change the file name but you also need to edit the first line in the file to use the new file name
For a rip build type this in the folder the comp file is in
halcompile --install downdraft.comp
For a deb install add sudo to the command above.
sudo halcompile --install downdraft.comp
See linuxcnc.org/docs/devel/html/hal/comp.html
You can change the file name but you also need to edit the first line in the file to use the new file name
Please Log in or Create an account to join the conversation.
16 Jan 2022 22:16 #232074
by andypugh
Replied by andypugh on topic Switch relay in a defined x position
Isn't this something that the built-on "comp" or "wcomp" components can do?
linuxcnc.org/docs/2.8/html/man/man9/comp.9.html
linuxcnc.org/docs/2.8/html/man/man9/wcomp.9.html
linuxcnc.org/docs/2.8/html/man/man9/comp.9.html
linuxcnc.org/docs/2.8/html/man/man9/wcomp.9.html
The following user(s) said Thank You: hoffb77
Please Log in or Create an account to join the conversation.
17 Jan 2022 06:27 #232091
by rodw
Replied by rodw on topic Switch relay in a defined x position
No wonder I wrote a component. The documentation there is truly awful. UNnless you have an electronics major you have no clue what a comparator is.Isn't this something that the built-on "comp" or "wcomp" components can do?
linuxcnc.org/docs/2.8/html/man/man9/comp.9.html
linuxcnc.org/docs/2.8/html/man/man9/wcomp.9.html
Please Log in or Create an account to join the conversation.
17 Jan 2022 18:10 #232148
by mgm
Replied by mgm on topic Switch relay in a defined x position
I have now managed to do this with the Halcompile. As an answer I got:
compiling realtime downdraft.c
Linking downdraft.so
cp downdraft.so /usr/lib/linuxcnc/modules/
I have also added the lines in the Hal file.
Now when I start Linuxcnc I get this error message:
HAL-ERROR: function downdraft not found!
What or where is the wrong?
compiling realtime downdraft.c
Linking downdraft.so
cp downdraft.so /usr/lib/linuxcnc/modules/
I have also added the lines in the Hal file.
Now when I start Linuxcnc I get this error message:
HAL-ERROR: function downdraft not found!
What or where is the wrong?
Please Log in or Create an account to join the conversation.
Time to create page: 0.095 seconds