Operácie

MEMS cvičenie 2: Rozdiel medzi revíziami

Z SensorWiki

(Vytvorená stránka „1. Look-up table #include <avr/pgmspace.h> const PROGMEM int table[] = {11,12,15,...}; Viac info tu: https://www.arduino.cc/en/Reference/PROGMEM 2. Po častiach li...“)
 
(1. Look-up table)
(3 medziľahlé úpravy od rovnakého používateľa nie sú zobrazené.)
Riadok 1: Riadok 1:
1. Look-up table
+
* Návod na cvičenia:
  
 +
 +
 +
 +
* Príklad na pripojenie analógového senzora: http://ap.urpi.fei.stuba.sk/sensorwiki/index.php/Acrob007
 +
* Riadiaca doska Acrob http://ap.urpi.fei.stuba.sk/sensorwiki/index.php/Acrob
 +
* Arduino homepage https://www.arduino.cc/
 +
 +
<source lang="cpp">
 +
#define SerialSpeed 9600  //typical values are 9600 or 115200
 +
#define SampFrequency 10  //sampling frequency in Hz (cycles per second)
 +
#define positionSensor 5        //define your pin here
 +
 +
int mDelay;
 +
int adcValue;
 +
float outputValue;
 +
 +
void setup()
 +
{
 +
Serial.begin(SerialSpeed);
 +
mDelay = 1000/SampFrequency; //calculate delay for proper sampling rate
 +
}
 +
 +
void loop()
 +
{
 +
adcValue = analogRead(positionSensor);
 +
/*  =============================================== */
 +
outputValue = adcValue;  // replace this line with your code
 +
/*  =============================================== */
 +
Serial.print( outputValue ); //reads the analog port and prints value over serial
 +
Serial.print('\n');
 +
delay(mDelay); //delay in milliseconds
 +
 +
}
 +
</source>
 +
 +
 +
 +
 +
 +
 +
== 1. Look-up table ==
 +
 +
 +
<source lang="cpp">
 
  #include <avr/pgmspace.h>
 
  #include <avr/pgmspace.h>
  
 
  const PROGMEM int table[] = {11,12,15,...};
 
  const PROGMEM int table[] = {11,12,15,...};
 +
</source>
  
 
Viac info tu: https://www.arduino.cc/en/Reference/PROGMEM
 
Viac info tu: https://www.arduino.cc/en/Reference/PROGMEM
  
2. Po častiach lineárna náhrada
 
  
 +
== 2. Po častiach lineárna náhrada ==
 +
 +
<source lang="cpp">
 
  if (adcValue > x1) && (adcValue <= x2)
 
  if (adcValue > x1) && (adcValue <= x2)
 
   y = k2 & adcValue + q2;
 
   y = k2 & adcValue + q2;
  
 
  return(y)
 
  return(y)
 +
</source>
 +
 +
 +
 +
== 3. Aproximácia funkcie ==
  
3. Aproximácia funkcie
 
  
 
* http://terpconnect.umd.edu/~toh/spectrum/CurveFitting.html
 
* http://terpconnect.umd.edu/~toh/spectrum/CurveFitting.html

Verzia zo dňa a času 10:43, 23. február 2017

  • Návod na cvičenia:



#define SerialSpeed 9600   //typical values are 9600 or 115200
#define SampFrequency 10   //sampling frequency in Hz (cycles per second)
#define positionSensor 5        //define your pin here
 
int mDelay;
int adcValue;
float outputValue;

void setup()
{
 Serial.begin(SerialSpeed);
 mDelay = 1000/SampFrequency; //calculate delay for proper sampling rate
}
 
void loop()
{
 adcValue = analogRead(positionSensor);
 /*  =============================================== */
 outputValue = adcValue;   // replace this line with your code 
 /*  =============================================== */
 Serial.print( outputValue ); //reads the analog port and prints value over serial
 Serial.print('\n');
 delay(mDelay); //delay in milliseconds

}




1. Look-up table

 #include <avr/pgmspace.h>

 const PROGMEM int table[] = {11,12,15,...};

Viac info tu: https://www.arduino.cc/en/Reference/PROGMEM


2. Po častiach lineárna náhrada

 if (adcValue > x1) && (adcValue <= x2)
   y = k2 & adcValue + q2;

 return(y)


3. Aproximácia funkcie


Odovzdať:

  • Chyby podľa EN 60 770
    • Nepresnosť
    • Meraná chyba
    • Nelinearita
    • Hysteréza
    • Neopakovateľnosť
  • Graf 1: prevodová charakteristika
  • Graf 2: chybové krivky (viď obr.)
  • Program pre mikroprocesor

Example2-1.png


Návrat na zoznam cvičení...