Welcome! Log In Create A New Profile

Advanced

New board for the ESP32 : ESPIon

Posted by Moddingear 
New board for the ESP32 : ESPIon
March 08, 2019 06:34AM
Hello, this is my first post here, so I don't really know where to start.
I designed a new board based on the RAMPS, with all know issues addressed, for example :
  • Added blade fuses for all power input
  • Power inputs are now screw terminals, rated for much higher current
  • Separated power inputs for bed/hotend/fan/5V (servo)/VCC/VMOT
  • Abstracted motor driver interface : Motor drivers are no longer directly on a board, instead they use another board, allowing for much easier installation of TMC or like drivers thanks to broken out I2C/SPI/UART. Chip select for SPI could be done using another PCF8574 connected with I2C
  • Added 7 stepper drivers by default, using 1 less pin thanks to a shift register placed on the stepper driver board (PCF8574).
  • Reset button pin broken out.
  • Features jumpers for simpler wiring : If you use 24V for heaters and motors, and 12V for fans, you can set the jumpers so you only have to set 2 wires instead of 4. Same for VCC/5V.
  • Changed mosfets for heaters to IRLB3034.

It's based around the ESP32 DOIT Devkit V1, as it is the most popular ESP32 board and the cheapest available, and some PCF8574 for more I/O to allow it to have enough

UPDATE : Changed the title.
As there is no board made for the ESP32 as of yet, this board might fit the bill with some good options.
It's now named the ESPIon

Here is the schematic :
https://easyeda.com/moddingear/espion

Edited 1 time(s). Last edit at 03/09/2019 11:35AM by Moddingear.
Re: Addressing common RAMPS 1.4 issues : New block design
March 08, 2019 07:13AM
oh god, not annother one... there are about 5 of these on the go atm...

1) the mega is old slow and needs to be retired.. If it isn't due compatible.... your probably wasting your time
2) its needs protection for idiots plugging endstops in backwards (and shorting 5v to gnd)
3) stop using STP55NF06L's they are crap, especially for the bed

take a look at the very active thread New Ramps design [reprap.org]
Re: Addressing common RAMPS 1.4 issues : New block design
March 08, 2019 07:24AM
Quote
Dust
1) the mega is old slow and needs to be retired.. If it isn't due compatible.... your probably wasting your time
That's why I'm abstracting the design, it's a generic shield that can be used with any board.
Quote
Dust
2) its needs protection for idiots plugging endstops in backwards (and shorting 5v to gnd)
Ok, but if I add reverse polarity protection, then it won't be backwards compatible
Quote
Dust
3) stop using STP55NF06L's they are crap, especially for the bed
What mosfet would you recommend using ? IRLB3034 ?
Quote
Dust
oh god, not annother one... there are about 5 of these on the go atm...
Not any other board has these features.
EDIT : The thing is that there are no other boards that makes use of I/O expanders, so they're easily limited. For example, the Arduino Mega 2560 ($7.98) costs more than an ESP32 ($5.01) with 3 PCF8574T ($0.75), and that is including the price of the specific breakout board. That's 23+8*3 = 47 pins for the ESP32 (I removed 2 to account for the I2C line of the esp32) vs 86 for the Mega. You can use the slower PCF pins for things that don't change often, like Enable on the stepsticks or a LCD, and use the directly connected pins for all analog/step signals. The ESP32 is much faster than the Mega too.
Furthermore, they all try to focus on having a single board. While that is great, it doesn't allow for flexibility or upgrades. With this, you could have a mainboard holding the MCU and all AUX headers, then this board handles the repartition of the pins, and another board plugged on top is specific to what motor drivers you use, and could be done using a single perfboard in some cases.

Edited 2 time(s). Last edit at 03/08/2019 08:14AM by Moddingear.
Re: New board for the ESP32 : ESPIon
March 09, 2019 03:20PM
I added daughter boards for the drivers.
Footprint for the daughter boards is still TBD but now there are no jumpers required anymore for the TMC2130/2208.
Re: New board for the ESP32 : ESPIon
April 01, 2019 09:58AM
Hi Moddingear,
this seems like a very interesting project that you have started.

About expanders.
I do wonder if it is ideal to use the I2C bus for all the expanders. I wonder if it would be better to use shift register(s).

So far the one thing that I am aware of, that has been tested for either direct-pin-connection, or connection-with-expander-chips, for 3D printers, is the LCD.
Some speed tests have been done between using direct-pin-connecton, I2C, SPI and shift registers - and between the expanders, the shift register is the fastest.

