So I have loads of these from an old project that you guessed it – I never got round to, but how accurate are these cheapest of cheap things?
Set up an Arduino/RasPi with all the sensors and get it to read them all back – if all in one location then they should all be the same right? Lets see how accurate they are! I’ll run the test for a week (probably longer) with various conditions and then report back.
oh and some code….
// origional code from ladyada, public domain
#include "DHT.h"
#include
#include
DHT dht0(2, DHT11);
DHT dht1(3, DHT11);
DHT dht2(5, DHT11);
DHT dht3(6, DHT11);
DHT dht4(7, DHT11);
DHT dht5(8, DHT11);
DHT dht6(9, DHT11);
DHT dht7(A0, DHT11);
DHT dht8(A1, DHT11);
DHT dht9(A2, DHT11);
//older sensors
DHT dht10(A4, DHT11);
DHT dht11(A5, DHT11);
float temps[12];
float hmids[12];
void setup() {
Serial.begin(9600);
Serial.println("DHT test!");
dht0.begin();
dht1.begin();
dht2.begin();
dht3.begin();
dht4.begin();
dht5.begin();
dht6.begin();
dht7.begin();
dht8.begin();
dht9.begin();
dht10.begin();
dht11.begin();
SD.begin(4);
}
void loop() {
// Wait a few seconds between measurements.
delay(30000);
hmids[0] = dht0.readHumidity();
temps[0]= dht0.readTemperature();
hmids[1] = dht1.readHumidity();
temps[1]= dht1.readTemperature();
hmids[2] = dht2.readHumidity();
temps[2]= dht2.readTemperature();
hmids[3] = dht3.readHumidity();
temps[3]= dht3.readTemperature();
hmids[4] = dht4.readHumidity();
temps[4]= dht4.readTemperature();
hmids[5] = dht5.readHumidity();
temps[5]= dht5.readTemperature();
hmids[6] = dht6.readHumidity();
temps[6]= dht6.readTemperature();
hmids[7] = dht7.readHumidity();
temps[7]= dht7.readTemperature();
hmids[8] = dht8.readHumidity();
temps[8]= dht8.readTemperature();
hmids[9] = dht9.readHumidity();
temps[9]= dht9.readTemperature();
hmids[10] = dht10.readHumidity();
temps[10]= dht10.readTemperature();
hmids[11] = dht11.readHumidity();
temps[11]= dht11.readTemperature();
Serial.print("Temps ");
for (int i=0;i<12;i++)
{
Serial.print(temps[i]);
Serial.print(", ");
}
Serial.println();
Serial.print("humids ");
for (int i=0;i<12;i++)
{
Serial.print(hmids[i]);
Serial.print(", ");
}
Serial.println();
//write data to SD card
File dataFile = SD.open("dhtdata.txt", FILE_WRITE);
if (dataFile) {
dataFile.print("Temps, ");
for(int i=0;i<11;i++)
{
dataFile.print(temps[i]);
dataFile.print(", ");
}
dataFile.print("Humids, ");
for(int i=0;i<11;i++)
{
dataFile.print(hmids[i]);
dataFile.print(", ");
}
dataFile.println(';');
dataFile.close();
}
//Serial.println(t);
}