programming a pir sensor using arduino

The OP should look at say IR beam break or proximity sensors when the detection using PIR sensors proves to be unreliable.

I fixed that for you.