Both I2C-bus and SPI-chips seem to have (clock) speed limits. Shift registers also have clock-speed limits, but they are typically (much) higher than the limits set by specific SPI-chips.


About backward compatibility
This is always an issue to consider. If changes - leading to improvements - will be desirable, even if they break backward compatibility. I do however think that improvements, that will not change functionality, are much to be preferred rather than just leaving things as they have been, if there are known "got'ya" issues with the design.


A few "improvements" I for instance have considered for end-stops are:

- to use color coded pins, so Vcc, GND, Signal pins are much more visible, when plugging in the switches.

- to use "keyed" sockets. This is the safest way, but it takes up a lot of PCB space.

- to add a resistor in the signal path.
This protects the signal pin from over-voltage situations. A 4K7 resistor will make most 3.3V pins 5V tolerant. A 20K resistor will make most 3.3V pins 24V tolerant.
At 24V a 20K resistor will allow a 1.2mA current, and perhaps most MCU pins will be able to sink 1.2mA of current without issue.

- to add a capacitor between the end-stop signal pin and GND.
This will help prevent some (if not all) electric noise problems that may occur on the end-stop switches.

- place all end-stops on an expander chip, where the expander chip has the ability to raise a signal pin, if any changes happen to the end-stop switches.
I think this is possible for both the PCF8475 chip and the MCP23xxx family of chips (MCP23008, MCP23S08, MCP23017, MCP23S17).
The one "something-has-changed signal-pin" from the expander chip can be tied to an interrupt pin on the MCU. This way an interrupt will occur, which can set an internal variable. Testing the state of an internal variable, is much faster than reading the state of a hardware pin.



Are you aware that the PCF8475 chip is rather crude in its High/Low design. The chip is by default in the output High state, because of a (weak) pull-up resistor. And in this "High" state the chip can not really supply any current to speak of (<4mA)
The LOW state does have a n-channel mosfet, and can sink a fair amount of current (<50mA).
But I think it is a primitive design. And it is a design where the power-on-state of each pin is HIGH.

The MCP23xxx family of chips are much more versatile. Much more programmable. And use proper digital input/output drivers for both high and low state of the pins.

The power-on-state of the pins on the Arduino DUE (MCU) is also HIGH, but it is again a "proper" digital high, and thus it is possible to use a semi-strong (4K7) pull-down resistor in order to achieve a power-on-state of LOW for the MCU pins.
A pull-down resistor on a PCF847 chip would put the pin in a permanent LOW state. So I would only consider using the (nice low cost) PCF8475 chip in some specific situations.



About a separate board for stepper drivers. I like that idea, as I think that we could all benefit from a more modular 3D print-controller design.

I wonder if it would not also be a good idea to have the mosfets on a separate board. This way it would be possible to use (smaller/cheaper) mosfets for the mosfet channels that would not require to be able to handle high currents.
And if a mosfet blew, it would be quick and easy to simply replace the mosfet board.

For a surface mounted mosfet, you might want to look at the IRFS7530-7P chip. It has a very low on-resistance.



Harden the thermistor pins - possibly making them 24V tolerant.

If you add a 20K resitor right before the analog MCU pin, then that pin will become voltage hardened, and be able to survive if a higher voltage (within limits) were to be applied to that input path by accident. You know, if, lets say, something were to melt/short at the hot-end and cause heater voltages to find their way to the thermistor wire.
The MCU pin basically draws no current. It only measures what ever voltage is there, so a resistor in series will have no (or very, very minimal) effect on what is being measured. But because a resistor will limit any short-circuit-condition currents to pass by, it will, in many, if not all cases, protect the MCU pin from an over voltage condition.


I notice that the LEDs for the mosfets are all powered from Vcc. I wonder if it would be interesting to power them from whatever power source is used at that particular mosfet.
When the LEDs are powered from Vcc, the LED will show if the mosfet is working.
If the LEDs are powered from the same power source as whatever is being driven by the mosfet, the LED will also show that everything is okay at that item. Meaning; the power source is working.
I have been successful in using a 2K resistor with the LED, and this works for both 12V and 24V supplies.

But essentially, how the LED is powered, and what you can read from the LED actually being lit, is a matter of preference.



I am not sure that I fully understand how you will populate the power management selection section of your design. But being able to select between a 24V and 12V power source for each mosfet is an intriguing idea.




I hope some of these comments can be of value to you, as you move forward with this very interesting ESP32 design.
Re: New board for the ESP32 : ESPIon
April 01, 2019 10:09AM
Are you aware of this project:
- [github.com] see also
- [github.com]

