PySerial Example to send GCODE via TinyG

Home Forums TinyG TinyG Support PySerial Example to send GCODE via TinyG

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8182
    anilreddyy
    Member

    My CNC machine is controlled via TinyG. I’m looking for an example of Python PySerial code that loads (or sends) gcode programmatically, and writes into the COM serial port where TinyG is connected.

    My simple below Command line options of PySerial, ends up in infinite X movement, not sure if this needs any additional serial port configurations. Whereas gcode from chilipeppr works fine.

    > python -m serial.tools.miniterm -p COM8 -b 115200 –rtscts
    >> G00 X1

    Thanks.

    #8183
    cmcgrath5035
    Moderator

    I assume you mean X heads into the Xmax rail?
    Is $ex=2 (tinyG flow control = rtscts)?

    But even if it isn’t, not obvious why G00 X1 would over run anything.
    How about G00 X1.0 , perhaps tinyG does not like whatever end of line terminator that gets sent.

    User Dave Hylands has developed a bunch of Python scripts, perhaps he will stop by and offer some suggestions

    #8191
    anilreddyy
    Member

    Yes, X heads to the max, and $ex=2. Also tried G00 X1.0 — same result.

    Here is my $ output from Python miniterm, almost same as chilipeppr

    [fb] firmware build 440.14
    [fv] firmware version 0.97
    [hp] hardware platform 1.00
    [hv] hardware version 8.00
    [ja] junction acceleration 100000 mm
    [ct] chordal tolerance 0.0100 mm
    [sl] soft limit enable 0
    [st] switch type 0 [0=NO,1=NC]
    [mt] motor idle timeout 2.00 Sec
    [ej] enable json mode 0 [0=text,1=JSON]
    [jv] json verbosity 1 [0=silent,1=footer,2=messages,3=configs,4=linenum,5=verbose]
    [js] json serialize style 1 [0=relaxed,1=strict]
    [tv] text verbosity 1 [0=silent,1=verbose]
    [qv] queue report verbosity 1 [0=off,1=single,2=triple]
    [sv] status report verbosity 1 [0=off,1=filtered,2=verbose]
    [si] status interval 250 ms
    [ec] expand LF to CRLF on TX 0 [0=off,1=on]
    [ee] enable echo 0 [0=off,1=on]
    [ex] enable flow control 2 [0=off,1=XON/XOFF, 2=RTS/CTS]
    [baud] USB baud rate 5 [1=9600,2=19200,3=38400,4=57600,5=115200,6=230400]
    [net] network mode 0 [0=master]
    [gpl] default gcode plane 0 [0=G17,1=G18,2=G19]
    [gun] default gcode units mode 1 [0=G20,1=G21]
    [gco] default gcode coord system 1 [1-6 (G54-G59)]
    [gpa] default gcode path control 2 [0=G61,1=G61.1,2=G64]
    [gdi] default gcode distance mode 0 [0=G90,1=G91]

    Does Dave Hylands have any Python examples? Thanks

    #8192
    anilreddyy
    Member

    OK, my TinyG is not configured yet to my CNCs max xyz movements. so the $pos shows as below
    tinyg [inch] ok>
    X position: 6.831 in
    Y position: 12.629 in
    Z position: 20.251 in
    A position: 0.000 deg
    B position: -270.000 deg
    C position: 0.000 deg
    tinyg [inch] ok>

    I reset the positions using G28.3 X0 Y0 Z0 — now the “G00 X1” works as in chillipeppr. Thanks.

    My CNC max physical movement is 2 in, but $X shows as below.

    $X
    [xam] x axis mode 1 [standard]
    [xvm] x velocity maximum 31 in/min
    [xfr] x feedrate maximum 31 in/min
    [xtn] x travel minimum 0.000 in
    [xtm] x travel maximum 5.906 in
    [xjm] x jerk maximum 1 in/min^3 * 1 million
    [xjh] x jerk homing 2 in/min^3 * 1 million
    [xjd] x junction deviation 0.0020 in (larger is faster)
    [xsn] x switch min 1 [0=off,1=homing,2=limit,3=limit+homing]
    [xsx] x switch max 0 [0=off,1=homing,2=limit,3=limit+homing]
    [xsv] x search velocity 20 in/min
    [xlv] x latch velocity 4 in/min
    [xlb] x latch backoff 0.197 in
    [xzb] x zero backoff 0.039 in

    How do I configure TinyG so that the max movement is not more than 2 in for X?

    #8193
    cmcgrath5035
    Moderator

    Read this wiki item and its suggested follow-ons.

    If you don’t have Xmax switch, then you can use Soft Limits.
    Read that section carefully

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.