Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   Signal Noise (http://www.chiefdelphi.com/forums/showthread.php?t=81628)

Golto 31-01-2010 23:43

Signal Noise
 
1 Attachment(s)
I don't know how useful this info will be, but I was able to graph out signal noise across a couple KOP sensors.

The hardware was tested on an Arduino Diecimilia, Analog port 0, the code will be posted later. I also used a program called Gobeteeno to assist in logging the data. Then in Excel I manipulated the data and generated a graph. The data was taken over 100 samples 1/10 of a second apart.

The sensors tested were the 2009 KOP 3-axis Accelerometer and the 2010 KOP Gyro, rate and temp. The graphs are attached as a .zip, inside are the PDFs generated.

INSTRUCTIONS:
  1. Download Betweeno from http://mikmo.dk/gobetwino.html
  2. Consulting documentation, add a process for EXCEL in Gobetwino
  3. program the arduino with the following code
  4. start gobetwino
  5. press reset on the Arduino
  6. watch as the data populates!

Code:

/*****************************
 * ANALOG SENSOR NOISE TEST  *
 * 2010 Patrick Plude        *
 *****************************/
 
// some setup variables
int serInLen = 25;
char serInString[25];
int pId =0;
int result;

void setup()
{
  Serial.begin(9600);
  Serial.println("#S|EXCEL|[]#");        // start EXCEL
  readSerialString(serInString, 5000);  // wait  5  seconds (max) for answer from Gobetwino (=porcess ID)
  pId= atoi(serInString);              // convert result to integer
  sendAnalogValues();                      // send some data to Excell
}
 
void loop()
{
  // no code here, all carried out in subroutines!
}

void sendAnalogValues()
{
  char buffer[5];
  int sensorValue;
 
  for (int i=1; i<=100; i++){
    //Read the sensor values
    sensorValue=analogRead(0);
 
    //Send the values as though it was typed into Excell, using the SENDK command
    // This is the total line that is send: #S,SENDK,[pId; sensorValue {TAB} potValue2 {DOWN} {LEFT} ]#
    Serial.print("#S|SENDK|[");
    Serial.print(itoa((pId), buffer, 10));
    Serial.print("&");
    Serial.print(itoa((sensorValue), buffer, 10));
    Serial.print(" {ENTER} ");
    Serial.println("]#");
    // wait up to 1000 ms for answer from Gobetwino, answer will be in serInString, answer is 0 if all is OK
    readSerialString(serInString, 1000);
    //Deal with answer here - omitted in this example
    delay(10);
  }   
}

//read a string from the serial and store it in an array
//you must supply the array variable - will return if timeOut ms passes before the sting is read so you should
//check the contents of the char array before making any assumptions.
void readSerialString (char *strArray,long timeOut)
{
  long startTime=millis();
  int i;

  while (!Serial.available()) {
      if (millis()-startTime >= timeOut) {
        return;
      }
  }
  while (Serial.available() && i < serInLen) {
      strArray[i] = Serial.read();
      i++;
  }
}

Enjoy! Any questions, send me a PM


All times are GMT -5. The time now is 12:36.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi