Use inductive proximity sensor for velocity

Hello,

I would like to use an inductive proximity sensor to calculate the velocity of a blade and I have this sensor: IME-12 SICK

The blade will run at about 1200 RPM at maximum.

Is it possible to read velocity by using this sensor or is it too much for the Arduino MEGA controller that run at 16Mhz? Moreover, I know that I should use a resistor in order to keep the output signal at 5VDC, but should I connect the sensor output to an analog sensor input or should I read it by using a digital input?

Should I use an interrupt to check when the signal is HIGH?
What happens if my code needs to perform other actions in the meanwhile? I know Arduino will execute the code sequentially, so I'm thinking about delays.

Sorry for all the questions!

So your idea is to calculate velocity by measuring the time that the proximity detector says the fan blade is close?

I read the data sheet to say that the output is like a switch, perhaps just an open collector transistor, you only get there/not there digital signal form it.

a7

1 Like

Buy only sensors or other parts coming with documentation and Arduino library and example code. In your case also look for application notes that cover your problem.

1 Like

Without knowing how many blades you device has 1,2,4 ?? One can only guess.

1200 RPM = 20 RPS which is the same as 50ms per sensed blade.

If I assume 2 then the pickup will sense a blade then the time between blades is 25ms.

25 ms is easy for an Arduino to count. However will your sensor respond in < 25ms? My guess is NO but this is only based on a thought that most automation equipment does not need such a fast response. But I don't know.

1 Like

Google will not show me a translation of the PDF, but this entry worries me: Frequenza di commutazione 2.000 Hz. Does that mean the device can only produce an output every two seconds?

1 Like

In Europe our period is a comma.

so USA $2,000.00 is Two thousand dollars.

In EU $2000,00 it two thousand dollars.

So the frequency is 2000

But still not sure what the 2000 means.

1 Like

Oh, ok, that likely means it can be transitioned up to 2000 time per second.
The OP has two options to compute velocity.
First would be based on the width of the blade and the time it took to pass the sensor.
Second would be to note the leading edge of the blade and the time for that to be repeated.
Then the velocity can be computed.
Problem will likely occur when the blade is stopped right under the sensor.

1 Like

Climbed around a bit and landed on the English language pages.

And DOH! of course blade to blade timing, geez.

a7

1 Like

Sorry, guys, this is the datasheet in english: https://cdn.sick.com/media/pdf/0/70/470/dataSheet_IME12-04BNSZW2S_1040774_en.pdf

It is not important to accurately read the blade RPM, I just need to have an estimation of the overall velocity. The device has a total of two blades and it is used in agricultural application to cut the plants; so it is fine to read, for example, 1000 RPM while the device is spinning at 1100 or 900 RPM, I mean, an error of +/- 100 RPM is still acceptable.

My concern is about the timing since my code also has to perform other actions.

I know that I will have to use a timer to count how many times the signal coming from the sensor becomes HIGH, but what happens if I have to execute other code in parallel with the timer?

Pretty sure this is a relatively slow thing that could be done by polling, if your other computations are loop-friendly (don’t block), especially given your willingness to live with gross inaccuracies.

This may also be an appropriate case for using interrupts, I don’t see a huge problem with that idea here.

And if the fan stops, it would simply mean no more transitions; another thing that could be done in the loop or however is noticing this absence to deduce that the velocity or RPM proxy is… zero.

a7

Can we clarify what it is, exactly, the OP wants? He mentions velocity and RPM. The velocity of a rotating object varies based on how far from the center axis you are measuring. From the sound of the project, only the RPM is needed to know if the machine is operating properly, NOT the blade velocity.

My approach would be to use an interrupt to accumulate the number of transitions of the sensor output. Then in the main loop, once a second get the accumulated value, save it, and then compute the number of turns for a minute.
That way the rest of the Arduino functions can continue as needed.

1 Like

Should I use something like this?

void setup(){
  Serial.begin(9600);                     
  attachInterrupt(0, tick_count, RISING);  
  pinMode(2, INPUT);                       
 }  


void tick_count()                         
 {  
    tick++;                              
 }

void loop() {      
 
  if(tick>=2)                                       //blades = 2
   {
    rpm = 30*1000/(millis() - timeold)*tick;        
    timeold = millis();                             
    tick = 0;     
     }
// CAN I PUT ALL THE OTHER CODE HERE WITHOUT HAVING DELAYS?
  Serial.print("   RPM = ");
  Serial.println(rpm);
  delay(100);
}

I haven't tested this code, yet, it is just a guess of how it should work.
I don't know if it makes sense.

At a glance that looks plausible.

The tick variable shoukd be qualified as volatile.

rpm and anything around computing with millis should be unsigned long.

There will be no harm in trying… while we wait for more better eyes.

a7

1 Like

I received the sensor today and I tested it with Arduino.
The sensor outputs +12VDC when a metal object is detected, so I used a voltage divider (1470 Ohm / 1K Ohm) in order to output +5VDC to Arduino.

I'm able to check when a detection occurs, but I'm still worried about the performance.

For example, if I want to use this sensor also to read RPMs from a gasoline engine that can reach 3500 RPM and I place it to read ticks coming from a gear that has 126 teeth, would it work?

125 teeth are a full revolution.

Is it too much to handle for Arduino MEGA?

If the maximum RPMs are 3500, then I should have about 58 samples per second and so I should be able to read 125 x 58 = 7250 ticks per second.
I think it is too much for the atmega2560, is it correct?

The sensor is specified for 2kHz max.

1 Like

Check my math, but that's 7.3 kHz.

Can the sensor do that?

Maybe leave out the Arduino. I never used one, but there are frequency to voltage converters like the LM2917.

And I see someone has posted the max frequency of the sensor, so 125 teeth are too many.

a7

1 Like

In my lab, I also have this other speed sensor https://www.rheintacho.de/fileadmin/user_upload/Datenblaetter/Magnetisch-induktiv/Datasheet_1-Channel_IDG_Standard.pdf which is rated up to 50 KHz.

Can the atmega256 handle the 7KHz in this case?
The controller should also perform other actions like communicating over serial port, read other inputs and set some outputs.

You will need to change the sine wave output to digital, but as you can well see, 30kHz is the maximum speed.

1 Like

Thank you, @Paul_KD7HB

What do you mean to "change" from sine wave to digital?

Look at the PDF you linked to. The sensor output is a sine wave. To get any speed at all for your Arduino counting your need a digital signal on a digital pin.