Build a Custom Servo Motor with a DC Motor

preview_player
Показать описание
Today I’ll convert a DC motor into a custom servo motor using a Seeeduino XIAO. Plus, we’ll learn about using PID controllers. This is a special project that I’m working on with Jeremy Fielding.

Servo motors are used in many hobby and experimenter applications. From radio-controlled aircraft to robot dogs, these motors are used whenever you need to be able to precisely position a motor shaft.

But most hobby servos are small devices, and even “large” hobby servos are not really all that large, and can only supply a limited amount of torque. Plus, larger servos generally mean a larger price tag.

Another limitation for some designs is that hobby servo motors are usually limited to either 180 or 270 degrees of rotation.

So why not build one ourselves? After all, internally, a servo motor is simply a DC motor with a control and feedback circuit. And you can buy, or salvage, a large DC motor for a lot less than the cost of a big servo motor.

Today, I’ll show you how to convert a DC gear motor into a custom servo motor. One that can rotate exactly to suit your requirements.

I’m doing this in tandem with Jeremy Fielding, a YouTuber with incredible mechanical and design skills. Jeremy is building a “self-driving go-kart”, and for his steering system he will need a big servo motor that can spin a full two turns (720 degrees).

I’ve come up with a design that uses a Seeeduino XIAO and a 10-turn potentiometer. While I’m driving a fairly powerful motor driver, you can substitute a smaller, and less expensive one if you don’t require the big motor Jeremy requires in his design.

Incidentally, a potentiometer isn't the only method of sensing shaft position, it's just the cheapest (and probably most common) method. The article accompanying this video has a few other sensor types that can be used, and we'll be looking at those in future videos and articles.

Here is the table of contents for today's video:

00:00 - Introduction
03:17 - Custom Servo Design
06:39 - Servo Test Setup
09:20 - Controller Design with Seeeduino XIAO
14:17 - Input Test Code & Demo
19:47 - Endpoint Test Code & Demo
22:57 - PID Controllers
28:58 - PID-based Servo Controller Code & Demo
39:19 - Conclusion

Jeremy’s “self-driving go-kart” is a project that is being built in tandem with my 6-wheel rover, so you’ll be seeing more collaborations in the near future.

Рекомендации по теме
Комментарии
Автор

Hi everyone - It's come to my attention that there has been someone masquerading as myself, responding to some comments here with a link to a Telegram chat to win a prize from me. THIS IS A SCAM, I am not holding a contest, nor do I have a Telegram account. PLEASE DO NOT RESPOND TO THESE MESSAGES!!


Thanks!

Bill (The real one!)

Dronebotworkshop
Автор

I am so glad we finally got to start making something together after talking all this time. I look forward to continuing the series! And great video as usual.

Jeremy_Fielding
Автор

Sir, I stumbled upon your channel looking for DIY projects, and I cannot be more than thankful for all the time and effort put in the content.
No annoying (techno/pop) music, No only-hands-pointing-to-objects-without-any-description, No wobbling camera, No rant/obscene/offensive content, etc.,
You take the time to explain all the things related to each project, and the information is easy to understand and the projects are easy to work even without the deep knowledge.
This is the 8th video so far I've watched in the last 2-3 days. This channel is what Youtube should be bringing up in their algorithm, not the other crap that shows twice or more on each search.

I'm glad I found and subscribed.

jaimerosariojusticia
Автор

Totally agree that Jeremy Fielding is a genius. Not only that, but he’s a very humble guy who doesn’t assume you know how something works, and explains every step. He’s also a great father to his children, involving them at every stage so that they will have a thorough understanding of Electro-mechanical engineering. He’s the “go-to” guy when it comes to modelling.

tomthumb
Автор

Title was awesome to begin with, didn’t know it was for Jeremy, another one of my favorite YouTubers. This will make him happy and filled with joy like a child.

arthurmorgan
Автор

Thank you for guiding us to Jeremy for increasing our skills morely

ishimwehonore
Автор

I was controlling a dc motor to move a heater door on a vehicle that voltage varies from 12.8-14.3 volts dc. Using a standard actuator or pot for feed back. On the dash, it can be rotary or linear. This a custom built air distribution box in a 1967 pickup and just adjust heat from closed to wide open and anywhere in between. Enjoyed the channel & Jeremy.
ASE Master Tech since 1978, retired.

deankay
Автор

Love seeing two channels working together. Both great channels

josephpennella
Автор

Am so glad that you and JF are buddies. I follow his channel. This project is thoroughly engrossing. Thank you!

sinjhguddu
Автор

I have watched a lot of Jeremy videos. Very smart guy.

jamescullins
Автор

Fantastic! Thank you!!!
I drive a Tesla and have marveled at the steering and the lack of overshoot. I’m pretty sure the Teslas uses the PID logic (which I heard of here first) and your explanation of the three components of the PID system was very enlightening. It also gives me motivation to dig a little deeper in the PID thinking.
Thanks for helping Jeremy and his fantastic workshop. I’m eagerly awaiting his second video to see how he fixed the broken steering shaft. Giving him a couple of nights to think of solutions will yield interesting results. 🤔

pbostonRR
Автор

This video came up in my feed with almost perfect timing as I am currently working on a couple of projects requiring custom servos that Ebay just cannot provide.
Thank you for this.

EsotericArctos
Автор

These are two of my favorite electronic channels . Jeremy is smart guy and also does a great job explaining things to you. Looks like you got got a fly by wire system.

rosie
Автор

Bill, your explanation of PID was one of the best ones I have seen. I would like to argue though that there is a critical fourth parameter that always gets minimal, if any, attention. That fourth parameter is Calculation Interval. In any controlled operation there is latency; it takes time for a motor to spin up and move to a new position. A program loop running on a microcontroller will almost always execute many times faster than the actuator's operational latency. It will remeasuring a new actual position and calculating a new error and output before the motor has reached the position commanded by the previous calculation. This new calculation will be based on the incorrect assumption that the new measured position was the result of the previous calculation. This mistake will lead to runaway actuator behavior. It would seem from your demonstration that you are addressing this in your code somewhere, but I cannot find it. It would seem to me that it is critical when explaining how to employ a PID controller to address how the latency of the system being controlled.

I love this series and this collaboration. I am trying to build a rover a little larger than Jeremy's so I will be following closely!!

kbouwman
Автор

You were right about Jeremy, he is a genius.

alandavis
Автор

This is one of the key components i''m using on my autonomous tractos project. Thanks for sharing!

eternalxpectator
Автор

Best channel in the business for this content.

Nick-yekk
Автор

Man I love the way you explain everything like a great teacher would do!

jasonruch
Автор

Another great video Bill. Thank you. I have been looking for closed loop DC motor control for years and just came across this video. This is what I need, except for the feedback. I have been a CNC tech for over 35 years, so "back in the day" all servo control was done with DC brushed motors, but now in these "modern" times it has moved into AC Servo motors. However, all industrial CNC machines use encoders to close the loop. Even China has been selling these cheap DC gear motors, with encoders, but there is not one person yet that has utilized this for any control. I want to control shades, windows, doors, DIY CNC, and anything to control linear motion with cheap DC closed loop. Would you please consider a video with H-bridge DC gear-motor, with encoder, to close the loop. It is needed more than most people think. lol

rhudithomas
Автор

If I will find a second so interesting channel it make me go out of my everday work!! - no time at all.

nixo