creating timer-based capture loop