Running a Stepper Motor From an Adafruit HUZZAH ESP8266





Surprisingly, you can run a powerful stepper motor (via motor controller) from the Adafruit Huzzah ESP8266 WiFi module and thus control the stepper via browser or web service, turning your stepper into an Internet of Things (IoT) device. This makes for a compact and low-cost remotely controlled motor, good for robots, mechanical arms and more.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Requirements

I used the following Adafruit components for the Stepper Motor and ESP8266 right out of the box. Otherwise, you would need to add regulators and related components to make the voltages compatible.

IMPORTANT NOTE! The power regulator on the Adafruit HUZZAH ESP8266 board has CHANGED. It no longer can handle 12v DC. A 5VDC power supply to feed the V+ and a 12v supply for the Stepper now required!

Older HUZZAH ESP8266's included a 3-16v regulator, so are unaffected.



Step 2: Important Initial Setup of Huzzah ESP8266

Before beginning the modification, you should become familiar with the Adafruit HUZZAH board and programming it using the Arduino IDE. The best way is to use the excellent Adafruit tutorial:

You must be able to program your ESP8266 and connect wirelessly to it via browser.

Once completed, THEN continue to next step.

Step 3: Software

First you should program and test the ESP8266 before adding its hardware wiring:

  1. STOP! Be sure you have already completed the preliminary software setup of the Arduino IDE and tested the ESP8266 with your WiFi network as described in the Initial Setup above!
  2. Ok, download the ESP8266_stepper software from GitHub
  3. Copy the StepperWebServer.ino program to your Arduino library area.
  4. Using Arduino IDE, edit the StepperWebServer.ino and insert your SSID and PASSWORD into the appropriate places.
  5. Compile and Upload the program using the FTDI or USB console cable just like shown in the Adafruit tutorial.
  6. When the program finishes loading, open a Serial Monitor, set to 115,200 baud, and press the ESP8266 RESET button to restart the program running.
  7. It should display the IP address once connected to your Wifi.
    Also, the onboard Red LED should blink 4 times signifying it’s successfully connected.
  8. Use a browser to go to http://{your_ip_addr}/stepper/stop
    This should respond back with “OK: MOTORS OFF” in browser
    Go to http://{your_ip_addr}/stepper/rpm?1 and see “OK: RPM = 1”
    Go to http://{your_ip_addr}/stepper/steps?10 and see “OK: STEPS = 10”
    Go to http://{your_ip_addr}/stepper/start and see the onboard LED blink once
    NOTE: If you have a Linux machine, you can use cURL to do these commands as well
  9. Unplug your ESP8266 and remove the FTDI/USB cable. It’s now programmed.

Step 4: Hardware Wiring

  1. Connect up the Stepper Motor to the TB6612 Driver board:
    • Hook one stepper motor coil to Motor A (red and yellow)
    • Hook the second coil to Motor B (green and gray/brown).
    • Connect VMotor V+ to +12V Power
    • Connect VMotor GND to 12V Ground
  2. Next, wire up the Huzzah ESP8266 board to the TB6612 Driver board (see Wiring Table and Circuit diagrams)

  3. Connect up the 5v DC power supply to GND and V+ pins on the side of the Huzzah board (same side that the FTDI USB programming cable connected to in the software load, above.)


If your power supply in insufficient, you could cause the ESP8266 to reboot repeatedly or not be able to drive the Stepper Motor.

Also, Steppers can get really hot w/o current limiting.

Be sure to send a “STOP” command (see below) to switch the TB6612 to standby which removes power from the Stepper. Use “START” command to reapply power.

Step 5: Testing

I used the built-in Arduino Stepper Library to control the stepper motor. I added this to a simple HTTP control web server to provide remote control of the stepper.

Use a PC with web browser or Linux cURL command to try the functions below:

Functions available:

  • http://{your_ip}/stepper/steps?5 -- Step 5 steps forward (values 1 to 200)
  • http://{your_ip}/stepper/steps?-10 -- Step 10 steps backwards (-1 to -200)
  • http://{your_ip}/stepper/rpm?6 -- Run at 6 RPM (1 to 50)
  • http://{your_ip}/stepper/stop -- Stop the stepper motor (Removes power)
  • http://{your_ip}/stepper/start -- Start the stepper motor (Restores power)

If you have a Linux machine (such as a Raspberry Pi) you can use the following simple automation example:

$ nano

Change ESP_IP to your ESP8266’s IP address.

$ bash 

