Wi-Fi Stepper

by Good Robotics

Control any stepper motor using Wi-Fi

View all updates Feb 01, 2019

Configuring Drive Voltage and Current

In this update, I’ll be discussing how the Wi-Fi Stepper controls the voltage and current of your stepper motor during operation. Having a good understanding of the basics of stepper motors is helpful here and there are plenty of resources available. This post will go over the specifics of the Wi-Fi Stepper and it’s two modes of control: Voltage and Current.

Voltage Control

Under Voltage control, the input voltage (Vin) is pulsed to each of the two motor phase coils at a configurable frequency (default 23.4kHz). This is called Pulse-Width Modulation (PWM) and is a way to vary the “effective” voltage on the coils. The Duty Cycle (percent time the voltage is high) determines how much of this effective voltage the phase sees. By alternating the timing and duty cycle of the PWMs on each of the phases, the stepper motor coils are energized accordingly resulting in shaft rotation.

Attaching an oscilloscope and probing the A+, A-, B+, and B- terminal connections (each side of Phase A and Phase B motor coils), we can see the PWM control in action. In this test, we are using 24V input.

Viewing Voltage mode PWM control on the motor phase coils.

Motor coil excitation using PWM.

KTval Registers

There are four registers to configure voltage/current on the Wi-Fi Stepper. Collectively, they are the KTvals set of registers. When the motor is accelerating, KTaccel is used. Likewise KTdecel is used during deceleration. KTrun and KThold are used when the motor is running at a constant speed and when the motor is stopped but holding position, respectively. Using these four registers, you can define different voltage/current for different phases of your motor’s overall movement. The math behind all KTval registers are the same and as such, we will designate KTval to refer to all four registers identically.

KTval is a floating point number between 0 and 1. Under Voltage control, it sets the maximum duty cycle of the voltage PWM driver (0.1 = 10%, 0.2 = 20%, etc.) Under Current control, it behaves differently and is covered in detail in the Current Control section below. (Note: KTval is named by the STspin motor driver series logic controllers. Under Voltage control, it assumes the Kval configuration, and under Current control, it assumes the Tval configuration.)

It’s a bit hard to make out the PWM waveforms on the oscilloscope capture above. We’ve drawn a simplified diagram to show the point.

Interpreting the equation, what this means is that the peak PWM (“effective”) voltage on the phase coils is the KTval setting multiplied by the input voltage (Vin).

Current Control

Under Current control, a feedback loop is introduced through a current-sense resistor (Rsense). The motor is PWM’d until a desired current is achieved. Because motor torque is proportional to current, using Current mode allows you to directly command torque, independent of speed or motor load.

In this mode, KTval defines the Vsense comparison voltage (0.1 = 100mV, 0.2 = 200mV, etc.) This voltage is directly related to the current through the motor coils by the following equation

This equation doesn’t depend on input voltage (Vin) or motor phase resistance. What this means is that, regardless of the input voltage or your motor size/type/series resistance, you can directly specify the motor coil current.

One last picture to show Current mode in action. Below is an oscilloscope capture showing the input PWM along with the measured Phase A coil current. In this test, we’re using KTval of 0.3 which equates to 3 Amps peak current. You can also see the 1/16 microstepping in action.

Viewing Current mode motor Phase A coil current.

$6,085 raised

of $5,000 goal

121% Funded!

Pledge Now


Support Us!

Thanks for helping make the Wi-Fi Stepper a reality! You will be rewarded with good karma and regular backer updates.


Wi-Fi Stepper Quickstart Kit

Includes the Wi-Fi Stepper board, NEMA 17 stepper motor, and 24 V power supply packages. Everything you need to get started.


Wi-Fi Stepper - Board Only

A Wi-Fi Stepper board to control small and large stepper motors.


Wi-Fi Stepper Board 3-Pack

A 3-pack of the Wi-Fi Steppers - boards only.


24 V Power Supply

Include a 24 V/3.75 A DC power supply that has been tested to work well with NEMA 17 and NEMA 23 motors.


NEMA 17 Stepper Motor

Include a NEMA 17 high torque stepper motor.


Good Robotics

Good Robotics develops hardware and embedded software for robotics and control applications. Our focus is on adapting professional-level platforms and techniques for a wider range of users such as makers/hobbiests. We have experts in electrical engineering, embedded systems, mechanical engineering, and sensor fusion/controls.

Andrew Klofas

Electronics Engineer and Embedded Systems Developer

Ace Shelander

Mechanical Engineer

Ted Larson

Senior Electronics Engineer

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects: