# M8 output in GRBL

**URL:** <https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497>\
**Category:** LightBurn Hardware Compatibility\
**Tags:** grbl, gcode\
**Created:** [February 7, 2024, 12:20am UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497 "2024-02-07T00:20:52Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 12:20am UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/1 "2024-02-07T00:20:52Z")

</div>

Running a generic GRBL card, and I want to use the M8 command with a relay for my air pump. None of the outputs on the card are marked M8. I have done some online research and see that there is theoretically a way to map the outputs in GRBL. But the docs I have found have a higher expectation of ability than I currently posses.

Anyone suggest a source for more complete GRBL explainations?

Thanks

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 2:39am UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/2 "2024-02-07T02:39:46Z")

</div>

If your controller is Arduino based then this might be useful:  
[M8 command - which pin, what signal? · Issue #882 · gnea/grbl · GitHub](https://github.com/gnea/grbl/issues/882)

Looks like a digital signal on analog pin 4.

---

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 4:05pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/3 "2024-02-07T16:05:22Z")

</div>

_Thanks_,

that refers to one of the docs that I have found, but don’t understand what to do with the information that they provide.

I am use to programming in a gui environment like ladder logic, and do not understand the intricacies of what those instructions mean.

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 6:07pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/4 "2024-02-07T18:07:54Z")

</div>

If that’s the case then this might be impractical for you to tackle as it involves some understanding of electronics. May be easier to swap a controller with air assist pins exposed.

 ![image](https://forum.lightburnsoftware.com/uploads/default/original/3X/7/8/785ee0ba6d69322408901cc694635135206b4c6e.png)

Essentially the information in the previous link explains what pin from the arduino is used to send the signal. In this case analog pin 4. In spite of the name this will be digital output signal, so 5V represents on, 0V represents off. You could not directly turn on a pump or solenoid with this so you’d have to bring in other components to make this work.

If your controller does not expose all the arduino pins you may be able to tap directly into the atmega chip pin that’s tied to analog pin 4 which I don’t know off hand.

---

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 6:44pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/5 "2024-02-07T18:44:53Z")

</div>

Programming is my problem, the wiki assumes everyone has the knowledge of what to do with these type instructions, I don’t understand how this is done, one line at a time, all lines together? How is it compiled, debugged, saved?

I understand that I would have to put a relay on the output, I’ve worked in robotics for 25 years, but the lightburn air feature uses M7 or M8, and I don’t see that here.

/\* The cpu\_map.h files serve as a central pin mapping selection file for different  
processor types or alternative pin layouts. This version of Grbl officially supports  
only the Arduino Mega328p. \*/

#ifndef cpu\_map\_h  
#define cpu\_map\_h

#ifdef CPU\_MAP\_ATMEGA328P // (Arduino Uno) Officially supported by Grbl.

// Define serial port pins and interrupt vectors.  
#define SERIAL\_RX USART\_RX\_vect  
#define SERIAL\_UDRE USART\_UDRE\_vect

// Define step pulse output pins. NOTE: All step bit pins must be on the same port.  
#define STEP\_DDR DDRD  
#define STEP\_PORT PORTD  
#define X\_STEP\_BIT 2 // Uno Digital Pin 2  
#define Y\_STEP\_BIT 3 // Uno Digital Pin 3  
#define Z\_STEP\_BIT 4 // Uno Digital Pin 4  
#define STEP\_MASK ((1\<\<X\_STEP\_BIT)|(1\<\<Y\_STEP\_BIT)|(1\<\<Z\_STEP\_BIT)) // All step bits

---

<div class="post-metadata">

**Author:** ![Dskall](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/d/b5e925/32.png) [@Dskall](https://forum.lightburnsoftware.com/u/Dskall)\
**Post date:** [February 7, 2024, 6:51pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/6 "2024-02-07T18:51:54Z")

</div>

Pin A3 is used for air assist.

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 7:05pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/7 "2024-02-07T19:05:21Z")

</div>

