I did take a look at my doorbell last night. I have a transformer down in the basement that's outputting 16VAC. Then the doorbell upstairs, with no convenient place to get power from. The wires from both the doorbell button and the transformer come to the doorbell "box" on the wall.

At first I was looking for a way to convert the 16VAC to 5VDC. Then as I was looking at the space in the doorbell to mount the board, I saw two more wires not connected to anything. They ran 4 conductor wire from the transformer to the bell! Sweet! So now I'll put a 5V source (probably phone charger to USB cable with the end cut off) in the basement, connect that to the other unused pair of wires, and have my power where I need it.

Is there any issue with running the 5V DC power and the 16VAC power alongside each other? It's not like either is carrying data, so I don't think there would be...

Just a quick question. I'm trying the original code for the doorbell, and I have it registering in Domoticz just great,. I have two lights, one to turn off the relay and the other, not sure of (thought it would turn on if doorbell was tripped). Anyways, did I miss something or did domoticz register it as the wrong item?

@drock1985 I have mine registered as a motion sensor. So when the button is pressed it shows tripped. It will only show tripped for one second though so maybe the Domoticz UI isn't updating fast enough?

Been looking into this, not sure what the problem is. I changed over the motion sensor settings in Domoticz so that it would stay on for 5 seconds after being tripped, but it never registers the change. I can turn the chime itself on and off no problem, just no alert.

This is the output from serial monitor in Arduino with the doorbell sensor. The sensor acknowledges the change in switch state (for muting the chime) but doesn't for the action of the button being pushed. Doesn't appear to be a message being sent out either.

So got my doorbell up and working. Here's the details: I used the mini RBoard and it's working out great.

