How to turn ON/OFF stair lights using a Raspberry Pi.
Pi have GPIO pins.
Use this 3 V from the pin to turn ON/OFF an optoisolator. These are Tk. 5 a piece. The optoisolator will turn ON/OFF 12 V.
Use 12 V from optoisolator to turn on a mechanical relay which will turn ON/OFF 220V AC. Mechanical relays are available at Tk. 80 per piece.
This 220V switches the light or motor ON/OFF.
So whenever you type in a command in Raspberry PI to turn on a pin, it will turn on the optoisolator connected with it, which will turn on the relay, which will turn on the light.
When exactly you want the switch to turn on can be controlled by a software, that will take input from other sensors to decide. It's upto you to put the logic there.