2

As some of you know GPIO0 is a special pin that needs to be pulled HIGH during start-up else the ESP07s enters flash mode.

GPIO0 pulled high connected to the INPUT1 of a ULN2003 with a, COM is 12V, GND is GND, load connected to +12V and OUTPUT1

Questions:

  1. The pull-up to 3.3V works right? My thinking is that if I have GPIO0 as and output and go HIGH it will output 3.3V, the input to UNR2003 will get 3.3V = HIGH. When outputing LOW on GPIO0 it will become 0V and the 3V3 voltage will be "pulled into" GPIO0, which results in 0V to UNR2003?
  2. Any obvious mistakes in the schematic?
  3. Do I need to add a resistor before input of UNR2003 to increase current to make it handle bigger load? How do I know what the current is without resistor? How do I size the resistor? Do I read the datasheet correctly, At 100µA input current, the corresponding output can handle a 400mA load?

Collector current vs Input current

Megamannen
  • 35
  • 5
  • 1
    Thank you for taking the time to ask your new question in a new thread (instead of in a comment in a previous thread). As you can see, it has resulted in people giving you great answers, something that would not have happened if I had tried to address your question in your comment in your previous thread. Your action helps you and adds value to this community. Thanks. – Davide Andrea Aug 31 '23 at 13:32
  • Note that if the ESP fails to start up properly somehow, the pull-up will enable the ULN2003, powering the motor constantly. Is that acceptable for your project? – marcelm Sep 01 '23 at 11:33

3 Answers3

3

Your circuit looks about right, but keep in mind a couple of things:

  1. GPIO0 usually has an internal pullup, therefore the resistor might be redundant
  2. Pulling up the input of your motor driver will spin up the motor. This might or might not be acceptable in your particular application.

GPIO0 is part of a list of what is known as strapping pins. Their status is sampled at PoR, and determines the startup mode and other basic settings of the chip. Some of the strapping pins have eFuses overrides, so you can burn a special configuration in your chip and the strapping pins are ignored.

Using strapping pins that can (and will) show a glitch during startup is generally discouraged, unless you can accept the glitch. Here you show a motor connected to the output of the driver, I suspect that a glitch is undesirable.

GPIO0 in particular is the most special of all the strapping pins, and the last one I would use on any design.

To actually get to your specific questions:

  1. Yes this works as you describe it - more or less :)
  2. No
  3. Usually the resistor is included, but it might depend on the specific ULN you have. Can you include a datasheet? Anyway, you read the graph correctly, but do not worry about that - as long as you provide some current to the input, you will be okay.

Let me stress again that the circuit you have drawn will work without any problems, but the motor is normally on, not normally off.

Vladimir Cravero
  • 16,007
  • 2
  • 38
  • 71
  • Thanks for the clear explanation. As I understand it and I think you verify it, that until the program has started and I've turned the GPIO0 into an output the motor (fan motor in this case) will turn-on briefly, which is okay in my case :) I have not decided on a component since I barely know what I'm doing. But I looked at the ULN2003A https://www.ti.com/lit/ds/symlink/uln2003a.pdf – Megamannen Aug 31 '23 at 12:56
  • If at all possible I suggest to avoid GPIO0 @Megamannen this is going to give you only headaches. – Vladimir Cravero Aug 31 '23 at 14:06
  • Hehe, I yearn to learn. I only have headache pins left. GPIO0, GPIO2 (also strapping pin) I theory I can free-up GPIO1(TX) and GPIO3(RX), maybe it will give me less headache – Megamannen Aug 31 '23 at 17:03
3

It means the output current will be 400mA, but sadly that does not mean that the chip will 'handle' that load, rather it will quickly burn out because it is not fully saturated and thus dissipating a great deal of power. I would not suggest using this chip for a 500mA resistive load (let alone a motor load with start-on surges)

enter image description here

