setting the speed of a brushless DC motor / ESC with an Arduino (not trimpot)

I need to use an Arduino (Nano) to set the RPM of a BLDC motor with an ESC to a specifc value. There are numerous tutorials on setting the speed with a potentiometer, but I instead need the RPM value set in code.

I believe I need a Hall sensor or photo sensor to measure the RPM and keep adjusting the PWM signal until the Hall sensor measures the RPM I need (PID?).

I guess my question is twofold,

  1. How sould I use the Hall sensor to measure and set the RPM?
  2. What accuracy can I expect from both the Arduino and generic ESC? +-1 RPM or more?

uhih:
I need to use an Arduino (Nano) to set the RPM of a BLDC motor with an ESC to a specifc value. There are numerous tutorials on setting the speed with a potentiometer, but I instead need the RPM value set in code.

I believe I need a Hall sensor or photo sensor to measure the RPM and keep adjusting the PWM signal until the Hall sensor measures the RPM I need (PID?).

I guess my question is twofold,

  1. How sould I use the Hall sensor to measure and set the RPM?
  2. What accuracy can I expect from both the Arduino and generic ESC? +-1 RPM or more?

Welcome to the Arduino forum with an interesting problem.

First, you have not identified the clock to be used to give you an accurate time for measuring the revolutions. And second you need to confirm that the load on the motor will never vary. And third, you need to verify the temperature of the motor and other components will never vary.

Your RPM requirements seem a bit tight.

Paul

What motor and what ESC? How variable is the load on the motor? And particularly what speed are you aiming for? If you're hoping for 10,000rpm +/-1rpm, no chance. 100rpm =/-1rpm, difficult but perhaps possible.

Can't you use a sensored brushless motor that already has hall sensors fitted?

Steve

And yes, to your question, PID will be involved.
You will use the output of the PID calculations to set the ESC command.

Also, Yes, please do tell us more about your project. Others have mentioned that you told us nothing about the load on the motor. I am adding my request for more information.
What load will be on the motor?
What RPM are you looking to maintain?
What is the overall project?

Hey. Sorry, here is the needed info:

  1. The load is ~100 grams, static (not variable)
  2. target RPM: 2800
  3. overall project is a swept volume display: Swept-Volume 3D Display - YouTube
    Volumetric 3D Display - YouTube

I have the code for rendering the 3d voxel stuff on the PC side up and running just fine but don't have as much experience in the Arduino/mechanical engineering department.
I could use a sensored BLDC motor but want to keep every component as cheap as I can get away with. The 3d engine is free and open source and the modified pico projector is very cheap as well.

I understand ESC as Electronic Speed Control, and would simply tell the ESC the speed to maintain.

I think ESC expects a PWM rather than integer or similar with the RPM value.
Even then I've heard motors vary from unit to unit so one PWM on one motor may provide slightly different RPM than on another motor from same manufacturer and same production batch. But I may be wrong.

Right, each ESC may interpret the PWM/PPM signal slightly differently. Then it's up to you, the user, to determine the true duty cycle for a given speed once, and calibrate your speed signal to that particular ESC accordingly. But if two ESCs of the same brand behave significantly differently, I'd consider at least one of them broken.

I'm not sure if it's just the ESC or the also individual BLDC motor itself that has slight variation.

Is a hall sensor good enough to calibrate the speed signal or is a photosensor more accurate for this job?

uhih:
I'm not sure if it's just the ESC or the also individual BLDC motor itself that has slight variation.

Is a hall sensor good enough to calibrate the speed signal or is a photosensor more accurate for this job?

I would imagine either would suffice.

It may be an advantage to choose a low kv motor for better control.