Arduino based USB Pendant for Linuxcnc

More
27 Jun 2019 20:12 #138029 by Robban
Hi, I think im having some trouble with the connection to linuxcnc.
Trying to use this code for a Emco 120 control panel but i cant get it to work, using the original serialcon file and have checked that i have the right port, also added the necessary code in the postgui.hal file
loadusr -W serialcon

# the -W switch is important or the pins might not have been created by time hal tries to connect to them
# as belt and braces I put the initiation command at the top of the file and the below at the end

net Xposition halui.axis.0.pos-relative serialcon.xposition
net Yposition halui.axis.1.pos-relative serialcon.yposition
net Zposition halui.axis.2.pos-relative serialcon.zposition
Have removed the lcd code from it and done so i can send the commands via the serialmonitor.
Can someone help me to see whats wrong.
I can see the serialcon pins in the Hal configuration.
Adding the arduino file
Attachments:

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

More
27 Jun 2019 22:27 #138039 by Robban
Update! Tried to get the x y z positions to the arduino and i got them to print in the serial monitor. So its probably something with the sendCommand function im missing.

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

More
28 Jun 2019 00:55 #138068 by andypugh
Robban: Can you start a new thread and describe your particular problems rather than ask us to read back through 10 pages of old posts fruitlessly searching for an earlier question from you with more background?

We like to help, but we need more clues what the problem is.

Basically:
What did you do?
What happened?
How is this different from what you wanted to happen?

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

More
28 Jun 2019 08:12 #138100 by Robban

Robban: Can you start a new thread and describe your particular problems rather than ask us to read back through 10 pages of old posts fruitlessly searching for an earlier question from you with more background?

We like to help, but we need more clues what the problem is.

Basically:
What did you do?
What happened?
How is this different from what you wanted to happen?


Ok, i have made a new post!
Help, Arduino based control panel for Linuxcnc.

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

More
28 Jun 2019 17:54 #138130 by pl7i92
as there is now a xhc componet
it is realy good to spend this 40USD on it
as all functions 4 axis and 12buttons are free to programm and
within the component redy to use at startup

but we use also a home made
Attachments:

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

More
08 Sep 2019 03:30 - 08 Sep 2019 15:55 #144503 by oddwick
I know that this is an old thread, but it definitely has promise and i stumbled across it a while ago, but just now started to work on it. I really like the idea of being able to change the pendant to suit my needs.

But i am having a few problems getting this going and i was curious if there have been some major changes between 2.7 and 2.8 that affect this project.?

first, i cant compile or install the comp as it is. i keep getting the following errors:
sudo halcompile --install serialcon2.c
Compiling realtime serialcon2.c
serialcon2.c: In function ‘__comp_parse_count’:
serialcon2.c:85:13: error: ‘count’ undeclared (first use in this function)
             count = strtoul(&argv[i][6], NULL, 0);
             ^~~~~
serialcon2.c:85:13: note: each undeclared identifier is reported only once for each function it appears in
serialcon2.c: In function ‘__comp_parse_names’:
serialcon2.c:112:17: error: ‘names’ undeclared (first use in this function)
                 names[j] = strtok(p, ",");
                 ^~~~~
/usr/share/linuxcnc/Makefile.modinc:113: recipe for target 'serialcon2.o' failed
make: *** [serialcon2.o] Error 1
and after i updated
gcc -Os -g -I. -I/build/linuxcnc-2.9.0~pre0.569.gae6e7e00a/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -DSIM -fPIC -URTAPI -U__MODULE__ -DULAPI -Os  -o serialcon2 /tmp/tmprpPLCd/serialcon2.c -Wl,-rpath,/lib -L/lib -llinuxcnchal 
/tmp/tmprpPLCd/serialcon2.c: In function ‘__comp_parse_count’:
/tmp/tmprpPLCd/serialcon2.c:85:13: error: ‘count’ undeclared (first use in this function)
             count = strtoul(&argv[i][6], NULL, 0);
             ^~~~~
/tmp/tmprpPLCd/serialcon2.c:85:13: note: each undeclared identifier is reported only once for each function it appears in
/tmp/tmprpPLCd/serialcon2.c: In function ‘__comp_parse_names’:
/tmp/tmprpPLCd/serialcon2.c:112:17: error: ‘names’ undeclared (first use in this function)
                 names[j] = strtok(p, ",");
                 ^~~~~
Makefile:2: recipe for target 'serialcon2' failed
make: *** [serialcon2] Error 1

BUT.... if i comment out the singleton directive, then i can compile an install, and then it will load fine.

the other issue with it which caused me grief is that i had to change
net Xposition halui.axis.0.pos-relative serialcon.xposition
to
net Xposition halui.axis.0.pos-relative serialcon.0.xposition
is that because my machine is using joints/axes?

and then finally, on the arduino side, i am gettin constant gibberish for the axes display, even when the machine is sitting still. i can manually send updates to the arduino and it is parsed just fine, but when hooked up to the machine the display is constantly flashing random numbers and an occasional 'X', 'Y' or 'Z'. Pretty sure that if machine isnt moving, neither should the position data... maybe its sending random line endings or something? Anybody have a way to find out what is being sent?

and finally, one last question. i originally tried to use a pro micro because with the atmega32u4, it has native usb and i had hopes of maybe using HID commands instead of sending them via serial, but they tend to be rather fickle (and they come up as /dev/ttyACM0 also, which linuxcnc doesnt seem to like) so i switched to a nano which seems to work better, but no native usb (ch340g instead). i dont know how linux handles usb connections, but when i plug it in, it comes up as ttyUSB0. that works ok. but if i have linuxcnc running and it accidentally gets unplugged, then it comes up as ttyUSB1 when i plug it back in and i lose communication. Does linux lock the connection when it is established and thinks this is a new device? that would be a disaster if it got unplugged in the middle of a job and not be able to reconnect...

anyway thanks in advance and ArcEye this is brilliant! im glad there are smarter heads than mine out there and any advice would be greatly appreciated!
Last edit: 08 Sep 2019 15:55 by oddwick. Reason: removed color tag

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

More
08 Sep 2019 15:40 #144536 by pl7i92
we use a Button on the main panell to reconnect the pedand
you can simply run the HAL again
or just by Mcode get the loadrt usercomp reloaded
that workes for most USB

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

More
21 Aug 2023 13:14 - 21 Aug 2023 14:26 #278611 by step4linux
hello everybody,
I was investigating for a flexible arduino-based, USB pendant solution and I came up to this old thread, since I did not find something more exciting (except HID based, which I would avoid).
My question: is there an "official" source for serialcon2? I found a link here, but the serialcon2.zip contains serialcon versions (without "2"). I could compile/install it anyway and it seems to be ok for my linuxcnc 2.8. What is the difference to "2"?

Any other suggestions?

kind regards, Gerd
Attachments:
Last edit: 21 Aug 2023 14:26 by step4linux. Reason: screenshot

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

Time to create page: 0.317 seconds
Powered by Kunena Forum