Brushless DC Speed Controller
Вставка
- Опубліковано 23 лис 2024
- In this video I'm going to show how i built a brushless DC (BLDC) ESC (electronic speed controller) based on an Atmega328P microcontroller. This ESC was a prototype for a much larger one that I'll be using to drive the 1500-watt motors on my submarine. The video also explains the theory behind how a brushless DC motor works, and some troubleshooting tips that you may find helpful if you build one of these yourself.
The code i used for the first test can be found here:
simple-circuit...
I later modified it to add a reverse function and adjusted the startup sequence settings to get a smoother start to my motors.
A guide on using the Atmega328P microcontroller by itself (without the arduino board) can be found here:
www.arduino.cc...
Hardware used:
MOSFETs: IRLZ44
Flyback Diodes: MUR120G
MOSFET Drivers: IR2101
5V Linear Regulator: LM7805
MOSFET Driver supply regulator: LM317
The motor used in the first part of this video is a very old brushless motor i used to fly on a drone, and I'm not sure what the part number is or if it's still in production.
The submarine motors are Turnigy SK3 6374-192 kV brushless motors. I've replaced their ball bearings with bronze sleeves, and coated the rotor and stator with enamel to protect against saltwater.
Arduino Code:
drive.google.c...
I've updated the description with a link to the arduino code
without checking the source it reeks of the electronoobs guy. he's the king of the 328p haha
@@jstro-hobbytech 😊
Can you plz given me the circuit diagram or garbal file
when will be the video about the bigger ESC
@@jstro-hobbytech@@a
You know you're in for a treat when the video starts with the words "My submarine...".
I died hahaha
Exactly...
My submarine-themed bathroom is relaxing to see while taking a dump.
My exact thoughts lol
Haha EXACTLY. A rare combination of words you hear spoken indeed.
As with any experimental project, you start from the basics, and when you get it kind'a working, you add other options to fine tune exactly what you really want. Amazing how large such circuits end up being. Been there done that so many times... Thumbs Up!
It’s because the brushless controller, like servos don’t just take PWM control, they need an exact pulse timing to initialise. If you use a servo library it’ll solve your issues.
They need an exact position of winding wrt magnet position & polarity.. but this is not achievable. with external servo pos. control .....
Here target is stator wdg./ rotor magnet ..ext.servo is for external target/ plant control
It's still PWM, just a particular rage of duty cycle. I'm sure this guy was able to figure that out. The problem with RC ESCs is that they are a bit picky about what signals you send them to start up. Some won't recognise a servo "0" or "180" degree, and will instead only accept signals between e.g. 20 and 160 degrees. On startup they often do some sort of input calibration, so once again if you have the wrong signal being sent at that moment it'll mess things up.
Great video, BLDC motors and its ESCs are tricky and most videos available get some details wrong and drive viewers to non working solutions and broken code. Your solution works and your explanation is very good. Thanks
I just wanted to say thanks for sharing your project, It provided inspiration and impetus. I had been putting my own ESC project off for a while. A combination of analysis paralysis and trying to think of all the required features. I decided to go with through hole components (majority) and an arduino after seeing this video. My motor is now up and running. Thanks again.
Holy shit, you did something most UA-camrs failed badly to do without even needing external comparators.
Very nice video giving a lot of insight. Congratulations.
One humble improvement I can suggest is not to use a Linear Regulator (LM317 at 10:41) but instead, use a DC-DC converter (aka switching power supply to convert your 24-28V down to 14V).
When you use a linear regulator, you are burning half of your battery capacity [ (28V-14V)/28V = 50% ] on the LM317, basically converting it to heat.
Switching power supplies, on the other hand, can be as much as 99% efficient, and therefore use your battery capacity for propulsion instead of heat.
Keep designing
Very good! A very clean guide through ESC design. The only mistake (that actually, almost all hobby ESCs have) is that you should not switch phases at zero-crossing. Zero-crossing happens in the middle of the current phase, not at the end. So you switch phases a little bit too early. That still works obviously, but it reduces efficiency and increases torque ripple.
Now add PWM, current limiting and smooth start and you got a usable brushless motor controller. Probably better to move to STM32 micro with many needed hardware peripherals already built in.
This is so interesting and impressive! I finally really understand exactly why 3 phase motors have 6 wires, how all these coils relate to only 3 phases, and how the number of magnets are related to the number of coils per phase.
When you were talking about needing a hall effect sensor, I realized you could deactivate one phase and measure voltage on that phase - but then you mentioned using the inactive phase because there's always one that's not driven. Super clever.
There are only two things I may have missed or you didn't address them: the waveform (PWM, simulated sine, or simply square - which is what you're doing), and the other is timing: the ATmega328 does not have reliable timing because of its factory default interrupts. I believe people can get much faster execution and much more reliable timing by programming them in assembly. This probably doesn't matter since you're relying on an interrupt for your timing anyway - so the measurement from the motor is your clock in a way.
Wow well done and thanks for sharing the code. be careful out there the ocean has this way of destroying everything that sied it looks like you know what you are doing! having been on a submarine With The RCN and noting that they spend a lot of time in dry dock and almost never sail I have a lot of respect for what you are attempting.
I was encouraged to see that you used a dual trace scope. I wanted to build my own esc but my motors are delta wound and I couldn't figure out how to detect the zero crossing point with my dual trace scope. I think I'll buy a wye motor and compare a phase with the neutral point as you did.
When running the motor there will always be one phase that is inactive during each step, thats the same for y and delta. Since the inactive coil will move along the permanentmagnets there will be a voltage induced, which can be measured. The point youre looking for is the moment when this induced voltage changes its sign (crosses zero).
@@jonibeYT _"...thats the same for y and delta."_
I started thinking about that. It makes perfect sense. With the delta motor only one coil is energized at a time. I'm going to run some tests with that in mind.
I'm just a hobbyist. The problem for me is I have three hobbies, electronics, programming and animation. If I run into a wall, sometimes I will switch to a different hobby and stay zoned in for months at a time. As a result I lose focus on my other hobbies.
I have to tip my hat off to you Sir. This video really refreshes my knowledge of electronics with all the buzz and straight information on the subject matter. I am looking forward to check out your other videos to bring my knowledge of electrical stuff to on par.
Job well done Sir too.
Have yourself a Merry Christmas and A Happy New Years fella. Hope great things for us both in the New Year.
Super, c'est très intéressant ces explications,et c'est très sympa de voir le cheminement pour en arriver au produit fini.!
I found my way here from the cryocooler videos, and YOU HAVE A SUBMARINE! This channel is amazing.
peace be upon you
Thank you for sharing the brushless motor driver code, thank you very much❤🌺🙏
You are the king!👑I didn't know you can use motor's coil for position sensing.
Yeahh me too!
You are a holy engineer. Whispering to esc and motors and stuff. So inspired by your work as a high school student!
If you made this as a product, I would definitely buy it
You say that a "Y" configuration produces more torque, but the more appropriate thing to say is that it produces more torque at a given current.
Assuming each phase is 1 ohm and we're powering the motor with 10V, at zero RPM the "Y" configuration will draw a maximum of 6.66A, while the delta will draw a maximum of 20A. At these respective currents though, the "Y" motor produces %66 of the torque of the Delta motor while only drawing %33 as much current.
My example and numbers assume that the all three half-bridges are either 'pushing' or 'pulling' at all times instead of only two at a time like yours, but the numbers are similar either way. If we leave one half bridge turned off, at zero RPM the Delta draws 10A, and the "Y" draws 5A but produces the same torque as the Delta.
Due to the increased inductance per phase of the "Y" type though, it will have a higher impedence at a given RPM, so you were right in saying that Delta is faster. The way I prefer to think about it is that "Y" configurations are good when current is the limiting factor, and Delta configurations are good when voltage is the limiting factor.
Fantastic video though! I love your channel.
EDIT:
I see you're using the IR2101. I was designing an ESC with those aswell, but I recently discovered the IRS2184. Just like the IR2101 it supports bootstrapping, but it also lets you switch from HIGH to LOW with a single input pin, and has a built in 400ns dead-time so your high side and low side MOSFETs dont transconduct. It also has a turn-off pin so that you can easily throttle your motor with a PWM signal generated by your Arduino.
This was an exceptional good video precisely about what I was searching for. Thank you good sir!
1:53 I´ve read, that holding the ends of a resistor at the 2 points you about to connect, before establishing the actual connection, is beneficial in limiting inrush-current, that can wear out components... A soft-start. The resistor can then be removed.
amazing channel canot wait for part2
Congratulations!
Your video is the best tutorial about the ESC for BLDC motors. Finally, I could understand how does work the BLDC with back EMF control.
Thank you, a lot.
The Arduino code is very optimized for speed, otherwise it would not usefull for this kind of motor control.
Your hardware considerations about the use of the Atmega328's internal analog comparator was great, as well as the Interrupt.
Did you finished the PCB design?
Do you think or plan to sell or share it?
I would like to get it.
Did you test your maximum speed acquired, at despite for your purpose you don't need very high speed, I think.
I'm looking to make my own mixed signal ESC for some DIY quadcopters and I want to use analog computing for the inner control loop. The idea is that sensors provide analog signals while the computer can control it either through sequential logic or a DAC. After computation the net output is fed into a voltage controlled oscillator running an endless loop shift resister which selects the BJT/FETs needed. The idea is that all of this takes place at the rotor so that each rotor has it's own inner control loop with mixed signal state mechanics.
Sounds complicated.
I guess the idea is you WANT complicated!
Well the tradeofff is simplicity for better inner loop response latency.
Great now I’ve started my day thinking about detecting runaway effects and oscillatory feedback
nice to see a demo using back EMF instead of an encoder
Very super description and explanation! Thank you very much! Tell me, is there or will there be a continuation of the video?
This is pretty cool. It's a lot simpler then I would have thought it would be. I mean the feedback stuff is a bit complicated. But it was simple before that 😂
It is good as a homemade esc but it is nothing compared to commercial escs, like blheli32 escs, they have a lot more functions, like low voltage cut off, stuff to help with starting large motors, braking, configurable acceleration rates an using PWM to emulate a sine wave, just to name a few of the advanced functions.
Great video , your voice was super clear , thanks
Great Video! Thank you for sharing! God Bless you!
When you know your stuff you able to explain it even to babies. Great video.
I still have the scars across my fingers 3 years after breaking the golden rule of "No Props in the shop" and having a unbalanced motor break free of its mount and bite me.
I'd highly recommend considering it. :)
If you want to handle huge voltage you can run the esc at 5volt and the it triger the MOSFETs with the cooler that are connected to the huge voltage
I want my OWN submarine!
Can i use yours sometime? Hmmm?
This looks like much fun!
I can't dive any more due to eustachian tube spasms in one ear, so this looks like next best thing.
Maybe better! Def better. 👍 👌
This really planted an idea in my head. Could the Atmega and logic be replaced with another BLDC motor used as an input. Hand crank (or pedals in my head) drives a motor to a set of MOSFET drivers to the output motor. Keep the whole thing AC. Manual Speed Controller?
Correct me if I am wrong but the feedback lines are connected to the Y point of the motor windings.Therefore, D7, c2 and c3 see exactly the same input.
Bro is the next micro reps
Would have been nice to show how to calculate the network resistor values for the processor?
Great Job and analysis.
yes thanks.. if it's a free source atmega328 bike controller for everyone, well the part, pcb and code awaited
Thank you very much for sharing your knowledge. Could you please help me by changing the code, replacing the speed control instead of the keys with a potentiometer?
Your mike is very noisy witch is sad because your content is very good.
Thank you very much for sharing your project and knowledge. I really liked this ESC. You said you would make an ESC for 40A in the next video, but I couldn't find the video, have you already done it? (I need an ESC for a higher power motor, I think about 40A is enough..)
congratulations great video!!
Soon you will be recognised
Great job, keep up the good work!!!
Greetings Sven
Great Job!! Thank you for Sharing!
Very informative video 👍
How did you modify the BLDCs for saltwater?
The MOST IMPORTANT Question.
Can you please let me know how did you wire slide switch for reverse forward function?
Your Answer wii be Appreciated 👍 👍
good explanation, thanks
Very nice all bord
Thanks for answering a lot of questions I previously had. Do you have a "Super Like" / donate button?
Hey Hyperspace, could you give me a quick explanation on what the MUR120G diodes are for? Or are they simply flyback diodes? in which case why is the low side one needed?
This was amazing!!!
Well done video, concise. But what is interesting to me is you are putting that motor in the water like that? Or did I miss your cover on them?
Why wouldn't you have motor inside and shaft to outside. Cooling them with the water?? Any particulates that gets inside can jam the rotor.
Very good video. It deserves more views
Some nice work there! I'm curious about (more than) one thing ... how did you diagnose that the voltage spike was resetting the AT-mega?
The feedback signal lines on the full diagram are connected to the wrong ends of the windings.
I do understand a major part of this but not all and not properly (I'm currently in 2nd year of my electrical engineering)
Can you guide me as to what will I have to do if I wanted it to work with 48v and around 150amps.
Also, can you upload the circuit diagram too.
It'll be very helpful.
Wow. I understand every bit of it, I've designed my own circuits to do all kinds of stuff... but I've never had ANY engineering classes. Not one.
I'm completely self taught, I just figured it out, by reasoning though it.
Where i learned? By reading data books published by the IC manufacturers, of course. You'll find a treasure trove of great info in there!
Everyone should do it, if you want to learn.
Some of the best ones are "App notes," AKA application notes. Those have theory, explanations, reasoning (strategies, etc), everything you'd want.
You can usually download them for free.
congratulations bro...
Nice info, thanks :)
flawless
Love your channel.. great content!! 👌
Can I please know what would be the process in case my motor had hall effect sensors.
All water circulation pumps in EU use similar circuit. Pumps like Wilo. I need driver board pcb. I can't find any information on those pump corcuits
Nice motor sound, but b4 you go to Atlantic ossion try enter your code and fine the active of pin7(PD7) of your circuit !!!?
Hello. Shouldn't the Vs (6.) pin of the IR2101 be connected to the junction point of the high side and low side mosfets? for bootstrap.
Very nice!
Iam having some douts bro
Is it possible to upgrade 30a esc to much higher ampere by. Addiing parallel mosfets. (Same voltage range)
What are the issiues of this idea
I wonder if we could make the raspi Pico mcu run the pattern described in the programmable gpio "bit banger" peripheral thingy.
We want the same explanation, but I have to run a larger motor, 320 volts DC
Subscribed sir very good content thanks!
Two questions. How do you need to modify the motors for run in salt water? And can we scale this ESC to support 250 Amp. I need one for high speed boat
First of all, congratulations, how many amps can it deliver continuously?
Hey, I’ve been trying to build one for sometime. I didn’t get IR2101 at first so I used the bootstrap circuit to build a hbridge but it didn’t work, and then I tried driving only the high side with your circuit by connecting one driver burned my raspberry pi pico and switched to stm8. Is there any references of not using the bootstrap circuitry as the data sheet recommends? 10:37
No. It is best to give the micro controller an independent power supply.
hello my friend. Can you share the final version of the circuit diagram and software? I'm thinking of using it in electric car control. I don't want to buy ready made motor driver. :)
Hi, how did you determine the resistance values of the new back emf voltage divide resistors?
Can you share the final code with the option of the reverse switch?
Super great. can you provide also the motor 3D printed frame ?
Nice video
Greetings Hyperspace Pirate. First of all thank you for sharing your project. I have three questions:
1) This circuit of yours for brushless motors, is it necessary to give a push to the motor to start it, like many circuits given on the internet?
2) It serves for HD and CD ROM motors with 3 and 4 wires?
3) Can Arduino Nano be used? Thanks a lot.
I followed this and the motor rotates but is vibrating, can you help me?
Can you tell me what I don't understand at 7:17 minutes? What is the purpose of the three resistors connected to the ground?
good course
Have you tried using VESC?
3:55 What if we use these switching instead ?
I realized.
I see in the video the sequence on/off of the switches is this:
s1: 110000
s2: 000011
s3: 001100
s4: 000110
s5: 011000
s6: 100001
But wouldn't it be better if it looks like this?
s1: 111000000011
s2: 001111100000
s3: 000000111110
s4: 000011111000
s5: 100000001111
s6: 111110000000
Waaait, doesn't delta have higher power (and thus torque) than star?
And RPM is controlled by the switching speed anyway?
Negative ghost rider how are you shorting the drain with 12v over its threshold? And the atmeg as well where's your second source or voltage drops for that? Also why connect source to ground an the datasheet says not to go over certain parameters or else the mosfets were destroyed themselves? Can you show all details if not explain it with out skipping the important steps please and thank you
I tried to make a similar circuit, but I could not get the result I wanted from the IR2101. I'm in trouble with the seventh pin. Even if I apply PWM to the Hin input with the second pin, it produces a constant 7 volt output (seventh pin Ho), which causes the mosfet on the H side to remain open all the time. Do you think the diode is causing this situation?
Can you email me a picture / schematic of how you wired your circuit?
Hey, can you share the first ESC_Test_Code? I would be very grateful if you could share it with me. :)
Bro please build the final esc
Did you try vesc at all?
Also the video has a fair amount of white noise in the background, jus so you know
Would you be able to slowly turn BLDC motors with an ESC like this?
Great broo
hi, very nice.thanks
Hey! Great video, very simple and straightforward, but I think there is a big mistake in control logic. I never built an ESC yet but I am pretty sure that zero-crossing happens in the middle of the phase, not at the end. So If you will switch the phase at that moment it will work, but I guess the efficiency will be very low because you always will be half-phase off the ideal timing. What you should do: use the previous zero-crossing time to get an idea about a phase duration and wait half of this duration AFTER zero-crossing and only then switch phases. I see the same issue in other DIY ESC builds. Please respond if you are sure that I am wrong. I would like to figure this out for sure.
These DIY escs use a driving strategy called 6 step switching, where for a full magetic field rotation, there are 6 different electric states. Each zero-cross represent the end of the current step, that may also be the end of that "phase".
the term "Zero crossing" is the
" motor B.E.M.F. crossing @ zero volts when its voltage polarity reverses.. from +to- or -to+ ... "commutation instant" is another event.. and is related to " current" going through zero , before changing polarity. & is not necessarily in phase with BEMF .. there's always more " current" phase lag @ light loads especially @ higher speeds....
therefore there's always lower torque @ higher speeds even when driven at rated motor current.
That thing looks like it could go to the titanic far more safely then that carbon fiber death trap
is this controller can be operated in 12kw brushless motor? i mean if we change a little parts. and also are we have to change some circuit to operate a 12kw bldc motor?