Read Pulse Of Built In Hall Sensor and Measure speed (RPM)

Hello I am here to asking about:

  1. How To Read Built In Hall Sensor Pulse of BLDC motors ( My BLDC have 3 Sensor hall, have GND,+5V, H1,H2,H3 pin)
  2. How to Measure Speed(RPM) BLDC motor with Built in Hall sensor, should i use 3 buiilt in sensor hall ??
    This is How i am wiring :
    *to measure speed or read pulse builtin hall sensor, it enough to use 1 hall sensor or we must use 3 of sensor ?

    and this my Arduino Code i found on internet:

</>

int ENCA = 2;
int encoderPos = 0;
float rpm;
unsigned int waktulama1, waktusekarang1; // variabel deklarasi waktu update kecepatan encoder;



void setup() {
  // put your setup code here, to run once:
  pinMode (ENCA, INPUT_PULLUP);
  Serial.begin(9600);

  attachInterrupt(digitalPinToInterrupt(ENCA), readEncoder, RISING);
}

void loop() {
  // put your main code here, to run repeatedly:
  waktusekarang1 = millis(); // time now
  if (waktusekarang1 - waktulama1 >= 1000) {
    waktulama1 = waktusekarang1;

    Serial.print("nilai pulse : "); // measure pulse
    Serial.print(encoderPos);
    rpm = (encoderPos * 33.33 / 10); //Measure RPM
    Serial.print("   nilai rpm : ");
    Serial.println(rpm);
    encoderPos = 0;
  }
  delay(50);


}

void readEncoder() {
  int a = digitalRead(ENCA);
  if (a > 0) {
    encoderPos++;
  }
}

But after tryin this code, i dont know this code correct or not, cause i am new on arduino

so, anyone know how to read pulse Builtin hall pulse to measure speed(rpm) of BLDC motors
thank you

Your duplicate topic on the same subject has been deleted. Why did you start a new topic ?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

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