It is essentially Marlin for the ESP32. And it seems that he also has a preliminary prototype board (designed in KiCAD) ready to run this firmware.
Perhaps it would be interesting to find out what issues he has addressed, in order to get the ESP32 to run the Marlin firmware.
Re: New board for the ESP32 : ESPIon
April 01, 2019 02:27PM
Quote
MrAlvin
Hi Moddingear,
this seems like a very interesting project that you have started.

About expanders.
I do wonder if it is ideal to use the I2C bus for all the expanders. I wonder if it would be better to use shift register(s).

So far the one thing that I am aware of, that has been tested for either direct-pin-connection, or connection-with-expander-chips, for 3D printers, is the LCD.
Some speed tests have been done between using direct-pin-connecton, I2C, SPI and shift registers - and between the expanders, the shift register is the fastest.

Both I2C-bus and SPI-chips seem to have (clock) speed limits. Shift registers also have clock-speed limits, but they are typically (much) higher than the limits set by specific SPI-chips.
Are you aware that the PCF8475 chip is rather crude in its High/Low design. The chip is by default in the output High state, because of a (weak) pull-up resistor. And in this "High" state the chip can not really supply any current to speak of (<4mA)
The LOW state does have a n-channel mosfet, and can sink a fair amount of current (<50mA).
But I think it is a primitive design. And it is a design where the power-on-state of each pin is HIGH.

The MCP23xxx family of chips are much more versatile. Much more programmable. And use proper digital input/output drivers for both high and low state of the pins.

- place all end-stops on an expander chip, where the expander chip has the ability to raise a signal pin, if any changes happen to the end-stop switches.
I think this is possible for both the PCF8475 chip and the MCP23xxx family of chips (MCP23008, MCP23S08, MCP23017, MCP23S17).
The one "something-has-changed signal-pin" from the expander chip can be tied to an interrupt pin on the MCU. This way an interrupt will occur, which can set an internal variable. Testing the state of an internal variable, is much faster than reading the state of a hardware pin.

Wow, thanks a lot for the comment !
Yes shift register are much faster, but they don't allow input or anything, also when you want to change an output, you're forced to push out all of the bits.
I had already seen the MCP23xxx family, but I hadn't considered them, and they're much more fitting for the task. The S variants are also better, due to having the 8 addresses like I2C and having the speed of SPI.
I also have already hooked up the interrupt pins of the PCF8574 to the MCU, so i did that too with the MCP.
(I used the DIP variant of the MCP17S23 so if it blows swapping it out is easy)

Quote
MrAlvin
About backward compatibility
This is always an issue to consider. If changes - leading to improvements - will be desirable, even if they break backward compatibility. I do however think that improvements, that will not change functionality, are much to be preferred rather than just leaving things as they have been, if there are known "got'ya" issues with the design.

A few "improvements" I for instance have considered for end-stops are:

- to use color coded pins, so Vcc, GND, Signal pins are much more visible, when plugging in the switches.

- to use "keyed" sockets. This is the safest way, but it takes up a lot of PCB space.

- to add a resistor in the signal path.
This protects the signal pin from over-voltage situations. A 4K7 resistor will make most 3.3V pins 5V tolerant. A 20K resistor will make most 3.3V pins 24V tolerant.
At 24V a 20K resistor will allow a 1.2mA current, and perhaps most MCU pins will be able to sink 1.2mA of current without issue.
Harden the thermistor pins - possibly making them 24V tolerant.

If you add a 20K resitor right before the analog MCU pin, then that pin will become voltage hardened, and be able to survive if a higher voltage (within limits) were to be applied to that input path by accident. You know, if, lets say, something were to melt/short at the hot-end and cause heater voltages to find their way to the thermistor wire.
The MCU pin basically draws no current. It only measures what ever voltage is there, so a resistor in series will have no (or very, very minimal) effect on what is being measured. But because a resistor will limit any short-circuit-condition currents to pass by, it will, in many, if not all cases, protect the MCU pin from an over voltage condition.

- to add a capacitor between the end-stop signal pin and GND.
This will help prevent some (if not all) electric noise problems that may occur on the end-stop switches.

I added resistors to the signal paths going from and to the heaters and thermistors following your advice, but not on the other pins as they are just connected to the stepper drivers and servos.
Keyed sockets aren't as easy to be made as Dupont connectors, so I was thinking of using a 2*2-connector, where one pin is non-connected, but I still have to decide how to lay the pins on the header so that however you rotate the connector it does nothing

