Advertisement

Motor Speed Sensor Module Circuit

motor speed sensor module

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.

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 specific 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) configured 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.

motor speed sensor module circuit

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 wouldn’t 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.

encoder disc wheel

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 sufficient for the task.

encoder disk

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).

proof of concept

After construction and pre-flight 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 motor’s rpm value. Arduino hardware hook up indicator (plus the demo sketch) is given below. Have a try!

arduino module connection

int encoder_pin = 2; // pulse output from the module
unsigned int rpm; // rpm reading
volatile byte pulses; // number of pulses
unsigned long timeold;
// number of pulses per revolution
// based on your encoder disc
unsigned int pulsesperturn = 12;
void counter()
{
   //Update count
   pulses++;
}
void setup()
{
   Serial.begin(9600);
   pinMode(encoder_pin, INPUT);
   //Interrupt 0 is digital pin 2
   //Triggers on Falling Edge (change from HIGH to LOW)
   attachInterrupt(0, counter, FALLING);
   // Initialize
   pulses = 0;
   rpm = 0;
   timeold = 0;
}
void loop()
{
   if (millis() - timeold >= 1000) {
      //Don't process interrupts during calculations
      detachInterrupt(0);
      rpm = (60 * 1000 / pulsesperturn )/ (millis() - timeold)* pulses;
      timeold = millis();
      pulses = 0;
      Serial.print("RPM = ");
      Serial.println(rpm,DEC);
      //Restart the interrupt processing
      attachInterrupt(0, counter, FALLING);
   }
}

14 Comments

Join the conversation!

Error! Please fill all fields.
  • kikiloaw

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

  • Taha

    Thank you again
    But can I know if I can connect it to LCD

    • 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 specific requirements.

  • Taha

    My last question: How we’re gonna connect this circuit with the motor?And Is there’s a video for this circuit while it works?

    And Thank you again.

    • Dandara

      Tohundowc! That’s a really cool way of putting it!

    • Taha

      Thank You very much.
      It was the last step.

    • T.K.Hareendran

      @Taha: Welcome!

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

  • tkhareendran

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

  • Taha

    Sorry but for complete it, I was asking how much power it’ll take for VCC ?

  • 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.

  • 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 scaffold 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.

    • T.K.Hareendran

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

Looking for the latest from TI?