0

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.

  1. 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.

  2. 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.

  3. 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!

0

The standard solution to 3) is to use an end stop microswitch. That solves 2).

For 1) boot into the GUI (a raspi-config option if you are using Raspbian) and search for auto-launch application is GUI tutorials.

0

nothing involving predetermined rotations from user input.

Which is what you would expect. The number of steps to do a full rotation depends on your stepper motor. e.g. you can have a 40, 100 or 400 steps motor.
For initial calibration you could use an end switch (as already suggested) or as you said you need to detect a high current. The latter is easy with DC motors but more difficult with stepper motors as they just tend to 'slip' during the step so you would have very short high current spikes.
I might get voted down for this but: If you have enough money the 'gertbot' does a lot of the difficult** work for you and it has build-in high current detection. I have no idea if it would detect a jammed stepper motor though.

**But it may be that your mechanical engineering program is intended for YOU to do all the hard work. Not to use a ready-made solution...

0

An end stop switch or high current detection are nice ways of doing things but people are always a pain. If the user has something in the jaws when turning it on then the jaws can't close fully and your positioning will be out.

As it's an engineering project how about something a little bit more 'out there'? Black and white rotary encoders are a fairly standard way of moving dc motors a know amount, but there a now a few colour sensors which can be interfaced with the pi. You could expand the encoder idea by printing a gradient colour strip or blocks of contrasting and changing colour. This way you can read a colour (or colour boundary with a tiny jiggle) and know where you are in your range of movement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.