Acceleration of stepping motor and limit switch. In this article, we will discuss these issues, and in this article I will introduce you to a motion test component. In addition to the concept of the terminal switch, I will also demonstrate an example of stepping acceleration code. Can the stepping motor be handled without acceleration? Yes I can. Just keep the speed constant. So what is the benefit of acceleration? Well, they have weight when you install a router or a CNC machine. Imagine that you pushed a spindle of 3cv, 4cv. . . Imagine the heavy mechanical structure. . . As a result, the engine needs to be detached from zero speed, which is gradually increasing because it is good for the health of the equipment. What happens if you don\'t speed up and slow down? You have to step on this mechanism. This will be hit when the stepping motor is turned on. Imagine that all the microscopic parts of the mechanism have been hit millions of times. . . This will damage all the equipment. So, let me warn you: 3d printer, router, all CNC machines can speed up and slow down. Therefore, the importance of this topic. So today I will talk about acceleration and deceleration to give a very simple example, but soon I will record a video showing how to install CNC machine tools step by step. I know there are basically two types of people who are interested in stepping motors. For example, some people want to know how to program a stepping motor because they want to make a robot or disconnect the machine. Since this is not designed and software is not ready, you need to know these concepts of acceleration, especially to assemble this type of equipment. As a cake recipe, there are still some people who want to be ready and follow the recommended steps. In this case, for example, I can take my classes and follow each stage until a component is finalized. For today\'s assembly, we use the following list of components: ladder-shaped spindle diameter 8mm and 2mm spacing 8mm diameter and 8mm spacing spindle flange nut suitable for 8-12 months spindle bearing 8mm diameter shaft 10mm cylindrical linear guide rail cylindrical roller bearings for 10mm cylinder 10mm guide rail bracket guide month of the Arduino Zhaofeng drive DRV882 May month matrix keyboard display Nokia 5110 various plastic accessories Bolt nut solid wood base external power supply month V infrared SensorsOur is very similar today, arduino Uno video with spindle and stepping motor. What do I need to change? This time I chose Arduino Mega to use the course end switch, which you can see on the right side of the project, because the end of the travel switch is used in the fastest spindle. Each menu is explained in the source code of this program in ATmega. In the demo in the video, we let the engine move 5 cm to show acceleration and deceleration. It then returns 15 centimeters and touches the end of the stroke switch that stops the engine. What is it for? The limit switch is a mechanical element that limits the route by stopping the movement of the engine. They are used for assembly of machines to protect mechanics. In CNC machines, keys are also used as reference points, for example, to zero the coordinates of the axes. There are several types of buttons on the market, including: keys, infrared sensors, capacitive sensors, etc. In our components, we use infrared sensors as shown in the above figure. Here I have a source code on arduino that shows the settings and how to move the stepping motor using the stroke switch and the end of acceleration. Below is the lib stepping motor I made, which is a library that operates 8825, 4988 and TB6600 drivers, allowing you to play larger engines like 16 or 34 in a movie for example. We then configure the drive pins, steps per mm and around, and microspeed. I also configure the throttle movement with maximum and minimum speed and activate the engine power output port. Finally, activate the limit switch pin. Here is an example of engine code. The campaign is the responsibility of the campaign headquarters. Code: in our code, we will operate the motor motion directly and disable the limit switch when it is activated. The steps of the motor are controlled with high and low pulses between time intervals. To make the engine not start directly at maximum speed, we use acceleration. The acceleration changes the pulse time of each step to change the engine speed, gradually increasing to the maximum speed to accelerate until the deceleration is stopped. Acceleration can be achieved in many ways. The code we created illustrates the use of stepping motor acceleration. A simple example of accelerated code. In this code, the pulse time is reduced at each step with the value chosen by the user until half, or until the engine reaches the maximum speed, that is, the shortest pulse time set. At this point, store the amount of pulses the motor performs to reach the maximum speed in that path. This amount will be the same amount that the engine will slow down before the end of the drive. In order to slow down the engine, the pulse time increases with each step until the engine stops.