Operating Arduino with Repetier Firmware from Python

Hi!

I'm looking for ways of operating stoppers via Arduino with Repetier Firmware avoiding Repetier-Host. I have Mega 2560 + Ramps1.4 + 4 drivers DRV8825 for 3D printers  "REPRAP" class and MT-1703HS120AW stepper.

So my goal is to find out how to:
1. send gcode directly from python to arduino
2. set min/max position using 2 click buttons

Could anyone help me do that?

Comments

  • I need only Z axis stepper motor operation, nothing more than that
  • There is no way around a host software. You can use repetier-server instead. It has a web api that you can use to send gcodes from any language you want and it automatically connects to the printer.

    Alternatively write your own host to communicate with the board. If you manage that it does not reset on connect you can simply send the command as string without checksum and line number to the serial stream. Not most secure way, but will work in 99%.
  • Repetier said:
    There is no way around a host software. You can use repetier-server instead. It has a web api that you can use to send gcodes from any language you want and it automatically connects to the printer.

    Alternatively write your own host to communicate with the board. If you manage that it does not reset on connect you can simply send the command as string without checksum and line number to the serial stream. Not most secure way, but will work in 99%.
    I'm just looking for any way to send commands from python to arduino with Repetier,  but I'm very new to programming.. So I have program in python that I want to send gcode from, PC with host and arduino board but I dont clearly understand how to post messages to arduino from python and info I find on web is far from what I could use
  • https://reprap.org/wiki/G-code
    is the basic for communication. See bottom. A stable connection with error detection and correction is not that simple. That is why I suggested to use repetier-server so all you need to learn is how to call a web api to achieve it.

    Python is not my language so can not say much about that. Have a look at pronterface if you want to know more about python and serial connection.
  • A quick Google search shows several ways to control a stepper through an arduino using Python that do not necessarily need a RAMPS board , if all you want to do is move it. I am sure with a little digging you could find a method that works for you.
  • Roko said:
    A quick Google search shows several ways to control a stepper through an arduino using Python that do not necessarily need a RAMPS board , if all you want to do is move it. I am sure with a little digging you could find a method that works for you.
    Congratulations sir, you've won the award for most useless reply I've received since starting to dig into this topic) Believe me I've googled a lot already and came here to find out if there is a way to simply send gcode to repetier firmware board to achieve what I want without actually wasting hours on deep understanding of grbl stuff (like I do from repetier gcode sender). 

    Now the question is should repetier firmware board react on just sending gcode to it from arduino IDE or Python or I need to send something else... 

    I'd prefer using gcode motor control because I got used to it already and all my scenarios saved from repetier as gcode files, so it's much easier to deal with gcode then just "spin left, spin right" commands
  • As said already, all you need is a serial connection. You do not need line numbers and checksums for firmware to work. Only thing you will miss is error correction, so once you get a communication error firmware will not detect it and execute what it thinks it got. So might be wrong coordinate or a different command.

    The normal checksum is easy to compute. xor all bytes left from * and write result as *value. That prevents at least firmware executing wrong line.

    If you also add line number Nxxx firmware will even request a resend of the correct line.

    That is the most basic operation the hosts do. Add numbers and checksums and correct errors. Also handle timeouts if returned "ok" did not come due to com error.
  • Repetier said:
    As said already, all you need is a serial connection. You do not need line numbers and checksums for firmware to work. Only thing you will miss is error correction, so once you get a communication error firmware will not detect it and execute what it thinks it got. So might be wrong coordinate or a different command.

    The normal checksum is easy to compute. xor all bytes left from * and write result as *value. That prevents at least firmware executing wrong line.

    If you also add line number Nxxx firmware will even request a resend of the correct line.

    That is the most basic operation the hosts do. Add numbers and checksums and correct errors. Also handle timeouts if returned "ok" did not come due to com error.
    I see, I must have set something wrong due to even commands from arduino IDE dont work... Or repetier(or marlin or else) firmware makes using simple non-gcode commands impossible? I mean those commands that dont require any extra firmware at all
  • Arduino serial normally has wrong baud rate. Works only with same baud rate as in firmware.
Sign In or Register to comment.