How to control a brushless spindle with PWM and a VESC skateboard speed control.

More
06 Mar 2017 22:17 #89107 by Johnsinski
Hi I am trying to replace my Colt trim router spindle head with a DIY brushless spindle. It works perfectly using a ground RC radio (2.4 gHz) and standard rx and a skateboard VESC speed controller.

But I can't seem to get LinuxCNC to work right with that VESC. I'm also using a HobbyCNC Pro board to control my steppers. It has a few extra pins that are just straight through from the parallel port.

So I've got the white signal wire from the VESC soldered to pin pad 16 on the HobbyCNC board, the black ground connect to ground and I've tried with and without the red 5V wire connected to a 5V pad on the HobbyCNC board.

The closest I've gotten it to working was this In stepconf:

PWM Rate :100 (I think the hobby level standard might be 50Hz?) But nothing here but 100 would work.
Min RPM 0 Min PWM 0
Max RPM 1000 Max PWM 1

The speed control needs to see "neutral" before it will arm, which in the RC hobby is around 1500 ns? pulse. Standard range for RC PWM is 1000 to 2000 (units?) So I would think that would lead to an MDI command of m3s500.

After much experimenting I found that m3s700 seemed to be close to neutral. However the spindle was kind of ticking back and forth. (dead band in VESC not big enough?)

Then it seemed max speed in reverse was m3s730 and max speed forward was m3s670.

So I don't understand why 700 seems to be the "center" and the range is only +-30.

But the spindle speed was not real consistent, not like when using the hobby transmitter/rx as the PWM source. It still had some weird ticks and speed variations.

So I assume I need to do something to get a better PWM signal from LinuxCNC or my HobbyCNC board. Or I'm just misunderstanding how it's supposed to work.

Any tips?

Thanks

Please Log in or Create an account to join the conversation.

More
06 Mar 2017 22:27 #89108 by tommylight
If i remember correctly from the days or model building and RC ( over 30 years), they do not use PWM, they use constant signaling with the only thing changing being the duration of the pulse from 1.2 to 2.2 ms.
If that is the case, have a look at PDM for spindle control as it is an an option in stepconf.
I have no further knowledge of how and where for the time being.

P.S. i sure hope that PDM stands for pulse duration modulation and not for pulse density modulation, as the second will not do you much good either.

Please Log in or Create an account to join the conversation.

More
06 Mar 2017 22:44 #89109 by Johnsinski
I think it is pulse density as I have recently been scouring the manual. But thanks.

Please Log in or Create an account to join the conversation.

More
06 Mar 2017 22:53 - 06 Mar 2017 22:55 #89110 by Johnsinski
One more bit of info, I just realized,by default, I crank all the sliders (feed, rapid, spindle, etc) to their max when I start up LinuxCNC. So I was setting the spindle to 120%.

And now leaving it 100% that seems to make the "center" m3s840 instead of m3s700. So it now seems to be 841 +-30.
Last edit: 06 Mar 2017 22:55 by Johnsinski.

Please Log in or Create an account to join the conversation.

More
07 Mar 2017 00:56 #89118 by Johnsinski
OK, so numbers that sort of work, but make no sense to me and there seem to be speed ranges that are "jerky"

I did increase the deadband on the VESC and neutral (stopped) is more solid now.

In stepconf I have Pin 16 as Spindle PWM (inverted)

on the last page "SPINDLE"

PWM Rate 100
Speed1 1000 PWM1 .825 (seems around top speed)
Speed2 0 PWM2 .841 (seems around neutral, "stop")

I still think there may be something weird with the PWM rate of 100 and maybe the inverting? Maybe I'm giving it an inverted signal that sort of works but not right?

Please Log in or Create an account to join the conversation.

More
07 Mar 2017 09:03 #89126 by Johnsinski
I think I have it working as good as it will.

Problem 1: The PWD output pin should have been NOT inverted
Problem 2: I didn't understand (and still don't) that changing the PWD Rate seems to change the neutral point.
Problem 3: I assumed that .500 (LinuxCNC output PWD units) would always be neutral.

Final settings that seem to work:

PWM Rate: 150
Speed1: 0 PWM1: .236 (neutral)
Speed2: 8000 PWM2: .338 (full forward)

The VESC software when hooked up via USB, can show what it's getting for PWM, so that helped immensely in determining what was going on, and the LinuxCNC HAL meter, which I had never used before.

The only other problem I'm having is when I do m5 or manually press the spindle off button, it seems to just give random results, that does anything from slowing the spindle, to stopping it, to making it go full bore! The only reliable way to stop it seems to be m3s1 (or in the range up to about s100) or m4s1. Seems dangerous. I assume that's in the VESC, but is there anyway to tell LinuxCNC to never stop outputting a PWM signal or to never make the spindle speed 0?

Forward and reverse work great too!

I will definitely need a manual safety switch to shut off power to the VESC.

Thanks for listening ;)

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum