Nowadays, enthusiasts are very interested in controlling Brushless DC (BLDC)
Compared with the traditional DC motor, the performance of the motor has improved, energy efficiency has also improved, but it is more difficult to use. Many off-the-
Shelf products exist for this purpose.
For example, there are a lot of small BLDCs controllers that work very well for RC aircraft.
For those who want to look into the control of the BLDC in more depth, there are also many different micro-controllers and other electronic hardware for industrial users, which usually have very good documentation.
So far I have not found any comprehensive description of how to use Arduino micro-controller for BLDC control.
Also, if you are interested in doing regenerative braking, or using a BLDC for power generation, I have not found many products suitable for use with small motors, nor have I found out about how to control 3-Phase generator.
This structure was originally in a story about real-
Time calculation, I continue to do so after the course is over.
The idea of the project is to show a proportional model of a hybrid car with flywheel energy storage and regenerative braking.
The motor used in the project is a small BLDCs cleaned up from the damaged computer hard drive.
This manual describes how to use the Arduino micro-controller and Hall-
Affects position sensors in driving and regenerative braking modes.
Please note that visiting oscillisoft is very helpful, if not essential, to complete this project.
If you are unable to access the scope, I have added some suggestions on how to do it without the scope (step 5).
One thing that this project should not include in any actual motor controller is any safety function such as over current protection.
In fact, the worst thing is that you burn out the HD motor.
However, implementing over-current protection with current hardware is not difficult, and maybe I will do that at some point.
If you are trying to control a larger motor, please add over current protection in order to protect your motor and your own safety.
I want to try to use this controller with a larger motor that can do some \"real\" work but I don\'t have the right one yet.
I noticed that eBay sold an 86 W car for about $40.
Looks like a good candidate.
There is also an RC website called \"GoBrushless\" that sells kits that assemble their own BLDC.
These are not too expensive and it is worth the experience to build one.
Please note that there is no hall sensor for the motor on this website. Whew!
Writing this structure is a big job.
I hope you find it useful, please make your comments and suggestions.
Digital Multimeter (DMM)-
If your DMM has a frequency meter oscilloscope (
It\'s better to have at least 2 channels)
T8 Torx driver (
You need one of them to open any hard drive).
There is a good hardware store.
Machine Workshop and rapid prototype (
These are very helpful but I think this project can be done without them).
Material bldc motor magnetic ring from computer hard disk (
Half of the motor)
From another hard driveSeveral (3-6)
There is a second small motor in the silver disk on the hard disk (DC brushed OK)
Rubber band or (preferably)
The brushless DC motor with a handle with another motor electronic bread plate solid wire month the Arduino Duemilanove 120 k ohm resistor six to 400 ohm resistor linear or rotating Poteniometer100 k ohmST micro circuit L6234 three phase motor driver IC two 100 uF capacitors one 10 nF capacitor one 220 nF capacitor one 1 uF capacitor one 100 uF capacitor three receiving diodes One 2.
Honeywell SS411A bipolar Hall-5 Amp Fuse 1 fuse holder 3
Note: Mike Anton designed and sold a product that will replace the power electronics and Hall sensor circuits I have shown in this manual (
It is controlled using back potential induction).
Specifications and procurement information can be found in these two links: If you are going to do this project, I suggest you take the time to thoroughly understand how the BLDC works and controls.
There are a large number of references online (
See below for some suggestions).
However, I do include some charts and tables in my project that should help you understand.
Here is a list of the concepts that I think are most important to understanding this project: MOSFET transistors 3-phase half-bridge 6-
3-step reduction of sentence
Pulse Width Modulation of phase motor (PWM)Hall-
Microchip AVR443: sensors-general reference DC motor Basic Principles for Digital position sensors
Control of three-phase brushless DC motor based on atmelbrusless DC motor control
Phase BLDC motor control of the Flying Star Hall sensor, a good video of cleaning up the hard drive motor, but the author seems to be running the motor as a stepping motor and as a stepping motor. A more specific reference web page for the BLDC on the l6234 motor drive IC, including data sheets, application notes, and purchase information.
Free sample for PM brushless motor drive for hybrid electric vehicle applications.
This is the only paper I found that describes the order of the regenerative braking phase change.
This paper, regenerative braking in electric vehicles is useful, I borrowed a few numbers from it, but I think it incorrectly describes how regeneration works.
I did this project with recycled disk drive motor because it was easy to pass through and I like to use a small low voltage motor to learn the cord controlled by BLDC and not cause any safety problems.
In addition, the magnet configuration of the hall sensor becomes very simple by using the magnetic ring (rotor)
From the second of these motors (See Step 4).
If you don\'t want to go to all the hassle of installing and calibrating the hall sensor (steps 5-7)
I know there are at least some CD/DVD drive motors built in-Hall sensor.
In order to provide some turning inertia to the motor and give them a little load, I put 5 hard drives on the motor, gently glued together with a little strong glue and glued to the motor (
This made the flywheel in my original project).
If you are going to remove the motor from the hard drive, you need a T8 torx drive to unscrew the Housing (
Usually there are two screws hidden behind the stick in the centeron label)
And internal screws that hold the motor in place.
You also need to remove the head Reader (
Sound circle executive)
This way you can take out the memory disk to reach the motor.
In addition, you will need a second same hard drive motor to remove the rotor from that motor (
There is a magnet inside).
In order to take the motor apart, I grabbed the rotor (top)
A vise of the motor and pry it on the stator (bottom)
The two screwdrivers are 180 degrees apart.
It is not easy to hold the motor on a tight enough pair without deformation.
You might want to build a wood v-
Block used for this purpose.
I drilled a hole in the magnetic ring on the lathe so that it fits comfortably on the top of the motor.
If you are unable to use the lathe, you can fix the inverted rotor on the motor with a strong glue.
The pictures 2 and 3 below show the interior of one of the motors I have disassembled.
In the first half there (the rotor)are 8 poles (
Magnet wrapped in plastic).
In the second half (the stator)
There are 12 slots (windings).
Each of the three motor phases has 4 slots in series.
Some HD motors have three contacts at the bottom, one contact per phase, and the other is the center tap of the motor (
Where three stages meet).
In this project, no center tap is required, but it can come in handy in sensor-free control (
I hope to release a note about Sensor-free control one day).
If your motor has four contacts, you can identify the phase with ohmeter.
The resistance between the center tap and the phase is half of the resistance between any two phases.
Most of the literature on BLDC motors deals with those with a ladder-shaped back potential waveform, but the hard drive motor seems to have a back potential that looks like a sine (See below).
As far as I know, driving a sine wave motor with a sine wave PWM is working fine, although the efficiency may drop somewhat.
Like all the BLDC motors, this one is made up of three-phase half-
Transistor Bridge (
See 2nd photos below).
I use the IC made by ST Micro (L6234)
For the bridge, also known as the motor driver.
The electrical connection of L6234 is shown in step 8.
The third photo below shows a schematic diagram of the motor driver and the three motor phases.
In order for the motor to operate clockwise, the switch will be made in the following order (
The first letter is the upper transistor and the second letter is the lower transistor)
: Step 1 2 3 4 5 6 clockwise: CB, AB, AC, BC, BA, CA counter clockwise: BC, BA, CA, CB, AB, AC these 6-
The step sequence requires a \"electrical degree\" of 360, but only a physical degree of 90 for these motors.
Therefore, the rotation speed of each motor occurs four times.
The two sequences seem to be the same, but they are not the same because for 6-
Step sequence, for CW, the current direction through the phase is one direction, and for CCW, the current direction is opposite.
You can see this yourself by applying the voltage of the battery or power supply to either motor phase.
If you apply the voltage, the motor will move a little in one direction and stop.
If you can quickly change the voltage on the phase in one of the above sequences, you can rotate the motor manually.
Transistors and microcontrollers complete all these switches very quickly, switching hundreds of times per second when the motor is running at high speed.
Also, please note that if the voltage is applied to both phases, the motor moves a little bit and then stops.
This is because the torque is zero.
You can see this in the fourth photo below, which shows the back potential of a pair of motor phases.
This is a sine wave.
When the wave goes through x-
Shaft, the torque provided by this phase is zero. In the six-
Step BLDC phase change sequence that never happened.
Before the torque on a particular phase becomes low, the power is switched to another phase combination.
Larger BLDC motors are usually manufactured by Hall sensors inside the motor.
If you have such a motor then you can skip this step.
Also, I know there are at least some CD/DVD drive motors built in already-Hall sensor.
When the motor rotates, three hall sensors are used for position detection, so the phase change is performed at the right moment.
My HD motor runs up to 9000 RPM (150 Hz).
Since there are 24 changes per wheel, at 9000 RPM, the machine is changed every 280 microseconds.
The Arduino micro-controller works at 16 MHz, so each clock cycle is 0. 06 microseconds.
I don\'t know how many clock cycles are required to perform a reduction of sentence, but even if 100 clock cycles are required, that is, it takes 5 microseconds for each reduction of sentence.
HD motors do not have Hall sensors, so it is necessary to install them on the outside of the motor.
The sensor needs to be fixed with respect to the motor rotation and exposed to a series of poles that are consistent with the motor rotation.
My solution is to remove the magnetic ring from the same motor and install it upside down on the motor to be controlled.
I then installed three hall sensors above this magnetic ring, 30 degrees apart from each other on the motor shaft (
120 degree electric motor rotation).
My Hall sensor holder consists of a simple holder consisting of three aluminum parts processed by me and three plastic parts made on a fast prototype.
If you do not have these tools, it should not be difficult to find another way to indicate the position.
Creating brackets for Hall sensors will be more challenging.
This is a possible way to work: 1.
Find a plastic tray of the right size and you can carefully epoxy the hall sensor. 2.
A template is printed on the paper, which has the same circle as the magnetic ring radius, and the three marks are 15 degrees 3 apart.
Glue the template to the disk and then use the template as a guide to carefully place the hall sensor epoxy in place.
Now that Hall sensors are installed on the motor, connect them to the circuit shown below and test them using a DMM or oscilloscope to make sure that the output gets higher and lower as the motor rotates.
I run these sensors under 5 v using Arduino\'s 5 v output.
The Hall sensor is high or low in output (1 or 0)
It depends on whether they feel the Antarctic or the Arctic.
Since they are 15 degrees apart, the magnets rotate under them and change the polarity every 45 degrees, these three sensors will never be high or low at the same time.
When the motor rotates, the sensor output is 6-
The step pattern shown in the following table.
The sensor must be aligned with the motion of the motor so that one of the three sensors changes precisely at the motor phase change position.
In this case, the rising edge of the first hall sensor (H1)
Should be consistent with the opening of the C combination (high)and B (low).
This is equivalent to turning on transistors 3 and 5 in the bridge circuit.
I align the sensor with the magnet with an oscilloscope.
In order to do this, I have to use three channels of scope.
I rotate the motor by connecting to the belt of the second motor and measure the back potential between the two phase combinations (
A and B, A and C)
This is two sine.
Like the waves in the picture below
Then look at the signal of Hall sensor 2 on channel 3 of the oscilloscope.
The Hall sensor holder is turned until the rising edge of the hall sensor is fully aligned with the point where the phase change should be performed (See below).
I now realize that there are only two channels to do the same calibration.
If the BEMF of phase combination B-
Using C, the rising edge of H2 will be related to B-C curve.
The reason why the phase change should be carried out here is to always keep the motor torque as high as possible.
The back potential is proportional to the torque and you will notice that each phase change occurs when the back potential passes below the next stage curve.
Therefore, the actual torque consists of the highest part of each phase combination.
If you can\'t access the scope, here\'s my idea of alignment.
This is actually an interesting exercise for anyone who wants to know how the BLDC Motor Works.
If the motor Phase A is connected (positive)and B (negative)
To the power supply and turn on the power supply, the motor will rotate a little and stop.
Then, if the negative power lead is moved to the C phase and the power is turned on, the motor will turn further and stop.
The next part of the sequence will be to move the positive lead to Phase B, etc.
When you do this, the motor always stops where the torque is zero, which corresponds to one place where the chart passes through the x-axis on the chart.
Note that the zero point of the third-phase combination corresponds to the phase change position of the first two combinations.
Therefore, the zero torque position of B-
The C combination is where you want to position the rising edge of h2.
Mark this position with fine marks or sharp blades, and then adjust the hall sensor holder using DMM until the output of H2 is exactly higher on this mark.
Even if you deviate a little from your school schedule, the motor should work well.
The three motor phase will receive power from the L6234 three-phase motor driver.
I found that this is a good product that can stand the test of time.
There are many ways to accidentally fry your components when using power electronics, I\'m not an electrical engineer and I don\'t always know what\'s going on.
In my school program, we did our own 3-
Phase half-bridge output of 6 MOSFET transistors and 6 diodes.
We used this on the HIP4086 of the other driver Intersil, but we have a lot of problems with this setup
We burned a bunch of transistors and chips.
I run L6234 (
So the motor)at 12V.
The L6234 has an unusual set of inputs to control a half-bridge of 6 transistors.
Not every transistor has an input, but a enable (EN)
Input for each of the three stages, and then another input (IN)
Select which transistor in the open phase (upper or lower).
For example, turn on transistor 1 (upper)and 6 (lower)
Both EN1 and EN3 are high (
EN2 low to keep the stage closed)
IN1 High, IN3 low.
This makes the phase combination-C.
While the L6234 application note suggested applying the PWM used to control the speed of the motor to the IN pin, I decided to do it on the EN pin because, at that time, I think it would be \"strange\" to turn on the upper and lower transistors of the phase alternately \".
In fact, it seems that there is nothing wrong with turning on the low transistors of both phases at the same time, because they have the same potential, so neither of them passes through the current.
With my method, the high phase is enabled and disabled alternately at PWM frequency, while the low phase remains on during the entire phase change.
Below is a schematic of the motor drive, I have added the pin connection to the Arduino board. I also add a 2.
5 amps fuse between the positive battery lead and the circuit, fuse 100 uF capacitor between the power supply and gnd to reduce the ripple in the regenerative current.
This figure is a bit small, so for larger versions, please refer to the documentation for L6234.
Note: Mike Anton made the PCB for L6234, which will (I believe)
Replace this track and save you the job of assembling it.
See these links for specs and purchase information: I haven\'t found a lot about 3-
I will describe my understanding of how it works.
Please note that I am not an electrical engineer and we would appreciate any corrections to my explanation.
When driving, the control system sends the current into three motor phases in a way that maximizes torque.
In regenerative braking, the control system also maximizes the torque, but this time it is a negative torque that causes the motor to slow down while sending the current back to the battery.
The regenerative braking method I used came from a paper from the Oakridge National Laboratory in the United States. S. govt.
A laboratory that does a lot of research for Automotive motors.
The chart below comes from another paper that helps illustrate how it works (
However, I think the explanation given in this second paper is partially incorrect).
Keep in mind that when the motor rotates, the BEMF voltage in the motor phase fluctuates up and down.
In the figure, it shows the moment when BEMF is high in Stage B and low in stage.
In this case, it is possible for the current to flow from B to.
Critical to regenerative braking, low-end transistors are turning on and off quickly (
Thousands of PWM switches per second).
When the high-end transistor switch is turned off;
When the low transistor is turned on, the current flows as shown in the first picture.
In terms of power electronics, the circuit is like a device called a boost converter, where energy is stored in the phase of the motor (
Wikipedia has a good article explaining how the boost converter works).
This energy is released when the low-end transistor is turned off, but at a higher voltage, the current instantly flows through the \"anti-excitation\" diode next to each transistor and then returns to the battery.
The diode prevents current from flowing from the battery to the motor.
At the same time, the current in this direction (
Contrary to driving)
Interact with the magnet ring to produce a negative torque that slows the motor down.
The low-side transistor uses a PWM switch, and the duty cycle of PWM controls the amount of braking.
When driving, the commutation of the motor switches from one combination to the next in due course to maintain the highest possible torque.
The commutation of the regenerative brake is very similar because some switching mode causes the motor to produce as much negative torque as possible.
If you watch the video in the first step, you can see that the regenerative brake works fine, but it doesn\'t work well.
I think the main reason is that the hard drive motor I use is a very low torque motor, so it doesn\'t produce much BEMF except at the highest speed.
At a lower speed, there is very little regenerative braking (if any ).
Also, my system runs at a relatively low voltage (12 V)
Moreover, since each path through the anti-excitation diode reduces the voltage by several volts, this also greatly reduces the efficiency.
I use normal rectifier diodes and I may get better performance if I use some special diodes with lower voltage drop.
Below is a list of inputs and outputs on arduino.
Also include charts and photos of my board. 2-
Digital entry-Hall 1
120 K resistance of Gnd 3
Digital entry hall 2
120 K resistance of Gnd 4
Hall 3 digital input-
120 K resistance of Gnd 5
1 Digital Output in series with 400 ohm resistor 6
2 Digital outputs in series with 400 ohm resistor 7
3 Digital outputs in series with 400 ohm resistor 9-
Digital Output of EN 1 in series with 400 ohm resistor 10-
Digital Output of EN 2 in series with 400 ohm resistor 11-
The EN 3 digital output is in series with a 400 ohm resistor, 100 k Ohm potentiometer, with 5 v and gnd connected at both ends and analog pin 0 connected in the middle.
This potentiometer is used to control motor speed and braking volume.
5 V power supply is also used to run Hall sensors (see step 5).
Here is the whole program I wrote for Ardjuino, which includes comments:/* bldc_congroller 3. 1.
1*3 by David Glazer.
The X series is ST L6234 3-
Phase motor driver IC * running disk drive motor clockwise * with regenerative braking * motor speed and braking controlled by a single potentiometer * motor position by three Hall-
Effect Sensor * Arduino receives output from 3 hall sensors (pins 2,3,4)
* And convert their combination to 6 different phase-changing steps on pins 9, 10, 11 at 32 kHz * PWM output (
Corresponding to EN 1,2, 3*3 DO on pins 5,6, 7, respectively (IN 1,2,3)
* Connect the simulation in 0 to the potentiometer to change the PWM duty cycle and Change * between driving and regenerative braking *. * 0-
499: brake * 500-
523: Taxi * 524-
1023: motoring * comments many lines for debugging by printing various values to a serial connection.
*/Int allstate1;
Variables of three hall sensors (3,2,1)int HallState2; int HallState3;
Int HallVal = 1;
/The binary value of all 3 hall sensors int MSPs = 0;
/Speed level int bSpeed = 0 for motor;
/Brake level of throttle = 0;
/This variable is used together with the analog in to measure the position of the gap setting of the throttle potentiometer (){pinMode(2,INPUT);
/Hall 1 pinMode (3,INPUT);
/Hall 2 pinMode (4,INPUT);
/L6234 Hall 3/output of pinMode motor driver (5,OUTPUT);
/In 1 pinMode (6,OUTPUT);
/In 2 pinMode (7,OUTPUT);
/In 3 pinMode (9,OUTPUT);
/EN 1 pinMode (10,OUTPUT);
/EN 2 pinMode (11,OUTPUT);
/EN 3/serial. begin(9600);
If you will be using a serial connection, please uncomment this line.
The flush command at the end of the program.
/* Set PWM frequency on pins 9, 10 and 11/set PWM to 32 kHz for pins 9, 10/first clear all three pre-divider bits: int prescalerVal = 0x07;
/Create a variable called prescalerVal and set it to equal the binary number \"00000111\" TCCR1B & = ~ Prescaler
/And the value in TCCR0B with a binary number of \"11111000\"/now set the appropriate pre-encoding bit: int pre-encoding bit 2 = 1;
/Set prescalerVal to equal the binary number \"00000001\" TCCR1B | = prescalerVal2;
/Or value in TCCR0B with a binary number of \"00000001\"/set PWM to 32 kHz for pin 3,11 (
This program only uses Pin 11)
/Clear all three pre-caler bits first: TCCR2B & = ~ Pre-calerval;
/And the value in TCCR0B with a binary number of \"11111000\"/now set the appropriate pre-encoding bit: TCCR2B | = Pre-encoding bit 2;
/Or the value in TCCR0B with a binary number of \"00000001\"/first clear all three pre-encoded bits :}
The main loop of the/PRGROM void loop (){
/Time = millis ();
Time after the printing program starts. println(time); //Serial. print(\"\");
Throttle = analogRead (0);
/Throttle potentiometer MSPs = map (
Throttle, 512,1023, 0,255);
/Driving is mapped to the upper half of the potentiometer bSpeed = map (
Throttle, 0,511,255, 0);
/Half-part regenerative braking at the bottom of the pot/MSPs ed = 100;
/For debugging HallState1 = digitalRead (2);
/Read input value from Hall 1 2 = Digital Read (3);
/Read input value from Hall 2 3 = Digital Read (4);
Read input value/numeric write from Hall 3 (8, HallState1);
/When the corresponding sensor is in high power, the led will turn on
Originally used to debug digitalWrite (9, HallState2);
//digitalWrite(10, HallState3); HallVal = (HallState1)+ (2*HallState2)+ (4*HallState3);
/Calculate the binary values of 3 hall sensors/* series. print(\"H 1: \");
For debugging serial port. println(HallState1); Serial. print(\"H 2: \"); Serial. println(HallState2); Serial. print(\"H 3: \"); Serial. println(HallState3); Serial. println(\" \");
*/ //Serial. println(mSpeed); //Serial. println(HallVal); //Serial. print(\"\");
/Monitor transistor output/delay (1000);
/* T1 = digitalRead (2); //T1 = ~T1;
T2 = digitalRead (4); //T2 = ~T2;
T3 = digitalRead (5); //T3 = ~T3; Serial. print(T1); Serial. print(\"\\t\"); Serial. print(T2); Serial. print(\"\\t\"); Serial. print(T3); Serial. print(\"\"); Serial. print(\"\"); Serial. print(digitalRead(3)); Serial. print(\"\\t\"); Serial. print(digitalRead(9)); Serial. print(\"\\t\"); Serial. println(digitalRead(10)); Serial. print(\"\"); Serial. print(\"\"); //delay(500);
*/Driving phase change/each binary number has a case corresponding to the different transistors turned on/bit math used to change the value of the output arduino: /PORTD contains the output of the IN pin on the L6234 driver/the output used to determine whether the upper transistor or the lower transistor/EN pin for each phase is controlled by the Arduino command analogy, set the duty cycle of PWM (
0 = OFF, 255 = ON or throttle value controlled by potentiometer). if (throttle > 511){switch (HallVal){
Case 3:/PORTD = 1111xxx00;
/Expected output of pin 0-
7 xxx refers to Hall input and PORTD & = B00011111 should not be changed;
PORTD | = B01100000;
/Analowrite (9,mSpeed);
PWM on A phase (
High-end transistor)analogWrite(10,0);
Phase B closure (duty = 0)analogWrite(11,255); // Phase C on -duty = 100% (
Low-end transistor)break;
Case 1:/PORTD = B001xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
/PORTD | = B00100000;
/Analowrite (9,mSpeed);
PWM on A phase (
High-end transistor)analogWrite(10,255); //Phase B on (
Low-end transistor)analogWrite(11,0); //Phase B off (duty = 0)break;
Case 5:/PORTD = B101xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
/PORTD | = B10100000; analogWrite(9,0); analogWrite(10,255); analogWrite(11,mSpeed); break;
Case 4:/PORTD = B100xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
PORTD | = bym000;
/Analowrite (9,255); analogWrite(10,0); analogWrite(11,mSpeed); break;
Case 6:/PORTD = B110xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
PORTD b11. 000 =;
/Analowrite (9,255); analogWrite(10,mSpeed); analogWrite(11,0); break;
Case 2:/PORTD = B010xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
B0201700 PORTD | =;
/Analowrite (9,0); analogWrite(10,mSpeed); analogWrite(11,255); break; }}
/Regenerative brake phase change/PORTD (
Output of IN pin on L6234)
The pins are always low, so only low transistors on each phase are used during regen. braking. else{
/PORTD = B000xxx00;
/Expected output of pin 0-
7 PORTD & = B00011111;
PORTD | = bym0000; // switch (HallVal){
Case 3: analogy writing (9,bSpeed); //analogWrite(9,0); analogWrite(10,0); analogWrite(11,0); break;
Case 1: analogy writing (9,bSpeed); analogWrite(10,0); analogWrite(11,0); break;
Case 5: analogy writing (9,0); analogWrite(10,0); analogWrite(11,bSpeed); break;
Case 4: analogy writing (9,0); analogWrite(10,0); analogWrite(11,bSpeed); break;
Case 6: analogy writing (9,0); analogWrite(10,bSpeed); analogWrite(11,0); break;
Case 2: analogy writing (9,0); analogWrite(10,bSpeed); analogWrite(11,0); break; }}
/Time = millis ();
Time after the printing program starts. println(time); //Serial. print(\"\"); //Serial. flush();
/If you want to debug using a serial port, please uncomment}
I think the operation that Arduino does in this project is so simple that it seems like a waste to do this task with a microprocessor.
In fact, L6234\'s application notes recommend a simple programmable gate array (
GAL16V8 made of Lattice Semiconductor)to do this job.
I am not familiar with the programming of this device, but the cost of IC is only $2. 39 at newark.
Other similar integrated circuits are also very cheap.
Another option is to piece together the discreet logic gates.
I came up with some relatively simple logic sequences that could drive the L6234 IC from the output of the three hall sensors.
The chart for stage A is shown below, and the truth table for all three stages (
In order for the logic circuit of the B and C phases, the \"not\" door must be switched to the other side of the \"or.
The problem with this approach is that there are nearly 20 connections at each stage, so it takes quite a bit of work to put it together.
It is best to program it as a programmable logic gate.