Welcome! Log In Create A New Profile


ESP32 Printer Board

Posted by CthulhuLabs 
ESP32 Printer Board
May 19, 2017 01:33PM
I was wondering about the feasibility of using an ESP32 for running a 3D printer.


It is 32bit, runs at up to 240Mhz, has 32 GPIO pins, and costs right around 4 USD for the chip itself. There are multiple companies selling development boards for it with all the necessary support circuits for right around 20 USD.

My only concern is if the number and types of GPIO pins it has will be enough for a 3D printer. If they are not enough by themselves would using a SPI GPIO expander work or would that add too much of a performance hit.

Edited 1 time(s). Last edit at 05/19/2017 01:49PM by CthulhuLabs.
Re: ESP32 Printer Board
May 19, 2017 01:43PM
I did some analysis when the ESP32 was first announced, and I came to the conclusion that with a few tricks (not involving an I/O expander), the ESP32 had enough I/O to build a basic 3D printer controller around. But I've been so busy with the Duet WiFi and Duet Ethernet that I haven't had time to develop those ideas.

Bear in mind that the processor is a small part of the overall board cost, unless you choose to use an expensive processor heading towards end of life, as many controller boards do.

Delta printer calibration calculator, mini IR Z probe, and colour touch screen control panel: [escher3d.com]

Large delta printer, and other 3D printer blog postings: [miscsolutions.wordpress.com]

Full disclosure: I have a financial interest in sales of the Panel Due, Mini IR height sensor, and Duet WiFi/Duet Ethernet.
Re: ESP32 Printer Board
May 19, 2017 02:28PM
Thanks dc42!!! I know your assessment is sound.

Ultimately what I want to design is something to be a replacement for the RAMPS board. It would have five sockets for stepper motor drivers (X,Y,Z,E1,E2), three endstop pins (X,Y,Z), three mosfets for two hotends and a heated bed, a built in SD card slot, and a header for a dumb LCD (not like your super smart LCD).

I like the low cost / minimal feature set of the RAMPS board. It is a really good starter board for people building printers. The issue I have with it is how under powered the Arduino Mega is. I feel like this is one of the major limiting factors in printer performance and feature sets.

By making a similar board that accepts one of these:


It will greatly reduce the cost of entry for printers running 32bit code. They are also cheaper than official Arudino Megas and I feel that cost is going to be going down as their production increases.

I want to make the board fully open source like the RAMPS and I fully expect cheap Chinese knock offs to follow.
Re: ESP32 Printer Board
May 19, 2017 03:05PM
My preliminary design included software-settable stepper motor current too. Having to twiddle pots to adjust stepper motor current is an abomination that no novice 3D printer builder should have to endure.

Delta printer calibration calculator, mini IR Z probe, and colour touch screen control panel: [escher3d.com]

Large delta printer, and other 3D printer blog postings: [miscsolutions.wordpress.com]

Full disclosure: I have a financial interest in sales of the Panel Due, Mini IR height sensor, and Duet WiFi/Duet Ethernet.
Re: ESP32 Printer Board
May 22, 2017 06:47AM
While I fully agree with your assessment of the pot adjustments, making the voltage adjustment software based requires the stepper drivers to be built into the board. This raises the cost of the board itself and reduces the molecularity of the design. As someone who has fried multiple stepper drivers when starting out, having the ability to change them out without replacing the whole board is a blessing.

It would be nice if there were stepper driver daughter boards that could take an external voltage adjustment source. Might be something to look into making as well.
Re: ESP32 Printer Board
May 22, 2017 01:01PM
Users fry plug-in stepper drivers precisely because they are plug-in (hence inadequately cooled and with too long a path to the supply capacitor) and because they don't get the current setting right. Stepper drivers properly mounted on a PCB with precise current setting in firmware are at least an order of magnitude more reliable. Ask Think3DPrint3D, they used to sell kits with RAMPS and plug-in drivers, then they switched to the Duet.

It would be perfectly possible to design a plug-in driver with digital current setting. I designed one a couple of years ago. It used an extra pin on one end of the carrier to pass Vref. But that doesn't get around the other issues with plug-in drivers.

Delta printer calibration calculator, mini IR Z probe, and colour touch screen control panel: [escher3d.com]

Large delta printer, and other 3D printer blog postings: [miscsolutions.wordpress.com]

