Building a brushless motor controller around an ATmega chip

brushless-motor-driver-for-ATmega

You know when you see something like this it’s just going to be awesome, and we weren’t disappointed by our first impression. [Davide Gironi] built a brushless motor controller from the ground up using an ATmega8 as the brain. If you want to understand every aspect of a subject this is how to do it. Lucky for us he explains what each portion of the prototype does.

Brushless motors have no brushes in them (duh). But what does that really mean? In order to spin the motor a very carefully crafted signal is sent through the motor coils in the stationary portion (called the stator), producing a magnetic field that pushes against permanent magnets in the rotor. A big part of crafting that signal is knowing the position of the rotor. This is often accomplished with Hall Effect sensors, but can also be performed without them by measuring the back EMF in the coils not currently being driven. The AVR-GCC compatible library which [Davide] put together can be tweaked to work with either setup.

Get a good look at the system in action after the break.

[via Dangerous Prototypes]

Comments

  1. scavanger says:

    Surely that isn’t a Floppy drive motor? Looks nothing like a CD-ROM motor.

    Nice build by the way, albeit a bit overkill for such a small motor. Would it be possible to use the motor-driver chip/circuit that originally drove it be controlled with the ATmega intsead? (I know that probably wasn’t the intent of the project though)

  2. Josh Martin says:

    Electronics Speed Controllers for RC stuff usually have AT Mega chips. People flash some of them so that they work better for quadcopters, like my quad uses 4 $8 F-20 ESCs flashed with SimonK.

    • I’m interested in this. What are the advantages of such quadcopter-optimized esc firmwares? Better responsiveness? I wonder why stock firmwares do not behave that way, maybe it’s not good for other applications.

      • Many ESCs uses LPF to process the PWM input. The LPF input is there to protect motors with gears. However on the multicopters ones needs sharp fast response. To workaround this problem you can use 400Hz signal (The data is fortunately processed over certain amount of samples, not over time) but is better having no LPF at all.
        And if you can get to TWI or SPI pins then you can have digital input with custom firmware.

    • davidegironi says:

      I’ve checked SimonK and other open source projects running on ATmega. Most of those are made for RC stuff. I’ve find it difficult to modify that code, to add a rotation direction and a speed controller, that’s the reason why i’ve developed my code, and even for educational purpose :)
      SimonK code is very optimized, mine not, and it will be the choice if i’ve to run motors with high speed / efficiency requirements.

  3. Joejoedancer says:

    Ugh, poor guy.

  4. Tom says:

    I have previously struggled with BLDC motor control, having resorted to using some of the DRV range of driver IC’s from TI to eventually make things turn.

    I’ll be giving his code a look, especially if it does a decent job of position sensing through back-EMF detection.

    Once you’ve had a hard drive spindle motor spinning (sans-original controller), you’ll never go back to brushed ;)

  5. Maryam says:

    can you please post the schematic and code of your circuit?
    and I have a question about hall sensors,if I want to build my own ESC, are the hall sensors already built in bldc motors of quadcopters or I have to get them and place them myself?
    Thanks in advance! =]

  6. davood says:

    hollo please send to me the circuit of bldc cntrol.this is my project in the university and i want to build this circuit.thank so much.

  7. Tejas says:

    What watts of motor this circuit can Run ?

    • davidegironi says:

      It depends on the power stage of the circuit, this one it is built using IRF640, so i suppose it can drive 15A without problems, but i’ve never try with more than 5A @ 24V motors, so you have to investigate it more. Also keep in mind that this firmware does not implement PWM, a better firmware should implement it. As soon as i had spare time, i will build a new one with PWM and analog comparer instead of ADC readings.

  8. Tejas says:

    I want to buy this circuit !!
    with the report…

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,915 other followers