Quote
MrAlvin
The power-on-state of the pins on the Arduino DUE (MCU) is also HIGH, but it is again a "proper" digital high, and thus it is possible to use a semi-strong (4K7) pull-down resistor in order to achieve a power-on-state of LOW for the MCU pins.
A pull-down resistor on a PCF847 chip would put the pin in a permanent LOW state. So I would only consider using the (nice low cost) PCF8475 chip in some specific situations.

The pull-up provided by those chips is enough for a logic-high on all stepper drivers, and the pull-up is also good enough for endstops. I haven't tried with optical endstops though, only with mechanical and hall effect, so optical might need a Schmidt trigger, or a pull-up resistor.

Quote
MrAlvin
About a separate board for stepper drivers. I like that idea, as I think that we could all benefit from a more modular 3D print-controller design.

I wonder if it would not also be a good idea to have the mosfets on a separate board. This way it would be possible to use (smaller/cheaper) mosfets for the mosfet channels that would not require to be able to handle high currents.
And if a mosfet blew, it would be quick and easy to simply replace the mosfet board.

For a surface mounted mosfet, you might want to look at the IRFS7530-7P chip. It has a very low on-resistance.

I am not sure that I fully understand how you will populate the power management selection section of your design. But being able to select between a 24V and 12V power source for each mosfet is an intriguing idea.

I notice that the LEDs for the mosfets are all powered from Vcc. I wonder if it would be interesting to power them from whatever power source is used at that particular mosfet.
When the LEDs are powered from Vcc, the LED will show if the mosfet is working.
If the LEDs are powered from the same power source as whatever is being driven by the mosfet, the LED will also show that everything is okay at that item. Meaning; the power source is working.
I have been successful in using a 2K resistor with the LED, and this works for both 12V and 24V supplies.

But essentially, how the LED is powered, and what you can read from the LED actually being lit, is a matter of preference.

I hope some of these comments can be of value to you, as you move forward with this very interesting ESP32 design.

