Relay not activating every time

darrenmathews:
The Sainsmart relay module didn't need any additional diodes, resisters, etc.

Sainsmart relay module? First mention of that.

darrenmathews:
The problem was in my code.

versus

The logic seems to work out ok in the code, the relay 'led' lights, but the relay doesn't actuate every time the PIR goes HIGH.