STM32 for Arduino - Electronic Speed Controller (ESC) - STM32F103C8T6

Поділитися
Вставка
  • Опубліковано 9 вер 2024

КОМЕНТАРІ • 65

  • @DeltaEngineer
    @DeltaEngineer 7 років тому +13

    You provide a goldmine of information, thank you very much. Keep it up! :)

  • @ajbeal531
    @ajbeal531 6 років тому +2

    Another excellent instructional video from Joop! You are an excellent teacher. Thanks for just the right amount of details, the working code, and for taking the time to share your work for our benefit. Super job!

  • @ED99LAM
    @ED99LAM 3 роки тому

    Many Thanks so much for the detailed explanation on how the hardware and software works together. hope to see more.

  • @knki_95
    @knki_95 6 років тому +4

    Hello sir!
    Could you please make videos on other peripherals of stm32 like adc, dac etc please. Your explanations along with scope waveforms are perfect!

  • @PerchEagle
    @PerchEagle 5 років тому

    I think you developed this channel for me dude 😊 You absolutely talk about the things I want to learn about 👍

  • @LightTecProductions
    @LightTecProductions 6 років тому +2

    Comparing timestamps directly will/can yield undefined results since it has a fixed number range (4294967296us in this case). This means about every 1.2 hours your loop will continue immediately after doing the flight controller section for a period of 4ms.
    To fix this use "while(time_now - time_start < 4000);" which will give you the correct result even after rolling over the 32bit range.

    • @mikebrown7366
      @mikebrown7366 5 років тому

      This is spot on. You must do unsigned subtract, then look at the result, to properly handle the rollover of the timer without a glitch.

  • @EdwinFairchild
    @EdwinFairchild 6 років тому +1

    just how you switch to Atmel Studio instead of Arduino IDE i suggest you dump Arduino IDE for stm32 and go for Keil which is free (with code size limit) or System Work Bench for Stm32 also free , because debugging and seeing the register values as you program is priceless!!!

  • @AdrianoBrand
    @AdrianoBrand 6 років тому

    Thanks for the vídeo and oscilloscope suggestion. I bought it from express! :)

  • @adelashour3253
    @adelashour3253 7 років тому +1

    thanks alot
    i am waiting the time that you may explain the feature of hold position of the quad
    and how to connect to GPS module to the stm to get a professional flight controller

  • @bigbernie23
    @bigbernie23 3 роки тому +1

    Hi Joop. Here a big fan of all yoru videos asking a dumb question. Why do you do it this way instead of simply using the setPWM function? What's the advantage of this? Thanks

  • @mikebrown7366
    @mikebrown7366 5 років тому

    Please look at the comment from Lighttec regarding handling timer maths properly. Otherwise, unexpected things can happen when rollover occurs. In this use case timer rollover occurs every 4000 seconds. For the main loop timer, worst case seems to be that the loop won't wait out the rest of the 4mS. That's fairly benign in this case, but in other situations tragedy could possibly result.

  • @GGAbi2012
    @GGAbi2012 7 років тому +2

    Thank you very much :)

  • @randysonnicksen9475
    @randysonnicksen9475 5 років тому +1

    Joop, Did you ever try to load your FC code into the Flip 32? I didn't see any video's on that.

  • @alula_fpv
    @alula_fpv 6 років тому

    Thanks Joop for the videos. waiting for Flip 32 version...............

  • @user-ll3kt2nw8d
    @user-ll3kt2nw8d 6 років тому +2

    This is a great project. Thank you very much for your great contribution. These video contents are precious to us beginners.I will always follow your video to learn from you
    sir i have done everything accordingly what u have explained in all the videos...............when i uploded the YMFC-32 - SETUP programme ,it appears “'HardWire' does not name a type”,an This causes the program to fail to compile,Can you help me? Thank you very much.

    • @Joop_Brokking
      @Joop_Brokking  6 років тому +1

      Use:
      TwoWire HWire (2, I2C_FAST_MODE);
      instead of:
      HardWire HWire (2, I2C_FAST_MODE);

    • @user-ll3kt2nw8d
      @user-ll3kt2nw8d 6 років тому

      Hello sir,my quadcopter can fly normaly,Thank you very much for your reply.,You are too great!the program works fine. Today I successfully passed the test program and flight control program. I can let the drone take off。
      But i have a question ?the first time the motor is turned on and off is normal. The second time, the motor can be turned on, but it cannot be turned off. Fly mode is normal, just can not turn off the motor,Can you help me? Thank you very much.

  • @talgattursynbekov9677
    @talgattursynbekov9677 6 років тому

    Geweldig

  • @subhamroy5619
    @subhamroy5619 2 місяці тому

    what if I want to change the Pin to pb6 to pb5 then what we have to do?

  • @robotcanfly4864
    @robotcanfly4864 7 років тому

    Very good.

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

    Do some tiny projects like diy for begining learners

  • @user-cq9uy9ug7u
    @user-cq9uy9ug7u 2 роки тому

    Why is it not supported to generate subtitles

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

    hi sir....
    can I use arduino nano instead of stm 32?

  • @kenwallace6493
    @kenwallace6493 6 років тому

    I scour these videos just for the programming tips. How to write directly to registers in the STM32 micro yet using higher level Arduino code when appropriate. You could do a video on this topic alone. Great stuff! BTW, cannot download your s/w from your website for some reason??

    • @Joop_Brokking
      @Joop_Brokking  6 років тому

      My server is down for the moment. And it will take a while to get it running again. Very inconvenient :-(

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

    Hello Sir, I already completed the hardware and all setup but during the calibration of ESC to synchronize the speed of the motors my front right ESC burned out (throttle in full upward position). Last time, my right rear ESC also burned out. Kindly help what are the solution on that issues. I used and follow according to your recommended hardware and during setup all are correct. Thanks.

  • @MrJmpast
    @MrJmpast 4 роки тому

    Hi, I get a square wave, but only get

  • @louies6914
    @louies6914 6 років тому +1

    Hello Joop.Can you recommend a starting point for an absolute beginner in embedded programming and in programming in general?.What i don't know is whether to start studying assembly language for a specific microcontroller or to start with general purpose C/C++ and then to make the transition to the microcontroller world.Please give me an advice on where to start and on which particular aspects of programming i should insist on.Thank you!!

    • @Joop_Brokking
      @Joop_Brokking  6 років тому +1

      The Arduino environment and the datasheet of the ATmega328P are very good starting points.

  • @noamkoren1839
    @noamkoren1839 6 років тому +1

    Hey Joop why not use the old way for controlling a brushless motor? like your YMFC, I tried it with the STM32 and it wokred fine.

    • @Joop_Brokking
      @Joop_Brokking  6 років тому +2

      With the STM32 it's possible to control the duty frequency. This way I'm sure that all ESC's for multicopters can handle this pulse.

    • @sidharthtalia
      @sidharthtalia 6 років тому +1

      I too preferred the bit-banging method because then I can do that on ANY pin I want, however, if you produce the signals using the timer, the major advantage that you get is that you can do stuff(communications with sensors, math etc) for the entire duration of the cycle instead of wasting at least 1000 us of time(the time after the first 1000us). This is a huuuuge advantage if you're trying to make something fully autonomous(think GPS+IMU+optical flow+obstacle avoidance + telemetry ) ;) . Also, Joop, I would love it if you could check out my code for a quadcopter (stabilize+altitude hold) , it runs at 400Hz - github.com/naughtyStark/Altitude-Hold-Drone-Simple

  • @ganeshramnandakumar1773
    @ganeshramnandakumar1773 6 років тому

    If we wanted to run this code at higher rates or lower rates. Which part of the code has to be modified?
    Is this the part I need to change?
    //Gyro angle calculations
    //0.0000611 = 1 / (250Hz / 65.5)
    Say if I added more code and I am able to get 200hz loop rate. Should I use 0.00007634(1/200/65.5) instead of 0.0000611? Is there any other place I need to change the code?

  • @randysonnicksen9475
    @randysonnicksen9475 5 років тому

    I can't imagine how much time it took to figure out these details. I've read through the STM32 datasheet and reference manual and it gets a bit overwhelming. And then how do you figure out that setting a pin to PWM mode links it to the alternate function??? You've saved me so much time and frustration. Thanks.
    I am proceeding with my plan to send telemetry data using DMA, and receive the GPS data also using DMA. I'll keep you posted. Just wondering...Have you ever tried experimenting with longer loop times? Is it really noticeable if you would double the loop time to 8ms?

    • @Joop_Brokking
      @Joop_Brokking  5 років тому +2

      Great to hear that my videos help. I always try to keep the loop time as short as possible. With the YMFC-32 it's possible to get even shorter loop times. However, it's always a good idea to have some extra room for your own extra's :-)

  • @josephdepont434
    @josephdepont434 3 роки тому

    Hi joop nice work, can you explain me why do you set 5000 ARR value ?. Thank you.

  • @tedelctro6849
    @tedelctro6849 4 роки тому

    hi sir i bought FLIP 32 and i tried to load your program to the filp 32 but in the Arduino message it is saying device not initiated could u please help me sir

  • @poweredbysergey
    @poweredbysergey 7 років тому

    Cool

  • @TanishqIsHere
    @TanishqIsHere 7 років тому

    I clicked on your video faster than _Flash_ .

  • @divyanshu_harkhka
    @divyanshu_harkhka 6 років тому

    Hello again,
    How will you connect GPS to that Flip32 board..?

  • @aunullahqaiser4411
    @aunullahqaiser4411 7 років тому +2

    why 250hz,since stm32 is faster why not reduce the frequency and get better control over the motor.

    • @divyanshu_harkhka
      @divyanshu_harkhka 7 років тому +2

      Because the refresh rate of electronic speed controller (ESC) is 250Hz..!

    • @Joop_Brokking
      @Joop_Brokking  7 років тому +5

      I want to give people enough room (time) to create their own code in the main loop.

  • @zacharycchen
    @zacharycchen 6 років тому

    Hi Joop,
    I am working on a physics project for school on the topic of electric motors and efficiency. I can’t find a clear answer to this anywhere on the internet : Is the pulse given to the ESC directly proportional to the RPM of the motor? Meaning does the ESC give the motor more current under load than when under no load with the same pulse?

    • @Joop_Brokking
      @Joop_Brokking  6 років тому

      Electronoobs made a video about how an ESC works. You will find your answer there: ua-cam.com/video/8LXPcJD6hEA/v-deo.html

  • @prmajiq
    @prmajiq 5 років тому

    can you make it with attny13 too?

  • @Kongfufrank
    @Kongfufrank 3 роки тому

    Calibração esc opto??

  • @kresimirbakovic2614
    @kresimirbakovic2614 6 років тому

    Can you give me some advice about ESC, i’m planing to built quadcopter with these things:
    1. Brotherhobby R2 2207 2400 KV motor
    2. ESC 40 A ZTW
    3. HRB 4S 14,8 V 5000 mAh, 50C battery
    Do they match? And if not what should i change?

  • @pankajk0714
    @pankajk0714 6 років тому

    My ESC is racerstar rs30A blheli_s opto can it will work with the 1000kv motor because i am making quardcopter F450 frame

  • @vikrantsingh47
    @vikrantsingh47 4 роки тому

    thank you for this amazing project. this will be my first drone project, can I use STM-Nucleo F446RE? would the code work with this nucleo board?. thanks for the time.

  • @petermeiner3574
    @petermeiner3574 7 років тому

    But you allready used an osziloskop....what was the reason to change it?

    • @Joop_Brokking
      @Joop_Brokking  7 років тому +2

      I want to know if these kind of budget oscilloscopes are any good. Most sources (review videos and forums) are 'forcing' people to buy a expensive oscilloscope. Not many have that kind of budget. That is why I bought one so my viewers can see for them self that it works fine for my projects.

  • @rohityjet4812
    @rohityjet4812 6 років тому

    Hi joop,
    would you told me how data can share or exchange between ArduPilot and mission planner ground station, or packet format of exchange data. so i can display my flight controller data by using mission planner ,such as altitude, location on map etc.

    • @Joop_Brokking
      @Joop_Brokking  6 років тому

      Check the ArduPilot forum for information about ArduPilot.

    • @rohityjet4812
      @rohityjet4812 6 років тому

      Hi... Joop Thanks, will you update some video about how to make ground telemetry Box that you are using.

  • @danarchuleta3244
    @danarchuleta3244 6 років тому

    Hello Joop. Great educational videos! Can I send you a Teensy 3.6. ? My gift to you. I would love to see you build your quadcopter with this powerful little board.

    • @donkelly36
      @donkelly36 6 років тому

      Dan Archuleta I’ve got it ported over and running on a Teensy 3.2. Works great. I did my interrupts different, but things run fast!

    • @Joop_Brokking
      @Joop_Brokking  6 років тому

      Dan, thank you for the gesture. But I simply don't have the time to start working on another microcontroller. It's already a time-challenge to get it to work on the STM32.

  • @yxhankun
    @yxhankun 5 років тому

    void setup() {
    pinMode(PB6, PWM); //output
    TIMER4_BASE->CR1 = TIMER_CR1_CEN | TIMER_CR1_ARPE; //channel 1
    TIMER4_BASE->CR2 = 0;
    TIMER4_BASE->SMCR = 0;
    TIMER4_BASE->DIER = 0;
    TIMER4_BASE->EGR = 0;
    TIMER4_BASE->CCMR1 = (0b110 CCMR2 = 0;
    TIMER4_BASE->CCER = TIMER_CCER_CC1E;
    TIMER4_BASE->PSC = 71;
    TIMER4_BASE->ARR = 5000; // auto reload register value
    TIMER4_BASE->DCR = 0;
    TIMER4_BASE->CCR1 = 1000;
    }
    void loop() {
    delay(4);
    loop_timer = micros() + 4000;
    TIMER4_NASE ->CNT = 5000;
    //flight controller code ehere
    TIMEr_BASE->CCR1 = channel_1
    // end flight controller code
    while (loop_timer > mirco())
    }

  • @AdventureTechnologies
    @AdventureTechnologies 6 років тому

    I have done some work with a futaba and got sbus to work using the arm chip. Compared to pwm it is much faster. I posted the code here: github.com/Chasedog98/SBUS_explore Try it out and see if any changes need to be made.