Detection of scanning velocity or position