Many questions, 3D printer as 3D scanner
-
On my printer I have interchangeable heads, I have 6 heads / blocks (don't know how to call them). Depending on the object I want to print, I attach the appropriate head, change config settings accordingly, and print.
I want to make a head for 3D scanning, with 2 sensors, one ultrasonic distance sensor, and another digitising touch probe similar to the ones for CNCs
I will use the ultrasonic distance sensor (I can make one with ~1 mm precision) to scan every 10 mm, to get a general idea where the object is. Then with a touch probe, to move the head fast until it's close to the object (using information from previous scan), and move slow to touch the object.
I want to create a program in python or C, to send G code commands to the printer (Duet Wifi)
Finally, my questions:
How to send G code commands to the Duet Wifi from my application ?When using the ultrasonic distance sensor, I need to pass the measured depth distance from the sensor to the Duet, and in turn to my program. Let's say I use an Arduino, how can I send data to the duet, and have the duet report it to the application on the computer?
The touch sensor will act like an endstop, but the problem is that when you home the printer it does not report how much it traveled until the endstop triggered. How can I get that value? this is a lot like the BLTouch probe, but I need to get the value in my program
Edit:
One more question, related to multiple heads or tools, is it possible to assign each head an ID, and have the duet load the config file for that ID. For example, as I said, I have 6 heads, can I have config01.g , config02.g , config03.g, etc, and when I plug in head with ID 2, to automatically read config02.g ? this will imply that each head will have a microcontroller to send the "ID"Edit 2:
I enabled Telnet, connected to it from my computer, and I tried to send a G command, and I got response "Bad command"
Connected to 192.168.0.xx.
Escape character is '^]'.
G1 X100 Y100 F10000
Bad command: G1 X100 Y100 F10000
okSo what's the point of Telnet then? how to send g code through telnet?
-
I figured out the telnet, my mistake is that I should have homed the printer first
So I connected to telnet, sent G28, it homed, then I was able to send the G1 command and it worked! yeey!! -
You may find that the M575 command does a lot of what you want.
If you are not using a PanelDue then one option would be to connect your Arduino+ultrasonic sensor to the PanelDue port (caution: it uses 3.3V signal levels, not 5V). You could then use the M118 command to send the Arduino a message, and it could response with a sequence of GCode commands to move the tool an appropriate amount.