Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Trent
#43207 I have an irrigation controller that you must short two terminals together for rain bypass. Historically I have used a 120v relay that is plugged into a controlled outlet. I'm building an esp8266 (adafruit hazzah) unit for other purposes nearby and would like to ditch the 120v relay as the outlet is somewhat unreliable due to distance from rest of house.

The huzzah obviously has 3v gpio and most relays are 5v. I was thinking of using an optocoupler as a sort of relay. Would an optocoupler with forward current of say 5ma be an acceptable way to do this or should I build out a transistor controlled relay. Something like this: http://www.mouser.com/ProductDetail/Sharp-Microelectronics/PC817X1NSZ0F/?qs=sGAEpiMZZMteimceiIVCBwW0eeEZ4eD118K0CibgR7c%3d
User avatar
By Reddn
#43226 Use a transistor. I am in the same predicament. GPIO to a 300-600 ohm resistor to the base of a 2n2222 transistor.
User avatar
By martinayotte
#43234 Is the optocoupler will be used to control some other relay ?
Because this optocoupler can NOT drive AC 120V directly !
First, they are DC not AC, and secondo their maximum rating is shows as 80VDC 50mA.
Maybe you can use SSR controlled by a MOSFET.
User avatar
By Trent
#43236 No no, the irrigation controller's sensor loop is 12vdc. Break it and the system enables, close it and it bypasses.

The 120vac relay was driven by 120v switched zwave outlet. It was just my last way of automating rain bypass.

The opto's collector and emmitter would simply act as the switched side of a relay to break or make the 12vdc sensor loop of the irrigation controller.