Hello, i have some 6N135 optocouplers and i would like to use them to hookup a NodeMCU to 24vac so i can detect the presence of the voltage. I want to use the nodemcu to detect if the 24vac is active or not. When the 24vac is present, a digital pin on the nodemcu would be high when it is not active the pin would be low.
Can someone tell me how to wire one of the optocouplers so i can do this?
Just to clarify, when the 24vac is present at the optocoupler it would pull a pin on the nodemcu/arduino high. when the presence of the voltage disappears the pin would be pulled low. So i would want dc on the MCU side.
And I would DROP the requirement for "I see voltage when the pin is HIGH". That, to me, is an arbitrary requirement and simple negation of pin value is needed. LOW = I SEE 24V, HIGH = I don't see 24V.
again... My circuit is untested but it SHOULD prevent you from blowing up your optocoupler that doesn't like more than 5V on the internal LED. 1 to 10 ma should make the LED light up. You might need to lower the 100 OHM resistor value a bit. Worth experimenting (WITHOUT necessarily hooking it up to your MCU).
Also note: Unless you add a capacitor after the diode... you are going to see PULSES.
And I would DROP the requirement for "I see voltage when the pin is HIGH". That, to me, is an arbitrary requirement and simple negation of pin value is needed. LOW = I SEE 24V, HIGH = I don't see 24V.
again... My circuit is untested but it SHOULD prevent you from blowing up your optocoupler that doesn't like more than 5V on the internal LED. 1 to 10 ma should make the LED light up. You might need to lower the 100 OHM resistor value a bit. Worth experimenting (WITHOUT necessarily hooking it up to your MCU).
Hi and thank you i'm going to try this. What is the zener diode for?
pwillard:
Zener is a cheap way to limit the voltage to 5V from 24. This is not the place to use a resistor voltage divider.
Okay thank for clearing that up. my HVAC transformer has a floating voltage of around 30-35v when there is no load on it. I suspect the working voltage could slightly be above 24vac. Would this be bad for the zener? I have zener diodes. I bought a pack of them that came with different ones too.
I would use a dual LED type like PC814 or LTV814 for AC with a 10 to 68nF ceramic cap from output transistor collector to emitter (GND) to filter ripple. Make the LED current 3 to 6mA RMS.
notsolowki:
Hello, i have some 6N135 optocouplers and i would like to use them to hookup a NodeMCU to 24vac so i can detect the presence of the voltage. I want to use the nodemcu to detect if the 24vac is active or not. When the 24vac is present, a digital pin on the nodemcu would be high when it is not active the pin would be low.
Can someone tell me how to wire one of the optocouplers so i can do this?
Just to clarify, when the 24vac is present at the optocoupler it would pull a pin on the nodemcu/arduino high. when the presence of the voltage disappears the pin would be pulled low. So i would want dc on the MCU side.
While I can appreciate you have some 6N135 opto couplers laying around I would consider using an optocoupler designed around an AC input or full wave rectify your AC. What you have as drawn is going to be pulsed so if you run with that consider it in your code. It will work for what you want but allow for pulses in when you write the code.