Ping Pong with the AccelStepper library and two limit switches - Polling and interrupts

preview_player
Показать описание
In this video I show you two ways of using 2 limit switches to bounce the stepper motor-moved linear carriage between some arbitrary positions. I show you how to set up everything and I show you and explain both software.

Check this video for wiring and further instructions:

Source code:

If you want to support my work, please consider buying the parts using my affiliate links:
Рекомендации по теме
Комментарии
Автор

I got this working with a different driver (DM542T), the instructions still apply and work the same way. I also really appreciate you showing how to add more functionality in the code towards the end. Like any language you don't fully understand, reading it is much easier than writing it and it helps with my syntax a great deal. I subbed and donated $20, not just for a great video but also how well your documentation is on your website.

jabels
Автор

Solid code, can easily test limit switches before use. You may want to declare variables inside your ISR function as volatile rather than bool but if it works it works!

zachshellouff
Автор

Hallo, Mr. Thanks for you. But i have some problem in my project. Previously I tried on my stepper motor. it went well. and after 3 trials. limit switch not working. and the motor won't go back and forth. may i know what is the cause?.
Thank you Mr.

b_yogiprasetyoatokillah
Автор

The wiring diagram on your other video has no limit switches. Can you tell us where to download the wiring for this system? Thanks

cantaldo
Автор

Is it possible to only use accel stepper library to move back and forth continuosly/repeatedly without the limit switches?

hxi
Автор

Andy Niewiara
I am using Arduino, stepper motor with Tb6600 driver. I need to move the motor ¼ of a turn, delay it and come back to its original position and delay it. So far I find that the motor with same amount of movement steps will not come back to its original position. Please any help will do

andrewniewiara
Автор

Thanks for this video! I used this code to program a Nano that I was using with an Easy Driver to drive a 17HS4401. All I was trying to do was reverse the direction of travel at the limits of a belt driven rail. It worked flawlessly when the circuit was first powered up but within a few minutes the limit switches were bouncing so that the direction was reversed twice and the carriage got stuck. I have both of my switches wired to the NO circuit and have added a pair of 10K-ohm resistors to pull the NO circuits to ground when not being pressed. I have tried changing the motion parameters and removing the pull downs, but nothing seems to be helping. Can you think of anything else I could try? Thanks for all your excellent work!

AllanWallsPhotography
Автор

What portion of code would you use to move a SPDT switch to run the stepper back and forth so that I can store two positions - a start point and an end point before the loop runs

johnossi
Автор

Can this be done with push buttons to simulate the limit switch?
I am going to use proximity sensors instead of limit switch

TheTacticalEngineer
Автор

Hallo, thank you for your very good Videos. Cold you write how it is possible to change the 2. code, that the stepper is going after the use of the interrupts a limited distance. I need to run the stepper after the contakt for 15 cm. Thank You.

samynwaisser
Автор

Hey!
Hello friend, I would like to know if this movement system can be replaced by an a4988 driver ... if that is possible, what modifications should be made?

lopezborisf
Автор

Hello, although the motor changed direction when I pressed the switch with my finger (worked in several tests), it did not do that after I installed the switch to the setup and restarted the program. The LED of the switch circuit board was On once pressed and continued to be On when the platform continued to press against the switch but the motor just did not change direction. Tried a few times already. Have you found a good way to make it works 100% of the time?

petercohen
Автор

I installed the library fine, but unfortunately it did not work, can you help me solve the problem, thank you very much

عاشقاللغةالعربية-قش
Автор

I would like to make use of this code, but only have standard NC limit switches, what changes would i need to make to enable use of these?

Concealed
Автор

Where can we see the limit switch wiring diagram ? On the other video it's mostly for the stepper. Is it supposed to work with standard SPST switch ? I am using two small OMRON V-15G-1C5-K switches and using the code provided it's not always working. Maybe because of the debouncing thingy discussed briefly ? It seems to works better in NC circuit than NO but not always reliable

OMCanam
Автор

How I can adjust code for Speed with potentiometer? Thank u and sorry for my eng

danielikke
Автор

Hi, mate! Please help with the AccelStep library. I am using TB6000 driver. I need the motor stepper to move left and right automatically and there is a limit switch insurance, so that if the motor suddenly goes further, the button will return it in the opposite direction! All codes work like this but not together

a_lhimik
Автор

Hi, first thanks you for your work, and sorry for my english, i'm trying to do this ping pong move with delay before restart to the other direction, it's OK, but now i wolud like to implement acceleration when the moves restart, i know i should use stepper.run() instead of stepper.runSpeed() but after reading accelstepper library, i cannot figure out how do to... Maybe you could show me the way ? To illustrate, i'm making cabble car, so i dont know how many step i have from 1 side to other side, and it car vary (slipering, lenght of cabble, etc...) so i cant use the move() or moveTo() command... i'm lost...

sarljlformatik
Автор

Is it possible to add some other methods to the Accelstepper library, like, for example, a goHome method?

havehalkow
Автор

What is the wiring scheme for the limit switches?

ArjunRG