Warning: Invalid argument supplied for foreach() in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 19

Warning: array_diff(): Argument #2 is not an array in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 29

Warning: Invalid argument supplied for foreach() in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 19

Warning: array_diff(): Argument #1 is not an array in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 29

Warning: Invalid argument supplied for foreach() in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 19

Warning: array_diff(): Argument #1 is not an array in /var/www/kartinki1/data/www/3.1onega.ru/ftrans/proxy.php on line 29
How to make turtle armor

How to make turtle armor

Date: 16.10.2018, 15:04 / View: 74431


Stepper motors are sufficiently common in devices in which it is necessary to achieve accurate movement of mechanisms. There are many types of stepper motors, but the most friendly in terms of control are 2-phase unipolar motors. This type of engine has two independent windings with leads from the middle. They can be found mainly in the old technology: printers, copiers, disk drives (5-inch) and many more.

Depending on how the middle windings are connected inside, 5 or 6 wires can go out of the motor. There is no difference, all the same, the average leads of the windings are connected together. A characteristic feature of stepper motors is the discreteness of the rotation of the rotor, that is, if you take and turn the motor shaft, you can feel how it is fixed at certain points. This is the engine steps. When powering one of the half windings, the motor shaft is fixed in a certain position. If you remove the voltage from this winding and power the other, the rotor turns and locks in a different position. Thus, if the windings are fed in a certain sequence, the motor shaft can be rotated.

There are several power control algorithms for motor windings. The simplest is full-step control, when at any time only one of the half windings is energized. For clarity, I put up a plate showing the sequence of switching on the windings:

The rotor with this control takes a natural position relative to the stator. There is also a way to control the shagovik in the full-step mode, when two phases are simultaneously powered, thus it is possible to increase the torque on the shaft by 40%.

The main drawback of full-step control is hellish engine vibrations and a small step increment equal to the passport value.

In order to reduce vibrations and achieve a smoother and more accurate shaft rotation, there is a more advanced method - half-step control, the algorithm for switching on the winding halves is shown below:

In this operation, the motor shaft in one cycle makes half a step and is fixed between two natural equilibrium states. Thus, the discreteness of rotation of the shaft is increased by 2 times.

There is still a way to increase the crushing of the rotor pitch of the motor - microstep control - when the winding is not just powered, but powered by a certain current. And the position of the rotor depends on the current ratio in the neighboring windings - the more current flows in the winding relative to the neighboring one, the closer the rotor moves to it and vice versa. This allows you to increase the crushing step in the tens and hundreds (!) Times.

With the theory a little sorted out, now you need to choose in what mode the engine will be controlled. The full step is too poor and not effective, the micro-step is complicated, and it is needed mainly in controlling the drive of a high-precision CNC machine tool. Therefore, we will turn in half step :)

The scheme is based on the attiny2313 microcontroller and has two buttons. When you click on one shaft of the engine will spin in one direction, when you press the other - in the other. The key transistors selected KT829, able to drag through up to 8 amps.



The terminals from the middle of the windings are connected to the Udvig terminal and the voltage is applied to power the windings. The voltage depends on the motor itself, for example, according to my documentation, the maximum current in the windings is 1.5 Amperes, measuring the resistance of the windings received 2 Ohms, hence the conclusion that the supply voltage should not exceed 3 V or a little more, given that inductive load will be supplied.
By the way, the diodes D2-D5 are in order to suppress the surge of reverse voltage after the transistor is closed. Otherwise, there is a possibility that the self-induction EMF arising during the switching off of the power of the winding will cause a transistor.

Control Board Assembly:



The red LED lights up when you press one of the buttons. Connector for controller on UART made optional, in case you need to attach the control of a small footstep with a computer.


Code in Bascom-AVR:
$ regfile = "2313def.dat"
$ crystal = 4000000
Dim S As Byte 'this variable keeps track of the engine step number
S = 1
On Int0 Knopka1 'give names to external interrupt handlers
On Int1 Knopka2
Config Portb = Output 'configure port to output
Config Portd.5 = Output 'Configuring the leg to connect an LED
Led Alias ​​Portd.5 'assign the name LED to pin 5 of port D

'interrupts will be generated while the low level on the leg, that is, while the button is pressed
Config Int0 = Low Level
Config Int1 = Low Level
'enable interrupts
Enable Interrupts
Enable Int0
Enable Int1
'main program loop, just waiting for interruption
Do
Loop
Knopka1: 'first button interrupt handler
Led = 1 'light up the LED

Incr S 'Increase Step Number
If S = 9 Then 'maximum step number = 8
S = 1
End If
Select Case S 'choose which windings to turn on depending on the step number
Case 1: Portb = & B00000001
Case 2: Portb = & B00000011
Case 3: Portb = & B00000010
Case 4: Portb = & B00000110
Case 5: Portb = & B00000100
Case 6: Portb = & B00001100
Case 7: Portb = & B00001000
Case 8: Portb = & B00001001
End Select
Waitus 1000 'delay between steps
Led = 0 'dim the LED

Return
Knopka2: 'second button interrupt handler
Led = 1 'light up the LED

Decr S 'is the same here, only in the opposite direction
If S = 0 Then 'minimum step number = 1
S = 8
End If
Select Case S
Case 1: Portb = & B00000001
Case 2: Portb = & B00000011
Case 3: Portb = & B00000010
Case 4: Portb = & B00000110
Case 5: Portb = & B00000100
Case 6: Portb = & B00001100
Case 7: Portb = & B00001000
Case 8: Portb = & B00001001
End Select
Waitus 1000
Led = 0 'dim the LED

Return
End

By varying the amount of delay between the steps, it is possible to regulate the speed of rotation of the shaft within wide limits. With a delay of 1000 μs chosen by me with a shagger having 200 steps per revolution (400 half-steps), the rotation speed is approximately 2.5 revolutions per second.

Download files to the project

UPD: Here I finished the program, now it became possible to control the stepper motor from the computer.


Related news:


Pictures for managing the stages for girls
How to make curls with straightener video
Stopari their hands
Table fountain with his own hands
The Sphinx with your own hands
Chair hand made toys
Handmade dolls Helena



Memory used: 144.72KB of 1.25MB
Render time: 4.021 sec., Version: 3.5.5