CD-ROM Sensored BLDC motor control with Arduino

Last time I made a simple PC CD-ROM (or DVD-ROM) brushless DC motor controller using Arduino UNO board and now I’m going to build the same controller but with modifications (let’s say improvements).

The type of motor used in this example is sensored BLDC motor which can be found in CD-ROM drives of personal computers (especially the old ones). Previous project link is the one below:

Sensored brushless DC motor control with Arduino

Components Required:

  • Arduino UNO or equivalent board   —> ATmega328P datasheet
  • Sensored brushless DC motor
  • 6 x 06N03LA N-type mosfet (or equivalent)    —> datasheet
  • 3 x IR2101 (IR2101S) gate driver IC    —> datasheet
  • LM339N (or LM339) quad comparator IC    —> datasheet
  • 10k ohm (or less) potentiometer
  • 3 x 10k ohm resistor
  • 100 ohm resistor
  • 6 x 10 ohm resistor
  • 3 x IN4148 diode
  • 3 x 10uF capacitor
  • 3 x 2.2uF capacitor
  • 12V source
  • Breadboard
  • Jumper wires

Sensored BLDC motor control with Arduino circuit:
The circuit diagram is shown below.

Arduino brushless DC motor control circuit IR2101

(All grounded terminals are connected together).

In the circuit there are three IR2101 gate driver ICs, each one is used to drive one high side mosfet and one low side mosfet, the switching between the high side and the low side is done according to the control lines which are: HIN and LIN. The figure below shows input and output timing diagram:

IR2101 input output timing diagram

The used motor has 3 hall effect sensors as any sensored brushless motor, each hall effect sensor has 4 pins: VCC, GND, H+ and H-. The three sensors are supplied with +5V through 100 ohm resistor. Each sensor output (H+ and H-) is connected to a comparator (LM339) which therefore gives a single output as shown in the circuit diagram above.

The 10k potentiometer is used to control the brushless DC motor speed, it is controlled using PWM technique (PWMing high sides only). At any time there is one active high side mosfet and one active low side mosfet, that means always there is one active PWM pin (Arduino pin 9, 10 or 11).

The table below summarizes the active Arduino pins according to the hall effect senors states (pins: 5, 6, and 7):

Arduino brushless motor sequence table for IR2101

Sensorled BLDC motor control with Arduino code:
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 31KHz and a resolution of 8 bits. The duty cycles of the PWM signals are updated after reading analog data from channel 0 (Arduino pin A0) by writing to their registers (OCR1A, OCR1B and OCR1A).

The ADC module is configured to read from channel 0 only.

Arduino interrupt on change is activated for pins 5, 6 and 7 (hall effect sensors inputs) for better commutation.

PORTB are Arduino uno pins: 8 … 13.
PORTD are Arduino uno pins: 0 … 7.

To fully understand the code, please read the ATmega328 datasheet!

Sensorled brushless DC motor control with Arduino video:
The video below shows a simple hardware circuit of the project.

12 thoughts on “CD-ROM Sensored BLDC motor control with Arduino”

  1. Daniel Fernandes

    Hello friend, first of all, thank you for sharing your project. I have one question:
    Can 06N03LA N-type be replaced by IRFZ44N? Thank you

  2. why this error ?

    sketch_mar08a:47:17: error: conflicting declaration of C function ‘void loop(…)’

    void loop() {

    ^

    In file included from sketch\sketch_mar08a.ino.cpp:1:0:

    C:\Users\jampy\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\cores\arduino/Arduino.h:155:6: note: previous declaration ‘void loop()’

    void loop(void);

    ^~~~

    exit status 1
    conflicting declaration of C function ‘void loop(…)’

  3. Funciona perfecto. Sensores a 120 grados garantizan que no presente problemas de arranque.
    Gracias mi viejo. Medellin, colombia

  4. can i change the pwm frequency to 12khz or 15 khz in case it happens..how to modify??? suggest me …

  5. hi sir
    i have bldc motor with 5 pins for the hall sensor connections how can i connect 8 pins to that 5 pin bldc motor

    1. If you have a BLDC motor with 5 pins for the hall sensor it means that you their is two pins for vcc and gnd and three pins for the the signal so you don’t have to use an LM339 you can directly plug the three signal pins of your hall sensors on pin 7,6, 5 of your arduino.

Leave a Comment

Your email address will not be published. Required fields are marked *

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

Scroll to Top