I am hoping to use my Raspberry Pi 3 in a senior project for my mechancical engineering program. I want to use the pi to drive a vice like fixture to predetermined positions by connecting a stepper motor to the driving screw shaft of the vice. It would have to boot directly into a simple GUI that allows the user to select preset vice positions on a small touchscreen. There are basically three primary obstacles I face.
Designing and booting directly to the GUI - I would like the GUI to have a couple of arrows where the user selects to drive the vice to 1/2 inch, 3/4 inch, 1 inch etc.... Or a series of buttons representing all of the preset size options, pick your button size and hit go. It can't require that the user go through the desktop and start a python script, I would like the pi to be the unseen magic that makes the system work.
Driving the stepper motor by user input - I have seen several tutorials about driving stepper motors with python but nothing involving predetermined rotations from user input. One problem will be that the code will not know the starting position of the vice jaws. This leads to my third challenge.
Vice jaw start routine - My solution to potentially random start positions of the vice jaws is to drive the vice all the way closed before starting the open to X setting routine. My thought is that it could be a timed routine run at low torque so that locking up the motor would not be a problem. Say it takes 4 seconds to close from the widest open setting, just drive the stepper motor "closed" for 4 seconds every time and if the jaws close early it jams the motor. In this case I suppose current may spike, not exactly sure how the motor would act. My second idea would be to drive the jaws closed at the start of the sequence until the PI sees some kind of feedback indicative of a jammed stepper motor then stop the "close jaws" routine and move on. For example, "if current > X amps, stop"
Just looking for some advice / tutorials / direction. I have some coding experience but I am new to PI and stepper motors. Thanks!