Arduino Projects

Arduino RPM Counter & DC Motor Constant Speed Controller

Arduino RPM Counter Description:

 

Arduino RPM Counter & DC Motor Constant Speed Controller- In this tutorial, you will learn how to make an RPM counter and how to automatically adjust the speed of a DC motor. In this project, the IR Sensor will be used with the Arduino Uno for the RPM measurement and a Potentiometer/Variable resistor will be used to set the RPM value. The real-time RPM value will be compared with the preset RPM value and then the Arduino will increase or decrease the speed of the DC motor automatically.

In this tutorial, we will cover,

allpcb circuit
  • The components and tools you will need for this project.
  • What is an RPM Counter?
  • Why we need DC Motor Constant Speed Controller?
  • Complete Circuit Diagram Explanation.
  • Proteus Simulation of the RPM Counter & DC Motor Constant Speed Controller.
  • Program explanation and finally
  • Practical Demonstration of the RPM counter and DC Motor Constant Speed Controller.

Without any further delay, let’s get started!!!


Amazon links

Arduino Nano USB-C Type (Recommended)

12v CPU Fan:

Obstacle IR Infrared Sensor:

Arduino Uno

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.



What is an RPM Counter or Tachometer?

RPM stands for “Revolutions per Minute”. The RPM counter is also known as the Tachometer, revolution-counter, tach, rev-counter, and RPM gauge. The RPM counter or Tachometer is an instrument or a device that is used for measuring the rotation speed of a shaft or disk of a motor or any rotating object.

There are two types of Tachometers

  • A tachometer that has contact with the rotating object, like for example an Encoder.
  • Contact-less tachometer or Optical Tachometers, these types of the tachometer or RPM counters use a laser or Infrared technology for measuring the RPM of a rotating object from a certain distance. The Optical Tachometers are becoming very famous and commonly used in vehicles and machines. The optical tachometers are now commonly used in industries for monitoring the RPM or speed of different AC or DC motors.


In this project, I have used the optical tachometer technology using an IR infrared Sensor.

Arduino RPM Counter

This is an Infrared Sensor. It has two LEDs. The white one is the Transmitter LED while the Black one is the Receiver LED. The range can be adjusted using the variable resistor.  The range of detection is also affected by the color of the object, if you place a Black color object the range of detection will decrease and for a White object, the range is increased. To get a nice reflection, use a white color sticky tap on the object surface.

Arduino RPM Counter

The Transmitted IR rays are reflected by the object and are received by the IR Receiver LED.

Why we need a DC Motor Constant Speed Controller?

DC Motors are used in industrial machines, Electric bikes, Wheelchairs, etc. There are situations when we need to run a DC motor at a constant speed, but sometimes when the load on the DC motor increases the RPM starts to reduce which can really affect the production. In a situation like this, we will need an automatic control system which can automatically adjust the RPM of the DC motor using the Pulse Width Module “PWM” Technique.

To achieve the constant speed or RPM we will need to make an optical tachometer or RPM monitor. The RPM counter or Tachometer will measure the RPM of the DC Motor in Real-Time, this RPM is then compared with the pre-set value defined in the programming and then Arduino decides whether to increase the speed of the dc motor or to decrease the speed. The adjustment value is added or subtracted as per the requirement; this is done automatically by the Arduino Uno.


Arduino RPM Counter Block Diagram:

Arduino RPM Counter

 Arduino RPM counter Circuit Diagram:

Arduino RPM Counter

Let’s first of all, start with the Power Supply which is based on the LM7812 and LM7805 Voltage Regulators. The 12 volts from the LM7812 are used to power up the DC Motor, while the LM7805 voltage regulator is used to power up the 16×2 LCD. In the circuit diagram, you can clearly see all the connections where the 5 volts are connected.

The connections of the 16×2 LCD with the Arduino Uno can be clearly seen. Pin number1 and Pin number16 are connected with the ground. Pin number2 and Pin number 15 are connected with the 5 volts. Pin number3 of the 16×2 LCD is connected with the middle Pin of the variable resistor, this variable resistor is used to control the LCD contrast. While the other two pins of the variable resistor are connected with the 5 volts and GND. The RS Pin of the 16×2 LCD is connected with the Arduino’s Pin number7. Pin number5 which is the R/W pin of the LCD is connected with the ground. The Enable pin of the LCD is connected with Pin number8 of the Arduino Uno. The data pins D4 to D7 of the LCD are connected with the Arduino’s Pins 9, 10, 11, and 12.

