📦 Archived documentation: r1 (committed 2026-07-24) View current documentation →

Variable Speed Bearing Vibration Analysis 2

Available on: Flexs Q5C

An extended diagnostic for a Link-Belt F-B22463H bearing: multiple captures per cycle (narrow speed capture, lubrication-film band, two enveloped captures with different low-frequency cutoffs), speed re-measured from the 15× harmonic with a ±2% window before each amplitude extraction, capture success checking, and three logged fault groups.

log("Logic Started",alm.info);

// Link Belt f-b22463h bearing
function getFaultFrequencies(rpm){
  // return our list of fault frequencys in a "label":frequency format.  the frequency value could also be an array such as [0,3500,"AVG"] to get the average amplitude from 0-3500hz
  // the lable used here also automatically creates a marker on the fft amplitude chart for the associated capture
  return {
  "Fundamental": rpm/60,
  "Fundamental Train":0.0071*rpm,
  "Inner Ring Defect":0.1717*rpm,
  "Outer Ring Defect":0.1283*rpm,
  "Roller Defect":	0.0548*rpm,
  "Pelton Cup":	rpm/60*16,
  "Generator Pole":	rpm/60*10,
};
}

setEnv("led","green");

while(run()){

  setEnv("log.clear");// clear the system log
  print(string(__status())); // {"vcc":23.814098,"contact":"","location":"","desc":"","name":"Flexs Vibration Monitor","uid":2585356324,"hw_v":9001,"fw_v":10,"cfg_v":164,"mqueue":0}

  let cap1 = scope.getWaveform({ "ch": 0, "osr": 4096, "size": 4096, "fft": true, "bandpass": false, "fMin": 120, "fMax": 190, "demod": false, "demodRatio": 8 });
  let speed = scope.getPeak(40,70,"hz"); // get the peak amplitude between 50 and 70 hz,  The second argment "hz" labels a marker on the graphical view for the associated capture
  print( string( speed ) ); // {"bin":322,"freq":59.977173,"amp":0.037552}

  let rpm = speed.freq * 120 / 10; // 10 pole motor


 print("Speed based on the peak around line frequency: ",rpm.toFixed() + "rpm, amp=",speed.amp.toFixed(2) + "g");  // Print the RPM from the base frequency peak

  let peak180hz = rpm/60*15;
  speed = scope.getPeak(peak180hz*0.98,peak180hz*1.02,"Speed"); // 2% tollerance
  rpm = speed.freq * 4;
  print("RPM from the 180hz harmonic:",rpm);



let freqs = getFaultFrequencies(rpm); // call our local function which calculates actual hz frequencies for each fault from the motor speed

// extract amplitude data from the FFT
let amplitudes = scope.getAmplitudes(	freqs, // fault freq list object
										2, // If a frequency in the fault list is not defiend as a range, this is the default width in Bins that is used for each precise fault frequency
                    					"MAX"); //default aggregation option "MAX","AVG","SUM"
amplitudes.speed = rpm;




// capture a high frequency fft to monitor lubrication film health
// a degraded lubrication film results in metal / metal contact which produces high frequency vibrations that can be analyzed
print("Analyzing lubrication film health");
let cap2 = scope.getWaveform({ "ch": 0, "osr": 64, "size": 4096, "fft": true, "bandpass": false, "fMin": 0, "fMax": 12000, "demod": false, "demodRatio": 1 });

  // extract the amplitudes for the bands we're interested in
  let hf =  scope.getAmplitudes(
  {
    lubricationFilm:[3500,24000,"AVG"] // 3.khz to 24khz range, use the AVG aggregation function across this range
  }
);







print("Analyzing bearing fault amplitudes");
// capture a fft with frequency demodulation / enveloping to diagnoose bearing failure conditions, fMin could also be set at 3-4khz to filter for just bearing faults
let cap3 = scope.getWaveform({ "ch": 0, "osr": 64, "size": 2048, "fft": true, "bandpass": true, "fMin": 500, "fMax": 32000, "demod": true, "demodRatio": 64 });


  // recalculate the speed based on the 180hz amplitude using the previous rpm to target our search area
  peak180hz = rpm/60*15;
  speed = scope.getPeak(peak180hz*0.98,peak180hz*1.02,"Speed"); // 2% tollerance
  rpm = speed.freq * 4;



  freqs = getFaultFrequencies(rpm); // Get the fault amplitudes for the envoloped capture

 print("RPM (2):",rpm); // print the rpm used to compute the fault frequencies for the amplitudes in this enveloped capture





// extract amplitude data from the FFT
let amplitudes1 = scope.getAmplitudes(	freqs, // freq list
										2,
                    					"MAX"); // aggregation option "MAX","AVG","SUM"
 amplitudes1.speed = rpm;






  print("Analyzing bearing fault amplitudes again");
  // we take another enveloped capture with no low frequency cutoff.
// capture a fft with frequency demodulation / enveloping to diagnoose bearing failure conditions, fMin could also be set at 3-4khz to filter for just bearing faults
let cap4 = scope.getWaveform({ "ch": 0, "osr": 64, "size": 2048, "fft": true, "bandpass": true, "fMin": 0, "fMax": 32000, "demod": true, "demodRatio": 64 });

  peak180hz = rpm/60*15;
  speed = scope.getPeak(peak180hz*0.98,peak180hz*1.02,"Speed"); // 2% tollerance
  rpm = speed.freq * 4;


  freqs = getFaultFrequencies(rpm);

 print("RPM (3):",rpm);





// extract amplitude data from the FFT
let amplitudes2 = scope.getAmplitudes(	freqs, // freq list
										2,
                    					"MAX"); // aggregation option "MAX","AVG","SUM"





amplitudes2.speed = rpm; // datalog the speed
for(let i in hf){ amplitudes[i] = hf[i];} // combine our hf measurements so that they are logged too



  if(cap1  && cap2 && cap3  && cap4){
  print("############ Sucessful Analysis! ############### ");
    // everything in the IO object is logged so we place the fft amplitude results for each computation into it.
io["Front Bearing Faults 1"] = amplitudes;
io["Front Bearing Faults 2"] = amplitudes1;
io["Front Bearing Faults 3"] = amplitudes2;
  } else {
    print("Failed Capture with errors!");
    print("Cap 1:",cap1);
    print("Cap 2:",cap2);
    print("Cap 3:",cap3);
    print("Cap 4:",cap4);
  }



waitMS(10);

}