Brushless speed mesureament

Hi,

I am developing a motor test bench and I need to know the motor speed. I don't have a hall effect sensor so I connect one of the phasis of the motor to the Arduino (through a voltage divider) and I tried to measure the speed.

I take 1000 adc samples and I detect rising edge. I count around 140 rising edges in 112ms (1000 samples) and then we can compute the speed easily.

With 1000 samples the accuracy is 77 rpm at a frequency of 9Hz.

The problem I have is the stability!

As you can see in this picture, there is a lot of noise. I don't know if it is a problem of mesureament or of the motor.

I also plot the raw adc data, as you can see there is noise but I think it is possible to count the number of rising edge.

Do you have an idea of the problem?
Do you have a library to detect rising edge with the ADC?

Thank you.

You are catching significant noise spikes intermingled with the data. However you know that the motor speed isn't going to change abruptly so you only need some bandpass filtering to eliminate the noise.

However you need to be able to tune the bandpass to track the speed of the motor - this is where it gets tricky/interesting.

In software rather than in analog electronics you have all the techniques of digital filtering available, which is a daunting list.

I'd suggest a simple technique of keeping a best-estimate of the current speed (or equivalently period) of the signal and then use this to determine which zero-crossings are signal and which are noise - and you may need to emulate missing zero-crossings too. Every few crossings your estimate of the current period needs to be updated using the good data only.

Actually this won't work from standstill, so you'll need special cases for start/stopping.

In analog electronics this is exactly the sort of application for a PLL (phase-locked loop), so try googling about them for more ideas.

Hi,

I solved the noise problem. I plug the analog input on a transistor pin of the ESC instead of one phase of the motor.

Now it should be easier to measure the frequency with a higher precision.

But I still have a problem. I took 500 adc samples and I count the number of rising edge. The problem is the resolution, I can measure the speed with a resolution of 150rpm at 18Hz (with 500 samples) but I would like to increase the resolution.

Do you have an idea to solve this problem?

Thanks a lot.

I know it would involve more hardware but you could simply run the signal through a simple comparator (op-amp) which show a state change a certain voltage in the phase. You could probably use the slope to trigger an interrupt each time and count the time between interrupts.

But I still have a problem. I took 500 adc samples and I count the number of rising edge. The problem is the resolution, I can measure the speed with a resolution of 150rpm at 18Hz (with 500 samples) but I would like to increase the resolution.

Do you have an idea to solve this problem?

Count for longer - or take accurate timings of the zero crossings (external comparator rather than onboard ADC)...

I don't want to use extra hardware.

I manage to reach good performance:

At 10 000rpm the resolution is now 19 rpm at a sampling rate of 19Hz
At 3 000rpm the resolution is 2 rpm at a sampling rate of 5Hz.

The only problem is that the sampling rate depend of the motor speed. I think I will change it to have a constant sampling rate. (it is easier to measure response time)