brushless gimbal with arduino
Thanks to Professor Dwight Whitaker, Tony grignby, and the Pomona Department of Physics.
Our goal in this project is to create a 2-axis brushless universal frame controlled separately by Arduino Uno and input from the accelerometer/gyro.
The universal frame is a camera stabilization system that uses a motor to correct unwanted camera movements.
The goal is to create a perfectly stable lens, although smoothing any bumps is a reasonable first benchmark.
\"Brushless\" refers to brushless motors, which we will explain in detail later.
All of the other frame items we found were controlled using the prefabrication frame control board, so we wanted to deal with the project on a more basic level.
Our hope is to use a more generic Arduino Uno to create a brushless frame control without this board.
We must prepare in advance;
We haven\'t found the universal frame we\'re looking.
However, we did learn a lot about how the equipment should work, so we wrote some ideas about improvement and the direction of the project.
We hope this is at least a good resource for a starting point.
Please let us know if you have any questions or suggestions for improvement.
Between learning how to control the brushless motor and connecting to the accelerometer, we consulted a lot of sources for this project.
We will refer to the materials and photos of this project, which are the basis for our brushless motor control.
Our code is largely based on the above motor control project and this I2C library with sample code for the MPU6050 chip.
Thank you very much for giving us the direction of our efforts!
There are several ways to get the parts of this project.
Of course, Arduino Uno is one of the main components.
We bought a frame and brushless motor group on Amazon: frame and brushless motor.
It may be possible to machine or print your own frame, but we are more interested in the electronic part of this project, so we took a faster route to simply purchase the ready-made framemade.
We also purchased our accelerometer on Amazon: Accelerometer/gyro. The GY-
The 521 breakout board is much cheaper than any other MPU6050 model we found, but it works great for our project.
However, we did manage to break one and had to order the other.
We are still not sure if its failure is our fault.
We used two Mauser 511L298 h-bridges (With radiator)
There will be more later.
They are able to handle the higher voltage and current required to drive the motor in order to move the frame and camera.
There are two other widgets we use.
2 k resistance, three 0.
1 microFarad capacitor and lots of wiring :)
Since they are efficient, precise and have full torque, the brushless DC motor is ideal for this project;
They are actually in control.
The most common hobby route is to purchase a programmable electronic speed controller that can accept throttle input and convert it to rotational speed in a brushless motor.
However, the cheapest one could cost $20, so we decided to save the cost and figure out how to control the motor without them.
Unlike the Brush DC motor, the Brush DC motor simply reverses the current in the wire circuit in the permanent magnet magnetic field through the converter, and the brushless motor has no physical connection between the coil on the stator and rotor.
The most common brushless motor is called a three-phase brushless motor.
This means that they have three different sets of coils, usually marked with A, B, and C.
The surroundings are permanent magnets in alternating directions.
Our motors have 12 coils or magnets (3 sets of 4)
There are fourteen permanent magnets on the rotor.
The idea is that we change the polarity of our magnets in one cycle, and permanent magnets follow the changing magnetic field.
In the simplest form, we have three magnets (A, B, and C)
The rotor is just a single NS permanent magnet.
If we have coil A to generate A North magnetic field, coil B to generate A South magnetic field, and coil C to close, the magnet will align as closely as possible to the resulting magnetic field.
Then we can rotate the polarity of the magnet in one position (
A Guan, B North, C South)
Magnets will follow.
In this way, we have a set of phase-swapping, and when we run them in order to make the rotor turn, we can reverse the loop and run it in the opposite direction.
Watch these two videos and explain them clearly and clearly with the chart.
We did some research and found that by sending out a sine wave of 120 degrees through these three sets of magnets, we could produce a dynamic magnetic field that drives the motor to rotate.
The introduction of a sine signal greatly smoothed the motion of the motor by gradually changing the polarity of the magnet.
This site is very useful in turning this theory into Arduino Software.
The trick of this method is to run our PWM signal from Arduino through the H-bridge to allow the negative polarity of one of the coils, because the PWM signal only outputs high levels (1)and Low (0).
One of the biggest challenges with brushless motors is that to properly control them, you need information about the position of the rotor relative to the stator coil.
In this way, the controller can know exactly where to start or jump to during the phase change cycle.
We would like the accelerometer to be able to give this feedback, which seems to have been a certain success.
More sophisticated methods include connecting Hall sensors to detect the position of the rotor and even using the \"back potential\" induced in the coil \".
The bridge that controls the motor allows us
The directional movement required by the universal frame also allows very smooth stepping of the motor position.
The H bridge basically flipped the symbol on a magnet so we could have high, medium, and low pressure.
As described in the introduction, we used L298 h-
Bridge with 15 pins.
As shown above, we connect each of them.
This is the data sheet.
Our source describes a clever scheme to approach the sine signal to the motor.
They construct an array of values between 48 0 and 255 that represent the values of the sine function in equal increments.
They begin to separate the values of A, B, and C 16 for each induction magnet state, which divides the period of the function into three, in other words, the phase moves the state 120 degrees.
They then simply add the value of each state to the array, so that the state passes through the sine wave with each loop of the program.
The result is that the rotation in the motor is very smooth, although the speed is limited by the physical ability of the motor to keep up with the Arduino signal.
We use the same PWM sine
The array format serves as our source, which allows for an increase over a given period by a numerical approximation of the sine function.
In our example, we doubled the number of values in the array from 48 to 96, so that we could control the motor more precisely.
This is because our universal frame application does not require a full rotation of the motor, in any case;
We only need to adjust the position of the camera according to the movement of the base.
Fast observation shows that our scheme allows the motor to step in 0.
Step 2 degrees at a time.
It should be noted that this is mainly a temporary way to control the brushless motor.
We need a high current, a low current and a high current at any given moment
Close to an impedance state that is neither high nor low.
In our case,
The impedance \"state actually makes the current ground, which generates a lot of heat in the motor.
A clear improvement is to prevent the motor from getting hot for a long timeterm (e. g.
More than a minute or two)operation.
Another danger we implement is that the motor physically misses or exceeds one of the steps, which can happen considering the huge weight of the frame and camera relative to the torque of the motor.
In this case, our program does not know that the motor is out of sync with the signal and cycles once in the sine wave before \"capturing\" the motor and recovering normally.
The accelerometer allows the Arduino to understand where our camera is relative to gravity at any given time and to detect the axial acceleration.
Changes in Gyro detection angle.
With this data, we created a servo (
Feedback loop close to a given set point)
Keep the universal frame in a fixed position
We used MPU 6050 6-DOF (
Accelerometer and gyro mounted on the GY 521 breakout board.
As shown above, we connect the accelerometer to the Arduino.
Unfortunately, there is no data sheet for this breakout board.
This is what we found in our comments on Amazon: we searched around and found some Arduino sketches that gave you raw data.
However, it is very noisy and not particularly useful, especially in servoing.
MPU 6050 built-in digital motion processor (DMP);
However, instructions for using it are not provided.
An outstanding person at the Massachusetts Institute of Technology
Thanks Jeff Rowberg! )
Reverse design the chip and figure out how to activate DMP and get clean and stable data from it.
We used his code, which allows us to receive data in several different forms, including the Orah angle, the quarter or the horizontal angle and the horizontal angle (YPR).
We decided to use YPR data because it is directly related to how we control the camera.
We have a lift motor (
Think about it)
And rolling motor (
Think about the bank plane).
Once we have this form of data, coding is relatively easy, and we write a basic servo code that rotates the motor to any angle we set in the code, by \"increasing\" the sine wave in the appropriate direction.
Conveniently, our two motors match exactly the two coordinates in it, so that we can servo them separately without interfering with each other.
This is a relatively simple conceptual core for our project.
YPR data is a bit tricky as it only gives-
90 degrees and 90 degrees, so it occasionally gets confused if the servo is close to the level, theoretically not a problem in the universal frame application (
Although we think it is still a place to improve).
For our end product, we simply combine the concepts of motor control and accelerometer reading to form a servo system.
You can view the generated code here.
Of course, the solution is not so simple.
During the merge phase, we had a lot of problems and most of them were not solved.
Our setup initially included only one of the two axes;
It took us a long time to have the motor open in the presence of the accelerometer, although the time we had for the two to work separately was relatively simple.
We found two 2 solutions. 2k pull-
Up resistance between I2C Port A4/A5 and 5 v on Arduino
Strangely, the value of all the other resistors except 3.
3 k, power is not allowed to reach the motor. Pull-
Upward resistors tend to insert analog read ports to stabilize the signal and prevent Arduino from freezing, but they are often a safety precaution rather than a strict necessity.
So it doesn\'t matter what the pull value should beThe Up resistance is (within reason)
Contrary to what we found.
Our conclusion is:
The Up resistor is compensating for something, but we are still not sure exactly what it is.
For whatever reason, each time we add an external power supply of more than 7 or 8 volts on the 1 axis (
Although we finally \"solved\" the 1 axis
With two axes and 3 to 4 volts (0.
30 amps seems to be the limit)
Accelerometer data output to bridge H-of-
Wack is useless.
This in turn causes the motor to freeze due to the final collapse of the Arduino.
We walked around with an oscilloscope and found something.
Basically, the circuit draws about 0 when we connect the external power supply.
8 amps, noise almost everywhere-There are many more.
\"The Ground\" is-2 and +3 volts! ! ! !
It makes sense that the accelerometer doesn\'t know what to do.
This seems to be the root cause of all of our problems, and we may have an effective product if we solve this problem.
When using a brushless motor, you generate a constantly changing magnetic field through the coil.
According to Faraday\'s law, an emf is generated in this online circle.
We think this \"back potential\" may be the reason for the noise we see.
The second guess is our chaotic setup.
We also use quite long wires, from Bridge H to bridge a, from accelerometer to bridge.
Long wires and high voltages are excellent in receiving electrical signals and introducing noise into the circuit.
At the end, it seems to be with 2.
2 k pull up resistance, we solve the problem of a shaft.
We have a good servo system that can run indefinitely and can even handle 15 V, giving it a lot of torque.
Note that here we try to servo to zero angle to test the servo action and make sure that all the work is done not just gravity.
The usual universal frame function uses gravity to help stabilize, so the quality center is critical.
The motor control is still a bit confusing, always running at a constant speed.
We think we can solve this problem by doing two things, first creating a sine wave array with a higher resolution.
Then, by implementing the PID library, we can change the reaction speed of the motor according to the distance from the set point of the motor.
When it is really far away, it will quickly move through the sine wave, so that it will slow down and stabilize as it approaches the set point.
In theory, this will eliminate the bumps we experience when the motor reaches the set point and create faster, smoother frame movements.
This is our last 2-axis action.
It has very low voltage and current, so it doesn\'t have all the torque we need.
It was set again to be a bit tilted.
Here are the test shots from GoPro-
Not the perfect stable lens we want.
The terrible noise comes from the brushless motor.
We\'re not sure if they\'re normal so loud, but who needs audio anyway.