Run a CDROM Brushless Motor With Arduino
Intro: Run a CDROM Brushless Motor With Arduino
A brushless dc motor or BLDC is a type of motor without any brush. It means that there is no direct connection (brush) between rotating spindle and other fixed parts like as coil. So the spinning is yield of changes in current direction of coil.
The spindle has a circular magnet (usually). And the coil is an electric controlled magnet itself. So by changing the poles of coil, you can turn the spindle.
Have you ever seen a BLDC? Yes, of course. There are many of them in every computer case.
Fan, CDROM and also Floppy drive (if you have yet) are devices that use BLDC. The fans usually use 2 phase motors with 2 pins for coil and 1 pin for Hall sensor.
CDROM or Floppy drive has 3 phase motor, with 3 pins for coil and 1 pin for Hall sensor.
The mentioned Hall, is a simple sensor to detect the current magnet pole of the spindle. Whenever a magnet reaches, it generates a signal. So you can use this pin to detect rounds of motor and also you can control the motor speed (RPM) by altering the signal speed according to this pin.
I thinks it's enough of theory, let's make!
The spindle has a circular magnet (usually). And the coil is an electric controlled magnet itself. So by changing the poles of coil, you can turn the spindle.
Have you ever seen a BLDC? Yes, of course. There are many of them in every computer case.
Fan, CDROM and also Floppy drive (if you have yet) are devices that use BLDC. The fans usually use 2 phase motors with 2 pins for coil and 1 pin for Hall sensor.
CDROM or Floppy drive has 3 phase motor, with 3 pins for coil and 1 pin for Hall sensor.
The mentioned Hall, is a simple sensor to detect the current magnet pole of the spindle. Whenever a magnet reaches, it generates a signal. So you can use this pin to detect rounds of motor and also you can control the motor speed (RPM) by altering the signal speed according to this pin.
I thinks it's enough of theory, let's make!
STEP 1: Salvage a BLDC From Your Victim CDROM
As you can see in the photo, I found a SAMSUNG brushless motor in my old ASUS CDROM. I think it is a proper low voltage motor for our project.
I have many old Hard disks in my room but they are a little bit hard to disassemble and depart. So for this beginner guide, the CDROMs are better victims.
Anyway, as mentioned before, we have 4 pins to soldering a wire. It is easy to detect the coil pins, they are after each other. Usually last pin is sensor.
But if you had any problem detecting pins, connect a (+), (-) 3 volt to them to see the spindle shake.
Also you can use an Ohmmeter to detect them.
I have many old Hard disks in my room but they are a little bit hard to disassemble and depart. So for this beginner guide, the CDROMs are better victims.
Anyway, as mentioned before, we have 4 pins to soldering a wire. It is easy to detect the coil pins, they are after each other. Usually last pin is sensor.
But if you had any problem detecting pins, connect a (+), (-) 3 volt to them to see the spindle shake.
Also you can use an Ohmmeter to detect them.
STEP 2: Make the Circuit
Used parts:
- 1x Breadboard.
- 1x Driver IC l293d.
- Wires.
- 1x External power source 6v (optional)
I've used a L293D IC that is well known as 4-Chanel driver. It is necessary to use a buffer between micro-controller and the other power consuming parts like as motors, relays, coils and this sort of things (not LEDs).
Sometimes it is important to use higher current or higher voltage (more than 5+ of Arduino) external power sources and sometimes, just to protect your micro from any backward effects.
There are many electronic parts to use as buffer like as Transistors and ICs. I suggest a l293d that supports external power and also has chip enabler pins.
As you can see in the data-sheet, there are:
- 4 ground pins (connect to Gnd)
- 2 enable and 1 Vss (connect to 5+ Arduino)
- 1 Vs (connect to positive external power)
- 4 inputs (3 of them to Arduino)
- 4 outputs (3 of them to Motor)
So, connect the pins as schematic presented in the picture.
- 1x Breadboard.
- 1x Driver IC l293d.
- Wires.
- 1x External power source 6v (optional)
I've used a L293D IC that is well known as 4-Chanel driver. It is necessary to use a buffer between micro-controller and the other power consuming parts like as motors, relays, coils and this sort of things (not LEDs).
Sometimes it is important to use higher current or higher voltage (more than 5+ of Arduino) external power sources and sometimes, just to protect your micro from any backward effects.
There are many electronic parts to use as buffer like as Transistors and ICs. I suggest a l293d that supports external power and also has chip enabler pins.
As you can see in the data-sheet, there are:
- 4 ground pins (connect to Gnd)
- 2 enable and 1 Vss (connect to 5+ Arduino)
- 1 Vs (connect to positive external power)
- 4 inputs (3 of them to Arduino)
- 4 outputs (3 of them to Motor)
So, connect the pins as schematic presented in the picture.
STEP 3: Write the Code
We want to prepare a series of proper signals to drive the brushless motor.
This BLDC has 36 steps in each complete round. It means that we should prepare 36 signal states to rotate the spindle a complete round. These 36 steps are divided into 6 parts of a unique sequence. So we have 6 different signals that should be repeated 6 times in a loop.
Assuming the 3 wires as A,B and C (ordered) we need a 3 bits value to use. We've assumed the 0 as negative and 1 as positive voltage.
The magical 6 steps are as follow:
110, 100, 101, 001, 011, 010
We will use them in a loop.
Other important thing to mention is wait or delay between each step. By modifying the delay time you can change the motor's speed. If you choose a high delay (Ex: 15 to 20 Milliseconds) the motor may just shake or start a cutoff move. If you use a low delay (Ex: 0 to 5 Milliseconds) you will just hear a buzz and no movement.
So I want to use a variable as delay and change it throw the serial monitor window in Arduino.
The code is as follow:
/*
***** BLDC DRIVER *****
*/
int wait = 10;
int p1 = 2;
int p2 = 3;
int p3 = 4;
char inChar;
void setup() {
pinMode(p1, OUTPUT);
pinMode(p2, OUTPUT);
pinMode(p3, OUTPUT);
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
if (Serial.available()){
inChar = (char)Serial.read();
if (inChar == '-'){
wait -=1;
}
else{
wait +=1;
}
Serial.println(wait);
}
digitalWrite(p1, 1);
digitalWrite(p2, 1);
digitalWrite(p3, 0);
delay(wait);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 0);
delay(wait);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 0);
delay(wait);
}
Some hints:
- Don't use external power more than 12v.
- For small BLDC motors you can use Arduino 5+ as Vs and no need to external power, but you can't reach the motor speed.
- Start with wait value of 10 and then open the serial monitor and enter the minus key to decrease the value. Lower wait value, faster speed.
This BLDC has 36 steps in each complete round. It means that we should prepare 36 signal states to rotate the spindle a complete round. These 36 steps are divided into 6 parts of a unique sequence. So we have 6 different signals that should be repeated 6 times in a loop.
Assuming the 3 wires as A,B and C (ordered) we need a 3 bits value to use. We've assumed the 0 as negative and 1 as positive voltage.
The magical 6 steps are as follow:
110, 100, 101, 001, 011, 010
We will use them in a loop.
Other important thing to mention is wait or delay between each step. By modifying the delay time you can change the motor's speed. If you choose a high delay (Ex: 15 to 20 Milliseconds) the motor may just shake or start a cutoff move. If you use a low delay (Ex: 0 to 5 Milliseconds) you will just hear a buzz and no movement.
So I want to use a variable as delay and change it throw the serial monitor window in Arduino.
The code is as follow:
/*
***** BLDC DRIVER *****
*/
int wait = 10;
int p1 = 2;
int p2 = 3;
int p3 = 4;
char inChar;
void setup() {
pinMode(p1, OUTPUT);
pinMode(p2, OUTPUT);
pinMode(p3, OUTPUT);
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
if (Serial.available()){
inChar = (char)Serial.read();
if (inChar == '-'){
wait -=1;
}
else{
wait +=1;
}
Serial.println(wait);
}
digitalWrite(p1, 1);
digitalWrite(p2, 1);
digitalWrite(p3, 0);
delay(wait);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 0);
delay(wait);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 1);
delay(wait);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 0);
delay(wait);
}
Some hints:
- Don't use external power more than 12v.
- For small BLDC motors you can use Arduino 5+ as Vs and no need to external power, but you can't reach the motor speed.
- Start with wait value of 10 and then open the serial monitor and enter the minus key to decrease the value. Lower wait value, faster speed.
25 Comments
ssce691 4 years ago
Asmodeo 4 years ago
mo-salama 5 years ago
E1024d 6 years ago
My email:eddieli1024@gmail.com
ateebhassan000 7 years ago
I have tried this with hard drive motor....The problem I am facing is that, I have to give a jerk with hand to start the motor and it starts at very low speed(as you mention at value 10) when I open serial monitor it stops and again same like above hand jerk and it start moving. Can you tell me how can I solve this issue. Supply voltage is +5V & 800mAh.
waiting for your response...!!!
ateebhassan000@gmail.com
FathiM1 8 years ago
really helpful thanks alot
AkashM15 8 years ago
hmm....ohk so it was easy, But can we control a high power (24 volts 4.4 am) bldc 3 phase motor with hall sensor with a Gyroscope (MPU6050)?? if so how??
Nikola010 9 years ago
Can you tell me approximate power of these cd rom bldc motors? I want to use tham for some RC flying stuff so i need to know what power in Watts does it have?
kurwicycek 8 years ago
The one I am playing with is about 0,875W @ 5V.
snoop911 8 years ago
Any ideas where to buy a motor like this? The motors I found on ebay/alibaba/etc are either 12v or higher.. or they say 3 phase, yet only have 2 wires, how can that be?
I'd like to buy a small 3.3v-5v 3-phase bldc, with 3 wires (one for each coil) to play with (and compare) sinusoial driving vs trapezoidal commutation!
m-shams 8 years ago
kavish laxkar 8 years ago
where i can found those article.??
m-shams 8 years ago
This instructable:
https://www.instructables.com/id/Arduino-CDROM-BLDC-Motor-Driver-Enhanced-Performan/
kavish laxkar 8 years ago
respected sir
nice instructable.-->>.but my motor is driving very slow like for 0.5 sec in right and then left for 0.5 sec...i want to drive for long time...wat to do ..plz tell sir.
vahidyou 8 years ago
When you are going to drive coil 1 and 2, coil 3 wires are connected together via one of other coils wire and this cause more resistance to rotate. I think it is better to use 2 L293 ICs and make enable pin low for the coil that is not driven.
daniellong2 9 years ago
the schematic seems to have one mistake, the output pins are connected to 2,3 and 4 while the code shows that the pins are 1,2 and 3. Nice circuit, It works also with hdd motors
carlos.cortez.9619934 9 years ago
i have 2 old hdd hard disk drives. Each one has 3 pins coming out. I can't not find information of how to connect them to a blcd driver. Can you help? My email is crcacr@gmail.com. Thank you.
m-shams 9 years ago
ahmda 9 years ago
the motor is not spinning correctly . is there a kind of Sequence for connecting the outputs pins . my motor is just shake and not move Smoothly
zoubir.santouh 9 years ago
great !