Tired with stumbling on stuff in my garage that doesn't have a light switch I decided to do something about it. Motion sensor connected to a light was the result and it works really well.
Step 1: Motion Sensor to Breadboard
Red cable is for power (5v), black for ground and purple is for output.
Between the output and the cable going to the RPI GPIO there is a 10k resistor.
Step 2: Relay to Breadboard
Here is how I connected the relay to my breadboard. Red for power (5v), Black is ground and the White cable to go into the RPI GPIO.
Step 3: Raspberry GPIO Pins Used
Raspberry connections for power (5v) and ground (black) to both motion sensor and relay and input from motion sensor(purple).
Step 4: Output to Relay From Raspberry GPIO
GPIO pin used for signal to the relay.
Step 5: Triggers in Cayenne.
Cayenne is a user friendly interface to connect sensors and use them with raspberry and arduino. This is how I have set my triggers to turn on the light connected to the relay when the motion detector is activated.
Step 6: Parts Required
I have used a Raspberry pi 3 model B
Jumper cables female to male
Jumper cables male to male
one 10 K resistor
Motion detector HC-SR501
Breadboard and the Cayenne interface to trigger it all.