stepper motor shaking problem

hi all,
I am doing a project that is a stepper motor can rotate with my potentiometer. Here is my schematic. I use a PWM pin to make pulse signal driving the stepper motor. I use a digital pin to control the rotate direction. My problem at this moment is my system is not stable. My stepper motor always want to rotate a little bit even when I do not turn my potentiometer. So when I use some gears to lock the motor shaft, it starts shaking. I think that is our potentiometer’s problem. I found it is very sensitive. When I clench the three pins of the potentiometer, the motor will not shake seriously.

I am a junior engineer, it is my honour if you have some suggestions or solutions.

Hi,

You should Show Us The Code...

Are you are using the potentiometer to try to set the direction and speed of the stepper motor?

PWM will put out constant pulses. Do you want the motor to run constantly??

Maybe you need to control the pulses directly from your code...

Whe you touch the pins on the Poetentiometer you are creating NOISE on the analog signal. the program is responding to that noise.

Whe you touch the pins on the Poetentiometer

The OP says that decreases the shaking, so probably the capacitance of the fingers is bypassing some noise.

I bet your Motors/wiring is making noise into the potentiometer. Try adding a capacitor (say .1 uf to 1 UF ort so across the outside of the pot connections, and a .1uf from the center connection to ground.

Also, try separating your program so that you can look only at the potentiometer value on the Serial Monitor with and without the motor connected. IS it different?