2

(Okay so I've been informed that you're supposed to edit your existing post and not make a new one even if you want to change the question, so just FYI for anyone reading the comments, this is slightly different than what was originally here.)

This is a new version of the old question that should be more specific/answerable. I think I gradually figured most of this out, and the schematic has more notes in it now to explain.

P-Detect and P-Hold go to the Arduino. First, the PWR button is pressed, turning on the active-low enable line to the regulator. Then after a specified hold-time to turn the device on, P-Hold holds the power to the regulator on, and finally, P-Detect detects if the button is pressed again once the Arduino is on.

However, the problems come in with that pull-up R24, which I can't really skip. It pulls the line up to the battery voltage, which could vary from 18V up to 50V depending on number of batteries (24V/36V/48V).

Unfortunately even the lowest of those voltages is way too high for the Arduino (the enable line of the regulator can tolerate Vin fine.)

I managed to protect P-Hold with a small N-MOSFET, but as for P-Detect, well I can only find MOSFETs that can handle a Vgs of +/-20V, which is a problem for connecting gate to 50V.

So instead I'm thinking of using a Zener diode voltage regulator. If I use a 5V Zener backwards from P-Detect to GND, that would pull the voltage down to 5V at P-Detect, correct? But it will also basically short 5V-EN to GND unless I use a very large value resistor between the Zener and D5/R22.

From what I calculated, 3M ohm should work (I'm using a 3M ohm resistor elsewhere in the circuit so it'd be convenient.) Would reading the state of the button through that large a resistor have disadvantages?

Arduino Power Switch

JRE
  • 67,678
  • 8
  • 104
  • 179
Pecacheu
  • 223
  • 1
  • 6
  • As drawn, not it is not safe. It could be made safe with some sort of diode clamp arrangement, but details of that or determining if it would even *work* would require including the regulator and Arduino pins in the schematic. Beware many modern regulators won't accept 30 volts, and those that will may see substantial thermal load as five times as much power will turn into heat in the regulator, as actually passed through to the Arduino. – Chris Stratton Oct 19 '20 at 15:14
  • Yeah, I did check the regulator datasheet in the "absolute maximum ratings" section to make sure, and it say the EN pin is tolerant from -0.3V to Vin (Vin being 30V of course). As for the Arduino, it's just a standard digital I/O pin. I'm not sure how to make a diode clamp. – Pecacheu Oct 19 '20 at 15:21
  • The regulator also has built-in thermal protection and current limit so I think it should be safe, I'm just using the recommended schematic in the datasheet. It's one of those chips that has almost everything built-in so it really only needs an external coil and some resistors. And it can go up to 50V – Pecacheu Oct 19 '20 at 15:24
  • 2
    @pecacheu unless you design for survivability, NEVER read the "absolute maxima"! That section shows the values that *will not instantly kill*, which is different from *what will work*. – Wouter van Ooijen Oct 19 '20 at 15:27
  • You need to *actually show* the connection to the regulator and identify it, and the connection to the Arduino, too. Otherwise, what's the point in asking a question? – Chris Stratton Oct 19 '20 at 15:30
  • 2
    The 30V would feed power power into Arduino via the IO pin. There is only 0.3mA available current, but it might rise the voltage enough so MCU starts running and then it can't because voltage drops due to current consumption. Basically, you should put a FET or transistor between unpowered IO pin and 30V. Or at least a voltage divider. – Justme Oct 19 '20 at 15:31
  • If the desired functionality is "OR" and the 30 volt presence doesn't need to be an input to the Arduino, then you might consider diodes to deal with @Justme's observed concern. But this is unanswerable without full details of the power supply/control circuit including the regulator and the needed functionality; voting to close. – Chris Stratton Oct 19 '20 at 16:17
  • 1
    @Chris Stratton Already updated with a new schematic – Pecacheu Oct 19 '20 at 18:06
  • What exactly is D4? It sure looks misapplied. What does P-Detect come from or go to? Your update seems to have left as much newly unanswered as it clarified; not only were these things needed from the start, more information is still needed. – Chris Stratton Oct 19 '20 at 18:09
  • 1
    I just added D4, though it might protect the other Arduino pin, P-Detect, which is supposed to detect additional button presses after the Arduino is turned on. Though I guess the way it's facing it wouldn't... I dunno, I added it just then. – Pecacheu Oct 19 '20 at 18:23
  • 1
    It would at least prevent P-Hold from holding P-Detect though. – Pecacheu Oct 19 '20 at 18:30
  • _" I did check the regulator datasheet in the "absolute maximum ratings" section to make sure, and it say the EN pin is tolerant from -0.3V to Vin (Vin being 30V of course)."_ - this datasheet says EN is 7V abs max. http://www.xlsemi.com/datasheet/XL7005A%20datasheet-English.pdf – Bruce Abbott Oct 21 '20 at 02:31
  • That's uh... somewhat weird. Says -0.3 to Vin clear as day right here, the datasheet listed at where I'm buying the part from: https://datasheet.lcsc.com/szlcsc/1811081614_XLSEMI-XL7005A_C50848.pdf The specs are also different yet the part number is the same. Mine says max duty cycle 90%, yours says 100%... Lol WTF are they smoking over there are XLSEMI? How does the specs of a part itself change from a datasheet revision? – Pecacheu Oct 21 '20 at 19:39

1 Answers1

1

So I'm not sure if this is a final solution/answer, but it seems pretty solid.

Based off @Bruce Abbott's comment that the regulators possibly can't take over 7V at the EN pin, I realized I could move my Zener diode regulator over to the pullup side. Then I can connect the Arduino pin (P-Detect) directly to the button like this:

Arduino Power Switch

Pecacheu
  • 223
  • 1
  • 6