# Detect speed of DC motor electrically

I'm looking to build a small robot using inexpensive DC micro gear motors. I would like to be able to measure the speed (count rotations) of the motors for accurate positioning etc. I'm aware that they have the encoder versions of these motors, with hall effect or optical sensors connected. However I started wondering if there might be smarter ways to be able to detect the rotations without having to purchase more expensive encoder motors.

• Is it possible/practical to be able to somehow measure the pulses generated by the switching of the armatures?
• Is this something that could possibly be detected by measuring variations in the current being drawn by the motor?

I'm aware that DC motors create a lot of electrical noise from the commutation of the brushes, which requires capacitors etc. to suppress. It seems that it aught to be possible to use some of this "noise" to detect the rotations of the motor.

edit: I've realised the title of the question perhaps is not quite accurate. I don't need to detect the actual speed of the motor directly, but rather to just detect and count rotations, or more accurately, the angular displacement. From this I can calculate everything else I need to know, speed, distance travelled etc.

After a bit more googling, it seems it is possible to calculate the speed of a DC motor, by measuring the back-EMF. The calculation is quite complex, and depends on knowing various characteristics of a particular type of motor.

As described here...

There is even Arduino code provided. In my case though, despite the incorrect title, I am actually mostly interested in measuring (or calculating) the angular displacement, to find out exactly how far each wheel of the robot has travelled, to then be able to determine orientation and position.

I'm not sure this EMF technique will provide the accuracy I'd need for that.

Anyway this does give me a bit more confidence that what I'm wanting to do may be possible.

• Have you thought about speed calculation based on mathematical model of the machine? In such a case you don't need speed sensor but you will still need armature current sensor and armature voltage sensor. – Steve Feb 10 at 11:31
• @Steve Yes, this is what I mean. I won't need to measure speed directly, but rather count rotations of the motor. From this I can calculate distance and speed based on elapsed time and circumference of the wheels etc. – user1751825 Feb 10 at 13:08
• @user1751825 I don't think that it's a good idea to relay on the mathematical model for measuring distance. Say the wheel slips for an instance, or that collides with something. Well, it depends on the application... but do you consider an accelerometer? – thece Feb 10 at 14:06
• @thece Those are valid points. However for the project I have in mind, these shouldn't be a significant problem. It will mostly be a learning toy for my kids. I'm hoping to have it traverse mazes and that kind of thing. I've designed it to do gradual start/stop to reduce the possibility of wheel spin and skid. It will use ultrasonic sensors for collision avoidance, so hopefully shouldn't often bump into things. – user1751825 Feb 10 at 14:18
• Use an optical mouse to discover how much you've moved in x or y. You're always better off measuring where you are (via correlation of images - which is what the mouse does) rather than integrated velocity. You won't be able to teach stuff about control with motors to the kids because the correct way is to use a motor with an encoder. – D Duck Feb 10 at 18:48