Brushless DC motor controller using Arduino and IR2101

A month ago, I build a sensorless brushless DC motor controller using Arduino UNO board, IR2104 gate driver, mosfets …. and now in this post I’m going to build exactly the same controller but using IR2101 instead of the IR2104. Previous project link is the one below (contains more details about sensorless BLDC motor and back-emf):

Sensorless BLDC motor control with Arduino – DIY ESC

Components Required:

  • Arduino UNO board
  • Brushless DC (BLDC) motor
  • 6 x 06N03LA N-type mosfet (or equivalent)  – datasheet
  • 3 x IR2101 (IR2101S) gate driver IC  – datasheet
  • 6 x 33k ohm resistor
  • 3 x 10k ohm resistor
  • 6 x 10 ohm resistor
  • 3 x IN4148 diode
  • 3 x 10uF capacitor
  • 3 x 2.2uF capacitor
  • 2 x pushbutton
  • 12V source
  • Breadboard
  • Jumper wires

Sensorless brushless DC motor control with Arduino circuit:
Project circuit schematic is shown below.

Arduino BLDC motor controller DIY ESC IR2101

Note that all grounded terminals are connected together.

In the circuit there are 2 pushbuttons, one is used to increase BLDC motor speed and the 2nd one is used to decrease it.

The first three 33k (connected to motor phases) and the three 10k resistors are used as voltage dividers, because we can not supply the microcontroller with 12V, the other three 33k resistors generate the virtual natural point. The virtual natural point is connected to Arduino pin 6.

The Arduino UNO board is based on the ATmega328P microcontroller which has one analog comparator. The positive input of this comparator is on Arduino uno pin 6 (AIN0) and the negative input can be pin 7 (AIN1), A0 (ADC0), A1 (ADC1), A2 (ADC2), A3 (ADC3), A4 (ADC4) or A5 (ADC5). So I connected the virtual natural point to the positive pin of the analog comparator (pin 6), phase A BEMF to pin 7 (AIN1), phase B BEMF to pin A2 and phase C BEMF to pin A3. Each time the comparator compares the virtual point with the BEMF of one phase (this is done in the software). This minimizes the hardware needed and simplifies the circuit.

The IR2101 chips are used to control high side and low side mosfets of each phase. The switching between the high side and the low side is done according to the control lines HIN and LIN. The figure below shows input and output timing diagram:

IR2101 input output timing diagram

The HIN lines of the three IR2101 are connected to pins 11, 10 and 9 respectively for phase A, phase B and phase C. The Arduino UNO can generate PWM signals on that pins where only high side mosfets are PWMed.

Sensorless BLDC motor control with Arduino code:
The code below does not use any BLDC motor library.

As mentioned above, Arduino pins 9, 10 and 11 can generate PWM signals where pin 9 and pin 10 are related with Timer1 module (OC1A and OC1B) and pin 11 is related with Timer2 module (OC2A). Both Timer modules are configured to generate a PWM signal with a frequency of about 31KHz and a resolution of 8 bits. The duty cycles of the PWM signals are updated when a pushbutton is pressed (speed up or speed down) by writing to their registers (OCR1A, OCR1B and OCR1A).

The analog comparator compares the positive input AIN0 (Arduino pin 6) with the negative input which can be AIN1 (pin 7), ADC2 (pin A2) or ADC3 (pin A3). When the positive pin voltage is higher than the negative pin voltage, the output of the analog comparator ACO is set, and when the positive pin voltage is lower than the negative pin voltage, ACO is cleared.
In this project I used the analog comparator interrupt and I used its interrupt on rising (transition from low to high) and interrupt on falling (transition from high to low), this makes the zero crossing events interrupt the microcontroller.

To fully understand the code, read the ATmega328 datasheet!

The video below shows how project is working (in this video I used the IR2104S chips).


  1. O how I love this new finding website.

    I am busy in research and developing in green energy, but I know nothing about programming and writing source code .

    Is it possible to help me change some coding in this very same project of the Sensorless BLDC motor control with Arduino code?

    If possible, please confirm so I may or can inform what I need in this project and coding to serve my research and purpose in this new invention of mine in GREEN ENERGY.

    Looking forward to hear from you soon.

    Kind regards.

    Gert van Kraayenburg
    South Africa.

  2. I do that with ir2101 and mosfet irf3205. Mosfets are hot, and motor not run. Can you tell me why it happend and how to repair it. Thank you

    1. The IRF3205 is not a good choice for this project, try with a different mosfet with characteristics similar (or better) to the one used here.
      That characteristics are in the datasheet (turn-on delay time, rise time, Rds(on) ….).

      1. i try many times, and it’s running, but the current picked up 8.2 amps, it’s too high, i using motor xxd 2212 2700kv, 12volt dc, can you give me Ampe of device consumption in this video, please!

    1. I don’t know if it will give you a good result because the ADC and the analog comparator of the ATmega328P microcontroller share the same multiplexer!

        1. i watched it ,but i didn’t understand code for pic18f.. can you help me write the code for arduino please!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.