Greeting all!
I start my self project recently, it is a CNC XY plotter which runs on grbl firmware.
My goal is to attach a air vacuum and a suction cup on a Uno board, so when the CNC finished writing,
it can send a signal to Uno board, then the Uno board control the air vacuum to suck up the paper and take it away.
So I want to ask is there a way for an Uno to read the serial port between my PC and grbl board? So when Uno catches a specific line (say "G90G0 X0Y0"), the Uno starts the vacuum.
Check the GRBL docs, there are things like M7 / M8 / M9 to change e.g. coolant pin, so you don't need a second uno.
Thanks for your quick reply!
I see the option in the config.h now.
But I still have some question:
Now I gain the control of pin 4 by M7, how can I read the specific line from serial port?
I tried to use Serial.readString(), but it seems it is conflicted with grbl.h.
Why do you want to read from serial? You just send "M7" from gcode sender and it'll do magic.
If you are definitly 100% sure you need to read from serial, then think again. If heavy thinking still leans itself to reading from serial, then you'll need to dig into the sources of grbl.
Sorry, I am new to grbl.
But I think I got what you mean now.
Thanks again!
Depending what you are using for the sending software some can also use pseudo macros so at the machine end you can do a specific task like the paper feed you describe.
As with all answers the devil is in the detail that you provide to us so the more you give us the better the answer teacher ;D
Thanks for the reply, I will try to explain as detailed as possible.
So my board which runs the grbl v0.9 is this one:
https://imgur.com/jd4dN7F
It's an integrated board, not a UNO with CNC Shield extension, and unfortunately, it has only A5 pin on it, instead of A4. So the M7 G-Code command suggested by zwieblum won't work 
My problem is, I want the integrated board send a signal when it finished plotting. So if there are A4 pin on it, I think I can add M7 command in my last line of G-Code, so the A4 pin will be HIGH when it finished plotting.
Then with my air vacuum connects with A4, I can control my air vacuum start to suck the paper when the CNC finished the plotting.
My original idea is to use an Uno board to read the serial port between my PC and the integrated board, but I don't know how to do that.
I hope all these make sense, since English is my 2nd language.
That is a total oddball !
op's board

I have not seen that one before but I dont think I would want to as I would have to re-learn the pin configs.
People have used a second Arduino to talk to and from the CNC board using pins 0/1 but IIRC it means some changes are needed to GRBL.
IMHO anything BUT that board would be preferable.
Where did you get it from maybe they have some extra info we could decipher ? (link)
(EDIT)
It seems they were only available via Ali Express (who I use a lot) but is no longer available from anyone on there and I can understand why !
You have at least unused "Servo", "Z axis", so you can use ordinary GCODE. You'll just need to take a look at the wiring and grbl code.
Yeah, I agree.
I can't find any information about that board beside that picture 
And that board seems be only work on grbl v0.9. I tried to upload v1.1 to it, and the plotter became so weird.
Maybe I should change a board. 
A standard UNO + CNC shield V3 will get you onto common ground with others and get you better support all around.
Prices from Ali for that package are exceptional and it gives you an all important third axis and all the pins are broken out properly.
teacher1065:
Maybe I should change a board. 
You should get a multimeter, the atmega datasheet, a piece of paper and then measure which pin on the atmega goes to which pin on the headers. Then you can configure grbl 1.1 and compile a working version. And do not forget to use decent defaults for grbl config - and check that configs before you move on.