Close
0%
0%

ESP8266 Stepper Driver

A cable-less connection for stepper motor control, using Forth

Similar projects worth following
Rather than connect with an ethernet cable, how about sending the control for a stepper motor using WiFi? Still have to supply power to each stepper, but that is much simpler than distributing control through wires. This becomes useful when the distance between stepper motors can be variable.

Besides, I get to play with ESP8266 in the form of ESP12E. I decided to use a Forth language, and I haven't used Forth for many years. What fun!!

The hardware elements are off-the-shelf, so I have decided to allocate this to software.

Forth

The first Forth I found that runs on the ESP8266 is PunyForth. I am still exploring it, but it seems to have lots of tools to work with ESP8266 capabilities.

A Forth environment is so extensible that the line between what is the system and what is user code is very indistinct. When this is completed, all the code will be included in the uploaded binary stored in with the base code uploaded with the esptool.


Hardware

I have a couple of ESP-12E dev boards and several bare ESP-12E boards, so I intend to develop code to put onto a ESP-12E driving either a ULN2003 board or an A8266 driver. Maybe both, just because I can. If you have a preference, let me know and I'll do that first. The stepper can be whatever you want to drive using either board, with relevant power supply.

UDP test client.py

To send UDP message from another machine connected to WiFi network to ESP

x-python - 251.00 bytes - 12/18/2016 at 01:41

Download

ESP8266-ULN2003-driver-v1-2.forth

Added handler for WiFi. Now accepts command lines from UDP connection.

forth - 4.01 kB - 12/18/2016 at 01:38

Download

ESP8266-ULN2003-driverv1-0-uncommented.forth

Removed comments just speeds up loading slightly, plus shows how little code is really needed. It is still 1098 bytes in the file, so maybe a few more comments and whitespace need to go just to get it under 1K bytes of source code!

forth - 1.07 kB - 12/07/2016 at 12:53

Download

ESP8266-ULN2003-driver-v1-0-tests.forth

Kept the comments and the tests in here. Usually just copy the relevant test line into the serial monitor as needed.

forth - 1.96 kB - 12/07/2016 at 12:53

Download

ESP8266-ULN2003-driver-v1-0.forth

Version 1.0 with lots of comments, including some tests.

forth - 2.90 kB - 12/07/2016 at 12:53

Download

  • 1 × 28BYJ-48 stepper motor
  • 1 × ULN2003 driver board
  • 1 × ESP12E development board
  • 1 × 5V power supply For steppper

  • Testing v1.0

    RigTig12/07/2016 at 13:47 0 comments

    Reworked code to better use the existing words in PunyForth, and actually did some testing on a 28BYJ-48 stepper motor using a ULN2003 driver. Version 1.0 of code is working fine from serial monitor. See video at https://vimeo.com/194805134.

    I decided to create a source file with minimal comments in an attempt to get the code under 1K bytes of source. Well the fist edit achieved 1098 bytes, and there are still some comments and whitespace I can cut out. Of course, I can also reduce the source code size by using much shorter names for the newly defined words, but that can be even more cryptic to read. Still it is an option, and I may need it, just to prove a point.

    Just as an example of the usage for the topmost word, you type in 2 numbers and the word 'move'. The first number is the time for the move to take, in microseconds. The second number is the distance in micrometres (um) to move. So, if you wish to move 40 millimetres (40mm = 40000um) in 1 second (1000000uSec), then you type

    1000000 40000 move
    and it happens. Well, kind of approximately; the actual move might be up to a step short of the distance and the time might be a few microseconds longer, but quite ok for this project. Now, keep the numbers you try within the capability of the stepper motor, because there is no checking in this code (at least not yet) if you overstep (pun intended) the rather slow little stepper (28BYJ-48).

    Talking of steps, the next step in this project is to give the commands via wifi.

View project log

Enjoy this project?

Share

Discussions

RigTig wrote 03/18/2018 at 05:17 point

https://m.youtube.com/watch?v=oNAHOOolHWw shows a really quiet 3D printer. The stepper driver is minimising acceleration using fine micro-stepping. Now, for a cable-based printer, this is a very useful feature. Looks like we need an update, so we'll go for a more powerful stepper too. 

  Are you sure? yes | no

MasterOfNull wrote 10/05/2017 at 08:46 point

Not so useful for hard real-time applications like 3D printing, but this would probably work perfectly for simple animatronics via DMX.  Like making a skeleton dance to music for example or controlling an XY spotlight.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates