Introduction: OWL Station
This project is a weather station with interaction. We want to measure some weather features with the interaction of the user (clapping). We want to detect the temperature, the humidity and the level of CO2.
The methodology to work this weather station work is:
1 clap: the user will know the temperature depending on the color. The color will be determinated by the color, if the color is…
… light blue, the temperature is lower than 9 degrees
… light yellow, the temperature is from 9 degrees to 15 degrees.
… light orange, the temperature is between 15 and 20 degrees.
… dark orange, the temperature is from 20 degrees to 25 degrees.
… light red the temperatur is between 25 and 30 degrees.
… pure red, the temperature is more than 30 degrees.
2 claps: the user will know the humidity state. It will depen on the velocity of the leds movement.
… very slow: the humidity is menus 25%
… slow: the humidity is between 25% and 50%
… more fast: the humidity is between 50% and 75%
… very fast: the humidity is more than 75%
More than 2 claps: the user will know the CO2 ppm in the air.
… if the color is green, the air quality is good
… if the color is purple, the quality of the air is bad
Step 1: Components Required:
- 1/ Digital Temperature and humidity sensor ( Ref. DHT 22 AM2302)
- 1/ Airquality Sensor ( Ref. MQ135)
- 1/ Microphone Sensor of the soundvoice ( Ref. TE136)
- 2/ NeoPixel Rings LED RGB (Ref. WS1281213)
- 1/ Arduino Genuino Uno
- 1/ Protoboard
- 15/ Jumpers (male to male)
- 1/ Battery 5V holder
- 3/ AA Batteries
- 1/ Owl structure (2 methacrylate plates)
Step 2: Flow Chart
The flow charts helps us to understand the functioning of the Owl Station, to lately make the code easier to create.
As we see on the photo, the functioning is by a loop. If the Owl listen any clap, the loop is interrupted and makes what we are asking for (measuring temperature, humidity and air quality).
Step 3: Mounting
The main precautions you have to take is te leds connection. You should connect the leds to make homogeneous the movement of the eyes.
Step 4: Owl Structure Construction
To make the Owl's structure we did a drawing by Autocad to be then being cut by laser cutter. To paint the Owl, we took some vinyls to later being cut and combined between them to our liking to simulate the owl's fur. We must remember not to put vinyl in the part of the eyes, because it will be where the owl is going to give us all the information as output.
If you liked to do this project, we leave you bellow the Autocad and PDF template.
Attachments
Step 5: Code
#include
#ifdef __AVR__ #include #endif
#define PIN 4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
// Example testing sketch for various DHT humidity/temperature sensors // Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN 6 // what digital pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
//Microfon
int sensorPin = 8; int cont; long st;
float h = dht.readHumidity(true); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true);
//Controlador Aire #include "MQ135.h" #define ANALOGPIN 10 // Define Analog PIN on Arduino Board #define RZERO 206.85 // Define RZERO Calibration Value MQ135 gasSensor = MQ135(ANALOGPIN);
void setup() {
Serial.begin(9600); pinMode(sensorPin, INPUT); cont = 0;
dht.begin();
strip.begin (); strip.show (); // Inicializa todos los píxeles a 'off' strip.setPixelColor ( 0 , 255 , 0 , 255 ); strip.setPixelColor ( 0 , 0 , 0 , 255 ); strip.setBrightness ( 100 );
float rzero = gasSensor.getRZero(); Serial.print("MQ135 RZERO Calibration Value : "); Serial.println(rzero);
}
void colorWipe(uint32_t c, uint8_t wait) { for (uint16_t i = 0; i < strip.numPixels(); i++) { strip.setPixelColor(i, c); strip.show(); delay(wait); } }
void theaterChase(uint32_t c, uint8_t wait) { for (int j = 0; j < 10; j++) { //do 100 cycles of chasing for (int q = 0; q < 3; q++) { for (uint16_t i = 0; i < strip.numPixels(); i = i + 3) { strip.setPixelColor(i + q, c); //turn every third pixel on } strip.show();
delay(wait);
for (uint16_t i = 0; i < strip.numPixels(); i = i + 3) { strip.setPixelColor(i + q, 0); //turn every third pixel off } } } }
void comprovaTemperatura() {
// Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature();
// Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); return;
}
// Compute heat index in Fahrenheit (the default) float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false);
Serial.println("Temperature: "); Serial.println(t); /*Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t"); Serial.print("Heat index: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.println(" *F");*/
if (t < 9) { colorWipe(strip.Color(160, 255, 252), 50); delay(50);
//Serial.println("COLOR BLUE"); } else if (t >= 9 && t < 15) { colorWipe(strip.Color(255, 255, 94), 50); delay(50); //Serial.println("COLOR YELLOW"); // turn the LED off by making the voltage LOW // wait for a second
} else if (t >= 15 && t < 20) { colorWipe(strip.Color(255, 168, 64), 50); delay(50);
//Serial.println("COLOR YELLOW"); // turn the LED off by making the voltage LOW // wait for a second
}
else if (t >= 20 && t < 25)
{ // wait for a second colorWipe(strip.Color(255, 142, 0), 50);
//Serial.println("COLOR RED"); // turn the LED off by making the voltage LOW // wait for a second delay(50);
}
else if (t >= 25 && t < 30)
{ // wait for a second colorWipe(strip.Color(255, 70, 0), 50); //Serial.println("COLOR RED"); // turn the LED off by making the voltage LOW // wait for a second delay(50);
} else
{ // wait for a second colorWipe(strip.Color(255, 0, 0), 50); delay(50); //Serial.println("COLOR RED"); // turn the LED off by making the voltage LOW // wait for a second
}
}
uint32_t Wheel(byte WheelPos) { WheelPos = 255 - WheelPos; if (WheelPos < 85) { return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } if (WheelPos < 170) { WheelPos -= 85; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } WheelPos -= 170; return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); }
void comprovaHumitat() {
// Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(true); // Read temperature as Celsius (the default)
if (h < 25) { uint32_t color = strip.Color(75, 250, 100); strip.show();//Serial.println("COLOR BLUE");
// Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r.
}
else if (h >= 25 && h < 50) { theaterChase(strip.Color(127, 127, 127), 100); //Serial.println("COLOR YELLOW"); // turn the LED off by making the voltage LOW // wait for a second } else if (h >= 50 && h < 75) { theaterChase(strip.Color(127, 127, 127), 65); //Serial.println("COLOR YELLOW"); // turn the LED off by making the voltage LOW // wait for a second
}
else
{ // wait for a second theaterChase(strip.Color(127, 127, 127), 15); //Serial.println("COLOR RED"); // turn the LED off by making the voltage LOW // wait for a second
}
}
void comprovaQualitatAire () {
float ppm = gasSensor.getPPM(); delay(1000); digitalWrite(10, HIGH); Serial.print("CO2 ppm value : "); Serial.println(ppm);
int sine[] = { 4, 3, 2, 1, 0, 15, 14, 13, 12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 36, 35, 34 };
if (ppm < 100) {
colorWipe(strip.Color(75, 250, 100), 50); uint32_t color = strip.Color(75, 250, 100);
for (int i = 0; i < 17; i++) { strip.setPixelColor(sine[i], color); // Draw 'head' pixel strip.setPixelColor(sine[(i + 36 - 8) % 36], 0); // Erase 'tail' strip.show();
} }
else if (ppm > 100) {
colorWipe(strip.Color(0, 250, 0), 50); uint32_t color = strip.Color(0, 250, 0);
for (int i = 0; i < 17; i++) { strip.setPixelColor(sine[i], color); // Draw 'head' pixel strip.setPixelColor(sine[(i + 36 - 8) % 36], 0); // Erase 'tail' strip.show();
} } }
void ferCoses(int aplausos) {
if (cont == 1) { comprovaTemperatura();
} else if (cont == 2) { comprovaHumitat(); }
else if (cont > 3) { comprovaQualitatAire(); }
}
void loop() { // Wait a few seconds between measurements.
if (digitalRead(sensorPin) == HIGH) { if (cont == 0) st = millis(); cont = cont + 1;
while (digitalRead(sensorPin) != LOW) { if (millis() - st > 500) { Serial.print(cont); Serial.println(" aplausos"); ferCoses(cont);
cont = 0; } } } if (millis() - st > 1000 && cont != 0) { Serial.print(cont); Serial.println(" aplausos"); ferCoses(cont); cont = 0; }
}
Step 6: Showing How It Works...
Nextly we will show how does the Owl work, and what happens if we clap once, twice or three times.