meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ixc2025:team_1:start [2025/05/14 13:41] karppiixc2025:team_1:start [2025/05/15 16:29] (current) karppi
Line 1: Line 1:
-====SIFLOPP====+=====SIFLOPP=====
  
 {{ :ixc2025:team_1:ixc_presentation_template_1_.pptx |Day 2 Presentation}} {{ :ixc2025:team_1:ixc_presentation_template_1_.pptx |Day 2 Presentation}}
  
 +=== 1. Group Introduction ===
 +So, we called our home "GreenGuard". It is a sustainable IoT-based smart home solution designed to enhance energy efficiency, comfort, and safety. It integrates multiple sensors and smart components to intelligently manage home environments while minimizing energy consumption. The key features include:
  
 +=== 2. Initial brainstorming ideas/concepts ===
 +🌡️ Smart Climate Control:
 +
 +Automatically opens windows when the temperature exceeds 20°C or humidity surpasses 70%, promoting natural ventilation.
 +
 +Fan activation within a comfortable temperature range (20-30°C) to improve air circulation without overcooling.
 +
 +🔕 Silent Mode with RFID:
 +
 +Mutes alerts using an RFID card, reducing noise pollution and conserving power when not needed. (we are still trying to get the RFID tag reading to work)
 +
 +🚪 Motion-Activated Door Control:
 +
 +Opens the door only when motion is detected and a button is pressed, enhancing security and minimizing unnecessary power usage.
 +
 +🌐 Real-Time Weather Integration:
 +
 +Displays next-day weather forecasts on the LCD, optimizing heating and cooling decisions based on external conditions (requires WiFi).
 +
 +🌱 Energy-Saving and Eco Modes:
 +
 +Window and fan behavior adapt based on indoor conditions, reducing HVAC system reliance and lowering overall power consumption.
 +
 +📊 Comprehensive Status Monitoring:
 +
 +Real-time temperature, humidity, and air quality data displayed on a 16x2 LCD for continuous home status awareness.
 +
 +
 +=== 3. Day 2 Presentation slides ===
 +{{ :ixc2025:team_1:ixc_presentation_template_1_.pptx |Day 2 Presentation}}
 +
 +
 +=== 3. Finalised Idea, description & Functions ===
 +Home that tracks electricity prices and adapts to it
 +
 +
 +
 +=== 6. Future Improvements ===
 + 
 +
 +Ad-Hoc Sensor Networks for Neighborhood Safety:​
 +Emergency Alerts: Nearby homes can communicate to share data about fire, smoke, gas leaks, or intrusions.​
 +Collective Security: Use mesh networks to create a neighborhood-wide alarm system for better safety.​
 +Predictive Maintenance and Analytics:
 +AI-Based Predictions: Use machine learning to predict appliance failures and optimize maintenance schedules.​
 +Usage Analytics: Provide insights on energy usage to promote more sustainable habits.​
 +
 +
 +Renewable Energy Integration:
 +Solar and Battery Integration: Smart control for charging and discharging based on real-time energy prices.​
 +Electric Vehicle (EV) Charging Management: Coordinate EV charging when electricity is cheapest.​
 +Waste and Water Management:
 +Smart Water Meters: Detect leaks and optimize water usage.​
 +Compost and Recycling Guidance: Use sensors to assist in proper waste segregation.
 +
 +
 +
 +
 +
 +
 +
 +===notes===
 Day 1: We gathered our team members according to our interests and built our smart home. Then we tested a few existing codes. Day 1: We gathered our team members according to our interests and built our smart home. Then we tested a few existing codes.
 We brainstormed with each other and finally agreed about the main points that we are all going to build for our sustainable home. We brainstormed with each other and finally agreed about the main points that we are all going to build for our sustainable home.
Line 24: Line 88:
 - After discussion, we decided to use the left button to turn off the buzzer and the right button to switch between the data that is shown in owr LCD. For instance, it shows the electricity price and the temperature. - After discussion, we decided to use the left button to turn off the buzzer and the right button to switch between the data that is shown in owr LCD. For instance, it shows the electricity price and the temperature.
  
