Go Down

Topic: Detecting "Physical" Resistance from Stepper Motor (Read 3 times) previous topic - next topic

arsene2conde

Hi guys,

I am working on a project and it would be very useful to know how to detect resistance from a stepper motor.  When I say resistance, I mean the resistance the stepper motor experiences during its motion.  For example, in my project I am using the stepper motor to open and close a door.
I want to be able to stop the motion of the stepper motor if there is an obstacle on the way of the door's path when opening or closing.  I would like the stepper motor to stop its motion for a few seconds, then resume its motion.
I am using a 12V, 1.6A Bipolar stepper motor using the SN75441ONE H-Bridge: http://www.robotshop.com/geared-bipolar-stepper-motor-3v-233-oz-in.html?utm_source=google&utm_medium=base&utm_campaign=jos

The code works perfectly but I don't know how I could make what I am looking for happen.  My thought was to use the speed and time to detect any type of resistance.
For example, setting the stepper motor at a certain speed, if the position is not found to be where it is supposed to in the required time, then that would be picked up as a resistance in the motion.  Is there anyway to program something like this with the Arduino or is there a chip to use (maybe something like this? https://www.sparkfun.com/products/8883).  If there is such a code, what would it look like?

Any help will be greatly appreciated.  Thank you!

Here is the code I am using:

#include <Stepper.h>

#define motorSteps 200     

#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define ledPin 13

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2,motorPin3,motorPin4);

void setup() {
  // set the motor speed at 60 RPMS:
  myStepper.setSpeed(30);

  // Initialize the Serial port:
  Serial.begin(9600);

  // set up the LED pin:
  pinMode(ledPin, OUTPUT);
  // blink the LED:
  blink(3);
}

void loop() {
  // Step forward 100 steps:
  Serial.println("Forward");
  myStepper.step(500);
  delay(500);

  // Step backward 100 steps:
  Serial.println("Backward");
  myStepper.step(-500);
  delay(500);

}

// Blink the reset LED:
void blink(int howManyTimes) {
  int i;
  for (i=0; i< howManyTimes; i++) {
    digitalWrite(ledPin, HIGH);
    delay(200);
    digitalWrite(ledPin, LOW);
    delay(200);
  }
}

weldsmith

Have you thought of using an encoder or home made rotary pulser. and compare the drive signal to the feed back signal. This is a bit crude but it would be an easy blockage detector. This sounds like a neat project but there is no one way to do this one. have fun!
David Smith

Boffin1

You could mount the motor with a spring or sponge that will let the motor twist when resistance is felt, the motor hits a microswitch. They used this on garage doors here for years.

BTW  when you post code, select it and hit the # icon up there above the smileys, and it will put it in a code box to save space.
With my mobile phone I can call people and talk to them -  how smart can you get ?

sbright33

You can measure the voltage on the winding of the stepper.  Any winding of 4.  It may only be a few mV different when there is a load, depending on the motor and controller.  You only need a resistor to hook it to A0 on Uno.  Have you seen my code under the Motor section of this forum?  It does exactly what you want. 
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

PeterH

Unless your stepper motor deliberately provides a torque output, I doubt that it will be possible to determine torque just from the stepper drive side. In any case, I would have thought that inertial loads would be high relative to the loads you'd need to detect to stop crushing somebody, and measuring motor torque is not the ideal approach for that. If you really need to go with this then I would think that a sprung switch mechanically connected to the motor so that the torque of the motor operated the switch would be the best way to detect excessive torque.

A light curtain or contact sensor along the leading edge seems like a much better approach, if you can do that.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up