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!

Step 1: Salvage A BLDC From Your Victim CDROM
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.

arduino BLDC

BLDC Driver

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.

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);

// the loop routine runs over and over again forever:
void loop() {

if (Serial.available()){
inChar = (char);
if (inChar == '-'){
wait -=1;
wait +=1;

digitalWrite(p1, 1);
digitalWrite(p2, 1);
digitalWrite(p3, 0);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 0);
digitalWrite(p1, 1);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
digitalWrite(p1, 0);
digitalWrite(p2, 0);
digitalWrite(p3, 1);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 1);
digitalWrite(p1, 0);
digitalWrite(p2, 1);
digitalWrite(p3, 0);

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.

About محمد شمس

برنامه‌نویس، طراح انیمیشن و علاقمند به هوش مصنوعی

پاسخ دهید