How to get wheel velocity

Hi guys,

I am taking "control of mobile robots" course on coursera and is pretty intrigued in building a 2 wheel robot car. One of the issues was the control of the 2 wheel velocities here.

So far, I've got a Uno and bought the magician chassis from sparkfun. It provides 2 dc motors. May I know using the dc motors, is it sufficient to be able to know and  control the individual wheel velocities? 

There are two more things

There are two more things you need to run the motors and control the speed:

1) Motor driver board.
This is the part that controls the power delivered to the motors, making them run fast, slow, backwards, etc. The Uno by itself can’t supply enough current to control the motors, so you’ll need a DC motor shield or another type of DC motor driver board.

2) Wheel speed feedback.
If for example you run both motors at 50% power, they still won’t go exactly the same speed. Also, as the batteries start to run low your motors will run faster or slower. Other things like temperature, wear, lubrication all factor in to make the motors run at varying speeds even if you try to run them at the same power.
To get around this problem, the easiest thing to do is add some feedback sensors to tell you how fast the wheels are going. If they aren’t going fast enough you just keep adding more power until you get the right speed, or less power if the speed is too high.
The simplest type of wheel speed feedback sensor is an encoder like Max mentioned.
OddBot has posted a good walkthrough on quadrature encoders that will help you understand how to use it. 

thanks! but some questions

hi telefox, 

thanks but as I’ve just got started out on this hobby, there are a couple of things I haven figured out and need your help.

1. What’s the difference between a motor shield and a h bridge driver? are there any guidelines in buying one?

2. Do i need external power supply to my uno board, or do i use the 5V USB input, once I got the motor shield? Right now, the magician chassis provides a 1.5V battery case, do I use that instead of the USB power supply?

3. How do I know what are the specifications of my DC motors? I got them with the chassis and theres no specifications anyway?

4. Is there any difference if I use a servo or a dc motor? I’ve roughly read about the differences but I am not too sure how those differences translates to how I control the motors/accuracy etc.

Thanks again for your help.

1) A motor shield is a board

1) A motor shield is a board that plugs into an Arduino board that has an H-bridge driver built into it. You can use any H-bridge driver of the right ratings for your motors, however a motor shield will typically be more expensive but require less effort.

2) Yes, it is very unlikely that the USB will provide enough power for your motors. The battery case should be enough to power both the Uno and your motors.

3) There are some specs you can calculate by measuring the motors yourself, but you are probably better off talking to the supplier and trying to get the info from them.

4) Yes, there are many differences:
• Each servo has an integrated driver - no H-bridge required
• Typical servos are controlled to move to a set position, not at a certain speed
• Typical servos can only rotate within a maximum range, usually less than 180°
• Servos are virtually always used with an integrated gearbox, so they turn more slowly but with higher torque 

It is possible to hack a servo so that is can rotate continuously, and then the normal position control becomes a speed control instead. There are many articles that can be found here on LMR regarding making a continuous rotation servo.
You’ll be able to manually tune the speed of two continuous rotation servos to be almost the same, but this method is still not going to be as accurate as using DC motors with encoders… really it depends on how accurately you need to be able to control the speed.