3
$\begingroup$

I'd like to buy a 3D printer and use it as a "platform" for an external optical sensor. The idea is to mount an optical sensor on the Z-axis and to put a workpiece on the X-Y table. Now, I'd like to move the sensor across the workpiece and trigger the measurement of the optical sensor. Hence, the 3D printer is not actually printing, but only used as a motion and trigger device for the optical sensors.

I have never used a 3D printer, but I'm afraid that I'll run into several problems:

  1. The standard G-code of "wait one second" is G04 X1 on many CNC machines. Does this code exist on 3D printers as well?
  2. Is it possible to extract a trigger signal (e.g. 5 V) from the 3D printer? Are printers available which provide a G-code for an external trigger? Could anybody suggest a model? I'm happy to pay some extra dollars if I don't have to solder by myself. Of course, a second option would be to use the voltage, which is used to heat the filament.
$\endgroup$

2 Answers 2

3
$\begingroup$

G4 is the "Dwell" command in Marlin, so you could specify a wait duration using it. Note that the time parameter is designated using S for seconds and/or P for milliseconds:

G4 S1    ; Wait for 1 second

I think you could use the M43 T code to set a pin high/low and act as a trigger signal. This would be coded for and not something that is done as a result of something detected, however:

M43 T S3 R1 W1000    ; Toggle pin 3 once and then wait for a second
$\endgroup$
3
$\begingroup$

The standard G code of "wait one second" is G04 X1 on many CNC machines. Does this code exists on 3D printers as well?

Yes. The exact set of commands supported by a given printer will depend on the firmware, so you should check the documentation for the particular printer you're looking at. But the G04 "Dwell" command is a common one. A list of all the G-code commands for the Marlin firmware, which is widely used, can be found at https://marlinfw.org/meta/gcode/.

Is it possible to extract a trigger signal (e.g. 5V) from the 3D printer? Are printers available which provide a G code for an external trigger?

Marlin supports an M240 command that means "trigger camera," which could probably be used to trigger other sorts of devices too. See: https://marlinfw.org/docs/gcode/M240.html You might also want to look into using OctoPrint to control your printer; there's a plugin (OctoLapse) for making time-lapse photos that might prove useful.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .