Jump to content
Ultimaker Community of 3D Printing Experts

Python controlling ultimaker 2+


nikitas
 Share

Recommended Posts

Posted · Python controlling ultimaker 2+

I want a linear 2 D scanning in the X and Y direction and a device is connected to the print head is logging a data. I wanted to use ultimaker as a XY scanner in my application. Is there any simple python code, that I can use to sent g-code directly to the UM2+?

 

I wanted to send only g-code "G0 X1" (move forward or backward X and Y direction. and pause for specific time. I tried putty using "COM3" and baud rate 115200, it give random text, how I can send the g-code via serial port using python?

 

 

  • Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+

    At the heart of the UM2 is the same chip as an Arduino Mega. You should be able to talk to open its serial port (using PySerial) and send any gcode to it line by line.

     

    The default Baud rate is 250000.

    • Like 1
    Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+

    Dear @ahoeben, Thank you. Can I use "PUTTY" for the initial testing with "COM3" and Baud rate of "250000" to send the g-code?

     

    should I need to send some other initial g-code for the initialization?

     

    Thanks

  • Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+

    Putty should work. I am not entirely certain if the checksum that is normally added to every line is mandatory. In that case using Putty would require some math.

     

    If you just want to move the head around, that should work without any initialisation. If you want to extrude material, you will first have to heat up the nozzle (the firmware prevents cold extrusions)

    • Like 1
    Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+

    pronterface is easier to use.  I think there *is* a checksum on the end of every line sent through usb/serial.  If so then pronterface does this automatically and I think you can see what is happening (I think it shows you the checksum).

     

    Pronterface is free and is here and has a command line utility also I think:

    http://koti.kapsi.fi/~kliment/printrun/

     

    Note that G0 X1

    Moves to position 1mm (1mm from left edge) but this is absolute so you then need to do:

    G0 X2

    To get to the next spot.

     

    If you just keep sending G0 X1 it moves there the first time but then keeps "moving" to where it already is from then on.

     

    • Like 1
    Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+
    19 hours ago, gr5 said:

    pronterface is easier to use.  I think there *is* a checksum on the end of every line sent through usb/serial.  If so then pronterface does this automatically and I think you can see what is happening (I think it shows you the checksum).

     

    Pronterface is free and is here and has a command line utility also I think:

    http://koti.kapsi.fi/~kliment/printrun/

     

    Note that G0 X1

    Moves to position 1mm (1mm from left edge) but this is absolute so you then need to do:

    G0 X2

    To get to the next spot.

     

    If you just keep sending G0 X1 it moves there the first time but then keeps "moving" to where it already is from then on.

     

    Thank you all for their nice suggestions and comments. @gr5, suppose if I use command G0 X1 it will move the head once, later if I again execute this it will not move the head? If I want to scan the head from point 1 to point 2 with stem size 0.5mm, I have to pass a gcode such as "G0 Xk" where k is calculated as Pi where Pi previous location+0.5?

     

    Thanks a lot.

     

  • Link to post
    Share on other sites

    Posted · Python controlling ultimaker 2+

    There are two "modes" of specifying coordinates: relative or absolute. You describe absolute coordinates. In relative coordinates each time you use `G0 X1`, the head will move 1 mm.


    You can change between absolute and relative modes with the G90 and G91 commands respectively.

     

    http://marlinfw.org/docs/gcode/G000-G001.html

    http://marlinfw.org/docs/gcode/G090.html

    http://marlinfw.org/docs/gcode/G091.html

    • Like 1
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    • Our picks

      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
          • Like
        • 11 replies
    ×
    ×
    • Create New...