Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Problem controlling a cnc spindle

    Scheduled Pinned Locked Moved
    CNC
    6
    11
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Stonekingundefined
      Stoneking
      last edited by

      Hello,

      I'm trying to build a 3dprinter/cnc machine with the Duet wifi but i can't manage to control the spindle.

      The cnc spindle is made by an esc and an rc motor, i tested the esc with a servo tester and it is fully working but when i connect it to the fan header i get no movement.

      Here's what i did:

      Connect the esc using only signal and ground wires to the fan2 pin

      Disabled the pwm fan 2
      M106 P2 I-1

      Load a new tool
      M563 P2 S"Spindle"

      Set the board to CNC mode using pwm fan 2 as servo output
      M453 P22 R15000

      Using M3 or M280 command doesn't produce any movement in the motor.

      The esc is a skywalker 80A UBEC and it works with 5v signals, the fan jumpers are set to internal 5v.

      Am i doing anything wrong?

      Can PWM fans output 5v PWM signal?

      toysrfunundefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators
        last edited by

        Try this:

        • Common the grounds of the ESC and the Duet
        • Connect FAN- on the FAN2 connector to the ESC PWM input
        • Connect a pullup resistor (e.g. 1K) between the ESC PWM input and +5V

        You will need to use the I1 parameter in M453 to invert the PWM polarity.

        You will probably find that when you start the Duet, the motor runs at full speed for a short while as the Duet starts up. You could use Fan1 instead of Fan2 to avoid this.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        1 Reply Last reply Reply Quote 0
        • Stonekingundefined
          Stoneking
          last edited by

          Thank you for the reply, but i'm not shure I understood.

          The esc pwm imput must be connected to the negative of the fan and at the same time should be connected to the positive of the same fan with a resistor.

          Did i misunderstood?

          dc42undefined 1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @Stoneking
            last edited by

            @stoneking said in Problem controlling a cnc spindle:

            Thank you for the reply, but i'm not shure I understood.

            The esc pwm imput must be connected to the negative of the fan and at the same time should be connected to the positive of the same fan with a resistor.

            Did i misunderstood?

            If VFAN is set to 5V then you can do that. But if instead you connect the resistor to the 5V pin on the expansion connector, then you can set VFAN to be VIN instead if that is more convenient for driving actual fans.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            1 Reply Last reply Reply Quote 0
            • Stonekingundefined
              Stoneking
              last edited by

              Thank you so much, I'll try with the expansion connector.

              1 Reply Last reply Reply Quote 0
              • toysrfunundefined
                toysrfun @Stoneking
                last edited by

                @stoneking I messaged you to see if you had figured this out. I’ve had quite a bit of thought about your project. I’m not sure how you would use a fan output to control an Rc esc. From what I understand you will need a 50k digital potentiometer that accepts a 0-5v input connected to a ne555 or other triple 5 pulse timer which would control your esc. Plenty of manual controls available including a simple servo tester which utilizes the 555 but adapting to the duet adds further complication. We are still waiting for our boards to arrive here so I can’t answer if the duet or duex expansion boards have a controlled voltage output. I’m not familiar enough with fan 0 or fan 1 to know if these would be potential options. I suspect duet controls a 12v fan signal? Perhaps a moderator/developer could step in. There may be 12v digital potentiometers also available but I am not familiar with one in particular. It seems that this would be the way to go about properly controlling an esc. We do have an assortment of various electronics, chips, etc... arriving soon so we can hopefully find a solution for ease of digital control. These small bldc Rc Motors put out a fair amount of power (10k-15k watts) and would work excellent for a spindle motor keeping within a small 58mm x 98mm lightweight frame for those wanting to quickly change over to a mini mill for pcb boards. I’ve even seen others machining aluminum and brass. What I haven’t seen is any direct control from the duet they have all used manual potentiometers which I understand takes an element of automation away and adds additional controls that tend to ugly up your machinery and lose that professional feature most prefer from digital operations like this. Maybe someone better versed can elaborate on my suggestion rather than opening a new post so this one could be further elaborated upon.

                Obsessed with knowledge and growth. Learning never stops and everyday equates to another day learned. Being polite isn’t always easy. The fundamental essentials in learning require patience and kindness towards others. Knowitalls knowitless.

                Danalundefined 1 Reply Last reply Reply Quote 0
                • Danalundefined
                  Danal
                  last edited by Danal

                  Test with a regular RC servo before you try the ESC. If you can get the servo to move, the ESC will work. See:

                  https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins

                  And then make a physical servo work before trying an ESC.

                  .

                  And... most RC ESCs require "Arming". They MUST see a 1.0 millisecond PWM pulse for several seconds to arm, then you can drive them anywhere between 1.0 and 2.0 milliseconds to control them.

                  When testing with the servo, this will show up as the servo moving all the way to one end of travel (which end is dependent on a ton of things) and pausing for about three seconds, then moving to different points in travel as you change the spindle speed.

                  You PROBABLY will have to put G-Code in, every time you power up the printer (and the ESC), that sets spindle to 0, delays 3 seconds, then sets spindle to some speed, etc, etc.

                  Delta / Kossel printer fanatic

                  1 Reply Last reply Reply Quote 0
                  • Danalundefined
                    Danal @toysrfun
                    last edited by Danal

                    @toysrfun said in Problem controlling a cnc spindle:

                    @stoneking I’m not sure how you would use a fan output to control an Rc esc....

                    Whatever can control a standard RC servo can control an RC ESC, without additional circuitry. A 3.3V to 5V logic level shift MIGHT be needed. Some ESCs will actually accept 3.3V input, even thought they are pure 5V devices.

                    Anyway, per:

                    https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins

                    there are several fan, and several other, pins that could be used.

                    Delta / Kossel printer fanatic

                    1 Reply Last reply Reply Quote 0
                    • Mitoundefined
                      Mito
                      last edited by Mito

                      Re: Problem controlling a cnc spindle

                      I have a question, my setup is :
                      Duet2 Wifi running on 24V PSU1
                      ESC Controller (with a servo connection) running on a different source PSU2 of 12V, connected pins +12v, GND, 1,2,3phases to motor
                      the ESC controller has a servo plug, do all pins need a connection to Duet? And are the FAN the best pins to use? I dont have an expansion board.
                      I dont want to blow up the board or the ESC.

                      Phaedruxundefined 1 Reply Last reply Reply Quote 0
                      • Phaedruxundefined
                        Phaedrux Moderator @Mito
                        last edited by

                        @Mito Probably best to start a new thread with your question.

                        Z-Bot CoreXY Build | Thingiverse Profile

                        1 Reply Last reply Reply Quote 1
                        • Mitoundefined
                          Mito
                          last edited by

                          Thanks, did move to https://forum.duet3d.com/topic/17401/cnc-motor-control-with-esc-with-different-psu

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Unless otherwise noted, all forum content is licensed under CC-BY-SA