Page 2 of 2

Re: PWM Speed Control - Will it work with gshield?

Posted: Wed Oct 15, 2014 2:41 pm
by cvoinescu
aeleus wrote:I see that PWM speed control is provided by Grbl v0.9 on pin D11 with a range or 0V to 5V. The controller calls for "PWM signal control" of 3.5-12V Vpp. That doesn't seem like a match.
That's actually a match. Pin D11 emits 5 V pulses at a fixed frequency, but with varying pulse width (that's what pulse-width modulation is); to turn the spindle slowly, the pulses are short and the pin spends most time at 0 V; to turn it fast, the 5 V pulses are wide with only short intervals of 0 V in between. The average voltage will vary between 0 and 5 V, but the motor controller takes the PWM signal unfiltered/un-averaged. Flipping between 0 V and 5 V like that is 5 Vpp (volts peak-to-peak). The controller can take anywhere between 3.5 and 12 Vpp, so 5 Vpp is a perfect fit.

Re: PWM Speed Control - Will it work with gshield?

Posted: Thu Oct 16, 2014 4:48 pm
by aeleus
Thanks cvoinescu, it's making sense to me now. I have over 20 years of experience in IT, so I'm comfortable with the software part of this. Where I have limited experience and need help is with the electronics and physically wiring this up.

So, I assume there's a wire running from D11 on the Arduino to the terminal labeled "PWM" on the controller. I also assume there's at least one other wire that needs to be connected, right? Electricity doesn't flow without at least two wires.

The "control" terminals on the controller are labeled as:

EN - Enable control input
PWM - PWM Frequency
F/R - Forward / reverse control signal terminal
GND - common control signal power ground
VR - Speed control signal input
+5V - +5V power supply control signal

Re: PWM Speed Control - Will it work with gshield?

Posted: Thu Oct 16, 2014 6:34 pm
by CrazyBillybob
The PWM pin (11) on the Arduino will be outputting a +5vpp signal so that means you need a common reference point (Ground).
Make sure the "Control GND" and the Arduino's GND are tied together and you should be good. (you don't have to remove the GND lead for the speed pot just add a wire to the Arduino GND).

Good Luck.
CBB

Re: PWM Speed Control - Will it work with gshield?

Posted: Fri Oct 31, 2014 4:09 pm
by aeleus
CrazyBillybob wrote:The PWM pin (11) on the Arduino will be outputting a +5vpp signal so that means you need a common reference point (Ground).
Make sure the "Control GND" and the Arduino's GND are tied together and you should be good. (you don't have to remove the GND lead for the speed pot just add a wire to the Arduino GND).

Good Luck.
CBB
There's another wrinkle in this saga. I finally got a 48V power supply and hooked it up like so:

Power:
DC+ ==== V+ from power supply (48V)
DC- ==== V- from power supply

Motor:
U ==== to motor (thick wire)
V ==== to motor (thick wire)
W ==== to motor (thick wire)

Hall Sensor:
HALL+ ==== to motor (thin wire)
HA ==== to motor (thin wire)
HB ==== to motor (thin wire)
HC ==== to motor (thin wire)
HALL- ==== to motor (thin wire)

Control:
EN ===== (not connected)
PWM ===== (not connected)
F/R ===== (not connected)
GND ===== Potentiometer
VR ===== Potentiometer
+5V ===== Potentiometer

It works! - almost. The spindle spins, and I can control the speed with the potentiometer. The problem is it spins counter-clockwise. I contacted the seller, and they told me I just need to connect +5V to the "F/R" (forward/reverse) terminal. I tried connecting a wire from +5V to F/R, but that did nothing. I suspect it's either not the right kind of signal (VPP?), or the "EN" (enable control) needs to be connected somehow as well. I just want to get this spinning in the right direction before I try PWM speed control.

I feel like I'm so close to getting this working. When I search on the web, the results are either about hooking up simple R/C ESC's or using the Arduino as an ESC - nothing on connecting Arduino to an ESC like the one I have. I'll definitely do a wiki entry once I get this sorted out.

Re: PWM Speed Control - Will it work with gshield?

Posted: Fri Oct 31, 2014 7:38 pm
by cvoinescu
Connect F/R to GND, that should reverse it.

Re: PWM Speed Control - Will it work with gshield?

Posted: Fri Oct 31, 2014 9:17 pm
by aeleus
cvoinescu wrote:Connect F/R to GND, that should reverse it.
Thanks for the suggestion, but that didn't work. It caused the motor to behave somewhat erratically and even start on it's own with the pot turned all the way down. And it still spun CCW.

Here's what I tried that does seem to work:

After reading online about people working with R/C motors just switching two of the three wires to the motor to switch direction, I decided to try that. It was a bit more complicated than switching any two wires.

Here are the results. The first line is how it came and turns CCW. R, B, and K are the red, blue and black wires.

R, B, K === CCW; pot full on (5V) = 10K RPM
R, K, B === alarm mode triggered
B, R, K === oscillates, alarm mode triggered
B, K, R === CW, runs roughly
K, B, R === oscillates
K, R, B === CW, 2.5V = 10K RPM, 3.75V = 12K RPM

So, the last combination seems to do the trick. The interesting thing though is that it seems to be overclocked somehow. Running CCW with the pot turned full on (at 5V) pushed the motor to 10K RPM. With the alternate wiring, I got 10K RPM with just 2.5V coming out of the pot. It reached 12K (the motor's rated speed) at just 3.75V. I could have pushed it faster, but it didn't sound right and I didn't want to take any chances.

Aside from having to be careful not to turn it up too fast, anything wrong with running it with the alternate wiring?

Re: PWM Speed Control - Will it work with gshield?

Posted: Fri Oct 31, 2014 9:35 pm
by cvoinescu
When you swap wires around, you have to be careful that the Hall effect sensor wires also match. If they don't, the motor may run slower, or run only one way. I suspect that's why it does not reverse for you, because the winding (thick) and sensor (thin) wires aren't in the correct sequence.

That said, it's true you can simply swap two of the thick wires (also swapping two of the sensor wires) to get the motor to turn in the other direction.

Re: PWM Speed Control - Will it work with gshield?

Posted: Sat Nov 01, 2014 2:19 am
by aeleus
I suppose that explains why I'm getting higher RPM's. I don't claim to fully understand it, but it works for now.

Re: PWM Speed Control - Will it work with gshield?

Posted: Sat Nov 01, 2014 2:35 am
by cvoinescu
Does it now change direction when you connect F/R to GND? If the sensor wires now match the winding wires, it should.

Re: PWM Speed Control - Will it work with gshield?

Posted: Mon Nov 03, 2014 12:47 am
by aeleus
Grounding the F/R terminal does nothing now...