The motor has Red wire connected to battery positive, Black connected to battery negative, White wire I connected to power ground for direction, Yellow is encoder output, Blue wire for PWM input which I connected to Arduino PWM output pin.
My expectation was, motor will not run with pwm 0 and will increase or decrease speed based on pwm setting, but it keeps on running even when pwm value from arduino is 0. Other thing I noticed is if I don't connect pwm wire to arduino and only red and black power lines of motor connected to battery, it doesn't run.
Does anyone have experience with such motor to control speed linearly using arduino driven pwm signal ?
Sorry I cannot help you as I do not know what you have. Post an annotated schematic showing exactly how every thing is connected, including ground, control signals and power source(s).
Thanks Paul. Yes, there is common ground which is connected to arduino, motor and going to battery negative terminal. Only thing I haven't explored yet to change PWM frequency of Arduino Due. Motor's recommended frequency is 15HHz to 25Khz while I am using default Arduino pwm frequency which I 1KHz I believe. But that should not make operation completely off. May be frequency will make more efficient and smooth operation of motor. Currently I don't see any pwm control working. I haven't measured encoder output to check motor speed though, but it doesn't seem to be changing with different pwm values and it is not stoping with pwm value 0 either. I hear different sound from motor though when pwm is 0 and when it is switching to non-zero value.
I will post circuit diagram and arduino code.
Thanks
That's right Pual, they didn't provide more information. I inquired with seller, lets see if they will provide. Typically, Aliexpress sellers are not technical people so I don't have much hope. But there are different variant of similar 5 wires BLDC motors being sold which has built in driver so I was wondering if anyone got pwm working with any such motor.
My guess is that since we are dealing with a 3-phase motor that the speed signal is actually the frequency changes, FM, and not PWM. Easy to get it wrong when the writer is clueless.
Hmm... Interesting ! So, you are saying I need to try generating FM using Arduino within 15KHz to 25KHz range they specified with may be 50% duty cycle. I will try. First I need to find way to modify PWM frequency in Arduino Due.. Thanks for your help Paul. I will try.
Doesn't PWM mean it is variable voltage ? That's how pwm works, to give average dc voltage to motor based on pwm duty cycle, isn't it? I will try though using dc power supply to increase voltage gradually on blue wire to see difference. If that works, then I will have to add DAC module driven by arduino either parallel digital outputs or serial digital output via SPI/UART/I2C etc.
Definately NOT! PWM changes the average POWER applied to the motor. The voltage will not change, except when it goes to zero. The current will not change, except when it also goes to zero. It is the average of volts X amps, the power, which changes.
Hi Paul, finally I found the issue. It actually operates with inverted pwm, meaning 0% duty cycle runs at full speed and 100% duty cycle stops the motor. That's why it was confusing. I was trying from 0, 5, 10, 20 pwm values in analog_write function which was running almost same, because motor has high rpm and those all pwm values were running at close to max speed so I thought pwm is not working but while experimenting different things, I noticed it actually gradually reduces speed as I keep on increasing pwm value and it stops at 255. Thanks for your help for all different possibilities you pointed out which will help for any future debug.