Thank you for this information. I am trying to get this to work but am running into a weird problem. If I turn the port on the relay does turn on. But after that it will not turn off. It stays on and I can no longer control it. If i power cycle the Pi it goes off until I turn it on again. Any suggestions.