Monday, February 10

New Part Day: The Wi-Fi Stepper Gets Ideas Working Faster

Like most of us, I sometimes indulge in buying a part for its potential or anticipated utility rather than for a specific project or purpose. That’s exactly how I ended up with the WSX100 Wi-Fi Stepper, a single board device intended to be one of the fastest and easiest ways to get a stepper motor integrated into a project. Mine came from their Crowd Supply campaign, which raised money for production and continues to accept orders.

What’s It For?

The WSX100 Wi-Fi Stepper Driver (with motor), by Good Robotics

The main reason the Wi-Fi Stepper exists is to make getting a stepper motor up and running fast and simple, in a way that doesn’t paint a design into a corner. The device can certainly be used outside of prototyping, but I think one of its best features is the ability to help quickly turn an idea into something physical. When prototyping, it’s always better to spend less time on basic bits like driving motors.

In a way, stepper motors are a bit like RGB LEDs or LCD displays were before integrated drivers and easy interfaces became common for them. Steppers require work (and suitable power supplies) to get up and running, and that effort can be a barrier to getting an idea off the ground. With the Wi-Fi Stepper, a motor can be fired up and given positional commands (or set to a speed and direction) in no time at all. By sending commands over WiFi, there isn’t even the need to wire up any control logic.

Why Use Steppers?

Stepper motors are great for any project that needs to do physical work in the real world with any sort of exactitude. Every 3D printer, laser cutter, and other CNC device uses them. They’re inexpensive, come in standardized shapes and sizes, can be precisely controlled, and can interface with many things directly without needing a gearbox. The downside is that steppers aren’t quite plug-and-play. They may be common, but they are also relatively complex electromechanical devices that require more than just applying power to get them to move. If you’re new to the idea of steppers, this project explains the theory and inner workings beautifully by using an oversized, 3D printed stepper as a visual aid.

What the Wi-Fi Stepper Delivers

All that’s really needed for the WSX100 to work is to hook up a DC power supply (input range of 9-80 V supported) and attach a stepper motor; there are convenient presets for NEMA 11, 17, 23, 34, and 42 motors. Once power is applied, the board will by default create a wireless access point named wsx100-ap with a unique id appended to the name.

Easy operation consists of connecting to the device’s network, then opening a browser window to 192.168.4.1 (or wsx100.local if enabled) and using the Quickstart section of the web interface. From there, the motor can be set to either servo mode (motor moves to a position on command) or speed mode (motor is given a direction and speed), and is then ready to move.

All configuration and basic movements are accessible via this web interface; simply drag the shaft position or click a direction and the motor will immediately do it. There are also Python and RESTful interfaces, so all commands and configuration can be done using HTTP GET requests, usually from python or a bash script (the latter uses curl piped to jq, a tool for command-line JSON processing.)

Embedded below is a short video demonstrating Servo Mode with a NEMA17 motor attached to a simple 3D-printed assembly. First the servo is moved by dragging the handle in the web interface, then a simple bash script is run that demonstrates bouncing between two points with a one second delay between each position. The commands in the script came from copying and pasting from the Quick Code section of the web interface, one of several handy features.

‘Quick Code’ Feature

There’s a particularly handy section in the web interface I want to highlight. After setting all desired configuration options (and there are presets for everything from NEMA 11 to 42 as well as stall detection, shutdown parameters, and everything else) and optionally giving a movement command, a Quick Code window provides matching sample code for both Python and Bash scripts. Therefore, after using the web interface to test things, a cut and paste will provide code to do exactly the same thing.

What the Wi-Fi Stepper board doesn’t have is a hardware encoder for absolute motor position sensing. This isn’t uncommon, but don’t misunderstand “Servo Mode” as implying the presence of such an encoder. Servo Mode in this context refers to moving the motor shaft by telling it to go to a specific position, which it then does and holds that position until further notice.

There’s one more feature I’d like to get into: wireless security.

Let’s Celebrate That Security Wasn’t An Afterthought

Something that caught my eye on this project was how seriously security was taken during development. Being mindful of security is good practice in principle, but there’s a practical consideration as well. The developers made a valid point that since the board can support large motors at high currents, there is potential for real damage to result from someone mistreating or compromising the unit and telling it to do things it shouldn’t. Security is always worth taking seriously, but as the developers put it:

Security is hard. Really hard. In a world where IoT devices are notoriously bad at security, we hope [our efforts are] a step in the right direction.

You can gain some insights into security design by reading the developer update that explains how exactly they approached securing a device like this. Briefly, it starts by stating some assumptions about how the device will be used and in what context, and letting the security design flow from those points.

In the case of the WSX100 Wi-Fi Stepper it is assumed that the device will be provisioned and configured in a secure environment, no sensitive information will be transmitted as part of commands, and physical security (e.g. tamper protection and detection) is out of scope. Working from these assumptions, the WSX100’s security focused on ensuring that only commands from an authenticated source are considered valid (thwarting things like man-in-the-middle and replay attacks.)

To do this, the WSX100 uses the ATECC508A by Microchip to provide an authentication key framework, and if enabled, implementing it is made painless by the API. Once the master key is set on the device, commands are transmitted unencrypted but with a computed signature attached. If a command’s signature is not valid, the command is not legitimate. It is not possible to deduce the master key from the signature, and by not encrypting transmissions there is minimal overhead and latency added.

The team also explains possible security issues that have not been addressed or could still cause problems. For example, for a wireless device denial of service or jamming is a possibility. While not much can be done to prevent attacks of that nature, it is possible to use timeouts to ensure that motors are parked in safe positions in the case of a loss of connectivity.

It’s wonderful to see security taken seriously, and not as an afterthought.

How Does It Fare?

The Wi-Fi Stepper is easy to get up and running, supports a wide range of motors and voltages, and security hasn’t been ignored. So far so good, but what does it do best, and are there any shortfalls?

As someone who doesn’t live and breathe steppers in my usual projects, some of the best value comes from making them almost plug-and-play. Any projects that do physical work (like automatic pet feeders or automated curtains) are better to develop the easier it is to play with the motors. Also important to consider are the things it doesn’t do.

The Wi-Fi Stepper absolutely does a great job of getting a motor moving, but it doesn’t have any external sensors (like limit switches) or simple ways to add them. That means it’s ridiculously easy to tell a motor “start turning” but adding “…until this switch is hit, then stop” is up to the developer. Likewise, there is no built-in support for an encoder with which to track and sense the motor’s real-world position, so applications that require an encoder will need one added and managed separately. The API and web interface won’t have any knowledge of them.

That all being said, position encoding isn’t necessary for using steppers effectively and the device’s Servo Mode — the ability to tell the motor to move to a certain position and stop there — can cover most bases. Still, being able to integrate a limit switch or two would have been a nice feature.

The ability to get a stepper going with minimal wiring and little more than a browser window is an awfully nice tool that I’m delighted to add to my workbench. The WSX100 Wi-Fi Stepper is, of course, open source. The Github repository is here and online documentation is at wifistepper.com. It’s available directly from Crowd Supply.

No comments:

Post a Comment