Speed & Position Control – DC Gear Motor with Encoder | MOT 6

preview_player
Показать описание
It’s time to make the motor project more practical. Let’s use a DC motor with integrated encoder module and gearbox – This motor can deliver a lot more torque than the previous one! While testing this hardware, we also improve the control loop running on the ATMEGA328P (Arduino Nano).

#Motor #Encoder #PID
Next topics: Control Improvements & Modbus Integration

Links:

Support EE for Everyone:

Amazon Associate Links (featured products – paid links):
“As an Amazon Associate, I earn from qualifying purchases.”

0:00 Introduction
0:40 Open Loop Speed Control
2:05 Speed and Position Control
4:00 Improved Controller Performance
4:31 Conclusion
6:53 Attempt at Improved Position Control
Рекомендации по теме
Комментарии
Автор

The Arduino only has I think 2 interrupt pins which you want to use for the encoder to get the best resolution out of it. Other micros like a Teensy would be a better option with more hardware acceleration. I think the STM32 black pill micro even has a hardware encoder module that keeps track of the position and can be enabled in ST Cube MX.

And yes, control systems can be tough. With a motor you have nonlinear effects such as saturation (maximum speed/acceleration/jerk), backlash on the gearing, torque ripple, friction in bearings and brushes, etc. A permanently excited DC motor will have a linear torque to speed response when driven with a constant voltage supply. That is it will have a maximum stall torque (0 RPM) and maximum no-load speed (no torque) and a straight line connects the two. Analogous to a voltage source with a series resistance, if you compare speed/torque to voltage/current. You can use this fact to implement some feed-forward to compensate without need of feedback.

Your job as the controls system engineer would be to model the system and develop a control system that can keep it stable. To do it right you would need to have some knowledge in control systems theory, digital signal processing, Laplace/Fourier domain, Z transforms (like the bi-linear transform), stability criteria (BIBO), phase and gain margins, nyquist stability criterion, etc. Really it is just black magic design.

power-max
Автор

Your struggles brings me back to my industrial commissioning days... fine tuning control loops with really expensive hardware

MellexLabs
Автор

Good work, its fun to the evolution!

As you mentioned control loop times, i can relate to a similar realization when i was working as an electrician.
There was a three phase motor with gearbox and mechanical break,
whenever a button was pressed a contactor closed and the motor rotated until an inductive sensor signaled to the control system and the contactor opened, got called out that it was not behaving as it should, it was stopping a bit randomly, often past the sensor, or making more rotations. First thought was that the brake had failed, so without to much troubleshooting i said to the mechanics to replace it.

After replacing the motor with a brand new one, it did exactly the same thing. so a bit embarressed, i was pondering the problem and with some doubt i checked the PLC application scan time, lo and behold it was 100ms IIRC. I concluded that we should try and reduce it, and i got met with some scepticism by the programmers who were sure that it should work and the problem was the motor/contactor.
But we made the change after some back and forth, reduced it to 50ms or less and it worked perfectly every time.

So yeah the problem was that either it scanned at the tail end of the sensor pulse, or missed it entirely, so a few MS make a big difference in motor control.

Ghoetic
Автор

Great work dude ! could you share the code?

woldecosgrove
Автор

How to make that kind of graph from the Arduino.

kutiesgalatta
Автор

Hey man ! Good vid, I have a project I'm struggling with where I need to control the exact same type of motor. Is there any way to get your code to do some testing ? Thanks.

toolkittt
Автор

And you haven't shown your code ...

lohikarhu
Автор

is it possible to operate this motor with a speed of 0.3rpm?

PresanaM-il
Автор

I am using same kind of motor, can i get the code please? thank in advance

bharanikrishnakumar