# How I can measure voltage on BLDC motor controlled by ESC 30 A and arduino

#### agnimusayoti

Joined Apr 26, 2021
14
Hi guys.
I have a college project to make fan. I used drone's propeller and BLDC motor. This motor is controlled by ESC 30 A and I was using arduino and a 10k potentiometer.
I got the code from YouTube.
But, in that code, I can't provide the BLDC voltage at certain position of potentiometer.
This is my code:

Arduino Brushless Motor Control:
#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 10
ESC.attach(10,1000,2000); // (pin, min pulse width, max pulse width in microseconds)
Serial.begin(9600);
}
void loop() {
potValue = analogRead(A1);   // 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
Serial.println(potValue);

}
What should I modify so I can know the BLDC voltage? Thanks pal.

#### KeithWalker

Joined Jul 10, 2017
1,947
Hi guys.
I have a college project to make fan. I used drone's propeller and BLDC motor. This motor is controlled by ESC 30 A and I was using arduino and a 10k potentiometer.
I got the code from YouTube.
But, in that code, I can't provide the BLDC voltage at certain position of potentiometer.

What should I modify so I can know the BLDC voltage? Thanks pal.
Why do you need the voltage of the motor? It is the supply voltage switched on and off by a series of pulses to each phase of the motor. Only the length of the pulses change with the position of the potentiometer, not the voltage.

#### agnimusayoti

Joined Apr 26, 2021
14
Hmm, I think from the bLDc voltage, I can convert to get the angular speed of propeller. Here the case, I actually want to know at what rate my propeller swing.

But from your response, another question arose. What is the number in the serial monitor? What kind of relation with the potentiometer?

#### KeithWalker

Joined Jul 10, 2017
1,947
The program that you listed does not communicate with the serial monitor.
The ADC in the Arduino gives a number fron 0 to 1023 for an input range of 0 to 5VDC. If the potentiometer is connected between the +5V supply and ground, the voltage on the slider will vary between these voltages depending on its position.
The simplest way to get the speed (or angular velocity) is by using a tachometer. Connected an LDR in series with a 10K resistor. Connected them across the 5V supply. Position it so that ambient light striking the LDR shines through the arc of the propeller. Connect the junction of the LDR and resistor to a digital input pin on the Arduino and read the pulses Look up "Arduino frequency meter" for information on how to program it.
Don't forget to divide the result by the number of blades on the prop and remember to keep your fingers out of it!

#### agnimusayoti

Joined Apr 26, 2021
14
the "serial..." Code communicate with serial monitor, doesn't it?

Ohh, I see. So for example if the monitor show 1000, equivalent with 1000/1023 * 5 V?

#### KeithWalker

Joined Jul 10, 2017
1,947
the "serial..." Code communicate with serial monitor, doesn't it?

Ohh, I see. So for example if the monitor show 1000, equivalent with 1000/1023 * 5 V?
Yes.