Arduino Electronic Speed Control explained

You can salvage some nice motors out of optical drives but they can be tricky to control. That’s because brushless DC motors require carefully timed signals used in a process called Electronic Speed Control (ESC). [Fileark] built and ESC using an Arduino and has a couple of posts explaining the concept and demonstrating how it works. His test circuit uses six 2N2222 transistors to protect the Arduino from excessive current. You can see six red LEDs above which are inline with the base of teach transistor. This gives visual feedback when a transistor is switched, a big help for troubleshooting your circuit.

Once you’ve seen the videos after the break you’ll probably come to the conclusion that this is an impractical way to use a brushless motor. But it is a wonderful way to learn about, and experiment with the concept of ESC. Chances are you can get your hands on an old optical drive for free, making this an inexpensive weekend project.

Comments

  1. minipimmer says:

    Very cool project. I was shocked because actually I was doing something quite similar this week. My idea was to build a small platform to teach control theory and what I do is to control a three wire computer fan from an arduino using transistors scavenged from a broken PC power supply to drive the motor and to buffer the pulse encoder signal from the fan. I should write something about this one of these days because I want to document it for the workshop. I’ll tell you as soon as I do.

  2. Gonzalo says:

    “you’ll probably come to the conclusion that this is an impractical way to use a brushless motor”

    Why do you think that? You don’t have to use an external controller IC, you can even remove the discrete transistors and use some uln2003 to manage all at once.

    Regarding the program, it should really be written using timers and interruptions, to reduce the cpu usage to the minimum

  3. bzroom says:

    legit

  4. Afroman says:

    As best as I can tell, the reason why he is having so much trouble getting the motor up to higher speeds is because there’s no system for detecting the position of the rotor so he can power the next coils at just the right moment. Usually people do this by sensing the back emf generated by the coils not in use, then making the switch.

  5. zool says:

    useful

  6. Will.Brunner says:

    I designed a shield for exactly this purpose. You can find the open source hardware and the (crude at this time) software at:
    https://code.google.com/p/threephase/
    I use this as a platform for developing motor control algorithms.

  7. holycrap says:

    This is such perfect timing.

    I have a shitload of these transistors lying around but haven’t been able to afford any ESCs to test out my new outrunner brushless motors.

    I had a few dual H-bridges lying around from sparkfun I was going to try and program to do this, but I didn’t really have the energy to get around to it.

    This is super simple, easy, and cheap.

    A+++ thanks for the inspiration!

  8. blue carbuncle says:

    FSK tracking. Done.

  9. Chris says:

    What about adding transitional steps where only one coil is active ?

    for example :
    100000
    110000
    010000
    011000
    001000

    the rotation should be more precise, smoother and stronger. And maybe it can fix the buggy behavior at high speed.
    What do you think about that ?

  10. JDN says:

    It’s a bit of a cheat I suppose but the optical drive the motor came from will also have the driver chip that does the back EMF measurement. Spec sheets are often available. Have your micro interface to that device instead.

  11. WestfW says:

    This is exactly the sort of “experimental” study that I’d like to see more of. Though not without flaws, it demonstrates the sort of results you can get without going to extreme efforts…

    I’m a little surprised that the high-side drivers (+V – 2n2222 – motor) work well enough to get the motor to turn at all. Usually you use PNPs in that spot (with opposite drive voltages…)

    The microcontroller used in many commercial RC ESC units is apparently an ATmega8; a processor very similar in capabilities to an Arduino (in fact, the mega8 was used in some of the earlier arduino boards.)

  12. zing says:

    @Chris
    That would work for a unipolar stepper, but this is a 3 lead brushless. If you only turn on one of the transistors, no current will flow through the motor.

  13. Mihail121 says:

    Very cool project indeed, good sirs. I was in deep need for exactly that thing for my epic project. May the queen be with you.

  14. @WestfW It’s just the atmega168/atmega328 (arduino) with less RAM. So, basically they are an Arduino.

  15. bogdan says:

    The schematic is rather flawed. He should have used a different kind of drivers, PNP transistors for the high side would have been better, but they are not enough. The motor from the CD drive is actually powered form 12V in order to achieve such speeds. Feedback is also given through the hall effect sensors in the motor that are not used here, but are necessary in order to use the motor at higher speeds.
    There are also no protection diodes used.
    The best chance of making the motor spin correctly with minimum work would be to use the actual driver from the cdrom and control it with a micro controller.
    I is a proof of concept, but it has errors. Errors which beginners will just propagate…

  16. Tim says:

    Its not going fast because he is going from 1ms to 0 delay. He should be using delayMicroseconds()

  17. Nomad says:

    @bogdan: i don’t think, there are any hall sensors in a CD drive. Just like there aren’t any in an HDD (i took some SCSI-HDDs apart). They are controlled via the back-EMF which you can measure on the third rail (read: the one that is not switched to ground or VCC)

  18. Anonymoose says:

    Lol @ Cat 5 cable – its so springy for wiring

  19. bogdan says:

    @Nomad
    All the cd-rom drives that i opened had hall sensors inside the motor. I suspect this has one as well and you may see that in the rather wide ribbon cable connecting to the motor(you need just 4 wires for the motor itself).
    It is true you can do things with back emf, but maybe back when cd drives were made that was too complicated.
    You are also forgetting that hard drives have the advantage of having to run at a single speed and the motor has a constant load.

  20. bogdan says:

    Here is what i typically saw in cd drives:
    http://www.ziva-vatra.com/index.php?aid=26&id=RWxlY3Ryb25pY3M=

  21. Roberto says:

    I am confused at the schematic. Did he use npn transistors for both the positive a d negative rails?

  22. bogdan says:

    @Roberto
    That’s right. It woks like this too, that is not a problem. But not correctly, the motor is powered from the 5V supply which is only good for low speed/load.
    Also, this trick will not work when powering from 12V.

  23. Mike says:

    You should use PNP transistors or P-Channel MOSFETS for the high-side. You are wasting 0,7V with those NPNs.

  24. Tomasito says:

    I did this 1-2 years ago. Sadly, we need some kind of feedback (back-emf or hall sensors) to trigger the coils. It’s have been discussed in arduino forums.
    Without it the motor just drives crazy at certain speeds, I and some others tried it on several motors.

  25. therian says:

    post back-emf sensors circuit

  26. Fileark says:

    The motor did have hall effect sensors but I blew them out while figuring out which wires went to the coils so I didn’t get to play with them much!

  27. Since we’re talking BLDC motors from CD drives, they are designed for much lower voltages than 12V mentioned above. I did some poking around an open DVD drive some time ago and I believe the motors are only energised from the 1.9V rail in the drive – there’s virtually no load once the disk starts spinning. Also, I believe they respond much better when PWM is involved else they are prone to skipping steps, especially without feedback. There’s a video illustrating the effect here http://elabz.com/bldc-motor-with-arduino-circuit-and-software/ with a very simple schematic and the Arduino code with PWM.

    I was actually hoping to use one of those CD spindle motors as a sort of a 36-steps per revolution stepper. Not having much luck with that as yet tho…

  28. tissit says:

    404

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 91,244 other followers