Arduino DRONE II Part 2 IMU and PID

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 พ.ค. 2024
  • Please forgive me, the PID isn't workink well yet... I hope this is usefull and that you could learn something.
    In the past video series we've used the MultiWii platform for the flight controller. Now I want to make my own code for the flight controller.
    In this second part we combine the PWM signals from the receiver (part 1) with the IMU data and create the PID control.
    Help my projects on Patreon : / electronoobs
    my Q&A page: electronoobs.com/eng_preguntas...
    Canal en Español: / electronoobs en español
    -----------------COUPONS-------------------
    FuriBee X215 PRO: www.gearbest.com/brushless-fp...
    Crealitu CR10: www.gearbest.com/3d-printers-...
    Coupon code: "11CR10EU"
    Anet E10: www.gearbest.com/3d-printers-...
    Coupon code: "ANET10"
    4k XIAOMI drone: www.gearbest.com/rc-quadcopte...
    -----------------LINKS-------------------
    Webpage tutorial: www.electronoobs.com/eng_robot...
    PID video: • PID brushless motor co...
    PID webpage: www.electronoobs.com/eng_robot...
    Previous series: • Arduino drone - Part1 ...
    Drone build webpage: www.electronoobs.com/eng_robot...
    STL files: www.electronoobs.com/eng_robot...
    Joop Brokking videos: • YMFC-3D part 6 - Build...
    ---------------MATERIAL---------------
    Full part list: www.electronoobs.com/eng_robot...
    Arduino NANO: www.gearbest.com/boards-shiel...
    MPU6050: www.gearbest.com/development-...
    LIPO battery: www.ebay.com/itm/T-Plug-11-1V-...
    ESC 12A: www.ebay.com/itm/4-x-Emax-12A-...
    1804 brushless motor: www.ebay.com/itm/4x-Brushless-...
    5030 propellers: www.ebay.com/itm/8-pairs-Gemfa...
    LIPO connectors: www.ebay.com/itm/10-Pairs-20pc...
    Slide switch: www.ebay.com/itm/50-Pcs-2-Posi...
    Drone body: DIY : www.electronoobs.com/eng_robot...
    Or : www.ebay.com/itm/250mm-Mini-Mu...
    ---------------SCHEMATICS-----------
    Full schematic: www.electronoobs.com/images/Ro...
    One axis schematic: www.electronoobs.com/images/Ro... _axis_schematic.png
    ESC calibrate: www.electronoobs.com/images/Ro...
    Lipo connection: www.electronoobs.com/images/Ro...
    Propeller spin direction: www.electronoobs.com/images/Ro...
    --------------------CODE------------------
    Gyro read: www.electronoobs.com/eng_robot...
    Acc read: www.electronoobs.com/eng_robot...
    Full angle read: www.electronoobs.com/eng_robot...
    ONE axis flight controller: www.electronoobs.com/eng_robot...
    TWO axis flight controller: www.electronoobs.com/eng_robot...
    Like share and subscribe to motivate me. Thank you
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @ELECTRONOOBS
    @ELECTRONOOBS  6 ปีที่แล้ว +16

    I couldn’t manage to make the drone fly straight. I couldn’t find the correct PID values. I’ve made 100 tests and still noting. Stay tuned for future updates. You could always use the MultiWii platform. Also, if you consider helping my projects chek my Patreon: www.patreon.com/ELECTRONOOBS
    I hope that you'll be able to learn sommething new with this video.

    • @Roxor05
      @Roxor05 6 ปีที่แล้ว +5

      The plot twist was awesome :D
      In the TWO axis file you made a mistake in the pid section. "if(pitch_PID < -4000){pitch_PID=-400;}" I think you want that to be 400 instead of 4000. I know you propably found it, but if somebody uses the code from your site will pull their hair, why is it not working.. :D
      BTW if you want to improve the quality of your code, make sure that you put every group of functions into a different tab. It's like using separate classes in .h and .cpp files, but simpler. (I have separate tabs for: Setup-Loop, Transmitter, IMU, PID, Motor control, Telemetry, LED signals.) It makes much easier to read the code.
      I hope that both of us will be able to tune the pid. :D
      Cheers!

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +3

      Ferenczi Csongor thank you very much!!!

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

      Electronoobs You're welcome. :)

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

      Have you check weight on each side? i think it's not symmetric

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +1

      I will never be perfectly symmetric. The idea of the PID is that even with bigger load on one side it should fly streight. On of the PID tests is to hang sommething on one side of the bar and it should always fly horizontal. I'll improve the code... Keep up!

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

    Thank you for this information, watching your video and others is helping to put all the pieces of the puzzle together on how to program a diy flight controller.

  • @vishal01mehra
    @vishal01mehra 6 ปีที่แล้ว +10

    Thanks for your hardwork it's because of you we LEARN.

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +1

      Vishal Mehra thank you. I'm glad to hear that!

  • @ali8067
    @ali8067 3 ปีที่แล้ว

    Love these video series, great man, really nicely done.

  • @denizpnarl3059
    @denizpnarl3059 6 ปีที่แล้ว +3

    Man, it was very nice that you built the control algorithm yourself and showed us. I was looking for such video for a long time. I think that you should take the yaw motion into account because when one or two motors try to compensate the disturbance, due to the conservation of angular momentum the yaw orientation of drone also changes. Also anti windup integral may help and probably with that much of code the refresh rate of arduino became insufficient. And you somewhat calibrated the gyro to assume the initial position of the drone to be flat by offsetting the initial reading, I think that should not be done. I also dont know how to control the yaw by the way, if you get it somehow please tell me also)

  • @tugaric
    @tugaric 6 ปีที่แล้ว +4

    As a tip to anyone trying to build a quad with the mpu6050, calculating the pitch and roll angles the way he did is wrong, you are gonna encounter problems, with rotations around the z- axis.
    You can test it yourself. 1) Implement his code so that you get an angle that's calculate only with the gyro values.
    pitch = gyro_x * dt and print the values to the serial port.
    Now starting at 0° if you rotate around x or y to 45° for example and then rotate around yaw, you'll see that the angle won't change or just a bit. If you now rotate back to the initial orientation the starting angle will be wrong.
    The correct formula is :
    phi = prevPhi + dt*(wx + wy*sinPhi*tanTheta + wz*cosPhi*tanTheta);
    For more information I'd recommend the following book: Rigid Body Dynamics for Beginners by Phil Kim
    or read this:
    andrew.gibiansky.com/blog/physics/quadcopter-dynamics/

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

      Well, it is depend on the flight mode he is trying to program. In rate/acro mode you don't need to calculate the angle of the IMU what you need is rate of velocity of the gyro. Only if Angle/Auto-level is programed for the quad you need absolute angle measurement. He is not mention about the flight mode he is trying to do though. One month agos I comment the same as you.

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

      Can you please provide link to the equation above ??
      so from the equation you provided above , is it for Roll angle calculation ??

    • @debsarkar4893
      @debsarkar4893 หลายเดือนก่อน

      can someone plz say how to implement in his code

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

    Oh man you're excellent :) I never undestood the PID in school.But at least now I have an small idea how it works and how to implement it on somethings like multicopter :)

  • @sophyreading7705
    @sophyreading7705 ปีที่แล้ว

    Thank you so much for sharing. I learned so much from your work. Thanks, heaps. 🤗

  • @robertparenton7470
    @robertparenton7470 ปีที่แล้ว

    Thank You! From Frisco, TX

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

    good job! looking forward to ESCs PWM write part!!

  • @acegame1452
    @acegame1452 4 ปีที่แล้ว

    I believe (I might be wrong) that the unstable state of the drone was due to the use of Euler Angles which are susceptible to the gimbal lock phenomena. If you opted for a quaternion interpretation of the rotation maybe you would get better results even without extra sensors. To be clear this is not a critique but just an idea. Love your channel and your videos helped me so much through my thesis, so thank you.

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

    Hi electronoobs love you video from India

  • @giftgodswin3557
    @giftgodswin3557 4 ปีที่แล้ว +1

    Hello my name is Gift, I love your video to me you are day best I'm learning from you as I'm also trying please keep up the good work

  • @gunarajgajurel1932
    @gunarajgajurel1932 6 ปีที่แล้ว +3

    You are a Genius. Love your Videos.

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

      Thank you very much.

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

      My pleasure. Actually was really impressed by your Electronic speed controller project and indeed it was a really complicated one.

  • @debsarkar4893
    @debsarkar4893 หลายเดือนก่อน

    Dude 😎 u are an absolute legendary legit legend

  • @divyanshu_harkhka
    @divyanshu_harkhka 6 ปีที่แล้ว +16

    Hello,
    I think that the main problem resides in the code itself.. Let me explain..
    As in the flight controller the PID errors are calculated using the pitch and roll angles, the PID controller is unable to compensate for sudden changes in movement or sudden changes in rate of rotation..
    Let's consider an example.. Suppose that the refresh rate is 250Hz giving a loop time of 0.004s or 4ms.. Now let's consider that the drone is flying with zero roll angle, and suddenly due to wind the drone starts to rotate with a rate of rotation of 100 degrees per second.. In this situation the roll angle will change only by 0.0121 ((100/32.8) * 0.004) degrees in one loop, hence the PID error will be +/- 0.0121 which is "very small" to account for a 100 dps movement and hence the PID controller fails to stabilise the drone.. The same can be applied for pitch axis..
    According to me, the PID controller should be based on degrees per second movement and not on angles.. Also, do not use the map function as it don't work for floating point numbers and returns long (data type) values..
    Divyanshu

    • @francoisguyot789
      @francoisguyot789 4 ปีที่แล้ว

      Interesting :) thanks but gyro is drifting..

    • @sumitrawat5317
      @sumitrawat5317 ปีที่แล้ว

      Bro can I use its flight controller code? Will it be worked with my drone?

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

    You are awesome man u teach so clearly now i am all clear i can make my own drone thanks a lot

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

    thank you very much for this vid!

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

    Pregunta brother El control que colocas bajo que función de transferencia lo basas o es de la librería de Arduino?

  • @abd-elrahmanmohamed9839
    @abd-elrahmanmohamed9839 5 ปีที่แล้ว

    Really great . Thanks a lot !

  • @RahulKumar-jm4yw
    @RahulKumar-jm4yw 2 ปีที่แล้ว

    Very good and easy explanation,.thanks a lot

  • @garethronaldo8692
    @garethronaldo8692 6 ปีที่แล้ว +1

    Dude you are awsome

  • @bktechnologies88
    @bktechnologies88 ปีที่แล้ว

    This is great you taught me a lot I give a thumbs up 😍😍😍 and I've built mine but how can I add a barometric sensor if I add a barometric sensor do need to code what should I do 🙏

  • @Ais-qc1bc
    @Ais-qc1bc 8 หลายเดือนก่อน

    is possible to get lat lan from Apm2.8 by arduino ?? plz make a video on arduino Mavlink

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

    Sir, i have a doubt... is it possible to use ur program for a drone which is not controlled by remote.... instead we r using GSM to controll the moment of drone.... Please answer fast !!!!

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

    Thank you very much.

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

    really nice video man ... I tried to make the same but the motors don't turn on ... i don't know why. Maybe the soldering ? or something esle ?

  • @wisehomo
    @wisehomo 4 ปีที่แล้ว

    First, I would like to thank you for sharing the knowledge and putting the effort into making educative videos with great illustrations and video editing.
    I really have something that's bugging me regarding how you calculate the angles using the linear acceleration. the MPU ciruit gives angles from the gyro sensors and linear acceleration from acceleration sensors. a rigid body in space can be fully defined kinematically by 6 DOFs ( 3 dispacements and 3 rotations). in the calculation of angle you seem to include the acceleration which you only account for 2% while 98% comes from gyro angular acceleration. I am also very confused on the formula used to compute angles using acceleration. because the gyro is attached to the body of interest (aircraft) angles should be only coming from gyros and if you want to control translation motion then you can but you will use the linear acceleration data. let me know what you think.

  • @chirayupurohit197
    @chirayupurohit197 4 ปีที่แล้ว

    Sir , can I use nodemcu instead of transmitter and reciver because it produce pwm output and control pwm using webpage.

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

    What is the metal mechanism you have used to levitate drone with 4 rods in between.

  • @juniorfenelon5251
    @juniorfenelon5251 ปีที่แล้ว

    Question: why is the servo library not used since it is usually used to control ESCs with BLDC motor? Please answer

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

    instead of arudino nano we can use arduino uno...for two axis flight controller.

  • @ParthBhat
    @ParthBhat 6 ปีที่แล้ว +1

    Hey, thanks a lot for sharing. I always love watching your videos! , may I ask what editing softwares you use ? I am guessing adobe premier pro and after effects but still.
    Cheers!

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +1

      Just After Effects. I stoped using premiere...

  • @ImranImran-pn3in
    @ImranImran-pn3in 6 ปีที่แล้ว

    merci bcp.

  • @minayakarimova
    @minayakarimova 3 ปีที่แล้ว

    Hi, thanks. i have a question. how can we make correction on gyro drift to make full imu code the help of magnetometer? i am using mpu9250

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

    10:35 you can test with 1 wire atached to load at bottom its more cheaper?

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

    it's a good work man, i understood the main idea but i need to know why you use a value of pitch angle range as i deal with only one axis (i talk about the pid balance control ) i use that code but i didn't work with me , serial monitor of that code when i use it didn't begin , what do you think ??

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

      I don't understand your question/problem.

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

      Electronoobs , the code of pid balance control didn’t work for the test and serial monitor gives nothing when when move the gyroscope sensor

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

    my pwm output from pid calculation is responsive but when it write to esc ,the bldc response is slow(its like have some delay on it) so my quad can't stable in any pid constants that i tune..
    Please help how to make my esc reponse to fast with no delay ?( thanks.

  • @vovanikotin
    @vovanikotin 6 ปีที่แล้ว +4

    You need to make integral windup protection.
    Also calculating rol, pitch, and yaw angle as you made kind a bad idea. Euler angles in 3d rotation sometimes works bad (gimbal lock) = crash.
    You need to use quaternions instead of euler.
    read about this things

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +2

      Ave Vovus! Thanks, I'll definitely improve my code.

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

      why are quaternions better ? I'm working on a similar project and i keep seeing this advice without explanation. please could you explain ?

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

      As Ave stated to describe 3D rotations you need to use quaternions, you can search for "gimbal lock" and get a very detailed explanation.

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

    is it required only pwm transmitter or not...?

  • @KARTIKCHDEY-ye1cg
    @KARTIKCHDEY-ye1cg ปีที่แล้ว

    How do you power the arduino without cable from laptop source?

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

    sir can i use bluetooth module? and operate by a smartphone...?

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

    Hi, first of all congratulation on your new spanish channel. I want to see you get your flight software to fly. So another comment. I read your code you use the elapsedTime, time, timePrev;. I just want to suggest you to try cycle time like multiwii of 2800us or higher depend on your program run. using while loop to create cycle rate.

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

    hello nice when you build the controller i like that

  • @djredrover
    @djredrover 2 ปีที่แล้ว +1

    Hey man, your problem isn't in your PID tuning, its in the actual structure of the drone. You see, you have programmed your software to assume symmetry, but your prop-arms are not symmetric about the roll-axis. Meaning, roll and pitch controls are not the same due to the angle of the prop-arms coming out of the center of the body.
    If you look at Falcon-9 grid fin orientation, they are separated by 90 deg giving identical roll and pitch ability, but if you look at the superheavy grid fins, they are at 120deg and 60 deg orientation, giving more control authority to pitch than roll (since the roll ability of the grid fins is much higher than pitch, I know i was confused at first too). I believe you have the same problem. Just orient your prop positions to be 90 deg apart.
    PS. even if you look at the other drone footage in your video that shows testing cage, those drones all have their props 90 degs apart.

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

    How are you sir...Can you use the ADXL345 you want the MPU6050 because I don't have the MPU6050 and thank you

  • @clintpereira4529
    @clintpereira4529 3 ปีที่แล้ว

    can this be used for Beta FPV drone

  • @MCsCreations
    @MCsCreations 6 ปีที่แล้ว +5

    Really, really nice work, man. :)

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

    Bro try with 2212 motor and use Q450 frame and 30am esc it will be stable

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

    👏👏👏👏

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

    how can we make the same receiver using arduino ?
    in your previous video you made the receiver with arduino but the pwm values were coming out using only 1 pin..
    But i want to make the receiver using arduino where it has multiple pins for sending different pwm values of roll, throttle, yall & pitch

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

      That receiver has PPM output not PWM. If you want PWM you should try a servo.writeMicroseconds() for each cahnnel and use a different pin for each one. Keep up!

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

      yaa it is PPM. :)
      how can we do it using an arduino ?
      because if we can do that using arduino.. that receiver can be used anywhere like a normal receiver!!

  • @lurkingcorsa10
    @lurkingcorsa10 4 ปีที่แล้ว

    thnks dude, it could minimalize the fee 😁

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

    good

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

    how do I do it for Altitude control

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

    Sorry. I am trying to make some sort if uber walter scooter for my son using ovc pipes. Do you gave any suggestiin how to make a warercproof throttke?so novwater will get in the pvc pipes i tgought hall sendors vut they do not seem very good,at sensing range rgs just go on or jf and i would kiks ti avoid using 10 sensers. Or naybe veter use 2 push buttons

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

    i am building a bicopter with arduino flight controller, please help me,share some important points you can tell ?

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

    You havent done any coding to choose FS_Select=2 in Register 0x1B, so weren't you using default FS select=0? if so, weren't you suppose to divide gyro raw with 131?

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

      If you go in the final 2 axis code in the setup loop you wil find this lines:
      Wire.beginTransmission(0x68); //begin, Send the slave adress (in this case 68)
      Wire.write(0x1B); //We want to write to the GYRO_CONFIG register (1B hex)
      Wire.write(0x10); //Set the register bits as 00010000 (100dps full scale)
      Wire.endTransmission(true); //End the transmission with the gyro
      Wire.beginTransmission(0x68); //Start communication with the address found during search.
      Wire.write(0x1C); //We want to write to the ACCEL_CONFIG register (1A hex)
      Wire.write(0x10); //Set the register bits as 00010000 (+/- 8g full scale range)
      Wire.endTransmission(true);
      This will setup the gyroand acc data to that range!
      Keep up!

  • @kevalnakar6269
    @kevalnakar6269 2 ปีที่แล้ว +1

    I think you haven't included yaw values that's why it isn't flies perfectly

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

    sir how are you ,
    there is some thing i am working on in pid issue
    and there is some thing special about not calculating setpoint in an error term , i have perfect results when changing pid rules , more ditles when you respond
    more thing about using virtual wire instead interrupt routine details

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +1

      I don't follow you. Thanks !

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

      ok,
      , i didnt mean to follow me , but it is just about acknowledge

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +1

      Thank for everything but what I meant by don't following you is that I didn't fully understood your message. Keep up!

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

      oh i am sorry for misunderstanding
      my friend
      i have been working on my cuad and i have always wondering why error = gyrovalue-setpoint
      why to add an necessary term to the PID equation , what i did simply is that i removed all the setpoint values from pid equations and i added them to the esc final signal drop calculations , the wonder result that i have achieved more stable cuad and when i searched about my way of PID i found that all scientific referances about this subject i found that (error = gyrovalue-setpoint) is a main truth in designing
      , so how my conclusions are correct!?
      is what i did a method of PID i dont know?
      if so why isnt it used in common cuadqopters or balanced systems?

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

      to be more clear , i modfied Joop Brooking code, Brooking from Norway i am sure that you know him

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

    where in the code we change the value of PID

  • @solitary062ak
    @solitary062ak 3 ปีที่แล้ว

    Help please
    If I want to compute value using a flight controller like Naza M, can I just use analogWrite(pwmPin, pwmInput) to send pwm signal?

    • @debsarkar4893
      @debsarkar4893 หลายเดือนก่อน

      pulseOut(pwmPin, pwmInput); works on arduino pins labelled with a "~" next to them like ~3 ~4

  • @appadiya5634
    @appadiya5634 6 หลายเดือนก่อน

    👌👌good 👏👏🏁🏁🏁🏁

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

    This only works with ESC's and not Brushed Motors, make one with analogWrite(); pls

  • @viswanath7168
    @viswanath7168 4 ปีที่แล้ว

    Sir please make a micromouse robot

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

    maybe hobbyking has a complete unit you can plug in and reverse engineer

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

      your test bar was not always leveling properly...could be due to pinch points

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

    i m making quadcopter using arduino uno mpu6050 and hc05 bluetooth as a transreciever...i tried but there is some mistakes in my code..can u plzz check it and suggest the way to fix it
    #include
    #include "I2Cdev.h"
    #include "MPU6050.h"
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
    #endif
    MPU6050 accelgyro;
    int16_t ax, ay, az;
    int16_t gx, gy, gz;
    #define OUTPUT_READABLE_ACCELGYRO
    #define LED_PIN 13
    bool blinkState = false;
    //Create the 4 esc objects
    Servo esc1;
    Servo esc2;
    Servo esc3;
    Servo esc4;
    //Esc pins
    int escPin1 = 5; //back
    int escPin2 = 9; //left
    int escPin3 = 10; //right
    int escPin4 = 11; //front
    //Min and max pulse
    int minPulseRate = 1000;
    int maxPulseRate = 2000;
    int throttleChangeDelay = 50;
    //SETUP
    void setup()
    {
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    Wire.begin();
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
    Fastwire::setup(400, true);
    #endif
    Serial.begin(9600);
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();
    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
    //pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);
    Serial.setTimeout(500);
    //Init escs
    initEscs();
    }
    //LOOP
    void loop() {
    //for led's
    // digitalWrite(2,HIGH);
    digitalWrite(3,HIGH);
    // Wait for some input
    if (Serial.available() > 0) {
    // Read the new throttle value
    int throttle = normalizeThrottle(Serial.parseInt());
    // Print it out
    Serial.print(" Setting throttle to: ");
    Serial.println(throttle);
    // Change throttle to the new value
    changeThrottle(throttle);
    }
    }
    //Change throttle value
    void changeThrottle(int throttle) {
    int currentThrottle = readThrottle();
    int step = 1;
    if(throttle < currentThrottle) {
    step = -1;
    }
    // Slowly move to the new throttle value
    while(currentThrottle != throttle) {
    writeTo4Escs(currentThrottle + step);
    currentThrottle = readThrottle();
    delay(throttleChangeDelay);
    }
    }
    //Read the throttle value
    int readThrottle() {
    int throttle = esc1.read();
    Serial.print("Ct th is: ");
    Serial.print(throttle);

    return throttle;
    }
    //Change velocity of the 4 escs at the same time
    void writeTo4Escs(int throttle) {



    //for gyro
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
    #ifdef OUTPUT_READABLE_ACCELGYRO
    float x,y,z;
    x=(ax/131);
    y=(ay/131);
    z=(az/7072);
    Serial.print("a/g:\t");
    Serial.print(x); Serial.print("\t");
    Serial.print(y); Serial.print("\t");
    Serial.print(z); Serial.print("\t");
    //Serial.println();
    #endif
    #ifdef OUTPUT_BINARY_ACCELGYRO
    Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
    Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
    Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
    #endif



    int A,B,C,D;
    C=throttle;
    A=B=D=C;
    //D=B;
    int yhigh=7;
    int ylow=3;
    int xhigh=15;
    int xlow=10;
    if(y=xhigh)
    {
    C-=3;
    B-=2;
    esc1.write(A);
    esc2.write(B);
    esc3.write(C);
    esc4.write(D);
    }
    else if(y>=yhigh)
    {
    C-=3;
    esc1.write(A);
    esc2.write(B);
    esc3.write(C);
    esc4.write(D);
    }
    else if(y=xhigh)
    {
    B-=3;
    esc1.write(A);
    esc2.write(B);
    esc3.write(C);
    esc4.write(D);
    }

    else if(x 80) {
    return 80;
    }
    return value;
    }
    plz check and help me to fix it

  • @ELMO7TARAMQ8
    @ELMO7TARAMQ8 6 ปีที่แล้ว +1

    there is a mistake in line 294 it should be (-400) not -4000 9:46. You probably forgot while typing

    • @ELECTRONOOBS
      @ELECTRONOOBS  6 ปีที่แล้ว +2

      ELMO7TARAMQ8 yes, you're the second person that tells me that. Already corrected that in the code on my webpage thanks again

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

    Then just get a betaflight compatible flight controller, and it will fly

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

    Bro.... Where is library link....??

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

      whar library do you need? Codes are in the description!

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

      sorry bro....got it

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

      Any Arduino IDE updated version should have that library.

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

    Make the third part bro

  • @anooftech345k6
    @anooftech345k6 4 ปีที่แล้ว

    Bro it name is eletronoob kid

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

    good job if your need help to system control algorithm . write in my email i am working in fuzzy neural network , adaptive control

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

      import numpy as np
      import matplotlib.pyplot as plt
      from module import *
      class Neuronal(object):
      def __init__(self, inputLayerSize,hiddenLayerSize,output):
      self.n1 = hiddenLayerSize
      self.n2 = inputLayerSize
      self.out=output
      def sigmoid(self,x):
      return 1 / (1 + np.exp(-x)) # activation function
      def tansig(self,n):
      y = (np.exp(n) - np.exp(-n)) / (np.exp(n) + np.exp(-n))
      return y
      def train(self,epochs,x1,y):
      ep=1
      alfa=0.01
      W1 = 2 * ep * np.random.uniform(size=(self.n1, self.out)) - ep
      b1 = 2 * ep * np.random.uniform(size=(self.n1, self.out)) - ep
      W2 = 2 * ep * np.random.uniform(size=(self.n2, self.n1)) - ep
      b2 = 2 * ep * np.random.uniform(size=(self.n2, self.out)) - ep
      W3 = 2 * ep * np.random.uniform(size=(self.out, self.n2)) - ep
      b3 = 2 * ep * np.random.uniform() - ep;
      l = len(x1)
      for i in range(epochs):
      sum = 0
      for q in range(l):
      a1 = self.sigmoid(W1 * x1[q] + b1)
      a2 = self.sigmoid(W2 * a1 + b2)
      a3 = W3 * a2 + b3
      e = y[q] - a3
      s3 = -2 * 1 * e
      s2 = np.diag((1 - a2) * a2) * W3.T * s3
      s1 = np.diag((1 - a1) * a1) * W2.T * s2
      W3 = W3 - alfa * s3 * a2.T
      b3 = b3 - alfa * s3
      W2 = W2 - alfa * s2 * a1.T
      b2 = b2 - alfa * s2
      W1 = W1 - alfa * s1 * x1[q].T
      b1 = b1 - alfa * s1
      sum = e * e + sum
      emedio = sum / l
      return a3
      def fun(x):
      return x*x*x+2*x+1
      #x1=np.array([-4,-3,-2,-1,0,1,2,3,4])
      #y=fun(x1)
      #P = np.array([[0 ,0, 1, 1],[0 ,1 ,0 ,1]])
      #T = np.array([-1, 1, 1, -1])
      #nn=Neuronal(4,4,1)
      #t=nn.train(600,P,T)
      #print len(P[1,:]) y
      #print t[1,:]
      #plt.plot(y,'ro')
      #plt.plot(t[1,:])
      #x=0
      #while True :
      # v = circle_trajectory(2, x, 0.1)
      # print v
      # plt.plot(v[0], v[1], 'ro')
      #plt.show()
      #x=x+1

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

      #separa los valores del universo y de los de pertencia de la matiz
      # si la funcion de membresia es de tipo trapeziodal
      def fTra(A,x):
      # type: (Matrix, universo) -> object
      #interseccion de la funcion de membresia y singleton
      """
      :rtype: float
      """
      a = A[0]
      b = A[1]
      c = A[2]
      d = A[3]
      if xa and xb and xc and xd :
      p=0
      return p
      ################# Triangulo ###########################################
      #///separa los valores del universo y de los de pertencia de la matiz //
      #////si la funcion de membresia es de tipo triangular //////////////////
      def fTi(A,x):
      a = A[0]
      b = A[1]
      c = A[2]
      if x a and x b and x 0 and b_t>0 :
      Or=1
      return Or
      ######## AND difuso#############
      def t_norma(a_t,b_t,op) :
      if op==1 :
      And = min(a_t, b_t)
      if op==2 :
      And = a_t * b_t
      #####Producto drastico
      if op==3 :
      if b_t==1 :
      And=a_t
      if a_t==1 :
      And=b_t
      if a_t

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

    Why even show the IDE with that font size, LOL

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

      If you watch this on a smartphone, well sorry. The video is Full HD and I can perfectly see all the text on my screen. Sorry and keep up!

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

      If you think that is fine to watch, then it's not my problem. I watch videos from atleast 1 meter from my large laptop. I dont watch video's in a typing position where I would clearly be able to read the very left edge of the screen where your code resides.
      Basically you think its fine because you can read it ?

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

    Too complicated to understand