What can’t the little $5 WiFi module do? Now that [lhartmann] has got an ESP8266 controlling the motors of a 3D printer, that’s one more item to check off the list.
What’s coolest about this project is the way that [lhartmann] does it. The tiny ESP8266 has nowhere near the required number of GPIO pins, the primary SPI is connected to the onboard flash memory, and the secondary SPI is poorly documented and almost nobody uses it. So, [lhartmann] chose to use the I2S outputs.
I2S is most often an audio protocol, so this might at first seem like a strange choice. Although I2S sounds like I2C, it’s really essentially an SPI protocol with a fourth wire that alternates to designate the right or left channel. It’s actually just perfect for sending 16×2 bits of data at high data rates.
[lhartmann] takes these 32 bits and feeds them into four shift registers, producing 32 outputs from just the four I2S data lines. That’s more than enough signals to run the stepper motors. And since it updates at 192 kHz sample rate, it’s plenty fast enough to drive them.
The other side benefit of this technique is that it can work on single-board computers with just a little bit of software. Programming very complicated stepper movements then becomes just a matter of generating the right “audio” file and playing it out. [lhartmann] demonstrated this earlier with an Orange Pi. That’s pretty cool, too.
The code for turning the ESP8266 and a short handful of 74HC595s into a 3D printer controller are up on GitHub, so go check it out.
Thanks [CNLohr] for the tip!
Nice trick for the toolbox, could be useful for repurposing tablet guts or routers, that don’t have a lot of I/O.
Nice, but missing the analog bits needed for temperature feedback, so not much use in 3D printing yet.
Yeah, but it could be a good octoprint alternative to the Raspberry pi.
Just slap an ADS1115 to the ESP and go to rule, with 4 high speed flash based 16bit ADC for few bucks.
The ESP8266 has a single analog input, which would be enough for a PLA-only printer with no heated bed. I am checking options for multiplexing. Maybe using a couple GPIOs as GND/High-Z to drive/disconnect different thermistors.
The ESP8266has been the best value chip for last two years (in my opinion) I hope the new version keeps up :D
And I hope the new version will soon be available as a module :)
Me too,I will be buying a few that’s for sure.
And better documentation.
I hope the new version will be available! B^)
seed studio already has them
> the secondary SPI is poorly documented and almost nobody uses it
Actually there are ready libraries that let you use it. Nodemcu and MicroPython have them built in. I use it regularly for controlling displays.
Regading your comments about SPI “the primary SPI is connected to the onboard flash memory, and the secondary SPI is poorly documented and almost nobody uses it” SPI is well documented on github. I use on extensively in all my projects and it works great!
Yeah its a weird statement. The Adafruit Huzzah for example has no pinouts for it, but with the Olimex board you can use the primary SPI just fine, not to mention that we also have the secondary one. I’m all for clever hacks, but in this case I’m not sure there was even a need for it.
The I2S was not chosen because the SPI wouldn’t work, it was chosen because of the accurate timing provided by I2S+DMA, as shown for audio playback in Espressif’s MP3 player example. SPI would work if you could find DMA code for it, but I am saving it for SDCARDs later on.
Fair enough. There’s also [metalphreak]’s library which should work too.
I haven’t seen many projects using SPI on the little beasties, but I’m glad some folks are doing so. (And maybe my recollections are only correct as of mid-2015…)
Clever!