FOC Driver + Feedback Magnetic Sensor - Arduino

Sdílet
Vložit
  • čas přidán 16. 06. 2024
  • High quality PCB prototypes: www.pcbway.com
    Project and PCB: bit.ly/3UUPb3W
    🔥Second version of my Arduino based FOC driver for triple phase brushless motors with AS5600 magnetic encoder. Works quite well! Soon we can make a harmonic drive motor for robots as the MIT Mini Cheetah.
    🔀LINKS
    -------------------------------------
    Tutorial page: electronoobs.com/eng_arduino_...
    My tools: electronoobs.com/eng_afiliate...
    False/True T-Shirt: teespring.com/it-s-funny-beca...
    🤝SUPPORT
    -------------------------------------
    Join my Arduino Course (Spanish): bit.ly/2JY8icE
    ELECTRONOOBS.io: electronoobs.io
    Donate on PayPal: www.paypal.com/donate?hosted_...
    Help my projects on Patreon : / electronoobs
    my Q&A page: electronoobs.io/forum/index.php
    Facebook page: / electronoobs
    Canal en Español: / electronoobs en español
    00:00 Intro
    08:51 Thank You
    Like share and subscribe to motivate me. Thank you
    #FOC
    #PCB
    #arduino
    #pcbway
  • Věda a technologie

