I have an Arduino thermometer by Sparkfun that measures temperature. It's very precise, but I need more of an average.
The code I'm using is straight from Sparkfun (https://learn.sparkfun.com/tutorials/sik-experiment-guide-for-arduino---v32/experiment-7-reading-a-temperature-sensor)
const int temperaturePin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
float voltage, degreesC, degreesF;
voltage = getVoltage(temperaturePin);
degreesC = (voltage - 0.5) * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
Serial.print("voltage: ");
Serial.print(voltage);
Serial.print(" deg C: ");
Serial.print(degreesC);
Serial.print(" deg F: ");
Serial.println(degreesF);
delay(1000);
}
float getVoltage(int pin)
{
return (analogRead(pin) * 0.004882814);
}
I'm looking get a reading every minute on an AVERAGE of every 10 seconds, AND throw out outliers, rather than merely what is is every minute. FOR EXAMPLE, if it reads 65, 64, 66, 67, 65, 44 over the course of a minute...it will average the first 5 and throw out 44, for an average of 65.4.
I suggest sorting the numbers and computing the average of a few numbers (about 10-25% of the number of samples may be a good start) near the median. This way you get rid of the outliers quite easy and obtain a relevant average.