Full disclosure: I have a financial interest in sales of the Panel Due, Mini IR height sensor, and Duet WiFi/Duet Ethernet.
Re: ESP32 Printer Board
May 22, 2017 03:24PM
The Trinamic Stepper Drivers can be "sort of" voltage adjusted by SPI. I designed a stepper driver daughter board that uses a trinamic stepper driver. Problem is that due to the SPI needed it is impossible to do it plug-in compatible to the pololu boards. Therefore it only makes sense if you also come up with your own base board for those stepper daughter boards.

It might also make sense to move the stepper controller chip to the motor. In industrial applications you often see a PCB attached to a stepper motor that carries the driver and an encoder. This would remove a lot of EMI from the printer controller board. wiring these things is then another issue,...
Re: ESP32 Printer Board
May 22, 2017 11:30PM
If you are building your own pololu/RAMPS compatible stepper driverboard and want to replace the potmeter adjustment:

1. Set enable signal to disabled. This tells the driver to be in config mode
( not the driver chip itself, but an interface chip acting as digital potmeter )

2. send steps and dir signal to be interpreted as " current up" or "current down". ( relative mode )
(eg. 1 step = 1mA) ( might require a new gcode or extra parameter )
2a. Same procedure, but steps are interpreted as absolute value.

Current adjustment would then look like: G1 S1 E1300 X500 Y500 Z1200 F[full speed], where S1 is the new adjust-mode parameter

Edited 2 time(s). Last edit at 05/22/2017 11:35PM by o_lampe.
Re: ESP32 Printer Board
June 15, 2017 12:26PM
I've been into ESP32 for a bit, after I did an ESP8266 Marlin port, and smashed into the tricky problem of limited number of pins.
I looked at it from firmware point-of-view.

So, diving into the ESP32, first thing:
Seen many complains about the Arduino core for it. It is far from complete.
If you'd like to use some Arduino-based code like Marlin, then it will be a huge headache.
Even its own SDK, the esp-idf is far from complete, constantly being updated, and the Arduino core is based on that. Many-many low-level accesses with not compatible registers, non-existing EEPROM, and stuff like that.

And it would be a waste to use standard "8-bit Arduino"-based code for this thing, which is a tad bit stronger, and has more peripherals, like native SD card interface.
It's on the level of 32-bit ARM processors, so something like RepRapFirmware or Smoothieware would be worthy for it. Problem is, they are very much not alike, especially the Smoothie.

There is another thread here where a new, FreeRTOS-based firmware was suggested by lhartmann (for ESP8266), and is also good for the ESP32, because esp-idf is FreeRTOS-based.

Now onto the next problem, which is before the potmeter adjustment problem. Let's put that aside, and use the old fashioned method.
How will you drive the stepper controllers?

There is the timer-based standard method, but ESP32 has some HW-accelerated solutions, like:
- PWM with modifiable frequency. Set it to 50%, and just adjust the frequency when needed. Also set a pulse counter on each output, so they can be HW-tracked, and set interrupt for them to adjust when needed. Well, there are more than enough channels, but the main problem is they can use up to 3 different timers for frequency. Meaning up to 3 steppers. sad smiley
- Motor control PWM. It is specifically designed to drive different kinds of motors. Not steppers though... And there are only 4 of them, if I remember correctly. sad smiley
- I2S with shift register, as lhartmann did. Clever idea. ESP32 has a parallel mode for I2S which would exclude the need for additional ICs, but well... the shift register version uses up less pins on the ESP32 itself. This way it is the ultimate method if you need pins. This could be considered.
- SPI. ESP32 has 3 SPI interfaces each with up to 3 HW-controlled CS pins. One SPI is used for flash and external ROM. The basic pin positions of another one share the SD card pins, but if I'm correct then with the GPIO matrix they can be used on separate pins, so we can have SD pins, and 2 SPI interfaces. That means 6 HW-controlled CS pins, but it would kick out everything else SPI-related. Unless for one SPI we use SW controlled CS pins, dedicated to stepper controllers, and have the other SPI for LCD and stuff. Maybe this could be it, but needs to be tested.

I'm into it, but have other things to do. At least I can tell you that it most likely needs its own firmware.
Or wait for the Arduino core to catch up, and have lots of headaches.
Re: ESP32 Printer Board
July 17, 2017 02:01PM
My ESP32 dev board finally came so I am getting back to this.

@Hubberthus - Pretty much figured it would run RepRapFirmware. Among other things it is the firmware I am familiar with on my existing RADDS board. Also dc42 is pretty much the maintainer of it, which is why I was happy to see him saying that the ESP32 should work. I do need to dig more into the HW acceleration capabilities of the ESP32.

