-1
\$\begingroup\$

I am working on a project(quad copter) which includes speed control of a brushless motor with raspberry pi.

To control the speed of the motor, I will use PID controller, however I could not find a way how to read rpm from ESC. I have read some articles about brushless motors and ESCs, and I understand the principle they work on. I also know that some ESCs use Back-EMF to detect which coil to power.

I have been looking for relevant article on reading motor position or directly rpm from the ESC for quite some time now, with little success. I would be grateful if someone could explain it in detail how to do it, or send a python/c/c++ code example.

\$\endgroup\$
  • \$\begingroup\$ @Barney, Please don't post duplicate questions. You need to be specific in your first question. People looked at your question and couldn't answer it because it wasn't specific enough. Edit your original question and provide the information and get it reopened. \$\endgroup\$ – Voltage Spike Sep 1 '16 at 16:33
5
\$\begingroup\$

You are already using a speed controller. You tell it the speed you want and it does it. It doesn't make sense to wrap that within your own control loop that tries to regulate speed. You want to wrap it in a control loop that tries to regulate something higher level, like the copter's attitude, speed, etc.

\$\endgroup\$
  • \$\begingroup\$ Olin, do you live on this forum? LOL You answered before I could even submit a comment. That's what I call Fast Response! I agree - there's no point in trying to take control of the speed externally - that's the ESC's job. For a rough reference, you could measure the RPM at various throttle positions and use these values in other calculations... \$\endgroup\$ – Ryan Griggs Sep 1 '16 at 14:08
  • \$\begingroup\$ @RyanGriggs Olin is very active on SE. \$\endgroup\$ – user86234 Sep 1 '16 at 14:09
  • 2
    \$\begingroup\$ @tuskiomi Yes I know I'm just kidding him. :) \$\endgroup\$ – Ryan Griggs Sep 1 '16 at 14:09
  • \$\begingroup\$ To the ESC i am sending PWM with a given duty-cycle. Is duty-cycle = speed of the motor even under load? I am new to the world of ESCs . I would be grateful if you could explain what you just wrote more in details.@OlinLathrop @RyanGriggs \$\endgroup\$ – Barney Sep 1 '16 at 14:13
  • 1
    \$\begingroup\$ @Barn: ESC means electronic speed control. It is doing the speed controlling for you. You tell it how fast the motor should turn, and it takes care of it. If you're sending it PWM, then it may not be a speed controller, or it has some published relationship from duty cycle to speed. \$\endgroup\$ – Olin Lathrop Sep 1 '16 at 14:18
0
\$\begingroup\$

however i could not find a way how to read rpm from ESC.
I would be grateful if someone could explain it in details how to do it
To the ESC i am sending PWM with a given duty-cycle.

RPM can be calculated using the following formula, given the duty cycle mentioned and the type of battery you're using.

\$Rpm_{motor} = (KV_{rating}) * N_{cells} *3.7_{V/cell}* \frac{DutyCycle_{us}}{2000_{us}}\$

\$\endgroup\$
  • \$\begingroup\$ @tuskomi : Thank you \$\endgroup\$ – Barney Sep 1 '16 at 14:37
  • \$\begingroup\$ @Barney Any time. And to think that a moderator tried to delete this as they didn't think it was an answer. twice. \$\endgroup\$ – user86234 Sep 1 '16 at 14:46
  • 2
    \$\begingroup\$ This is misleading, and not the formula when a deliberate speed controller is being used. If the speed controller works from duty cycle, then its documentation needs to tell you what speed you get for what duty cycle. Your formula makes a bunch of unstated assumptions, then appears to be assuming the raw PWM is applied to the motor windings with a fixed 2 ms PWM period. Again, this is misleading at best. \$\endgroup\$ – Olin Lathrop Sep 1 '16 at 14:47
  • \$\begingroup\$ @OlinLathrop That's why a KV reading exists. All hobbyist brushless motors have a KV reading which will tell you How many RPM you get from a certain voltage (99.99% of the time, it's RPM/Volt). All hobbyist speed controllers are meant to adapt to the type of battery and KV rating of the motor, and use your duty cycle to control the motor based on the two. This is not misleading in the least. Given, I did assume that he was using lithium batteries for his copter, but I doubt that other batteries are even viable at this point. \$\endgroup\$ – user86234 Sep 1 '16 at 14:49
  • \$\begingroup\$ @OlinLathrop all hobbyist brushless speed controllers ^ \$\endgroup\$ – user86234 Sep 1 '16 at 15:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.