user27968: I am currently trying to build a line follower robot that is designed to solve maze. This maze has a loop, thus it needs to know distance it already travelling (or at least I assume so, please let me know otherwise).
I am aware of a rotary encoder motor from Polulu (for example) but it's not available in my country and shipping price is too expensive.
So I need to find way around it. Should I use Stepper motor? Is there any other way? Thanks in advance.

user2881: You could add a rotary encoder to a motor yourself. Thought this is not as convenient as buying an all in one solution. 
You can even build your own by making a disk with holes at regular intervals, and using an IR led, phototransistor pair on either side of the disk. You can even get all in one photo-interruptors. You could get them from an old computer-mouse. You might even be able to use the wheel/disk in it.
Another option is to add a magnet to the wheel, and a hall-effect sensor to the body. That way you can count the number of revolutions. (Though you probably want higher resolution than once per revolution). 

user19409: An optical encoder would be the best solution in my opinion. The next best thing would be to use a stepper motor. You can find plenty of stepper motors in old printers - which is good if the budget is tight.
The problem with a stepper motor is that you have no feedback on where the motor actually is. You drive it forward say 100 pulses, but without any feedback you have no idea if there was any slip or overrun. This is called open loop control.
However, both of these methods are measuring/driving the rotation of the motor. What happens if the wheel doesn't have enough grip and slips and does a sort of burnout. For this reason, I have seen some maze robots use an old mouse to measure the distance the robot has actually travelled. This was not necessarily very accurate over long distances but was a cheap way of measuring distance travelled.

user16098: You can Use wheel encoders. You can even make your own wheel encoders with general parts like photoTransistor and lasor or led light. you can make your encoder or print it out in paper. The use little math to calculate the distance. It will give you measurement with good level of precision.
Basic principle:


more information at
wheel Encoder
another encoder

27968: <p>I am currently trying to build a line follower robot that is designed to solve maze. This maze has a loop, thus it needs to know distance it already travelling (or at least I assume so, please let me know otherwise).</p>

<p>I am aware of a rotary encoder motor from Polulu (<a href="https://www.pololu.com/product/2821" rel="nofollow noreferrer">for example</a>) but it's not available in my country and shipping price is too expensive.</p>

<p>So I need to find way around it. Should I use Stepper motor? Is there any other way? Thanks in advance.</p>
 2881: <p>You could add a rotary encoder to a motor yourself. Thought this is not as convenient as buying an all in one solution. </p>

<p>You can even build your own by making a disk with holes at regular intervals, and using an IR led, phototransistor pair on either side of the disk. You can even get all in one photo-interruptors. You could get them from an old computer-mouse. You might even be able to use the wheel/disk in it.</p>

<p>Another option is to add a magnet to the wheel, and a hall-effect sensor to the body. That way you can count the number of revolutions. (Though you probably want higher resolution than once per revolution). </p>
 19409: <p>An optical encoder would be the best solution in my opinion. The next best thing would be to use a stepper motor. You can find plenty of stepper motors in old printers - which is good if the budget is tight.</p>

<p>The problem with a stepper motor is that you have no feedback on where the motor actually is. You drive it forward say 100 pulses, but without any feedback you have no idea if there was any slip or overrun. This is called <a href="https://www.servocity.com/open-loop-vs-closed-loop" rel="nofollow noreferrer">open loop</a> control.</p>

<p>However, both of these methods are measuring/driving the rotation of the motor. What happens if the wheel doesn't have enough grip and slips and does a sort of burnout. For this reason, I have seen some maze robots use an old mouse to measure the distance the robot has actually travelled. This was not necessarily very accurate over long distances but was a cheap way of measuring distance travelled.</p>
 16098: <p>You can Use wheel encoders. You can even make your own wheel encoders with general parts like photoTransistor and lasor or led light. you can make your encoder or print it out in paper. The use little math to calculate the distance. It will give you measurement with good level of precision.</p>

<p>Basic principle:
<a href="https://i.stack.imgur.com/M0b9p.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/M0b9p.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/tEJc2.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/tEJc2.jpg" alt="enter image description here"></a></p>

<p>more information at</p>

<p><a href="http://www.societyofrobots.com/sensors_encoder.shtml" rel="noreferrer">wheel Encoder</a></p>

<p><a href="http://letsmakerobots.com/node/12293" rel="noreferrer">another encoder</a></p>