> [@Dskall](#):
>
> Pin A3 is used for air assist.

This may be right. I didn’t look at it too closely so I’d suggest double checking.

> [@Wrenchforhire](#):
>
> Programming is my problem, the wiki assumes everyone has the knowledge of what to do with these type instructions, I don’t understand how this is done, one line at a time, all lines together? How is it compiled, debugged, saved?

There’s no programming required. GRBL will already have this compiled in by default. So if you give the M8 command the pin will behave accordingly.

---

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 7:07pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/8 "2024-02-07T19:07:24Z")

</div>

![image](https://forum.lightburnsoftware.com/uploads/default/original/3X/3/6/36c856277bc21097a0ca467934cb83541fd258b1.jpeg)

I know I sound obtuse, but how do I find A3?

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 7:27pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/9 "2024-02-07T19:27:00Z")

</div>

I originally thought that you had determined that your board was not exposing the air assist pin but I understand now that you’re saying that nothing on the board indicates M8 specifically.

It’s entirely possible that the board doesn’t expose the pin. If anywhere it would be near the yellow headers marked with RST, PRB, RUN, HOLD.

Else if you were inclined you could tap directly onto the atmega.

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 7:28pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/10 "2024-02-07T19:28:11Z")

</div>

I can’t quite make out the markings here. What do they say?  
 ![image](https://forum.lightburnsoftware.com/uploads/default/original/3X/b/9/b999bfb44e9fcbf0dd4c09f8a2de65e14ae1a4da.png)

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 7:48pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/11 "2024-02-07T19:48:16Z")

</div>

I’ve thought of an alternative solution.

If you did not need one of the existing pins, you could customize GRBL to reuse that pin for air assist. That would be far better than tapping onto the MCU pins.

---

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 8:07pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/12 "2024-02-07T20:07:24Z")

</div>

That was the road that I was going down, only I don’t understand the instructions that I have found on how to do that.

The pins you asked about are labeled for USB-CHK & UUSB

Thanks for sticking with me and all the questions.

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 8:34pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/13 "2024-02-07T20:34:36Z")

</div>

There’s 2 basic obstacles:

1. identifying the type of board that you have. If you look at the cpu\_map.h there are lines that start with “#ifdef”. These are pre-processor directives that dynamically change what code will be processed or not. Note that there are different pin mappings depending on hardware type. I’m not familiar which your particular board falls under. If we assume that it falls under the general first group with the line ` #if !defined(ENABLE_DUAL_AXIS)` then indeed we see coolant flood (M8) tied to analog pin 3.

```auto
  #define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3

```

1. The second aspect is reassigning the pins. So let’s say you wanted to switch with the Probe pin:

```auto
  #define PROBE_BIT 5 // Uno Analog Pin 5

```

Then you’d simply swap the 5 and 3 values.

Then compile and flash to the controller.

---

<div class="post-metadata">

**Author:** ![Wrenchforhire](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/wrenchforhire/32/23059_2.png) [@Wrenchforhire](https://forum.lightburnsoftware.com/u/Wrenchforhire)\
**Post date:** [February 7, 2024, 9:01pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/14 "2024-02-07T21:01:16Z")

</div>

Okay, we come back around to my original question.

What are the commands? When I type in **cpu\_map.h**

I get

 ![IMG_3500](https://forum.lightburnsoftware.com/uploads/default/original/3X/b/5/b5bf3cbd8c930578ecf2cae0af2201b039e870b5.jpeg)

---

<div class="post-metadata">

**Author:** ![berainlb](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@berainlb](https://forum.lightburnsoftware.com/u/berainlb)\
**Post date:** [February 7, 2024, 9:51pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/15 "2024-02-07T21:51:18Z")

</div>

I think there’s a significant gap here.

I suggest you read through this:  
[Compiling Grbl · gnea/grbl Wiki · GitHub](https://github.com/gnea/grbl/wiki/Compiling-Grbl)

---

<div class="post-metadata">

**Author:** ![Dskall](https://forum.lightburnsoftware.com/letter_avatar_proxy/v4/letter/d/b5e925/32.png) [@Dskall](https://forum.lightburnsoftware.com/u/Dskall)\
**Post date:** [February 7, 2024, 11:08pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/16 "2024-02-07T23:08:12Z")

</div>

This is 4 axis board. They may have just used up all available pins.

---

<div class="post-metadata">

**Author:** ![system](https://forum.lightburnsoftware.com/user_avatar/forum.lightburnsoftware.com/system/32/64335_2.png) [@system](https://forum.lightburnsoftware.com/u/system)\
**Post date:** [March 8, 2024, 11:08pm UTC](https://forum.lightburnsoftware.com/t/m8-output-in-grbl/128497/17 "2024-03-08T23:08:47Z")

</div>

Closed on March 8, 2024, 11:08pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
