<p>By connecting to the D9 output header (see RAMPS 1.4 shield schematic below) you only have 2 wires that represent a scheduled load and ground. You actually need to connect the positive (red) lead to the power supply 12&nbsp;V and the negative (black) lead to the ground. The third wire (usually a different color) needs to be connected to the actual D9 in your example; note that this one is connected to the MOSFET! And as such not readily available, it is far more easy to use an other free pin.</p>

<hr>

<p>Just use the PWM pin (attached to the MOSFET) of the print cooling fan (that schedules the MOSFET), you can then schedule the laser power with G-code <a href="https://reprap.org/wiki/G-code#M106:_Fan_On" rel="nofollow noreferrer">M106</a>, e.g. <code>M106 S127</code> to select half the power (<code>S255</code> would be max power). Alternatively, and probably a much better solution is that you can use any free (but exposed) pin of your microprocessor; you can set the value of that pin using G-code <a href="https://reprap.org/wiki/G-code#M42:_Switch_I.2FO_pin" rel="nofollow noreferrer">M42</a>.</p>

<blockquote>
  <p>M42 switches a general purpose I/O pin. Use M42 Px Sy to set pin x to value y, when omitting Px the LEDPIN will be used.</p>
</blockquote>

<p>The only electrical wiring you need to do is to attach a wire (solder or connect to a header) to bundle that with a power and ground wire and route that to the laser module.</p>

