Pages: [1]   Go Down
Author Topic: brushless motors ,esc , quadcopters  (Read 2290 times)
0 Members and 1 Guest are viewing this topic.
India
Offline Offline
Newbie
*
Karma: 0
Posts: 17
im a newbiee..... but has a beleif and trust to find something new....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,,, sorry for creating this seperate but this would be much more usefull to all my friends who are part of the arduino team...to get this info quickly...
here is my problem......
how can i check my brushless motor belonging to topstar 2400kv http://topbandmotor.en.alibaba.com/product/427426170-212087816/brushless_dc_motor.html,, and esc belonging ipeaka 40A and 45A burst for 10shttp://www.ecvv.com/product/3694372.html,,,and with my arduino uno rev3????
when i use the following code
Code:
   
#include <Servo.h>    // including the servo library
Servo motorServo;     // naming the servo as "motorServo"

void setup()
{              // runs code once on setup:
  motorServo.attach(9);   // reporting the pin motorServo is attached to
  throttle();      
}

void loop()
{              // runs code repeatedly:
 
  setRpm(40);
}

void throttle()
{
  motorServo.write(0);   // sets the throttle to 0
  delay(1000);           // waits one second
}

void setRpm(int spd)
{
  int rpm = map(spd, 0, 100, 0, 179);    // maps rpm to a motor-friendly number
  motorServo.write(rpm);                     // sets motor to the rpm speed
  delay(15);                                        // waits for motor to get there
}
this does not work practically but as per theory its right (verify was successful)>>>> smiley-sad smiley-neutral
« Last Edit: July 29, 2012, 08:39:04 am by deepu1994 » Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Every ESC has its own arming sequence and will refuse to start up if you don't follow it - this prevents injury when tinkering with an RC plane.

Generally many ESCs will arm if the throttle is set to zero for several seconds at start up (1 second is definitely rather short) and then _ramped up_ to speed.  Sudden step changes could be break-through from another RC channel and treated as an error condition perhaps?   If you have an RC transmitter and receiver you can experiment with it to see what your ESC likes.

This sequence is more conservative and I think might have a better chance of working.  Most ESCs chirp the motor to indicate status, typically 3 beeps upon arming
Code:
  setRpm (0) ;
  delay (4000) ;
  for (i = 0 ; i <= 40 ; i++)
  {
    setRpm (i) ;
    delay (20) ;
  }

The actual throttle settings for you particular ESC you'll have to experiment with.  I definitely use the higher-resolution calls to servo.write() where you pass the pulse-width in microseconds (540 to 2400 is the valid range).
Logged

