How to Defy Physics With LEGO 51515 - PID Self Balancing Robot

Поділитися
Вставка
  • Опубліковано 29 чер 2024
  • This self balancing robot uses a PID algorithm and the gyro sensor in the LEGO 51515 intelligent hub to keep itself upright. The PID gyro combination is the ideal control mechanism to keep a LEGO 51515 robot balancing upright. When built with LEGO MINDSTORMS 51515, this type of robot is called an inverted pendulum, because its center of mass is above its pivot point, which leads to unstable physics.
    The new LEGO 51515 set includes a gyro sensor built into the intelligent hub, which opens up a whole new range of possibilities! Today, I teach you how to program your very own self balancing robot (or segway style robot) in Scratch using LEGO MINDSTORMS 51515.
    This video was a collaboration with Garry from Creator Academy Australia. You can check out his original Gyro Girl video here: • SPIKE 2.x PID Balancer...
    🔴 Watch my LEGO MINDSTORMS 51515 Review: • LEGO MINDSTORMS 51515 ...
    🤖 See all of my LEGO 51515 Tutorials here: • LEGO 51515 Tutorials -...
    CONTENTS
    0:00 - Introduction
    0:52 - Collaboration With Creator Academy Australia
    1:33 - Building the Balancing Robot
    2:17 - Gyro Sensor Explained
    2:51 - Self Balancing Robot Explained
    4:44 - PID Algorithm Explained
    7:42 - Code Walkthrough
    14:35 - Guidelines for Tuning the PID Algorithm
    📕 Check out my book, “Building Smart LEGO MINDSTORMS EV3 Robots,” available on Amazon: amzn.to/2MyGVCl
    🔴 Subscribe to Builderdude35: ua-cam.com/users/builderdude35...
    🕸 My Website: builderdude35.com/
    📷 Follow me on Instagram: / builderdude35
    🦸‍♂️ My supporters on Patreon contribute additional funding that allow me to build up and improve this channel and to make more videos. If you would like to help, you can support me here: / builderdude35
    🎵 Thank you to my friend OTT for producing the beats and music used in this video. You can check him out on Instagram here: / onetaketom
    🎥 Thank you to Garry Law from Creator Academy Australia for designing the intro animation and end screen animation! You can check out his UA-cam channel here: / @creatoracademyaustralia
    📽 Thank you to my friend Preston Nichols for designing Builderdude35's logo!
    #builderdude35 #lego51515 #legomindstorms51515
  • Наука та технологія