<p>Note that the PWM pins of the Mega are numbered D2 through D13. Also, D44, D45 and D46 are also PWM capable. Checking the RAMPS 1.4 (the board/shield of the Reprap Guru) pinout, you will see that D8, D9 and D10 are used for the MOSFETs (and as such not easily available and would require soldering). E.g. D2 and D3 are used by the X max/min endstops (note that most printers don't use an X-max, so pin D2 may be free on your machine). </p>

<p>For your purpose, any of the following pins can be used: D2, D4-7, D<strike>11</strike>12-13 and D44-46.</p>

<p>Best option would be the <strike>D11</strike> pin (on second thoughts, D4 might be a much better option as the <a href="https://reprap.org/forum/read.php?147,651203" rel="nofollow noreferrer">timer associated with PWM on pin D11 is internally used</a> in Marlin for generating interrupts); it has a pin you can connect to the SERVO header pin.</p>

<p>The image shows the location of the pins:</p>

<p><a href="https://i.sstatic.net/L83Ji.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L83Ji.png" alt="RAMPS pin layout"></a></p>

<p>An example to connect a laser module is seen in this image:
<a href="https://i.sstatic.net/iCuKU.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iCuKU.jpg" alt="Wiring laser module to RAMPS D4 pin on AUX2"></a></p>

CC BY-SA 4.0
2019-05-18T10:49:17.010Z
Great details and I can confirm the the board in your image matches what I have. Are you referring to D2, D4-7, D11-13 and D44-46? Also seems like the cooling fan was only connected to D9 (power), so I am not sure how it's PWM connection can be leveraged her
codeNinja
CC BY-SA 4.0
2019-05-18T12:23:33.120Z
There are plenty of other pins to use, just look them up in the schematics, you can edit the schematic yourself if you want to encircle them, but that is not necessary for answering the question. Do not use the +/- under D9, you could use the pin that is attached to the MOSFET, but don't bother, there are plenty more free pins to use! The answer explains what you can use. I would not solder if I were you, but you could, it would work! Best option would be the D11 pin; it has a pin you can connect to the SERVO header pin.
0scar
CC BY-SA 4.0
2019-05-18T13:04:47.473Z
Okay that helps. Clarifying my understanding. (1) connect the PWM wire from the laser to D11. (2) connect the power wires to 5A power supply in pins on the ramp 1.4 board.
codeNinja
CC BY-SA 4.0
2019-05-19T22:46:20.593Z
I was able to control the laser by sending the `M42 P11 S0` and `M42 P11 S255` codes. The laser does not turn on with any other `SXX` value. Saw this article (https://reprap.org/forum/read.php?147,651203) which says that D11 is being used by a timer. Changed to pin `D4` and am able to control any power level by sending `M42 P4 SXX`. Now testing if printing in grayscale actually works, the purpose behind the question.
codeNinja
CC BY-SA 4.0
2019-05-18T05:36:40.233Z
2019-10-02T13:41:32.213Z
2019-10-02T13:41:32.213Z
0scar
<p>I have a Reprap Guru Prusa i3 v2 3D printer. <a href="https://drive.google.com/file/d/0B4A3jLWIXeoFUVhJa25lcGl6Rzg/view" rel="nofollow noreferrer">Here</a> is a link to the 192&nbsp;MB manual. And <a href="https://reprapguru.com/pages/resources" rel="nofollow noreferrer">here</a> is the link to the resources page for the Reprap Guru. Page 58 of the manual discusses electronics.</p>

<p>I purchased a 5.5&nbsp;W laser from an online resource (AliExpress). It has its own controller module. It has one connector with 3 pins</p>

<ol>
<li>12&nbsp;V</li>
<li>Gnd</li>
<li>PWM</li>
</ol>

<p>I want to now connect the laser module in-place of the 3D printer nozzle. I have been able to install it physically, but not sure how to connect it to the Reprap Guru Prusa i3 board.</p>

<p>I am not an electrical engineer, but I am capable of connecting wires with clear instructions. Any pointers on how to connect this module to the 3D printer board is appreciated.</p>

<p>Updates:</p>

<ol>
<li>The board of my 3D printer is an Arduino Mega 2560 board.</li>
<li>I have been able to power the laser on using the fan connections and it can burn stuff (so it works). I have connected to the D9 pins</li>
<li>Now need to figure out where to connect the PWM from the laser module to the Arduino Mega 2560 board</li>
</ol>

CC BY-SA 4.0
2019-05-18T00:53:39.573Z
Ensure that you have correct safety glasses for the frequency of your laser diode. There are many versions of laser safety glasses, but you must match your laser to the glasses, when using such a high power diode laser. Ensure also that anyone within view of the machine has these glasses as well. Reflections from a five watt laser will destroy tissue without the awareness of the victim. You may already be aware of this consideration.
fred_dot_u
CC BY-SA 4.0
2019-05-18T03:32:37.847Z
Yes glasses are covered. Have gotten the setup work without PWM. Need that to achieve grayscale
codeNinja
CC BY-SA 4.0
2019-05-18T13:23:28.407Z
The ideal would be to change out all the plexiglass in the enclose with the equivalent of the safety glasses for the frequency of you laser.  Otherwise, you need to restrict access during laser operation.
Perry Webb
<prusa-i3><g-code><ramps-1.4><wiring><laser>
Add a laser module to Reprap Guru Prusa i3
codeNinja
# Add a laser module to Reprap Guru Prusa i3

(Asked by: username_0 on 2019-05-17)

I have a Reprap Guru Prusa i3 v2 3D printer. [Here](https://drive.google.com/file/d/0B4A3jLWIXeoFUVhJa25lcGl6Rzg/view) is a link to the 192 MB manual. And [here](https://reprapguru.com/pages/resources) is the link to the resources page for the Reprap Guru. Page 58 of the manual discusses electronics.

I purchased a 5.5 W laser from an online resource (AliExpress). It has its own controller module. It has one connector with 3 pins

1. 12 V
2. Gnd
3. PWM

I want to now connect the laser module in-place of the 3D printer nozzle. I have been able to install it physically, but not sure how to connect it to the Reprap Guru Prusa i3 board.

I am not an electrical engineer, but I am capable of connecting wires with clear instructions. Any pointers on how to connect this module to the 3D printer board is appreciated.

Updates:

1. The board of my 3D printer is an Arduino Mega 2560 board.
2. I have been able to power the laser on using the fan connections and it can burn stuff (so it works). I have connected to the D9 pins
3. Now need to figure out where to connect the PWM from the laser module to the Arduino Mega 2560 board

**Tags:** prusa-i3, g-code, ramps-1.4, wiring, laser
> **Comments:**
> **username_1**: Ensure that you have correct safety glasses for the frequency of your laser diode. There are many versions of laser safety glasses, but you must match your laser to the glasses, when using such a high power diode laser. Ensure also that anyone within view of the machine has these glasses as well. Reflections from a five watt laser will destroy tissue without the awareness of the victim. You may already be aware of this consideration.  
> **username_0**: Yes glasses are covered. Have gotten the setup work without PWM. Need that to achieve grayscale  
> **username_2**: The ideal would be to change out all the plexiglass in the enclose with the equivalent of the safety glasses for the frequency of you laser.  Otherwise, you need to restrict access during laser operation.  

---

## 1 answers

### Answer by username_3 on 2019-05-18. Score: 7 | Accepted answer

By connecting to the D9 output header (see RAMPS 1.4 shield schematic below) you only have 2 wires that represent a scheduled load and ground. You actually need to connect the positive (red) lead to the power supply 12 V and the negative (black) lead to the ground. The third wire (usually a different color) needs to be connected to the actual D9 in your example; note that this one is connected to the MOSFET! And as such not readily available, it is far more easy to use an other free pin.

---

Just use the PWM pin (attached to the MOSFET) of the print cooling fan (that schedules the MOSFET), you can then schedule the laser power with G-code [M106](https://reprap.org/wiki/G-code#M106:_Fan_On), e.g. `M106 S127` to select half the power (`S255` would be max power). Alternatively, and probably a much better solution is that you can use any free (but exposed) pin of your microprocessor; you can set the value of that pin using G-code [M42](https://reprap.org/wiki/G-code#M42:_Switch_I.2FO_pin).

> M42 switches a general purpose I/O pin. Use M42 Px Sy to set pin x to value y, when omitting Px the LEDPIN will be used.

The only electrical wiring you need to do is to attach a wire (solder or connect to a header) to bundle that with a power and ground wire and route that to the laser module.

Note that the PWM pins of the Mega are numbered D2 through D13. Also, D44, D45 and D46 are also PWM capable. Checking the RAMPS 1.4 (the board/shield of the Reprap Guru) pinout, you will see that D8, D9 and D10 are used for the MOSFETs (and as such not easily available and would require soldering). E.g. D2 and D3 are used by the X max/min endstops (note that most printers don't use an X-max, so pin D2 may be free on your machine).

For your purpose, any of the following pins can be used: D2, D4-7, D1112-13 and D44-46.

Best option would be the D11 pin (on second thoughts, D4 might be a much better option as the [timer associated with PWM on pin D11 is internally used](https://reprap.org/forum/read.php?147,651203) in Marlin for generating interrupts); it has a pin you can connect to the SERVO header pin.

The image shows the location of the pins:

[![RAMPS pin layout](https://i.sstatic.net/L83Ji.png)](https://i.sstatic.net/L83Ji.png)

An example to connect a laser module is seen in this image:
[![Wiring laser module to RAMPS D4 pin on AUX2](https://i.sstatic.net/iCuKU.jpg)](https://i.sstatic.net/iCuKU.jpg)

> **Comments:**
> **username_0**: Great details and I can confirm the the board in your image matches what I have. Are you referring to D2, D4-7, D11-13 and D44-46? Also seems like the cooling fan was only connected to D9 (power), so I am not sure how it's PWM connection can be leveraged her  
> **username_3**: There are plenty of other pins to use, just look them up in the schematics, you can edit the schematic yourself if you want to encircle them, but that is not necessary for answering the question. Do not use the +/- under D9, you could use the pin that is attached to the MOSFET, but don't bother, there are plenty more free pins to use! The answer explains what you can use. I would not solder if I were you, but you could, it would work! Best option would be the D11 pin; it has a pin you can connect to the SERVO header pin.  
> **username_0**: Okay that helps. Clarifying my understanding. (1) connect the PWM wire from the laser to D11. (2) connect the power wires to 5A power supply in pins on the ramp 1.4 board.  
> **username_0**: I was able to control the laser by sending the `M42 P11 S0` and `M42 P11 S255` codes. The laser does not turn on with any other `SXX` value. Saw this article (https://reprap.org/forum/read.php?147,651203) which says that D11 is being used by a timer. Changed to pin `D4` and am able to control any power level by sending `M42 P4 SXX`. Now testing if printing in grayscale actually works, the purpose behind the question.  

---

