I have built my mpcnc for a while now and soon I only have the table to do
And how to control the frequency inverter for the cnc spindle. I have been thinking about this a lot and chat with the support on bigtreetech (I have an SKR 2 REV B), I asked if I can send Modbus commands from the SKR 2 to the inverter through rs485 and he said it should be possible and that I can use the TX and RX pins for the WiFi module
But now the problemā¦ how can I make the marlin code send Modbus commands???
Couldnāt tell you if itās a good idea or not, but after avoiding work by scanning the Marlin codebase a bit, my suggestion would be to add a Modbus feature class (Marlin/src/feature/modbus.h/.cpp) to handle the Modbus communications (you could look at the I2C feature in the twibus feature as a start), then you just need to figure out how to get the spindle_laser feature to use your new Modbus feature instead of either PWM or on/off on a given pin. Simple, reallyā¦
thank you i will se if i can manage to do this or the other method Robert Bunney write about? if you know how modbus works can you please tell me for example how the command to start spindle would look like? (0x2000(8192)1:0 b10?) i referred to the picture i uploaded (start command)
thanks! i will dive deeper in this and K Cummins suggestion to and se how i can do, im not very skilled at this so need to try and fail until i succeed
Hoo-boy! OK, youāre talking about implementing a protocol you donāt really know. Thatās going to be a tall order. Letās take a step back. Does your spindle frequency inverter (BTW, Iām just parroting your terms back, I honestly donāt know what a frequency inverter actually is) only talk Modbus, or is there another way you can control it? Does it take a PWM signal? We understand PWM signals.
Took a quick dip into modbus, and you almost need a separate microcontroller just to handle the modbus communications. Thereās a lot going on in there, more than you probably want your CNC controller handling. I mean, itās probably doable, and if youāve got a decent processor, it could probably handle it, but it wouldnāt be simple. I see that thereās an Marlin feature request thatās just to access the UART or SPI for someone who wants to talk to temperature sensors via modbus, and theyāre talking about using a separate microcontroller to handle the modbus.
edit: Gah! Now you have me reading the modbus protocol docs! No! I have to do my real work! Aaaiieee!!!
Maybe it is like you says K Cummins, I may be taking water over my head here.
It would be much simpler to use pwm, but the inverter does not have that function sadly but it will work with an pwm to 0-10v or 0-5v converter. Just thought it would be nice to have free ports.
The frequency inverter is the āsmartā product that the cnc spindle are connected to that controls speed, forward/back and more things (maybe I did not get this word correct? )
A separate microcontroller No no thatās to much, the processor on the skr 2 is 168MHz but I donāt know ANYTHING about this so I will use the converter instead and you should go back to work
It sounds like thatās an industrial-level spindle thatās designed to be connected to a beefy controller (something like Mach3 or LinuxCNC) thatās either designed to handle Modbus, or has a dedicated Modbus controller to handle the communications with all of the Modbus devices.