Sensorless (current sensing) BLDC control

I’m trying to control two small 24V BLDC pumps. I thought this SimpleFOC 3.2 Shield MKS Dual module from Amazon would work.

The pumps don’t have encoders. My understanding is that I can use the current sensor on the FOC module to adjust the speed. I don’t need to be able to control absolute speed, just relative speed once I see how much water its pumping at some setting. Am I correct about using the current sensor on the FOC module for reliable speed control?

Looking deeper on how the current sensor is instantiated in the Arduino code example, I see it seems to expect A0 and A1 pins on the ESP32 for current sensing.

LowsideCurrentSense current_sense  = LowsideCurrentSense(shunt_resistor, gain, A0, A1); // when measuring A and B phase currents and not measuring C

The ESP32 microcontroller is connecting to the FOC module over I2C (so just connecting SCL, SDA, gnd, 3.3V). It doesn’t seem like I’m meant to connect analog pins from the ESP32 to the FOC module to get current sensor data? Or have I misunderstood? The FOC v3.2 module has onboard current sensor already. I should be able to grab the current via I2C data?

Maybe I’m following the wrong Arduino code from an older version of FOC? One that assumes my application microcontroller has the current rather than the FOC module?

“Current sensing: ±33A On-line current detection: (1mR resistor for example)”

Onboard high precision current sensor.

Yes, the flux observer works well for speed control (and does give absolute speed).

You need to solder those SMD pin headers to the pads on the board and then plug the ESP32 into it. The SDA and SCL pins are for communicating from that ESP32 to other devices.

I can’t find a simple pinout image showing which pins are what, but it should be possible to sort it out from the schematic and example code here GitHub - makerbase-motor/MKS-DUALFOC · GitHub

Thanks, I’m pretty new to the electronics part. I was wondering why they gave me headers with bent pins! Thanks for spotting that I had things backwards.

I see that now - the SMD pin headers hook up PWM output pins on the ESP32 to the power electronics on the FOC module. Ok, less confused. Thanks so much.