Have Fun!

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    16 Discussions


    2 years ago

    IMPORTANT NOTE! The power regulator on the Adafruit HUZZAH ESP8266 board has CHANGED. It no longer can handle 12v DC.

    A 6VDC 2amp power supply to feed the V+ and the Stepper now required!

    The lower voltage will drop the torque, but will still step.

    Alternately, use separate 12v for stepper and 3.3v to 6v for ESP8266.

    I will update the docs here.

    Older HUZZAH ESP8266's included a 3-12v regulator, so are unaffected.


    2 years ago

    nice.. so how can i make the functions as a button to trigger the stepper


    2 years ago

    Nice job.. But how comes the ESP stops responding after a couple of minutes? After RESET it works for another couple of minutes.. Is it MEMORY getting full or something?


    3 replies

    Reply 2 years ago

    Had a similar issue with powering a stepper on one of these. I ended up using a microstepping library I found online and modifying it slightly. I noticed the device would reset and have a kinds of crazy errors if I tried to do more than 30 steps at a time. So I added a delay(1) to the code every 30 steps. This has 100% resolved issues with resets and errors driving steppers from the esp8266 chipset.


    Reply 2 years ago

    Here is the microstep library:


    Reply 2 years ago

    No, the web server on the ESP shouldn't run out of memory. I've been running a similar application (Space Station (ISS) Tracker )
    for many months without a reset.

    My best guess is that the power supply is insufficient or a loose connection. If the stepper vibrates the wiring, it can intermittently break a connection causing the ESP to hang. I had this problem until I soldered all the connections.


    2 years ago


    im looking into this thread and i'd like to implement it into Domoticz as blinds controller ... but im not able to buy here in my country Adafruit do you think i can switch it for this one?

    and still use your code?
    thanks for answer master. :)


    Reply 3 years ago

    The Adafruit TB6612 can only run 1 stepper. But it looks like this one: could run 2. And the description says it will work with an ESP8266 (though, might be just the ESP8266 Feather (


    3 years ago

    Hey thanks for the instructable I am looking forward to get this working and playing with it.

    When I try uploading the sketch it complains that Blink(), getvalue() and printusage are all undeclared.


    4 replies

    Reply 3 years ago

    finally got the test page off adafruit, don't know how just kept playing

    connecting to
    Requesting URL: /testwifi/index.html
    HTTP/1.1 200 OK
    Date: Mon, 04 Jan 2016 20:06:15 GMT
    Content-Type: text/html
    Transfer-Encoding: chunked
    Connection: close
    Set-Cookie: __cfduid=df46de64de054aeeeb2ea71b1283fbc691451937975; expires=Tue, 03-Jan-17 20:06:15 GMT; path=/;; HttpOnly
    Accept-Ranges: bytes
    Access-Control-Allow-Credentials: true
    Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Accept-Encoding, Authorization, Referer, User-Agent
    Access-Control-Allow-Methods: GET, POST, OPTIONS
    Access-Control-Max-Age: 1728000
    Cf-Railgun: direct (starting new WAN connection)
    Last-Modified: Thu, 27 Jun 2013 14:13:27 GMT
    Vary: Accept-Encoding
    Server: cloudflare-nginx
    CF-RAY: 25f9901854ad3060-YYZ

    This is a test of the CC3000 module!
    If you can read this, its working :)


    closing connection
    connecting to
    Requesting URL: /testwifi/index.html

    is that a true internet connection? how do i control a simple web blink?


    Reply 3 years ago

    I assume you have installed and tested the Adafruit ESP8266WiFi library into your Arduino IDE, and are using version 1.6.5 or higher of the IDE?

    You also need to select Tools -> Boards -> "Adafruit HUZZAH ESP8266" in the IDE.

    The sketch also uses the "Stepper.h" library that comes built into the Arduino IDE package.

    If all of above is true and you can successfully compile and use the Adafruit HUZZAH ESP8266 breakout examples then I would suspect a missing close bracket } character in your copy of the sketch. Maybe re-download or cut/paste the RAW version of the ino sketch file into the Arduino IDE window and try a recompile. (You should see the blink(), printUsage() and getValue() functions in the bottom of the sketch.)

    P.S.> You do not need a ESP8266 board plugged in to recompile, but you do have to select the Adafruit board.


    Reply 3 years ago

    Hi rgrokett,

    While I really have no idea why, I got it working after moving blink(), printUsage() and getValue() functions from the bottom of the sketch to just above the setup() function. So I will go play with it now.



    Reply 3 years ago

    Hi rgrokett,

    Thanks for the reply. All your assumptions are correct. I did run through and tested things o the Adafruit site and I am using the latest 1.6.6 (Ihave heard others having issue with this version and I am considering trying 1.6.5) IDE. I have also successfully compiled and ran a couple stepper Arduino stepper examples.

    I also just downloaded ( and extracted your .ino file and tried compiling it with out editing a thing and got the same results (see screenshot).

    If anything else comes to mind please let me know I think I will go through everything at Adafruit again and now that I see where those functions are defined I will review that as well. I will keep at it and hopefully figure it out.

    Thanks again

    Screenshot 2015-12-03 18.07.51.png

    3 years ago

    can't get my huzzah to connect to my linksys wrt54g2, what router you use?

    1 reply

    Reply 3 years ago

    Take a look at this and see if it matches your issue or gives you some clues...