Many people claim that your videos are too complicated but I think that its the way to go. Well... Nobody thaught me about eletronics. I am learning because I want. The thing is that even if the subject requieres knowledge I will try to learn the "basics" and then come back to your videos. I think people should do that. A big part of what I know about eletronics comes from you, because I feel motivated to learn more and more so I can understand better the videos.You are a genius GreatScott! Keep this solid work. You inspired me and a lot of others. Thanks for the effort!
I am VERY glad that I found your videos. I'm building an vacuum cleaner robot and need to build simple, but powerful ESC. Now I finally understood how to do it. Brilliant!!!
I guess I should add my own comment. First, I just want to say this is a FANTASTIC video and I hope to see more. I dearly wish the people saying stupid things like "duh... just buy a ESC" would understand that the point is to learn and develop new ways of doing things, as well as to understand why ESC's work the way they do. So... Let me be sure I understand: 1. You have to start "open loop" as far as position goes because you don't know where the motor shaft is... you just pulse it and switch the power back off when the voltage rises in the coil. You switch to the next coil after a set time. This is slow, because the A2D takes time, and the speed is pretty much just controlled by the frequency of the coil switches, not by the voltage applied, because you can't apply any more voltage without frying to motor. This is a "stepper mode". It should have good /holding/ torque, but the phases are too far apart to have anything like reasonable /detent/ or "pull in" torque like a regular stepper. The fact that you don't know where you are doesn't really matter because you can't drive the motor any harder anyway... if it's "skipping steps" against a load... oh well. 2. Once the speed is high enough for the magnet to induce a detectable back EMF voltage in the the third / undriven phase, we can use a comparator to trigger on that as our signal to switch to the next phase. At this point, the speed of the motor is controlled by the voltage we apply to the driven coils. As we back off the voltage, the motor moves less quickly to the next phase, and the back EMF spike appears later so we switch slower. Or we apply MORE voltage, not bothering to sense the voltage buildup in the driven coil because we know it won't get high enough to fry the coil or to pull more current than we can provide because it won't have time. The back EMF pulse happens quicker, we switch faster, and so the frequency and speed increase. 3. At some point, we probably can't sense the back EMF pulse quickly enough and we go into another open loop mode where we are just hitting the coils with everything we have and switching based on what we think the motor needs. If we start seeing the back EMF pulses again, then we can switch out of this mode and back down to mode 2. Or perhaps we still see the EMF pulses, but we must switch /before/ they appear. We are only looking for them as confirmation that the motor "caught up" with us. If we wait for the pulse, it's already too late to switch to the next coil. If we go ahead and switch, and the pulse doesn't show up when we expect it, then the load on the motor is too great and we have to slow our switching down a bit to avoid falling out of phase. I'm not sure this mode is actually necessary, but I think it may be why you are unable to get faster speeds. All of that could be avoided if there was an encoder on the motor. In that case, we could simply pulse the coil that matched the current position of the shaft to get started, we could always know when the motor was ready for the next phase, and we would never lose the back EMF pulse as we ran slower or faster. I'm really interested in the use of BLDC motors to make servos. I have a good encoder and some programming skills, so I hope to develop some ideas in this space soon. In the mean time, if you want a fun encoder to play with let me know. They are magnetic, non-contact, and still support very high speeds (28K to 75K RPM) and resolutions (4000 to 360 clicks) and... have a digital mode where you can just read out the current position instead of having to count the encoder pulses. In any case, I'm completely fascinated! The use of the back EMF pulse is such a cool hack and seeing all the complexity of it from your exploration really helps me understand the limitations of this system. THANK YOU!
This video has saved me! I didn't understand why my motor didn't run continuously, and at last I found this video that is the only on youtube which explain why! Thanks a lot
I like that you took this problem from the very roots, but with better and smarter ic you can control in a much simpler way and more attractive for your viewers.
You can use hardware comparator that is in Arduino, at least for BEMF - you can attach virtual ground to AIN0 and phases to 3 analog pins and use internal multiplexer to choose which pin to use. It is much simpler and less error prone (PCINT aren't best solution for time-dependent tasks, and driving BLDC is such) than using external comparator. The only thing you have to have in mind is voltage levels, but simple voltage dividers should do the trick. Also you have to have in mind, that drone BLDS can operate at hundreds of amps, not like your small chip can deliver - 4A. Please tak that into consideration when selecting proper MOSFETs in the end of video.
Moreover, with timing of about 4-8 us you are meeting the smallest thing Adruino can count. Take in mind it works at 16MHz and by default uses 8x clock prescaler. This gives you the time of 0.5us per clock cycle, quite too much to be sure about the time microcontroller will switch your inputs.
I just want to say, he was probably getting screwed by some of the default Arduino code that runs in the background all the time. Joop Brokking has an excellent video on why he switched to Atmel Studio because of the Arduino fluff
I am not sure if any one else has mentioned it, firstly appart form a very good tutorial, you are only running the motor in synchronous mode. Like a stepper motor, to get more speed you need to increase the frequency. It is not true brushless where the ESC only performs commutation as dictated by motor position and in such a way speed is governed by the voltage applied and the KV rating of the motor. Most ESC's start in stepper motor mode but as soon as the BEMF is sufficient to detect commutation state they switch over to full brushless, which is more efficient. and allows for faster operation. Thank you.
Rotor Rant let me check I understand. To begin with we use the BEMF from the third phase but once there is enough rotational energy to keep the rotor flywheeling then we can just ignore the sensor reading and just rotate through the different phases and assume that the motor is keeping up?
Ah no sorry if I have not made that clear. Also sorry if I misunderstood you. The Back EMF on the open winding is what you use to determine when to switch the phases. In your video you said if you want to make the motor go faster then you increase the frequency. That was not quite right if you want it to go faster and your ESC is comutating correctly then you should increase the applied voltage and this may (depending on the load) increase the frequency if the motor goes faster. If you force the frequency to increase in the code you will loose synchronization. So maybe I misunderstand you but If you are going in free running comutation then the speed should be proportional to applied voltage, If you code is not fast enough you will loose synchronization so it seems odd that your motor does not go very fast. If you have a look at my channel you will see an +80,000RPM test. Keep up the videos.
So... Let me be sure I understand: 1. you have to start "open loop" because you don't know where the motor shaft is... you just pulse it and switch the power back off when the voltage rises in the coil. You switch to the next coil after a set time. This is slow, because the A2D takes time, and the speed is pretty much just controlled by the frequency of the coil switches, not by the voltage applied, because you can't apply any more voltage without frying to motor. This is the "stepper mode" you spoke of. It should have good /holding/ torque, but the phases are too far apart to have anything like reasonable /detent/ or "pull in" torque like a regular stepper. 2. Once the speed is high enough for the magnet to induce a detectable back EMF voltage in the the third / undriven phase, we can use a comparator to trigger on that as our signal to switch to the next phase. At this point, the speed of the motor is controlled by the voltage we apply to the driven coils. As we back off the voltage, the motor moves less quickly to the next phase, and the back EMF spike appears later so we switch slower. Or we apply MORE voltage, not bothering to sense the voltage buildup in the driven coil because we know it won't get high enough to fry the coil or to pull more current than we can provide because it won't have time. The back EMF pulse happens quicker, we switch faster, and so the frequency and speed increase. 3. At some point, we probably can't sense the back EMF pulse quickly enough and we go into another open loop mode where we are just hitting the coils with everything we have and switching based on what we think the motor needs. If we start seeing the back EMF pulses again, then we can switch out of this mode and back down to mode 2. I'm not sure this mode is actually necessary. All of that could be avoided if there was an encoder on the motor. In that case, we could simply pulse the coil that matched the current position of the shaft to get started, we could always know when the motor was ready for the next phase, and we would never lose the back EMF pulse as we ran slower or faster. I'm really interested in the use of BLDC motors to make servos. I have a good encoder and some programming skills, so I hope to develop some ideas in this space soon. I would really love to watch your video, but I can't seem to find it on your page. A link would be great.
I am so sorry for not getting back to you sooner. Firstly here is a +80kRPM test ua-cam.com/video/TfL3JQ4f83I/v-deo.html points 1 and 2 are correct. point 3 delete! Yes sensored Brushless motors are exactly correct with a hall effect device you can commutate the MOSFETS like they were brushes and the code becomes trivial,(it can be done with gates) in sensorless brushless motors you need to detect position using the Back EMF to know when to switch and you always need to do that and it is usually done with a comparator to get the speed. Basically the PWM is used to reduce the applied voltage and limit the current (especially in stepper mode) If you only stepped phases at a few RPM your current would fry the motor so the PWM limits that and the motor is rotated in synchronous mode (it increasing frequency) until the motor is going fast enough to generate a usable back EMF and then you can go to switching the phases using the BEMF. and you stay in that mode. RPM is then controlled by varying the PWM wich is the same as varying the applied voltage.
Why hassle the poor guy, he is trying. I firmly believe in learning form making mistakes. Its a bonus for people when some one else makes them for you. He is on the right track and with community guidance every one will learn something
Hey all! If anyone is thinking about building this, this circuit needs an additional resistor network! I just made something quite like this, using the same LM393 comparators, and my timing was looking really strange, and the speed/torque was a bit lacking. I'm using dual source, common ground to power my circuit, and the motor voltage is around 11v, the rest is at 5v. The motor acts as a voltage divider, making the motor common and coil leads around 5.5v, so what was happening was when the motor started to spin fast, the comparator inputs would get saturated over VCC and on the way back down take a fair bit longer to switch low, making the next step happen much later than it should. I added a resistor network (10k) at the coil sense leads to half the voltage, and then connected the common with 1ks. Now my voltage sits in a happy place between VCC and ground, and the timing is looking spot on. Have fun!
I also found that I needed to turn the internal pullups off, and add my own pullup of about 22k... not sure why, but I was getting a rather dirty output otherwise.
Hi Scott, thank you for your inspiring videos. This video has remind me two salvaged washing machine motors that I would like to use for something useful. A video series on speed control for this universal motors would be really great, if made it by you. (and I bet would be pretty interesting for all us beginner makers that want to build some useful tools). Thanks again for your videos, I really appreciate it.
Your method to build ESC is combination of reading the schematic + try and error. You not know everything but you believe it is not difficult to achieve what you want. Now I can see your leadership.
As an R/C amateur, I thought I'd drop by this vid and learn how the ESC on my cars works, but now I feel I need an electronics degree and possibly maths as well
Danke,I love your videos. Even though I don't yet use Adrino and I am working on improving my off-grid solar system,I always come across at least 1 of your videos (which are very helpful in my search).
I don't know if you address individuals,as it seems most up-loaders only address a general audience,but I figured it would be worth asking. I want to automate my solar system,but I don't know where to start. I have 2 power sources (a 12v/10w solar panel,and a 12v generator (using a speed control module,a 3-12v dc motor and a couple of these www.ebay.com/i/222602490507?chn=ps )),and 2 power supply (a 7.4v/40ah battery and a 14.8v/20ah battery,both of which comprised of 18650 cells). My problem is that I need the mini 12v generator to automatically turn on when the solar panel isn't getting power and my 14.8v battery still needs charging (as my inverter is powered from this battery). The 7.4v battery is for supplying power to the driver motor of the 12v generator,which charges the 14.8v battery,but I also need it to charge the 7.4v battery when it's low. Do you know how I should go about it? I think I'll have to create a custom circuit board; unfortunately I'm only a novice with circuitry. Any help is appreciated,but I understand if not.
Great example. Really enjoy this channel. The example code on the instructables has a few issues like video says but its a great learning tool. First time Ive used 3 interrupts simultaneously!
My god, I think u can see the electrons flowing through the wires. I am learning so much from you. God give u a long long life so that you continue to upload such videos. A request. Pl, do make the videos a bit more explanatory for ordinary mortals like me........
Best video ever. "Screw the measuring technic" haha! Controlling n Using closed loops systems it's sometimes a big headache. Thank you I've learned a lot about Controlling these kind of motors you really love the subject and share it with us. Greetings from Ecuador.
IDK if anyone pointed this out yet, but... the ATMEGA328P in the Arduino Nano has an internal comparator between PD6 and PD7 that can request an interrupt whenever the positive input of the comparator is greater than the negative input. Plus, as far as i know, runs asynchronously (correct me on that one, if needed). This means that you could actually measure the current flow using the internal comparator without worrying of it not being detected AND you actually removed a chunk of circuit from your board In fact, the IC in the ESC is (usually) an ATMEGA8 and you can see they use no extra ICs, which is rather impressive, i must say
What I'd love to see is an open source esc project for retrofitting brushless motors into electric cars. I think this would really beat the price down making more people give it a go.
Great video! Being a motor control enthusiast everything made sense to me and I would love to make it myself when I have the available resources. Thanks!
anything compiled in the arduino ide will be useless for high speed real time reactions like this, it produces stuttering bloatware MS would be proud of, hand coded would be so much more efficient, and so much more complicated. What you have achieved here is simply amazing
Great job, not easy to make that motor spin. A lot going on. I don't where you find the time to do all this while working on your advanced degree. Your going to be an excellent engineer.
This was a really interesting pair of videos. Great job explaining everything. I'd be interested in a high power high voltage ESC design for E-bikes or similar
Great video as always! I'm wondering if you could use the signal from the virtual ground point directly with only one comparator instead of 3 separate pins? I have used that star point to time a current source BJT, but I have no idea if this would work with Arduino. Any thoughts?
Just buy a BLHeli_32 ESC and be done with it. That being said, thank you very much for clarifying the basic operation of ESCs in a fairly simple manner. Keep up the great videos!
Great Video !!! Comparators bounce like a button causing many interrupts in zero crossing areas, i couldn't find a stable solution for that. Ps. Please use something plastic while showing oscilloscope screen, screwdriver will scratch it.
Wow, you did some great work with the MCU timings. You may need a FPGA or CPLD to meet tighter timing constraints, but maybe the FETs will be enough for this. It will be interesting to see this project take off.
For block commutation(like shown) a micro-controller should be plenty. If you go for Field Oriented Control/vector control then you may need something more powerful.
Is he going for something that is functional with 4 ESCs, accelerometer, gyroscope, digital compass, altimeter, GPS, and RF remote? Or is this a project he's doing just as a proof of concept? It could work with 5~6 Atmega 328s.
Controlling an ESC alone should be fine with C or assembly. If he wanted to build a full quadcopter, he will need some more MCUs, or an FPGA. The 8 cog propeller CPU (P8X32A) does a very good job with multicopters.
For FOC an MCU is also enough, especially when using LUTs for the (co-)sine functions. Tho you have to use timer peripherals for PWM, but that's a given in every MCU.
Great Scott, I think you might want to to consider lighter motors and a different structural material, considering wood has a high wind resistance therefore require more thrust
Considdering that most quadcopter esc's are 12A or more each, and your build will weigh much more than most racing quads then i would suggest that you beef it up to handle atleast 12A if you want to have some power left to save yourself from a hard crash. Most of the times my quads have been broken were when i didn't have enough lift to pull myself out of a bad situation.
Scott, I think I may have found an error in your explanation or I don't quite understand it. At 0:56 you show how you activate the corresponding low-side FET to short the coil with itself, reducing the current flow. If A-HI was high and turned off at threshold value, switching it off makes sense because it stops the current flow. However, opening A-LO makes no sense in that case because the current would be allowed to flow in the direction you've drawn anyway, because of the body diode of the MOSFET. It seems to me that, instead of what you were explaining there, you would like to switch the high-side MOSFET at threshold value, and switch it on again once the waiting time has passed, and leaving the opposite FET on to allow current to flow. Activating the corresponding FET does not make a difference (because of the body diode), and disabling the opposing FET could create a spike in voltage that could kill your FET (I do think the body diode of the opposing high-side FET allows this to dissipate but if not, breakdown voltage is easily achieved). However, maybe I didn't understand your explanation right. Could you give me an explanation on this matter?
things like current limiting and BEMF feedback had been recurring problems in my hand-made motor drivers. I had tried doing BEMF sensing/... via discrete transistors (ex: 2n3904) but with limited success (don't have opamps or trimpots; mostly tried biasing things via voltage dividers). recently put this on hold as this stuff eats a lot of money and components (more so when accidentally blowing up comparably expensive MOSFETs and similar). I had admittedly had more success for some stuff basically just using stepper motors and computed duty-cycles and speeds. for fastest speeds with steppers, generally had best results with both phases active at a time and using a variation of reverse-sawtooth waves (square was better for torque but limited to low speed, sine wave made motors run quieter and cooler, but had neither great speed nor strong torque). in code, could switch between driving waveform and duty cycle values and similar based on target speed (except on some MSP430s I was using, where the drivers were pretty limited due to the 2kB ROM size limit).
I understand the feeling, but basically it's giving up figuring out why the proper solution doesn't work, and using a hack that kinda gets things done, but not ideally
Cool project! I watched the video several times to understand how to control a BLDC motor. I always confused ist with a synchronus motor which needs three sine waves. But i'll use an other microcontroller. I don't really like Arduino because the most people never reads datasheets or know how a microcontroller works. They simply use all the libraries without understanding what's happening. I'll use a PIC18F4431 microcontroller that has a special hardware to control BLDC motors, with integrated timer for the rotation frequency and another one for the PWM.
the inability to achieve high RPM also comes from the limitations from MCU. To achieve high rpm, Phase Advance method is used. Microchip has a nice application note on sensorless control
this is to save power , control speed and increase efficiency right. More motors could be used because you are like trying to run on low load right. Is this a big delta configuration or no it is star. In a series i dont know much of elecric motors i love the video its very good.
Kevin Day actually the standard ESC are programmable and can be flashed with different firmware and code. It's just not an Arduino (though you can program it with an Arduino).
Question : why didn't you use the integrated analog comparator of the Atmega328p ? Its non-inverting input is on AN0 and its inverting input can be muxed on-the-fly on ADC[0..7]... ( cf datasheet chapter 23, page 234 ). In fact, this trick is used on any atmega8-based commercial BLESC. ;) AN0 gets the summed phases voltage, and negative inputs are switched on each cycle.
Great videos, concise and packed with juicy info....! Even though I have experience with microcontrollers and driving motors, not being an electrical engineer, I can't profess to understand everything here on a first viewing. Probably benefit from a slowing down by a factor of 2... 😜
Hi Scott!, Very informational video. Could you please make a video explaining how to make an ESC using MOSFET's and MOSFET drivers instead of L6234 IC? L6234 is great but the DIP version of it is no longer manufactured and the peak current of the IC is also kind of low.
@9:28 Is it time for that video, yet? Really interested in utilizing reverse as well as seeing what kind of power is possible with these mystical new components.
There shall come a day, where I will understand 100% of the content you post. But today is not that day!
BraedanRicketts Ricketts I said the same thing over and over never unsubbed the channel, this is making sense to me now...
@@hasemhasan1151 Ditto :) (now try EEVblog)
@@SpaghettiEnterprises I know about that too, but it just hurts my ears...for some very odd reason
@@hasemhasan1151 same thing here, it helps to do some of this stuff yourself.
Ha ha ha
Very well said
Many people claim that your videos are too complicated but I think that its the way to go. Well... Nobody thaught me about eletronics. I am learning because I want. The thing is that even if the subject requieres knowledge I will try to learn the "basics" and then come back to your videos. I think people should do that. A big part of what I know about eletronics comes from you, because I feel motivated to learn more and more so I can understand better the videos.You are a genius GreatScott! Keep this solid work. You inspired me and a lot of others. Thanks for the effort!
I am VERY glad that I found your videos. I'm building an vacuum cleaner robot and need to build simple, but powerful ESC. Now I finally understood how to do it. Brilliant!!!
Did not understand anything, but still watched because hypnotized when GreatScott! is drawing his schematics ... Just marvellous !
I LOVE that you show the troubleshooting process.
I guess I should add my own comment. First, I just want to say this is a FANTASTIC video and I hope to see more. I dearly wish the people saying stupid things like "duh... just buy a ESC" would understand that the point is to learn and develop new ways of doing things, as well as to understand why ESC's work the way they do.
So... Let me be sure I understand:
1. You have to start "open loop" as far as position goes because you don't know where the motor shaft is... you just pulse it and switch the power back off when the voltage rises in the coil. You switch to the next coil after a set time. This is slow, because the A2D takes time, and the speed is pretty much just controlled by the frequency of the coil switches, not by the voltage applied, because you can't apply any more voltage without frying to motor. This is a "stepper mode". It should have good /holding/ torque, but the phases are too far apart to have anything like reasonable /detent/ or "pull in" torque like a regular stepper. The fact that you don't know where you are doesn't really matter because you can't drive the motor any harder anyway... if it's "skipping steps" against a load... oh well.
2. Once the speed is high enough for the magnet to induce a detectable back EMF voltage in the the third / undriven phase, we can use a comparator to trigger on that as our signal to switch to the next phase. At this point, the speed of the motor is controlled by the voltage we apply to the driven coils. As we back off the voltage, the motor moves less quickly to the next phase, and the back EMF spike appears later so we switch slower. Or we apply MORE voltage, not bothering to sense the voltage buildup in the driven coil because we know it won't get high enough to fry the coil or to pull more current than we can provide because it won't have time. The back EMF pulse happens quicker, we switch faster, and so the frequency and speed increase.
3. At some point, we probably can't sense the back EMF pulse quickly enough and we go into another open loop mode where we are just hitting the coils with everything we have and switching based on what we think the motor needs. If we start seeing the back EMF pulses again, then we can switch out of this mode and back down to mode 2. Or perhaps we still see the EMF pulses, but we must switch /before/ they appear. We are only looking for them as confirmation that the motor "caught up" with us. If we wait for the pulse, it's already too late to switch to the next coil. If we go ahead and switch, and the pulse doesn't show up when we expect it, then the load on the motor is too great and we have to slow our switching down a bit to avoid falling out of phase. I'm not sure this mode is actually necessary, but I think it may be why you are unable to get faster speeds.
All of that could be avoided if there was an encoder on the motor. In that case, we could simply pulse the coil that matched the current position of the shaft to get started, we could always know when the motor was ready for the next phase, and we would never lose the back EMF pulse as we ran slower or faster.
I'm really interested in the use of BLDC motors to make servos. I have a good encoder and some programming skills, so I hope to develop some ideas in this space soon. In the mean time, if you want a fun encoder to play with let me know. They are magnetic, non-contact, and still support very high speeds (28K to 75K RPM) and resolutions (4000 to 360 clicks) and... have a digital mode where you can just read out the current position instead of having to count the encoder pulses.
In any case, I'm completely fascinated! The use of the back EMF pulse is such a cool hack and seeing all the complexity of it from your exploration really helps me understand the limitations of this system.
THANK YOU!
This video has saved me! I didn't understand why my motor didn't run continuously, and at last I found this video that is the only on youtube which explain why! Thanks a lot
I like that you took this problem from the very roots, but with better and smarter ic you can control in a much simpler way and more attractive for your viewers.
jaime caballero hobby ESCs have been using inferior, dumber IC and managing to control motors just fine for years now.
I absolutely love your videos! You have inspired me to learn more about electronic engineering and making something amazing. Keep up the great work!
Excellent pair of videos! This was exactly at my comprehension level, and I think your pacing was spot on. Neither boring, nor too advanced/fast.
You can use hardware comparator that is in Arduino, at least for BEMF - you can attach virtual ground to AIN0 and phases to 3 analog pins and use internal multiplexer to choose which pin to use. It is much simpler and less error prone (PCINT aren't best solution for time-dependent tasks, and driving BLDC is such) than using external comparator. The only thing you have to have in mind is voltage levels, but simple voltage dividers should do the trick. Also you have to have in mind, that drone BLDS can operate at hundreds of amps, not like your small chip can deliver - 4A. Please tak that into consideration when selecting proper MOSFETs in the end of video.
Moreover, with timing of about 4-8 us you are meeting the smallest thing Adruino can count. Take in mind it works at 16MHz and by default uses 8x clock prescaler. This gives you the time of 0.5us per clock cycle, quite too much to be sure about the time microcontroller will switch your inputs.
These two videos were fantastic, even if I'm 4 years late saying so. Thank you for your hard work!
Love it "...instead of the measuring bullsh!t" at 5:30. Finding a way forward is what engineering is all about!!
I just want to say, he was probably getting screwed by some of the default Arduino code that runs in the background all the time. Joop Brokking has an excellent video on why he switched to Atmel Studio because of the Arduino fluff
@@ShinyMajor It's probably the `step == (2 || 5)` code, should be `(step == 2 || step == 5)`
I am not sure if any one else has mentioned it, firstly appart form a very good tutorial, you are only running the motor in synchronous mode. Like a stepper motor, to get more speed you need to increase the frequency. It is not true brushless where the ESC only performs commutation as dictated by motor position and in such a way speed is governed by the voltage applied and the KV rating of the motor. Most ESC's start in stepper motor mode but as soon as the BEMF is sufficient to detect commutation state they switch over to full brushless, which is more efficient. and allows for faster operation. Thank you.
Rotor Rant let me check I understand. To begin with we use the BEMF from the third phase but once there is enough rotational energy to keep the rotor flywheeling then we can just ignore the sensor reading and just rotate through the different phases and assume that the motor is keeping up?
Ah no sorry if I have not made that clear. Also sorry if I misunderstood you. The Back EMF on the open winding is what you use to determine when to switch the phases. In your video you said if you want to make the motor go faster then you increase the frequency. That was not quite right if you want it to go faster and your ESC is comutating correctly then you should increase the applied voltage and this may (depending on the load) increase the frequency if the motor goes faster. If you force the frequency to increase in the code you will loose synchronization.
So maybe I misunderstand you but If you are going in free running comutation then the speed should be proportional to applied voltage, If you code is not fast enough you will loose synchronization so it seems odd that your motor does not go very fast. If you have a look at my channel you will see an +80,000RPM test.
Keep up the videos.
So... Let me be sure I understand:
1. you have to start "open loop" because you don't know where the motor shaft is... you just pulse it and switch the power back off when the voltage rises in the coil. You switch to the next coil after a set time. This is slow, because the A2D takes time, and the speed is pretty much just controlled by the frequency of the coil switches, not by the voltage applied, because you can't apply any more voltage without frying to motor. This is the "stepper mode" you spoke of. It should have good /holding/ torque, but the phases are too far apart to have anything like reasonable /detent/ or "pull in" torque like a regular stepper.
2. Once the speed is high enough for the magnet to induce a detectable back EMF voltage in the the third / undriven phase, we can use a comparator to trigger on that as our signal to switch to the next phase. At this point, the speed of the motor is controlled by the voltage we apply to the driven coils. As we back off the voltage, the motor moves less quickly to the next phase, and the back EMF spike appears later so we switch slower. Or we apply MORE voltage, not bothering to sense the voltage buildup in the driven coil because we know it won't get high enough to fry the coil or to pull more current than we can provide because it won't have time. The back EMF pulse happens quicker, we switch faster, and so the frequency and speed increase.
3. At some point, we probably can't sense the back EMF pulse quickly enough and we go into another open loop mode where we are just hitting the coils with everything we have and switching based on what we think the motor needs. If we start seeing the back EMF pulses again, then we can switch out of this mode and back down to mode 2. I'm not sure this mode is actually necessary.
All of that could be avoided if there was an encoder on the motor. In that case, we could simply pulse the coil that matched the current position of the shaft to get started, we could always know when the motor was ready for the next phase, and we would never lose the back EMF pulse as we ran slower or faster.
I'm really interested in the use of BLDC motors to make servos. I have a good encoder and some programming skills, so I hope to develop some ideas in this space soon.
I would really love to watch your video, but I can't seem to find it on your page. A link would be great.
I am so sorry for not getting back to you sooner. Firstly here is a +80kRPM test ua-cam.com/video/TfL3JQ4f83I/v-deo.html points 1 and 2 are correct. point 3 delete!
Yes sensored Brushless motors are exactly correct with a hall effect device you can commutate the MOSFETS like they were brushes and the code becomes trivial,(it can be done with gates) in sensorless brushless motors you need to detect position using the Back EMF to know when to switch and you always need to do that and it is usually done with a comparator to get the speed. Basically the PWM is used to reduce the applied voltage and limit the current (especially in stepper mode) If you only stepped phases at a few RPM your current would fry the motor so the PWM limits that and the motor is rotated in synchronous mode (it increasing frequency) until the motor is going fast enough to generate a usable back EMF and then you can go to switching the phases using the BEMF. and you stay in that mode. RPM is then controlled by varying the PWM wich is the same as varying the applied voltage.
Why hassle the poor guy, he is trying. I firmly believe in learning form making mistakes. Its a bonus for people when some one else makes them for you. He is on the right track and with community guidance every one will learn something
the only useful channel on UA-cam
This man can distroy esc business
Very well made video, thanks for sharing the steps you went through, and pointing out how hard it actually is to make a good ESC.
I keep coming back to your videos to see If things you say are starting making sense to me, If they do, then I know I've improved
Hey all! If anyone is thinking about building this, this circuit needs an additional resistor network! I just made something quite like this, using the same LM393 comparators, and my timing was looking really strange, and the speed/torque was a bit lacking. I'm using dual source, common ground to power my circuit, and the motor voltage is around 11v, the rest is at 5v. The motor acts as a voltage divider, making the motor common and coil leads around 5.5v, so what was happening was when the motor started to spin fast, the comparator inputs would get saturated over VCC and on the way back down take a fair bit longer to switch low, making the next step happen much later than it should. I added a resistor network (10k) at the coil sense leads to half the voltage, and then connected the common with 1ks. Now my voltage sits in a happy place between VCC and ground, and the timing is looking spot on. Have fun!
I also found that I needed to turn the internal pullups off, and add my own pullup of about 22k... not sure why, but I was getting a rather dirty output otherwise.
Beautiful videos, you pay attention to every small detail. I like those close-ups where you are writting
Hi Scott, thank you for your inspiring videos. This video has remind me two salvaged washing machine motors that I would like to use for something useful. A video series on speed control for this universal motors would be really great, if made it by you. (and I bet would be pretty interesting for all us beginner makers that want to build some useful tools). Thanks again for your videos, I really appreciate it.
Thanks for making these videos. I love keeping up with your projects. I hope your studies are going well!
Your method to build ESC is combination of reading the schematic + try and error. You not know everything but you believe it is not difficult to achieve what you want. Now I can see your leadership.
What just happened. Not into programming and after watching this I now know why. Do like your videos though, keep them coming.
Best part of the week when Great Scott! uploads
9:28 man I hate this sentece :(
Well it make sense with the load of work to made this motor work !
Never can miss a video of yours
I made a DIY arduino from scratch but this is like a next level! Great job!
Hi, Scott!
I love your videos! I really want you to make a sensored version, too! With IR2103 drivers and a hoverboard-like motor
As an R/C amateur, I thought I'd drop by this vid and learn how the ESC on my cars works, but now I feel I need an electronics degree and possibly maths as well
Danke,I love your videos. Even though I don't yet use Adrino and I am working on improving my off-grid solar system,I always come across at least 1 of your videos (which are very helpful in my search).
I don't know if you address individuals,as it seems most up-loaders only address a general audience,but I figured it would be worth asking. I want to automate my solar system,but I don't know where to start. I have 2 power sources (a 12v/10w solar panel,and a 12v generator (using a speed control module,a 3-12v dc motor and a couple of these www.ebay.com/i/222602490507?chn=ps )),and 2 power supply (a 7.4v/40ah battery and a 14.8v/20ah battery,both of which comprised of 18650 cells). My problem is that I need the mini 12v generator to automatically turn on when the solar panel isn't getting power and my 14.8v battery still needs charging (as my inverter is powered from this battery). The 7.4v battery is for supplying power to the driver motor of the 12v generator,which charges the 14.8v battery,but I also need it to charge the 7.4v battery when it's low. Do you know how I should go about it? I think I'll have to create a custom circuit board; unfortunately I'm only a novice with circuitry. Any help is appreciated,but I understand if not.
Great example. Really enjoy this channel. The example code on the instructables has a few issues like video says but its a great learning tool. First time Ive used 3 interrupts simultaneously!
The man is a genius !
My god, I think u can see the electrons flowing through the wires. I am learning so much from you. God give u a long long life so that you continue to upload such videos. A request. Pl, do make the videos a bit more explanatory for ordinary mortals like me........
Best video ever. "Screw the measuring technic" haha! Controlling n
Using closed loops systems it's sometimes a big headache. Thank you I've learned a lot about Controlling these kind of motors you really love the subject and share it with us. Greetings from Ecuador.
you are the best (y) ,
because you know about electronics - analysis - and programming
IDK if anyone pointed this out yet, but... the ATMEGA328P in the Arduino Nano has an internal comparator between PD6 and PD7 that can request an interrupt whenever the positive input of the comparator is greater than the negative input. Plus, as far as i know, runs asynchronously (correct me on that one, if needed). This means that you could actually measure the current flow using the internal comparator without worrying of it not being detected AND you actually removed a chunk of circuit from your board
In fact, the IC in the ESC is (usually) an ATMEGA8 and you can see they use no extra ICs, which is rather impressive, i must say
Oh my god, I'm really excited for Part3, keep it up the good work man!!!
Matheus Eduardo no part 3 :(
Finally,the weather is decent and i can build some LED Blinker circuits in my garden.Lg from Bayern
Been waiting for this the whole week! Great videos man!!
Thank you :-)
German engineering in action!!!! Fair play to you!!! I wont be building an ESC but really enjoyed the videos
What I'd love to see is an open source esc project for retrofitting brushless motors into electric cars. I think this would really beat the price down making more people give it a go.
Sehr informativ. Der iterative Entwicklungsprozess rund um die Problemchen hat mir gut gefallen.
Really fantastic work, man!
Thanks for noticing his valuable intentions.
W8...
Sir what level of knowledge 😲
Great video! Being a motor control enthusiast everything made sense to me and I would love to make it myself when I have the available resources. Thanks!
I liked the way he used 3 resistors to produce a virtual earth when there was no access to the centre of the windings. Lateral thinking,
Excellent presentation. Keep up your research work. Zero crossing is the solution as you set in your last version. Liked your video.
Great video, as always. I hope to see a future video where you develop a more powerful board!
Useful project, let me learn more and more and this is the most important thing.
Great video waiting for part 3 👍
anything compiled in the arduino ide will be useless for high speed real time reactions like this, it produces stuttering bloatware MS would be proud of, hand coded would be so much more efficient, and so much more complicated.
What you have achieved here is simply amazing
Great job, not easy to make that motor spin. A lot going on. I don't where you find the time to do all this while working on your advanced degree. Your going to be an excellent engineer.
This was a really interesting pair of videos. Great job explaining everything. I'd be interested in a high power high voltage ESC design for E-bikes or similar
Hey this landed perfectly for me, thanks for the level of detail and great process
This is great. I would love to see more about getting your custom ESC closer, or even superior to the commercial one.
love from INDIA.
Great work
nicely explained.
was eagerly waiting for your video ,good job
You just saved my thesis.
Great video as always! I'm wondering if you could use the signal from the virtual ground point directly with only one comparator instead of 3 separate pins? I have used that star point to time a current source BJT, but I have no idea if this would work with Arduino. Any thoughts?
Just buy a BLHeli_32 ESC and be done with it. That being said, thank you very much for clarifying the basic operation of ESCs in a fairly simple manner. Keep up the great videos!
It's a very good video , I like it a lot .You did a very good job
Ok, take my subscription, you genius, you!
Great Video !!! Comparators bounce like a button causing many interrupts in zero crossing areas, i couldn't find a stable solution for that.
Ps. Please use something plastic while showing oscilloscope screen, screwdriver will scratch it.
Wow, you did some great work with the MCU timings.
You may need a FPGA or CPLD to meet tighter timing constraints, but maybe the FETs will be enough for this.
It will be interesting to see this project take off.
For block commutation(like shown) a micro-controller should be plenty.
If you go for Field Oriented Control/vector control then you may need something more powerful.
Is he going for something that is functional with 4 ESCs,
accelerometer, gyroscope, digital compass, altimeter, GPS, and RF remote?
Or is this a project he's doing just as a proof of concept?
It could work with 5~6 Atmega 328s.
What about using the same mcu with asm?
Controlling an ESC alone should be fine with C or assembly. If he wanted to build a full quadcopter, he will need some more MCUs, or an FPGA.
The 8 cog propeller CPU (P8X32A) does a very good job with multicopters.
For FOC an MCU is also enough, especially when using LUTs for the (co-)sine functions. Tho you have to use timer peripherals for PWM, but that's a given in every MCU.
Great Scott, I think you might want to to consider lighter motors and a different structural material, considering wood has a high wind resistance therefore require more thrust
What does that have to do with the motor turning? The material used in the video to hold the motor is just for demonstration purposes.
I like this now I am a big fan of yours
Considdering that most quadcopter esc's are 12A or more each, and your build will weigh much more than most racing quads then i would suggest that you beef it up to handle atleast 12A if you want to have some power left to save yourself from a hard crash.
Most of the times my quads have been broken were when i didn't have enough lift to pull myself out of a bad situation.
that was cray cray! But well done on doing it!
Scott, I think I may have found an error in your explanation or I don't quite understand it.
At 0:56 you show how you activate the corresponding low-side FET to short the coil with itself, reducing the current flow. If A-HI was high and turned off at threshold value, switching it off makes sense because it stops the current flow. However, opening A-LO makes no sense in that case because the current would be allowed to flow in the direction you've drawn anyway, because of the body diode of the MOSFET.
It seems to me that, instead of what you were explaining there, you would like to switch the high-side MOSFET at threshold value, and switch it on again once the waiting time has passed, and leaving the opposite FET on to allow current to flow. Activating the corresponding FET does not make a difference (because of the body diode), and disabling the opposing FET could create a spike in voltage that could kill your FET (I do think the body diode of the opposing high-side FET allows this to dissipate but if not, breakdown voltage is easily achieved).
However, maybe I didn't understand your explanation right. Could you give me an explanation on this matter?
Great Stuff. Nice mix of basic and High Level. Great Quality!!! More please
things like current limiting and BEMF feedback had been recurring problems in my hand-made motor drivers. I had tried doing BEMF sensing/... via discrete transistors (ex: 2n3904) but with limited success (don't have opamps or trimpots; mostly tried biasing things via voltage dividers).
recently put this on hold as this stuff eats a lot of money and components (more so when accidentally blowing up comparably expensive MOSFETs and similar).
I had admittedly had more success for some stuff basically just using stepper motors and computed duty-cycles and speeds. for fastest speeds with steppers, generally had best results with both phases active at a time and using a variation of reverse-sawtooth waves (square was better for torque but limited to low speed, sine wave made motors run quieter and cooler, but had neither great speed nor strong torque).
in code, could switch between driving waveform and duty cycle values and similar based on target speed (except on some MSP430s I was using, where the drivers were pretty limited due to the 2kB ROM size limit).
waiting for that more powerful ESC that you were talking about at the end of the video.
@5:03 "And that was the moment I said Screw Measuring, I'm going to us an additional timer." Freaking brilliant! =)
Yep this is when I related!
I understand the feeling, but basically it's giving up figuring out why the proper solution doesn't work, and using a hack that kinda gets things done, but not ideally
Cool project! I watched the video several times to understand how to control a BLDC motor. I always confused ist with a synchronus motor which needs three sine waves.
But i'll use an other microcontroller. I don't really like Arduino because the most people never reads datasheets or know how a microcontroller works. They simply use all the libraries without understanding what's happening.
I'll use a PIC18F4431 microcontroller that has a special hardware to control BLDC motors, with integrated timer for the rotation frequency and another one for the PWM.
the inability to achieve high RPM also comes from the limitations from MCU. To achieve high rpm, Phase Advance method is used. Microchip has a nice application note on sensorless control
Why don't use arrays for the states, instead of switch with functions?
I made very basic raspberry pi ESC with python. This video solve my problem that motor get stuck when it is in high speed.
That's why I just get ESCs off the shelf, very interesting try on your part though.
Al-Moutasm Bellah Rajab yea I think that was the point. It's good to learn new things
there is obvious diff bet maker and user
Wow Scott amazing explanation.
"And that's a subject for another video!" this means the tutorial will come up soon (2022)😉
Still 2 years left
almost there
>>> made own 3 phase controller from osc ( 74hc14 / 555 ) 74hc393 ,74hc138 74hc30 - 2n7000 - got plenty of these if it 'blows' - not a problem
Heatsink the DIP package and it might work better. Great videos!
this is to save power , control speed and increase efficiency right. More motors could be used because you are like trying to run on low load right. Is this a big delta configuration or no it is star. In a series i dont know much of elecric motors i love the video its very good.
This project is so cool! Really informative debugging!
Another great video, Scott! ;)
And this is why people need to learn to solve problems with circuitry other than microcontrollers...
Kevin Day actually the standard ESC are programmable and can be flashed with different firmware and code. It's just not an Arduino (though you can program it with an Arduino).
Still waiting to see the better version esc; and very good video 💛
Question : why didn't you use the integrated analog comparator of the Atmega328p ? Its non-inverting input is on AN0 and its inverting input can be muxed on-the-fly on ADC[0..7]... ( cf datasheet chapter 23, page 234 ).
In fact, this trick is used on any atmega8-based commercial BLESC. ;)
AN0 gets the summed phases voltage, and negative inputs are switched on each cycle.
Great videos, concise and packed with juicy info....! Even though I have experience with microcontrollers and driving motors, not being an electrical engineer, I can't profess to understand everything here on a first viewing. Probably benefit from a slowing down by a factor of 2... 😜
I enjoy your videos!
Hi Scott!, Very informational video. Could you please make a video explaining how to make an ESC using MOSFET's and MOSFET drivers instead of L6234 IC? L6234 is great but the DIP version of it is no longer manufactured and the peak current of the IC is also kind of low.
Awesome stuff Scott.
@9:28 Is it time for that video, yet? Really interested in utilizing reverse as well as seeing what kind of power is possible with these mystical new components.
Great video!! Keep it up Scott!
I watching your videos, craving for a new one! Thanks for the surprise 😊
I understood just enough to be awestruck!😂
Greatly appreciate your details..Many Thanks, God Bless 🙌
Great! SUPERB! I am thrilled!
You are a genius!