Controlling a Duet 3 with python and SBC?
-
Hi, I'm a little new to this field but need a 3D plotter for research purposes.
Background: I have a Workbee Z1+ CNC with a Duet 2 ethernet board. I need to be able to send specific coordinates (in the form of Gcode obviously) to my CNC and be able to get a live readout of its current position through all a python script. The script will also be outputting commands to other devices and sensors.Currently, we are advised not to connect a USB while the CNC is powered so this does not seem like a viable option. It comes with a Web controller connected through the ethernet but the web controller does not give me the flexible control I need. I have heard that we could connect an SBC (Raspberry Pi) which would be easier to do on a Duet 3.
My question is: If an SBC was connected would this allow me to send individual Gcode commands and read live positions, and if so how?
If not, would anyone have any advice on potential solutions?
Any support or suggestions would be greatly appreciated -
@bmeun96 said in Controlling a Duet 3 with python and SBC?:
Currently, we are advised not to connect a USB while the CNC is powered so this does not seem like a viable option.
Is that a recommendation from workbee?
-
@phaedrux said in Controlling a Duet 3 with python and SBC?:
Is that a recommendation from workbee?
Looks familiar. It's a warning Duet3D writes into support documents (e.g. for flashing firmware via USB) due to possible ground loops.
-
Yes but that's not a blanket warning to never do it. With precautions for ground loops you can use USB terminal for logging.
https://duet3d.dozuki.com/Wiki/Logging
I'm curious if there is something specific to the machine that would make that unwise.
-
You can telnet to the duet and basically do what you want. Before the firmware had variables I made a bunch of. Net apps for various tasks.
-
@phaedrux I've only seen it in the Workbee CNC setup guide so couldn't comment on that.
-
@rzi Would you have any useful links on how you did this? I've found some Telnet python library that looks promising but otherwise I wouldn't know where to start.
-
@bmeun96 When you telnet to the controllet you get the same functionality as you do with the console in DWC. Connect to the duet with telnet and send some basic gcode to get it up and running. M114 return the current position for example. You have to dive into the wiki.
-
@bmeun96 I thought you could do this a lot more easily with the API? However, I haven’t gotten that far yet myself so I would love to hear from someone who has. Cheers.
-
@theolodian If you want an example to reference have a look at my repo for the MQTT4DSF project. It's depreciated now, but its written in python and uses the API for talking to DSF, and should still be functionally relevant.
The API allows you to "subscribe" to the keys in the object model you want to monitor and will push updates when the values change. It can also handle executing gcode commands.