Electronic Basics #34: Two-Position Controller & PID Controller

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • Only $2 for 10pcs PCBs (10cm*10cm): jlcpcb.com
    Support me for more videos: / greatscott
    Previous video: • Easy & Powerful Arduin...
    Facebook: / greatscottlab
    Twitter: / greatscottlab
    How does Magnetic Levitation work? || Crude Levitator circuit: • How does Magnetic Levi...
    You can get the schematic and the code of the circuit here: / 16653255
    You can get the spreadsheet for the Arduino PID calculation here: www.dropbox.co...
    Thanks to JLCPCB for sponsoring this video
    Visit jlcpcb.com to get professional PCBs for low prices
    Parts list: (affiliate links):
    Aliexpress:
    SS495A Hall effect sensor: s.click.aliexp...
    Electromagnet: s.click.aliexp...
    IRLZ44N MOSFET: s.click.aliexp...
    TC4420 MOSFET Driver: s.click.aliexp...
    PCB Terminals: s.click.aliexp...
    UF4007 Diode: s.click.aliexp...
    Arduino Nano: s.click.aliexp...
    Ebay:
    SS495A Hall effect sensor: rover.ebay.com/...
    Electromagnet: rover.ebay.com/...
    IRLZ44N MOSFET: rover.ebay.com/...
    TC4420 MOSFET Driver: rover.ebay.com/...
    PCB Terminals: rover.ebay.com/...
    UF4007 Diode: rover.ebay.com/...
    Arduino Nano: rover.ebay.com/...
    In this Electronic Basics episode we will have a look at a crude levitator circuit and its control system. We will find out how two-position controller work and why it often makes sense to use the more complicated PID controller instead. At the end you will know the basics about those regulation technology systems and the levitator circuit will function as well.
    Music:
    2011 Lookalike by Bartlebeats
    Ecstatic Wave, Jens Kiilstofte
    machinimasound...

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

  • @Brendead8
    @Brendead8 4 года назад +48

    Lesson learned here: As long as you have enough power and the right components, it's all in the programming.

  • @pierrec1590
    @pierrec1590 6 лет назад +141

    Hi, I am not a PID specialist, but I suspect that gluing the sensor right on the electromagnet may be the source of some instability, because the sensor is exposed to two variable fields, as well as some interactions between the neodymium magnets and the coil of the electromagnet. This has all the features of a chaotic system, including non-linear feedback. You might want to place the sensor underneath the neodymium magnets, or use a photocell instead of a hall effect sensor.
    Good luck!

    • @noweare1
      @noweare1 6 лет назад +29

      You may not be a PID specialist but you are special because you know what you are talking about. Great points.

    • @ricardomaggiore5518
      @ricardomaggiore5518 6 лет назад

      what photocell sensor can work variating the output?? i have searched a lot but just found on/off type... not ideal for these aplications of positioning.

    • @merlinsghost756
      @merlinsghost756 6 лет назад +3

      Shielding the HALL sensor on the backside with mu metal can also help, as well as moving the HALL sensor off to the side of the metal core of the electromagnet where the field from the electromagnet is less concentrated. A bar electromagnet is also helpful and should give you more distance as some of your field lines are going to take the path of least resistance and go nearly straight across the gap between the elctromagnet north and south pole, although if the HALL effect sensor is placed in the right spot between the north and south pole you may get them to zero-out their effect on the HALL sensor, not sure on that one though.

    • @senceryazici
      @senceryazici 5 лет назад +2

      You are correct, in those kind of systems where the feedback is non-linear (changed by multiple effects other than the levitating magnet) completely changes the dynamic model of the system, that will lead to unstability when the control signal aka the electromagnetic force applied by the electromagnet, will change the feedback dramatically, thus will lead to a situation that the controller thinks that the magnet position changed much. So it will try to compansate that big change which will result in a bigger control signal which causes a bigger feedback change even tough the magnet hasn't moved much. and this goes on and on... So the control signal will be affected by this problem more and more after a certain time system will go unstable. Instead of hall sensor, a distance sensor could be used. Anyway, Great work. !

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

      I was also wondering if you could simply consider the contribution of the magnet as a function of the current supplied to it. And then you just subtract this value from the value given by the sensor. The function could be determined experimentally.

  • @WalidIssa
    @WalidIssa 6 лет назад +93

    This kind of systems is nonlinear and the controller can really struggle to stabilize the system around an equilibrium point. However, Two nested (inner and outer) loops can improve the performance much more.

    • @phantom349uj
      @phantom349uj 6 лет назад +6

      Walid Issa typically nested loops require another input. One slow and one fast input. It is non linear so I think he'd need to linearized the pv or cv before feeding it into the pid algorithm

    • @Pablososki14
      @Pablososki14 6 лет назад +4

      Maybe a sensor which indicates the vertical distance of the magnet from a certain spot in the structure?

    • @maku6087
      @maku6087 6 лет назад +3

      He should use a filter in the system so that unwanted frequencies can not get through.

    • @AdaptivePhenix
      @AdaptivePhenix 6 лет назад +1

      @@Pablososki14...With as much resolution as possible.

    • @dlptube1
      @dlptube1 3 года назад

      You are wrong, a PID controller can be used to control a non linear- non stable transfer function.

  • @nivensmith6043
    @nivensmith6043 Год назад +1

    This is fantastic using the hall effect sensor. Excellent.

  • @nicholashemenway2787
    @nicholashemenway2787 4 года назад +3

    In high performance applications, the way magnetic levitation is performed is by using two control loops. You have an inner control loop using typically a PI controller that regulates current (you need current sensors) into your RL load (electromagnet). You then have a an outter control loop that regulates position typically using a PID controller with a low pass filter on the derivative term. Your sensor reads in position which goes through your PID controller... the output of this motion controller is a force command. This force command is then inverted into the corresponding current needed to produce that force. This current command is then fed into your inner loop controller which regulates your current to the desired value. The desired current flows and produces the force commanded by your PID position controller and the overall loop is closed. Tuning the current regulator is pretty simple... using pole-zero cancellation, you set kp = L * w_b and ki = R * w_b where R and L are the resistance and inductance of your electromagnet respectively and w_b is the desired bandwidth of your current controller in rad/s. Tuning the position controller is a little more involved as you must move your unstable RHP pole into the LHP. Although tuning can be done manually, it is very difficult as you're trying to make an inherently unstable system stable. Frequency domain methods usually work really well for tuning it. Cheers!

  • @younalazzawi
    @younalazzawi 6 лет назад +2

    I Really enjoyed the idea of applying principles of PID to this project. You made the explanation of a PID controller very simple and easy without delving into mathematical jargon, the kind we used to endure in the old days. And .... thanks for the JLCPCB link.

    • @noweare1
      @noweare1 6 лет назад

      Ha ha, so right...."the kind we used to endure in the old days." Excellent

  • @ShomiTheGreat
    @ShomiTheGreat 6 лет назад +34

    From a mechatronics student- inertia, drag and friction all help stabilise the system which utilises a PID.
    The reason why a "bigger" magnet had more stability is that it had more mass, thus it was less prone to sudden position changes due to its greater inertia. This way you can slip out of complicated automatic control systems calculations and simplify experimental PID method. I think that (instead of adding additional magnets to the elongated structure which changes the field's geometry) you should try attaching non-magnetic material to the bottom of the magnet, as a weight.
    Lead is easy to melt/ shape, it has brutally high density and it is a diamagnetic. You could maybe try experimenting with small lead pellets, sticking them to the bottom of the elongated magnet until you hit the required weight for approximated parameters.

  • @enricorov
    @enricorov 6 лет назад +1

    Automatic Control is tough stuff. Hats off, man.

  • @StanleyKubick1
    @StanleyKubick1 6 лет назад +6

    incredibly interesting project. I barely understood any of it and was completely engrossed =)

  • @SunnyJerai
    @SunnyJerai 5 лет назад

    I have been watching you videos for a while now and I find them really informative and intriguing. The fact that you also show things and projects that didn't work out as expected or didn't work out at all ( while many other channels just fake it for views) is what makes you stand out. It gives us insight for what to look out for and how to avoid them. Hope to see more great content from you. Kudos.

  • @edwardalmanzar3927
    @edwardalmanzar3927 6 лет назад

    I made this project totally with an analog circuit. It was difficult but I managed to move the setpoint without shutting down the magnet. Is an amazing project.

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

    Awesome
    Great learning
    Thanks for sharing
    I wish I had teachers like you..

  • @qwaqwa1960
    @qwaqwa1960 6 лет назад +6

    Scope the magnet current vs. PWM. Your freewheeling diode will keep the current flowing for a while after voltage is removed, so you may need to subtract a time offset from your PWM setting to help stabilize response.

  • @Minecraftmigapiku
    @Minecraftmigapiku 6 лет назад +13

    You should consider that switching on and off by itself changes readings from hall effect sensor

  • @Rainbowang123
    @Rainbowang123 6 лет назад +5

    Greeting GreatScott!, I have seen a lot of giveaway events, but by asking participants to find and publicly expose own mistakes in a giveaway, this is my first time. Salute your humility and efforts in doing better in educating people.
    Below are the mistakes I have found:
    1) You shouldn't be gluing your hall effect sensor to the electromagnet. The sensor should be 'focus' on detecting the magnetic field strength of the magnets without being affected by the electromagnet. In other words, during automatic control, you are changing the gain of the electromagnet, the distance you desired is no longer 700mV. The way you did causes the control system to be non-linear and time-varying.
    2) SS49E, not SS49A
    3) Hysteresis, not hysterisis
    4) Derivative controller is actually based on the rate of change of ERROR to be precise, de(t)/dt, not rate of change of actual value (mentioned at 6:04). It sounds the same and intuitively no difference, but the rate of change of error and rate of change of actual value is totally two different things.
    5) And of course, at 6:05, df(t) / dt, not df(x) / dt
    6) At 6:10, Kd factor not Kp.
    I am not sure what type of mistakes you want (minor or major?). If I need to choose only two, I will choose (3) and (5) mistakes since they are obvious in your video.
    And I hope the following will be helpful to everyone who are interested in control system engineering:
    - Normally, people use displacement sensor to do positioning of magnetic levitation (maglev) system.
    - Maglev system is a highly non-linear system, using merely conventional PID controller is never sufficient to control. Classical control (PID controller is in this section) emphasizes on LTI system, which LTI stands for linear time-invarient.
    - I believe that the performance of the MOSFET is non-linear. In other words, the supply voltage and the lifting force is not directly proportional, thus non-linear. Two ways of solving this problem - first, identify the LTI range of the MOSFET and make sure your system works only within that range, second, accept the non-linearity and uses a controller that works with non-linear properties, for example, Fuzzy-Logic controller (FLC).
    - At 7:21, the tuning method is belongs to Ziegler-Nichols tuning method. Such tuning method is easy to be implemented, and unfortunately causes it to be 'exploited' and 'abused'. The tuning method by the original author/creator emphasizes that such tuning method is only applicable to first-order plus time-delay system (FOPDT). Maglev is indeed not one of them. But still, people are using it everywhere for all kind of system without actually understand the tuning method's requirement.
    - At 7:25, I have never seen such high Ki is required for a system. I think eventually, you are implementing I controller instead PID controller, which is why it still works (and even better) and you got it theoretically correct - it will never last forever.
    I am extremely welcome to any feedback regarding what I've posted here. Anyway, I am a control student who self-fund for my own study and researches (sadly no free education at all in my country). I only has a DSO138 oscilloscope on my workbench and wanted to upgrade since long time ago, so hopefully I get to win this giveaway.

    • @antoniomeraz520
      @antoniomeraz520 3 года назад

      Awesome dude, mechatronic student here, we see some control engineering but what you said is awesome

  • @patprop74
    @patprop74 6 лет назад +2

    I would like to be as smart at electronics as you are! I kind of understand just enough to watch and enjoy.

  • @edslab5383
    @edslab5383 6 лет назад +5

    First of all you need to identify your system in order to know if it is a first order, a second order system or even higher, from that you will be able to get the correct values for the three parmeters using the appropriate methods. Mathematics are mandatory for the PID controller designing if you want to get better results. Please consider make more videos about this topic it is really interesting and helpful.

    • @nonamenoname6445
      @nonamenoname6445 5 лет назад +1

      Or don't, since you obviously don't know how to use a PID..

  • @AlexRhodesMV
    @AlexRhodesMV 6 лет назад +1

    This is was one of my favorite videos you've made. Good explanation of PID controllers. Thanks!

  • @milan.stankovic
    @milan.stankovic 6 лет назад +4

    The mistakes are :
    Hysterisis is actually hysteresis and you said Kp factor the Kp factor is used in the proportional term while you were talking about the Kd factor which is used in the derivative term :D Awesome video, I had to learn about this in Uni 2 years ago it would be easier if I had this video at that time :D

  • @TheJay6621
    @TheJay6621 6 лет назад

    Awesome.. watching an object levitating is satisfying..

  • @lauretivan6231
    @lauretivan6231 6 лет назад +1

    i really love your videos, always wanted to do more in eletronics and your way of explaning it with these nice colored schematics in action is far more better than just plain theory. i'd love to do a Moodle or Wiki of some sort of all your videos and tutorial (writing it would help me remenber more)

  • @bur1t0
    @bur1t0 6 лет назад

    I must be learning, I was half way there with the PWM suggestion. I'm crediting your excellent teaching style :-)

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

    I have seen several explanations of a PID controller, but this one is the best.
    It's even better than the one by @AndreasSpiess.
    And that is an achievement !
    Another GreatScott moment !

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

    Hi, I tried your methods in my Lab. It is super unstable, you're right. But I fixed it. What I did was change the shape of the levitating body. I cut out a piece of circular light weight cardboard and attached it to the magnet. Like this:
    -----()------
    Now the magnet rarely topples or falls down, because it is hard for the levitating body to topple side ways.
    Your idea works, it just needed a little mechanical touch to it.

  • @power-max
    @power-max 6 лет назад +15

    Either a faster microcontroller or an analog op-amp PID controller would probably work out well. Tuning an analog PID controller would not be as easy as simply changing constants though. (Instead requiring changing component values, variable capacitors and pots would probably make this easy)

    • @DavidP_98
      @DavidP_98 6 лет назад +3

      Even better: use a fast comparator like the lm319 (or a newer high speed comp)

  • @ELEKTROGOWK
    @ELEKTROGOWK 6 лет назад

    Schön zu sehen, dass auch Andere damit Probleme haben .-)

  • @FirechipAcademy
    @FirechipAcademy 6 лет назад

    I expect this time you make new project but you completed your previous project. that is awesome

  • @javierperez_21
    @javierperez_21 6 лет назад +2

    The hall effect sensor glued to the electromagnet might be the problem. I think something like an optical sensor would do the job well. Thanks! I really like your videos!

  • @Just_call_me_M
    @Just_call_me_M 6 лет назад +1

    i dont understand some times but i keep watching ur videos because they are intersting and i learn something new every video u release

    • @greatscottlab
      @greatscottlab  6 лет назад

      Happy to hear that. That is what I am trying to achieve.

    • @Just_call_me_M
      @Just_call_me_M 6 лет назад

      GreatScott! Well ur doing a great job well done

  • @junjett6358
    @junjett6358 6 лет назад +9

    Hi, I study control systems for a living. The system you described can never be truly 'stable' from a single loop PID. What you need is a cascaded PID. The first loop should look at the derivative of position of the magnet, and the outer loop should look at the position of the magnet itself.

    • @St0RM33
      @St0RM33 6 лет назад +2

      what you mean is control both the position and velocity of the magnet, correct?

    • @junjett6358
      @junjett6358 6 лет назад +5

      St0RM33 Well, correct in a way. A cascaded controller would mean you have one loop taking in magnet position and outputting velocity, which is fed into another loop that takes in velocity and outputs electromagnet output. :)

  • @maxtorque2277
    @maxtorque2277 6 лет назад +17

    one fundamental issue with your setup (and in fact all electromagnet setups) is that the attractive force varies linearly with coil current, but is inversely proportional to the square of the separation distance between the coil and the target magnet! So, increasing coil current by say 1amp, might be enough when the magnet is close, but not nearly enough when it is far away! That square term means as the magnet approaches the coil, the current in the coil must fall with the square of the rate of change of distance! The two step (bang-bang) controller works better because the inductance of the coil effectively stores energy, and that energy is then set by the average duty cycle of the output. With its higher gain (max on, or max off) and faster loop (less time between changing the state) that system works better than a slow, poorly tuned PID. If you want to use a PID, then two options are possible, 1) non linear gains, or (easier) 2) a feed forward table of duty cycle values. Populate that table with the duty cycle that just balances the magnets mass at each distance away from the coil. That open loop feed forward table means the PID then just has to mop up the error (in fact, you'll find a simple P controller will work) as the intrinsic phase lag of the I term has been removed!

    • @SFCounterfeiter
      @SFCounterfeiter 6 лет назад

      Max Torque Thats right! Also because of the integral process you do better if you tune a PD controller. That means set the Ki to zero!

  • @LeadSkillets
    @LeadSkillets 6 лет назад

    PID tuning is definitely an art that takes time to master. When you get comfortable try your hand at servo systems. While they are more expensive than steppers, they are far superior in some applications.

  • @maulanaabdulmalika6814
    @maulanaabdulmalika6814 6 лет назад

    Finally, the basic electronic video has been release

  • @yuxin7440
    @yuxin7440 6 лет назад +3

    I think a faster controller might help. And also, as someone has mentioned, position the setup in vacuum eliminate the uncontrollable air turbulence. Moreover, The initial condition of the system matters since it is a nonlinear system, so try to come up with a setup that put the magnet in the same position before every test will reduce the complexity as well.

  • @soranuareane
    @soranuareane 6 лет назад +38

    6:02 df(x)/dt? Integrating a positional function with respect to time? I don't think your IV is x here. Shouldn't that be df(t)/dt?

  • @isettech
    @isettech 5 лет назад

    Before digital became common, this was all analog. The whole thing is built on a quad op amp. 3 of the amps are PID portions and the 4th sums the currents. Each portion had more control. For example the P factor has gain and offset so the linear portion is balanced with high gain with an offset to target the setpoint. The integrator and diritive has gain as well as tuning for the time constants. The time constants are selected to be complimentary to the mechanical moment of inertia for critical damping. The analog systems when properly tuned perform very well without the lag of A/D and calculation cycles on a processor. This is important when the moment of inertia is low such as the single magnet in the video. Many of these systems are linear for a low noise figure in the system without PWM.
    Would you like to try to make a video of the analog version of this? I would recommend the Active Filter Cookbook by Don Lancaster for reference in design of the low and high pass filters for the time constants.

  • @extraace
    @extraace 6 лет назад +2

    I would switch from digital write to port registers. Digital write is slow and can do strange things long enough for magnets to get out of place and mess up the pid loop as i have discovered in my project. Worked perfect with direct port.

    • @greatscottlab
      @greatscottlab  6 лет назад +1

      +extraace I used the port registers. Look closely.

    • @brandonsaffell4100
      @brandonsaffell4100 6 лет назад

      The same could be true of using analogRead vs putting the ADC in free running and directly reading the ADC register.
      Of course it could also be true that the time to calculate the PID output is too long and a faster micro is required.

    • @extraace
      @extraace 6 лет назад

      Oh yeah I see it now. Looked through it again. I missed that screen snapshot .

  • @СеменХеруимов
    @СеменХеруимов Год назад

    Большое спасибо! Лучший канал :)

  • @sciencechemistry9259
    @sciencechemistry9259 6 лет назад +1

    Awesome video keep up the good work

  • @gervas8457
    @gervas8457 6 лет назад

    I will admit I truly understood very little of this video. But I have found something interesting to investigate further. Thanks!

  • @naggorski
    @naggorski 6 лет назад

    Love your videos! Great to see implementation of theory

  • @sjoervanderploeg4340
    @sjoervanderploeg4340 6 лет назад +2

    You are modulating the voltage, I think you should wire the the MOSFET to modulate current instead!

  • @carlosagorreta5276
    @carlosagorreta5276 5 лет назад +1

    the problem of this sytem is that it's not a linear system, but a non-linear one, what means you can't use linear control techniques to control it. Also PID linear tuning method like ziegler-nichols won't work with a non-linear system (a PWM control, for instance).

  • @gilberttheregular8553
    @gilberttheregular8553 5 лет назад

    Yet another calculus problem.
    I love it!

  • @aslambatcha5683
    @aslambatcha5683 4 года назад

    You got a good handwriting mate.

  • @Speglritz
    @Speglritz 6 лет назад +1

    I think there is a problem with using just one linear Hall effect sensor. The sensor will naturally sense the electromagnet as it switches as well as the neodymium magnet as it changes its distance. If you install two hall effect sensors on each side of the electromagnet then you could use their difference to sense only the magnetic field from the neodymium magnet.

  • @Maxisokol
    @Maxisokol 6 лет назад +8

    Hey Scott!
    The sensor in your setup is the weak spot - since it changes the output not only due to magnet movement, but also when you change the current in the coil.
    I have instructed a student project with the same topic, you can see how we solved this problem with 2x hall sensors: /watch?v=1JjDcn8fHO0
    Hope you'll make your prototype work!

  • @nr7000000001
    @nr7000000001 6 лет назад

    You can make a nice rail system for trains (or little toys) with this; the rail is made of steel and the electromagnet is on the train, the train hangs down but is attracted to the steel. you can make a propulsion system when you have multiple electromagnets. And when you place this in a vacuum you have a kind of hyperloop train

  • @NNNILabs
    @NNNILabs 6 лет назад

    Just one look at all you videos will make anyone an electronics expert.

  • @DavidP_98
    @DavidP_98 6 лет назад

    What also could help is using a high voltage zenerdiode as flyback diode for the electromagnet. Higher voltage = faster discharge of the electromagnet. If you have a slow discharge the magnetic field will also slowly decrease when the elktromagnet is supposed to be off. Might make it more stable ;)

  • @researchandbuild1751
    @researchandbuild1751 6 лет назад

    PID mainly help account for nonlinear systems. A magnet is non linear in its attraction. Same as inertia of a heavy object is. So just using a simple switch on/off isnt enough to accounnt correctly for error since its a nonlinear function. Thats why PID works for these problems

  • @RollerCucuta
    @RollerCucuta 6 лет назад

    Genial, sería interesante ver esto con controlador lógico difuso. Saludos desde Cúcuta, Colombia

  • @szoszaty
    @szoszaty 6 лет назад

    It was very informative SLASH helpful video! Thank you!

  • @FMPV50
    @FMPV50 6 лет назад

    Uau! great video! :-D i think that i never saw PID being explained so good and so simply :-) and now for me a PID with a arduino is a complete game changer! :-O

  • @ionforbes4155
    @ionforbes4155 6 лет назад

    I can see this channel reaching 1m subs

  • @phamtoan3820
    @phamtoan3820 6 лет назад +1

    I like before watching the video

  • @dinesh8238
    @dinesh8238 6 лет назад +7

    I think you have to make part 3 to fix issues

  • @keen2461
    @keen2461 6 лет назад

    Kudos man. Excellent video as usual.

  • @sukhpalsinghji
    @sukhpalsinghji 5 лет назад

    Thanks a lot for these Informative videos

  • @joshhagen4182
    @joshhagen4182 6 лет назад

    I wonder if I could use this info for a project I would need to add two buttons and a screen, thank you for the info! Great video!

  • @polishfuze1934
    @polishfuze1934 6 лет назад

    Really nice and informative video, love it!

  • @timobk14
    @timobk14 6 лет назад

    Hey Scott... again nice video. For a basic understanding I'm agree with you, but I hope there will come more videos about PIC. Like...scoping set and act values to improve pic values. Keep on going dude. Thumbs up

  • @ams0063
    @ams0063 6 лет назад +1

    Once again awesome video. I remember I asked that will you continue working on it an you said maybe. Thankyou so much for this video

  • @tk2life
    @tk2life 6 лет назад +1

    Maybe the problem is the lateral oscillations, vertically it work well but when it moves horizontally the sensor detect fakes measures because the moving magnetic field of the magnet is changing, and the fake measures take out of set point the system

  • @meem9328
    @meem9328 4 года назад +1

    If you add another e-magnet under the permanent magnet so that when the permanent magnet falls, the other magnet pushes it up, this will create an ocilation

  • @InFAMOUSPS4_19
    @InFAMOUSPS4_19 4 года назад

    I might have this wrong but that long ferromagnetic rod might have a higher moment of inertia than your other magnet configuration types thus it doesn’t want to oscillate as much. The magnetic field lines are also different (this case the poles have a smaller area) thus giving the circuit a more precise signal on the Hall effect sensor an easier job to do

  • @kecoaberkacamata6128
    @kecoaberkacamata6128 5 лет назад

    hah, here you are, I saw your another video before this one. i read also the comments with pid controller, but for magnetic levitation, it's better to use z-transform, or n-order discrete controller.

  • @ZenPanda2023
    @ZenPanda2023 6 лет назад +3

    I was reminded how long it took me to find the Kp, Ki, and Kd of a heavy duty autonomous cart. It took me days to figure out. And even until now I'm not sure whether I got the right PID factors.

  • @somabhadraghosh5441
    @somabhadraghosh5441 6 лет назад

    Great Video as Always

  • @sunny90908
    @sunny90908 6 лет назад +2

    Nothing beats PID CONTROLLER!! Nice to know you are still working on magnetic levitation. What's next ???

    • @greatscottlab
      @greatscottlab  6 лет назад +1

      I don't want to spoil what comes next.

    • @sunny90908
      @sunny90908 6 лет назад

      GreatScott! Understood!!!!

    • @sunny90908
      @sunny90908 6 лет назад

      Have you got increased subs?? I told my friends to subscribe to your channel.

  • @vidrogic1499
    @vidrogic1499 6 лет назад +2

    best part of sunday!

  • @miguelduran1549
    @miguelduran1549 5 лет назад

    the most interesting video you have

  • @insightfool
    @insightfool 6 лет назад +1

    I think you will have better luck if you use a wider electromagnet. There's more "buffer" if you will and it will give you more of a cushion in your P values. When you look at most of the levetators out there the controller magnet is always wider than the floating magnet.

  • @apostolosvrontos5792
    @apostolosvrontos5792 6 лет назад +8

    You can try the Matlab PID Tuner. You give the Voltage and the Distance as a plot and it spits you the KKK factors

  • @sipbit
    @sipbit 6 лет назад

    Had a similar set up. I found in some forum that the Hall effect needs to be positioned a few (1-2)mm away from the electromagnet to get it stable. Don’t know why it worked. It just did.

  • @EmreKonca
    @EmreKonca 6 лет назад

    So nice

  • @hashemmi24
    @hashemmi24 6 лет назад +1

    The patreon guided you to a simplified ziegler nichols method, basically, eliminate Ki and Kd, and set Kp to a value, and monitor the sensor with an oscilloscope, lf the wave form's amplitude rises, decrease Kp , if the amplitude decays, increase Kp, try as hard as you can to get a sin wave, that 1 second you reached was almost it, at this point the Kp value is Ku (ultimate gain), then you use Ku value in ziegler nichols equations to derive Kp, Ki and Kd. Fine tuning is another thing.
    Edit: the equations are really simple, one or two multiplication at most :p

    • @smeezekitty
      @smeezekitty 6 лет назад

      Why toss out Ki though? Having a Ki means you have to worry about setting the center point precisely

    • @rodneygian12
      @rodneygian12 6 лет назад

      Can this method be used for slow reacting outputs like temperature? Im trying to tune my PID for my temperature control system. Trial and error takes too long. TOO LONG!

    • @hashemmi24
      @hashemmi24 6 лет назад +1

      @smeezekitty You toss Ki and Kd only at first, so you'd have only one variable to worry about(Kp), which after trial and error give me Ku, i then use Ku to get the exact Kp, Ki and Kd.

    • @hashemmi24
      @hashemmi24 6 лет назад

      @Rodney Yruretai believe it does, trialing three variables could take alot of time and might never work, trialing only Kp at first and using the oscope as a reference can be done quickly

    • @rodneygian12
      @rodneygian12 6 лет назад

      I'm using PID library by Brett Beauregard and It doesn't respond to just Kp with both Ki and Kd at 0. Any suggestions? Thanks for the help, brother.

  • @its_just_me_
    @its_just_me_ 6 лет назад

    Your voice is soothing!😊

  • @SMITHII_
    @SMITHII_ 6 лет назад +2

    Scott, you should get into fpv quadcopters. Right up your alley. Especially when you smoke the flight controller, because you could actually fix it instead of just replacing it.

  • @M_MAMDOUH
    @M_MAMDOUH 6 лет назад +1

    I love all of your videos😗😗😗

  • @playvectrex
    @playvectrex 6 лет назад

    I think the reason a larger mass of magnets is more stable could be due to the fact that you increased your electromagnet capability. To see if that's true try decreasing the peak current to the coil while using smaller magnets. A larger mass dampens out the instability. Also try to remove the D (derivative) portion of your PID controller. I've experienced instability when adding this term when the value is not calibrated properly. Sometimes analog hardware is the right tool for the job.

  • @geetanshujain3154
    @geetanshujain3154 6 лет назад +7

    Use MATLAB to tune ur pID controller... there u dont evn need the system characteristics you can jst enter ur response type and sampling time ... it will automatically give u values of Kp Kd and Ki automatically

    • @nonamenoname6445
      @nonamenoname6445 5 лет назад +2

      @@rauankaldybaev4770 or you could actually study the PID controller and use a proper method(like nichols ziegler) and not a stupidly slow manual calibration/or an unnecessary complex method..

  • @waltsteinchen
    @waltsteinchen 6 лет назад

    Hi Scott, as mentionend to the last video I build such a system long time ago (without a Microcontroller). These days I just had 3 potis to adjust the K* values, which worked pretty good. So my hint would be to use 3 potis on ADC channels to adjust the values simply with a screedriver, not having to run though a build cycle. Hope this helps!

  • @dlptube1
    @dlptube1 3 года назад

    Another way to do this, is sensing the position with a light and a photoresistor or phototransistor. I get Much more control range and stability than with magnetic flux sensors.

  • @the_perigoso
    @the_perigoso 6 лет назад +5

    One problem with your setup is that your sensor is too close to the electromagnet, you need to place the sensor at least half a centimeter below the electromagnet, if you had an air core coil it would possible to place it directly below it though. also you are modulating the voltage to the coil, I think you should try to modulate current instead. i dont know if these were the mistakes you were looking for, not even if they're right, i really want that scope :'(

  • @anishsarkar120
    @anishsarkar120 6 лет назад

    i think this the community tab you mentoned about :---
    1.(6:05)Derivative controller is actually based on the rate of change of ERROR to be precise/correct (in control systems), de(t)/dt, not rate of change of actual value
    2. Kd factor not Kp at 6:10
    BTW a grt idea for giveaway and i ddint knew you had covered PID of control systems

  • @Drxxx
    @Drxxx 6 лет назад

    you are the best! I love your videos :D

  • @xtozlabs8440
    @xtozlabs8440 6 лет назад +2

    Try adding a heavy weight to the bottom of the magnet.
    I think the reason the longer skinnier magnet works better is because it is heavier.
    The longer skinnier magnet has more mass and therefore has more inertia and will resist changes in acceleration more, effectively dampening out small up and down accelerations and giving the Arduino more time to correct for any small changes in position.

  • @electrospark1765
    @electrospark1765 6 лет назад

    Finally going to try this

  • @akkou2910
    @akkou2910 6 лет назад +1

    For the fist minute i thought the video already begun but 26 seconds later the intro begun. Me: wait life is a lie

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

    Get a Bluebird pid controller and look at its software. It has an automatic K value determination algorithm.
    If you can add this to your ardruino, you should be able to have it automatically do this for you!

  • @mohamedtebbo123
    @mohamedtebbo123 4 года назад

    I had a similar problem with a uni project , try using a state-space controller. Otherwise you'll be using 3 PID control loops

  • @bjarnehansen1101
    @bjarnehansen1101 6 лет назад

    Again a great Video!

  • @TheS1l3ntOne
    @TheS1l3ntOne 5 лет назад

    You just need more electromagnets to create a magnet free core. The core's diameter should be larger than the to be levitated magnet. And use a h-bridge to create an alternating field. Like this : as the magnet flips you should also flip the polarity of the electromagnet. It should work.

  • @jeroendebest1711
    @jeroendebest1711 3 года назад

    The magnetic field is inversely proportional to the gap squared, making it a quite nonlinear system. For small variations it might be linearized though

  • @Chiller3k
    @Chiller3k 6 лет назад +4

    One of the problems you are facing is that the system is non linear. The force weakens with 1/r^2. PID controllers can do a lot... but controlling more complex non linear systems sometimes requires a non linear controller. (I'm not saying, this system can't be controlled by a PID though)

    • @matthewmaxwell-burton4549
      @matthewmaxwell-burton4549 6 лет назад +1

      You are right, lets not forget the dead time induced by the arduino and its calculation time. PID is very old and extreamly outdated. This system won't be robust at all too.

    • @Chiller3k
      @Chiller3k 6 лет назад

      Matthew Maxwell-Burton I wouldn't go as far too say PIDs are outdated =D Depends on the field of work and what you are trying to do. But you are right, nowadays there are way more options that sometimes have quite good self tuning as well.
      But I agree with the dead time part! I imagine that's also why the longer magnet worked better. It made the system slower and thus the dead time of the arduino had less of an effect

    • @GrumpyOldTech
      @GrumpyOldTech 6 лет назад

      Chiller3k I have gotten around similar non-linear issues in the past by applying an appropriate equation between the pid output and the actual control element and achieved reasonable results. I tend to agree though, the deadband will be a significant issue, maybe, just for fun, implement in analog form, it’s just a few opamps and a handful of components....

    • @matthewmaxwell-burton4549
      @matthewmaxwell-burton4549 6 лет назад

      Haha i was joking a bit, but my prof at uni hates pid controllers. His phd was on control theory.
      Yes the deadtime does not suit a pid controller. You could always implement a smith predictor. Which would help a lot ! No point going analogue nowadays, control theory has gone a long way since. I which he'd brake out the simulink.

    • @PunitSoni00
      @PunitSoni00 6 лет назад

      Curious. Can you please point to some of the other more robust alternatives?

  • @hammerkino
    @hammerkino 6 лет назад +1

    Maybe include a smith predictor if you can describe your system precise enough. This would solve the issue of the dead time your system needs to react.

  • @dinesh8238
    @dinesh8238 6 лет назад +1

    Wow amazing

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

    This is not madness i teach electrical and always encourage my learners to experiment doing this type of work and safely.

  • @GeorgeGeorge-xj2bc
    @GeorgeGeorge-xj2bc 6 лет назад

    Pulling the mass against gravity is much difficult rather than pushing it upwards i think because there are two out of controls points,completely stuck and fall down.When pushing it there is no chance to go higher from a certain distance but it needs to maintain equal distance in the center so it needs multiple magnets.