X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=rpi_promini%2Frpi_promini.ino;h=d767dd05fb22de970c70af11d4682e03e4ac236c;hb=488180b8cb3ff52eebea03a5d5e4b5da70a06f39;hp=ea9eb671fcc4cae22186076f116ad7787279c468;hpb=1c12728d3935e13aeb7617dd5a1bcb8081c4ebba;p=Arduino diff --git a/rpi_promini/rpi_promini.ino b/rpi_promini/rpi_promini.ino index ea9eb67..d767dd0 100644 --- a/rpi_promini/rpi_promini.ino +++ b/rpi_promini/rpi_promini.ino @@ -5,13 +5,13 @@ RPI pin Arduino RXD TXD TXD RXD - GPIO6 RST + BCM25 RST GND GND +5V RAW 2 433Mhz receive // 3 433Mhz outdoor temperature sensor receiver # DISABLED - 8 DHT22 + 8 DHT22 (VCC from arduino VCC) 10 433Mhz send 11 DS18B20 12 315Mhz send @@ -40,7 +40,7 @@ DallasTemperature sensors(&oneWire); int int_0 = 300; // ms int int_1 = 900; // ms int wait = 2000; // ms -int repeat = 20; // times (5 times seem a little low for sensors which are more than 10m away) +int repeat = 5; // times (5 times seem a little low for sensors which are more than 10m away) void send_315(char *code) { Serial.print("send 315Mhz "); @@ -78,8 +78,8 @@ DHT dht; #include "RunningAverage.h" -RunningAverage temp_avg(20); -RunningAverage hum_avg(20); +RunningAverage temp_avg(10); +RunningAverage hum_avg(10); // setup @@ -114,11 +114,13 @@ unsigned long time = millis(); void loop() { if ( millis() - time > 2000 ) { float t = dht.getTemperature(); - if ( dht.getStatus() == 0 ) + float delta_t = abs(t - temp_avg.getAverage()); + if ( dht.getStatus() == 0 && delta_t < 10 ) temp_avg.addValue( t ); else dht22_errors++; float h = dht.getHumidity(); - if ( dht.getStatus() == 0 ) + float delta_h = abs(h - hum_avg.getAverage()); + if ( dht.getStatus() == 0 && delta_h < 10 ) hum_avg.addValue( h ); else dht22_errors++; time = millis();