I soldered the cap directly onto the nrf board. Unfortunately, that board overhangs the A0 connections on the rboard (there's 2 pins there, one is the A0 pin and one is a ground). Thankfully, it only ACTUALLY covered the ground, so it was easy to work around. The brown wire in the photo is the wire I have connected to the A0 pin. The green wire is a temp wire I was connecting to the ground in the serial connections.

In the doorbell, I cut away one of the panels over one of the resonant chambers since I saw that the module would fit in there perfectly. I then wired it up and tucked it away. I did lose a little volume since the chamber is filled rather than resonating, but it's worth it to have the doorbell notifying my Vera system. That can flash lights and so forth to notify us other ways - we couldn't usually hear the doorbell when downstairs anyway.

Code wise, I used the original code above with just a couple minor changes. I set the doorbell_pin to A0, the relay_pin to 4, and the node_ID to auto. I also set it to act as a repeater since it's hardwired to power. Now that I have it working, I wish I'd changed the ringTime to a lower value since 7/10 of a second is way longer than the doorbell normally takes between the two notes, but it's not a big deal. Not worth pulling the board out, disconnecting it, reprogramming it, and reinstalling everything

I discovered that they ran 4 conductor wire from the transformer in the basement to this location. So I plugged a phone charger in near the transformer, cut the end off a USB cable, and connected the 5V and gnd wires from that USB cable to the spare 2 wires in the cable. So then there's 6 wires coming into the doorbell as shown here: 2 for 16VAC from the transformer, 2 for 5VDC from the phone charger, and 2 from the doorbell button. I then connected the 5V pair to the top pair of screw terminals in the photo on the rboard. They're the blue and green wires. The white wire in the top terminal is one side of the button, connecting to ground there. The second side of the button is the red wire going into the grey wire nut. The brown wire coming out of the nut connects to the A0 pin on the board. Finally, the 2 16VAC wires are red and white. The red goes over to the right terminal on the plunger mechanism. The white goes to the common terminal on the rboard's relay connections. Finally, a black wire connects the NO from the relay to the other side of the plunger.

I'm trying to hook this doorbell sensor up, what I've found is that when I connect it, I must connect it to NC. The downside is that when I reset the Arduino, the doorbell keeps ringing until pin4 is pulled up. How can I change that in the sketch?
Also I can ring it once, it rings and then it stops working. Connection to the gateway is lost and it won't ring either.
been trying to fix it for 3 days now, but I can't seem to figure out what I've done wrong.
Hooked up pin 4 to the input pin of the relay. The relay is directly powered by 5v coming from a usb hub with 2A.
The Arduino is powered using the same 5V, with a regulator to the radio to give it 3.3V. Connected a 4.7uF cap directly on the radio.
When I reset the arduino this comes to the gateway:

@arjen That's strange. You shouldn't need to connect it to NC. That means you are normally sending power to your doorbell unless it is rung. Are you sure you have the wires from your doorbell correct? You may want to double check them with a multimeter.

Just to make sure I've took some photo's.
When I take a multimeter and place it on the bottom two wires of the trafo I get zero rating.
There is no difference between blue and red, neither does it make a difference if I change the wires in what ever way. Tried all possibilities I can think of.

@arjen Can you post pictures of the rest of the wiring? It's still strange that you have to have it connected to normally closed. That is most likely why your doorbell is ringing when it's first powered on.

Sure, no prob.
This is the relay, at the moment a 6 port, didn't had a one port available.
The green wire is connected to IN1 on the relay and pin4 on the arduino.
the backside of the print. The bottom row 'S' is pin 9 on the arduino, 'M' and 'K' is pin3 and Ground to doorbellbutton.
front side. The brown and blue on the left are 5V to the relay, on the right red and blue are input doorbellbutton.

Huh, I have the same problem as @arjen is describing too, the only difference is i'm using a 2x raly vs. his 4. I don't have an issue with the relay being on, since my node is always powered on, the pull always goes high. Might just change it in the code/wiring though when I get the Arduino IDE working again.

Quick question: do you have the relay board powered by the Arduino, or another 5V source?

Made the changes to the sketch as suggested, and now I can connect it to NO.
Just to make sure I didn't made a mistake while soldering, used a fresh nano and made all connections again. In the sketch the changes still need to be made, however as far as i could test this morning all is working fine now!
Thanks for all the tips!

The relay is powered by the same powersource as the arduino (6 port powered usb hub 2A).

@drock1985 the relay should be powered by the same 5v power source as the Arduino but not from the arduino. It can draw too much power and cause issues when connected to the arduino.

@arjen Great! I just noticed the selection pin (can't think of the correct name right now) on your relay. I wonder if switching that would allow you to use the original code as well as the NO connections?

Excellent project, great work.. So I need to pick your mind.... I have a doorbell that can change music and volume. I hope to be able to fully control it by zwave using this app with Vera...Any ideas.....

Hello all - sorry I have been away for so long...
This bring back memories http://forum.mysensors.org/topic/1620/mysensored-doorbell
I wish I found a way of triggering the notification from the ring and not the other way around, as this way when something happen to your arduino the doorbell will not ring. Didn't happen yet - it works perfectly for 6 months but I would feel more relaxed if it was the other way around. Oh well...

@Moshe-Livne Cool! You can look at it the other way around on the Arduino processing the ring issue you raised. I now have the ability to turn off the ring if I want to. So I guess there is some give and take

@petewill ummmm you could still cut the ring even if it was the other way around with a relay. Sorry to be a pain can't fight my mold hehehe. generally I find the reliability of dorrbells (especially the old wired kind) to be excellent. mine has been working flawlessly for at least 35 years.

@Moshe-Livne Ok, I must have misunderstood. I thought you wanted the bell to ring no matter what then just detect the signal so you could send it to your gateway. Either way, that's why MySensors is so great, you can do pretty much what ever YOU want, not what someone else wants

@petewill My original plan was to unintrusively detect the ring and trigger the arduino without effecting the bell circuit. However, it proved to be a bit more complicated and 2 dead arduinos and several other fried components later I gave up.

I am new to home automation but curious if this same setup would work by having the arduino centrally located with the transformer in a closet and use the extra connections on the existing 4 conductor wire from the transformer to connect the new relay installed in the chime?

All this saves is some extra space and having to run 5V to the chime but one could use a larger arduino for additional automation projects rather than dedicated to just the chime.

@petewill, thanks for the reply and sorry it took me so long. I have decided to keep it to a small project starting with the remote on off, then moving to a trigger to my camera. I plan on breaking the doorbell down once the wife is out of the house for a day, lol. Thanks again.

Thanks for the code! For some reason it is not functioning on my arduino pro, the relay doesnt do anything when I push the button on pin 3, I do see within the Vera that the button is being pushed I have no clue what is going wrong..

Excellent hack, works like a charm! I added two extra activations for my doorbell so it rings two times short and one longer time... Is there a way to create a variable in the Vera options so you can change the number of time the relay activates? Now I added them in the code but that is not really handy when the thing is build in and such...

I had my doorbell working fine on Vera for months, but now I'm switching over to Domoticz. I used the updated domoticz version of the code above (by drock1985) but it's still not working right. My only changes were the pin assignments to match my wiring and setting the repeater to true since it's powered.

My domoticz is version v3.4834. Mysensors ethernet gateway is working fine. When I powered up the doorbell, I got an unknown node with sketch "unknown" show up under mysensors. It has 2 children - a repeater with childID 255, and an unknown with childID 0 and a V_Tripped value.

Tried that sketch (with just changing pin assignments and flipping the relay high/low settings). As soon as I powered it up, the relay started clicking every 4 seconds and it never appeared in Domoticz. I think it's because after the pin is set to input, there's " digitalWrite(FRONT_DOOR_BUTTON, HIGH);" command that's like someone holding the button down.

Went back to the original sketch I used. I changed from an auto NODE_ID to a fixed setting in the defines and re-uploaded it. The device appeared in Domoticz correctly! I've got a "doorbell sketch 1.0" with 3 devices - repeater, the doorbell button as a S_Motion, and the doorbell on/off as a S_Lights.

However, it still doesn't work. My wiring is shown above and it worked great under Vera. Now, I cannot get the doorbell to actually chime. Nor does the outdoor button do anything. I've verified the wiring, but shorting the A0 pin to the ground input doesn't do anything like it should. However, there's ANOTHER ground next to the A0 (under the wireless card), and if I short the A0 to that ground pin, the switch shows on in Domoticz. I can change the wiring since for some reason which ground I use is making a difference.

No matter what, still no relay action though. I tried turning the doorbell on/off switch both ways and it made no difference. In either setting, shorting the two pins turns the switch in Domoticz on.

I was comparing the two sketches (the one I'm using, and the dual-bell one). The single bell sketch sets the button pin with pinmode(Doorbell_pin, input_pullup) where the dual uses input without the pullup. Which should be right?

I don't think it's really a Mysensors issue though as I think about it - the doorbell should ring when you press the button whether you have the gateway running or not. And I'm not even getting that. In fact, I AM getting the signal to the gateway, but it's not activating the relay.

Is it possible that the doorbell on/off switch isn't working right in the code? I never used that before. I think I'll try tomorrow (kids in bed now, so can't really play around with a doorbell!) removing that switch for now and have it always set to on.

I looked through comparing the sketch I'm using now (the one drock1985 made that's for domoticz) and the original. The only change is moving the gw.send command and changing it slightly. But again, that shouldn't impact the bell physically working. So there's something else going on.

Is there a way to check if the code uploaded to the arduino correctly? I'm using the rboard and a FTDI to upload. I'm wondering if something isn't going weird there and it's not uploading correctly and that's why I'm getting different issues every time I try something...

I have installed the doorbell sketch on my testboard. This just to see how it should be working. First sensor with a relay for me basically

But I have a question. I have use the sketch, I have two devices coming up in Domiticz, a security sensor and a light switch. But basically I don't get the function of these buttons?
I think the security sensor responds on the doorbell press?

Also I think the other button is to activate the physical doorbell which could switch the relay? But I would expect that the security switch button in Domoticz could also activate the relay remotely, but this is not the case? Because, I don't see an option to switch the relay remotely in Domoticz?

So it is working; but any help is appreciated if somebody could explain the functionallity for me and if this is the expected behavior

I know when I was playing with Domoticz the Doorbell sketch would show up as a security light and a light for me. The security light I changed to a motion sensor in Domoticz (click edit on your dashboard/switches tab). After that when I pressed the doorbell button, the motion sensor would switch on to show the button was pressed, then immediately back off. Although for it to turn off automatically, I may have had to tell domoticz to do that after xx seconds, can't remember for sure now.

And yes you are correct, the second switch is a 'mute' for the doorbell. If off, the doorbell won't sound (switch the relay).

For my setup I've got a diode bridge followed immediately by a buck converter, so the doorbell's 18v AC comes down to 8v DC. My plan was to run the doorbell AND the arduino off this same supply, but I'm guessing now that it may not be possible. The reason for this was down to there only being 2 wires to the doorbell. The doorbell works fine off 8v DC and so does the arduino. The issue however is when i both power the arduino and the doorbell at the same time of the same supply. The relay opens and then the arduino resets. No chime.

What should I do? Wiring layout is exactly the same as above but the 8v DC loops through the relay to the doorbell as well as going to VIN/GND on the Arduino Nano.

I can't have the arduino at the power supply end as I need the doorbell button connections, so I'm hoping someone might have some ideas around splitting out the power supplies at the doorbell end? Or smoothing it or something like that.

Power is red/yellow from the wall. Doorbell button is yellow/yellow from the wall. brown/brown is soldered/heat shrunk to red/red within the housing. NRF is on headers, so it's lifted out in this photo.

Or can i just get away with a better power supply for the both? Essentially I've got a pulse-detecting mysensors node, a doorbell node and a doorbell itself running off a cheap-ass ebay chinese full-bridge rectifier and step-down converter (120v AC > 8v DC). The doorbell takes 8v DC so I'm using that as the common voltage.

@pjblink - what are the components you have built in there? I see the Arduino Nano and a relay - are they all attached to a board? Is there a radio in there, too? I clicked on the (old) link above for Mini RBoard, but I get a gateway error when going to the page to purchase...

So yeh, there's a nano on headers, relay, nrf on headers and 3 wire terminals - 1 for the doorbell button, 1 for the bell itself and another for the DC IN. Everything is soldered to a prototyping board which has now been trimmed down to fit in the doorbell housing.

I've just tried it with both 1000uF and then a 4700uF cap across VIN/GND on the arduino with only slightly better results. It'll ring, but the relay stays open most of the time and the arduino needs resetting to release it

@sundberg84 That was definitely on the cards...but it looks like I might have got it working. I did 4 things in one go, which is unlike me, so now I have to break things down to see which one helped (if it wasn't all)...1st thing was a 4700uF cap over the arduino VIN/GND, 2nd was a 1000uF cap over the relay +- 5v,… 3rd was to reflow a few of the GND solders and finally I dropped the voltage regulator from 8v to just under 7v...and hey presto...

So it kept failing after 2 or 3 rings...frustrating! I enabled all the debug and noticed it kept failing just before sending out the "off" message. It didn't reset, just stalled. This was the case even when powered by USB. And then I remembered how sensitive the NRFs are to fluctuations in power and I hadn't got round to putting a cap on there yet!!! I put a spare 1000uF (47uF are on order) and so far it hasnt caused me any further issues! So now I've got 3 huge capacitors on there, and it looks ok...touch wood.

How are you powering the relay? Are you trying to run it directly from an arduino data line? If so, that could be your problem. I am currently working on a motion sensor light with a PIR, LDR, and a relay. Now the relay I am using is a 12 volt relay, but the concept would be the same for a 5 volt relay. The idea is to use a transistor to trigger the relay from a separate power source. I used an 2N3904 NPN transistor to switch the the negative side of the power to the relay. You simply connect the emitter to your ground, the collector to the negative side of your relay and the base goes to your arduino data pin. You may need to add a pull-down resistor on the transistor base to ground depending on your situation. In my case it worked fine without it. Also, you should still of course put your flyback diode across your relay coil to prevent voltage spikes.

The above assumes that you are using a relay on it's own and not a relay module like the ones you find on ebay. The relay modules already have the transistor and diode already built in, and some even use an optocoupler for added isolation.

My test situation is Nano+Radio with double relay module and push button for the bell. Relay is powered by the 5V by Arduino, and i have tested this with the example sketch (+modification for double relay) and everything was working fine. The issue i am having is the original sketch (1 bell + 1 relay) is made for mysensors 1.x, and i am running 2.x and have no idea how te rewrite this.

I followed this recently (different sketch) and it works just fine as long as you take your time and make sure you do each step properly. Post back on how you get on, if you're still stuck I might be able to give a hand next week but I'm pretty new at this myself.

Sitting on my desk, it works fine. It appears in Home Assistant, clicks the relay when A0 is shorted to ground, and that appears in HASS as a motion event. Seems good, so I installed it in the doorbell. Doesn't work there. I get one ring when I hook up power, and then nothing. I checked again the leads from the physical doorbell button with a multimeter - I get a good continuity buzz when I press the button and silence when not pressed. Then I discovered something - if I physically unhook the wire going to A0 and reconnect it, the doorbell rings and I get that notification in Hass. If I unhook and reconnect the wire again, same thing. So that makes it appear that the A0 is being constantly grounded - is that possible? It acts like my physical doorbell button is stuck in the pressed position, but the multimeter indicates it's fine.

Further testing - If I connect the board to the doorbell system but leave the physical doorbell button disconnected, then attach a spare piece of wire to A0 and ground it, the system works perfectly. So it's definitely something related to the physical button.

On thing I've realized - I THINK the outdoor button is an illuminated one, which isn't illuminated with this system. Could that light be the cause? If so, why doesn't the continuity test show it as continuous? I think I'll go buy a basic non-illuminated button and install it and see if that works. Or just pull the button out of the wall, disconnect the wires, and then short them together. Duh, that'd be easier and cheaper. I'll try that this afternoon - have a wedding to get to first.

I THINK the outdoor button is an illuminated one, which isn't illuminated with this system. Could that light be the cause?

The button is probably illuminated with LEDs and a resistor (depending how old it is). This could complete the circuit to the digital input on the arduino making it look like the button is pressed. It is probably not seen on a continuity test when the button is not pressed because the resistance is enough where you don't have full continuity. See if reversing the wires into the arduino A0 and ground gets it working. If the doorbell is illuminated with an LED and a resistor that should reverse the current flow of the LED/resistor into A0 on the arduino in effect preventing that problem.

It's definitely the illuminated button. I pulled it out and connecting the wires rings the bell correctly. I hadn't thought about swapping the wires... It is pretty new but I wasn't considering the possibility of it being led. I'll give that a try. Worst case, replace it with a non lit button. Just glad to have finally figured it out!

edit: actually, I'm betting it's not a LED. These buttons are typically on a 16VAC system, so a LED wouldn't work without more components. Whereas a simple incandescent bulb works fine on AC. So I think I probably just need a new button.

actually, I'm betting it's not a LED. These buttons are typically on a 16VAC system, so a LED wouldn't work without more components. Whereas a simple incandescent bulb works fine on AC. So I think I probably just need a new button.

Actually an LED WILL work on AC. It will just flicker at 50/60 Hz (Depending on what country you are from) when connected with only a resistor which is only slightly noticeable to the naked eye. The flickering is because it is only lighting the LED on one half of the AC sine wave. An LED is a current controlled device, so all you need to make it work on AC is the correct size resistor to limit the current for whatever voltage you put on it. You can put more complex components in to stop the flickering such as a bridge rectifier, but for very basic operation it is not needed.

Final update - no local stores carry a non-illuminated doorbell button. Argh. So I ended up taking the button apart on mine, yanking the incandescent bulb out, and putting it back together. Since it's held together with just some bent over tabs, they broke off and I had to glue it back together. Once I did, everything worked perfectly. The sketch I posted above is working great - doorbell rings and the ring appears in my Home Assistant like it should.

I built this project and it is working great, but i have a question about this. My controller is Domoticz and in Domoticz i have the two switches (DOORBELL_CHILD_ID, SWITCH_CHILD_ID). I though with this project i could also use the ringer of my doorbell as a sort of alarm in other combinations, but if a use the doorbell-switch in Domoticz the doorbell won't ring. But if i use the normal doorbell at my front door, it will ring.

@Mister_ik You're not missing anything. It wasn't designed to do what you're describing. That is an interesting idea that I never thought of though! It shouldn't be too hard to implement if you wanted to try. I'm not sure which device types are available in Domoticz but I would think you would want to use some sort of momentary button press (rather than an on/off switch) in Domoticz. You could then send that to the sensor and when it receives the command it could trigger the relay. Have a look at the relay actuator code if you haven't done this before. https://github.com/mysensors/MySensors/blob/development/examples/RelayActuator/RelayActuator.ino#L82