how to count the revolution of motor

Yes, use a shaft encoder.