Arduino RPM counter with IR sensor

I'm a Beginner.
I want to make a RPM counter with using Arduino and IR sensor.i want to put a limit for RPM and operate output relay.for example if the RPM is ">=100" the output should active. If the RPM is "<100" Deactivate the Relay please help me out.

Show is what you've got so far, in code tags, and describe how it falls short of your expectations.

A schematic would be useful too.

Hi,
Have you googled;

arduino ir tacho

Tom... :grinning: :+1: :coffee: :australia:

Yeah but I couldn't understand

Hi,

Can you please tell us your electronics, programming, arduino, hardware experience?

If you want someone to do it for you, put your post in "Gigs and Collaboration".

Tom... :grinning: :+1: :coffee: :australia:

Arduino mega and uno.led blinking , seven segment, 16×2 lcd, push button interfacing, programming external atmega328p Ic with arduino uno and mega. But I copied these programs from Google.

So, did you ever try changing things in the code you copied?
Like, making the off time of the blinking led different to the on time?

I did little bit changes only for example sing led to sequential led blinking. 7segment numbers to Alphabets like so

I tried Some IR tachometer codes and I try to set a if condition but it's not working properly

We can't see what you tried.

void setup() {

pinMode(2, INPUT);

pinMode(A0, OUTPUT);


}

int rpmPin = 2;

int rel1 = A0;


volatile byte half_revolutions; 
unsigned int rpm;
unsigned long timeold;
void setup()
{ 
Serial.begin(9600); 
attachInterrupt(digitalPinToInterrupt(rpmPin), rpm_fun, RISING); half_revolutions = 0; 
rpm = 0;
timeold = 0; 
} 
void loop()
{
if (half_revolutions >= 20) { 
//Update RPM every 20 counts, increase this for better RPM resolution, //decrease for faster update
rpm = 30*1000/(millis() -
timeold)*half_revolutions;
timeold = millis();
half_revolutions = 0; 
Serial.println(rpm,DEC);

if(rpmPin > 100){
analogWrite(rel1, HIGH);
;
}

if(rpmPin, < 100){
analogWrite(rel1, LOW);
}

What's the comma for?

Wouldn't you normally use a digitalWrite for a relay?

Yes I used that in my relay operating with push button. I will use digitalWrite instead of analogWrite in this code

Have you tried compiling it? There are some simple glaring errors there the compiler will find for you.

Yeah it's showing compilation error :relaxed:

Can you please correct it

What does not work is also a lesson to be understood, the final school is the school of debugging where experienced students speak of 95% done, 95% to go. That's not a rule, it's how far they reached.

Please, simple is best here because less to go wrong and fewer things to confuse lessons.

... show the smallest sketch that you tried and say what it does, not what you think it does or should do.

Can you make a sketch that reads the IR detector and makes led13 the same state, ON or OFF? 100RPM should make led13 blink quickly.

Looking is not enough to learn doing. Only doing is enough.

1 Like

Thankyou so much for your valuable suggestions.
Can you suggest me a tutorial for arduino..?

A word of warning - avoid just about anything on YouTube - they're often just show-and-tell,with little or no depth,unless they're a linked, progressive series.

While watching most of the youtube videos i get confused than clarity.
Thankyou you so much for your support and suggestions.