element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Controlling Brushless Motor
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Answers 1 answer
  • Subscribers 402 subscribers
  • Views 949 views
  • Users 0 members are here
Related

Controlling Brushless Motor

Former Member
Former Member over 13 years ago

Hey I am having problem controlling brushless motor.I am controlling motor through ESC using 9v battery supply.My motor gives one beep and rotate at certian angle and stops.This process repeats .I tried changing delays but no success.Here is my code::

 

#include "Servo.h"


#define MOTOR_PIN         10

#define MOTOR_MAX_SPEED              180

#define MOTOR_START_SPEED               80


int motor_current_speed = 0;

int motor_increment = 1;

int max_reached = 0;


Servo motor;



void motorSetSpeed(int speed)

{


   if     (speed > MOTOR_MAX_SPEED)

      speed = MOTOR_MAX_SPEED;

   else if(speed < MOTOR_START_SPEED);

      speed = MOTOR_START_SPEED;


   motor.write(speed);

   motor_current_speed = speed;


   Serial.print("current motor speed = ");

   Serial.println(motor_current_speed);

}


void motorSpeedUp()

{



   int increment = (motor_current_speed < 100) ? motor_increment + 2: motor_increment ;

        motorSetSpeed(motor_current_speed + increment);

}


void motorSlowDown()

{

  int increment = (motor_current_speed < 100) ? motor_increment + 2: motor_increment ;

   motorSetSpeed(motor_current_speed - increment);

}


void motorStop()

{

   motor.write(0);

}




void motorStartAt(int start_speed)

{

   int i;

   for (i=0; i < start_speed; i+=5)

       {

      motorSetSpeed(i);

      Serial.println(i);

      delay(10);

   }

}


void setup()

{


  

   Serial.begin(9600);


  

   delay(1000);

   motor.attach(MOTOR_PIN);

   motorStartAt(MOTOR_START_SPEED);

   delay(1500);

}


void loop()

{


        if (!max_reached)

        {

            motorSpeedUp();

        } else

        {

            motorSlowDown();

        }

        if (motor_current_speed < MOTOR_START_SPEED)

        {

            max_reached = 0;

        } else if (motor_current_speed > MOTOR_MAX_SPEED)

        {

            max_reached = 1;

        }

        delay(50);

}

  • Sign in to reply
  • Cancel
Parents
  • billabott
    0 billabott over 13 years ago

    I could be wrong about this, but I think the setup() and loop() should be the first functions listed in the sketch.  The otherMotor() would be listed after the end of loop().

     

    -= Syntax Matters =-

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    I tried as you suggested...but gives same problem...No Success

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    I tried as you suggested...but gives same problem...No Success

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • billabott
    0 billabott over 13 years ago in reply to Former Member

    http://arduino.cc/forum/index.php/topic,20594.0.html

     

    So the E.S.C. (Electronic Speed Controller) is fed servo signals from the 'Duino and controls the brushless motor.

     

    I saw something about the ESC MUST receive a signal to go the ZERO position and then the speed controller will behave itself with regards to controlling the speed of the brushless motor.

    It most likely has some smart safety features which you  need to be aware of.

     

    Your motor should have a feature/data sheet like this one: http://www.castlecreations.com/support/documents/Thunderbird-9%20User%20Guide.pdf

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    My motor specifications::

     

    KA450H

    Shaft Size: 3.17mm~14mm

    Motor Dimensions: ł28mm~34mm    

    Weight: 61g

     

    Spec.

    KV: 3200rpm/V

    Battery: 2-3cell Lipo (7.4-11.1v)

    Opperating Current: 8-19A

    Peak Current: 24A (15sec)

     

     

     

    Kv (rpm/v) 3200

    Weight (g) 61

    Max Current (A) 19

    Resistance (mh) 0

    Max Voltage (V) 11

    Power(W) 0

    Shaft A (mm) -

    Length B (mm) 33

    Diameter C (mm) 28

    Can Length D (mm) 21

    Total Length E (mm) 49

     

    I am using 12v 1500 mAH NimH BATTERY  and 30Amp ESC.

     

    Am I going wrong somewhere here.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to Former Member

    Is your NiMh battery pack made up of 4/3 A cells?  If so, the max. current is about 4 amps.

    You must have D or C cells to reach the current levels you seek but since you did not specify

    what you have, I have to raise the question.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    sir,

    It consists of 10 AA batteries , is that sufficient?

    By the way is there any problem with the code specified above?

     

    When i make the connection and run it ,

    it rotates around 100 degree n makes a single beep

    it doesnot change even if i change the delays.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to Former Member

    The spec you posted:

    Spec.

    KV: 3200rpm/V

    Battery: 2-3cell Lipo (7.4-11.1v)

    Opperating Current: 8-19A

    Peak Current: 24A (15sec)

     

    There is no way 10 AA batteries are going to even come close to providing the current demands of the ESC/brushless motor combo.

     

    Can you borrow someone else's 11 volt Lipo pack(s) to test with?

     

    Else, you can try the following:

    one beep at initial power up indicates the brake is enabled. (factory default) To disable the brake, at initial power up, have the TX throttle "high" instead of off. Now turn on the RX power. The motor will not start and after about 10 seconds you will hear a double tone of low and high pitch. After hearing these tones immediately drop the throttle to the "off" position. It will now beep twice to confirm the brake is off. The next time you move the throttle up the motor will start as normal but with the brake turned off.     source

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    Will you please suggest some battery which will drive my motor....and  also tell me how to make TX throttle 'high' and how to turn on RX power......We need to do it in programme .....as I am new in playing with motor using arduino..please clarify.image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 13 years ago in reply to Former Member

    A suggestion you ask for and a suggestion I will give: Depending on your needs/requirements pick one of the 11.1Volt pack on this page: http://www.hobbyking.com/hobbycity/store/uh_listCategoriesAndProducts.asp?idCategory=252

     

    Is there someone in your town that does hobby helicopters?  You need to talk with them or research on the internet.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    Sir,

    I havn't connected the remote controller(PS2 controller ) with the brushless motor yet,

    so I can't set throtle high and test the motor. I m controlling it using arduino board.

    For my project I am using arduino board(atmega328) to control two brushless motor and one servo motor.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube