Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
11 Sep 2024 18:48 - 13 Sep 2024 13:18 #309930
by the_erk
Linux beginner RPI 5, GPIO + ethercat 4 axis adventure was created by the_erk
Hello all,
In this thread i intend to to document my attempt to to build a controller for a 4 axis mill, from concept to implementation.
I am highly inexperienced with Linux and programming in general, so this may be new source of entertainment for the more experienced members. The hope is to leave a trail someone as daft as me could follow, to create a workable controller.
The Photo's of screens and other dubious content is aimed at providing a quick and dirty temporary reference for those of us who don't know what the result is supposed to look like, if this ends up being of use i will tidy it up.
The end goal is a 4 axis ethercat motion controlsystem with RPI gpio performing a few less timing sensitive functions such as spindle direction and gear selection. with closed loop position control.
In this thread i intend to to document my attempt to to build a controller for a 4 axis mill, from concept to implementation.
I am highly inexperienced with Linux and programming in general, so this may be new source of entertainment for the more experienced members. The hope is to leave a trail someone as daft as me could follow, to create a workable controller.
The Photo's of screens and other dubious content is aimed at providing a quick and dirty temporary reference for those of us who don't know what the result is supposed to look like, if this ends up being of use i will tidy it up.
The end goal is a 4 axis ethercat motion control
Last edit: 13 Sep 2024 13:18 by the_erk. Reason: updated information
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 18728
- Thank you received: 6297
11 Sep 2024 19:09 #309932
by tommylight
Replied by tommylight on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Welcome and feel free to ask/teach/entertain us.
Please Log in or Create an account to join the conversation.
12 Sep 2024 05:55 #309969
by the_erk
Replied by the_erk on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
So one of the first questions that seems to crop up is latency/jitter and general performance of the RPI5 vs PC hardware and older RPI models.
I don't have an old pc available but i do have a RPI 4b and a PRI 5, both with 8gb of ram. and i can test the RPI 5 with and without the PCIE NVME hat to see if that makes any meaningful difference.
For fun i might try a usb bootable image for the laptop i used for Mach4 and Ethernet Smooth Stepper.
All will be tested with Linux CNC 2.9.2, SD card tests are done with a fresh image from the RPI Imager using the same sd card.
For the NVME test i have been playing with that install(2.9.2) for a few days (and the jitter looks worse for it I think).
All tests done with 10x glx gears running and Linux CNC guide open in firefox and scrolled around to get some idea of loaded up performance.
All RPI tests will be also using the same keyboard, mouse and HDMI + USB touch screen
As a side note the NVME drive seems to make the PI5 feel more responsive and quicker to bootup.
The performance of the PI4 with a desktop is new to me as i have only used it headless to run a 3d printer with klipper.
I don't have an old pc available but i do have a RPI 4b and a PRI 5, both with 8gb of ram. and i can test the RPI 5 with and without the PCIE NVME hat to see if that makes any meaningful difference.
For fun i might try a usb bootable image for the laptop i used for Mach4 and Ethernet Smooth Stepper.
All will be tested with Linux CNC 2.9.2, SD card tests are done with a fresh image from the RPI Imager using the same sd card.
For the NVME test i have been playing with that install(2.9.2) for a few days (and the jitter looks worse for it I think).
All tests done with 10x glx gears running and Linux CNC guide open in firefox and scrolled around to get some idea of loaded up performance.
All RPI tests will be also using the same keyboard, mouse and HDMI + USB touch screen
As a side note the NVME drive seems to make the PI5 feel more responsive and quicker to bootup.
The performance of the PI4 with a desktop is new to me as i have only used it headless to run a 3d printer with klipper.
Please Log in or Create an account to join the conversation.
12 Sep 2024 07:43 - 12 Sep 2024 13:57 #309974
by the_erk
Replied by the_erk on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Well i have some results, but I'm not sure what they mean in real terms beyond the recomendations in the documentation. I would be curious to know how they compare to other peoples results.
DUT base thread (us) servo thread (us)
RPI 4b sd card -24.7 (sdev2.5) +79.1 -149.2 (sdev5.4) +148.6
RPI 5 sd card -23.6 (sdev 1.0) +19.3 -30.6 (sdev2.1) +31.6
RPI 5 NVME -13.1 (sdev0.9) +12.1 -15.7 (sdev2.1) +16.3
(left running for 7 hours, result above unchanged)
Going by linuxcnc.org/docs/stable/html/install/latency-test.html the sub 15 microsecond base jitter provided by the RPI 5 with NVME should allow software stepping and the hardware seems capable from this crude test.. And yes i did take a photo of the screen because i am a luddite.
DUT base thread (us) servo thread (us)
RPI 4b sd card -24.7 (sdev2.5) +79.1 -149.2 (sdev5.4) +148.6
RPI 5 sd card -23.6 (sdev 1.0) +19.3 -30.6 (sdev2.1) +31.6
RPI 5 NVME -13.1 (sdev0.9) +12.1 -15.7 (sdev2.1) +16.3
(left running for 7 hours, result above unchanged)
Going by linuxcnc.org/docs/stable/html/install/latency-test.html the sub 15 microsecond base jitter provided by the RPI 5 with NVME should allow software stepping and the hardware seems capable from this crude test.. And yes i did take a photo of the screen because i am a luddite.
Attachments:
Last edit: 12 Sep 2024 13:57 by the_erk. Reason: aditional info
Please Log in or Create an account to join the conversation.
12 Sep 2024 08:10 #309976
by rodw
Replied by rodw on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Your latency looks fine for ethercat. To me it does not make sense to adopt ethercat and use another system for I/O. Use a ethercat I/O module
The following user(s) said Thank You: the_erk
Please Log in or Create an account to join the conversation.
12 Sep 2024 09:48 - 12 Sep 2024 10:09 #309980
by the_erk
Replied by the_erk on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Good point, Rodw.
Part of my interest in the GPIO was to use encoders for screw mapping or closed loop control, thinking the more ethercat components i buy(controller budget) the less the retrofit budget for the mill.
However a serious deficiency in motion control cannot be compensated for in motion hardware and vise versa.
I now have an Ethercat IO module next to me (arrived this morning along with some cat 6e patch leads) but due to me being a clown it seams the connection module for the ethernet cables is a discreet entity, and that will arrive tomorrow along with a 2x channel encoder interface.
On rout from china is an Rtelegent ECT60 Ethercat closed loop stepper driver that should be compatable with the 4x nema 34ish encoder equipped steppers i removed from my first cnc retrofit project. If i can bully them into working together i will order 3 more.
As for the Ethercat IO and encoder inputs i have aquired some Beckhoff modules.
EK1100 Ethercat coupler (don't forget this bit )
EL2609 18x 24v digital output
and possibly the wrong encoder interface for TTL grrrr
Part of my interest in the GPIO was to use encoders for screw mapping or closed loop control, thinking the more ethercat components i buy(controller budget) the less the retrofit budget for the mill.
However a serious deficiency in motion control cannot be compensated for in motion hardware and vise versa.
I now have an Ethercat IO module next to me (arrived this morning along with some cat 6e patch leads) but due to me being a clown it seams the connection module for the ethernet cables is a discreet entity, and that will arrive tomorrow along with a 2x channel encoder interface.
On rout from china is an Rtelegent ECT60 Ethercat closed loop stepper driver that should be compatable with the 4x nema 34ish encoder equipped steppers i removed from my first cnc retrofit project. If i can bully them into working together i will order 3 more.
As for the Ethercat IO and encoder inputs i have aquired some Beckhoff modules.
EK1100 Ethercat coupler (don't forget this bit )
EL2609 18x 24v digital output
and possibly the wrong encoder interface for TTL grrrr
Last edit: 12 Sep 2024 10:09 by the_erk. Reason: aditional info
Please Log in or Create an account to join the conversation.
13 Sep 2024 13:05 #310072
by the_erk
Replied by the_erk on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Establishing Ethercat communication is covered beautifully by forum.linuxcnc.org/ethercat/45336-etherc...-how-to-step-by-step
But for those like me who struggle with following instructions you might encounter the following error
because you failed to modify the ethercat conf file located
with
MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"DEVICE_MODULES="generic"
beware that is might not show an error like this if you missed the DEVICE_MODULES="generic" line further down the file. but it did not behave as expected / work.
the end result of "sudo systemctl status ethercat.service" should look like this
To confirm that Ethercat is trying to do something, but without any slave devices attached the command " ethercat master" should provide some conformation that something is going on. the output of the command should appear something like this.
But for those like me who struggle with following instructions you might encounter the following error
because you failed to modify the ethercat conf file located
with
MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"DEVICE_MODULES="generic"
beware that is might not show an error like this if you missed the DEVICE_MODULES="generic" line further down the file. but it did not behave as expected / work.
the end result of "sudo systemctl status ethercat.service" should look like this
To confirm that Ethercat is trying to do something, but without any slave devices attached the command " ethercat master" should provide some conformation that something is going on. the output of the command should appear something like this.
Attachments:
Please Log in or Create an account to join the conversation.
14 Sep 2024 21:36 #310167
by rodw
Replied by rodw on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Please Log in or Create an account to join the conversation.
17 Sep 2024 19:20 #310340
by the_erk
Replied by the_erk on topic Linux beginner RPI 5, GPIO + ethercat 4 axis adventure
Well hopefully it gives a few people like yourself a chuckle Rodw.
I hope my antics didn't come across as a criticism.
I am impressed but Ethercat , Linux CNC and the supporting documentation available, i'm just a bit of a bumbling idiot who has no idea what he is doing.
The fact i have made any progress at all ( i got some lights to flash on demand) is a testament to the efforts of people like yourself in making a complex and intricate system accessible to a digital novice like me.
I hope my antics didn't come across as a criticism.
I am impressed but Ethercat , Linux CNC and the supporting documentation available, i'm just a bit of a bumbling idiot who has no idea what he is doing.
The fact i have made any progress at all ( i got some lights to flash on demand) is a testament to the efforts of people like yourself in making a complex and intricate system accessible to a digital novice like me.
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
Time to create page: 0.193 seconds