I've always wanted something more modular too.
But I think that going too far into modularity is just going to bring the costs up really fast, like having a board per mosfet. Instead, we could use swiss machine pin to slot them in, or some thing like that. Worst case scenario : THT mosfets aren't that hard to swap out.
About the power distribution, the idea is that if you want some part of your machine to run at 12V and another part of the machine to run at 24V, you can do it with those jumpers,and everything will be separated, it makes it so that you don't have to run 7 wires, instead you can run 2 or 3.
The current mosfet also has a very low on-resistance (it's rated for almost 130 A at a gate-to-source voltage of 3.3V, typical of 1.4mOhm at GtS = 10V). I think that's overkill enough.
For the LEDs, having a 2K resistors means that for some voltage it would be too bright, damaging the LEDs, and for others it would be way too dim, that's why I went with VCC (I switched that to +5V now to leave more power to the MCU).

Quote
MrAlvin
Are you aware of this project:
- [github.com] see also
- [github.com]

It is essentially Marlin for the ESP32. And it seems that he also has a preliminary prototype board (designed in KiCAD) ready to run this firmware.
Perhaps it would be interesting to find out what issues he has addressed, in order to get the ESP32 to run the Marlin firmware.

I've seen the code, and he's well implemented the core functions of the ESP32, but it looked like he had nothing to test it that would be practical, so I made that.


Thanks a lot for your comments ! thumbs up
Re: New board for the ESP32 : ESPIon
April 02, 2019 04:21AM
Quickly looking at the schematic:

Pins 34-39 on the ESP32 are input only pins so you'll need to swap those.

In the current configuration, you should protect the ESP pins (not 5V tolerant) from the expander I2C and INT signals since it is powered by 5V.

The schematic shows RX0 and TX0 pins tied together and used by the stepper module, but those pins (normally connected to the usb-uart chip on the dev boards) are needed to flash the firmware (unless you plan on using OTA for updates), and also send/receive serial if you plan on printing with USB.

EDIT:
I also just noticed the thermistor pullups are to VCC (which appears to be 5V?) instead of 3.3V.

Edited 1 time(s). Last edit at 04/02/2019 04:33AM by sdavi.
Re: New board for the ESP32 : ESPIon
April 02, 2019 02:13PM
Quote
sdavi
Quickly looking at the schematic:

Pins 34-39 on the ESP32 are input only pins so you'll need to swap those.
Ok, I put the interrupt of the endstops and the thermistors there instead.
Quote
sdavi
In the current configuration, you should protect the ESP pins (not 5V tolerant) from the expander I2C and INT signals since it is powered by 5V.
I interfaced with 5V powered chips before without using resistors and with I2C, didn't have any issues, but I guess better safe than sorry, so I added 4.7k resistors.
Quote
sdavi
The schematic shows RX0 and TX0 pins tied together and used by the stepper module, but those pins (normally connected to the usb-uart chip on the dev boards) are needed to flash the firmware (unless you plan on using OTA for updates), and also send/receive serial if you plan on printing with USB.
Actually I was thinking or removing the chip to update it, since most people don't have a computer near their 3D printer, but OTA could also work.
I thought that the usb-uart was connected on pins 3 and 5.
So I added a key that you can remove to flash the chip via usb, it's 6 pins so you can't put it the wrong way.
Quote
sdavi
EDIT:
I also just noticed the thermistor pullups are to VCC (which appears to be 5V?) instead of 3.3V.
Oops, changed it.

Also, now the unused pins of the I/O expander are broken out for filament runout/extra endstops.
Re: New board for the ESP32 : ESPIon
May 23, 2019 04:57PM
I've made the PCB design and i've started ordering the components to test it.
PCB is 100x100mm so that ordering it at jlcpcb you still get the 2$ offer.
In total, ordering everything in bulk, I paid about 12$ for the components, so it's looking to be not that expensive, could be looking at 20 dollars for the full pack.

Enable pins for the stepper motors are now in the header for the daughter stepper boards, but I think it's wiser to not add the enable I/O expander directly to the motors daughter board, instead i'll add it as an intermediary board that can be placed between the motor daughter board and the main board.
Re: New board for the ESP32 : ESPIon
May 24, 2019 02:51AM
I've not seen anyone use through hole DIP chips for final designs in a few years now, it's pretty much all surface mount these days.

For those who are not used to working SMT chips, it's not as difficult as you might think.

To solder a SMT chip, all you really need is ..
  • A soldering iron.
  • Solder.
  • Decent flux.
  • Desolder wick (copper braid type stuff).
  • A little isopropanol alcohol (amazon or such like).
  • Maybe a cheap LED ring lit bench magnifier if desired.

Then all you do is ..
  1. Flood the pins (chip in place on board) with just enough solder and flux (short any many-to-all as you want).
  2. Use the desolder wick to wick the solder back up - until you no longer see any shorted pins and the joints look proper.
  3. Clean off the flux with the isoprop.

You'll be left with a nice and clean pretty much perfectly soldered chip. I'd much prefer a SMT chip to a big through hole chip these days, through hole DIP's take up loads of space. But saying that, they are easy you're right.

I wonder why you chose the ESP over say an STM32F4/7 (or whatever 32-bit chip) with already enough pins to not start using expander chips ?

Edited 2 time(s). Last edit at 05/24/2019 02:57AM by Pippy.
Re: New board for the ESP32 : ESPIon
May 24, 2019 11:30AM
Quote
Pippy
I've not seen anyone use through hole DIP chips for final designs in a few years now, it's pretty much all surface mount these days.

For those who are not used to working SMT chips, it's not as difficult as you might think.

To solder a SMT chip, all you really need is ..
  • A soldering iron.
  • Solder.
  • Decent flux.
  • Desolder wick (copper braid type stuff).
  • A little isopropanol alcohol (amazon or such like).
  • Maybe a cheap LED ring lit bench magnifier if desired.

Then all you do is ..
  1. Flood the pins (chip in place on board) with just enough solder and flux (short any many-to-all as you want).
  2. Use the desolder wick to wick the solder back up - until you no longer see any shorted pins and the joints look proper.
  3. Clean off the flux with the isoprop.

You'll be left with a nice and clean pretty much perfectly soldered chip. I'd much prefer a SMT chip to a big through hole chip these days, through hole DIP's take up loads of space. But saying that, they are easy you're right.

In case you blow a component you can easily switch it out. And you don't have to remove the whole board in order to flash a new version in.

Quote
Pippy
I wonder why you chose the ESP over say an STM32F4/7 (or whatever 32-bit chip) with already enough pins to not start using expander chips ?

The ESP is very cheap, and with the STM that would be almost doubling the cost of the board.
Also it has WiFi which mean that by giving a LCD and SD card it could print via wifi.
And you can update the code with OTA.
(Also there's the ESP32-S2 coming soon)
Sorry, only registered users may post in this forum.

Click here to login