Other ways to interface with LinuxCNC

More
09 Sep 2023 07:48 #280315 by rodw

In many of my projects, having a fully featured CNC controller core like LinuxCNC (with trajectory planning, PID tuning, homing cycles, etc...) would be very useful and I am not aware of LinuxCNC alternatives that are this advanced. 

I suspect its not clear to you that Linuxcnc IS_THE_MOTION_CONTROLLER so everything to do with motion happens on the PC, not on an external board.

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

More
09 Sep 2023 08:10 #280316 by HerrNamenlos123
I am aware of that, which is why I would probably use an SPI Ethernet board to communicate with the Arduino. But the point is that it does not need to be an Arduino, as soon as the program works.

I think I am close, actually, I wrote a HAL component using a .comp file, compiled with halcompile, and loaded using loadrt. I can already manipulate position commands and axis velocities in C, which is exactly what I wanted. Now, (given that the Arduino connection can keep up of course), will this be just as fast as any other hardware, allowing for high-precision motion, or is this halcompiled realtime component still slower than a real parallel port?

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

More
09 Sep 2023 08:18 - 09 Sep 2023 08:24 #280317 by HerrNamenlos123
Yes, this is exactly why I want to use it! I want to use LinuxCNC as the head for everything, and a very simple arduino to connect to a motor. I do not want to buy ready-made hardware.

I think my back story would help you understand my projects. In the past years I build CNC mills by doing EVERYTHING myself, using salvaged motors, hand-made encoders, and writing a custom GRBL clone because GRBL does not support real servo motors, only stepper hybrids. So I did everything myself, including G-Code parsing, trajectories, PWM generation, etc. Not the best, but it worked.

What I am hoping from LinuxCNC is that it will be a step up, by moving the core logic from the Arduino to the PC, while keeping the hardware almost identical. Having anything to do with ready-made Mesa cards or anything like that would be a step back from the perspective of my projects since my goal is not to simply have a working machine, my goal is to BUILD the machine. (as cheaply as possible).

EDIT: Oh right, to explain what I meant with controlling anything: I was talking about homemade servo motors. Plugging a bought servo into a servo card would be boring :) I am tinkering around with DC motors and homemade encoders.
Last edit: 09 Sep 2023 08:24 by HerrNamenlos123.

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

More
09 Sep 2023 08:20 #280318 by cornholio
What would make your proposal of communicating with an Arduino (which may not the strongest choice) any better than some of the other options I mentioned ?
The FPGA options I mentioned, including Mesa (here we have etherent, EPP and SPI interfaces for coummunicating from Linuxcnc, then the FPGA can extend this via SmartSerial interface and some others), are very configurable, and to be honest if you use the Mesa supplied hardware there are just 2 files that need editing. Using a generic Spartan 6 board it comes to 3, as you need to create a pin file to suit the hardware.
Litex-cnc (initially ethernet, but a SPI interface is being talked about). Linuxcnc-RIO (this can be via SPI or an Etherent to SPI bridge) & LiteHm2 (etherent) only really require editing a single config file for the hardware.
There's nothing to stop you adding extensions to the FPGA solution if you are fluent in VHDL or Verilog (there is a guy that used a Mojo board and added a plugin to talk to the on board MCU to get analogue readings). That is something you may not be, but then again not everyone can program an Arduino.
Give it a shot, but just make sure that you aren't trying to reinvent the wheel, so to say.

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

More
09 Sep 2023 08:28 #280319 by cornholio

I am aware of that, which is why I would probably use an SPI Ethernet board to communicate with the Arduino. But the point is that it does not need to be an Arduino, as soon as the program works.

I think I am close, actually, I wrote a HAL component using a .comp file, compiled with halcompile, and loaded using loadrt. I can already manipulate position commands and axis velocities in C, which is exactly what I wanted. Now, (given that the Arduino connection can keep up of course), will this be just as fast as any other hardware, allowing for high-precision motion, or is this halcompiled realtime component still slower than a real parallel port?
 

Linuxcnc still talks to the parallel port via a realtime component\driver. Each external piece of hardware as their own realtime component\driver that is used for back & forth communication. Before jumping of the deep end I suggest a read of the docs maybe an idea. Almost all of the hal components are described.
The following user(s) said Thank You: HerrNamenlos123

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

