You are on page 1of 13

(/)

Home (http://www.electroschematics.com)/Arduino
(http://www.electroschematics.com/arduino/)/Motor Speed Sensor Module Circuit

(http://www.electroschematics.com/wp-content/themes/electroschematics-
v2/img/fallbak.png)

Motor Speed Sensor Module Circuit


T.K. HAREENDRAN (HTTP://WWW.ELECTROSCHEMATICS.COM/AUTHOR/HAREENDRAN/)

(https://www.facebook.com/sharer/sharer.php?
u=http://www.electroschematics.com/12275/motor-speed-sensor-module-
circuit/) (https://twitter.com/share)
LM393 (/tag/lm393-circuits) (/qa/)
motor controllers (/tag/motor-controllers)

(http://www.electroschematics.com/wp-content/uploads/2015/09/motor-speed-sensor-
module.png)

Here is a motor speed sensor module, the major goal is to check the rate of an
electric motor. The module can be used in association with a microcontroller for
motor speed detection, pulse count, position limit, etc. In principle, any rate meter
simply measures the rate at which some event occurs. Usually this is done by
counting the events for a given period of time (integration interval) and then
simply dividing the number of events by the time to get the rate.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you
Looking for the latest from TI?
wish. Accept Read More (/policy/)

Basically, the microcontroller-compatible motor speed sensor module described is
a simple device that yields processed pulse trains when the visual path of its optical
sensor is physically interrupted by some sort of slotted wheel or similar
mechanism (an optical sensor commonly consists of a light emitting diode that
provides the illumination, and a phototransistor that senses the presence or
absence of that illumination). The transmissive optical sensor used here consists
of an infrared light emitting diode and a phototransistor. This both prevents
interference from stray external light sources and by having the two components
matched for a speci c frequency of radiation, they are even more immune to
undesired interference.

The Circuit
As stated, the circuity can be used to send calibrated pulses to a microcontroller-
based tacho meter or similar circuit/device. The wiring of the hardware turned out
to be deceptively simple. At the heart of the circuit is the OS25B10 transmissive
optical sensor with phototransistor output (OC1).

Next is the venerable LM393 dual comparator chip (IC1) con gured as a simple
Schmitt trigger (schmitt triggers are fundamental circuits with several uses; one is
signal processing, they can pull digital data out of some extremely noisy
environments). The green indicator (LED1) indicates the presence of voltage
applied, and the red indicator (LED2) monitors output of the motor speed sensor
module. Recommended working voltage of the module is 4.5 to 5.5 volt dc.

(http://www.electroschematics.com/wp-content/uploads/2015/09/motor-speed-sensor-
module-circuit.png)

LM393 datasheet (http://www.electroschematics.com/7980/lm393-lm2903-


datasheet/)
Note that a 180R resistor (R1) is used here to limit operating current of the light
emitting diode inside OS25B10 optical sensor (OC1). It might become necessary to
alter this value in your prototype. Similarly, try to tweak the value of the 10K
resistor (R2) to get a decent voltage swing based on your real life application. The
last 10K resistor (R7) is an optional pull-up resistor.

The Encoder Disc


Note that one side of the optical sensor holds s a light emitting diode, and a photo
transistor on the other side. If the visual path is not blocked, phototransistor
would conduct, but when something blocked the light falling on the photo
transistor it wouldnt conduct. So an encoder disc (with a proper encoder
resolution) can be placed in the slot of the optical sensor to count rotation rate of a
connected wheel/motor.

(http://www.electroschematics.com/wp-content/uploads/2015/09/encoder-disc-
wheel.png)

The encoder disc (also known as index wheel) in the above image have multiple
slots/holes. You can easily fabricate your own encoder disk from a sheet of
stainless steel or hard plastic. If you are interested only in speed sensing (not
position sensing) application , one set of slots is su cient for the task.

(http://www.electroschematics.com/wp-content/uploads/2015/09/encoder-disk.png)
Proof of Concept
My basic prototype was built on a small piece of perfboard, photograph of which is
shown below (some components are soldered at the bottom side of the perfboard;
power indicator not wired).

(http://www.electroschematics.com/wp-content/uploads/2015/09/proof-concept.png)

After construction and pre- ight test, the module was connected to an Arduino
board and measured the rotation per minute (rpm) rate of a geared robo motor
(150rpm@5V) with the help of a home-made encoder disc (resolution 12 slots/disk)
attached to its shaft. Final result observed was somewhat close to the spec of the
robo motors rpm value. Arduino hardware hook up indicator (plus the demo
sketch) is given below. Have a try!

(http://www.electroschematics.com/wp-content/uploads/2015/09/arduino-module-
connection.png)
1. int encoder_pin = 2; // pulse output from the module
2. unsigned int rpm; // rpm reading
3. volatile byte pulses; // number of pulses
4. unsigned long timeold;
5. // number of pulses per revolution
6. // based on your encoder disc
7. unsigned int pulsesperturn = 12;
8. void counter()
9. {
10. //Update count
11. pulses++;
12. }
13. void setup()
14. {
15. Serial.begin(9600);
16. pinMode(encoder_pin, INPUT);
17. //Interrupt 0 is digital pin 2
18. //Triggers on Falling Edge (change from HIGH to LOW)
19. attachInterrupt(0, counter, FALLING);
20. // Initialize
21. pulses = 0;
22. rpm = 0;
23. timeold = 0;
24. }
25. void loop()
26. {
27. if (millis() - timeold >= 1000) {
28. //Don't process interrupts during calculations
29. detachInterrupt(0);
30. rpm = (60 * 1000 / pulsesperturn )/ (millis() - timeold)* pulses;
31. timeold = millis();
32. pulses = 0;
33. Serial.print("RPM = ");
34. Serial.println(rpm,DEC);
35. //Restart the interrupt processing
36. attachInterrupt(0, counter, FALLING);
37. }
38. }

Previous
High Speed Ecosystem
Support and Calamity
Monitoring System
(http://www.electroschematics.com/12241/high-speed-ecosystem-
support-and-calamity-monitoring-system/)
Next
Overheat/Overcooling
Circuit Breaker
(http://www.electroschematics.com/12242/overheatovercooling-
circuit-breaker/)
Related Tutorials

DC Motor Speed Controller Circuit (http://www.electroschematics.com/407/dc-motor-speed-


regulator/)
AC Motor Speed Controller Circuit (http://www.electroschematics.com/444/motor-speed-
regulator-with-triac/)
DC Motor Speed Controller Project (http://www.electroschematics.com/8243/dc-motor-speed-
control-project/)
GUVA-S12SD UV Sensor Module & Circuit (http://www.electroschematics.com/11509/guva-
s12sd-uv-sensor-module-circuit/)

14 Comments

Join the conversation!


You must be logged in (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-
speed-sensor-module-circuit%2F) to post a comment.

kikiloaw
pulse means interruption for IR Sensor by blocking receiver and transmitter. right? its that
what you mean in your code in variable pulsesperturn?

Posted on December 05th 2015 | 4:38 pm (http://www.electroschematics.com/12275/motor-speed-sensor-


module-circuit/#comment-1873474)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

Taha
Thank you again
But can I know if I can connect it to LCD
Posted on November 27th 2015 | 2:49 pm (http://www.electroschematics.com/12275/motor-speed-sensor-
module-circuit/#comment-1869362)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

tkhareendran
Yes, with little skill and patience you can add a display panel with the
hardware.For this,try an LCD Keypad Shield and modify the code accordingly. To
make it more clear,refer lcd-related projects published here from time to time.

I regret,due to time constraints I am unable to re-write the code for speci c


requirements.

Posted on November 27th 2015 | 3:04 pm (http://www.electroschematics.com/12275/motor-


speed-sensor-module-circuit/#comment-1869371)

Taha
My last question: How were gonna connect this circuit with the motor?And Is theres a
video for this circuit while it works?

And Thank you again.

Posted on October 20th 2015 | 5:38 pm (http://www.electroschematics.com/12275/motor-speed-sensor-


module-circuit/#comment-1846053)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

Dandara
Tohundowc! Thats a really cool way of putting it!

Posted on December 22nd 2015 | 12:10 pm (http://www.electroschematics.com/12275/motor-


speed-sensor-module-circuit/#comment-1882948)

Taha
Thank You very much.
It was the last step.
Posted on October 22nd 2015 | 8:10 pm (http://www.electroschematics.com/12275/motor-speed-
sensor-module-circuit/#comment-1849264)

T.K.Hareendran

(http://www.electroschematics.com/wp-

content/cache/comment-plus/1847051-1024x768.jpg?1472108799)
@Taha: Welcome!

Note that no electrical interfacing is required here. First of all, prepare a suitable
index disc (see the article) for your speci c application, and optically-couple
the disc to the sensor module. Refer the example image!

Posted on October 21st 2015 | 5:47 am (http://www.electroschematics.com/12275/motor-speed-


sensor-module-circuit/#comment-1847051)

tkhareendran
@Taha: Its well below 50 mA (actually it depends on the current rating of the IR module,
and the output LED)!

Posted on October 13th 2015 | 5:55 pm (http://www.electroschematics.com/12275/motor-speed-sensor-


module-circuit/#comment-1833886)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

Taha
Thanks

Posted on October 20th 2015 | 5:30 pm (http://www.electroschematics.com/12275/motor-speed-


sensor-module-circuit/#comment-1846046)

Taha
Sorry but for complete it, I was asking how much power itll take for VCC ?

Posted on October 13th 2015 | 5:45 pm (http://www.electroschematics.com/12275/motor-speed-sensor-module-


circuit/#comment-1833880)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-circuit%2F)

Taha
I was searching for a project, And I found this one.
When I read it I found it very good and simply project.
Really, Thank You.

Posted on October 13th 2015 | 5:41 pm (http://www.electroschematics.com/12275/motor-speed-sensor-


module-circuit/#comment-1833874)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

tkhareendran
@Taha: Thanks!

Posted on October 13th 2015 | 5:45 pm (http://www.electroschematics.com/12275/motor-speed-


sensor-module-circuit/#comment-1833879)

Mart
I was thinking about how to make a drive by wire circuit control system to drive a
mechanical device and this is a simple means of doing this.

By mechanical device, I mean, for example, a portable mobile sca old that I can stand on
and motorize it to move me around while standing on it without having to get down and
move it myself.

Or, building a small go-cart and electronically control the desired speed by using this speed
control circuit system.
Obviously there are many other applications where speed control is desired and this simple
circuit you describe could be easily implemented.

I have an arduino uno and so thank you for providing the sketch and circuit diagram to
achieving and implementing this system.

Thank you very much for writing this article.

Posted on September 23rd 2015 | 1:06 pm (http://www.electroschematics.com/12275/motor-speed-sensor-


module-circuit/#comment-1810026)
Log in to Reply (http://www.electroschematics.com/wp-login.php?
redirect_to=http%3A%2F%2Fwww.electroschematics.com%2F12275%2Fmotor-speed-sensor-module-
circuit%2F)

T.K.Hareendran
@Mart: Thanks for your keen interest in my article. Really happy to note your
open feedback.

Posted on September 23rd 2015 | 1:53 pm (http://www.electroschematics.com/12275/motor-


speed-sensor-module-circuit/#comment-1810085)

Login
Email

Password

Remember Me

Log In

Register (http://www.electroschematics.com/register) | Lost your password?


(http://www.electroschematics.com/lostpassword)

Latest Article Comments


Arduino Digital Voltmeter 0V to...
(http://www.electroschematics.com/9351/arduino-digital-voltmeter/#li-
comment-1901280)
"Precision voltage measuremt is still an issue if we dont have a precise voltage"

VHF FM Antenna Booster... (http://www.electroschematics.com/786/vhf-fm-


antenna-booster/#li-comment-1901279)
"I'm very interested in making this circuit, but I am having trouble understanding what kind
of"

Best of Free PCB Design... (http://www.electroschematics.com/2249/pcb-design-


software/#li-comment-1901278)
"I know this post is a bit old, but check out Pad2Pad (www.pad2pad.com) if you are looking
for"

Fan Speed Controlled by Temperature and...


(http://www.electroschematics.com/9540/arduino-fan-speed-controlled-
temperature/#li-comment-1901277)
"I think this is a dead artical. I have questions posted back to july 2016 and have had no
responce"

AVR PWM Pulse Width Modulation - Tutorial...


(http://www.electroschematics.com/9941/avr-pwm/#li-comment-1901276)
"Read on:"

View More ()

New Projects Recent Q&A

Compact 2S LiPo Battery Charger (http://www.electroschematics.com/12964/compact-2s-lipo-


battery-charger/)

Arduino Visual Basic Integration (http://www.electroschematics.com/12943/arduino-visual-


basic-integration/)

Intelligent Blackout Noti er (http://www.electroschematics.com/12847/intelligent-blackout-


noti er/)

Automatic Fragrance Dispenser Circuit (http://www.electroschematics.com/12839/automatic-


fragrance-dispenser-circuit/)
Retro t Toilet Cistern Over ow Monitor (http://www.electroschematics.com/12833/retro t-
cistern-over ow-monitor/)

(/subscribe)

(https://www.facebook.com/groups/electroschematics/)

THE BASICS

About Us

Contact Us (/contact-us)

Participate (/participate)

Privacy Policy (http://www.aspencore.com/privacy-policy)

Terms of Use (http://www.aspencore.com/terms-of-use)

Feedback (https://www.surveymonkey.com/r/2SMMN52)

FOR ADVERTISERS

Contact Sales (mailto:sales@aspencore.com)

ASPENCORE NETWORK
Electronics Tutorials (http://www.electronics-tutorials.w
ElectroSchematics s/)

Electronic Products (http://www.electronicproducts.com/) 21IC (http://www.21ic.com/)

Embedded Control Europe (http://embedded-control-euro


pe.com/) Elektroda (http://www.elektroda.pl/)

EEWeb (http://www.eeweb.com/) Mikrocontroller (http://www.mikrocontroller.net/en)

Engineers Garage (http://www.engineersgarage.com/) EEM (http://www.eem.com/)

Embedded Know How (http://www.embedded-know-how.c


om/)

CONNECT WITH US

Facebook (https://www.facebook.com/groups/electro YouTube (https://www.youtube.com/user/ElectroSch


schematics/) ematics)

All contents are Copyright 2016 by AspenCore, Inc. All Rights Reserved.

You might also like