04-13-2022 03:56 PM
Hi,
Below I attached the code I wrote to check whether the limit switch works properly or not. Now I am struggling to integrate this to the stepper motor. My goal is to stop the stepper motor and switch direction when it touches the limit switch. There will be 2 limit switches on the x-axis. The bigger goal of this project is to automate a microscope stage movement with the limit switches but right I am stuck.
Thank you,
Ashiful
04-13-2022 08:25 PM
@Ash4321 wrote:
Hi,
Below I attached the code I wrote to check whether the limit switch works properly or not.
Sooo... does it work or not?
Since we cannot see your stepper motor code where you want to integrate this, it is impossible to make any suggestions at all. What kind of architecture are you using?
04-14-2022 12:49 AM
I'm assuming it doesn't, because he reads the switch value inside the loop and only changes motor value once he manually exits the loop.
04-14-2022 09:20 AM
Also you should not rely totally on software, your limit switches should simultaneously disable the stepper motor and signal your program the limit was reached.
04-18-2022 03:47 PM
There were signals and the limit switch worked but I need help integrating it to the motor.
04-19-2022 12:48 PM
How do you expect anyone to help integrating this into your motor code if you don't even show us that?
04-20-2022 03:45 PM
Sorry, I should've attached my motor code. Here I attached it below.
04-20-2022 04:21 PM
I also need help with one more thing. I am using the motor to automate a microscope stage moving on the x-direction. I needed to start the stage at a certain location and control the speed. I was wondering how to go about that. I know we can control the speed using duty cycle and start the motor at that chosen speed. But how would choose the location where the motor would start.
Thank you,
Ash
04-21-2022 01:13 AM
Well if you need certain location during your motor's travel, then you need sensors.
What kind of sensors depends on your application, if you only have one location you are worried about you could use limit switch at that location.
Really you are being very vague with your information here and it's been hard to help you...
04-21-2022 08:27 AM
Ideally, I would want to start the microscope stage from the furthest left and move it using the motor to the right. Then, when it hits the limitswitch it would change direction to the left until hitting the left limitswitch and continue on. This way the image can be captured for the longest time. I hope this makes sense and if you need anything else I will try my best to provide.
Thank you