Been a long time lurker around these forums but always found a way to get the help I need using older posts. This time, after days of searching and testing, I finally gave up and decided to post something about this.
Currently have an Arduino project that will be using two 36V 350W Brushless DC Motors. Attached to the motor are the hall lines and motor lines. I'm using this for my controller. My microcontroller is the Arduino Uno.
I have a problem trying to keep a steady RPM on the motors even with consistent voltage from my Arduino signal line. I've used the analogWrite(pwmPin, rate) with an example of analogWrite(6, 150). However, when running the code with a delay, the RPM changes at every instance of stopping and starting again. I do not know why this is happening. I have everything wired with the hall lines and motor lines all connected properly. My 36V supply is also consistent to which it couldn't be a power issue.
Is there a way to have this outputted somehow? Perhaps in Serial Monitor? Currently it's extremely visible as well as audible of how stark the differences in RPM are
There are posts like this or this where they describe using a controller with Arduino. As for the MOSFET, I was thinking to use it as my signal line to in conjunction with a diode to control the throttle speed but haven't gotten concrete understanding if such an idea could work.
Neither of the posts linked above describe a successful Arduino connection to a Chinese eBike/scooter brushless motor controller. You need to find a tutorial with a clear wiring diagram and evidence of success.
However, beware that Youtube and Instructables are extremely unreliable sources of Arduino information.
The first code you posted would be used for an R/C model most likely one for a model car since you say the brushless motor has hall sensors.
The second code would be how you might drive a brushed D/C motor or provide a reference signal to another type of motor driver.
Which of the two codes you posted actually make the motor run? I cannot imagine that they both work.
You will not be able to make sense of the output signal using a volt meter. The signal outputs a 1.5 mS pulse every 20 mS (with code you posted). You will need an oscilloscope to analyze the signal.
It would be best to post links to your motor and motor driver. Also a schematic drawing of your project.
Thank you. I see that you did post the link to the motor controller. I missed it due to my slight color blindness. When posting links it is best to put them on a line by themselves. It will appear as a large lin like this:
After looking at the controller listing on Amazon we will need a copy of the documentation for the controller. Either a link to a website or if there is none a photo of each page.
Edit:
I certainly hope the instructions are a lot more clear than what appears in the Amazon listing
how to connect?
1.connect the motor line (color to color,must connect)
2. connect the battery line(2 red wires is connect to battery + , black connect to battery-,these wires must need connect)
3. connect the controller throttle line(color to color connect)
4. connect the hall line(if motor without hall line, don’t need connect)
5.docking the two self-learning lines, the wheel will forward or reverse.
(1.if wheel forward ,Separate the self-learning line.
2.if wheel reverse, Separate the self-learning line. Docking the self-learning line again,if wheel forward ,Separate the self-learning line.)
6.other functions can be connected as needed.
After looking for any type of documentation, it appears there are none. I've looked through the reviews and others have stating this is how most controllers are delivered unfortunately. Basically, manufacturers are bent on withholding the exact wiring diagrams and voltage references for each wire on the controllers. All the options and no info on how to utilize them, risking shorting out the controller from experimenting with these wires.
Do you think investing in a better controller would help?
You could look for a controller with better documentation or you could try this which I copied from the Amazon listing
The product wiring is complex. If the buyer cannot understand the product details page here, please contact us via email, and our customer service can help you as much as possible.
36V-48V 350W controller can work with hall sensor/hall sensorless
As far as I understand the wiring from the amazon page, you need to use a throttle lever like this one :
Get one and if it works (it should), measure the signal on the various pins. My guess is that red is power supply and green is what remains of it passing through a variable resistor. Disconnect and measure the variable resistor. It should be a new starting point...