There is another variable resistor given at the bottom, its middle Pin is connected with the Arduino’s Analog Pin A0. This variable resistor is used to set the Pre-set value. This variable is used to tell the controller that at which RPM we want to keep the motor speed constant. The real-time RPM is compared with this value.



On the right side, as you can see, the IR Sensor VCC and GND are connected with the Arduino’s 5 volts and ground. While the OUT Pin of the IR Sensor Module is connected with the Arduino’s External Interrupt Pin 2.

The Motor driver circuit is build using TIP122. This transistor is selected due to its ability to handle currents more than 2Amps. A motor is then connected between the +v supply wire and collector of the TIP122 and a 10k ohm resistor is connected at the base of the TIP122 as its BJT a current-controlled device, and another end of the 10k ohm resistor is connected to the PWM pin of the Arduino as per the programming. So that’s all about the Circuit diagram.

 Arduino RPM Counter Programming:


Optical Tachometer or RPM Counter Simulation:

Before I start the soldering I always check my connections in simulation software like Proteus, and once I am satisfied with the results then I start the practical connections.

Arduino RPM Counter

Download Simulation of Arduino RPM counter & DC Motor Constant Speed Controller: simulation

For the practical demonstration watch video given below. This is an old video which I recorded a long time ago, sorry for the video quality. The same project is also known as the frequency locked loop DC Motor Speed Controller.

Arduino RPM Counter Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

6 Comments

  1. It’s a great effort you are helping students. I’m trying to find hex file simulation plz guide me in this regard.

  2. Hello. I’ve been trying to use your code but instead of using an Infrared sensor I want to use a Hall Effect sensor. I don’t know where I’m going wrong?

    int sensePin = 2; // hall effect sensor
    int motorPin = 9; // Motor is connected here

    volatile byte rpmcount;
    unsigned int rpm;
    unsigned long timeold;
    int incmspeed = 25; // default motor speed

    byte val = 1500;

    void rpm_fun()
    {
    rpmcount++;
    }

    void setup()
    {
    pinMode(sensePin, INPUT);
    pinMode(motorPin,OUTPUT);

    attachInterrupt(0, rpm_fun, FALLING);

    rpmcount = 0;
    rpm = 0;
    timeold = 0;
    }

    void loop()
    {

    delay(1000);

    detachInterrupt(0);

    rpm = 601000/(millis() – timeold)rpmcount; // thirty means that the motor blade cuts the sensor two times. so its gonna be half. if the motor blade

    timeold = millis();
    rpmcount = 0;

    attachInterrupt(0, rpm_fun, FALLING);

    if( rpm < val )
    {
    incmspeed = incmspeed + 10;
    }

      if( rpm  > val )
    

    {
    incmspeed = incmspeed – 10;
    }
    // new addition
    if ( incmspeed < 1)
    {
    incmspeed = 0;
    }
    if( incmspeed > 254)
    {
    incmspeed = 255;
    }

    analogWrite(motorPin, incmspeed);
    Serial.print(rpm);
    }

    1. Thanks for this, extremely helpful!!

      Andre..

      Without going into your code, have you used a pull-up resistor to 5V? you will need to with most Hall effect FG outputs.

      Cheers

  3. Dear Mr Engr Fahad

    is it possible to have PR RPM fixed 5 different frequency example 100, 200, 300, 400 & 500rpm with normal rotary switch for rpm selection
    Thanking You

  4. Hello,

    What was meant my:
    int incmspeed = 25; // default motor speed
    What is the “default motor speed?
    Also you’re powering the IR LED from pin 13 but using the sensor from doesn’t need that because it’s always on.
    I tried “the project and it produces extremely high RPMs. For example a 40x40mm fan with a reflector on only one of the blades will produce 45-60 000 RPMs while according to the datasheet it;s a 7000rpm fan. Had to use smaller multiplication by 1000 in order to get in the ballpark but some comments on that will be appreciated as well.
    The sensor is too sensitive and doesn’t work accurately at small distances and on small diameter rotors.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button