Keep nuking my D1 Mini's

Need some advice please… using a D1 Mini, ESPHome software, two push button switches on D6 and D5 (ground to D8); ULN2003 stepper motor on D1, D2, D3, D4.

To power it, I’m using a 5V power supply (300W which also powers my LED’s). I have one feed that comes from the power supply that splits - + and - to the D1 mini ports (5V and GND) and a + and - to the ULN2003 driver that in turns controls a 28BYJ-48 stepper motor to control the tilt action on my 12 blinds in my conservatory (sun room).

Everything works okay, however, a few power cycles later, I have noticed I lost two D1 mini’s. So I’m doing something wrong.

My earlier design I was powering the D1 Mini via a 5V USB cable, then powering the ULN2003 from the 5V and GND pins from the D1. But I lost 10 out of 12 D1 Mini’s over time. I read somewhere that I shouldn’t power the ULN2003 from the D1 Mini but have its own power supply.

I’ve attached a crude diagram of my current iteration. Welcome feedback and suggestions please.

First off, I’m wondering how 5V is enough to power the stepper motor. Some of those want 12 or 24 volts.
Your buffer - the ULN2003 - seems content to handle anything in that range, while still accepting TTL signals for control, a great combo.

So, what specifically is telling you that the ESP’s are burning out? Maybe nothing’s happening because the stepper is underpowered.

Please make sure you are using the 5v variant, because the 12v vs 5v have the same model number. I have been using a 5v version with D1 mini for quite a while now with my shades, and haven’t lost one yet. You are using the same power supply that you are lighting your Leds with, and 60 amps should be enough for most things. But, you should make sure you have done the calculations for your leds power draw. If you are running close to the limit, you could be causing brownouts, which over time can destroy your D1 Mini.

1 Like

Also, beware that many D1 mini ‘clone’ boards use a lower-capacity voltage regulator and cannot provide the current available from an authentic Wemos/Lolin D1 mini.

I believe that the IO pins for the D1 mini are limited to 3.3 vdc, if power is being feed back to any pin other than 5 volt input you will fry the D1 mini (I have lost a couple of them).

As far as driving a stepper motor I recommend that you consider something like one of the boards from Pololu they make many different ones. Some are feed via serial and can run up to more than 18 model aircraft servos, maybe more if chained together from a single ESP that provides step and direction signal. They start at about $6. Pololu Stepper Driver. This link has a lot more selection and a lot of information as well Additional boards and information.

2 Likes

Hi
They are not powering on. And when completely removed from the unit with nothing attached to GPIO pins, it’s not powering up or seen by the computer. So I assume they are dead. The stepper is 5V as is the driver board which can handle 5/12V.
PJ

Hi,
Thanks for replying. I have calculated the LED draw, I have 546 LEDs in strips controlled by WLED. I also have the power supply plugged in to a smart plug flashed with Tasmota and I monitor the draw on there. Generally I’ve had the LED’s off when using the blind motors too, so the draw is low.
PJ

I’m running the same setup (D1 mini, uln2003 and the 28BYJ-48) for my blinds for a few years and no issues so far. I even drive 2 steppers from the D1 directly using an USB power supply. I don’t see any issue with your setup. However there are 2 possible explanations that I can think of: 1. A faulty power supply that may spike the voltage on power-on/loss. 2. Are you perhaps saving the current position of the steppers to persistent memory in the ESP? Excessive writes to the flash memory may also kill your D1 over time.

1 Like

They are indeed designed for 3.3v logic but perform perfectly fine with 5v logic (within rated current limits) for me.

The esp82xx has snap-back circuit on all gpios that kicks in when a voltage of about 6V or more is presend. In theory this should protect from over voltage but probably only works reliable (in terms of not damaging components) when no or only a minimal current is attached.

Connecting a 5Vdc power supply to a gpio pin or the 3.3v rail of a esp82xx will most likely fry the little thing :fire:

I did have an additional idea, If you are driving stepper motors you maybe getting an inductive kick when the motors stop. Maybe worth adding a diode into the positive lead to the ULN2003 to block any spike into the D1 Mini.

No it won’t. The snap back only kicks in at ~6V and will hold at 5.8V according to the datasheet. Since the input isn’t shunted at 5V, the current potential of the source is irrelevant at that voltage. It also shows that ESPs are 5V tolerant on gpio, since the snap back / zener ESD protection has a holding potential of 5.8V (which apparently Espressif considers safe, or they would have used different thresholds). You could connect a 10kW 5V source to an ESP gpio and it would be perfectly fine.

Connecting it to the supply rail will indeed fry it though.

Edit: If I remember correctly the CEO of Espressif confirmed that gpio 5V tolerance somewhere (can’t remember where though) and said it wasn’t in the datasheets anymore because people mistook it as 5V supply voltage, which isn’t supported.

1 Like

ULN2003 seems to have internal freewheeling (flyback) diodes.

Sadly this was only communicated on Facebook. Interestingly he even confirmed (years later) that the esp32 is also 5v tolerant.

1 Like

Maybe they do happen to be 5V tolerant, and if so that’s great news for the “ooops, I forgot” moments that inevitably happen to us all.
But if the primary datasheet says it’s 3.3v, then that’s what I’d build for.

There is no power being fed back to any of it’s pins (D1 to D4) in this setup, right? The ULN2003 just has a NPN Darlington pair with a resistor to limit the base current.
image

The only concern with feeding it with 3.3 V instead of 5 V would be that the transistors might not have enough base current to go into saturation. But that would just cause the driver to overheat and die, it should not kill the MCU driving it.

That circuit should protect the driver.

The way I read the data sheet that you attached, that input should be good.