How to use a LM393 IR Speed sensor with an Arduino – Tutorial
|How to use a LM393 IR Speed sensor with an Arduino – Tutorial
Let’s see how to connect and use a LM393 Speed Sensor to calculate the speed of a DC motor.
Check out our tutorials page at : https://brainy-bits.com/tutorials/ to get the schematic and more information on this tutorial.
How to use a LM393 IR Speed sensor with an Arduino – Tutorial
How to use a LM393 IR Speed sensor with an Arduino – Tutorial
47 Comments
Yay, I'm the first to like this video.
Thanks for watching Mike!
Ivan … I love your videos…. awesome. But … my friend … you need to fix your pronounciation of "potentiometer".
http://dictionary.reference.com/browse/potentiometer
+Neil Kolban Thanks for watching and your comment! And I will work on my pronunciation of "potentiometer" in my next videos! 🙂
Your video’s and web site is very nicely done, you have me hooked.
Shouldn't the Ground of the motor driver be connected to the arduino's Ground in order to have signals travel to the motor driver?
fantastic 😀 , that what i's looking for 🙂
thanks a lot ^_^
Will it work with stepper motor ? and not connected to PC ?
Great tutorial, really useful.
is it possible to use this system with a 220v pwm speed controller? I want to make a speed controller for a 220v router motor on a cnc machine for mach3, im just worried about the higher voltage frying the rest of the circuit. maybe there is buffer circuit or something i need to put between the dc and ac parts?
Nice video. Is encoder disk included when you buy LM393? Where could I find any?
sketch_nov05a.ino: In function 'void timerIsr()':
sketch_nov05a:14: error: 'Timer1' was not declared in this scope
sketch_nov05a.ino: In function 'void setup()':
sketch_nov05a:30: error: 'Timer1' was not declared in this scope
I get the above error message.
I have extracted the TimerOne-r11.zip file into libraries file where all my other libraries work fine for other sketches.
So WHY won't it recognise this, or am I mistaken?
Many thanks
+Max Tubbs Hi, make sure that the folder that has the TimerOne files in your Arduino Libraries folder is named: TimerOne and not TimerOne-r11. Not sure if that's the problem but it's worth a try. Let me know if that doesn't fix it, then we'll try something else 🙂
+Max Tubbs Also make sure that you closed and restarted the Arduino IDE software after you extracted the files.
can u tall me how can use to count the pules to rotate the motor to a particular position. like a stepper motor. plz hlp
Hello there, great tutorial!. It should work with any ir sensor right?. Thanks
can u tell me how i can show rps in lcd.
Hi…. does this tell the RPM of the vehicle or the VELOCITY of the vehicle???? Plzzzzzz help for my project….. I need to know the velocity of my RC vehicle can u tell how to get the velocity…..
While this code is simple so it does not really matter much, to be accurate and safe, your counter variable should be declared as volatile ( volatile keyword should be used in the definition of a variable when there's a chance that the variable's value could change outside the normal flow of execution of the program – which is the case here as you use it in an interrupt).
this is a nice high level explanation.
I'd be careful in the way you handle the math –> as your rotation variable is an integer and integer math are trunking results – what you get when you divide by 20 is highly approximative( but it makes nice for display). In practice with your code, if counter is 20 or 39 you'll show 1 Revolution per second which is correct for 20 but almost way off when counter is 39.
Also, while by defaults lower level interrupts do not stop the execution of an interrupt callback, it might be good practice to call noInterrupts(); and interrupts(); at the beginning and end of your timerIsr function.
Also because it's not a great idea to have long running interrupts (where you do all the printing – that skews timing functions and your main code might need accurate millis() for example) best would be to limit what you do in the timerIsr function. For example you could have a global volatile variable lastMeasuredRPM which you would calculate in timers and do the printing in your main loop function (checking millis() – startmillis) and print every second for example)
Can you make a tutorial taking speed from a spyglass?
i had a problem with this sensors. how the speed sensors will get the rpm data ? all i know.. we put the rotation thing between the two little cube things that allready in the sensor modules. im a correct ? because i didnt see how you put the rotation things in this video.
sorry for my bad english btw 🙂
guys, how do i wanna measure the speed underwater? it is for my final project, can u help me, what sensor should i use, help me plis….
Hello, I'm making a line following robot and I want to know I can connect 04 motors DC (3-6v) in brigde l298n? And how to control the rotation and speed of the motors(02 motors by connecting in series) ?
Thank you.
Hello, can we set the timer to a higher value like 15 mints? and how? thank you.
perfect for beginners! exactly what i was looking for. thanks! which language is the code in .. C ?
why 680 value? i dont understand why maping this value
hi…what is the maximum allowable cable distance between sensor and the UNO??
Would it work if your encoder plate has say 4 holes? You would just divide the counter by 4?
Hello! Can i print the disc with a 3D printer? Do i have to have the exact number of slots you had on your disk?
I was working on a project with your code as the base where the rpm is displayed on an LCD screen, however, these weird characters are also getting displayed along with motor speed .
i cant found the library. please give me the link 🙁
i used stepper motor with tb6600 driver and i also use your encoder coding. but when i combine your coding with my motor stepper coding, the serial monitor shows value 3000 but i didn't let anyting through sensor… how come it could happend:( please help:(
which sensor is used to measure the speed of the vehicle
Very useful, Thank you. Liked. :o)
how to change output pin from speed sensor (pin 2) to another pin ?. Currently im using arduino mega.
what is the maximum rpm that can be measured using this module ?
hi i am prepairing a winding counter and display on lcd for coil winder. is it must to use materials in adition to lcd for display ? if so please tell asimple material? if or not please tell me the code to display rotation on lcd?
Hi how can i use this lm393 project with arduino due.
Can you help me?
Awesome!
I have basically replicated your project here but using a hobby airplane electric motor. The difference for me is I'm dealing with much faster RPMs. Using your code above with the interrupts, I can only sense a maximum of 240 "counts" per second. Anything faster begins to drastically corrupt the reading. Is that a limitation of the interrupt itself or of this sensor (LM393)? I have it plugged into the interrupt 21 (2) pin of my Arduino Mega. What would you suggest if I wanted to increase the counts per second? Thanks in advance.
can u send u circuit…..
Do exactly the same, and it works well, thank you very much, but only works correctly up to 10 Volts, after that, the speed decreases. Please help.
can we control angular position of shaft by the same IR sensor ?
hi I m basically in making of project by using adruino to test the rpm and output voltage from the 24v dc generator of wind turbine can you help me with the coding?
very nice, thank you very much
can you give me coods for ardueno
and map