@dc42 - Again while I agree that software settable voltages is a great thing, I think it is a luxury and not a necessity. Among other things it locks you into the stepper drivers that come with the board. Also when I fried a stepper board it was because of a problem in my wiring and not with my voltage setting. I do like the idea of extra pins to supply an external Vref for daughter boards designed to support them though. With regards to your concern about cooling, one of the design constraints I wanted to put on the board was making sure that there was plenty of air flow around the stepper driver boards. I realize that most of these chips are designed to be cooled from the bottom and not the top. As such I wanted to design the board so that air being blow across it has an easy path under the stepper drivers. If you look at a RAMPS board there are those stupid jumpers and capacitors in between the socket for each stepper driver. As for the distances to the supply capacitor, I may be misunderstanding what you are referring to, but this sounds like an issue with the design of the actual board and not with using daughter boards.
Re: ESP32 Printer Board
July 17, 2017 11:55PM
There already exists Pololu like driver with addon Pins for digital Vref, from panacutt
Also the fitting board for that is available there.
They also have a ARM Upgrade for the Ramps Board
Unforunately all in the USA, so not really orderable for me.

I´m also for a simple new 32 Bit board for long time, also had a couple of discussions here at the forums with DC42 about simpler and lower cost boards.
For me the conlusion is that DC42 with his Duet boards is willing to only adress the "Apple-Like" users with big money pockets and not want to be annoyed with users who want to tinker around on their machines and do not have that big money pockets ...

@ Cthulhulabs do you have some more information about your board ? i`m looking since long time for a good 32 Bit Entry class board smiling smiley


[chrisu02.wordpress.com] Quadmax Intel Delid Tools
Re: ESP32 Printer Board
July 18, 2017 10:15AM
@chri - The board is just a concept at this point. I am currently finalizing what I think should be on the board.

As for those SD5984 drivers, it is a good concept, but the position of those extra pins means that will restrict airflow under the board. Might not be a problem for this specific stepper board, but for stepper driver chips like the DRV8825 are designed to have thermal vias bring the heat to the underside of the board so airflow under the daughter board is very important. However the design I have in mind would be very easy to route a jumper wire from the socket to the external Vref on the SD5984.

As for that 32bit board to make the RAMPS 32bit, that board is too specialized. It basically only has one purpose which is to make the RAMPS board 32bit. It also has to have a large number of 3.3v to 5v level shifters for the processor they are using to communicate with the RAMPS board. As such it will always be expensive. It looks like the KickStarters has those boards at 39 dollars. Generally when KickStarters go into production they charge even more than what they charged the backers. The ESP32 is a general purpose IoT board that just came out. The actual chip costs just four dollars (lower in bulk). The Development board costs just 15 dollars. As the production and popularity of these boards increases for all sorts of IoT devices the costs will go down.

Currently I am planning on having 5 external stepper driver sockets. These sockets will be compatible with the Pololu A4988, but have an additional 6 pins. 1 for Vref, 1 for GND, and 4 for SPI. There will also be a one pin space between these extra pins and the standard A4988 pins so people using A4988 and compatible boards do not accidentally stick them in the wrong location. So it would look something like this:

Enable *       * VMOT
   MS1 *       * GND
   MS2 *       * 2B
   MS3 *       * 2A
 Reset *       * 1A
 Sleep *       * 1B
  Step *       * VDD
   Dir *       * GND

  Vref *       * GND
  SCLK *       * MOSI
    SS *       * MISO

I want it to also have an MicroSD card slot, three MOSFETs, three thermisters pins, three end stops pins, headed bed control, and at least one servo hook up. The question is can all of this be done with the I/O on the ESP32 or do I need to get an external GPIO chip.

The board in general will be larger than the RAMPS board and most other boards out there. I want the components setup so a fan blowing across the board has easy air flow under the stepper drivers as well as around the MOSFETS. The MOSFETS I want to have plenty or room for an external heatsink as well.

The initial board will be designed around having one of the ESP32 Development boards socketed into it. This will make revising the board easier. In the future though might move the ESP32 directly onto the board to reduce overall cost.

So yeah that is where I am at, and I am still very open to suggestions.
Re: ESP32 Printer Board
July 18, 2017 01:14PM
Sorry, only registered users may post in this forum.

Click here to login