Help with Arduino control of an Out Runner Brushless motor - Electronics Forums

Author Topic: Help with Arduino control of an Out Runner Brushless motor  (Read 33921 times)

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Help with Arduino control of an Out Runner Brushless motor
« on: January 20, 2013, 07:16:39 PM »
I'm just starting this topic to help one of our visitors hook up an RC helicopter BLDC motor to the Arduino-based controller here.

The datasheet on the motor is in the attachment below and it's been said that the motor is just vibrating and not turning:
Quote
NO ITS JUST VIBRATING AND NOTHING HAPPENS IT IS MOTOR THAT NORMALLY USES FOR HELICOPTERS IM TRYING TO RUN IT WITHOUT ESC THAT’S WHY I AM TRYING TO MAKE IT.


Electronics Forums

Help with Arduino control of an Out Runner Brushless motor
« on: January 20, 2013, 07:16:39 PM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #1 on: January 20, 2013, 07:27:10 PM »
Did you by any chance build the full circuit as on this page: http://elabz.com/brushless-dc-bldc-motor-with-arduino-part-3-the-stroboscope-project/ (about 1/3 of the way down the page there's the schematic)? It has the RPM control potentiometer which you may want to play with - it sounds as if the RPMs are too high for the motor to start properly - in other words, the commutation of the windings is switching too fast and the moment of inertia does not let the rotor to pick up the pace quick enough. You may want to lower the RPM down all the way, then bring it back gradually.

By the way, this is a good high-amp motor, the SN754410 chip can only deliver 1A per winding - about 1/10th of what this motor is capable of.

What is the motor control voltage on the Pin 8 of the SN754410?

sa898

  • Trusted Member
  • *
  • Posts: 3
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #2 on: January 21, 2013, 12:11:00 AM »
yes i built the full circuit i think you are right about the current, so what ic should i use here to drive the motor? and i supplied 12 volt in sn754410Ne.

sa898

  • Trusted Member
  • *
  • Posts: 3
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #3 on: January 21, 2013, 12:16:24 AM »
And i have tried the pot thing so idnt thing that could be a problem

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #4 on: January 21, 2013, 01:59:29 PM »
And i have tried the pot thing so idnt thing that could be a problem
Sorry I didn't quite understand because of the typo: you did try to control the rotation with the pot and it did not change the motor's response?

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #5 on: January 22, 2013, 12:34:51 AM »
Just wanted to mention that I did find a similar outrunner BLDC motor and hooked it up to the circuit. Although it does run, I'm finding that I cannot really control the speed which is very slow - about 100~120RPM. I've got to do some calculations here - it may actually turn out that the PWM frequency is messing with the timing.

I tried to load the version of the Arduino sketch without PWM ( http://elabz.com/wp-content/uploads/2011/11/DVD_three_phase_discrete_steps.zip ) and it does control the motor much better - I could rev it up to something like 600-1000RPMs, and perhaps more can be achieved. Please  note that without ESC the motor can easily lose steps under load and that creates vibration, and the rotation does not appear smooth, at least until it gathers enough speed to get past the dead zones (the missteps in windings' commutation).  Also, the SN754410 cannot handle the power of a motor like this and gets really hot in a matter of seconds - so this can only be done as a test or perhaps to prove a point, but for any real work with this motor at any real speed you would need ESC and different components that can handle 10 times the current.

I plan to look closer into this myself, check the blog from time to time, I'll post updates on BLDC ESCs.

melonFury

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #6 on: February 10, 2013, 07:25:42 AM »
Hi there,
I've been having the same 'vibrating' problems with my motors. Unlike the spec, I'm using a similar L293D H-Bridge IC. It has the exact same pinout and it seems to be giving (almost) desired results so I assume it's ok as a stand in. I've tried playing with the base RPM value in the code and changing it between 0 and 2000, but with or without my 10k pot it doesn't seem to make any difference apart from increasing the rate at which it vibrates back and forward.

I've tried using the discrete steps code as well as the pwm version, but to no avail, both seem to vibrate just as much as each other and neither makes the motor go a full revolution.

Here's a video example of what's happening:

Also, I've tried running the motor on 4.5, 9 and 13.5v, and I've hooked up both the button and the pot to the arduino, leaving out the leds as I don't really need any flashy lights :)

Thanks in advance
« Last Edit: February 10, 2013, 12:01:11 PM by ElectroNick »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #7 on: February 10, 2013, 12:25:27 PM »
melonFury, thank you for the video, it goes a long way in describing what's going on. As they say, picture is worth a thousand words; video must be worth 30,000 words per second then  :)

Anyway- regarding the vibrations. First thing first: these motors are usually fed from the +1.9V rail in the DVD drive, so there's no good reason to hook them up to 13V+. Their windings are usually between 1.5Ω and 5Ω (measuring two at a time of course) , so we're talking some serious current here - 9A is way-way too much for these little motors. They are sturdy enough to just dissipate all the extra energy as heat but increasing the voltage on the H-Bridge won't do anything useful except for making it rush past the points of maximum magnetic attraction faster than the software moves those points around the circle - it may be one of the things that's happening. I would think that if you played with the RPM  setting in PWM mode, you would be able to still catch the moment when the timing is just right despite the very high voltage but perhaps it still moves way to quick (or your potentiometer is very non-linear and you move past the desired setting too quickly).

Another thing that comes to my mind - it would behave like this when one of the three legs is not attached. I noticed it's a ribbon cable, and those can be a pain to hook up if you don't have a proper connector. Are you sure all thee windings' ends are hooked up to where they're supposed to? Since it's a ribbon cable, there are many more lines in there - there's +5V and ground, then there are three outputs from the Hall-effect sensors. Be sure that you're hooking up to the actual windings, and not to Ground, for example. Usually the winding's traces on the PCB are wider than the rest, but not always. Just verify that the resistance between all of the three ends you consider windings is the same within the 1.5Ω - 5Ω range. Perhaps it could be a different value but it has to be exactly the same between all three.

And yet another thing that could be causing it is the design of the motor itself - if it's not a 9-cog 12-poles motor, it would need a different sequence of winding's commutation. I have to say though that I've yet to find one DVD spindle motor that was not a 9-cog one but the shroud magnetization is not always easy to see. Was that a Nidec motor with 11-wire ribbon cable, BTW? I have one that looks almost exactly like that - I want to try and hook it up just to see what's happening. 
 

melonFury

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #8 on: February 10, 2013, 08:51:36 PM »
Thanks for the awesome reply :)

First of all, here's a closeup of the two motors I've been testing with, both have been taken from CD/DVD drives, and as far as I can tell they are both exactly the same.



You can see I've connected the motors via their three large connections, I've skipped the ribbon completely to avoid any shorts or dodgy connections.

As you suggested, I lowered the voltage to the motors to 2.4v (two re-chargeable AA's) but they seem to be showing the same behaviour as before, except with less force and speed. And it seems that even with no pot and a motorDelay value of 1, they still vibrate at a very high frequency, enough for the motor to emit a quiet hum. This wasn't happening before though, the vibrations were at a much lower frequency and were too sporadic to emit a steady tone.

I think what may of been happening before is that the higher voltages were pushing the motor so far that the code was switching too fast for the motor to keep up, resulting in the motor only physically turning for a small portion of the times it was told to.

Also, is the order of the connections important? e.g. Will it make a difference if I switch pin 9 with pin 10? And should I be doing anything with the Hall-Effect sensors? They seem to take up a major portion of the ribbon, which leads me to believe they might be there for more than just looks ;)


ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #9 on: February 10, 2013, 10:21:15 PM »
Nice photo! Yes, these are almost certainly regular 9-cog 12-poles BLDC motors just like the ones I used in my blog post. And I can see that you've soldered directly to the winding terminals, so disregard what I wrote about ribbon cable - not an issue.

The order of connection does not matter at this point - it "only" affects the direction of rotation. I assume you're trying to see them rotate in general at this point, so don't worry about the actual order of connections to pins 9, 10 and 11. 

The Hall effect sensors are very useful for determining the position of the rotor, although they aren't used in the circuit you are building. The BLDC controller you're building has no feedback whatsoever - it assumes the motor will dutifully follow the phases around and that only works for slight loads or no loads. 

The pot is actually needed because without it the delay is too small, the pot analog value read is multiplied by the standard delay, so it does play an important role. I am assuming you have one end of the pot on Gnd, the other on +5V and the wiper is connected to analog 0 input of Arduino, right?

I am actually experimenting right now with a circuit built on just 6 discrete transistors, trying to make use of back EMF to control the speed of rotation. It won't materialize tonight but I just made a video I'll post here in a moment, just to keep you posted.

So, yes, please check to pot, you do need it to be able to lower the expected RPMs to some reasonable value (approx 100RPM is where is starts working) and then rev it up to a faster spin until at some point it'll loose the synchronization again (you'll see it one the video)

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #10 on: February 10, 2013, 10:48:15 PM »
Here is the video of a simpler controller I talked about, took a while to upload that to Youtube. The schematics is extremely simple, I'll try to draw it real quick and post here as well. The transistors can be 3 x 2N3906 (PNP) and 3 x 2N3904 (NPN) . I'm using similar transistor pairs -  C9012 and C9013 - basically same thing, just 400mA max current rathet than 200mA for 390X.
Here goes:


melonFury

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #11 on: February 10, 2013, 11:39:15 PM »
That looks a lot simpler haha.

I've had some progress with my motor, it now turns at about 60 RPM with the pot at full. The pot has to stay at full though or else the motor stops working altogether. In the video below you see the current movement, but you also see that sometimes when I stop it, it goes much faster in the opposite direction, which leads me to believe the motor is still not turning properly, yet it is in sync enough for it to rotate at a slower speed.


Also, here are my modified constants:

const int buttonPin = 8;// the number of the direction pushbutton pin
const int ledPin =  7;  // the number of the status LED pin (not the flash LED)
const int potPin = 0;  // pot controls the RPM speed
const int potPinFlash = 1;  // pot controls the flash speed
const int motorPin1 =9;
const int motorPin2 =10;
const int motorPin3 =11;
const int flashPin =12;
const int motorDelay=100; // together with pot controls the RPM
const int flashDelay=2; // controls duration of flash
const int frames=24; // has to be divisible by 3 in this version
const int serialDelay = 2000; //debug only
long serialLast =0; //debug only

I've changed the variables in red. Now that I look at it though, changing the frames doesn't seem to do much... And a delay > 100 makes it slower, yet a delay < 100 makes it more buggy and jumpy, and more likely to do the smooth rotation in the opposite direction you see in the video :/

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #12 on: February 11, 2013, 12:10:26 AM »
I'll have to take another look at the old code. I believe the frames variable does not do much of anything if you are not using an LED for the stroboscope effect, so don't worry about it. 

I'm curious if you can try the code I used for the simpler setup on the discrete transistors without making any changes to your circuit. At least I can be sure that the timing variables there are fine for rotation between ~80RPM and ~400RPM. It should work on your H-Bridge chip (I think) - anyway, should be easy enough to try. Please keep me posted. I'll be checking out for the night, will take a look here tomorrow morning. See the Arduino sketch attached.

Cheers! 

melonFury

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #13 on: February 11, 2013, 12:36:11 AM »
Wow, it works perfectly!  :D

I put in your new code and it seems to be working just as yours does. I have to start the motor between 90 and 150 RPM in order for it to start spinning properly, otherwise it'll start vibrating back and forward. After its going I can slowly rev it up until around 400 RPM where it just stops and vibrates back and forward like before, but at a much higher frequency. This vibrating also happens if I obstruct/stop the motor at any point after 150 RPM.

So overall, its still a bit glitchy, but its still infinitely better than before :) Now... how to get it up to 42,000 Rpm?  ;)

EDIT: Oh yeah, is it a problem with my motor that it isn't able to support a CD when its placed on top? It seems to be going to fast to keep proper traction

EDIT EDIT: Also forgot to mention, I had to remove the line "Serial.println(bEMFComp);" near the bottom in order for it to compile, I'm probably missing a module or something
« Last Edit: February 11, 2013, 01:01:23 AM by melonFury »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Help with Arduino control of an Out Runner Brushless motor
« Reply #14 on: February 11, 2013, 11:28:24 AM »
Wow, it works perfectly!  :D

I put in your new code and it seems to be working just as yours does.
...
So overall, its still a bit glitchy, but its still infinitely better than before :) Now... how to get it up to 42,000 Rpm?  ;)
OK, we'll just use that as a starting point - I started writing the new code because I wanted to avoid any influence of the stroboscope-related parts of the old code and also to be able to disconnect a winding to measure the back EMF at least once in the electrical rotation (which translated into 6 times per one mechanical 360° turn of the rotor). I'm not sure how fast I will progress with work getting in a way :) but I would hope to have some kind of a workable solution in a few days.

I have to warn you though that the ESC (electronic speed control) based on measuring back EMF may not work with  the L293D chip - I have to read the datasheet one more time but I don't believe you can put its outputs into the high-Z state (they are always either 0 or Vmotor) and that will prevent measuring the actual back EMF voltage. So, I'll be sticking with discrete transistors at this point, moving onto power MOSFETs when I switch into the RC BLDC outrunners - the actual goal of this particular project.   

EDIT: Oh yeah, is it a problem with my motor that it isn't able to support a CD when its placed on top? It seems to be going to fast to keep proper traction
Yup, that's the lack of PWM playing tricks again - that's what this video is about:
- on these super low RPMs the motor moves so fast to its next stable position point (maximum magnetic attraction) that the CD slips, even though the eye cannot catch the actual movement because it's too quick. Definitely need to add PWM to make the move to the next point smoother or glue CD to the rotor  :) - its moment of inertia will pretty much do the same thing.

EDIT EDIT: Also forgot to mention, I had to remove the line "Serial.println(bEMFComp);" near the bottom in order for it to compile, I'm probably missing a module or something
Yes, sorry about that! I've already started messing with back EMF measurements when I realized that the new code can work on the old hardware, so I've taken the EMF related stuff out and forgot this line in there.  bEMFComp used to be defined earlier in the code but I took it out. I'm glad you're proficient with Arduino C to spot and fix that.

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
14539 Views
Last post February 11, 2013, 12:15:21 PM
by ElectroNick
14 Replies
20859 Views
Last post June 07, 2013, 11:49:31 AM
by mamette
6 Replies
8261 Views
Last post June 14, 2013, 12:56:18 PM
by antmabee
9 Replies
21579 Views
Last post December 16, 2015, 12:03:18 PM
by PaulBailey
0 Replies
11279 Views
Last post April 05, 2015, 07:30:53 PM
by earslan