# Arduino and stepper motor

How arduino stepper library handles stepper motor with ULN2003? I mean, for controlling stepper motor one actually needs four pwms. It can be reduced to two by encoding, or maybe even to one by using other techniques. But could you, please, clarify how arduino does it? I could not find the low level code for that from arduino to inspect.

Thanks

• why do you believe that you require PWM signal to control a stepping motor? – jsotola Feb 20 at 16:26
• For not blocking the main code. Like PWM with DC motor. – Pasha Feb 21 at 11:06

There is generally a stepper example in the arduino Compiler, you can find the code there, or look at the stepper library

However arduinos can‘t control steppers directly, but they send signals to stepper drivers, which then send the correct voltages to the stepper to rotate in a specific direction and rotate at a specific frequency.

Arduinos are basically ‚bit banging‘ namely they send a single high and low signal at a specific frequency and duty cycle, which determines the rotational speed of the motor itself. One line is high/low for direction, another for the signal. The advantage is you can count how many times you bit banged, and have an open loop position control system for easy NC applications

No-one would use the analog pins on an arduino to control stepper motors.

4wire stepper motors have A and B coils that require specific timing to excite (read, step) the motor and a large amperage/voltage requirement. Hence the drivers.

• Speed is a function of steps. $\omega=2 \pi f$ – morbo Feb 21 at 10:50