This is it! So PUL+, ENA+, and DIR+ all to 5V, type in a "C" to serial monitor to get all the commands. Command example would be "R 2000 1000" Rotate +, 2000 steps? at 1000 speed? Still figuring it out, but I love it!
Why don't you watch the video and read the code? I explain the answer your question at @14:58... The motor will only move once with this code, since it moves on an absolute scale. You might want to use "P" if you want to move let's say 1000 steps, then pause and do something else, then move 1000 steps again.
Nice implementation, I just had one problem with it, I had to remove the default case in the serial switch otherwise it will only move one step regardless of any command I give to move at any direction, regards!
Thanks! That's interesting, I will check it. I uploaded the code as it is presented in the video, so it was working for me with the default case as well.
An excellent demonstration. Most Arduino/Stepper videos on RUclips are very basic and not that useful in practical situations. You give many different applications that can be adapted for practical use. Thank you. How can I find out what functions are available in the AccelStepper library and what parameters they use? I can't figure that out. Thanks again. Regards.
Great video. You are putting up video of projects that are the next thing on my mind. But there is a bit of an issue that I really want to clear up. In the first part of the video, you moved the stepper by 1500 steps or 3 cm. But in reality the stepper moved something like 3.6 or 3.8 cm. Even after taking into account the fact that you used a cardboard to attach the linear bearing to the moving block, this is a significant gap. What extra thing should I do to precisely move 3 cm? I am aiming for an accuracy of 0.01 mm. I am going to build a similar configuration but use TB6560 and also a backlash prevention nut. I am also going to use the same type of lead screw.
Hi and thank you! The lines on the aluminium profile were not perfectly 10 mm apart and also I recorded everything with a tiny action camera, so there is always some distortion. If you use an anti-backlash nut, and you do not overload the lead screw mechanically (which would lead to skipping steps), it will be very precise. If you want more precision, you can use a lead screw with finer threads, for example with 1 mm pitch. The one I use is a 4-start 2 mm pitch lead screw, so one turn results in 8 mm linear displacement of the nut.
Hello sir ,this code is works perfectly to me ...as you said in this video i need a suggestion from u that my Current location of the motor is : 90935 displayed in the serial monitor ....in this circumstances when i get to the home postion it runnning to the home position slowly...while returning back how can i speed up the home position ?? or whether i want to add any line in the code ? for getting speed to the home position sir? If i want to add the code means ...what command line i have to insert sir? kindly reply me sir.....
THANK YOU SO MUCH, THAT IS THE BEST CODE FOR STEPPER MOTORS. Would you please give some advice on how to give the required Torque to the motor? My guess is to make a lookup table. I have an MST342 Stepper and I want to make a closed-loop to damp the vibration on a 100 kg flexible robot. The controller that I have designed calculates the amount of Torque to be given to the motor. also, there is no encoder on the motor.
If you know the value of the constant, then you can just use an external circuit that can measure the current with high enough precision and program the formula so you can calculate the torque. Looks straightforward.
@@CuriousScientist I don’t want to use external circuit, since they are already built and packed. For stepper motors there is a curve between full-step/s and Torque and that’s in the nominal current. In my case that’s 7nm in 1000 fstep/s with nominal 9.5 phase current. I guess there should be some way to program Arduino to adjust the current to give 5 nm in 1000 fstep/s.
I would think that those curves are also a function of load to some extent. Different load would require torque that would also result in different speed, I guess. I am not entirely sure. But if you trust the motor and you say it will have the torque at a certain speed, or the other way around, then it is just simple mathematics. Since you dictate the speed, you can use the value of that variable to calculate the torque.
Great explanation. Here I have to ask two questions. 1) If I want to add one more motor(not in this example ... taking Rough case).How can add 2nd Stepper motor code? and can rotate the each stepper motor independently with some interval? 2) If add sensor then how can give the command line at last?
Thank you! 1) I have several videos with 2 motors, check my channel to see how I implemented their control. They can move independently and simultaneously. 2) In the same way as you would give any other command. I have many explained examples, check them carefully.
@@CuriousScientist not by using Joystick . if I want to add one more motor what changes I have to do accordingly? for example I want to move the 1st motor 90 degrees cw and then 2nd 90 degrees cw with delay 1 st motor come back to 90degrees ccw and then 2nd motor also 90 degrees ccw. how can I add this type of case in code.
The code is still the same, it does not matter what provides the input, whether it is a joystick, a command or some other thing... Also, you just defined an algorithm in your comment, you just need to code it, it is not too difficult.
Are these TB6600 drivers OK for using with the Nema-17 or 23 stepper motors?? I know they are cheap and cheerful but are the good enough if I want to build a CNC Router of my own.. I'm new to all of this kind of electronics guys so I would be very grateful for any helpful hints and tips and if u could recommend any information a out building my own CNC machine I would be ever so grateful to u all.. Thanks for ur time good ppl
IF build own cnc router, some basic rules have, you need first minimum nema 23 3Nm /450 Oz torque motors, then stepper motors drivers etc, DM554 or 556 4 or 6 mean max current for motor, need be drivers more handle current than motor maximum have not burn driver, normal used 3-4Ampere motors, power supply need be if use 3 pcs 4 ampere motors maximum need be 3x4=12 ampere power supply minimum. then need cheap 10-20$ breakoutboard, paraller port or USB port, parallerport better safe board, and parallerport pcie card to computer, 7-14$ and best easy FREE software controller all machine linuxcnc, i use version 8.2.4 worst cnc can build whit arduino and cnc shield but not have millin cnc only draving pen plotter or laser or 3D printer used. windows and USB port can use only mach3 software and not have real time controller and thats mean not have safety. better use factory quality safe controller thats can use only linuxcnc and paraller port controller have true real time controll and safe.
Hi there, great video. I need the exact setup with one difference. Instead of programming the points I need to have two physical buttons. One for CCL and one for clockwise. Can I easily add this to your code somehow.
Hi and thank you! Please check my most recent video, and also look around in the stepper motor related playlist on my RUclips channel and also on my website. You will find ready-made solution for your question with code and wiring published. Just invest a little time and watch my videos and read the descriptions carefully.
Hello, Is there a way to change the serial commands to something else? I have a control program that generates specific serial commands for "Open", "Close", and "Park" Thank you! Great video
Awesome tutorial, after movement or so the motor is hard to turn by hand it appears that it is consuming current and is getting hot, looks like that disable output function is not working in my setup, don't know what could be wrong, my setup is same as yours do we need to use the enable input in the tb6600? second question is can you embed your limit switch in this code ?. cheers
Thanks! Check my more recent videos. I have implemented 2 limit switches and also an option to turn the power on\off via switching the enable pins on the motor drivers.
@@CuriousScientist Hi Sir, could that be the video with ping pong setup, enable pin was not used there. kindly point me to the video/link/title at your leisure if possible. Most of your great tutorials are using your specialized controller, that is great. In my case I just want to use bare minimums with no controller, like a simple turntable/curtain control. Thank you very much and kind regards.
Hi! You need to watch my more recent videos. I built something which can do all those things that you mentioned. This is the video: ruclips.net/video/4Wrt7swXjsQ/видео.html
the disable command does not work. Yours everything was correct but we need to add a pin as digital pin and connect enable negative at it. With this we can disable the holding torque and rotate the shaft with hand while on power mode. Thanks a lot man. I am just very grateful to you. Keep it up.
with enable pin high we can disable and with low command we can enable . no changes in rest of wire connections and code only u need to add this new digital pin (eg-7) and mention in setup and call in loop.
@@CuriousScientist All credits to you sir ❤️ .. i am also working on a stepper based industrial arm can u please help out with the motor that I should use . Because I have done some calculation for stepper kgcm and i will have to use nema 42 -25Nm motor for the base motor so that it can hold atleast 8 kg at a distance of 35 cm .... So please can u make a video in which how to calculate which motor to use using stepper specs.
It will work, yes, this driver can drive it. The wiring diagram is unnecessary because you can see all the connections in the source code, just follow it.
hey! thanks for the video and the code. can you tell me how to change the way to input the steps from serial ide to keypad? i want to run the motor using keypad. and im confuse how to configure it in the code. thanks a lot
If you are controlling the motor you should know when it is running. If it is more or less automated, then you can use the isRunning() function from the accelstepper library to know if the motor is running. The isRunning() function returns a boolean.
You only need it if you want to manually enable/disable the power to the stepper motor driver. In that case, you can pick any GPIO pins. Then you just need to tell the accelstepper library this pin (see setEnablePin() function) and then you use the enableOutputs() and disableOutputs() functions.
Ok tks. I loaded the code for this video, but when the engine stops (With "S") it gets stuck and consumes approximately 0.650a. The stepper.disableOutputs () function; shouldn't I prevent this? The ENA- pin in the photo of this video appears connected to the arduino. In your blog the photo says that it is not to connect this pin (ENA-) or am i mistaken?
For some reason, my reply disappeared. The disableoutputs depend on the board you use. It will not always work. The wire goes into one of the holes in the PCB of the Arduino. I just use it to hold the Arduino in the breadboard. It is not in an electrical connection. If you watch it carefully, you can see that it is just a hole and not an electrical terminal.
HI ! In the code comments you write: "// We only use non-blocking commands, so something else (should also be non-blocking) can be done during the movement of the motor." does the command below block the code ?: Serial2.print ("tm0.en = 0"); // (using arduino Mega and Display Nextion - serial2) Serial2.write (0xff); Serial2.write (0xff); Serial2.write (0xff); I have a stepper motor control project and a timer, based on your code, and when I send this command to the Nextion display , for stop the timer, the motor stops momentarily. Would you help me? tks!
Hi Paulo and thank you for your kindness! ;) Anything that keeps the microcontroller busy is blocking. This can be anything such as reading a sensor, sending data through the terminal, printing values on the LCD...etc. So, I would say that the above code is _blocking_ for sure. The idea behind the non-blocking instructions and stepper motor control is that while there is time between two step pulses, the microcontroller can do something else. The higher the speed of the stepper motor, the smaller the distance (time) between two step pulses. Therefore, you have less time to do something else. The reason why your stepper stops for a little moment is probably because the above set of commands take more time than the time between the two step pulses. Serial.print/write or any serial related command is relatively time consuming, so if your stepper is not "slow enough", you will always experience the little stops. Do you really need to send the "0xff" three times? There, you can cut back some delay. But, to run the motor and the display at the same time, Arduino is not necessarily the best solution. You can use 2 Arduinos. Wire them together. The master takes care of the screen, sensors....etc. The slave just receives the commands from the master and performs the stepping. I already implemented this, but haven't yet made a video about it. Since this can be interesting and useful for many people, I might make a video on the topic soon.
@@CuriousScientist TKS !! I did it as suggested and I'm using an arduino nano only for the engine, the arduino mega controls the display and data for the engine and is working without crashes! My project now has: 1 MEGA arduino (I need 3 serial ports) which is the central (receives and sends data, to the Nextion and to the engine arduino and to the arduino with weight sensors) 2 nano arduinos: - the 1st controlling the motor and connected via serial to the arduino MEGA - the 2nd nano controls 3 weight sensors and sends data via serial port to the mega that sends for Nextion 1 NEXTION display connected to the Mega 1 OLED display connected to the 2nd arduino (shows data from weight sensors. It was a little confusing, but it works without crashes! Tks !!
@@CuriousScientist TKS !! I did it as suggested and I'm using an arduino nano only for the engine, the arduino mega controls the display and data for the engine and is working without crashes! My project now has: 1 MEGA arduino (I need 3 serial ports) which is central (receives and sends data, to the Nextion and to the engine arduino and to the arduino with weight sensors) 2 nano arduinos: the 1st nano controlling the motor and connected via serial to MEGA
the 2nd nano controls 3 weight sensors and sends data via serial port to the mega that sends to Nextion 1 NEXTION display connected to the Mega 1 OLED display connected to the 2nd arduino (shows data from weight sensors. It was a little confusing, but it works without crashes! Tks !!
Nice one, I am extremely happy that you figured this out! I will also share some ideas about this next week. I already have this implemented for years (see my DIY tensile testing machine), but I haven't though about publishing it. Now I can see that this can be interesting for others too. Cheers!
Hi man thanks for your nice tutorial i use and change your code for my DIY slider camera and every thing seems OK . one problem when i use stepper.disableOutputs(); motor immediately stop but when press any button and use stepper.enableOutputs(); motor first finish last command and then start new command i hope that i can explain my situation correctly i use nema 17 - uno - cnc shield ver3 - and a4988 driver
this is my code : #include #include AccelStepper stepper(1, 2, 5); SoftwareSerial Bluetooth(4, 3); const byte enablePin = 8; bool newData, runallowed = false; // booleans for new data from serial, and runallowed flag char receivedCommand; long Set_Speed = 3000; long A_position; long B_position; void setup() { pinMode(enablePin, OUTPUT); digitalWrite(enablePin, HIGH); Bluetooth.begin(9600); Serial.begin(9600); //define baud rate
//setting up some default values for maximum speed and maximum acceleration Serial.println("Default speed: 400 steps/s, default acceleration: 800 steps/s^2."); } void loop() { //Constantly looping through these 2 functions. //We only use non-blocking commands, so something else (should also be non-blocking) can be done during the movement of the motor checkSerial(); //check serial port for new commands RunTheMotor(); //function to handle the motor } void RunTheMotor() //function for the motor { if (runallowed == true) { digitalWrite(enablePin, LOW); //enable pins stepper.run(); //step the motor (this will step the motor by 1 step at each loop) } else //program enters this part if the runallowed is FALSE, we do not do anything { digitalWrite(enablePin, HIGH); //disable outputs return; } } void checkSerial() //function for receiving the commands { if (Bluetooth.available() > 0) //if something comes from the computer { receivedCommand = Bluetooth.read();// pass the value to the receivedCommad variable Serial.println(receivedCommand); newData = true; //indicate that there is a new data by setting this bool to true if (newData == true) //we only enter this long switch-case statement if there is a new command from the computer { switch (receivedCommand) //we check what is the command { case '1': //when press left button slder move left runallowed = true; Serial.println("Slider Move To Left"); //Print the message GoLeft();// Run the function break; case '2': //when release left button stepper.stop();//stop motor digitalWrite(enablePin, HIGH); break; case '3': //when press left button slder move Right runallowed = true; Serial.println("Slider Move To Right"); //Print the message GoRight();// Run the function break; case '4': //when release Right button stepper.stop();//stop motor digitalWrite(enablePin, HIGH); break; case '5': // set current position as A_position .
runallowed = false; //we still keep running disabled Serial.print("Current location of the motor: ");//Print the message Serial.println(stepper.currentPosition()); //Printing the current position in steps. A_position = stepper.currentPosition(); break; case '6': //set current position as B_position . runallowed = false; //we still keep running disabled digitalWrite(enablePin, HIGH); //disable power Serial.print("Current location of the motor: ");//Print the message Serial.println(stepper.currentPosition()); //Printing the current position in steps. B_position = stepper.currentPosition(); break; case '7': //slider mfirst go to A then move to B // // runallowed = true; // Serial.println("Slider Move A To B"); //Print the message // GoA(); // Go To A // digitalWrite(enablePin, LOW); //disable power stepper.setMaxSpeed(5000); //SPEED = Steps / second stepper.setAcceleration(3000); //ACCELERATION = Steps /(second)^2 stepper.moveTo(A_position); while (stepper.currentPosition() != A_position) // Full speed up to 300 stepper.run(); // stepper.stop(); // Stop as fast as possible: sets new target // stepper.runToPosition(); Serial.print("Current location of the motor: ");//Print the message Serial.println(stepper.currentPosition()); //Printing the current position in steps. // Now stopped after quickstop // Now go backwards stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second stepper.setAcceleration(Set_Speed); //ACCELERATION = Steps /(second)^2 stepper.moveTo(B_position); while (stepper.currentPosition() != B_position) // Full speed basck to 0 stepper.run(); // stepper.stop(); // Stop as fast as possible: sets new target // stepper.runToPosition(); Serial.print("Current location of the motor: ");//Print the message Serial.println(stepper.currentPosition()); //Printing the current position in steps. // Now stopped after quickstop break; case '8': //decrease speed runallowed = false; //we still keep running disabled, since we just update a variable digitalWrite(enablePin, HIGH); //disable power Set_Speed = Set_Speed - 290; //receive the acceleration from serial Serial.print("New Speed value: "); //confirm update by message Serial.println(Set_Speed); //confirm update by message break; case '9': //increase speed. runallowed = false; //we still keep running disabled, since we just update a variable digitalWrite(enablePin, HIGH); //disable power Set_Speed = Set_Speed + 290 ;//receive the acceleration from serial Serial.print("New Speed value: "); //confirm update by message Serial.println(Set_Speed); //confirm update by message break; default: runallowed = false; //we still keep running disabled stepper.disableOutputs(); //disable power break; } } //after we went through the above tasks, newData is set to false again, so we are ready to receive new commands again. newData = false; } } void GoLeft() { stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second stepper.setAcceleration(6000); //ACCELERATION = Steps /(second)^2 stepper.moveTo(stepper.currentPosition()+75000); //set abolute distance to move } void GoRight() { stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second stepper.setAcceleration(6000); //ACCELERATION = Steps /(second)^2 stepper.moveTo(stepper.currentPosition()-75000); //set abolute distance to move }
Hi! Sorry, but I won't go through your code, as I do not have time and resources to do these kinds of works for free. However, one part of your sentence struck me and I think I know what is your issue. You said you use the stepper.disableOutputs() to stop the motor. That is not correct! That just disables the outputs but does not stop/finish the instruction. It just "removes the power" from the outputs for the stepper motor. The rest of the command will be suspended and it will be continued once you enable the outputs again, because the motor still haven't reached the target position. The correct way is to use stepper.stop() to stop the motor because this command resets the target position to the position (or very close to that) where the command was given. Also, avoid using Serial.println when running the motor as it will slow down your motor.
@@CuriousScientist Thanks man but when use stepper.stop() then i can't stop motor immediately for example when motor go to end of the rail and press end switch
hey! Thanks a lot for this video! Can you tell me what microsteppin setting you used here? I had problems with normal running of the motor, and a pitchy noise came out of it. I did the wiring with the TB6600 from your other video.
@@CuriousScientist Ok, I didn't. Your code still not working for me, but somehow I reconstruct by myself line-to-line, and i manage to start and stop the stepper. Thank you again for your help!
@@CuriousScientist And I wanna know if the changes of direction (from positive to negative) have to be gradually? Can be implemented some deceleration function , and how? Sorry for spaming.
This was super helpful thank you. I was wondering if there is a way to manipulate it to go the needed amount of steps in a certain amount of time. I have almost an identical setup but I need to go about 7 rotations per second (about 420 RPM). Then change directions and do the same speed and amount steps back to the origin and wait a few seconds until doing it again. Any suggestions?
Sure, it is absolutely possible. And it is done in the same way as you just described. You tell the code to go a certain distance with a certain speed, and then just change the parameters. But 420 RPM is somewhat high, so you'll need acceleration and maybe even a larger motor depending on the load.
i have connected my TBB6600 motor driver pins direction+=3 and pulse+=2 in Arduino using ur code can I run the stepper motor and my lead screw width is 600 mm and 8mm diameter and I am using nema 23
Hi this Version of your code is not working at all. The previous Version ie with the stop switch is working fine . The main differnce i see it that you have used switch case instead of Ifs . I have copied your coded exactly as in the previous versios . So i dont know why its not working . The Commands are printed on the Serial Monitor but the motor does no move at all . the connections are as in the previous versions . IF i download the privious version then it works . so its puzzling . can you please help . many thanks .
@@apdevoocomany1179 I checked the code, and it works after a tiny modification. Another viewer pointed out that the 'default' case should be removed from the switch-case part of the code. So, if you comment out the runallowed = false; and the stepper.disableOutputs(); parts and upload the code, it should work. However, it is puzzling for me to see why it is not working. I basically recorded the two videos simultaneously (the code demonstration and the moving of the stepper motor) and it was working with the presented code. Maybe something changed in the libraries or something. I changed the code in PasteBin too and added some comments there. PS: Do not just copy and paste everything, try to think like the other viewer, Enrique did! He found the error and he fixed it himself.
Thanks for the amazing effort that you put in those videos. How do you calculate the linear velocity of the power screw? Do you multiply the pitch*rpm*pi/180?
Hi and welcome! The linear speed is calculated in the following way: You know that you stepper motor has to do a certain number of steps to rotate the shaft 1 full turn (360°). Usually, this is 200 steps. Supposing that you use a "full step" microstepping, 200 steps of the motor will rotate the shaft of the stepper motor 1 turn. If you for example want to reach 60 RPM, that is 60 turns per minute -> 1 turn per second, so 200 steps/second. Now, we move to the lead screw. The lead screw's most important parameter here is the pitch. If the pitch is 8 mm (usually a 4-start lead screw) it means, that one turn of the shaft will cause 8 mm linear displacement of the nut. So, for example 200 steps will move the nut 8 mm. 200/8 = 25 -> 25 steps will move 1 mm. Now you know the steps to move 1 mm as well as the speed. 25 steps/s on the motor is 1 mm/s on the shaft. So, with full step microstepping, the magic number is 25. Example: you want to move 14.3 mm -> 14.3 mm * 25 steps/mm = 357.5 steps. Similarly, if you need for example 10 mm/s speed, then you need to move 10 mm/s * 25 steps/s = 250 steps/s.
I already answered you under the other video, you don't need to write everywhere. And you should watch the videos and read the descriptions of them since everything is provided in the mentioned places...
For presenting my code, either I use the general Arduino IDE, or sometimes I also use Visual Studio. For developing more complex code, I use Visual Studio with Visualmicro.
Hi. Since you have to ask it, I don't know if _you_ can make it, but it is possible to make it. I have several video examples with the described features.
Check my other stepper motor-related videos, you will find the answer in one of the videos/source codes. Also, if you watch my videos carefully, you will be able to write any kind of code for stepper motors easily.
Help me please 😭 I have a project like this with some differences. If the 0 position was in bottom and by pressing the button once it starts to Go up and down.i forgot explain that there are two micro switch in top and bottom.when object hits every micro switch it will change the direction until i press the button for second time.and by this the object goes to 0 position automatically and finish.🙏 Please tell me how programming it. Thanks a lot 🌹🙏 For more information when I press for second time, the object might be very point of the path.imagine we don't know where is the object.and when we press the button for second time the object goes to homing point or zero point.
In one video u have shown in one video about all the controller DRv and A4988 don't need different coding ...but TB6600 also will work same for that same source code .?
@@CuriousScientist yeah got it thanks.... actually I wanted to feed wire ....with length of 150 mm and cut it..with pneumatic cylinder...how can I synch both...can you suggest
You should keep in mind that stepper motors are for precision operation and not really for high speed operation. Use some DC servo if you need such high speeds.
This is it! So PUL+, ENA+, and DIR+ all to 5V, type in a "C" to serial monitor to get all the commands. Command example would be "R 2000 1000" Rotate +, 2000 steps? at 1000 speed? Still figuring it out, but I love it!
Why don't you watch the video and read the code? I explain the answer your question at @14:58...
The motor will only move once with this code, since it moves on an absolute scale. You might want to use "P" if you want to move let's say 1000 steps, then pause and do something else, then move 1000 steps again.
Nice implementation, I just had one problem with it, I had to remove the default case in the serial switch otherwise it will only move one step regardless of any command I give to move at any direction, regards!
Thanks! That's interesting, I will check it. I uploaded the code as it is presented in the video, so it was working for me with the default case as well.
An excellent demonstration. Most Arduino/Stepper videos on RUclips are very basic and not that useful in practical situations. You give many different applications that can be adapted for practical use. Thank you.
How can I find out what functions are available in the AccelStepper library and what parameters they use? I can't figure that out. Thanks again. Regards.
Hi and thanks. Just Google accelstepper library. It is very well documented.
Just what I want to do!!! Thanks a lot great job
Thanks! I am glad you found what you were looking for!
Creative video, well done, thanks for sharing it :)
Thank you!
Great video. You are putting up video of projects that are the next thing on my mind. But there is a bit of an issue that I
really want to clear up. In the first part of the video, you moved the stepper by 1500 steps or 3 cm. But in reality the stepper moved something like 3.6 or 3.8 cm. Even after taking into account the fact that you used a cardboard to attach the linear bearing to the moving block, this is a significant gap. What extra thing should I do to precisely move 3 cm? I am aiming for an accuracy of 0.01 mm. I am going to build a similar configuration but use TB6560 and also a backlash prevention nut. I am also going to use the same type of lead screw.
Hi and thank you! The lines on the aluminium profile were not perfectly 10 mm apart and also I recorded everything with a tiny action camera, so there is always some distortion. If you use an anti-backlash nut, and you do not overload the lead screw mechanically (which would lead to skipping steps), it will be very precise. If you want more precision, you can use a lead screw with finer threads, for example with 1 mm pitch. The one I use is a 4-start 2 mm pitch lead screw, so one turn results in 8 mm linear displacement of the nut.
Hello sir ,this code is works perfectly to me ...as you said in this video i need a suggestion from u that
my Current location of the motor is : 90935 displayed in the serial monitor ....in this circumstances when i get to the home postion it runnning to the home position slowly...while returning back how can i speed up the home position ?? or
whether i want to add any line in the code ? for getting speed to the home position sir?
If i want to add the code means ...what command line i have to insert sir?
kindly reply me sir.....
Hi! Change the speed with the setSpeed() command to the preferred speed value.
THANK YOU SO MUCH, THAT IS THE BEST CODE FOR STEPPER MOTORS. Would you please give some advice on how to give the required Torque to the motor? My guess is to make a lookup table. I have an MST342 Stepper and I want to make a closed-loop to damp the vibration on a 100 kg flexible robot. The controller that I have designed calculates the amount of Torque to be given to the motor. also, there is no encoder on the motor.
Thanks! You need to be able to measure the torque somehow to be able to control it.
@@CuriousScientist Can Arduino measure the torque by the current, since in DC motors T=c*I and c is a constant?
If you know the value of the constant, then you can just use an external circuit that can measure the current with high enough precision and program the formula so you can calculate the torque. Looks straightforward.
@@CuriousScientist I don’t want to use external circuit, since they are already built and packed. For stepper motors there is a curve between full-step/s and Torque and that’s in the nominal current. In my case that’s 7nm in 1000 fstep/s with nominal 9.5 phase current. I guess there should be some way to program Arduino to adjust the current to give 5 nm in 1000 fstep/s.
I would think that those curves are also a function of load to some extent. Different load would require torque that would also result in different speed, I guess. I am not entirely sure. But if you trust the motor and you say it will have the torque at a certain speed, or the other way around, then it is just simple mathematics. Since you dictate the speed, you can use the value of that variable to calculate the torque.
Nice video!
Thank you! Don't forget to subscribe!
Great explanation. Here I have to ask two questions.
1) If I want to add one more motor(not in this example ... taking Rough case).How can add 2nd Stepper motor code? and can rotate the each stepper motor independently with some interval?
2) If add sensor then how can give the command line at last?
Thank you!
1) I have several videos with 2 motors, check my channel to see how I implemented their control. They can move independently and simultaneously.
2) In the same way as you would give any other command. I have many explained examples, check them carefully.
@@CuriousScientist not by using Joystick .
if I want to add one more motor what changes I have to do accordingly? for example I want to move the 1st motor 90 degrees cw and then 2nd 90 degrees cw with delay 1 st motor come back to 90degrees ccw and then 2nd motor also 90 degrees ccw. how can I add this type of case in code.
The code is still the same, it does not matter what provides the input, whether it is a joystick, a command or some other thing... Also, you just defined an algorithm in your comment, you just need to code it, it is not too difficult.
works perfect. Instant perfect code, so I could skip hours of programming and go straight to test the mechanics :-) thanks mate. You are amazing
Hi! Glad to hear that it works!
Are these TB6600 drivers OK for using with the Nema-17 or 23 stepper motors?? I know they are cheap and cheerful but are the good enough if I want to build a CNC Router of my own..
I'm new to all of this kind of electronics guys so I would be very grateful for any helpful hints and tips and if u could recommend any information a out building my own CNC machine I would be ever so grateful to u all.. Thanks for ur time good ppl
Hi! They are good enough for hobby purposes. I haven't gotten any issues with them so far.
IF build own cnc router, some basic rules have, you need first minimum nema 23 3Nm /450 Oz torque motors, then stepper motors drivers etc, DM554 or 556 4 or 6 mean max current for motor, need be drivers more handle current than motor maximum have not burn driver, normal used 3-4Ampere motors, power supply need be if use 3 pcs 4 ampere motors maximum need be 3x4=12 ampere power supply minimum. then need cheap 10-20$ breakoutboard, paraller port or USB port, parallerport better safe board, and parallerport pcie card to computer, 7-14$ and best easy FREE software controller all machine linuxcnc, i use version 8.2.4 worst cnc can build whit arduino and cnc shield but not have millin cnc only draving pen plotter or laser or 3D printer used. windows and USB port can use only mach3 software and not have real time controller and thats mean not have safety. better use factory quality safe controller thats can use only linuxcnc and paraller port controller have true real time controll and safe.
Hi there, great video. I need the exact setup with one difference. Instead of programming the points I need to have two physical buttons. One for CCL and one for clockwise. Can I easily add this to your code somehow.
Hi and thank you! Please check my most recent video, and also look around in the stepper motor related playlist on my RUclips channel and also on my website. You will find ready-made solution for your question with code and wiring published. Just invest a little time and watch my videos and read the descriptions carefully.
Hello,
Is there a way to change the serial commands to something else? I have a control program that generates specific serial commands for "Open", "Close", and "Park"
Thank you! Great video
Hi! Thanks! Sure, it can be anything as long as you can parse it on the Arduino.
Awesome tutorial, after movement or so the motor is hard to turn by hand it appears that it is consuming current and is getting hot, looks like that disable output function is not working in my setup, don't know what could be wrong, my setup is same as yours do we need to use the enable input in the tb6600? second question is can you embed your limit switch in this code ?. cheers
Thanks! Check my more recent videos. I have implemented 2 limit switches and also an option to turn the power on\off via switching the enable pins on the motor drivers.
@@CuriousScientist That is great, thanks for the feedback
@@CuriousScientist Hi Sir, could that be the video with ping pong setup, enable pin was not used there. kindly point me to the video/link/title at your leisure if possible. Most of your great tutorials are using your specialized controller, that is great. In my case I just want to use bare minimums with no controller, like a simple turntable/curtain control. Thank you very much and kind regards.
You can always modify my code to your own needs. My special controller has 2 different ping-pong implemented.
@@CuriousScientist Thank you so much... cheers
Hi ! can you plz explain how did u define Home position on the screw and in the code as well?
Hi! It is explained in the video...
Thanks mate
It is my pleasure!
I would like to control the motor with push buttons and a speed regulator and not have to depend on a notebook, what would I have to do?
Hi! You need to watch my more recent videos. I built something which can do all those things that you mentioned.
This is the video: ruclips.net/video/4Wrt7swXjsQ/видео.html
i has build many push button system, etc, motoriced vise, angle grinder cutting machine, grinder run front/back to rail and cut sheet.
the disable command does not work. Yours everything was correct but we need to add a pin as digital pin and connect enable negative at it. With this we can disable the holding torque and rotate the shaft with hand while on power mode. Thanks a lot man. I am just very grateful to you. Keep it up.
with enable pin high we can disable and with low command we can enable . no changes in rest of wire connections and code only u need to add this new digital pin (eg-7) and mention in setup and call in loop.
Thanks for the feedback. Seems like I forgot to add this part to the code. But I am glad that you've figured it out!
@@CuriousScientist All credits to you sir ❤️ .. i am also working on a stepper based industrial arm can u please help out with the motor that I should use . Because I have done some calculation for stepper kgcm and i will have to use nema 42 -25Nm motor for the base motor so that it can hold atleast 8 kg at a distance of 35 cm .... So please can u make a video in which how to calculate which motor to use using stepper specs.
Sorry, but I don't make videos on request for free. You can always read the datasheet of the motors where they show the torque vs speed chart.
@@CuriousScientist No issue sir and thank you
Will this work for a nema 23 as well? Also, is there a wiring diagram available? Thank you. I really appreciate your information.
It will work, yes, this driver can drive it. The wiring diagram is unnecessary because you can see all the connections in the source code, just follow it.
hey! thanks for the video and the code. can you tell me how to change the way to input the steps from serial ide to keypad?
i want to run the motor using keypad. and im confuse how to configure it in the code. thanks a lot
Hi! You just need to replace the commands received from the serial with the commands received from the keypad.
Can you explain how can we check the running status of motor while using serial ?
If you are controlling the motor you should know when it is running. If it is more or less automated, then you can use the isRunning() function from the accelstepper library to know if the motor is running. The isRunning() function returns a boolean.
where do i put the tb6600 ENA+ pin to arduino pin?
can you give us the wiring pls?
You only need it if you want to manually enable/disable the power to the stepper motor driver. In that case, you can pick any GPIO pins. Then you just need to tell the accelstepper library this pin (see setEnablePin() function) and then you use the enableOutputs() and disableOutputs() functions.
Ok tks.
I loaded the code for this video, but when the engine stops (With "S") it gets stuck and consumes approximately 0.650a.
The stepper.disableOutputs () function; shouldn't I prevent this?
The ENA- pin in the photo of this video appears connected to the arduino.
In your blog the photo says that it is not to connect this pin (ENA-)
or am i mistaken?
For some reason, my reply disappeared. The disableoutputs depend on the board you use. It will not always work. The wire goes into one of the holes in the PCB of the Arduino. I just use it to hold the Arduino in the breadboard. It is not in an electrical connection. If you watch it carefully, you can see that it is just a hole and not an electrical terminal.
SOund is coming from the motor inside but the shaft is not moving?
Sometimes, depending on the setup the motor gives a buzzing/humming sound when the coils are powered. It is "normal", or at least, not unusual.
thank you for your video its posibel with pinball moving with wout serial , i mean just give the speed and distance
Look around on my channel, there are plenty of stepper motor related videos.
@@CuriousScientist thank you for your answer , myporbelm in i should know the RPM of motor i have range 80-200
@@aliumara1205 What do you mean by "you should know"? You are the one who determines the RPM.
@@CuriousScientist how can i determine this RPM ?
You can calculate it from the speed of the stepping and the number of steps required to achieve a full rotation on the shaft of the stepper motor.
HI !
In the code comments you write:
"// We only use non-blocking commands, so something else (should also be non-blocking) can be done during the movement of the motor."
does the command below block the code ?:
Serial2.print ("tm0.en = 0"); // (using arduino Mega and Display Nextion - serial2)
Serial2.write (0xff);
Serial2.write (0xff);
Serial2.write (0xff);
I have a stepper motor control project and a timer, based on your code, and when I send this command to the Nextion display , for stop the timer, the motor stops momentarily.
Would you help me?
tks!
Hi Paulo and thank you for your kindness! ;)
Anything that keeps the microcontroller busy is blocking. This can be anything such as reading a sensor, sending data through the terminal, printing values on the LCD...etc. So, I would say that the above code is _blocking_ for sure. The idea behind the non-blocking instructions and stepper motor control is that while there is time between two step pulses, the microcontroller can do something else. The higher the speed of the stepper motor, the smaller the distance (time) between two step pulses. Therefore, you have less time to do something else. The reason why your stepper stops for a little moment is probably because the above set of commands take more time than the time between the two step pulses. Serial.print/write or any serial related command is relatively time consuming, so if your stepper is not "slow enough", you will always experience the little stops. Do you really need to send the "0xff" three times? There, you can cut back some delay. But, to run the motor and the display at the same time, Arduino is not necessarily the best solution. You can use 2 Arduinos. Wire them together. The master takes care of the screen, sensors....etc. The slave just receives the commands from the master and performs the stepping. I already implemented this, but haven't yet made a video about it. Since this can be interesting and useful for many people, I might make a video on the topic soon.
@@CuriousScientist tks for return
!!
tks for return
I will study and try this possibility of 2 microcontrollers..
@@CuriousScientist TKS !!
I did it as suggested and I'm using an arduino nano only for the engine, the arduino mega controls the display and data for the engine and is working without crashes!
My project now has:
1 MEGA arduino (I need 3 serial ports)
which is the central (receives and sends data, to the Nextion and to the engine arduino
and to the arduino with weight sensors)
2 nano arduinos:
- the 1st controlling the motor and connected via serial to the
arduino MEGA
- the 2nd nano controls 3 weight sensors and sends
data via serial port to the mega that sends
for Nextion
1 NEXTION display connected to the Mega
1 OLED display connected to the 2nd arduino (shows data from weight sensors.
It was a little confusing, but it works without crashes!
Tks !!
@@CuriousScientist TKS !!
I did it as suggested and I'm using an arduino nano only for the engine, the arduino mega controls the display and data for the engine and is working without crashes!
My project now has:
1 MEGA arduino (I need 3 serial ports)
which is central (receives and sends data, to the Nextion and to the engine arduino and to the arduino with weight sensors)
2 nano arduinos:
the 1st nano controlling the motor and connected via serial to
MEGA
the 2nd nano controls 3 weight sensors and sends data via serial port to the mega that sends to Nextion
1 NEXTION display connected to the Mega
1 OLED display connected to the 2nd arduino (shows data from weight sensors.
It was a little confusing, but it works without crashes!
Tks !!
Nice one, I am extremely happy that you figured this out! I will also share some ideas about this next week. I already have this implemented for years (see my DIY tensile testing machine), but I haven't though about publishing it. Now I can see that this can be interesting for others too. Cheers!
Hi man thanks for your nice tutorial i use and change your code for my DIY slider camera and every thing seems OK . one problem when i use stepper.disableOutputs(); motor immediately stop but when press any button and use stepper.enableOutputs(); motor first finish last command and then start new command i hope that i can explain my situation correctly
i use nema 17 - uno - cnc shield ver3 - and a4988 driver
this is my code :
#include
#include
AccelStepper stepper(1, 2, 5);
SoftwareSerial Bluetooth(4, 3);
const byte enablePin = 8;
bool newData, runallowed = false; // booleans for new data from serial, and runallowed flag
char receivedCommand;
long Set_Speed = 3000;
long A_position;
long B_position;
void setup()
{
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, HIGH);
Bluetooth.begin(9600);
Serial.begin(9600); //define baud rate
//setting up some default values for maximum speed and maximum acceleration
Serial.println("Default speed: 400 steps/s, default acceleration: 800 steps/s^2.");
}
void loop()
{
//Constantly looping through these 2 functions.
//We only use non-blocking commands, so something else (should also be non-blocking) can be done during the movement of the motor
checkSerial(); //check serial port for new commands
RunTheMotor(); //function to handle the motor
}
void RunTheMotor() //function for the motor
{
if (runallowed == true)
{
digitalWrite(enablePin, LOW); //enable pins
stepper.run(); //step the motor (this will step the motor by 1 step at each loop)
}
else //program enters this part if the runallowed is FALSE, we do not do anything
{
digitalWrite(enablePin, HIGH); //disable outputs
return;
}
}
void checkSerial() //function for receiving the commands
{
if (Bluetooth.available() > 0) //if something comes from the computer
{
receivedCommand = Bluetooth.read();// pass the value to the receivedCommad variable
Serial.println(receivedCommand);
newData = true; //indicate that there is a new data by setting this bool to true
if (newData == true) //we only enter this long switch-case statement if there is a new command from the computer
{
switch (receivedCommand) //we check what is the command
{
case '1': //when press left button slder move left
runallowed = true;
Serial.println("Slider Move To Left"); //Print the message
GoLeft();// Run the function
break;
case '2': //when release left button
stepper.stop();//stop motor
digitalWrite(enablePin, HIGH);
break;
case '3': //when press left button slder move Right
runallowed = true;
Serial.println("Slider Move To Right"); //Print the message
GoRight();// Run the function
break;
case '4': //when release Right button
stepper.stop();//stop motor
digitalWrite(enablePin, HIGH);
break;
case '5': // set current position as A_position .
runallowed = false; //we still keep running disabled
Serial.print("Current location of the motor: ");//Print the message
Serial.println(stepper.currentPosition()); //Printing the current position in steps.
A_position = stepper.currentPosition();
break;
case '6': //set current position as B_position .
runallowed = false; //we still keep running disabled
digitalWrite(enablePin, HIGH); //disable power
Serial.print("Current location of the motor: ");//Print the message
Serial.println(stepper.currentPosition()); //Printing the current position in steps.
B_position = stepper.currentPosition();
break;
case '7': //slider mfirst go to A then move to B
//
// runallowed = true;
// Serial.println("Slider Move A To B"); //Print the message
// GoA(); // Go To A
//
digitalWrite(enablePin, LOW); //disable power
stepper.setMaxSpeed(5000); //SPEED = Steps / second
stepper.setAcceleration(3000); //ACCELERATION = Steps /(second)^2
stepper.moveTo(A_position);
while (stepper.currentPosition() != A_position) // Full speed up to 300
stepper.run();
// stepper.stop(); // Stop as fast as possible: sets new target
// stepper.runToPosition();
Serial.print("Current location of the motor: ");//Print the message
Serial.println(stepper.currentPosition()); //Printing the current position in steps.
// Now stopped after quickstop
// Now go backwards
stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second
stepper.setAcceleration(Set_Speed); //ACCELERATION = Steps /(second)^2
stepper.moveTo(B_position);
while (stepper.currentPosition() != B_position) // Full speed basck to 0
stepper.run();
// stepper.stop(); // Stop as fast as possible: sets new target
// stepper.runToPosition();
Serial.print("Current location of the motor: ");//Print the message
Serial.println(stepper.currentPosition()); //Printing the current position in steps.
// Now stopped after quickstop
break;
case '8': //decrease speed
runallowed = false; //we still keep running disabled, since we just update a variable
digitalWrite(enablePin, HIGH); //disable power
Set_Speed = Set_Speed - 290; //receive the acceleration from serial
Serial.print("New Speed value: "); //confirm update by message
Serial.println(Set_Speed); //confirm update by message
break;
case '9': //increase speed.
runallowed = false; //we still keep running disabled, since we just update a variable
digitalWrite(enablePin, HIGH); //disable power
Set_Speed = Set_Speed + 290 ;//receive the acceleration from serial
Serial.print("New Speed value: "); //confirm update by message
Serial.println(Set_Speed); //confirm update by message
break;
default:
runallowed = false; //we still keep running disabled
stepper.disableOutputs(); //disable power
break;
}
}
//after we went through the above tasks, newData is set to false again, so we are ready to receive new commands again.
newData = false;
}
}
void GoLeft()
{
stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second
stepper.setAcceleration(6000); //ACCELERATION = Steps /(second)^2
stepper.moveTo(stepper.currentPosition()+75000); //set abolute distance to move
}
void GoRight()
{
stepper.setMaxSpeed(Set_Speed); //SPEED = Steps / second
stepper.setAcceleration(6000); //ACCELERATION = Steps /(second)^2
stepper.moveTo(stepper.currentPosition()-75000); //set abolute distance to move
}
Hi! Sorry, but I won't go through your code, as I do not have time and resources to do these kinds of works for free. However, one part of your sentence struck me and I think I know what is your issue. You said you use the stepper.disableOutputs() to stop the motor. That is not correct! That just disables the outputs but does not stop/finish the instruction. It just "removes the power" from the outputs for the stepper motor. The rest of the command will be suspended and it will be continued once you enable the outputs again, because the motor still haven't reached the target position. The correct way is to use stepper.stop() to stop the motor because this command resets the target position to the position (or very close to that) where the command was given.
Also, avoid using Serial.println when running the motor as it will slow down your motor.
@@CuriousScientist Thanks man
but when use stepper.stop() then i can't stop motor immediately for example when motor go to end of the rail and press end switch
I don't really understand what you mean. The stepper.stop() should stop almost immediately.
@@omidsharifi974 Try to find some where to your code then reset the position to zero.
hey! Thanks a lot for this video! Can you tell me what microsteppin setting you used here?
I had problems with normal running of the motor, and a pitchy noise came out of it. I did the wiring with the TB6600 from your other video.
Hi! I always use 400. Cheers!
Should I have the ENA- pin connected to arduino? But where?
@@sinumihai7495 Nowhere, do not even touch that terminal. ENA(-) is not connected, don't put any wires into that terminal.
@@CuriousScientist Ok, I didn't. Your code still not working for me, but somehow I reconstruct by myself line-to-line, and i manage to start and stop the stepper. Thank you again for your help!
@@CuriousScientist And I wanna know if the changes of direction (from positive to negative) have to be gradually? Can be implemented some deceleration function , and how? Sorry for spaming.
Sir is it vibrant when move .
You may use too weak power supply or want to run at a too high speed or acceleration.
This was super helpful thank you. I was wondering if there is a way to manipulate it to go the needed amount of steps in a certain amount of time. I have almost an identical setup but I need to go about 7 rotations per second (about 420 RPM). Then change directions and do the same speed and amount steps back to the origin and wait a few seconds until doing it again. Any suggestions?
Sure, it is absolutely possible. And it is done in the same way as you just described. You tell the code to go a certain distance with a certain speed, and then just change the parameters. But 420 RPM is somewhat high, so you'll need acceleration and maybe even a larger motor depending on the load.
which interface are you using, I am not getting any window for writting comment in IDE
Visual Studio with VisualMicro.
i have connected my TBB6600 motor driver pins direction+=3 and pulse+=2 in Arduino using ur code can I run the stepper motor and my lead screw width is 600 mm and 8mm diameter and I am using nema 23
Just follow the exact instructions which I tell in the video. The driver should work with the motor you mentioned.
Hi this Version of your code is not working at all. The previous Version ie with the stop switch is working fine .
The main differnce i see it that you have used switch case instead of Ifs . I have copied your coded exactly as in the previous versios . So i dont know why its not working . The Commands are printed on the Serial Monitor but the motor does no move at all . the connections are as in the previous versions . IF i download the privious version then it works . so its puzzling . can you please help . many thanks .
Hi! I will check it this weekend and come back with an answer. Cheers!
Many Thanks look forward it .
@@apdevoocomany1179 I checked the code, and it works after a tiny modification. Another viewer pointed out that the 'default' case should be removed from the switch-case part of the code. So, if you comment out the runallowed = false; and the stepper.disableOutputs(); parts and upload the code, it should work.
However, it is puzzling for me to see why it is not working. I basically recorded the two videos simultaneously (the code demonstration and the moving of the stepper motor) and it was working with the presented code. Maybe something changed in the libraries or something. I changed the code in PasteBin too and added some comments there.
PS: Do not just copy and paste everything, try to think like the other viewer, Enrique did! He found the error and he fixed it himself.
Thanks for the amazing effort that you put in those videos. How do you calculate the linear velocity of the power screw? Do you multiply the pitch*rpm*pi/180?
Hi and welcome!
The linear speed is calculated in the following way:
You know that you stepper motor has to do a certain number of steps to rotate the shaft 1 full turn (360°). Usually, this is 200 steps. Supposing that you use a "full step" microstepping, 200 steps of the motor will rotate the shaft of the stepper motor 1 turn. If you for example want to reach 60 RPM, that is 60 turns per minute -> 1 turn per second, so 200 steps/second.
Now, we move to the lead screw. The lead screw's most important parameter here is the pitch. If the pitch is 8 mm (usually a 4-start lead screw) it means, that one turn of the shaft will cause 8 mm linear displacement of the nut. So, for example 200 steps will move the nut 8 mm. 200/8 = 25 -> 25 steps will move 1 mm. Now you know the steps to move 1 mm as well as the speed. 25 steps/s on the motor is 1 mm/s on the shaft. So, with full step microstepping, the magic number is 25.
Example: you want to move 14.3 mm -> 14.3 mm * 25 steps/mm = 357.5 steps. Similarly, if you need for example 10 mm/s speed, then you need to move 10 mm/s * 25 steps/s = 250 steps/s.
hi i want to run a nema 23 with tb6600 and flysky rc controller can you give some idea for tis and also code thank-you.
I already answered you under the other video, you don't need to write everywhere. And you should watch the videos and read the descriptions of them since everything is provided in the mentioned places...
What was the approximate total cost for the project?
You can easily estimate it yourself because I published all the parts I used. Sorry, but I don't have the time to summarize it.
stepper motor 5-50$ ,driver 8-14$ ,power supply 10-30$ ,arduino 3-12$ ,hardware what need build. screws,linear rails,bearings, etc.
How to run nema17 stepper motor with increasing speed
By accelerating it.
bro did u use arduino 1.8 software for code
For presenting my code, either I use the general Arduino IDE, or sometimes I also use Visual Studio. For developing more complex code, I use Visual Studio with Visualmicro.
Hello please answer me
I am planning to make
Stepper Motor + stop Switch + speed controller
Can I make it in one circuit ???
🥲🥲🥲🥲🥲
Hi. Since you have to ask it, I don't know if _you_ can make it, but it is possible to make it. I have several video examples with the described features.
how to configure the motor to run continuously in one direction and stop only at the "S" command?
Check my other stepper motor-related videos, you will find the answer in one of the videos/source codes. Also, if you watch my videos carefully, you will be able to write any kind of code for stepper motors easily.
can you please give the circuit for pinout from tb6600 to arduino uno
It is available in many of my videos and blog articles. Please look at my website.
@@CuriousScientist thanks for the instant reply . Love from india
You're welcome!
have you code for three motors? this is only for one
You can easily expand it to three based on my other examples.
@@CuriousScientist where is your other examples can you share link hear
I have a whole playlist of stepper motor related videos on my channel.
Help me please 😭
I have a project like this with some differences.
If the 0 position was in bottom and by pressing the button once it starts to Go up and down.i forgot explain that there are two micro switch in top and bottom.when object hits every micro switch it will change the direction until i press the button for second time.and by this the object goes to 0 position automatically and finish.🙏
Please tell me how programming it.
Thanks a lot 🌹🙏
For more information when I press for second time, the object might be very point of the path.imagine we don't know where is the object.and when we press the button for second time the object goes to homing point or zero point.
Hi! Watch my other, more recent tutorials, I talk a lot about limit switches and their usage in different cases.
Thanks 🥴🙏🌹
Unfortunately I can't find it.
It's very important for me to make it
Please help me.thank you very much 🙏🙏🙏
Sorry, but I won't write a code for you for free. I am not a support service.
Ok my friend.there were many videos in your RUclips for free and why now you don't do it?😜however i will pay you🙏.how does it cost?
Hi, I am an electronic engineering college student living in Korea, and Arduino has a problem with slowing down, so can you check the code?
Hi! What do you mean?
@@CuriousScientist We're having a hard time writing Arduino codes that accelerate each using five motors. Can you take a look at our codes?
Sorry, but I am not a free support service. I can't just troubleshoot other people's issues for free.
Can you please share the IDE name ?
Hi! It is Microsoft Visual Studio with the Visual Micro extension.
Jow can I contact you I am from Canada I need your help how
You just contacted me by writing comment. :)
Motorcycle sttepper nema?
A what? I used a NEMA17.
How to add buttons with these L and all functions pls tell that..as well..
Check my RUclips channel more carefully...as well.
@@CuriousScientist ok..
In one video u have shown in one video about all the controller DRv and A4988 don't need different coding ...but TB6600 also will work same for that same source code .?
Why don't you watch my videos? The answer is already there in my videos.
ruclips.net/video/_enXxcBTOdM/видео.html
@@CuriousScientist yeah got it thanks.... actually I wanted to feed wire ....with length of 150 mm and cut it..with pneumatic cylinder...how can I synch both...can you suggest
can increase the speed 4000rpm?
No. The max RPM value of a NEMA 17 is around 1800 RPM.
@@CuriousScientist thnx sir coz i try many times to change the code but cannot do any change
You should keep in mind that stepper motors are for precision operation and not really for high speed operation. Use some DC servo if you need such high speeds.
No that is not a good library it is not giving you accurate positions it is overshooting by alot.
Are you sure it's not your system? I haven't noticed any positioning issues with the library yet.