Recently i doing a project which is automatic lamps and fans.
In the project, i use 3 sensor, IR sensor to replace PIR motion sensor, light sensor and temperature sensor
When the IR sensor sense 'human' it will activate the lamps and fans.
The light intensity for the lamp will due to light intensity of the outdoor.
The brighter the outdoor, the dimmer the lamp.
The fan's speed control by the temperature.
The higher the temperature, the faster it rotates.
I using mplab ide 8.86 as my compiler and pic 16f877a