# Soft latching circuit, selecting low-dropout voltage regulator (LDO), data logging

Joined Dec 21, 2015
67
I am planning to build this Low Energy IOT Door Sensor. The idea is to stick it in a professor's door to see when he's available. (It's an issue waiting outside his door all the time.)

I think I can set up another ESP8266 to receive the signal, and log the data with an Arduino. Besides the questions below, I'd appreciate any pointers on the device-to-device communication and data logging. I plan to work that out when building/experimenting with my little experience with ESP8266 and NodeRED hoopla. I'm also just doing this for the learning experience, but it'd be better if the actual application is fruitful.

Brass tacks
The main thing I want to understand is the low dropout (LDO) linear voltage regulator. It seems that the $1.14 AMS1117 is what people are using. But then I find this 38 cent AP7370. I wonder about the difference in specs: LM1117 AP7370 Voltage Dropout (Max) 1.2V @ 800mA 0.6V @ 100mA Current - Output 800mA 300mA Current - Quiescent (Iq) 5mA 2.5µA Current - Supply (Max) 10mA 300µA So I read these pages: Voltage Dropout (Max) The LM1117 is just over a volt at 100mA. So the AP7370 is better, "the smaller the dropout voltage, the greater the useful input voltage from the battery and therefore the longer the run time." [1] Defined, "voltage drop across the regulator where the device can no longer regulate the output voltage." [2] Current - Output The LM1117 has a higher maximum it can provide. Will that four-terminal node in the circuit go over 300mA? Calculated as 3.3/(110k) or how can that node be analyzed? Also, the maximum current drawn from a GPIO pin is 12mA (for the ESP8266-01). Would that change..... Mostly, how much current will the circuit draw? Current - Quiescent (Iq) Less is better: "current consumed by the regulator when it is not supplying load current." [3] The AP7370 wins. Current - Supply (Max) Maximum current supplied by the battery? Is there a way to test this? It's from a$8.88 ~100 mAh battery on Amazon: 4.2 V when completely charged to 3.7 V.

TMI
Before I wandered across the Instructable above, I was looking into creating a continuity tester, transmitter and receiver using the Beetle (smallest Arduino). The thought was to have the door's metal plate complete the circuit (continuity), log the data, then send the signal. This way a sleep mode could be used...

#### RPLaJeunesse

Joined Jul 29, 2018
91
My suggestion: Replace Q1 above with a pair of BSS138 logic level NMOS switch FETs, one driven by SW1 and one driven by GPIO0. No need for D1, D2, or R5. R2 helps keep the switch side BSS138 less ESD sensitive, but could be deleted as well. Raise R3 to 100K and the whole thing takes only a few tens of uA when on, only a uA of leakage (if that much) when off. For this application the MOSFET based AP7370 is a good call, you don't need the higher current of the LM1117, which is bipolar junction transistor based - hence the higher quiescent.

Joined Dec 21, 2015
67

Like this?

#### RPLaJeunesse

Joined Jul 29, 2018
91
Not quite. M3 gate hooks to GPIO0, M3 drain to M2 drain.

#### RPLaJeunesse

Joined Jul 29, 2018
91
Just noticed the GPIO2 connection - could be a problem. If VCC to micro is off then GPIO2, via an internal diode to VCC, may keep M2 from turning on (and VCC from turning on) when S1 closes initially. Consider using another BSS138 like M3, driven by GPIO2, with drain tied where GPIO2 shows now. To save battery bump R2 to 47K and R4 to 470K.

Joined Dec 21, 2015
67
I don't understand why GPIO0 drives a gate, while your new suggestion for GPIO2 drives the drain.
GPIO0 is the power signal pin. GPIO2 is the reed switch signal.

...seems like every configuration has the ~1.5 V on:

#### RPLaJeunesse

Joined Jul 29, 2018
91
Let's step back, ignore what you just did, and start over with the Thursday circuit. Disconnect GPIO2 from the circuit. Add another BSS138 as M5. Connect M5 source to common/ground. Connect M5 drain to node of R2, R4, M2, I2 (note: NOT GPIO2). Now connect GPIO2 to the gate of M5. That's what I meant.