Connecting the core to a 16V doorbell

Hello

I’m an experienced Java/Android developer. And just recently picked up on Hardware and the Internet Of Things using Spark.

I made Spark prototype and an Android application to connect my doorbell to the Spark core, and every time someone rings the bell, I get a notification on my Android device.

Now I’m at the point where I would like to install this on my current doorbell. However my current doorbell uses a 16V signal. And I’m not sure how to connect this to my Spark. Can anyone point me in the right direction? I read some things about adding resistors to my circuit to reduce voltage. Would that be the way to go?

Basically I have a pushbutton, which is connected to the D3 pin. The LOW/HIGH value of this pin is then requested every other second using my phone

You have a couple of options:

  • you can use a small relay, so that the 16v goes across the relay coil to open/close 3.3v to the spark pin.
  • use a voltage divider. This allows you “siphon off” a given ratio of the voltage by using a pair of resistors. For example, using a calculator I find that to get 3.3v from 16v, the resistors 47k and 12k would be needed.

Incidentally, rather than having your phone request the doorbell value every few seconds or so, you could use an event instead via Spark.publish(). You can then have your phone connect to the cloud via a http request like

GET /v1/devices/{DEVICE_ID}/events[/:event_name]

And it receives notification whenever your core publishes the event.

3 Likes

I’ve found that using an optocoupler is cheaper than a relay and safer than a voltage divider. They work like a tiny relay that physically separates the 16V power from your Core. If you use the wrong resistor for it or your doorbell power supply goes bad and starts putting out >16V, it will burn up a $0.25 optocoupler instead of your $40 Core.

4 Likes

Yes, definitely good points about the voltage divider being a dangerous solution if the doorbell psu goes bad. I was aiming to keep things simple suggesting common components someone might have to hand, but you’re totally right that the optocoupler is the ideal solution here if you can get hold of one.

3 Likes

Thank you for the suggestions. The Optocoupler presented below also look spromising, although I don’t understand much about it. But I’ll read up on that when the time comes…

About the Voltage divider. Could I also use a 10k and 1k resistor? I have those in stock. This should give me about 1.4V on the pin. Is the amount of resistance important, or is just the ratio between the 2 resistors important?

It’s the ratio that’s important, and the overall magnitude to limit current draw. (That’s why we use 10k and not 10ohm.)

Be sure to check your doorbell uses DC - some use AC, so just a heads-up about that. And I don’t know the specs off hand for the minimum voltage to represent a digital HIGH, so you’ll have to try and see if 1.4v is enough.

1 Like

I’ve powered my motor with 6V while analogWrite() it using the core’s analog pin. Is it safe to assume that analogWrite() from the pin with 3.3V without receiving the higher voltage (like analogRead()) is safe for the core?

Is your doorbell 16v DC or AC? Most doorbells run directly from a transformer connected to the A/C mains. I suspect your doorbell would be 16v A/C.

There are several optocouplers available.
Refer to the figure @ih57452 posted.

If you have 16v A/C you will want to use one like figure 2, if you have 16v DC figure 1 will work.

Connect pin A to one side of the doorbell switch and pin B to the other side with a current limiting resistor. If the voltage is 16v and you want to drive the optocoupler with 1ma use a 16K resistor. Optocouplers can be driven with more current but since you are putting this in parallel with the doorbell button any current you allow to pass will go on to your bell.

Next connect pin C (output transistor collector) to the 3.3v rail with a 10K resistor. Connect pin D to GND.

Last, connect pin C to your Spark input pin.

The doorbell button will short the connection when pressed, that is how it typically activates the bell. So your optocoupler will be on most of the time and off when the doorbell button is pressed.

The signal on your Spark input pin will be low most of the time and go high when the doorbell is pressed.

Don’t be surprised to see some bouncing on the High signal. Mechanical buttons do this all the time.

Good Luck!

1 Like