njr27:
Measuring voltage at Optoisolator:
The voltage at pin 1 to ground is 4.88V for around 2 seconds. (This makes sense, the arduino & microcontroller are working)
OK, looks like Arduino code is doing the right thing !
njr27:
The voltage at pin 2 to ground is 0.63V for around 2 seconds. (This makes sense, the voltage is dropping over the resistor)
Hmmm, this puzzles me a bit. From the datasheet, the forward drop of the input to the opto-isolator should be about 1.3V. With a 4.88V output and minus the 1.3V should leave ~ 3.58V for the 2 secs the Arduino output is high. That you see only 0.63V indicates to me that the current is lower that expected. I thought an Arduino output could source or sink 40 mA. Perhaps I'm wrong re: this. I'd have expected about 16 mA given the aforementioned 1.3V drop and a 220 ohm resistor. IF the resistor is 220 ohms then you're seeing only ~3 mA. The opto-isolator should work with less forward/input current that 20 mA though. Perhaps the 2 seconds isn't long enough to allow the meter to settle ? :? Or perhaps the resistor isn't really 220 ohms ? :?
njr27:
The voltage at pin 3 to ground is 0V. (This makes sense, the ground is in reference to the board, not the battery)
Agreed.
njr27:
The voltage at pin 4 to ground is 0V. (This makes sense, the ground is in reference to the board, not the battery)
Agreed.
njr27:
The voltage at pin 3 to pin 4 is 6.45V.
Just to be picky but I hope you mean "voltage
**from** pin
**4** to pin
**3** is 6.45V". [pin 3 to pin 4 should be -6.45V]
I’ve been under the assumption that you hacked the above cables onto/into the doorbell. If this isn’t the case, were there mechanical switches previously attached to these cables (or their equivalents) ? I’m trying to revisit my assumptions to see if they hold up. I’m trying to make sure what I’ve assumed are inputs to the doorbell are/were indeed inputs.
BTW did the doorbell chime with the above timing and connections ?
If you wanted to verify your opto-isolator was working (perhaps a good idea given my puzzle above) then you could connect it’s pin 3 to the Arduino ground and another 220 ohm resistor (500 - 1000 ohms would be better if you have one) between it’s pin 4 and the Arduino 5V. Then you should be able to measure between pin 4 and Arduino ground and see the opto switch between about 0.5 V and 5 V.