I'm building my own DLP printer with UV LEDs. I use a 20A relay to power them on, since they require high power and can't be directly driven by arduino or Raspberry.

I'm planning to use them with NanoDLP on Raspberry + GRBL on Arduino.

Is it possible to make NanoDLP tell GRBL to power on (send digital 1/+5V) the relay when the print starts and power it off (send digital 0/GND) when the print ends?

The other way would be to just install an on/off switch and do it manually, but I feel this step should be automated somehow.

Is there a way to do it?

  • $\begingroup$ why not you use commands on and off, for example: extruder, heatbed, fan etc. $\endgroup$ Sep 29, 2017 at 17:01
  • $\begingroup$ @FernandoBaltazar AFAIK GRBL is a CNC host software, it doesn't have extruder, nor heatbed, nor fan I suppose. $\endgroup$
    – BackSlash
    Sep 29, 2017 at 17:05
  • $\begingroup$ So, this have an spindle control, Cooler, and so on. $\endgroup$ Sep 29, 2017 at 17:07

3 Answers 3


I have no experience with either GRBL or DLP printers, but the


coolant control codes should be able to be sent by NanoDLP to GRBL. Those seem to allow for direct digital output. Apparently you can set the pin you want them to use in the cpu_map.h file, with the standard being Analog Pins 3 and 4 for the M8 and M7 commands respectively.

// Define flood and mist coolant enable output pins. 
#define COOLANT_FLOOD_BIT   3  // Uno Analog Pin 3 
#define COOLANT_MIST_BIT   4  // Uno Analog Pin 4 

Hope this helps! Source: https://github.com/gnea/grbl


Franco Cicero is completely correct there is an option to control your printer by using the GPIO of the Raspi. To do this you still need a stepper driver motor or some interface between the GPIO and the steppers/LED/etc.

More info here: http://www.buildyourownsla.com/forum/viewtopic.php?t=3772

You should really control the LEDs using a mosfet, or even a solid state relay and not just keep them on all the time. The lights should ideally switch on and off for each layer.

  • $\begingroup$ Well, the question is about controlling the LEDs and the answer you referenced is only about the Z-axis. I think that confused some people. $\endgroup$ Nov 24, 2017 at 7:25
  • $\begingroup$ It's downvoted because it doesn't answer the question. Question is about how to manage LEDs with GRBL, answer is on how to manage z-axis without an arduino. Your answer doesn't really answer the question too, I asked how to manage LEDs using a relay (SSR of course) with GRBL, you answered I should control LEDs with a relay (which is what I already wrote in the question). $\endgroup$
    – BackSlash
    Nov 24, 2017 at 9:37
  • $\begingroup$ I agree it didn't answer the question directly, but he and I am providing a differing idea as you did mention that you were using NanoDLP on a Raspi. Is there any particular reason why you are using GRBL? But what I am trying to tell you is you are probably best turning the LED on/off between layers rather than just at the start/end of the print job. $\endgroup$
    – Seen Green
    Nov 25, 2017 at 9:16
  • $\begingroup$ But if you want a direct answer, yes if you can send a G-code to turn on/off the relay then you can do this in the settings at the "Start of print GCODE", and the "END OF PRINT GCODE" $\endgroup$
    – Seen Green
    Nov 25, 2017 at 9:18
  • $\begingroup$ But what i was trying to get at is, and what i did say: "The lights should ideally switch on and off for each layer." $\endgroup$
    – Seen Green
    Nov 25, 2017 at 9:20

I think you don't have to use the Arduino. There´s an option in NanoDLP to control the z-axis through the Raspberry GPIO.

  • 2
    $\begingroup$ Could you expand upon your answer? For example, state the name of the option (and/or where it could be found), and an example... As it stands your answer (while it may be correct) is just a little terse and has been flagged as low quality. $\endgroup$
    – Greenonline
    Nov 21, 2017 at 15:10

You must log in to answer this question.

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