Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: manueluchiha on November 13, 2017, 03:55:47 PM

Title: Help spindle speed
Post by: manueluchiha on November 13, 2017, 03:55:47 PM
Good afternoon, buy the following card to be able to drive a motor with encoder, but I can not make the mach3 regulate the rpm with this card, you could help me with this problem, since I do not know what it is, if that is why I have badly configured mach3 or badly connected the card.
Annex the papers.
Title: Re: Help spindle speed
Post by: joeaverage on November 13, 2017, 04:09:58 PM
Hi,
do you have a voltmeter to measure the PWM output voltage from the breakout board?

Not sure what your doing with an MPG, the spindle speed measuring is done off an index pulse, one pulse per rev not an
MPG. If you have an encoder with an index pulse that might work.

On the spindle setup page make sure PWM is used, don't worry about spindle speed averaging and all of that,
until you get the spindle to go it doesn't make any sense.

Craig
Title: Re: Help spindle speed
Post by: manueluchiha on November 14, 2017, 09:24:37 AM
The motor is with encoder, the encoder has 6 cables, which are 2 for the supply voltage of + 12V, 2 cables are the activation voltages of the encoder + 5V and 2 cables are the outputs of the encoder output A and output B. I already set some mach3 data, for example kernel speed is 35khz, engine outputs> spindle> step pin # 5 and dir pin # 4, input signals> index pin number # 15, timing pin number # 13, output signals> output # 1 pin number # 4 to activate the relay and pin number # 5 is used as output for the pwm, encoder / MPG'S> encoder 2> A-port # 15 and A-port # 13, the maximum rpm is 2300 and minimum 150, attach the screenshots of the mentioned values.
Title: Re: Help spindle speed
Post by: joeaverage on November 14, 2017, 11:57:04 AM
Hi,
a few suggestions...don't worry about the encoder feedback to start with.

Your original post showed  a pulse width modulated DC power supply to drive your spindle motor yet here you are showing two pins for Step and Direction.
Which is it?

Craig
Title: Re: Help spindle speed
Post by: manueluchiha on November 14, 2017, 12:05:59 PM
Ok, I want to vary the rpm of the motor by means of the pwm, due to this it was that I activated the output pin of passage so that from there is the output signal of the pwm, the output pin of the address occupied it to activate the relay and rotate CW O CCW, also for that reason activate the signal of index and timing to be able to be censando the real rpm with respect to the programmed.
Title: Re: Help spindle speed
Post by: joeaverage on November 14, 2017, 12:27:19 PM
Hi,
well you've got a few clashes and it won't work as you've got it at the moment.

Leave the Index and Estop inputs alone, they're fine.

Assign Output#1 to <port 1 pin 1>  and
Output#2 to <port 1 pin 2>

Disable encoder 2 inputs. Do yourself a favour, when you disable something enter zeros into the pin assignments, it saves confusion.
Disable the Timing input.

Now you have two outputs, one for CW and one for CCW at pins 1 and 2.
Pins 4 and 5 are motor ouput pins, one will be PWM, I don't know which one yet.

Mach will read the Index input to measure its speed and position for threading. Don't worry at the moment about hooking it up just get the PWM and relays sorted.

Craig
Title: Re: Help spindle speed
Post by: manueluchiha on November 14, 2017, 03:43:07 PM
Ok, I already made some of the changes you recommended, but I have doubts about the frequency of kernel speed and on PWMBase freq. I also have doubts with my motor as I have 6 threads, 2 are from the power supply, 2 are from the encoder supply and 2 are encoder outputs, one of these outputs is connected as a index signal, but the second signal to where I connect it , I ask why a signal is to record the rpm, but how to count the fractions back to be able to make a string. Annex the pdf with the changes and the engine.
Title: Re: Help spindle speed
Post by: joeaverage on November 14, 2017, 03:56:09 PM
Hi,
don't bother with the encoder until you get the motor to go. You don't need it yet.

The base frequency (kernel is not the right term here, its confusing)  should be anywhere from 1 to about 5kHz
will be fine.

The Index input is expecting one pulse per revolution of the spindle. A multi pulse encoder won't really do you
any good. Until you get the motor to go you don't care about the  encoder. All your interested in at the moment
are the two wires going to the core of the motor, the big ones. All the rest are unimportant at this time.