Komentáře • 133

  • @Dustmadeout
    @Dustmadeout Před 17 dny +8

    Lots of people in the comment section give a lot of criticism and doubts but I think what you do for other people is amazing, providing an info and solutions for complex problems for free! Keep it up, you are doing great.

  • @SouravTechLabs
    @SouravTechLabs Před 20 dny +7

    Thank you for making code, the schematic, the PCB files open source!

  • @motherjoon
    @motherjoon Před 21 dnem +11

    A few comments: 1) You can put V-grooves on your PCB so they break off easier and cleaner. Putting a slot is a lot less aesthetic 2) See if some of your PCBs can be partly pre-assembled 3) Phoenix CNC on tindie has an arduino 328p bootloader burner that burns QFP chips in less than 3 seconds - definitely check it out so you don’t have to waste arduino boards 4) superglue is super temporary on anything that moves. Love your videos

    • @conorstewart2214
      @conorstewart2214 Před 21 dnem +2

      A lot of PCB manufacturers charge you extra if you have snap off parts on your boards since they count them as separate circuits.

  • @ranaharsh365
    @ranaharsh365 Před 21 dnem +29

    Video is missing core parameters for FOC, like: Direct axis force and current (Id), Quadrature axis force and current (Iq), Space vectors etc. Happy to see in the next video.

    • @ELECTRONOOBS
      @ELECTRONOOBS  Před 21 dnem +15

      Current sensing will ne next. For now it doesn't control the current value...

    • @Jose-tw9bl
      @Jose-tw9bl Před 21 dnem +2

      Content is allready super interesting! If you take it one step further and control currents and use them in another control loop that would be so awesome. I've been trying to do it with no success😅

    • @hellyesOo
      @hellyesOo Před 16 dny

      Great job, but still not a FOC but you are doing a great job.

  • @joshuavincent7884
    @joshuavincent7884 Před 21 dnem +1

    so nice to see you revisit this! thanks!

  • @ephraimwestenberger3565
    @ephraimwestenberger3565 Před 21 dnem +2

    Just when im about to include FOC into a new project! :) Thanks!

  • @ARKTech49
    @ARKTech49 Před 22 dny +2

    I guess the algorithm is working. video came up top on my feed. and its only 15mins old!
    Loved the content, I just learned some new stuff today.

  • @larspetersen2688
    @larspetersen2688 Před 21 dnem +1

    Always a pleasure to watch your videos, always a highlight to see what you have what you have come up with.

  • @CesarAnton
    @CesarAnton Před 21 dnem +2

    Thank you!
    I'm a fan of FOC drivers

  • @AljazJelen1992
    @AljazJelen1992 Před 20 dny +10

    Two cents from my side for anyone watching this cool video and reading this comment 😊
    First of, this is a nice introduction to the world of motor control, it covers some of the basics.
    Second, some people said that FOC needs position sensor. Thats not true. There are sensorless FOC (read about BEMF or SMO observers)
    Third, what we seen here its not even 5% of FOC, but is a good basis to build a basic FOC (im not saying its bad, im just saying that FOC is much more than setting PWMs based on angle input)
    Fourth, having high pole-pairs is disadvantage, if you want to do FOC with uC which cost below 100€. Why? Angle sensor is measuring rotor mechanical position with some inaccuracy, which is only greater with more pole-pairs, since you need to do conversion to electrical domain.
    Fifth, proper motor control (current, torque, speed) in proper closed-loop is one of the hardest things in embedded systems you can do, if you develop HW and SW from scratch.
    Sixth, as much as this video is cool, please note, this is barely an introduction (stress on barely). For anyone trying to do these things professionally, keep in mind that you can only cover part of the field and not entire motor control. Field is just to vast.
    Lastly, dont be discururaged when you fail. But also dont attempt such projects without having either immesne motivation to learn a few years or enough Control-Theory/Electronics/Firmware/Inverter knowledge to finish in one.

  • @ranganatennakoon
    @ranganatennakoon Před 21 dnem

    I was waiting for this project and tutorial ! thanks

  • @saaieshithier
    @saaieshithier Před 14 dny

    Another cool project! Thanks!

  • @user-ng2ly6nf1c
    @user-ng2ly6nf1c Před 19 dny +2

    Interesting concept! Like it! Thx for sharing.

  • @PhG1961
    @PhG1961 Před 21 dnem

    Waw, this looks really awesome!!

  • @mancio92M
    @mancio92M Před 21 dnem

    great tutorial on FOC, thanks for the tutorial!

  • @user-xb5zu6zu7j
    @user-xb5zu6zu7j Před 22 dny +2

    Good stuff! More vids like that please.

  • @rafaelguida2317
    @rafaelguida2317 Před 9 dny

    I added this video to favorites as soon as I saw the thumbnail! What a great video! You always do a great job explaining the concepts and showing how everything works, really neat pcb designs btw! I wonder if you could add some thermal vias below the IC that gets hot to help with heat dissipation. Thanks for the video!!!

  • @jetraid
    @jetraid Před 21 dnem

    Amazing, thats give me an idea for a gauge, now only need to find small motors with a lot of poles

  • @mallikarjunse
    @mallikarjunse Před 21 dnem

    Loved the start. 😂😂

  • @chuvvyyk
    @chuvvyyk Před 20 dny

    Good job! Smart knob is based on this technology!

  • @pipsqueak2009
    @pipsqueak2009 Před 17 dny

    Nice project!

  • @haydenc2742
    @haydenc2742 Před 21 dnem +5

    Can you put via's under the controller chip, then make a larger ground plane (or even a 4 layer board) so the internal copper pours can act as heatsinks spreading the heat out away from the chip...use the copper and PCB as a heatsink
    Very cool design...take a file or low grit sand paper and scuff the end of the shaft and back of the magnet before applying the glue, give is a rough surface to bond to.
    Keep em coming!!!!

  • @NilsRohwer
    @NilsRohwer Před 21 dnem

    Brilliant video and work ❤

  • @chrismayer8990
    @chrismayer8990 Před 21 dnem

    Many thanks for your great work!

  • @bobrowles43
    @bobrowles43 Před 21 dnem +1

    Love your channel and videos... please keep them coming. One possible content suggestion. I'm a novice about ready to dive into my first PCB from PCB way. I'm struggling a little with KiCad. Maybe a playlist with more detail for beginners / novice hobbyists on how to design a PCB and maybe a walkthrough with KiCad or open source equivalent. Anyway, great content as always. thank you.

  • @Jose-tw9bl
    @Jose-tw9bl Před 21 dnem

    Great content!!

  • @stm32user
    @stm32user Před 21 dnem

    Great work man

  • @muhammadshahzaib3813
    @muhammadshahzaib3813 Před 20 dny

    Thank uou for another awesome video.

  • @faultboy
    @faultboy Před 22 dny +1

    Ladies and gentleman, he really did it!!!

  • @peter360adventures9
    @peter360adventures9 Před 21 dnem

    Awesome work.

  • @fefafafe5059
    @fefafafe5059 Před 21 dnem

    All wishes are with you

  • @Nordl3
    @Nordl3 Před 19 dny

    awesome!

  • @intisharalammisbahul9927

    This just so happens to be my research topic at uni.

  • @hudsonbrown31
    @hudsonbrown31 Před 21 dnem

    Awesome video

  • @SupernovaSpence
    @SupernovaSpence Před 21 dnem

    Like others have said, I look forward to state space implementation. :)

  • @jirikucera84
    @jirikucera84 Před 21 dnem

    Great video

  • @mutthunaveen
    @mutthunaveen Před 21 dnem

    Wonderful video...😊😊

  • @stefanguiton
    @stefanguiton Před 21 dnem

    Excellent

  • @user-jv7eh9ho9s
    @user-jv7eh9ho9s Před 16 dny +1

    You are the best

  • @MutlulukVerenBilgi
    @MutlulukVerenBilgi Před 21 dnem

    This FOCin nice!..

  • @semspiri789
    @semspiri789 Před 21 dnem +1

    Apply a low pass filter to both of your inputs into PID. That will help with runaways and shaking. Learned from FPV drones :)

    • @AljazJelen1992
      @AljazJelen1992 Před 20 dny

      This cannot work for angle input, as it will result in phase shifts which is for proper FOC (current control) undesirable.
      Except if you then implement correction algorithms

  • @viniciusnoyoutube
    @viniciusnoyoutube Před 21 dnem

    Nice!

  • @weerobot
    @weerobot Před 21 dnem

    Awesome...

  • @samm7716
    @samm7716 Před 21 dnem

    could you do a part 2, where you implement other control schemes and using z domain to properly implement a difference eq as a compensator?
    very entertaining video

  • @VideoStefan17
    @VideoStefan17 Před 21 dnem

    supercool!!

  • @dennisfahey2379
    @dennisfahey2379 Před 21 dnem

    Nice video

  • @mikeseba7817
    @mikeseba7817 Před 21 dnem

    👍👍👍
    Thanks!

  • @purvr4626
    @purvr4626 Před 18 hodinami

    This is a good video for FOC basics well done man.
    A request, Please can you make a tutorial for SimpleFOC library? If possible for esp32 it would be of so much help.

  • @DJSolitone
    @DJSolitone Před 21 dnem

    Nice job exactly what I am currently working on. This is helpful. Do you intend to expose the SPI on a 2.2 revision of your gerber, because I don't feel like butchering some arduino dev boards just in order to get this cheap part.

  • @noviceartisan
    @noviceartisan Před 21 dnem +1

    You need to replace the AS5600 with a better sensor. It's not really meant to be used to way you're using it, with a spinning device, and is ideally meant to be used in an object with a fixed rotation of under 360 degrees, with the hard angles recorded in the one write PROM for permament use.
    Try the MT6701 :D

  • @Davidlahall
    @Davidlahall Před 17 dny

    Good job.... Just a side note the more practical your content( not that you know how we would use it but rather how easy it if to take from you and then for us to implement it) the more obvious it is for us to subscribe like share... ect. No need to ask us to do this when the content is good.

  • @shyebutnot8637
    @shyebutnot8637 Před 17 dny

    I see motors and circuit boards: can’t help but watch

  • @loukanikos90PRO
    @loukanikos90PRO Před 21 dnem

    I electonoobs i am a fan

  • @thunderbug1819
    @thunderbug1819 Před 16 dny

    Please make this into a product! A bldc Arduino server motor that can either be used as an Arduino servo to play around directly or as cheap and quiet servo modules that get commands via serial or can bus. Would be amazing for some projects 😄

  • @pauldls9972
    @pauldls9972 Před 21 dnem

    Your sensor is the as5048a, which only does SPI and PWM, if you want I2C you need the AS5048b

  • @stm32user
    @stm32user Před 21 dnem

    I am waiting for your helicopter video. You explained in previous video how the helicopter moves up down back forward.

  • @mates436
    @mates436 Před 21 dnem +7

    good job but I don't see the essence of FOC there. how did you solve the current measurement when you talk about torque regulation. I would also be interested in how he mastered the park and clark transformation atmga.
    finally, I would recommend you to increase the pwm frequency above 20khz, you wouldn't have strange sounds there either.

    • @akkudakkupl
      @akkudakkupl Před 21 dnem +1

      The transforms are doable on ATMega if you use tables or CORDIC for the trig functions and fixed point math of course.
      But he doesn't measure phase currents so no way to do the transforms without that.

    • @AljazJelen1992
      @AljazJelen1992 Před 20 dny

      Additionally, there is no way to use this ATMEGA for FOC @ 20kHz
      Clock frequency is just too slow to be able to read angle, process currents, perform corrections, calculate DQs, do the PI, apply svpwm and repeat.
      I mean you can do it in most basic form, but it's like putting lawnmower motor to a child toy chassis and call it a car.

    • @akkudakkupl
      @akkudakkupl Před 20 dny +1

      @@AljazJelen1992 might be able to do the algorithm at 1kHz repetition rate, but yeah. Should go to some ARM CPU.

  • @GameAndJokes
    @GameAndJokes Před 21 dnem

    Brother I m really Grateful for your video, Can you please try Closed Loop control In Simple FOC mini Board I tried so much But i couldn't make it work, Thanks ❤

  • @Build_the_Future
    @Build_the_Future Před 16 dny +1

    could you add more MOSFETs in parallel to get more current?

  • @DemocritoBinary
    @DemocritoBinary Před 20 dny

    Para contar las vueltas puedes utilizar este algoritmo:
    Sabiendo que el AS5600 tiene una resolución de 4096 puntos por revolución, entonces:
    * dif --------> diferencia entre pasado y presente.
    * num -------> Valor actual del encoder.
    * last ---------> Valor anterior del encoder.
    * turns -------> número de vueltas.
    * steps -------> Pasos totales.
    dif = num - last; // Guarda la diferencia entre el valor nuevo y el valor anterior (pasado).
    last = num; // Y ahora guarda el valor actual como pasado.

    if (dif < -2048) turns = turns + 1; // Comprueba si ha pasado por cero para contar una vuelta (cuando pasa de 4096 a 0) o descontar una vuelta (cuando pasa de 0 a 4096).
    else if (dif > 2048) turns = turns - 1; // Esto se consigue si en la lectura del encoder el valor anterior y actual cruza ese umbral y está dentro del rango del "if".
    steps = (long)(turns * 4096L) + (long)num;
    El problema lo vas a encontrar si cuentas vueltas de forma muy rápida, probablemente deje de contar bien. No es problema del algoritmo de contar vueltas, sino de la lentitud en la ejecución. Se necesitaría acceder al AS5600 por interrupción.

  • @anibalvilelarj
    @anibalvilelarj Před 20 dny

    Hi, congratulations!
    What do you think about to add an external Floating Point Unit, or a cheaper 32bit microcontroller(stm32f103c8t6) for the math calculations with SPI communciation?

    • @AljazJelen1992
      @AljazJelen1992 Před 20 dny +1

      If you plan to use current control, forget about SPI, it's too slow.
      If you want to find cool ready-to-use HW, then check STM32G431 ESC. It's perfect for proper FOC

  • @aliawrang9503
    @aliawrang9503 Před 21 dnem

    Could you also try building an FOC driver using DRV8323 IC?

  • @mr.satishfy
    @mr.satishfy Před 20 dny

    Is it rectangular hole to easy cut out 2nd pcb

  • @shokdj1
    @shokdj1 Před 20 dny

    I’m interest in this

    • @shokdj1
      @shokdj1 Před 20 dny

      Just to let everyone know

  • @scalt8367
    @scalt8367 Před 21 dnem +1

    Hi! In one of your previous videos, you mentioned that using the INA3221 is a great choice for measuring each phase of a BLDC motor. I'd like to use it to create a custom ESC for a drone, but I'm not sure how to wire this sensor in EasyEDA. Could you guide me through the process? Can I send you an email for more details?

  • @bananasba
    @bananasba Před 5 dny

    Is it possible to use back EMF to control motor without sensor?

  • @DrLithium
    @DrLithium Před 21 dnem

    Отказался от AS5600 в пользу MT6701. Выгоднее по скорости и вариантам вывода данных, да и точность хорошая - 1024 деления на оборот.

  • @apurvathak
    @apurvathak Před 21 dnem

  • @raymundhofmann7661
    @raymundhofmann7661 Před 18 dny

    Doesn't FOC mean the motor is controlled with a current that is always in a phase such as to maximize torque? I can't verify that, but i see that there is a position feed back.

  • @alifesh
    @alifesh Před 21 dnem

    I am the FOC Machine... wait, wrong topic, this is about electronics :D
    Jokes aside, good implementation. I think the other sensor is more expensive because it will allow for MUCH faster control loops. If your control logic is in say an FPGA, I2C would be a major bottleneck of control loop speed and will render the FPGA advantage useless.

  • @GeekDetour
    @GeekDetour Před 21 dnem

    What a beautiful project! Andrei, I want to be your friend - would you?🤣Contact me! I spent a week playing with the AS5048A - the one that communicates over SPI, instead of I2C. It communicates way faster than the AS5600 (roughly 10x faster) - but the readings were more nosy. I still don't know if that's just because it has a 14 bit resolution instead of a 12 bit... Also, the AS5600 has 2 internal modes: when it is rotating fast, it is also noisier - when the speed reduces, it uses some filtering to provide more steady readings.

    • @ELECTRONOOBS
      @ELECTRONOOBS  Před 21 dnem

      Thanks fot your message, I've seen other posts using it with i2c but I wasn't able to make ir work that's why I've only used the 5600.

  • @flolorenzo
    @flolorenzo Před 21 dnem

    Did you use SPI or I2C to talk to the AS5048, as this module only supports SPI. It doesn't look like you're able to use SPI with the breakoutboard

    • @AljazJelen1992
      @AljazJelen1992 Před 20 dny

      Forget about either, if you want higher speed torque control.
      Except if you can implement observers

  • @user-xb5zu6zu7j
    @user-xb5zu6zu7j Před 21 dnem

    Quick question: How do you design your PCB use MOSI and MISO, SCL and CS to burn bootloader? Do you use jumpers to select these pins as inputs for burning bootloader (from Arduino Nano) and then when its the job is done select these jumpers to whatever you need in the project?

    • @ELECTRONOOBS
      @ELECTRONOOBS  Před 21 dnem +2

      The atmega328 has those pins as default mosi miso on pins 11 12 ad 13. You Don't need any jumper just add pads dor the pina and that's is

  • @subash001s
    @subash001s Před 20 dny

    Sir what about ur MPPT SOLAR CHARGE???? Fast finish the changer the make other videos

  • @ThoCoKhi181
    @ThoCoKhi181 Před 21 dnem

    i have a question: what are the inputs and outputs of the PID? Since you used a sine wave, you were able to precisely control the position of the rotor, right?

  • @conorstewart2214
    @conorstewart2214 Před 21 dnem +1

    This still isn’t really FOC is it? Doesn’t FOC control the current through the coils rather than just setting a PWM duty cycle?

  • @widyahong
    @widyahong Před 21 dnem

    Can we only use internal sensored brusless 3 phase motor? So we can get rid zero crossing sensor and the hall effect sensor?

    • @conorstewart2214
      @conorstewart2214 Před 21 dnem

      Internal sensored motors just have Hall effect sensor inside them. They tend to be more expensive too, just attaching a magnet to the back of the motor shaft is usually a better option.

  • @rizer58
    @rizer58 Před 21 dnem

    hi! why are you using a rather expensive driver ($12)? why don't you use DRV8313 ($2) or DRV8323 ($3) or some cheaper ones?

  • @sharadvaishnav85
    @sharadvaishnav85 Před 20 dny

    I didn't know anything about this.

  • @barbaro9154
    @barbaro9154 Před 15 dny

    Where can I buy this motor?

  • @OwlingBishop
    @OwlingBishop Před 14 dny

    That's a closed loop indeed with feedback and a nice PID .. Still not FOC though :/

  • @rancillinmontgomery2480

    Then use an electronic potentiometer controlled by another arduino etc and voila robotics!

  • @conorstewart2214
    @conorstewart2214 Před 21 dnem

    Don’t PCB manufacturers not like you having snap off parts? Don’t they charge extra for that since it is separate circuits? With PCBWay don’t you need to select “Panel by Customer” and set the number of different designs which in this case is 3?

  • @zarnianali8091
    @zarnianali8091 Před 20 dny

    Sir why you did not use esp32? you always use Arduino

  • @akifozturk9492
    @akifozturk9492 Před 21 dnem

    evry time will be some people who can 't any thing and
    talk nonsense. Soman you are the king and f * c * it all

  • @user-eu2xq1qf2q
    @user-eu2xq1qf2q Před 21 dnem +1

    Привет! Извини, что пишу по-русски, по-английски не умею:)
    Я купил ту же микросхему, что и у вас, но в dip корпусе. Собрал по той же схеме, но она работает не конкретно. С маленькими моторами она вообще не работает: моторы дёргаются, сильно греется мотор и драйвер и все. С большим мотором, подобным вашему работает, но он крутится очень медленно в режиме установки скорости. Я даже модернизировал код, но ничего не помогает :( Даже большой мотор начинает дорожать и дёргаться при таких же скоростях, как у вас в видео. Само движение тоже рваное, мотор заметно дёргается при движении. Пробовал даже ставить конденсаторы в различные места, но ничего не помогает. В чем может быть проблема?
    P.S. посмотрел видео немного дальше. Вы сказали, что схема не будет работать с моторами от дронов. Ок. Мой большой мотор имеет 18 катушек. Неужели этот мало?

  • @BLATSZ123
    @BLATSZ123 Před 15 dny

    Still waiting for the scooter update

  • @Arek_R.
    @Arek_R. Před 21 dnem +1

    That's a really really bad way to panelise the PCBs, they will draw a square around it which will contain large gaps and they will charge you for all that area.
    The driver IC got hot because you have no ground pour underneath the thermal pad and also 0 stitching vias.

  • @ZENOX_BGMI
    @ZENOX_BGMI Před 18 dny

    Bro i want help to program arduino i am confused plz respond

  • @user-ee2zv8sm7o
    @user-ee2zv8sm7o Před 21 dnem

    next

  • @ashkananali8571
    @ashkananali8571 Před 21 dnem

    Can you do this on Arduino?

  • @Jai_Lopez
    @Jai_Lopez Před 19 dny

    omg this motherfukerr lol im dead @0:24 funny AF! queeeee k bron lmfol

  • @akkudakkupl
    @akkudakkupl Před 21 dnem +1

    No current feedback, no transforms to alpha/beta and DQ space, inefficient code using floats on the ATMega that doesn't have FPU, low freq PWM output by using Arduino analog write functions... Man, what a letdown :-(

    • @HelloNotMe9999
      @HelloNotMe9999 Před 21 dnem +2

      Let’s see how much better the you made is. From scratch, no pre bought products allowed.

    • @akkudakkupl
      @akkudakkupl Před 21 dnem

      @@HelloNotMe9999 No problem, I have DIY inverter board on my desk and did FOC.
      Doing it DIY doesn't excuse the laziness of using built in arduino functions that are useless for this application.

    • @08acbest
      @08acbest Před 20 dny +1

      Exactly, just what I was thinking.

  • @SolgerLemp
    @SolgerLemp Před 21 dnem

    easy to use easy PCB for 5$ ?? with 20$ shipping lol four times the price of the pcb

  • @vellu5051
    @vellu5051 Před 19 dny

    This is not FOC😢

  • @saptarshimukherjee8447

    Second 😂

  • @venkatpuneeth
    @venkatpuneeth Před 22 dny

    Third 🥉😂

  • @Service_John
    @Service_John Před 22 dny

    4th

  • @MitsuZer0G
    @MitsuZer0G Před 22 dny

    First

  • @andrejladislavsmith
    @andrejladislavsmith Před 21 dnem

    You should not use UPPER_CASE naming for variables

    • @conorstewart2214
      @conorstewart2214 Před 21 dnem

      That really doesn’t matter, it is mostly up to preference, different languages have different recommended naming schemes. The most important thing is that you are consistent and that if working in a team you agree on what to use. How you name the variables doesn’t change or affect how the code works.

    • @andrejladislavsmith
      @andrejladislavsmith Před 17 dny

      @@conorstewart2214 It does not affect how the code works or something. But these are some rules and conventions developers should follow. Have a look at that code and tell me something about consistency.