Motor Current Signature Analysis for Gear Train Fault Detection
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I'm working on the Motor Current Signature Analysis for Gear Train Fault Detection example. I have a problem with the choice of component since I cannot get a sample rate of 1500Hz. Could someone tell me how to get such a sample rate with an arduino?
Thank you
댓글 수: 0
답변 (2개)
main temas
2020년 10월 23일
I think the problem comes from Matlab, it slows down aqcuisition a lot. try to use directly in arduino you will see that it will go much faster. with Python or Labview also it goes faster. I hope Mathworks can explain to us one day why it slows down so much !!!!
댓글 수: 0
Bora Eryilmaz
2020년 12월 22일
편집: Bora Eryilmaz
2020년 12월 22일
Hi,
I am one of the author's of this example. It is definitely possible to achieve 1500 Hz sampling rate with Arduino Uno and transfer real-time data to MATLAB, without any slowdown, by following a couple of rules.
(1) You have to set the prescaler of the ADC converter to speed up analog to digital conversions. This requires a few lines of low-level Arduino Uno code as follows:
// ADC Prescaler set to 64. Default was 128.
ADCSRA |= (1 << ADPS2) | (1 << ADPS1);
ADCSRA &= ~(1 << ADPS0);
(2) In order to transfer data sampled at 1500 Hz to MATLAB in real time, you also need to set the serial communication speed to 250 kbaud:
Serial.begin(250000);
(3) You have to set a 666 usec loop for 1500 Hz sampling rate, something like
// Variables for the timed loop
constexpr uint32_t sample_time = 666; // microseconds for 1.5 kHz loop
uint32_t previous_time = 0;
// Compact binary data buffer
constexpr uint8_t sz = 5;
uint8_t buffer[sz];
void loop() {
// Run main event at constant rate of sample_time
uint32_t current_time = micros();
uint32_t delta = current_time - previous_time;
if (delta >= sample_time) {
previous_time = current_time;
// Read using analogRead
// Send data using Serial.write and the buffer
}
}
Depending on the size of the data you want to acquire, you might also save the data in an array first and send it later after the data acquisition is complete.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!