Electronic – How to power ESP8266 from changing voltage

esp8266home-automationpower electronicsvoltagevoltage-regulator

So I'm very new to electronics of all sorts, have done some basic repairs but I'm interested in learning more.

The project I have in mind is to use the cheap and easily available Doit NodeMcu Lua ESP8266 ESP-12E to send me a push notification anytime the door buzzer is rung. I would like to embed this project inside of the internal phone housing in my apartment and use the wifi to send the notification.

My door buzzer seems to receive a voltage of 4.4v when idle, when the door bell is pressed that changes to 13.3v.

My questions are:

  • Can I somehow use the 4.4v to power the ESP? How do I safeguard it from the increased voltage when active? Some sort of voltage regulator that would still allow the buzzer to be rung?

  • How do I use this voltage change to create an alert? I know I can, but do I need additional sensors or will the ESP be able to handle it?

Here are some images of my door phone http://imgur.com/a/H0GJU

If anyone can draw me a fritzing diagram or similar I'd be very grateful.

Other information.

  • I'm using Pushover which I understand only allows HTTP (not HTTPS) with these units.
  • I live in Denmark.
  • I have access to a hackerspace for basic supplies.

EDIT: I think that a 3.3v voltage regulator IC would allow me to do the powering part, would you use a wire-tap style connector to add it in from the +ive buzzer wire?

Best Answer

The ESP-12E can be powered from a higher voltage by using a voltage regulator.

The voltage regulator Vout needs to suit the required ESP-12E supply voltage (presumabaly 3V3). The regulator needs to be able to operate with Vin comfortably above 14V. (eg probably 20V + )

Energy sources:

(1) If the 4V4 level can supply enough current to charge a capacitor via a schottky diode this may be a suitable supply. If this was followed by a regulator it would need to be an LDO (Low Dropout Voltage) regulator as Vin - Vout is under 1V. The regulator input could be arranged to either turn off when 13V3 was present or to tolerate the 13V3 level.

(2) If the 4V4 does have enough current capability to charge a power supply capacitor then the 13V3 probably does. If so then you can power the ESP from a capacitor charged when the button is pressed so it gets a long enough period to transmit even if the button press is very short.

Note that ESP current drain can be quite high and any reservoir capacitor, regulator and voltage source has to take account of this.

(3) Easiest of all is to use a battery to power the ESP-12E and trigger it from the 13V3 when it occurs. As current is drawn only when transmitting the battery load is low overall. eg 3 r 4 x AA Alkaline cells and an LDO regulator would probably last for years in most doorbell applications.


Bell push sensing:

Input sense can be a resistor divider eg 10k:2k7 divider (10k in series wity 2K7 to ground. Input to 10K, output from junction of 2 resistors) gives ~= 2v8 out with 13v3 in, and 1V with 4v4 in. This may be seen as high/low by the ESP-12E or you may ned to play. Vhi_in must not exceed the ESP-12E Vdd.

Or you could use an optocoupler - resistor from Vin to opto-in to ground.

Or ...


Tell us:

Knowing how much current is available at 4V4 and 13V3 will be extremely helpful. Experiment will help you to know.

Find ESP-12e max current draw and current profile across the required transmit cycle.

How long do you need the ESP to be powered per button press?

__________________________________________________

Useful Q&A:

I tried to measure current to be able to work out the resistors needed to hook up the +ive to the ADC, when measuring at 4.4v it is 0mA (as you said) at 14.4v it's 306mA.

So that means I can't keep it powered at idle, and would need a capacitor (any suggested specs?)

But would I even then need an input sensor? Can I just tell the ESP that whenever you turn on, send notification then sleep?

Re How long would it take to boot, connect to wifi and send the message? No longer than 5-6 seconds?

Is the 306 mA the available current or the ESP demand?
Note that the ESPs draw very high current at some points in a TX cycle.

As a guide, 1F drops 1V in 1s when drained at 1A.
So 1000 uF drops 1V in 1s when drained at 1 mA.
You can drop from 13V3 to say 5V3 for regulator input so you have 8V allowed droop.

For 6 seconds TX you need 1000 uF x 6s /8V at 1 mA ~= 0.75 uF per mA. Say 1 uF/mA min. So for eg 200 mA AVERAGE you need 200,000 uF !!!
Too large for normal capaciors. You'd need a supercap.
So a say 1F at 3V3 should be very ample.
Depending on what is availale you may need to put two caps in series to get even a 3V3 voltage rating. Capacitance is eg 0.5F for 2 x 1F in series.

If you use a buck converter you'll get better utilisation. Note that IF you need say 200 mA x 6s avg = 1200 mA seconds and if button press is short then all that current must flow into cap during button press. so eg
1S press - 1200 mA.
0.2S press = 6A. (Ouch).

Easier is to use a battery and have the doorbell voltage as trigger only. If you use an optocoupler then you are isolated from the 13V3. Not essential but it all helps forestall Murphy.

306mA is the available current when the buzzer is activated. I think with the help of your maths that I've realised that I'll be forced to use a battery for power as you said, along with the voltage change for a trigger. I'm assuming I could then leave the unit to deep sleep until triggered and something like a spare 2000mAh usb battery connected to the usb input would last a reasonable time (doorbell isn't used a huge amount). I know this is not the most efficient method to power it, but it should be simple enough for others to be able to maintain.

Regarding the octocoupler, would I simply need to find one that has an input range suitable for < 4.4v and => 14.4v as well as having a maximum output voltage of 1v. Would this allow me to reliably trigger the ADC? (I assume it would receive the same voltage each time, 1v, from the octocoupler)

Input to optocouplers in most cases is an LED - usually IR so often under 2v operation. They are specified by current required to operate (and not by voltage) and you arrange circuitry (usually just a resistor to suit).
eg say a given opto has 2 mA min operate and 10 mA max allowed you may decide to run it at 5mA.
If V_LED is say 1.5V then at 13.3V a series resistor must drop
Vdrop = (13.3-1.5) =~11.8V.
For 5mA R=V/I = 11.8/.005 = 2360 Ohms.
You could use eg 2K2 or 2K7.
With 2K2, the current at 4.4V = V/R
is about (4.4-1.4)/2K2 =~ 1.4 mA = below min operate current so OK.

There are a number of other ways of doing this. Adding a series say 4V7 zener to the input circuit in series with the resistor means you need over 4V7 for any useful current to flow, making distinction between Vlow and Vhigh much easier.

Opto out is usually a transistor on/off switch.
You probably want input to ESP to swing most of supply (and can use a logic input - ADC not necessary).

So - transistor emitter to ground. Resistor 2K2 from collector to ESP-Vdd (3V3) and resistor-collector common point to ESP input.

That arrangement causes the ESP input to go low when button is pressed.
Swap resistor and opto-transistor (collector to Vdd, emitter to resistor, other end of resistor to ground) to have ESP input go high when button pressed.

DRAW THE ABOVE AND UNDERSTAND HOW IT ALL WORKS !!!!!