Problem controlling a cnc spindle
-
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-1Load a new tool
M563 P2 S"Spindle"Set the board to CNC mode using pwm fan 2 as servo output
M453 P22 R15000Using 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?
-
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.
-
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?
-
@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.
-
Thank you so much, I'll try with the expansion connector.
-
@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.
-
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.
-
@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.
-
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. -
@Mito Probably best to start a new thread with your question.
-