Relays and optocouplers