• Hardware

    Vitaly10/26/2021 at 13:48 0 comments

    Schematic: https://oshwlab.com/speed/dc-speed-control

    Keep in mind, this is rework of https://hackaday.io/project/166492-grinder-speed-control-with-stable-rpm. Many things are very similar. Let's describe difference.

    MCU

    Currently, many chips become not accessible (very high priced). MCU is changed to  STM32G030F6P6. It has no USB support (no easy flash without programmer), but has low price and better performance.

    Appropriate components, related to USB uploader, are removed. Also, removed ADC power filter, because new MCU usees the same pins for digital & analog power.

    Motor's commutator

    For FFT-based frequency detector we need PWM instead of phase control. So, instead of triac we use rectifier + mosfet + anti-spike diode.

    • Cost is comparable.
    • Thermal loss is similar.
    • Size is a bit more high (due rectifier), but not significantly.

    Note, most of brushed motors (without magnets) are "universal". That means, those works well with both AC and DC power. In theory, those need some correction of winding count for DC power. But in real world, those work "as is".

    Current sensing shunt amplifier

    Since FFT-based algorithms are well resistant to noise and DC drifts, shunt amplifier is replaced with INA180A2IDBVR - more cheap and more easy to mount.

    AC-DC power

    Schematic is the same, but step down output increased to 5.5 volts for more stable mosfet control. Also, LDO replaced with more simple, supporting 6 volts input.

    Voltage sensor

    FFT frequency detector requires only value of current to work. No voltage sensor needed. Appropriate components are removed.

    Other advantages

    New regulator should be very flexible. For example:

    • Can be used to control 110 volt AC/DC brushed motors from 220 volts AC.
    • Can be used for DC low voltage tools. Just remove rectifier, step down converter and replace switch component for appropriate voltage/current.

  • Theory

    Vitaly10/26/2021 at 11:08 0 comments

    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.