Build a Custom Servo Motor with a DC Motor

Поделиться
HTML-код
  • Опубликовано: 24 июл 2024
  • 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.
    You can check out Jeremy’s video here - • Building A Self Drivin...
    Article with all the code: dronebotworkshop.com/custom-s...
    More articles and tutorials: dronebotworkshop.com
    Join the conversation on the forum: forum.dronebotworkshop.com
    Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/
    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 RUclipsr 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.
    Make sure you check out Jeremy’s video at • Building A Self Drivin...
  • ХоббиХобби

Комментарии • 179

  • @Dronebotworkshop
    @Dronebotworkshop  5 месяцев назад

    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!!
    It's happening on a lot of my videos, I'm taking steps to remove them manually, but as I have 162 videos, it will take some time. If you do run across a suspicious comment, I would appreciate you letting me know at info@dronebotworkshop.com.
    Thanks!
    Bill (The real one!)

  • @JeremyFieldingSr
    @JeremyFieldingSr 2 года назад +152

    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.

    • @thomaslum2
      @thomaslum2 2 года назад +12

      Big fan of both of your channels! Awesome.

    • @Leroys_Stuff
      @Leroys_Stuff 2 года назад +3

      I’m glad this happened. Great project both of you

    • @PhG1961
      @PhG1961 2 года назад +2

      Excellent cooperation of 2 of my heroes ! Awesome video !

    • @bigsteve6729
      @bigsteve6729 2 года назад +1

      Cool didn't know this will check it out

    • @tombudd1281
      @tombudd1281 2 года назад +1

      I've been watching your videos for a while. It's good to see you getting more exposure :)

  • @jaimerosariojusticia
    @jaimerosariojusticia 2 года назад +14

    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 RUclips 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.

  • @tomthumb3085
    @tomthumb3085 2 года назад +11

    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.

    • @m3chanist
      @m3chanist Год назад

      Agreed on all points. He is a wonderful man. You'd be lucky indeed to have his acquaintance.

  • @arthurmorgan8966
    @arthurmorgan8966 2 года назад +1

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

  • @stevenpwilliams
    @stevenpwilliams 2 года назад +4

    You do just incredible videos, as does Jeremy! Can't wait to digest this, and see further collaborations! Love both of your work!

  • @josephpennella3396
    @josephpennella3396 2 года назад +4

    Love seeing two channels working together. Both great channels

  • @EsotericArctos
    @EsotericArctos 2 года назад

    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.

  • @pboston6RR
    @pboston6RR 2 года назад +1

    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. 🤔

  • @ishimwehonore8042
    @ishimwehonore8042 Год назад

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

  • @sinjhguddu4974
    @sinjhguddu4974 2 года назад

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

  • @uwe.herting.37431
    @uwe.herting.37431 2 года назад

    I especially love the code you wrote. Simple and very effective. Great work!

  • @ardespmaker
    @ardespmaker 2 года назад

    Thanks for this Bill - such good quality and simply put - worth waiting for!

  • @whatwhatdidtheysay...lyric2373
    @whatwhatdidtheysay...lyric2373 2 года назад

    OMG! Perfect timing! Im undertaking a project just like this. Great video, excellent job!!!! And a very practical real-world purpose

  • @eternalxpectator
    @eternalxpectator Год назад

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

  • @1607rosie
    @1607rosie 2 года назад +1

    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.

  • @deankay4434
    @deankay4434 11 месяцев назад

    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.

  • @jasonruch3529
    @jasonruch3529 2 года назад

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

  • @jamescullins2709
    @jamescullins2709 Год назад

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

  • @paulramasco6769
    @paulramasco6769 2 года назад

    This is awesome, Two of my favorite Makers on youtube.

  • @glensharp3275
    @glensharp3275 2 года назад

    Thanks for this great video! It gave me a good understanding of how to use the PID library.

  • @Nick-ye5kk
    @Nick-ye5kk 2 года назад +1

    Best channel in the business for this content.

  • @narayan6911
    @narayan6911 2 года назад

    Thats the video i am looking for so long. Thnks for detailed explanations ❤️👍

  • @petermolnar6017
    @petermolnar6017 2 года назад

    As always superb! Thank you!

  • @danieldivinsky4988
    @danieldivinsky4988 2 года назад +1

    Your videos are just fantastic!

  • @isidorovazquez6968
    @isidorovazquez6968 2 года назад

    Awesome video, learned a lot with it. God bless you!

  • @yoashuain1
    @yoashuain1 Год назад

    Yes, Jeremy is awsome.😁😎

  • @rhudithomas7582
    @rhudithomas7582 2 года назад +1

    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

  • @tubeDude48
    @tubeDude48 2 года назад

    Bravo Bill !! Great and helpful video. I subscribed to Jeremy's site immediately! Thanks.

  • @bradlesc1000
    @bradlesc1000 2 года назад +1

    I'm so excited to go through your stuff, I'm a 4th year mechanical engineering student and I'm about to take mechatronics so this should be fairly useful. Jeremy sent me btw this collab is cool!

  • @OGMann
    @OGMann 2 года назад

    Timely, as I just snagged a 24vdc 3a 2560 rpm motor from the maker shop. It's part of an armchair lift actuator. I was considering using it in a CNC hack, and using a circuit like this is exactly what I had in mind.

  • @nixo0077
    @nixo0077 2 года назад

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

  • @damsaddles9911
    @damsaddles9911 2 года назад

    Excellent explanation. Thank you

  • @studentofedison421
    @studentofedison421 2 года назад

    Thanks for this video

  • @scualo00
    @scualo00 2 года назад

    Nice video and grate explanation, thanks!

  • @JLCPCB
    @JLCPCB 2 года назад +1

    Great episode! Also very good explanation of PID control! 🙂

  • @piconano
    @piconano 2 года назад +13

    I was hoping you were going to make a servo with an optical encoder attached to the motor shaft of a NEMA stepper motor.

  • @AGR472
    @AGR472 6 месяцев назад

    That’s really cool

  • @tolikche
    @tolikche 2 года назад

    Thanks for the video. You can also use simple diode like 4148(cathode facing 5v side ) with a pull-up resistor on 3v3 side as a cheap and simple one-directional level convertor.

  • @miyesisandella1479
    @miyesisandella1479 2 года назад

    very useful gear set

  • @jacknewzeland4913
    @jacknewzeland4913 2 года назад

    This is an awsome video!!👍

  • @youtubeworldlk7650
    @youtubeworldlk7650 2 года назад

    very useful drive shaft

  • @BeefIngot
    @BeefIngot 2 года назад +1

    I mentioned this on his video as well, but figured it might be use to someone here too:
    There is a really cheap alternative to traditional potentiometers called a magnetic absolute encoder. The typical one I have found that is cheap is called a AS5600 magnetic encoder. It can be had for about 2 bucks, and has a little breakout board where you either can get the same sort of signal you get from a potentiometer or receive data from I2C. It has sub degree accuracy, and won't fade and become less accurate over time like the wipes of a potentiometer.
    Actually I think I might be talking about what's talked about in the article as Hall Effect Sensors

    • @jrkorman
      @jrkorman 2 года назад

      I was wondering the same. Thanks for bringing it up.

  • @michaeljoshuamanallo1742
    @michaeljoshuamanallo1742 2 года назад

    I been waiting for this

  • @woodrowbrimm2805
    @woodrowbrimm2805 10 месяцев назад

    For those interested in more information on P.I.D. Controllers are also used with Type K Thermocouples and Relays to Control the Melt Temperature for Bullet Casters o greatly improve Temp. Consistency and improve uniformity by bullet caster to control the Melting Pot. There are several you Tube Videos about building them and Amazon has all the parts.

  • @electronic7979
    @electronic7979 2 года назад +1

    Helpful video. I liked it

  • @primecouncil6475
    @primecouncil6475 2 года назад

    i hope i will be able to adapt this knowledge to make robotic joint out of hydraulic valves and my cheapass muscles
    anywho, thanks for the video and huge effort of making it!

  • @sefamil9372
    @sefamil9372 2 года назад

    Very good

  • @kbouwman64
    @kbouwman64 2 года назад +2

    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!!

    • @prestonknodelliii838
      @prestonknodelliii838 2 года назад

      If the digital sample rate is high enough (with enough averaging) this will not happen. Mathematically there are 3 possible solutions : critically damped, underdamped, and overdamped. It will be stable if the PID is tuned overdamped near critically damped. It can oscillate if underdamped. There are mechanical issues also, : gear lash and natural resonance.

  • @wardogdauwdd3020
    @wardogdauwdd3020 2 месяца назад

    This is vary helpful I been looking for a video like this to help with my robotics project I'm building a custom show time animatronic

  • @bountyjha
    @bountyjha 2 года назад

    U r the most wonderful person on earth. U shoud make videos on PID. It would be really nice for students.

  • @alandavis6429
    @alandavis6429 2 года назад +3

    You were right about Jeremy, he is a genius.

  • @Bianchi77
    @Bianchi77 2 года назад

    Nice video, keep it up, thank you :)

  • @crazytronics9917
    @crazytronics9917 2 года назад

    Thanks a lot i am also working on it and i face some troubleshooting , this video will help me lot.
    Also i request you to please make video on FOC(Field operation control)

  • @shuvra4352
    @shuvra4352 2 года назад

    Great video on this sub.

  • @murraymadness4674
    @murraymadness4674 2 года назад +1

    I would think to use a stepper motor with a position encoder (can be a pot).
    I'd also note that I took apart a small r/c servo and used it to power a bigger dc motor.

  • @abbeed1
    @abbeed1 2 года назад

    thanks

  • @sabitklcaslan6652
    @sabitklcaslan6652 2 года назад

    İşinin ehli bravo

  • @NZHippie
    @NZHippie 2 года назад

    Great video Bill, at the beginning of the video you outlined the requirements of 720 degrees of rotation yet while explaining the endpoints sketch the rotation was only 120 degrees, I assume that you doing so was that it would be the common servo movement range and not the specific project requirements...

  • @andrewbarnard3229
    @andrewbarnard3229 2 года назад

    have you played with the serial wombat io expansion chips? would love to see them used in a project. i have ordered a couple sets now and find them awesome to use especially with small microcontrollers where space is a factor.

  • @tulaydemir9355
    @tulaydemir9355 2 года назад

    Video içi teşekürler

  • @oguzdinc7664
    @oguzdinc7664 2 года назад

    great 😊

  • @braddixon3338
    @braddixon3338 2 года назад +5

    Another great episode! What I really find valuable in these, are the libraries and commands that are kind of hard to find out otherwise. As a question, I'm not sure why you called the D component of the PID a dampening element, as it is producing an output proportional to the rate of change of the input. The faster something is moving, the greater the output. I suppose you could use a negative Kd value to subtract a rapid motion, so slow things down.

    • @Enigma758
      @Enigma758 2 года назад

      D helps prevent oscillations via "prediction". It actually is related to damping.

  • @jrkorman
    @jrkorman 2 года назад +1

    Bill, I signed up for the newsletter about 2 years ago, received several through early 2020 and nothing since. I've resubscribed, but a question. Are the newsletters archived so one may read old letters? Thanks. As an aside, glad to see you working with Jeremy, he's quite a talented fellow!

  • @ahmetsahin1250
    @ahmetsahin1250 2 года назад

    Nice

  • @mrobi5797
    @mrobi5797 2 года назад

    Awesome video. On a different note, have you ever made a video on the Canaduino Full-Automatic Bootloader Programmer for Atmega328P?

  • @okanowl633
    @okanowl633 2 года назад

    Very Good Çok Íyi :)

  • @pascallavanchy1642
    @pascallavanchy1642 2 года назад

    Hello DroneBot team,
    thanks for this wonderfull tuto.
    I did it with my son for one of his project......works great.
    I have a quick question that i'm trying to solve.
    I use a small 12v actuator and drive it with the arduino.
    when approching the target, the motor slows down in order no to overshoot but up to a point that the motor is forcing whithout moving creating a buzzing noise.
    I try to fine tune my PID with no succes so far.
    if you have any idea how to solve this probleme like creating a deadzone i would appreciate.
    Thanks one again for sharing your work.
    best
    Pascal.

  • @SENRIKAVLOGS
    @SENRIKAVLOGS 2 года назад

    Like it ⭐️💫

  • @avrphreak9121
    @avrphreak9121 2 года назад

    Interesting!

  • @JohnWinquist
    @JohnWinquist 2 года назад +1

    I've never considered PID use in a servo. Great video as usual. With P set to one and I and D set to zero is not doing anything that remapping the input wouldn't though, right?

  • @ALXandroATS
    @ALXandroATS 2 года назад

    Can gear positioning accuracy be improved by using gears with smaller teeth? Hope you can explain the pros and cons when it comes the size/number of gear teeth.

  • @imarobodude
    @imarobodude Год назад

    this is very helpful thanks, aside from the confusion: it is called subscript, not "underscore" which would mean underlined

  • @jesmonde2120
    @jesmonde2120 2 года назад

    Güzel video

  • @Mecatronicgarage
    @Mecatronicgarage 2 года назад

    Hi, very good video. How can I modify the code to instead of an output for a pwm motor controller , use only one L293D with two wires one for each direction of the dc motor.

  • @douras96
    @douras96 2 года назад

    Thanks for the video. But why use PWM as a command ? It's complicated to "decode" and doesn't mean a rotation. Wouldn't it be simpler and clearer to use something like i2c, spi or even serial communication to send the rotation command ?

  • @k4x4map46
    @k4x4map46 2 года назад

    great stuff! what brand and model power supply you using? Looks like a KORAD possibly KA3005D? squinting a bit lol

  • @furkand2092
    @furkand2092 2 года назад

    Good

  • @wretchedfibs4306
    @wretchedfibs4306 2 года назад

    good ideas. car window motors are cheap and wanted to build a steering mechanism such as a joystick for an outboard engine on a boat. The common steering wheels and cables used are expensive and clunky.

  • @user-di4bt7qu2i
    @user-di4bt7qu2i 2 года назад

    Jeremy Fielding on the Dronebot Workshop? Looks like Christmas has come early this year!

  • @GordieGii
    @GordieGii 2 года назад

    What software do you use to make your diagrams? (e.g. PID loop diagrams)

  • @alexgonzalez2338
    @alexgonzalez2338 2 года назад

    Bill: Jeremy likes to build big machines. Jason: hold my beer…. Great video, best PID explanation. Looking forward to the series !

  • @DesertVox
    @DesertVox 9 месяцев назад

    What about using the circuitry inside a hobby servo and soldering it to a bigger motor to drive it?

  • @carolinecaroline2264
    @carolinecaroline2264 2 года назад

    Hi there, is it possible that you can do a video on how to create my own nodes in ZOD?

  • @kevgermany
    @kevgermany 2 года назад

    Love Jeremy's channel.
    Just wondering why you didn't use a stepping motor.

  • @silivriadanaocakbas1838
    @silivriadanaocakbas1838 2 года назад

    Harika 👏👏

  • @user-mj3qg6cc2z
    @user-mj3qg6cc2z 2 года назад +1

    Thank you for your videos.
    But can explain PID with quadcopter

    • @snfn7847
      @snfn7847 2 года назад

      You trying to do PID tuning?

  • @jon2487
    @jon2487 2 года назад +1

    Do you have any suggestions for how to add acceleration or deceleration with pid as you mentioned in the video? I don't seem to be able to find any tutorials about that!

    • @AdaptivePhenix
      @AdaptivePhenix 2 года назад

      Search for Baldor Motion Products AN00115-001 Trapezoidal Move Calculations
      There are many texts on this subject but the above document really simplifies the problem.

  • @jessemendes9491
    @jessemendes9491 2 года назад

    Muito bom !

  • @crazytaxi3277
    @crazytaxi3277 2 года назад

    Hi, can we build a servo with a latch such that no power is needed when holding at a position for long time?

  • @botak333
    @botak333 Год назад

    Hi sir how to make steeper closeloop with magnetic sensor as5600

  • @Noble3dprintersLLC
    @Noble3dprintersLLC 3 месяца назад

    What setting do I change in the code if i want to replace the potentiometer as my input to an AS5600 encoder as my input?

  • @mrkattm
    @mrkattm 2 года назад

    Why are you setting the position with PWM? That makes sense if you are transmitting position via an RF link but if you are hard wired an error voltage makes for a simpler implementation.

  • @restaliayurike6838
    @restaliayurike6838 2 года назад

    hello sir, I want to ask when I make a program using the ultrasonic sensor in the Labview application on the arduino the Tr and Tx lights keep flashing after I run the program and the sensor can't detect it, why sir?

  • @Dasol0246
    @Dasol0246 2 года назад

    Can you make a video on Pi Pico PID motor controller for position using micropython, I don’t see any out there on RUclips.

  • @j1952d
    @j1952d 2 года назад +1

    Good stuff, and great to see you having a collab. with Jeremy. One tiny niggle: I'd've been happier to see "Kp = 1.0;" rather than "Kp = 1;" to emphasise that it's not an integer. Just being a grumpy old git!

  • @Rudie_
    @Rudie_ 2 года назад

    I would say that the PWM controls the servo arm position and not the motor shaft position. (3min 58s)

  • @DrewTeter
    @DrewTeter 2 года назад

    **Music starts**
    Me: "Hermitcraft recap?"

  • @SuperToughnut
    @SuperToughnut 2 года назад

    I haven't been getting notifications off these videos lately.

  • @7LegSpiders
    @7LegSpiders 4 месяца назад

    I have 4 of these motors and I wonder if they would work to move a heavy 2-axis CNC.
    BALDOR 590CD2 TYPE PM3336P ½ HP FR 48Z 1140 RPM 230 V DC MOTOR