# Stepper Motor Direction via Flow Amps

I have a problem with stepper motor direction.

I want to change the direction of the stepper motor rotation, when the stepper motor shaft is stuck.

For example, when I hold the shaft of the stepper motor with my hand, the direction should change.

How can I do it? Someone told me you should calculate the current, but I don't know how to do this?

My material components:

• Arduino
• stepper motor gearbox 12 V
• ULN 2003A
• When motors stuck their current draw increases, you can sense that increase in the current (with any current sense method you see fit) and then change the rotation of the motor. – ElectronSurf Oct 18 '19 at 10:14
• I now this discuss but I dont now how can I do it I have no idea circuit or cod for it can you help me more ? i need it – Rayan_skofw Oct 18 '19 at 10:22
• in Face if you have seen the air conditioner splite Opereting system stepper motor it rotats the some way for 360 Degree but when shaft stuck the direction change I want do this – Rayan_skofw Oct 18 '19 at 10:27
• If you haven't any knowledge about electronics I'm afraid you will fail in that project. You first had to learn what current is, how current is measured ( over a shunt or by heating a wire or whatever). You possibly must compute a mean value. You had to learn how to use the right ground potential and so on. And there are issues with the current that is drawn by the stepper before each step to overcome the inertia of the rotor. But if you're only supossed to change the direction of the rotation at a define location you could use a switch at that location. That's much easier. – Peter Paul Kiefer Oct 18 '19 at 10:41
• I now about electrinics .but now a lot .but you Idea is very nice about swiching at that location but I have no any place for it I wnat works like air conditoner – Rayan_skofw Oct 18 '19 at 10:48

When motors stuck their current draw increases, you can sense that increase in the current and then change the rotation of the motor. The simplest way to measure current is with using a shunt resistor, for sensing high currents, current sensors based on hall effect sensors is usually used. ACS712 is one example.

How to sense current using a shunt?

Basically we're measuring the voltage drop over a resistor (RS), but the voltage drop is too small for Arduino to measure so we need an opamp to "amplify" the input: simulate this circuit – Schematic created using CircuitLab

The schematic above is the simplest way to measure the voltage drop at "LOW SIDE", there is differential mode and "HIGH SIDE" measurement methods.

The gain of opamp can be set with resistors and this formula:

VOUT = (1 + R2/R1) * V1

The output of opamp then can be calculated to get current using ohm's law:

I = V / R

A simple code to calculate current:

``````int rawAnalog;
float voltageDrop;
int resistor = 0.1;
float current;

void setup() {
pinMode(A0, OUTPUT);
}

void loop() {