As you can see, under the given (reasonable, IMO) conditions, a single output is limited to about 350mA with 100% duty cycle (assuming no other outputs are in use). That's the D (SOIC) package, the DIP package can shed more wasted heat so it's capable of more current.
The ULN2003A is a bipolar Darlington driver chip so each output has a lot of drop even when it is properly driven.

You would be far better off to use a small MOSFET and a diode, with your 10kΩ pullup. With ~50mΩ Rds(on) the MOSFET will dissipate less than 13mW, so it will run cold. At 1.5V drop for the ULN2003 you'd get more like 750mW dissipation and the motor would only see 10.5V rather than 12V.

As to the ULN2003A, adding a resistor at the input decreases the drive to the Darlington, it's already a bit marginal at 3.3V (the ULN2003A was designed many, many years ago and aimed more at 5V drive, other variants are optimized for high voltage PMOS etc.) Your 10kΩ pullup decreases the drive even more and may result in the chip burning up more-or-less immediately.

schematic

simulate this circuit – Schematic created using CircuitLab

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
  • Uff, look at my other question where I tried to use a MOSFET, and I was pointed to this kind of component (but I'm a noob and might have misunderstood something) https://electronics.stackexchange.com/questions/679515/driving-a-12v-500ma-load-with-a-3-3v-logic-level-special-pin-gpio0-on-a-esp07s – Megamannen Aug 31 '23 at 12:52
  • 1
    The suggestion is for a low-side switch, not a high-side switch with P-channel MOSFET as shown in that question. The ULN2003A is a low-side switch and an N-channel MOSFET (with suitable characteristics, as linked above) can do a similar thing. See edit above with schematic. It *must* be a logic-level MOSFET with Rds(on) specified at 3.3V or less (2.5V in the case of the above-mentioned MOSFET). – Spehro Pefhany Aug 31 '23 at 12:58
  • 1
    FWIW, ULN2003LV exists, which is basically 7 MOSFETs in one package – Vladimir Cravero Aug 31 '23 at 14:26
  • Correct me if I'm wrong, but it seems like ULN2003LV can't handle 12V and it can only handle 180mA per channel, I might get away with 200mA per channel, but that is cutting it close. – Megamannen Aug 31 '23 at 17:16
  • What is the purpose of the diode, why is the connection there at all? @SpehroPefhany – Megamannen Aug 31 '23 at 19:38
  • 1
    The diode is there to protect the transistor from energy stored in the motor inductance. The ULN2003A has diodes for similar reasons (connected to the COM terminal- it's not used for anything else). – Spehro Pefhany Aug 31 '23 at 19:49
  • 1
    Sorry guys - it is entirely possible that the LV version is not okay for this specific application. I am guilty of just skimming *very* quickly through the datasheet. – Vladimir Cravero Sep 01 '23 at 06:34
3

ULN2003 input is a load, basically a 2k7 resistor to base of darlington transistor. It will form a voltage divider with the pull-up resistor.

Having a pull-up of 10k to 3.3V would not bring the IO port voltage much above 2V, and that is not a level for 3.3V input.

It needs to be much stronger to allow the voltage to go near 3.3V.

  1. Pullup is needed
  2. 10k is not good, stronger is needed
  3. no series resistance needed, it will just limit the drive to ULN input.
Justme
  • 127,425
  • 3
  • 97
  • 261
  • Probably don't know what I'm talking about again.... But if the GPIO0 is outputting 3V3, how can the internal 2k7 be divided with the pull-up? – Megamannen Aug 31 '23 at 17:20
  • 1
    @Megamannen I was talking about the scenario where the GPIO pin is not yet an output as the MCU is starting up and the resistor is responsible for pulling the pin high for the MCU to read the pin and boot into correct mode. So if the pin has to be high during MCU boot, the ULN tries to pull low and resistor tries to pull high. Of course when MCU has booted and your code has set it to an output, it will either be high output or low output. – Justme Aug 31 '23 at 18:43