More
09 Sep 2023 08:35 - 09 Sep 2023 08:36 #280321 by HerrNamenlos123
Hm, I have to think about that.
When forgetting about all bad ideas in my head and facing the reality, I have a homemade CNC mill that was build for almost no money at all, constisting of DC motors with handmade encoders, hand soldered pcbs, DC motor drivers, and an Arduino that is running a custom GRBL clone, closing the loop on all 3 servos, and the GCode is streamed via USB via Universal G-Code Sender. (realtime not required as the PC only sends G-Code in advance). It might sound really sketchy and it is, but given the circumstances it works amazingly well and I already milled amazing parts, while having spent close to zero money for the machine.

This is the reality. Now, ideally i would like to upgrade this by putting LinuxCNC on the PC and letting someone else do the heavy work, while most likely moving to an Ethernet connection and minimizing the Arduino code to only put power to the motors. As said, buying specialized hardware would at this point defy the point of having the machine in the first place, and I would not know of a board that talks to my handmade encoders :) I want to tinker with the concept of servo motors, not build a perfect machine.
Last edit: 09 Sep 2023 08:36 by HerrNamenlos123.

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

More
09 Sep 2023 09:34 #280324 by cornholio
What's the issue with your encoders ?
Did you go for somethings other than a quadrature output ?

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

More
09 Sep 2023 11:14 - 09 Sep 2023 11:33 #280329 by tommylight
Now we are getting somewhere.
There is everything regarding arduino with LinuxCNC, even directly controlling stuff like motors and IO made by DaBit, a member here and the same nic on youtube.
There is SPI stuff for RPI and 3D printer boards, Remora and some other projects also here.
To find stuff on this forum and website, use google:
arduino usb site:linuxcnc.org
That returns only stuff from this website containing arduino and usb.
Still, as mentioned above, do not get your hopes high about arduino, it is still crippled by the USB interface and the inherent latency.
edit
some links to cheap servo drives
forum.linuxcnc.org/show-your-stuff/31742...for-2-motors?start=0
forum.linuxcnc.org/27-driver-boards/3867...i92-firmware-request
Last one is for parallel port or Mesa boards.
Last edit: 09 Sep 2023 11:33 by tommylight. Reason: more info

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

More
09 Sep 2023 17:33 #280339 by andypugh
Have you found the STMBL project? Open-hardware and software running on the STM32 to run moderately large servos.

github.com/rene-dev/stmbl

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

More
10 Sep 2023 16:35 #280408 by HerrNamenlos123
Thank you all for the links!
You are right, we are getting somewhere. Now that I think about it, there actually isn't anything weird about my hardware. I was just so hyper focused on my past attempts that I did not think it is plausible that any ready made hardware would work well for me.

Time for some specs:
I am using BTS7960 DC motor drivers like shown here: www.amazon.com/HiLetgo-BTS7960-Driver-Ar...urrent/dp/B00WSN98DC. 43A and I got them for around 8€ each. IIRC there are 2 direction pins and 2 PWM pins, but I chained them together to have one pin for right direction, one pin for left direction, and one common PWM pin. All 5V. Additionally there is a Current-Sense pin but I did not use them.

On the other hand, I have the encoders, they consist of IR leds and sensors, and a very simple PCB that rectifies the signals to be a sharp 5V quadrature signal. So yes, quadrature. Reference mark is yet to come.

In the past, I did not find any boards that are good in decoding quadrature inputs and that are still cheap and not part of a massive system, so I was trying to read the quadrature signals with the Arduinos directly. The Interrupts were too slow, so I used the Arduino MKR Vidor 4000 which has an FPGA as well as an MCU, and used the FPGA to decode the quadrature signals, and to do the PID loop at a very high frequency.

That being said, yes, if there was a LinuxCNC compatible board that takes in 5V quadrature signals and puts out PWM and direction signals for the BTS7960, I would spend money on it. It would still allow me to experiment with my own encoders and the concept of reference marks, and so on... Open to board suggestions, thank you :)

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

Time to create page: 0.093 seconds
Powered by Kunena Forum