Hello guys,
I want to press a button of a subject in different intervals. For that i made a test bench of a stepper motor to press a button. I have attached a picture as well. The button operating force is 1.6N where the motor torque is 420 mN.m. The button travel length is 2mm. When i am applying my code on it, it sometimes pressing the button but most of the time its skipping the step. I am running my motor on Full step. I did check upto 1/32 but it doesnt provide enough force as compare to Full stepping. Have a look at my code, Button link, Motor link, Picture. Any leads would be wonderful.
Thanks and regards.
Motor = https://www.amazon.de/MVPOWER-Schrittmo ... SP0BK2CKK3
Button = https://www.mouser.de/datasheet/2/15/SKRT-1370725.pdf
Code =
I want to press a button of a subject in different intervals. For that i made a test bench of a stepper motor to press a button. I have attached a picture as well. The button operating force is 1.6N where the motor torque is 420 mN.m. The button travel length is 2mm. When i am applying my code on it, it sometimes pressing the button but most of the time its skipping the step. I am running my motor on Full step. I did check upto 1/32 but it doesnt provide enough force as compare to Full stepping. Have a look at my code, Button link, Motor link, Picture. Any leads would be wonderful.
Thanks and regards.
Motor = https://www.amazon.de/MVPOWER-Schrittmo ... SP0BK2CKK3
Button = https://www.mouser.de/datasheet/2/15/SKRT-1370725.pdf
Code =
Code:
from time import sleep
import RPi.GPIO as GPIO
DIR = 2 # Direction GPIO Pin
STEP = 3 # Step GPIO Pin
CW = 1 # Clockwise Rotation
CCW = 0 # Counterclockwise Rotation
SPR = 5 # Steps per Revolution (360 / 1.8)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(DIR, GPIO.OUT)
GPIO.setup(STEP, GPIO.OUT)
GPIO.output(DIR, CW)
MODE = (14, 15, 18) # Microstep Resolution GPIO Pins
GPIO.setup(MODE, GPIO.OUT)
RESOLUTION = {'Full': (0, 0, 0),
'Half': (1, 0, 0),
'1/4': (0, 1, 0),
'1/8': (1, 1, 0),
'1/16': (0, 0, 1),
'1/32': (1, 0, 1)}
GPIO.output(MODE, RESOLUTION['Full'])
step_count = SPR
delay = 0.005
for x in range(step_count):
GPIO.output(DIR, CW)
GPIO.output(STEP, GPIO.HIGH)
sleep(delay)
GPIO.output(STEP, GPIO.LOW)
sleep(delay)
sleep(1)
GPIO.output(DIR, CCW)
for x in range(step_count):
GPIO.output(STEP, GPIO.HIGH)
sleep(delay)
GPIO.output(STEP, GPIO.LOW)
sleep(delay)
GPIO.cleanup()
Attachments
-
112.8 KB Views: 14