Craig
Title: Re: Help spindle speed
Post by: joeaverage on November 14, 2017, 04:16:23 PM
Hi,
the red and black wires are the motor wires. Don't worry about the rest of them yet.

You have Output#1 assigned to <port1 pin4> and the spindle Dir pin as <port1 pin4>, a clash.
Make Output#1 <port1 pin2> Output#2 <port1 pin3>.

Now use a voltmeter to establish which of pins 4 &5 are PWM.

Craig
Title: Re: Help spindle speed
Post by: joeaverage on November 14, 2017, 05:40:29 PM
Hi,
once you've cleared the clash on pin 4 try setting the PWM Min to 50%. That will mean that pin 5 (or possibly 4)
is about 2.5V whereas the other pin will be 0V or 5V depending on whether the spindle is supposed to be running
or not. May make it a bit easier to work out which pin is which.

Craig
Title: Re: Help spindle speed
Post by: byteman59 on August 30, 2022, 08:57:36 AM
Ok, I already made some of the changes you recommended, but I have doubts about the frequency of kernel speed and on PWMBase freq. I also have doubts with my motor as I have 6 threads, 2 are from the power supply, 2 are from the encoder supply and 2 are encoder outputs, one of these outputs is connected as a index signal, but the second signal to where I connect it , I ask why a signal is to record the rpm, but how to count the fractions back to be able to make a string. Annex the pdf with the changes and the engine.

Will this encoder work for a 120V AC motor?
Title: Re: Help spindle speed
Post by: joeaverage on August 30, 2022, 03:55:12 PM
Hi,
what encoder? You have provided no technical details.....the two outpts you mention are probably A & B outputs, not an index signal at all.

Craig
Title: Re: Help spindle speed
Post by: byteman59 on August 30, 2022, 03:59:45 PM
Sorry, this one.
the one pictured at the beginning of topic.
Title: Re: Help spindle speed
Post by: joeaverage on August 30, 2022, 04:48:58 PM
Hi,
none of what is pictured is an encoder???
All that you have pictured is an adjustable power supply for a DC motor. There is no encoder or any other means for Mach to measure the speed.

Craig
Title: Re: Help spindle speed
Post by: byteman59 on August 30, 2022, 04:52:42 PM
I think i found what i was looking for.

https://www.cnc4pc.com/c47-a-c-speed-controller-relay-board.html
along with this.

https://www.aliexpress.com/item/2251832705665188.html?spm=a2g0o.best.old-user.4.23a12c25PufyFW&scm=1007.28303.271905.0&scm_id=1007.28303.271905.0&scm-url=1007.28303.271905.0&pvid=21628fda-b3ac-45ce-af10-81280c410ff7

I have a MF70 which i am upgrading. I wanted to have speed control. Do you have any concerns about what i have selected to accomplish it?
Title: Re: Help spindle speed
Post by: joeaverage on August 30, 2022, 05:02:47 PM
Hi,
that is just another speed controller board....its not an encoder. Mach will have no idea how fast the spindle is going unless you have an
encoder or an index pulse.

A speed controller board will drive the spindle just fine but if Mach sends out a 50% duty cycle PWM you'd expect and want the spindle to do 50%
speed, and it may be close, but likely not better than 10%. Once the spindle comes under load it will slow down, and Mach has no way to know that
nor have any means to correct it.

Craig
Title: Re: Help spindle speed
Post by: byteman59 on August 30, 2022, 05:16:36 PM
Good point. Is there a way to monitor spindle speed?

I have built a laser and now working on a CNC. Just started the journey.
Here is my laser. Also been working on a A10 SimPit, have completed several panels.

Thanks for the input.


Title: Re: Help spindle speed
Post by: joeaverage on August 30, 2022, 05:21:41 PM
Hi,
Quote
Good point. Is there a way to monitor spindle speed?

Yes there is, but it requires an encoder or an index pulse fitted to the spindle. Mach can count the pulses and can calculate how fast the spindle is going.
Depending on your controller mach may be able to adjust the PWM duty cycle to compensate for the load induced slowing for example.

Craig
Title: Re: Help spindle speed
Post by: byteman59 on August 30, 2022, 05:25:00 PM
I'm pretty sure i know what you are refering to.

Thanks!