meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ixc2025:team_1:start [2025/05/14 13:41] – karppi | ixc2025:team_1:start [2025/05/15 16:29] (current) – karppi | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====SIFLOPP==== | + | =====SIFLOPP===== |
{{ : | {{ : | ||
+ | === 1. Group Introduction === | ||
+ | So, we called our home " | ||
+ | === 2. Initial brainstorming ideas/ | ||
+ | 🌡️ 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, | ||
+ | |||
+ | |||
+ | === 3. Day 2 Presentation slides === | ||
+ | {{ : | ||
+ | |||
+ | |||
+ | === 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: | ||
+ | Usage Analytics: Provide insights on energy usage to promote more sustainable habits. | ||
+ | | ||
+ | | ||
+ | Renewable Energy Integration: | ||
+ | Solar and Battery Integration: | ||
+ | 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. |
+ | https:// | ||
+ | |||
+ | 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 | ||
+ | |||
+ | |||
+ | {{: | ||
+ | === 4. SUSAF Analysis === | ||
+ | |||
+ | {{: | ||
+ | === 5. Power meter measurements === | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | |||
+ | === 7. Final Day Presentation Slides === | ||
+ | |||
+ | final ppt | ||
+ | {{ : | ||
+ | |||
+ | |||
+ | === 8. Final Code === | ||
- | {{:ixc2025:team_1:20250514_133202.jpg?400|}} {{:ixc2025:team_1:20250514_132909.jpg?400|}} | + | #include < |
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | |||
+ | // WiFi | ||
+ | const char* ssid = " | ||
+ | const char* password = " | ||
+ | |||
+ | |||
+ | // 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, | ||
+ | |||
+ | |||
+ | // Ajastin hintapäivitykselle | ||
+ | unsigned long lastPriceUpdate = 0; | ||
+ | const unsigned long priceInterval = 0.5 * 60 * 1000; // 30 sec | ||
+ | |||
+ | |||
+ | // WiFi-yhteys | ||
+ | void connectwifi() { | ||
+ | WiFi.begin(ssid, | ||
+ | Serial.println(" | ||
+ | |||
+ | |||
+ | while (WiFi.status() != WL_CONNECTED) { | ||
+ | delay(500); | ||
+ | Serial.print(" | ||
+ | } | ||
+ | |||
+ | |||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | |||
+ | // Piippaus | ||
+ | void beepBuzzer() { | ||
+ | tone(BUZZER_PIN, | ||
+ | noTone(BUZZER_PIN); | ||
+ | } | ||
+ | |||
+ | |||
+ | // Hälytys | ||
+ | void alert(String warningMessage, | ||
+ | lcd.clear(); | ||
+ | lcd.setCursor(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, | ||
+ | lcd.print(" | ||
+ | lcd.print(temperature); | ||
+ | lcd.print(" | ||
+ | lcd.setCursor(0, | ||
+ | lcd.print(" | ||
+ | lcd.print(humidity); | ||
+ | lcd.print(" | ||
+ | } else if (state == price_display) { | ||
+ | lcd.setCursor(0, | ||
+ | lcd.print(" | ||
+ | lcd.print(price); | ||
+ | lcd.print(" | ||
+ | } | ||
+ | } | ||
+ | // | ||
+ | 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 = " | ||
+ | if (WiFi.status() == WL_CONNECTED) { | ||
+ | HTTPClient http; | ||
+ | |||
+ | |||
+ | String date = " | ||
+ | int hour = 14; | ||
+ | |||
+ | |||
+ | String url = " | ||
+ | http.begin(url); | ||
+ | int httpResponseCode = http.GET(); | ||
+ | |||
+ | |||
+ | if (httpResponseCode > 0) { | ||
+ | String payload = http.getString(); | ||
+ | int priceIndex = payload.indexOf(" | ||
+ | if (priceIndex != -1) { | ||
+ | int start = payload.indexOf(":", | ||
+ | int end = payload.indexOf(" | ||
+ | priceStr = payload.substring(start, | ||
+ | priceStr.trim(); | ||
+ | } | ||
+ | } else { | ||
+ | Serial.print(" | ||
+ | Serial.println(httpResponseCode); | ||
+ | } | ||
+ | |||
+ | |||
+ | http.end(); | ||
+ | } | ||
+ | return priceStr.toFloat(); | ||
+ | } | ||
+ | |||
+ | |||
+ | // Alustus | ||
+ | void setup() { | ||
+ | randomSeed(71137); | ||
+ | Serial.begin(115200); | ||
+ | // | ||
+ | |||
+ | |||
+ | lcd.init(); | ||
+ | lcd.backlight(); | ||
+ | dht.begin(); | ||
+ | |||
+ | |||
+ | pinMode(BUZZER_PIN, | ||
+ | digitalWrite(BUZZER_PIN, | ||
+ | |||
+ | |||
+ | FastLED.addLeds< | ||
+ | FastLED.setBrightness(50); | ||
+ | |||
+ | |||
+ | pinMode(BUTTON_LEFT_PIN, | ||
+ | pinMode(BUTTON_RIGHT_PIN, | ||
+ | |||
+ | |||
+ | screen(display_state); | ||
+ | } | ||
+ | |||
+ | |||
+ | // Pääsilmukka | ||
+ | void loop() { | ||
+ | if (millis() - lastPriceUpdate > priceInterval | ||
+ | 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(" | ||
+ | |||
+ | |||
+ | screen(display_state); | ||
+ | } | ||
+ | |||
+ | |||
+ | if ((last_humidity != humidity || last_temperature != temperature)/ | ||
+ | if (humidity <= 100) { | ||
+ | screen(display_state); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | last_temperature = temperature; | ||
+ | last_humidity = humidity; | ||
+ | } | ||
+ |