PIR sensor with timer, first time and need help

You might want to add another led that lights when motion is detected and turns off when there is no motion. This is just for debugging. Or you could use serial print. The reason the light stays on longer than your two seconds may be because the pir sensor is still detecting motion. Depending on your motion sensor, it's on board micro-controller may be programmed that way.