LM393 Speed sensor

Motor Speed Encoder Sensor


15 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2021-02-03



LM393 Speed Sensor with disk






add TIMER library



Go to the sketch then click on the include library and then in the include library click on add zip library.





after added it >> will find it in libraries like next picture








LM393 Speed Sensor with Arduino, Circuit diagram:






arduino code

code
نسخ
اقتباس
عرض
تنزيل
	
								
#include "TimerOne.h" unsigned int counter=0; void docount() // counts from the speed sensor { counter++; // increase +1 the counter value } void timerIsr() { Timer1.detachInterrupt(); //stop the timer Serial.print("Motor Speed: "); int rotation = (counter / 20); // divide by number of holes in Disc Serial.print(rotation,DEC); Serial.println(" Rotation per seconds"); counter=0; // reset counter to zero Timer1.attachInterrupt( timerIsr ); //enable the timer } void setup() { Serial.begin(9600); Timer1.initialize(1000000); // set timer for 1sec attachInterrupt(0, docount, RISING); // increase counter when speed sensor pin goes High Timer1.attachInterrupt( timerIsr ); // enable the timer } void loop() { }





سلة المشتريات افراغ السلة