# Theory

A project log for Brushed motor speed control with stable RPM

Uses brush current pulses to measure speed

When brushed motor works, brush commutations causes current peaks. If we can detect fundamental frequency. then speed will be:

` Speed = (frequency * 60 / poles) RPM`

Idea is simple - use FFT and find peak frequency. Also, we have to drop noise, produced by rectified power:

• 100/120 Hz (depends on country)
• harmonics up to 4 (up to 480 HZ)

Ordinary grinders have 8-pole motors and work in range 5000...30000 RPM. Some models - up to 45000 RPM. Desired range to measure is 670...6000 Hz.

# Real data

Repository at github has multiple dumps for different motor modes. We did simple scripts to quick-check math, and imported data to LibreOffice Calc (Excel) to build diagrams.

See images below.

• 16Khz sampling rate.
• 512 points FFT (32Hz per point)
• zeroed first FFT point for better scale

Current at high speed:

Current at low speed:

Spectrum at high speed:

Spectrum at low speed

As you can see, if we drop 0..500hz range (first 16 points), peak reflects RPM very well..

# Estimates

In ideal world, it would be fine to measure speed every 0.1 sec, with precision 1%. Let's check what we have in reality.

For FFT 512, Sampling rate 16384 Hz:

• Time to collect data: 512/16384 => 0.031 sec
• Precision at lowest speed (usually 5000 RPM), 32/16384 => 5%

Not as perfect as desired, but pretty well for real world. Any attempt to increase precision at low speed (via FFT size or resampling) will cause increase of total sampling period and going out of desired limits. Also, let be honest, added value of those extra efforts will be zero :).

# In total

For grinder motors, powered via rectifier:

• Make samples at 16384 Hz frequency,
• Use FFT 512
• Blacklist [0...500Hz] range, and find peak in the rest
• Use result for PID or ADRC.

Looks pretty simple.