﻿ Sensored ESC circuit homemade DIY

## INTRO

In a past tutorial we have build an ESC for sensor-less brushless motors. Without sensors we had to implement a back electromotive force detection and make the switching sequence with that. The circuit got quite complicated and the code wasn't the best neither.

So, in this tutorial we will build another type of speed controller for brushless motors and also improve the code. In this case we will build a sensored motor controller, which basically means that the motors will have sensors in order to detect its position while rotating. So, we don’t have to integrate the back magnetic force and make the zero-crossing switch anymore.

See the full part list here:

## PART 1 Prepare the motor

I've took out a brushless motor from an old CD writter. It has to be a sensored motor, so make sure you will see 3 small sensors on the motor PCB as you can see in the photo below. Not all CD/DVD writers haev sensored brushless motors so you ahve to make sure. The next step is to identify the pins of the motor with a total of 11 pins.

I take my multimeter and go pin by pin and write them down on a piece of paper. Not all motors from CD writers have the same pinout so make sure which is yours. The first motor has the next pinout as you can see below. Each sensor has 4 pins, the positive and negative sensor output and the positive and negative supply. So for the pins of the motor we will have 6 sensor outputs, 5V, GND and 3 inputs for the brushless motor coils.

Ok, now pay attention. The motor that I've used for this tutorial is not the same as the one above. It is the same motor but the pinout is different. Below, on that PCB we have the motor pinout that I've used for this project. So, we have the input for the 3 coils of the triple phase brushless motor. Then we haev the negative supply, in this case GND, the negative and positive output of each sensor and finally the positive supply, in this case 5V.

So why is there a PCb with that IC? Well, the output of the sensor is given by the difference between the positive (Out+) and negative (Out-) outputs. So, we have to compare those outputs using an OPAMP, and when the positive output is higher than the negative one (negative polarity magnet detected), we will have a positive "1" output and when the negative is higher (positive polarity magnet detected) we will have a negative "0".

### Hall sensors schematic

So, now we take each of the outputs from the hall sensors and compare them using an OPAMP. I've used the LM324 OPAMP since it has 4 amplifiers and we need 3. Supply 5 volts to all hall sensors through a 100 ohms resistor to limit the current. Also supply 5V to the OPAMPs and connect GND to everything. Now take the negative outputs from the sensors to the negative input of the OPAMPs and the positive to the positive inputs.

Mount the schematic above on a drilled PCB and put wires for the 3 coils inputs, 5V and GND supply and also the 3 sensors outputs, hall A, B and C. Now we have the motor prepared. If you use a commercial sensored motor, it will already have the outpus amplified.

Now connect sensor output A and B to the oscilloscope and spin the motor. As you can see below we have two square signals with 1/3 phase difference between each other. Next, if we connect A and C, we will now have 2/3 phse difference. The sensors are separated 40 degrees one to each other so using this 3 signals we will detect the rotation position and control the motor.

## PART 2 Brushless 3 phase control

Ok, so let’s look once again on how the brushless motor control will work. I suggest you to take a look on my other tutorial on the Arduino based electronic speed controllers.
Our motor has 3 coils. I know that inside we can see 9 coils, but the truth is that these are 3 coils winded on 9 poles. On the exterior of the motor we have 12 magnets. This motor uses magnetic strip so we can’t see the 12 different magnets, but there are 12 different polarity magnets inside.

In the photo below we have the representation of our motor. We have 9 poles on the stator, 12 magnets on rotor and 3 sensors. Since we have 3 coils, we have 3 inputs, A, B and C, so we will need a triple phase bridge to control this motor. In order to control the rotation speed we have to apply power to these 3 inputs in a certain sequence.

We start with positive power to the A input and ground to B. We leave the C input floating with nothing connected to it. That will create a magnetic field in the A coils that will push the rotor on to the right and in to the B coils that will drag the rotor to the right as well since positive with positive are repelling and negative with positive will attract.

But if we don’t switch the inputs, the rotations will stop here. For that we switch to the next part of the sequence. We leave B connected to ground but now we apply positive power to C instead of A. That will make C to drag the positive magnet and if we keep switching the inputs we can create a full rotation.