I have the following circuit:
simulate this circuit – Schematic created using CircuitLab
When I digitalWrite(HIGH)
the GPIO pin, the transistor closes and thus the relay's input is grounded, causing it to switch.
However on digitalWrite(LOW)
, the transistor opens, so the IN pin is floating, yet the relay switches.
I thought the operation was working on strokes of luck. But when I connect 5 V to pull it up like this, it won't switch when I make the GPIO pin high. I thought the connection to ground would cause it to be pulled down.
(The module looks like the one shown in this question.)