Speed and Position Control on a DC Brushed Motor With a PID Corrector From Z-Transform

by manu4371 in Circuits > Arduino

374 Views, 2 Favorites, 0 Comments

Speed and Position Control on a DC Brushed Motor With a PID Corrector From Z-Transform

PAGEDEGARDE.jpg

In my previous Instructables files I conducted works on 2 different kind of electrical motor: a high power hybrid stepper motor and a triphase brushless motor. On both of them I also manage to control speed and rotor position.

So my new goal: the famous and much-easy-to-control DC BRUSHED MOTOR in the same ways of "domestication".

This kind of motor is still in use but more and more replaced by brushless motor or servo-motor.

Supplies

STUFFS.jpg
IMG_5094.JPG
IMG_5095.JPG
IMG_5099.JPG
IMG_5096.JPG
IMG_5097.JPG
IMG_5098.JPG
IMG_5100.JPG

So you need some basic components:

-a DC Brushed Motor: here ESCAP 28LT2R-416E (21W, 36VDCmax) +rotary encoder HEDS5540 (500 pulses/trn)

-a dual or not H-BRIDGE made of MOSFET IRF3205 10A / 30A max

-a microcontroller Atmega1284 or 1284p or 644 (may be) mounted on a DIY board (Arduino clone)

-a LCD display+I2C board

-a DC power supply 12V DC

-a DIY pushbuttons/LEDs board

-a FT232RL FTDI TTL/usb converter: serial read speed and position

-an USBasp board: upload program

-Arduino IDE including MightyCore library

-the freeware SerialPlot: displaying serial speed and position

Wiring Diagram and Block Diagram of the System

BLOCKDIAGRAM.jpg

Follow the wiring diagram to build your system.

You can model the system with the diagram above:

  • a PID corrector is needed for quick response, accuracy and stability (Proportional, Integral, Derivative)
  • with Z-TRANSFORM you can develop a sort of mathematical suite really easy to program on arduino IDE
  • no need to know the transfer function of your motor except some features on its datasheet

Downloads

Choices to Make and Tests

In order to realize such a project, you need to know some mechanical and electrical features on your motor. These features allow you to choose:

  • the right PWM freqency
  • the sampling time of the PID corrector.

I tried to use the famous PIDlibV2.h available on Github and there were many problems to include it in my program: too many interferences with I2C/TIMERS/PWM/interrupt.

Also, this microcontroller must be powerfull to run in "pseudo multitask mode" a lot of stuffs.

I give you too 5 programs:

  • 4 programs for speed control at 4 different sampling times (50, 20, 10 and 8ms),
  • 1 program for rotor position control with a 8ms sampling time.


Conclusion

The sampling time must not be too high because it makes the microcontroller overload and some functions may be dysfunctionning.

The PWM frequency must be over 20KHz (audible noise).

It takes a month to achieve it but it was really a rewarding project melting power electronics/automation/regulation and control/advanced programming.

Thanks to all valuable tutorial over the net.

Happy Instructables!!!