Is it difficult to measure rpm of motor ???
I don't think so. Here is one simple solution.
Only one IR sensor and Arduino in your kit can do so.
It is very useful for DIY creators & robot makers and is very easy to make. It requires only 5 minutes for set up.
This assembly works well and can measures rpm much accurately upto 5%. I had tested it till 10000rpm.
And Yes, this can be used for any type of motor Big or Small (industrial too)
What you can do with this?
- Measure rpm / check rpm of motor
- measure speed of robot m/s (step 4)
- Maintain constant speed(rpm) of DC motor (step 5)
How to use
- Stick aluminium foil piece as reference point anywhere on shaft or on its attachment
- Start the motor
- Place IR sensor infront of the reference point.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: We Require
- IR sensor
- Aluminium foil
LCD if you have
- LCD Display
- 10K potentiometer or I2C module(will reduce pins)
For controlling speed
- Motor Driver
- 10K potentiometer
A rigid stand if you have/can make (recommended)
Step 2: How It WORKS ??
So what is the logic behind this ??
It works on basic principle of an encoder and it works much similar to encoder
When a shaft/body rotates, same point on it repetatively comes to original position after one revolution.
But for that it requires some time.
By measuring time (in second) between these two positions ie. completeing one revolution, we get time (second) required to complete one revolution.
Simply taking reciprocal of this value we get rps (revolution per second) of motor.
Multiplying it by 60 will give rpm
Simple haa ! ! !
RPM does not depend on Distance between centre of shaft and reference point.
Now to measure the time difference IR sensor is used. Aluminium foil is used set a reference point. Also it reflects light thus enhances sensitivity of IR. sensor gives HIGH output, when aluminium foil comes infront of the sensor. micros() command is used to measure time which is 10^-6 of second which can measure time lapse at high speed accurately.
Step 3: Preparation & Code
Basic min. requirement
If you want to measure rpm but don't have display.
No problem. You can measure on Arduino's Serial Monitor on PC.
Simply connect data pin of IR sensor to Arduino's pin 2 and connect +5 & ground pin accordingly.
Upload code and test on Serial Monitor
The assembly looks like mess. But it's really simple. Connecting LCD display requires too much wires and connections.
So if you have I2C connector for LCD then I highly recommend to use it. It requires only 2 Arduino pins.
The code uses unsigned long to store time. The code is written so that only when input from IR sensor changes from LOW to HIGH, it will proceed ie. calculate time difference. So it will be triggered only when leading edge of aluminium foil comes in front of the sensor. So there are less chances of false triggering. Each time one revolution is completed, arduino measures time required and it's corresponding rpm which is then displayed on LCD screen. LCD will refresh its value every 0.1 second.
LCD PIN CONNECTIONS
- VSS = Ground
- VCC = +5V
- VEE = Centre pin of Potentiometer
- RS = Pin 8
- RW = Ground
- E = Pin 9
- DB0 = N/C
- DB1 = N/C
- DB2 = N/C
- DB3 = N/C
- DB4 = Pin 4
- DB5 = Pin 5
- DB6 = Pin 6
- DB7 = Pin 7
- LED+ = +5V
- LED- = Ground
Step 4: Update 1 : How to Measure Speed (m/s or Km/hr) of Robot
If you are mounting this on a robot and want to know speed of your robot then follow this -
A very basic principle.
Speed = Perimeter of wheel * speed of wheel
But perimeter is Pi times the Diameter of wheel
So Speed = PI*D * speed of wheel
Speed(m/s) = Pi * D(in meter) * rps
Speed(km/hr) = Pi*D(in kilo meter) * rpm * 60
Add this in code
const int D = _____ ; // Diameter in cm (include at the top)
speed = 3.14159*(D/100)*(rpm/60) // speed in m/s
speed = 3.15159*(D/100000)*(rpm*60) // speed in km/hr
Step 5: Update 2 : Controlling Rpm of DC Motor
Now we know the rpm of the motor.
So it's not difficult to manage speed of the motor.
For this purpose we require a motor driver. EN (enable) pin on driver is used to vary speed of motor using PWM (pulse width management). So simply connect pwm pin (pin 11 used in code) to the EN pin on driver. Also set the pin on driver to HIGH which drives the motor.
Same thing can be done by using fast acting NPN transisor. Use resitors to limit current.
Potentiometer knob is used to set the rpm required.
I tested this code and assembly. Every thing is working well.
Code needed to be slightly fixed because rpm of motor fluctuates wrt set point (speed is not smooth).
But you can try it, it works well. If you have any solution then it will be great.
Advantage of using IR sensor for maintaining conatsnt speed of DC motor
Suppose somehow load is increased on the motor. Which will reduce the RPM of motor. By checking real time rpm, arduino will sense that rpm has been reduced. Accordingly arduino will send signal to increase power supplied to the motor in order to compensate the reduced RPM. Similar thing will happen if load is reduced. Thus a constant RPM will be managed in any condition.
Step 6: Tips and Troubleshooting
1) rpm does not remains stable / not accurate
Change sensitivity of IR sensor by turning knob. Use stand
2) Shows wrong RPM
Reset arduino because code uses micros() which overflows fast. if this not works change sensitivity
I will recommend you to use stand to hold IR sensor
Try this simple and useful RPM tester which is easy to make.
Give your feedback and suggestions.
Participated in the
Automation Contest 2016