Balancing Robot 2 : Arduino Program Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2015
  • The code that runs this is available here, just copy and paste into ARDUINO SKETCH.
    randomagglomeration.blogspot....

ความคิดเห็น • 18

  • @VolthausLabElectronics
    @VolthausLabElectronics 8 ปีที่แล้ว

    Very well done Mr. Black. I really look forward to building this. Thank you for taking the time to make the video as well as the tutorial.

  • @knowall5792
    @knowall5792 6 ปีที่แล้ว

    You should run it on plain solid floor, at a higher speed, may be on a bike. Still your balancing logic is working. What about running on a tight rope (with a safety harness)?

  • @sanchohacker
    @sanchohacker 7 ปีที่แล้ว +1

    Hey, I'm doing the exact same project with these component, but I'm having a problem when tuning the PID gain, I can't get it balances even around 3 second, Can you tell me how can you tune the PID so well??? thank you so much

    • @Peter-sj6yn
      @Peter-sj6yn  7 ปีที่แล้ว

      Hi
      Well I spent some weeks tuning this and learning how to.
      You should look at all the videos you find that explain PID controllers.
      the PWM (motor controling value)
      P ( the angle measured from the MPU) target angle should be zero so if it measures 50 when upright make P = measurement - 50
      I = I + P ( I = value acculmulated over time )
      D = P this time - P last time ( this assumes each cycle is roughly the same length of time).
      Timing can really be thrown out by delays in communication between Arduino and MPU due to noise caused by the PWM signal to the DC Motors!
      PWM = P*coefficient + I*coefficient + D*coefficient
      start with all coefficient set to zero.
      tune P by increasing its coefficient until you get as good as you can get.
      then
      Increase the coefficient of D this should dampen any oscillation or over shoot.
      finally I is used to compensate for long term error like adding a weight to one side.
      and is the least important component.
      sorry for delay in response
      Hope this helps
      please let me know how you get on
      Yours
      Peter

    • @sanchohacker
      @sanchohacker 7 ปีที่แล้ว

      Thanks for replying Peter!!! I finally got it balance, I change the sensor filter to Kalman filter instead of Complementary filter, But I am still not understanding quiet well about PID. I'm planning controlling the robot by an Bluetooth module, but I'm having some problems when changing the Setpoint, It falls down immediately, seem like it overshoots too much. Do you have any idea of that?

    • @Peter-sj6yn
      @Peter-sj6yn  7 ปีที่แล้ว

      Hi Good to hear you have made some progress
      No that does not sound familiar
      I did have trouble with the GPU locking up
      then it would fall over
      but that was due to electrical noise from motors.
      when something odd happens I usually trace the variables through the program using a Serial.print() to check that they are not going out of range
      or you haven't cast a float to an int by mistake
      Yours
      peter

    • @sanchohacker
      @sanchohacker 7 ปีที่แล้ว

      Thanks for nice advices Peter!!! You had an excellent work. Hope you can do some more interesting stuffs.
      All the best.

    • @alihajmostudio8902
      @alihajmostudio8902 5 ปีที่แล้ว

      Thai Hoang Nguyen

  • @TejasBhale
    @TejasBhale 8 ปีที่แล้ว

    It's very good

  • @jach1969
    @jach1969 2 ปีที่แล้ว

    This, without PID controller ?

  • @Peter-sj6yn
    @Peter-sj6yn  8 ปีที่แล้ว +2

    this took me six months....
    but its a really satisfying project.
    the pwm driving the motors creates interference that can lock up the gyro :(
    so probably better to have separate power supply.
    the bits i have used are freely available on ebay , and fit together easily
    but you should still be pretty pleased with yourself getting this to work.
    All the best.

  • @FranciscoGomez-cw2nd
    @FranciscoGomez-cw2nd 5 ปีที่แล้ว

    Y el Diagrama de conexiones ?????

  • @user-ud6od9eh5k
    @user-ud6od9eh5k 6 ปีที่แล้ว

    where did you use "10V 3900uf Capaictor"?

    • @Peter-sj6yn
      @Peter-sj6yn  6 ปีที่แล้ว +1

      The motors speed is varied by Pulse Width Modulation.This square wave generates a lots of electrical noise! which interferes with communication between the Arduino and the MY-6050 gyro.
      The large capacitor acts as a smoothing capacitor across the battery pack.
      I put capacitors across the motors they provide a short circuit for noise from the motors and the wires to the motors pass through ferrite beads twice the ferrite also absorbs electrical noise.
      Without this the MY-6050 gyro would lock up and the robot falls over....

    • @user-ud6od9eh5k
      @user-ud6od9eh5k 6 ปีที่แล้ว

      Thank you. This means that "10V 3900uf Capaictor" is used between motor terminals . And this Capacitor are non-polar ?

    • @Peter-sj6yn
      @Peter-sj6yn  6 ปีที่แล้ว +1

      no
      I only used 1 3900 μF across the batteries ( i only had a picture with two caps )
      the capacitors on the motors are small ceramic
      i don't know the values. I salvaged them from a power supply.
      a quick google around on the subject of DC motor noise dug out these values 0.1 μF or 0.47 μF
      have a look at www.x2y.com/publications/dcmotors/feb14-05.pdf

    • @user-ud6od9eh5k
      @user-ud6od9eh5k 6 ปีที่แล้ว

      Peter Black
      thank you very much!