Read GCode File From SD Card and Send to GRBL

I have a CNC sand table with an UNO running GRBL. It works great using Universal GCode Sender to stream GCode to it.

For demo purposes, I would like to have a separate Nano reading GCode files from an SD card and streaming them to the UNO. I can read a file from the SD card and send the contents to the serial monitor easily enough (there's an SD example that does exactly that), but I can't figure out how to send the GCode from the Nano to the UNO. I tried hooking up RX>TX and TX>RX and just running the dump example, but that didn't work.

I've read about different kinds of handshaking - and I think GRBL sends an OK message after each line - but I'm not sure how to get started. I think I need to read line by line from the file, send one line at a time, and wait for the response from GRBL before sending the next one, but I'm not sure. Could someone give me an idea of what I need to do to make this work? Thanks!

If you send from serial monitor to GRBL then also read and print back what GRBL sends to see. Perhaps the Nano should send each line then wait for the ok to send the next.

Details count. When you show what the GRBL sent, show unprintable chars as hex values.

The 2 boards should have their grounds connected together.

This may be of interest.

justone: The 2 boards should have their grounds connected together.

Thanks for that - I did not have the grounds connected. Still didn't get it working yet, but that definitely needed to be done, so thanks again!

groundFungus: This may be of interest.

Thanks! That looks like it will be helpful.

groundFungus thanks again! Those links eventually led me to this: Looks like just what I need!

Para poder usar nuestra cnc sin necesidad de un ordenador también existe la posibilidad de usar este programa para un segundo arduino el cual se conecta a GRBL mediante comunicación serial. En este arduino tendremos una pantalla lcd, un lector de tarjetas SD (en el cual tendremos nuestros archivos de corte) y un mando a distancia infrarrojos el cual controlara el movimiento de la maquina manualmente y podremos seleccionar desde la pantalla el archivo que elijamos así como colocar la maquina en el punto 0,0,0 hacer homing, en incluso ver la posición en la que se encuentra nuestra maquina por medio de coordenadas x,y,z. Este programa a sido creado completamente por mi y probado. Próximamente incluiré vídeos del funcionamiento.