0

i modified my door bell with a NodeMCU which is now capable of triggering the door opener using a relay. Now I want to add a door bell detection to this system. I figured out two contacts which supply a DC of ~5V for a second while the bell rings. How can I connect this to the NodeMCU since it has only 3.3v GPIOs as far as I know. Do I need a resistor and if so - how much ohm? Or a step down converter? And what's about the amperage?

Sorry I'm really new to electrical engineering and might need some noob explanations :)

Thank you!

Clemens
  • 3
  • 1
  • The first think you need to know is that you can't attach the NodeMCU directly to the doorbell circuit since it is a ~10VAC signal. I would suggest taking a look at [this question](https://electronics.stackexchange.com/questions/450539). – Caleb Reister Sep 27 '19 at 00:18

1 Answers1

0

Since we know nothing about how the two systems are powered and/or grounded, it would be a good idea to keep them isolated. A simple optoisolator should do the trick.

schematic

simulate this circuit – Schematic created using CircuitLab

The resistor values are selected based on how much current you want to flow in each side of the circuit.

  • On the input (LED) side, you generally want somewhere between 3 and 20 mA flowing through the LED. Verify this against the datasheet for the actual coupler you buy. Therefore, I selected 1 kΩ for R1, which allows 3 mA to flow at an input voltage of 5 V, given a forward drop of about 2 V on the LED: \$\frac{5 V - 2 V}{3 mA} = 1000 \Omega\$. This means that the input voltage could go as high as 20 V without damaging the LED. For higher voltages than that, you'll need a different value.

  • On the output (transistor) side, a relatively low current can drive a GPIO pin on an MCU. I arbitrarily selected ~1 mA. Assuming that the voltage drop across Q1 is no more than 0.6 V, this leads to a resistor value of \$\frac{3.3 V - 0.6 V}{1 mA} = 2700 \Omega\$. Again, this should work over a wide range of supply voltages coming from the MCU; adjust to taste.

Dave Tweed
  • 168,369
  • 17
  • 228
  • 393
  • Thank you! So what i need is: the two resistors, the diode D2 and the optoisolator Q1 right? D1 is part of the optoisolator or a separate diode like D2? – Clemens Oct 07 '19 at 13:17
  • Yes, D1 and Q1 are part of the optoisolator. D2 is mainly there to protect D1 in case you get the connections backwards. It also make the circuit suitable for AC doorbell applications. – Dave Tweed Oct 07 '19 at 13:18
  • Thank you very much for your detailed explanation! I got the circuit working with a stable 5V supply on the left. If I en-/disable the 5V supply, I get the expected results on the right site. Now, when I connect this to the door bell, nothing happens. I remeasured the voltage coming from the bell and it says ~8V for a really short time period on my multimeter. Do you have any hints what this could be caused by? – Clemens Oct 08 '19 at 13:19
  • Not a clue. You'd have to trace the circuit and/or find information about the manufacturer and model of doorbell you have. – Dave Tweed Oct 08 '19 at 13:26
  • Does an AC door bell source change anything? – Clemens Oct 08 '19 at 13:29