КОМЕНТАРІ • 87

  • @Builderdude35
    @Builderdude35  2 роки тому +9

    What other cool things have you used PID for? Let me know here!

    • @fishybuilds9230
      @fishybuilds9230 Рік тому

      I'm not really sure if it was a PID controller but when I built the gyro boy that came with the ev3 set, the code was very hard to understand and there wasn't any way to change the PID values if it even had any. A video breaking down the code would be great!

    • @VJBrickss
      @VJBrickss 8 місяців тому

      Same

  • @tarstco
    @tarstco 2 роки тому +3

    After making it balance, can you then make it drive around like the old lego mindstorms?

  • @lovemadeinjapan
    @lovemadeinjapan 2 роки тому +2

    The sensor is not a gyroscope, but a 3D acceleration sensor, so it basically can output angles based on the movement of 3 little MEMS mass-spring systems. Nothing to integrate. Just read out the spring movement in the 3 directions and calculate angles with plain gonio functions.

  • @VladoNikiforov
    @VladoNikiforov 2 роки тому +1

    It is fantastic! Can I download/buy the program?

  • @FlyingMD11
    @FlyingMD11 2 роки тому +7

    May I add some improvement to your algorithm?
    The motors are controlled by power, so I‘d say with torque.
    The torque required is not linear with the error of angle, but with sin(error), as this is gravity‘s vector component perpendicular to the lever.
    This results in a reduced correction around the target angle and a higher correction once deflected. So I wrapped the error Formular with a sinus function.
    Of coarse the PID values need to be adjusted afterwards.
    By doing so I could achieve a much more stable balance.

  • @micheleraucci9070
    @micheleraucci9070 2 роки тому +4

    Do you think it is possible to backsolve Kp, Ki and Kd by tracking the effect of power on the robot roll angle? So the idea is to let it play a little bit on its own by modifying the constants until it reaches the desired result and then these will become the constants to use. A little bit like the goal seek in excel.

    • @michaels.4034
      @michaels.4034 Рік тому +2

      Hey, mechanical engineer here. It should be possible. There are techniques already used in Technology, e.g plane stabilazation. Also bc you can analyze the swinging behaviour on the hub itself and calaculating the right parameters. Im currently working on this and let you know if i manage to do so ;)

  • @_yaseen
    @_yaseen 2 роки тому +3

    Thanks!

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      What did Yaseen mean by this?

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      Thanks Jimmy :) that phrase is something of a meme among my friends, and Yaseen knows it all too well

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      no it's not about you haha

  • @darkesto
    @darkesto 2 роки тому +1

    Can you update the central position in real time? Suppose that you surface angle changes it Will nevet hold upright with the current implementatiob

  • @jinfenggoh
    @jinfenggoh 2 роки тому +2

    Thanks

  • @controlaguy6315
    @controlaguy6315 Рік тому +3

    O dont know why but it is not working for me im gonna restart and i checked the robot and code 100 times i hope when i restart it will work

  • @ivorjawa
    @ivorjawa 2 роки тому +2

    Why didn’t you just incorporate the .25 into Ki? Unless I’m very wrong, it’s mathematically equivalent and an extra multiplication you don’t need to keep repeating.

  • @SeconYan
    @SeconYan 2 роки тому +3

    Long time no see, guy.

  • @prueba-qv3ym
    @prueba-qv3ym 2 роки тому +1

    hi! ma man yo i was wondering if you can bring the xiaomi robot and compare to a lego one. thanks!

  • @Ziad_Elsalseely
    @Ziad_Elsalseely 2 роки тому +5

    Builderdude 35 returned back 👍🥳

  • @daeboos
    @daeboos 2 роки тому +1

    My robot keeps falling over it corrects it a little too late then over corrects can you help

  • @dluders
    @dluders 2 роки тому +3

    I wonder if the Space-X rockets use PID programs to move the rocket gimbals when landing....

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      I will have to ask my SpaceX colleagues ;)

  • @miguelnassour110
    @miguelnassour110 2 роки тому +4

    Weird why I tried making the program but my hub flopped to the floor… even when I change the balance variable’s angle

  • @ImpostorSus
    @ImpostorSus Рік тому +1

    Should I change power variable and 0.25 or just k values?

  • @yen-thanhmac9900
    @yen-thanhmac9900 2 роки тому

    Ok, but how can you programe it??? I don't even know what the heck to do with it.

  • @MalarLearner75
    @MalarLearner75 2 роки тому +2

    I will get one this week

  • @alexandrucreata6342
    @alexandrucreata6342 Рік тому

    Do you thing you can do this with Lego boost?

  • @erikvarga5212
    @erikvarga5212 2 роки тому +2

    For me the program doesn't work. I don't know why. But also I don't think it's your fall, you are a very good guy who wants to help us better understand lego MINDSTORMS. You are the Best!!! RESPECT.

  • @Mint474
    @Mint474 3 місяці тому

    i want to download this

  • @GamingKing-jo9py
    @GamingKing-jo9py 2 роки тому +3

    cool pid

  • @KhangPhucNguyen-kc3sb
    @KhangPhucNguyen-kc3sb Рік тому

    👍👍

  • @mathguy9495
    @mathguy9495 2 роки тому +3

    Can you do this with the EV3?

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      absolutely! One thing to look out for is that it may be more challenging to build a robot that has balanced weight

  • @Meowzofficial
    @Meowzofficial 2 роки тому +2

    POV:You bought gyro boy on wish but it has a newer technoligy so its kind of beeter but not as pretty

  • @LEGO_CREATOR_IDEAS
    @LEGO_CREATOR_IDEAS 10 місяців тому

    my robot is not working. it very slow sensing :(

  • @kaydeinomg5829
    @kaydeinomg5829 2 роки тому +1

    Ok now one wheel

  • @thorbjrnhellehaven5766
    @thorbjrnhellehaven5766 2 роки тому +1

    I want to remote control movement for this robot:
    Fwd/bwd and turn.

    • @thorbjrnhellehaven5766
      @thorbjrnhellehaven5766 2 роки тому +1

      I guess you could manipulate the roll target, to make it go fwd/bwd

    • @ImpostorSus
      @ImpostorSus Рік тому +1

      Did you manage to get it working? I've got some problems with doing it so I'd be happy if I can get some advice

    • @thorbjrnhellehaven5766
      @thorbjrnhellehaven5766 Рік тому

      @@ImpostorSus I barely tried, but not giving it enough time for any success . Then canibalized parts for a different project.

    • @thorbjrnhellehaven5766
      @thorbjrnhellehaven5766 Рік тому

      @@ImpostorSus maybe check out their other video about this ua-cam.com/video/fazYC6cyAn8/v-deo.html

  • @aleksandarvolkanovski4565
    @aleksandarvolkanovski4565 2 роки тому +2

    Collaboration with Thoroughfare production?

    • @Builderdude35
      @Builderdude35  2 роки тому

      This is a cool idea! I hadn't heard of this channel before, but just checked them out and they have some cool content there.

  • @tomatus270389
    @tomatus270389 2 роки тому +2

    You didn't divide by dt in the derivative.

    • @Builderdude35
      @Builderdude35  2 роки тому +1

      You have out-mathed me, I tip my hat to you.

    • @jaapcilia392
      @jaapcilia392 2 роки тому +2

      @@Builderdude35 How does this correction change the code for this robot? And how is "dt" defined or calculated.
      Please help. I've spent days on making this thing work, but to no avail.....

    • @joakkoing
      @joakkoing 2 роки тому +1

      This is not necesary to divide by dt because you can assume that the time between loops is almost constant

  • @a.sanusinazareth9213
    @a.sanusinazareth9213 2 роки тому +1

    Your robots not balance enough. How can make it more stable. I'm dying

  • @jeramiahbrown8555
    @jeramiahbrown8555 2 роки тому +4

    2 hours of adjusting variables to find different ways of making it not work. Oh well.

    • @Builderdude35
      @Builderdude35  2 роки тому +2

      It took me several hours and trying a few different surfaces to get it to work. Don't get discouraged. If it were easy, everyone would do it. ;)

    • @lubogregor3534
      @lubogregor3534 2 роки тому +3

      @@Builderdude35 is there at least some reasonable range for each of the P.I.D. variables to operate within? (So great to see you back again btw).

  • @user-jj1tp4qm8m
    @user-jj1tp4qm8m 2 роки тому +1

    1.7

  • @LegoMaster5197
    @LegoMaster5197 2 роки тому +1

    Hi

    • @LegoMaster5197
      @LegoMaster5197 2 роки тому

      This is the first comment i think

    • @Builderdude35
      @Builderdude35  2 роки тому

      Indeed you are the certified first commenter

    • @LegoMaster5197
      @LegoMaster5197 2 роки тому +1

      @@Builderdude35 Epic, love your videos btw

    • @Builderdude35
      @Builderdude35  2 роки тому

      @@LegoMaster5197 I'm thrilled to hear that! What's your favorite video so far?

    • @LegoMaster5197
      @LegoMaster5197 2 роки тому

      @@Builderdude35 The one where you reviewed the Porsche 911 (10295)

  • @monmonwadee127
    @monmonwadee127 26 днів тому

    Not working

  • @cindyshaiu
    @cindyshaiu 5 місяців тому

    Scammer

  • @reenabondada7490
    @reenabondada7490 2 роки тому +5

    Doesn't work. That is just a scam. Don't try it, it's just a waste of time and lego.