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

LM393 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 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);     }  }