Sample rate
in
Integration and Hardware
•
1 year ago
Hi,
For my master's thesis I have to design a device which can measure the clearance between the blade tips and the turbine housing of a gasturbine.
I'm using an analog inductive sensor which is alligned at the inside of the turbine housing. The sensor is coupled with an arduino mega adk board.
The turbine will rotate at a slow, constant speed of 3rpm. There are about 70 blades mounted on the rows where I have to measure the clearance. The blade tip will move at a speed of 0,67 m /s.
The top surface of the blade varies in dimensions depending on the rownumber.
Since the dimensions of the top surface have a big influence on the signal we get from the sensor, we have to be sure that we can take as many measurements as possible.
When the sensor doesn't detect any conductive material(air between 2 blades), the arduino gives a signal of 1023 bytes.
When we can accurately count the number of samples which varies from 1023 bytes(for 1 blade), we can relate this to the dimensions of the surface(a bigger surface gives more measurements than a smaller surface when the rotational movement of the turbine stays the same).
For the moment we are testing the program on the bottom of this post. It's a program we found and adapted on this forum for graphing 6 sensors. We've built a test setup but i'm not sure that we can read all the data that the sensor detects.
I've implemented a crappy function that writes the time and the data to a textfile. As I expected there are some values which aren't written in the textfile.
Do you maybe know a way to reach a more accurate and fast as possible sampling rate?
In a later stage we want to know the clearances of each blade. We will have to implement a function which can relate each clearance measurement to the correct blade. To be able to do this we will insert the number of blades of that row.
I'm not very good at programming so all tips are more than welcome!
Thanks a lot!
Niels
Arduino code:
- #define X_ACCEL_APIN 0
- void setup()
- {
- Serial.begin(115200);
- }
- void loop()
- {
- int waarde=0;
- unsigned int startTag = 0xDEAD; // Analog port maxes at 1023 so this is a safe termination value
- int loopCount;
- #ifdef CHECK_FPS
- unsigned long startTime, endTime;
- startTime = millis();
- #endif
- waarde = analogRead(X_ACCEL_APIN);
- Serial.write( (unsigned byte*)&startTag, 2);
- Serial.write((unsigned byte*)&waarde, 2);
- #ifdef CHECK_FPS
- endTime = millis();
- Serial.print(" - FPS: ");
- Serial.println(1.f / (endTime-startTime) * 1000);
- #endif
- }
- import processing.serial.*;
- import java.util.Date;
- Serial mySerial;
- FileWriter file;
- String filename;
- int starttijd;
- void setup() {
- starttijd = millis();
- mySerial = new Serial( this, Serial.list()[1], 115200, 'N', 8, 1.0 );
- long thisDate = new Date().getTime();
- filename = "output-" + thisDate + ".txt";
- try {
- String emptyStart = "";
- file = new FileWriter(filename, false); // Wtrite empty string to file to clear it on start
- file.write(emptyStart, 0, emptyStart.length()); //(string, start char, end char)
- file.close();
- }
- catch(Exception e)
- {
- println("Error: Can't open file!");
- }
- }
- void draw() {
- while (mySerial.available() >= 2*6+2) {
- readData();
- }
- }
- void readData() {
- int inByte = 0;
- int curMatchPos = 0;
- int[] intBuf = new int[2];
- intBuf[0] = 0xAD;
- intBuf[1] = 0xDE;
- while (mySerial.available() < 2); // Loop until we have enough bytes
- inByte = mySerial.read();
- // This while look looks for two bytes sent by the client 0xDEAD
- // This allows us to resync the server and client if they ever
- // loose sync. In my testing I haven't seen them loose sync so
- // this could be removed if you need to, but it is a good way to
- // prevent catastrophic failure.
- while(curMatchPos < 2)
- {
- if (inByte == intBuf[curMatchPos])
- {
- ++curMatchPos;
- if (curMatchPos == 2)
- break;
- while (mySerial.available() < 2); // Loop until we have enough bytes
- inByte = mySerial.read();
- }
- else
- {
- if (curMatchPos == 0)
- {
- while (mySerial.available() < 2); // Loop until we have enough bytes
- inByte = mySerial.read();
- }
- else
- {
- curMatchPos = 0;
- }
- }
- }
- while (mySerial.available() < 2*6); // Loop until we have a full set of data
- // This reads in one set of data
- {
- byte[] inBuf = new byte[2];
- int data;
- mySerial.readBytes(inBuf);
- // Had to do some type conversion since Java doesn't support unsigned bytes
- data = ((int)(inBuf[1]&0xFF) << 8) + ((int)(inBuf[0]&0xFF) << 0);
- //println(xAccel);
- String tempStr;
- tempStr = data + "\r\n";
- String tijd;
- tijd = Integer.toString(millis()-starttijd);
- try
- {
- file = new FileWriter(filename, true); //bool tells to append
- file.write(tempStr, 0, tempStr.length()); //(string, start char, end char)
- file.write(tijd, 0, tijd.length());
- file.close();
- }
- catch(Exception e)
- {
- println("Error: Can't open file!");
- }
- println(data);
- }
- }
1