<p>I have no experience with either GRBL or DLP printers, but the</p>

<pre><code>M7
M8
M9
</code></pre>

<p>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 <code>cpu_map.h</code> file, with the standard being Analog Pins 3 and 4 for the M8 and M7 commands respectively.</p>

<pre><code>// Define flood and mist coolant enable output pins. 
#define COOLANT_FLOOD_DDR   DDRC 
#define COOLANT_FLOOD_PORT  PORTC 
#define COOLANT_FLOOD_BIT   3  // Uno Analog Pin 3 
#define COOLANT_MIST_DDR   DDRC 
#define COOLANT_MIST_PORT  PORTC 
#define COOLANT_MIST_BIT   4  // Uno Analog Pin 4 
</code></pre>

<p>Hope this helps!
Source: <a href="https://github.com/gnea/grbl" rel="nofollow noreferrer">https://github.com/gnea/grbl</a></p>

CC BY-SA 4.0
2018-10-12T11:56:14.950Z
2018-10-15T06:27:34.220Z
2018-10-15T06:27:34.220Z
towe
<p>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.</p>

<p>More info here: <a href="http://www.buildyourownsla.com/forum/viewtopic.php?t=3772" rel="nofollow noreferrer">http://www.buildyourownsla.com/forum/viewtopic.php?t=3772</a></p>

<p>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.</p>

CC BY-SA 3.0
2017-11-24T07:25:40.073Z
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.
Tom van der Zanden
CC BY-SA 3.0
2017-11-24T09:37:44.220Z
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).
BackSlash
CC BY-SA 3.0
2017-11-25T09:16:32.277Z
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.
Seen Green
CC BY-SA 3.0
2017-11-25T09:18:08.870Z
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"
Seen Green
CC BY-SA 3.0
2017-11-25T09:20:12.217Z
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."
Seen Green
CC BY-SA 3.0
2017-11-24T05:01:43.873Z
2017-11-27T12:10:09.133Z
2017-11-27T12:10:09.133Z
Seen Green
<p>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.</p>

CC BY-SA 3.0
2017-11-21T15:10:31.970Z
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.
Greenonline
CC BY-SA 3.0
2017-11-18T20:31:49.053Z
2017-11-21T15:11:46.503Z
2017-11-21T15:11:46.503Z
Franco Cicero
<p>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.</p>

<p>I'm planning to use them with NanoDLP on Raspberry + GRBL on Arduino.</p>

<p>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?</p>

<p>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.</p>

<p>Is there a way to do it?</p>

CC BY-SA 3.0
2017-09-29T17:01:30.983Z
why not you use commands on and off, for example: extruder, heatbed, fan etc.
Fernando Baltazar
CC BY-SA 3.0
2017-09-29T17:05:39.440Z
@FernandoBaltazar AFAIK GRBL is a CNC host software, it doesn't have extruder, nor heatbed, nor fan I suppose.
BackSlash
CC BY-SA 3.0
2017-09-29T17:07:54.007Z
So, this have an spindle control, Cooler, and so on.
Fernando Baltazar
<diy-3d-printer><dlp>
Managing LEDs with NanoDLP
BackSlash
# Managing LEDs with NanoDLP

(Asked by: username_0 on 2017-09-22)

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?

**Tags:** diy-3d-printer, dlp
> **Comments:**
> **username_1**: why not you use commands on and off, for example: extruder, heatbed, fan etc.  
> **username_0**: @FernandoBaltazar AFAIK GRBL is a CNC host software, it doesn't have extruder, nor heatbed, nor fan I suppose.  
> **username_1**: So, this have an spindle control, Cooler, and so on.  

---

## 3 answers

### Answer by username_2 on 2018-10-12. Score: 3

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

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_DDR   DDRC 
#define COOLANT_FLOOD_PORT  PORTC 
#define COOLANT_FLOOD_BIT   3  // Uno Analog Pin 3 
#define COOLANT_MIST_DDR   DDRC 
#define COOLANT_MIST_PORT  PORTC 
#define COOLANT_MIST_BIT   4  // Uno Analog Pin 4 

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


---

### Answer by username_3 on 2017-11-24. Score: -1

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.

> **Comments:**
> **username_4**: 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.  
> **username_0**: 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).  
> **username_3**: 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.  
> **username_3**: 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"  
> **username_3**: 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."  

---

### Answer by username_5 on 2017-11-18. Score: -3

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.

> **Comments:**
> **username_6**: 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.  

---

