I want to be able to extract data while doing shadow runs on the MR-1. I want to be able to extract things like the voltage in/out, stepper motor signals, any internal diagnostics or sensor data exposed by the controller.
I can see that the position values are being recorded on CutControl, but how can I gather that data in real-time without using an OCR?
You can’t do this with CutControl. You might be able to do it with GRBL, I’m unsure of what telemetry it publishes. You can do this easily with LinuxCNC and probably other control systems (limited by what the controller publishes). For the stock hardware the spindle controller can expose some telemetry signals like spindle position and I think you can get an analog output of load (% of power vs max power). The stock stepper controls don’t expose any telemetry.
The ideal thing is to get controllers with modbus output. My VFD does this and I interface it using a USB-RS485 input to my LinuxCNC controller. You can see the modbus signals that I read at this bottom of this configuration file:
It looks like I missed uploading the ini file that controls the modbus, but I’ll fix that next time I have the machine online.
I will say that I haven’t run across stepper drivers with modbus support. I am using Clearpath servos and they have telemetry over USB, but I haven’t tried wiring this in realtime to LinuxCNC. I’ve used it in a diagonostic way (hooked up to a separate laptop) when tuning the system. There are a lot of videos about Clearpath servos on youtube. Warning, they aren’t cheap – I got lucky with a seller of lightly used ones on eBay that were the right size and shaft diameter for the MR-1.
Actually, it strikes me that you could do a fun project here without having to swap out the controller. Get a USB-RS485 adapter (I use one made by Waveshare) and wire that up to the modbus output on the drive. Then you could write a python script to use that to monitor the modbus output from the drive while CutControl is running, and you’d be able to see all of the parameters. There should be modbus libraries already available for Python, and the supported outputs are found in the documentation on page 116. Here are a few interesting ones:
0x0000: Motor speed, unit “r/min”;
0x0009: Motor torque, unit “%” (percentage of rated torque);
0x000A: peak torque, unit “%” (peak torque within 1s); <10>
0x000E: Speed command, unit “r/min”;
0x0012: Input terminal DI status, [Note 1];
0x0013: Output terminal DO status, [Note 2];
0x0018: Average load rate, unit “%”;
0x0019: Output voltage, unit “%”; <25>
If you get this working and later do switch to LinuxCNC you’ll find the same hardware useful, so there is no wasted money here.