Notifications
Clear all

AccelStepper Code for finding 'home'

2 Posts
2 Users
0 Likes
76 Views
(@sswcharlie)
Member
Joined: 4 years ago
Posts: 7
Topic starter  

Hi

Is there a code for Nano ULN2003, in the setup, for returning motor position to home or zero, using a micro switch.

Thanks

Charles


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6972
 

Posted by: @sswcharlie

Hi

Is there a code for Nano ULN2003, in the setup, for returning motor position to home or zero, using a micro switch.

Thanks

Charles

There is no 'home' function that I can see in the library.

If home is defined as an arbitrary position of the motor where a micro switch is positioned, then a function you can create called as an example 'moveToHome' just needs to rotate the motor slowly while waiting to sense the micro-switch closing. Of course you will need to physically attach some sort of a micro-switch actuator to allow this to work.

CAUTION: This is a fairly imprecise method if the 'home' position needs to be within a specific angle of the total rotation.

Other sensors are possible that may or may not be more precise but the code is 99% the same.

If you can guarantee no 'slippage', then returning to 'home' is just a matter of counting pulses where 'home' is when the count is zero.

You may want to combine a micro-switch with a count. 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote