Welcome! Log In Create A New Profile

Advanced

Sending G-code to 3d printer

Posted by hyabc12321 
Sending G-code to 3d printer
September 30, 2015 05:54AM
Hello,

I'm trying to write a program to control my printer.
It seems that simplily sending g code string via serial port will not work.
Is there any solution for this problem?

THX
Re: Sending G-code to 3d printer
September 30, 2015 06:51AM
Should work.

Some firmwares require you to wait for the OK before the next line.

Some firmware (ie sailfish) do not talk gcode.

Some even require checksums per line... See http://reprap.org/wiki/G-code#.2A:_Checksum

Firsly you need to identfy your firmware.

Also take a look at this simple sender https://github.com/nrpatel/FaceCube/blob/master/RepRapArduinoSerialSender.py

Edited 2 time(s). Last edit at 09/30/2015 07:05AM by Dust.
Re: Sending G-code to 3d printer
September 30, 2015 07:11AM
Quote
Dust
Some firmwares require you to wait for the OK before the next line.

That's not a function of the firmware, it's a feature of electronics that uses a USB-to-serial converter without flow control, e.g. Arduino Mega + RAMPS. If you don't wait for the OK when using this type of electronics, you are likely to overflow the serial input buffer. Boards that have a native USB port don't have this problem, because flow control is built in to the USB protocol.

I am not aware of any 3D printer firmwares that require a checksum, although most firmwares will validate the checksum if it is included in the gcode command.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Sending G-code to 3d printer
September 30, 2015 10:10PM
Quote
hyabc12321
Hello,

I'm trying to write a program to control my printer.
It seems that simplily sending g code string via serial port will not work.
Is there any solution for this problem?

THX

This is just way too vague to get a useful answer.

What type of printer do you have? What type of firmware is installed on it? Or are you wanting to write the firmware yourself? What hardware interface are you using?

Have you had the printer working with other software? e.g. Repetier Host, Octoprint.
Re: Sending G-code to 3d printer
October 01, 2015 03:05AM
Quote
frankvdh

This is just way too vague to get a useful answer.

What type of printer do you have? What type of firmware is installed on it? Or are you wanting to write the firmware yourself? What hardware interface are you using?

Have you had the printer working with other software? e.g. Repetier Host, Octoprint.

I'm have prusa i3 with Marlin firmware installed on it.
Re: Sending G-code to 3d printer
October 01, 2015 04:50AM
OK... what hardware interface do you have? If you have a typical Arduino Mega2560, you'll have a micro-USB port. This will appear to the host computer as a serial port on the USB bus. When you plug it into the host computer (what OS are you running), it should be visible when you look at the installed hardware. Your program will need to open this serial port and write to it to send G-code to the printer.
Re: Sending G-code to 3d printer
October 04, 2015 04:35AM
Sorry for my bad explanation.

I'm writing a serial program that send gcode to my arduino board.

When I try to send command, but it doesn't do any thing. (

e.g. G28 to homing. My code will be:

serial.write("G28 ; \n");

Is there any handshake protocol that I miss?
Re: Sending G-code to 3d printer
October 04, 2015 04:47AM
make sure you set the baudrate correct.
Re: Sending G-code to 3d printer
February 03, 2017 10:41AM
Hello,

did you ever get that solved? I am trying to do the same thing but not getting any response from the printer.

I have a Tarantula i3 with Repetier firmware. Sending Gcode works though Repetier-host. I already checked the baud rate.

Best
Re: Sending G-code to 3d printer
February 04, 2017 09:37PM
You could use ---- Universal Gcode sender?

[github.com]

send individual commands
or
send a file of g-code

confused smiley
Re: Sending G-code to 3d printer
March 06, 2017 04:07PM
If you are coding, and want to "manually" send gcode to the printer, with automatic flow control, one easy way is to leverage off "printcore" from Printrun.

Printcore is what Prontorface and Pronsole etc using as a back end to send gcode to the printer...

Sending Gcode becomes as simple as:
printcore.send("G0 X170 Y250")

Or, if you are on Linux and wish to be able to send Gcode straight from the terminal, @250000 baud:
[3dprinting.stackexchange.com]
Sorry, only registered users may post in this forum.

Click here to login