Quick (easy?) Question

I am making a drone, and I need to have a variable that is the speed that of the brushless motor. I was wondering if this is possible? Thanks!

If you mean the actual motor speed in rpm then it's possible but it's not simple.

Steve

I was fairly sure that was true, but how can I do it?

Detect the rotation of the prop using an optical sensor

Why do you need to know the speed of the motor? You are, after all, controlling it, and probably 3 others, to respond to outside influences and it is usually the effect of changing the speed that you need to know rather than the actual speed ?

Depends what exactly you want your variable to contain and what the rest of your drone is. Since you've given zero information my best offer is you'll need to make some changes to your code and possibly add some extra hardware. Good luck.

I am using a 960 KV motor, with 40A ESCs, and I need to have a variable with the speed of the motor because I will be adding onto the current motor speed. For example if I want to go up and forward, I would have to make the back 2 motors move even faster relative to the speed of all of the motors, and I think it would be quite difficult to do that without a variable storing the speed of the motors. I am using a GY-521 module as the gyro/accelerometer, and a 2.4 Ghz radio receiver/transmitter. If you need more information, ask me, I should be able to answer your questions

From what you say you don't need actual speeds i.e. you don't need to know that M1 is doing 12000rpm and M2 is doing 13000. You just need to make each motor to move faster or slower than it is doing now.

Do you have any code yet that gets your motors to move at all? So do you know how to the motors what speed to go at? Once you know that the problem has more or less solved itself. Post what you have so far.

Steve

I have just started, but I can move the motors with this code:

#include <Servo.h>
Servo ESC;     // create servo object to control the ESC
int potValue;  // value from the analog pin
void setup() {
  // Attach the ESC on pin 9
  ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds) 
}
void loop() {
  potValue = analogRead(A0);   // reads the value of the potentiometer (value between 0 and 1023)
  potValue = map(potValue, 0, 1023, 0, 180);   // scale it to use it with the servo library (value between 0 and 180)
  ESC.write(potValue);    // Send the signal to the ESC
}

I am able to control the speed of the brushless motor with a joystick, but the number can't just be the value from the joystick, because we would also have to take into account the change in speed due to the self-correction code, so it would make life much easier to create a variable that could store the speed of the motor.

You will be aware of the motor speed commanded by the self correction code as well as the user input so I don't see the need to know the actual motor speed

Oh, sorry. You're right, I think I know how I'll do it now.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.