[ I won't respond to messages, use the forum please ]

India
Offline Offline
Newbie
*
Karma: 0
Posts: 17
im a newbiee..... but has a beleif and trust to find something new....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i cant get u >>>> becoz.....according to the manual of my ipeaka esc 40A...it needs a min throttle signal to arm itself>>>> then a continuous three beep sound when armed... the if we increase the throttle signal the motor accelerates up......
in my case it arms well but when i supposed to increase the throttle it keeps in beeping continuously........
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What's your code now?
Logged

[ I won't respond to messages, use the forum please ]

India
Offline Offline
Newbie
*
Karma: 0
Posts: 17
im a newbiee..... but has a beleif and trust to find something new....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi tnx for u r help anyway>>> i came out of that easily with my prof advise>>>
he advised me to use the microseconds value for the esc and arm the same >>>
my esc arms at 100ms and has the highest throttle range of 2000ms......
now all is working like charm>>>>\

my next point of interest is using the gsm module and the at commands>>>>
kindly give me essential details
Code:
#include <Servo.h>
Servo motor;

void esc() {
  delay(5000);
  Serial.print("Sending lowest throttle");
  motor.writeMicroseconds(1000);
  delay(2000);
  Serial.print("Low throttle sent");
}
void setup() {
  Serial.begin(9600);
  motor.attach(9);
  Serial.print("ESC calibration started");
  esc();
  Serial.print("ESC calibration completed");
}

void loop() {
  if (Serial.available()>0) {
    int key = Serial.read();
    switch(key) {
      case '1':
      motor.writeMicroseconds(1250);
      delay(2000);
      break;
      case '2':
      motor.writeMicroseconds(1400);
      delay(2000);
      break;
      case '3':
      motor.writeMicroseconds(1750);
      delay(2000);
      break;
      case '4':
      motor.writeMicroseconds(2000);
      delay(2000);
      break;
      case '5':
      motor.writeMicroseconds(2500);
      delay(2000);
      break;
      default:
      motor.writeMicroseconds(1000);
      break;
    }
  }
}
Tjhis is the code i used for controlling the motor
Logged

Leverkusen
Offline Offline
Sr. Member
****
Karma: 4
Posts: 325
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello together,
I think I'm right here. With a very similar code, I run my BL. But I have difficulties to control 4 BL's. Can you help me please.
Regards
Kucky
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some more information - "have difficulties" isn't very informative...
Logged

[ I won't respond to messages, use the forum please ]

Leverkusen
Offline Offline
Sr. Member
****
Karma: 4
Posts: 325
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, diese info war wirklich zu kurz.
Here my code:
Code:
#include <Arduino.h>
#include <Servo.h>

Servo rotor_1;
Servo rotor_2;
Servo rotor_3;
Servo rotor_4;

#define PINESC1 2
#define PINESC2 3
#define PINESC3 4
#define PINESC4 5

  int rotorMillis1 = 0;
  int rotorMillis2 = 0;
  int rotorMillis3 = 0;
  int rotorMillis4 = 0;

  int speed1 = 0;
  int speed2 = 0;
  int speed3 = 0;
  int speed4 = 0;

//---------------------------------------------------------------------------------------------------------------------
void setup()
{
Serial.begin(9600);
Serial.println("****************************");
Serial.println("*    Rotoren Test          *");
Serial.println("* Parameter = Microseconds *");
Serial.print  ("*  ");Serial.print(__DATE__);Serial.print(" ");Serial.print(__TIME__);Serial.println("    *");
Serial.println("****************************");

rotor_1.attach(PINESC1);
rotor_2.attach(PINESC2);
rotor_3.attach(PINESC3);
rotor_4.attach(PINESC4);

arm();
}

//---------------------------------------------------------------------------------------------------------------------
void loop()
{
ReadKeybord();
rotor_1.writeMicroseconds(rotorMillis1);
rotor_2.writeMicroseconds(rotorMillis1);
rotor_3.writeMicroseconds(rotorMillis1);
rotor_4.writeMicroseconds(rotorMillis1);
}


//---------------------------------------------------------------------------------------------------------------------
void ReadKeybord()
{
int key = 0;

if(Serial.available() > 0)
{
key = Serial.read();

switch(key)
{
case '8': /// beschleunigen

rotorMillis1 = mapPWMtoMS(speed1 += 1);
Serial.print("Beschleunigen - ");Serial.println(rotorMillis1);
break;

case '2': /// abbremsen

rotorMillis1 = mapPWMtoMS(speed1 -= 1);
Serial.print("Abbremsen - ");Serial.println(rotorMillis1);
break;

case '5':
speed1 = 0;
rotorMillis1 =  mapPWMtoMS(speed1);
Serial.print("Stop - ");Serial.println(rotorMillis1);
break;
}
}
Serial.flush();
}
//---------------------------------------------------------------------------------------------------------------------
int mapPWMtoMS(int speed)
{
int _MS = 0;
_MS = map(speed, 0, 100, 1000, 2000);
return(_MS);
}

//---------------------------------------------------------------------------------------------------------------------
void arm()
{
Serial.println("Arming begins.");
delay(6000); ///?????
Serial.println("Now writing maximum output.");
        Serial.println("Wait 2 seconds.");
Serial.println("Arming ESC 1");
        rotor_1.writeMicroseconds(2000);
delay(2000);
rotor_1.writeMicroseconds(1000);
delay(100);

Serial.println("Arming ESC 2");
rotor_2.writeMicroseconds(2000);
delay(2000);
rotor_2.writeMicroseconds(1000);
delay(100);

Serial.println("Arming ESC 3");
        rotor_3.writeMicroseconds(2000);
delay(2000);
rotor_3.writeMicroseconds(1000);
delay(100);

Serial.println("Arming ESC 4");
rotor_4.writeMicroseconds(2000);
delay(2000);
rotor_4.writeMicroseconds(1000);
delay(100);

Serial.println("Armig is finished");
}
//---------------------------------------------------------------------------------------------------------------------

Not always run all the motors.
Sometimes only 1,2 and 3.
Sometimes only 1,3 und 4 or others.

I suspect it's the arm of the ESC's.
Can you help me.

Best Regards
Kucky
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not arm them all at the same time - perhaps they will time-out if not armed soon after power-up?
Logged

[ I won't respond to messages, use the forum please ]

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2512
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not arm them all at the same time - perhaps they will time-out if not armed soon after power-up?

Code:
void arm()
{
Serial.println("Arming begins.");
        rotor_1.writeMicroseconds(2000);
        rotor_2.writeMicroseconds(2000);
        rotor_3.writeMicroseconds(2000);
        rotor_4.writeMicroseconds(2000);
delay(2000); // might want to add more delay
rotor_1.writeMicroseconds(1000);
rotor_2.writeMicroseconds(1000);
rotor_3.writeMicroseconds(1000);
rotor_4.writeMicroseconds(1000);
delay(100);

Serial.println("Arming has finished");
}
Logged

Leverkusen
Offline Offline
Sr. Member
****
Karma: 4
Posts: 325
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the code. Now it works, strange. But I have the ESC's 2 times on and off and then reset the Arduino.
Willi
Logged

Pages: [1]   Go Up
Jump to: