0
\$\begingroup\$

Original situation I live in an apartment with a 12VAC intercom/open button for the street door.

Current situation I've wired a normally-open relay, linked to a NodeMCU, across the terminals for the open button. This works fine and I can now remotely open the street door. The NodeMCU is currently powered by a 9V battery and draws around 15mA.

Desired situation I don't want to rely an a battery that I will exhaust, so I'm thinking of one of the following, and please feel free to recommend one or the other, or any other alternative approaches.

Option 1. Power the NodeMCU from the intercom. I understand I can use a bridge rectifier to produce a nominal 12VDC which I can pass through a small regulator to get a stable voltage to power the NodeMCU. But If I do this, won't I effectively be closing the switch circuit and thus permanently opening the door?

Option 2. Continue to power the NodeMCU by battery, but have it deep sleep, only to be awakened when the street doorbell is pressed. I understand I can do that by applying a voltage to RST. I'd appreciate any hints on how not to fry my NodeMCU by applying too much voltage with this approach.

\$\endgroup\$
  • \$\begingroup\$ Option 1 is good, but you should test how much current you can draw before the switch registers as closed and see if your controller will fit within that limit. \$\endgroup\$ – awjlogan Dec 4 '17 at 15:12
  • \$\begingroup\$ Why not the obvious of powering the processor from a separate wall wart or something running off of regular line power? \$\endgroup\$ – Olin Lathrop Dec 4 '17 at 15:37
  • \$\begingroup\$ @OlinLathrop Seems silly if there's already power at the point of use. Why would you have a separate power supply for a telephone, for example, when there's power available from the line? \$\endgroup\$ – awjlogan Dec 4 '17 at 15:44
  • \$\begingroup\$ @awj: Because drawing power from that line may be part of the protocol, and not so easy to do without some smarts. That seems to be precisely the OP's question. \$\endgroup\$ – Olin Lathrop Dec 4 '17 at 15:51
  • \$\begingroup\$ @OlinLathrop Hence my first comment, rather than an answer. \$\endgroup\$ – awjlogan Dec 4 '17 at 15:52
0
\$\begingroup\$

At a guess, your original door switch wiring looks like this:

schematic

simulate this circuit – Schematic created using CircuitLab

V1 is your 12V AC, presumably from a transformer secondary, and L1 is the solenoid coil that opens the door. SW1 is your door opening button and - if this is a shared street door for more than one apartment - is probably connected in parallel with everyone else's door open buttons.

Powering your circuit from the door switch AC

What you're thinking of doing is this:

schematic

simulate this circuit

First of all, the rectified DC voltage will not be 12 V, it'll be more like 16 - 17 V, because the capacitor charges up to the peak voltage of the AC waveform which is root 2 times the RMS AC voltage. Actually, you may find it's more than that because of voltage fluctuations in the AC line and imperfect regulation of the transformer. That's OK, because standard voltage regulators can take up to 30 or 35 V, but make sure your capacitor has a suitable voltage rating.

Second, when your micro switches the relay on, it shorts out its own power source! This isn't the disaster it might seem at first because the bridge rectifier means this doesn't short out the capacitor. However the current demand of your micro (and the voltage regulator) will start discharging the capacitor, at 1 volt per Farad per amp, until it goes below the dropout voltage of the regulator and at that point Vcc to your micro will drop and it will reset or if you're unlucky, lock up or behave unpredictably.

You said your micro draws 15 mA; if your rectified DC from the solenoid supply is 16 V and you use a low-dropout 5 V regulator, you have roughly 10 V of headroom. Say you want to be able to maintain the 5 V for 10 seconds: your capacitor will need to be 15 mF, more commonly known as 15,000 µF. That would be a readily available part, so this approach should be feasible; you should just be aware that it will draw a spike of current as it charges up which might activate the door solenoid for a fraction of a second, but normally this will happen at the instant the relay opens so it won't make any practical difference. You could reduce this by adding a few ohms resistance between the bridge positive and the capacitor positive, which will also help filter any incoming voltage spikes on the AC supply (very likely, since there's a solenoid involved). In any case you will need to make sure your power supply is well decoupled near the micro.

Does that 15 mA include the relay coil current though? If so I wonder whether the relay contacts are up to the switching task. An inductive load like the door solenoid will create big voltage spikes as the relay switches off and if it's only a reed relay, for example, may end up welding the contacts together leaving it permanently on - not what you want.

Note that if as I suspect the other door-open buttons are connected in parallel with yours, you will also lose the AC whenever someone else presses their button. However in this case your circuit is not operating its relay so its current draw should be much less.

What you could do is to add a backup battery which supplies the micro only when AC power is absent (showing only the part downstream of the bridge):

schematic

simulate this circuit

As long as the rectified DC voltage is above the battery voltage, no current is drawn from the battery. When it drops out, the battery takes over. The ideal solution would be to use a rechargeable battery and trickle-charge it from the rectified supply.

Waking a battery-powered circuit from sleep

If you prefer to take this approach, you correctly identify that you will want to trigger the micro's reset line from your doorbell signal. To give advice on a circuit for this we'd need to know what that signal looks like, but if you're worried about damaging your micro you should consider using an optoisolator, where the internal LED is operated by your signal and the phototransistor operates your reset line. If you need more advice on this approach (after searching on here) I suggest asking a new question.

\$\endgroup\$
  • \$\begingroup\$ Many thanks. While sipping a skinny latte this afternoon, the realisation that closing the relay would short out my power supply hit me too. As long as the solution requires a battery, I might as well go option 2 and have the battery as the sole power source and have the nodeMCU in deep sleep until it receives a reset signal from the door bell. I'll then stay awake for up to say 1 minute waiting for an open-door command, then sleep again. \$\endgroup\$ – pinoyyid Dec 4 '17 at 20:13
  • \$\begingroup\$ See edits...... \$\endgroup\$ – nekomatic Dec 5 '17 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.