-- The LED turns on when the prices are low for example.+- The LED turns on when the prices are low for example. So, we are fetching online the electricity price from the electricity provider (it could be for example extracted from here: 
 +https://vare.fi/sahkon-hinta/sahkon-hinta-nyt/?utm_term=s%C3%A4hk%C3%B6n%20hinta%20nyt%20p%C3%B6rssis%C3%A4hk%C3%B6&utm_campaign=SEM+%7C%C2%A0S%C3%A4hk%C3%B6n+hinta&utm_source=adwords&utm_medium=ppc&hsa_acc=9613272229&hsa_cam=21500165233&hsa_grp=164788003843&hsa_ad=706690047770&hsa_src=g&hsa_tgt=kwd-2366899273632&hsa_kw=s%C3%A4hk%C3%B6n%20hinta%20nyt%20p%C3%B6rssis%C3%A4hk%C3%B6&hsa_mt=b&hsa_net=adwords&hsa_ver=3&gad_source=1&gad_campaignid=21500165233&gbraid=0AAAAAC5G_NIUGrEO4FEF5yBbn5WpWL1ER&gclid=CjwKCAjw_pDBBhBMEiwAmY02NgOSaQ7zkck59UzrX335iREoeV3npKda0DlU1P5GvDATViJVcy2K7xoCwXgQAvD_BwE ) 
 + 
 +And according to the prices, our home appliances are used. 
 +The current price is also displayed on our LCD and the right button gives us the option to switch to other views. 
 +If the price is high, the buzzer goes on and the red light is on. 
 +The buzzer could be turned off with the left button. 
 +We could add a green led light all the time when the price is considered low or negative 
 + 
 + 
 +{{:ixc2025:team_1:20250514_133202.jpg?400|}} {{:ixc2025:team_1:20250514_132909.jpg?600|}} 
 +=== 4. SUSAF Analysis === 
 + 
 +{{:ixc2025:team_1:näyttökuva_2025-05-15_kello_13.25.22.png?400|}} 
 +=== 5. Power meter measurements === 
 + 
 +{{:ixc2025:team_1:screenshot_from_2025-05-15_15-06-43.png?600|}} 
 +{{:ixc2025:team_1:result_data.png?400|}} 
 + 
 + 
 +=== 7. Final Day Presentation Slides === 
 + 
 +final ppt 
 +{{ :ixc2025:team_1:greenguard_smart_home_presentation_final_day.pptx |}} 
 + 
 + 
 +=== 8. Final Code ===
  
  
-{{:ixc2025:team_1:20250514_133202.jpg?400|}} {{:ixc2025:team_1:20250514_132909.jpg?400|}}+#include <WiFi.h>  
 +#include <HTTPClient.h>  
 +#include <Wire.h>  
 +#include <LiquidCrystal_I2C.h>  
 +#include <DHT.h>  
 +#include <DHT_U.h>  
 +#include <FastLED.h>  
 +  
 +  
 +// WiFi  
 +const char* ssid = "Phone";  
 +const char* password = "12345678";  
 +  
 +  
 +// Tilamuuttujat  
 +int screenstate = 0;  
 +float price = 0;  
 +float temperature;  
 +float last_temperature;  
 +float humidity;  
 +float last_humidity;  
 +bool alertcheck = true;  
 +  
 +  
 +// Rajat  
 +#define PRICE_ALERT_THRESHOLD 20.0 // c/kWh  
 +  
 +  
 +// Pinimääritykset  
 +#define LED_PIN 26  
 +#define BUTTON_LEFT_PIN 16  
 +#define BUTTON_RIGHT_PIN 27  
 +#define BUZZER_PIN 25  
 +#define NUM_LEDS 4  
 +#define DHT_PIN 17  
 +#define DHT_TYPE DHT11  
 +  
 +  
 +// Näyttötilat  
 +#define price_display 0  
 +#define temperature_display 1  
 +  
 +  
 +// Muut globaalit  
 +CRGB leds[NUM_LEDS];  
 +boolean alertStatus = false;  
 +int display_state = 0;  
 +LiquidCrystal_I2C lcd(0x27, 16, 2);  
 +DHT dht(DHT_PIN, DHT_TYPE);  
 +  
 +  
 +// Ajastin hintapäivitykselle  
 +unsigned long lastPriceUpdate = 0;  
 +const unsigned long priceInterval = 0.5 * 60 * 1000; // 30 sec  
 +  
 +  
 +// WiFi-yhteys  
 +void connectwifi() {  
 +WiFi.begin(ssid, password);  
 +Serial.println("Yhdistetään WiFi-verkkoon...");  
 +  
 +  
 +while (WiFi.status() != WL_CONNECTED) {  
 +delay(500);  
 +Serial.print(".");  
 +}  
 +  
 +  
 +Serial.println("\nWiFi-yhteys muodostettu!");  
 +}  
 +  
 +  
 +// Piippaus  
 +void beepBuzzer() {  
 +tone(BUZZER_PIN, 440, 250);  
 +noTone(BUZZER_PIN);  
 +}  
 +  
 +  
 +// Hälytys  
 +void alert(String warningMessage, int freq) {  
 +lcd.clear();  
 +lcd.setCursor(0, 0);  
 +lcd.print(warningMessage);  
 +  
 +  
 +while (alertStatus)  
 +beepBuzzer();  
 +for (int i = 0; i < NUM_LEDS; i++)  
 +leds[i] = CRGB::Red;  
 +}  
 +FastLED.show();  
 +delay(1000 / freq);  
 +  
 +  
 +if (digitalRead(BUTTON_LEFT_PIN) == LOW) {  
 +delay(50); // debounce  
 +alertStatus = false;  
 +clearAlert();  
 +}  
 +  
 +  
 +for (int i = 0; i < NUM_LEDS; i++) {  
 +leds[i] = CRGB::Black;  
 +}  
 +FastLED.show();  
 +delay(1000 / freq);  
 + 
 + 
 +  
 +  
 +// Hälytyksen poisto  
 +void clearAlert()  
 +alertStatus = false;  
 +lcd.clear();  
 +for (int i = 0; i < NUM_LEDS; i++)  
 +leds[i] = CRGB::Black;  
 +}  
 +FastLED.show();  
 +alertcheck = false;  
 +}  
 +  
 +  
 +// Oikean napin painallus  
 +int r_buttonPress() {  
 +if (digitalRead(BUTTON_RIGHT_PIN) == LOW) {  
 +delay(100); // debounce  
 +return 1;  
 +}  
 +return 0;  
 +}  
 +  
 +  
 +// Näytön päivitys  
 +void screen(int state) {  
 +lcd.clear();  
 +if (state == temperature_display) {  
 +lcd.setCursor(0, 0);  
 +lcd.print("Temp");  
 +lcd.print(temperature);  
 +lcd.print(" C");  
 +lcd.setCursor(0, 1);  
 +lcd.print("Hum: ");  
 +lcd.print(humidity);  
 +lcd.print(" %");  
 +} else if (state == price_display) {  
 +lcd.setCursor(0, 0);  
 +lcd.print("Price: ");  
 +lcd.print(price);  
 +lcd.print("c/kWh");  
 +}  
 +}  
 +//randomhinta  
 +float changePrice() {   
 +  
 +  
 +float newPrice = random(18, 30); // Generoi uusi hinta   
 +  
 +  
 +if (newPrice > 0.5 || newPrice < -0.05) {   
 +  
 +  
 +//newPrice = 0.05; // Palauta hinta, jos se karkaa käsistä   
 +  
 +  
 +}   
 +  
 +  
 +return newPrice; // Palauta uusi hinta   
 +  
 +  
 +}   
 +// Hintahaku  
 +float curPrice() {  
 +String priceStr = "0";  
 +if (WiFi.status() == WL_CONNECTED) {  
 +HTTPClient http;  
 +  
 +  
 +String date = "2024-05-14";  
 +int hour = 14;  
 +  
 +  
 +String url = "https://api.porssisahko.net/v1/price.json?date=" + date + "&hour=" + String(hour);  
 +http.begin(url);  
 +int httpResponseCode = http.GET();  
 +  
 +  
 +if (httpResponseCode > 0) {  
 +String payload = http.getString();  
 +int priceIndex = payload.indexOf("\"price\":");  
 +if (priceIndex != -1) {  
 +int start = payload.indexOf(":", priceIndex) + 1;  
 +int end = payload.indexOf("}", start);  
 +priceStr = payload.substring(start, end);  
 +priceStr.trim();  
 +}  
 +} else {  
 +Serial.print("HTTP-virhe: ");  
 +Serial.println(httpResponseCode);  
 +}  
 +  
 +  
 +http.end();  
 +}  
 +return priceStr.toFloat();  
 +}  
 +  
 +  
 +// Alustus  
 +void setup() {  
 +randomSeed(71137);  
 +Serial.begin(115200);  
 +//connectwifi();  
 +  
 +  
 +lcd.init();  
 +lcd.backlight();  
 +dht.begin();  
 +  
 +  
 +pinMode(BUZZER_PIN, OUTPUT);  
 +digitalWrite(BUZZER_PIN, LOW);  
 +  
 +  
 +FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);  
 +FastLED.setBrightness(50);  
 +  
 +  
 +pinMode(BUTTON_LEFT_PIN, INPUT_PULLUP);  
 +pinMode(BUTTON_RIGHT_PIN, INPUT_PULLUP);  
 +  
 +  
 +screen(display_state);  
 +}  
 +  
 +  
 +// Pääsilmukka  
 +void loop() {  
 +if (millis() - lastPriceUpdate > priceInterval || price == 0) {  
 +price = changePrice();  
 +lastPriceUpdate = millis();  
 +alertcheck = true;  
 +}  
 +  
 +  
 +temperature = dht.readTemperature();  
 +humidity = dht.readHumidity();  
 +  
 +  
 +if (r_buttonPress() == 1) {  
 +delay(50);  
 +display_state = !display_state;  
 +screen(display_state);  
 +}  
 +  
 +  
 +if (alertcheck && price > PRICE_ALERT_THRESHOLD) {  
 +alertStatus = true;  
 +alert("Price is high", 5);  
 +  
 +  
 +screen(display_state);  
 +}  
 +  
 +  
 +if ((last_humidity != humidity || last_temperature != temperature)/* && display_state == temperature_display*/) {  
 +if (humidity <= 100) {  
 +screen(display_state);  
 +}  
 + 
 +  
 +  
 +last_temperature = temperature;  
 +last_humidity = humidity;  
 + 
 +