This is going to be my first question after 3 weeks adventures of electronics - so my apologies in advance for any "mistakes".
I have chosen to automate my house with Arduino. Therefore as beginner I would like Arduino to detect when someone has/is pressing my doorbell.
Due to fact I live in apartment I do have only access to 2 cables (so I have no detailed information about power source).The schematic can be seen on attached picture.
I have used multimeter and confirmed this is AC current and while not being pressed it has ~5V and while being pressed around ~13,48 V
Now my question would be how can I use this to get information about "doorbell" being pressed to Arduino ?
You have already done some research, good job at that.
I can tell you that you are not measuring the doorbell button, but an already somehow processed signal.
A doorbell button normally measures a voltage when not pressed, and no voltage when pressed (as that will make a short).
The optocoupler you found, doesn't care if the voltage is 5 volts or 230 volts, as soon as it "sees" anything in between these values, it will switch the optical isolated output.
So the output will not change whether that button is pushed or not.
An AC current can be rectified using a diode or a set of those.
You could use a capacitor to get rid of the pulses that come out of that rectifier.
Parallel to that capacitor, you can put 2 resistors in series.
That will make sure that the capacitor gets discharged and so will follow the voltage from the 'button'.
Because you're using 2 resistors, you'll also have a voltage divider.
Pick the resistors so that they are in a 15:5 (or 3 :1) ratio.
18K and 4K7 could be good standard values in this case
You would then measure with your Arduino over the lower value resistor and see about 5 volts when not pressed, and a bit under 1.5 volt when pressed.
Measure this before connecting it to your Arduino, because you can not handle voltages over 5.0 volts and will destroy your Arduino if that would happen.
Also, doing it this way, you are connecting the Arduino to an external power source (that of your doorbell / intercom system).
I'm not sure how (un)safe it is to do this, but using an optocoupler (a different one) would solve this.
@Larry : unfortunately not - only simple push button ?!
@MAS3 : Could you maybe point me as well how should I approach this using optocoupler ? Would this model do the job ? http://www.vishay.com/docs/83725/4n25.pdf. As I do have rectifiers already (and aforementioned optocoupler)
It might, i'm not sure.
This optocoupler might be able to have the input regulate the output current.
But the most reliable way to do that with opto's is by applying PWM, which you don't have available here.
You could consider dimensioning the resistors in such way that the LED in the optocoupler will be off when the button is pressed and on when it is not.
But then you would also register a button press when the system is down and/or without power.
So I have used rectifier along with optocoupler and that works perfectly fine! I have added 2 resistors to avoid damage to optocoupler (the first one I burned the diode )
Now I'm certain that I wont damage my arduino! Attached is my first eagle schematic if anyone would like to see how it has been done
That schematic doesn't make sense.
You are using an optocoupler, to have input and output completely separated from each other.
Once achieved, you connect the two systems by hardwiring the grounds.
By doing things this way, you could as well have done without the optocoupler at all.
So remove the line connecting the two ground symbols (incorrectly) labeled PE, and see if things still work, it should.
Some more tips:
If you use a diode bridge and measure the output, you will get a pulsing DC voltage.
There's not necessarily a problem with that, but you might consider to use a small capacitor (10 µF ?) to get rid of the pulses and a parallel resistor to discharge it fast enough when the button is no longer pushed.
The GND's should not be called PE.
PE means Protective Earth, and belongs to devices powered by AC power.
A device that has a PE has a metal casing which is earthed.
If some wire happens to come loose and touch that metal casing, the power will have a route to safely escape.
Would this escape not be there, the power will use anything it can find to escape, and that includes you touching it.
So PE means "zap protection".
Ground and earth can be confusing in electronics, because it has many different versions which should be kept apart.
That's why one should start as early as possible to understand the differences and avoid confusion and / or real trouble (and why i make this point).
And the schematics: it's good practice to try to only use horizontal or vertical lines.
It reads easier if you do that.
Thanks very much for the input - much appreciated ! I have corrected now the schematics a bit ( so now its my second schematics in Eagle yupi )
And I can confirm it does work when I do now have grounds connected.
It shows nicely points of learning for coming days !
Quit edit : answer found :
"Whenever you have systems connected together that communicate with each other you must have a common ground! Without this, voltage levels are not referenced to anything and could appear as nearly any voltage to the other device. The only exception to this rule is when you intentionally isolate systems from each other, say for noise reasons. Then you might use an optocoupler for example."