meta data for this page
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ixc2025:lappeenranta:team_1:start [2025/05/21 11:55] – [9. Final Code] mrc | ixc2025:lappeenranta:team_1:start [2025/05/22 15:51] (current) – [1. Group Introduction] mrc | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ==== 1. Group Introduction ==== | ==== 1. Group Introduction ==== | ||
| + | We are DAMP+J, a team formed during the hackathon to explore how IoT can be used to influence individual behavior for sustainability and well-being. Our group brings together complementary skills in embedded systems, software engineering, | ||
| + | Our approach prioritizes simplicity, functionality, | ||
| + | |||
| + | Our final project, FRoast, reflects this mindset—a behavior-aware smart fridge prototype designed to promote conscious food habits, reduce waste, and make sustainability both personal and actionable. | ||
| + | |||
| + | |||
| + | === Our team members === | ||
| + | - Jorge Leon | ||
| + | - Marcia Rodrigues | ||
| + | - Daniella Fajardo | ||
| + | - Prachi Singhal | ||
| + | - Abdulkadir Abubakar | ||
| ==== 2. Initial brainstorming ideas/ | ==== 2. Initial brainstorming ideas/ | ||
| Line 13: | Line 25: | ||
| We explored several IoT-based concepts that aim to nudge individuals toward sustainable, | We explored several IoT-based concepts that aim to nudge individuals toward sustainable, | ||
| - | === 🚿 Smart Bath / Water Control System === | + | === Smart Bath / Water Control System === |
| * **Goal**: Reduce water and energy waste by encouraging shorter, more efficient showers. | * **Goal**: Reduce water and energy waste by encouraging shorter, more efficient showers. | ||
| * **What it’s about**: This system monitors shower duration using steam and temperature sensors. It gives real-time feedback using buzzers, RGB lights, or LCD messages when a user exceeds optimal limits. The aim is to build awareness of water usage and promote sustainable bathing habits. | * **What it’s about**: This system monitors shower duration using steam and temperature sensors. It gives real-time feedback using buzzers, RGB lights, or LCD messages when a user exceeds optimal limits. The aim is to build awareness of water usage and promote sustainable bathing habits. | ||
| Line 22: | Line 34: | ||
| * Eco-feedback or daily stats to reward water-efficient behavior. | * Eco-feedback or daily stats to reward water-efficient behavior. | ||
| - | === 🌱 Sustainability Coach – In-Room Behavioral Monitoring === | + | === Sustainability Coach – In-Room Behavioral Monitoring === |
| * **Goal**: Help individuals become more energy-conscious in their personal spaces. | * **Goal**: Help individuals become more energy-conscious in their personal spaces. | ||
| * **What it’s about**: This system acts as a digital coach inside a user’s room. It monitors air conditioning use, artificial lighting, fan activity, and motion detection to identify unnecessary resource consumption. Feedback is delivered via lights, screen messages, and audio cues. | * **What it’s about**: This system acts as a digital coach inside a user’s room. It monitors air conditioning use, artificial lighting, fan activity, and motion detection to identify unnecessary resource consumption. Feedback is delivered via lights, screen messages, and audio cues. | ||
| Line 32: | Line 44: | ||
| * Idle Energy Consumption: | * Idle Energy Consumption: | ||
| - | === 🥩 Meat Consumption Awareness Coach (Concept) === | + | === Meat Consumption Awareness Coach (Concept) === |
| * **Goal**: Encourage more sustainable dietary choices by reducing unnecessary meat consumption. | * **Goal**: Encourage more sustainable dietary choices by reducing unnecessary meat consumption. | ||
| * **What it’s about**: While not fully developed, the concept involved using fridge/ | * **What it’s about**: While not fully developed, the concept involved using fridge/ | ||
| Line 41: | Line 53: | ||
| * While not implemented, | * While not implemented, | ||
| - | === ♿ EcoAccess Station – Adaptive Smart Environment for Inclusion === | + | === EcoAccess Station – Adaptive Smart Environment for Inclusion === |
| * **Goal**: Combine energy efficiency with personalized accessibility for users with diverse needs. | * **Goal**: Combine energy efficiency with personalized accessibility for users with diverse needs. | ||
| * **What it’s about**: EcoAccess Station uses **RFID** to identify users and adapt room conditions based on their physical or sensory requirements (e.g., mobility-impaired, | * **What it’s about**: EcoAccess Station uses **RFID** to identify users and adapt room conditions based on their physical or sensory requirements (e.g., mobility-impaired, | ||
| Line 51: | Line 63: | ||
| * Provides accessible feedback through color-coded LEDs and simple audio/text messages. | * Provides accessible feedback through color-coded LEDs and simple audio/text messages. | ||
| - | === ❄️ | + | === Coach Fridge – Personal Eating Habits(Selected Project) === |
| * **Goal**: Promote healthier eating habits and reduce unconscious fridge use through personalized feedback. | * **Goal**: Promote healthier eating habits and reduce unconscious fridge use through personalized feedback. | ||
| * **What it’s about**: Coach Fridge uses **RFID** to identify users and monitors their **frequency**, | * **What it’s about**: Coach Fridge uses **RFID** to identify users and monitors their **frequency**, | ||
| Line 75: | Line 87: | ||
| ==== 3. Day 2 Presentation slides ==== | ==== 3. Day 2 Presentation slides ==== | ||
| + | {{ : | ||
| ==== 4. Finalised Idea, description & Functions ==== | ==== 4. Finalised Idea, description & Functions ==== | ||
| Line 82: | Line 94: | ||
| The project is a smart fridge system designed to monitor and influence users’ eating habits through real-time feedback and personalized behavior tracking. It uses RFID identification, | The project is a smart fridge system designed to monitor and influence users’ eating habits through real-time feedback and personalized behavior tracking. It uses RFID identification, | ||
| - | === 🔎 Description === | + | === Description === |
| Each time a user approaches the fridge, they are identified using an RFID tag. The system monitors fridge access patterns — how often, when, and for how long the fridge is used — and cross-references this with sensor data (e.g., steam, gas, temperature, | Each time a user approaches the fridge, they are identified using an RFID tag. The system monitors fridge access patterns — how often, when, and for how long the fridge is used — and cross-references this with sensor data (e.g., steam, gas, temperature, | ||
| Line 94: | Line 106: | ||
| Real-time nudges are provided through LEDs, buzzer sounds, and messages on an LCD display, mimicking the role of a digital “fridge coach.” | Real-time nudges are provided through LEDs, buzzer sounds, and messages on an LCD display, mimicking the role of a digital “fridge coach.” | ||
| - | === ⚙️ | + | === Functions === |
| * **User Identification**: | * **User Identification**: | ||
| Line 112: | Line 124: | ||
| ==== 5. Future Improvements ==== | ==== 5. Future Improvements ==== | ||
| - | While the current prototype | + | While the current prototype of FRoast successfully demonstrates |
| - | * **Data Logging | + | === 1. Nutritional Categorization |
| - | Store user behavior data (e.g., access time, duration, triggers) to analyze trends over days or weeks and generate visual | + | Integrating basic food identification features—such as barcode scanning, NFC tags, or weight sensors—could enable FRoast to provide context-specific |
| + | * Encourage the storage of healthier food options | ||
| + | * Discourage excessive processed food consumption | ||
| + | * Track diversity in food selection | ||
| - | * **Mobile App or Dashboard Integration** | + | === 2. Inventory Management and Waste Reduction === |
| - | | + | By associating RFID tags with specific food items or enabling manual item logging, FRoast could offer inventory tracking capabilities. This would support: |
| + | | ||
| + | * Alerts for items nearing expiration | ||
| + | * Waste reduction via proactive usage reminders | ||
| - | * **Nutritional Categorization** | + | === 3. Multimodal Feedback: Voice Integration === |
| - | | + | To enhance accessibility, |
| - | * **Fridge Inventory Tracking** | + | === 4. Energy Efficiency Adaptation === |
| - | Track stored items using RFID or manual input to suggest food rotation and reduce waste (e.g., reminders for expiring items). | + | Incorporating ambient temperature sensing would enable FRoast |
| + | * Stricter alerts during hot weather when open-door cooling loss is more severe | ||
| + | * Relaxed thresholds during colder months when external temperatures mitigate loss | ||
| - | * **Voice Feedback System** | + | === 5. Machine Learning and Personalized Adaptation === |
| - | | + | Introducing a lightweight machine learning layer could allow the system to evolve beyond fixed thresholds. Using historical behavior data, the model could: |
| + | | ||
| + | | ||
| + | * Differentiate between habitual and intentional exceptions | ||
| + | ==== 6. SUSAF Analysis ==== | ||
| - | * **Energy Optimization Module** | + | {{: |
| - | Add external temperature detection to adapt internal feedback based on seasonal energy demands (e.g., reducing unnecessary opening in summer). | + | |
| - | * **Machine Learning Integration** | + | {{: |
| - | Train a simple model to adapt nudging patterns based on user-specific behaviors rather than using static thresholds. | + | |
| + | {{: | ||
| + | |||
| + | {{: | ||
| - | These improvements would help transform FRoast from a rule-based behavior tool into a more adaptive, personalized, | ||
| - | ==== 6. SUSAF Analysis ==== | ||
| ==== 7. Behavioral Change Analysis ==== | ==== 7. Behavioral Change Analysis ==== | ||
| - | FRoast is designed | + | FRoast is designed |
| - | === 🎯 Targeted Behaviors | + | === Rationale for Behavior Change |
| - | * Late-night snacking | + | |
| - | * Leaving the fridge open too long | + | |
| - | * Storing hot food improperly | + | |
| - | * Repetitive short visits (poor food rotation) | + | |
| - | * Ignoring seasonal energy efficiency | + | |
| - | * Lack of dietary awareness (e.g., not enough fruits or meal structure) | + | |
| - | === 🔍 Behavior Detection Mechanism === | + | Refrigerators contribute significantly to household energy consumption and are often involved in avoidable food waste due to poor usage habits. Traditional tracking alone provides |
| - | * **RFID Identification** links behavior | + | |
| - | * **Sensor Data** (motion, temperature, | + | |
| - | * **Time-based Logic** determines whether behaviors occur during target windows (e.g., night hours, meal prep times). | + | |
| - | * **Usage Frequency & Duration** are logged to identify repetitive or excessive patterns. | + | |
| - | === 🔁 Feedback Strategy === | + | The premise is simple but effective: raising user awareness |
| - | * **Immediate feedback** | + | |
| - | * **Positive reinforcement** for reduced usage or healthy timing encourages habit building. | + | |
| - | * **Warning signals** during undesired behaviors (e.g., frequent night visits) create disruption that prompts reconsideration. | + | |
| - | === 📈 Potential Impact Over Time === | + | === User-Specific Monitoring and Triggers |
| - | * Increased mindfulness around food access | + | |
| - | * Reduction in energy waste (fridge left open or hot food storage) | + | |
| - | * Healthier timing of meals and snacks | + | |
| - | * Decrease in impulsive or unconscious food-related behavior | + | |
| - | Through continued use, the system promotes gradual behavior shifts without requiring drastic | + | Each user is identified via RFID, enabling individualized tracking and tailored |
| - | ==== 8. Final Day Presentation Slides ==== | + | |
| + | * **Fridge Door Access Patterns** | ||
| + | * Frequency of openings per day | ||
| + | * Duration of door open per session | ||
| - | ==== 9. Final Code ==== | + | * **Nighttime Usage** |
| + | * Identification of fridge use during designated rest hours | ||
| - | === 🧪 Test Code: RFID + Servo + Buzzer | + | * **Steam Events** |
| + | * Detection of hot food insertion through steam sensors, indicating inefficient storage behavior | ||
| + | |||
| + | * **Gas Events** | ||
| + | * Detection of spoilage or strong odors, signaling delayed disposal or neglected items | ||
| + | |||
| + | * **Fruit and Compartment Use** | ||
| + | * Patterns of compartment interaction, | ||
| + | |||
| + | === Metrics for Evaluating Change === | ||
| + | |||
| + | To assess the effectiveness of FRoast in modifying behavior, both quantitative and qualitative metrics are collected: | ||
| + | |||
| + | **Quantitative Indicators** | ||
| + | * Average duration of fridge door openings over time | ||
| + | * Number of late-night access events per week | ||
| + | * Frequency of steam or gas sensor activations | ||
| + | * Interaction rates with the fruit compartment or healthier food zones | ||
| + | * Frequency of sustainability warnings recorded via the internal log or connected web interface | ||
| + | |||
| + | **Qualitative Indicators** | ||
| + | * User-reported changes in snacking frequency or food discipline | ||
| + | * User preference tracking based on response to feedback tone (e.g., comedic, neutral, advisory) | ||
| + | |||
| + | === Anticipated Impact === | ||
| + | |||
| + | The long-term objective of FRoast is to instill sustainable behavior without requiring significant user effort or intrusive systems. By embedding behaviorally-informed micro-interventions into an everyday appliance, the system can contribute to: | ||
| + | |||
| + | * Improved food storage habits and reduced spoilage | ||
| + | * Lower average energy usage through better door discipline | ||
| + | * Reduced impulsive eating, particularly at night | ||
| + | * Increased user engagement with sustainability as a personal responsibility | ||
| + | |||
| + | Through repeated exposure to feedback and subtle reinforcement, | ||
| + | |||
| + | ==== 8. Final Day Presentation Slides ==== | ||
| + | |||
| + | {{ : | ||
| + | ==== 9. Final Code ==== | ||
| <code python> | <code python> | ||
| - | from machine import Pin, PWM, I2C | + | import uasyncio as asyncio |
| + | from machine import Pin, PWM, SoftI2C, ADC, DAC | ||
| + | from i2c_lcd import I2cLcd | ||
| import time | import time | ||
| + | import dht | ||
| from mfrc522_i2c import mfrc522 | from mfrc522_i2c import mfrc522 | ||
| + | import collections | ||
| - | # ====== | + | class MessageQueue: |
| - | addr = 0x28 | + | def __init__(self): |
| - | scl = 22 # I2C SCL pin | + | self.queue = [] |
| - | sda = 21 # I2C SDA pin | + | |
| - | rc522 = mfrc522(scl, sda, addr) | + | async def put(self, item): |
| + | self.queue.append(item) | ||
| + | |||
| + | async def get(self): | ||
| + | while not self.queue: | ||
| + | await asyncio.sleep(0.1) | ||
| + | return self.queue.pop(0) | ||
| + | |||
| + | message_queue | ||
| + | |||
| + | # Constants | ||
| + | SERVO_PIN | ||
| + | BUZZER_PIN | ||
| + | I2C_SCL | ||
| + | I2C_SDA | ||
| + | I2C_ADDR | ||
| + | RFID_ADDR | ||
| + | AUTHORIZED_ID | ||
| + | SERVO_OPEN | ||
| + | SERVO_CLOSE | ||
| + | BUZZER_FREQ1 | ||
| + | BUZZER_FREQ2 | ||
| + | ALARM_DURATION | ||
| + | HUMIDITY_THRESHOLD = 30 | ||
| + | TEMP_THRESHOLD = 27 | ||
| + | GAS_PIN = 23 | ||
| + | GAS_SENSOR = Pin(GAS_PIN, | ||
| + | GAS_THRESHOLD = 70 | ||
| + | |||
| + | # State | ||
| + | door_opened | ||
| + | open_time = 0 | ||
| + | |||
| + | # I2C + LCD setup | ||
| + | i2c = SoftI2C(scl=Pin(I2C_SCL, | ||
| + | | ||
| + | freq=100000) | ||
| + | lcd = I2cLcd(i2c, I2C_ADDR, 2, 16) | ||
| + | |||
| + | # Buzzer setup | ||
| + | buzzer = PWM(Pin(BUZZER_PIN)) | ||
| + | buzzer.duty(0) | ||
| + | |||
| + | # RFID setup | ||
| + | rc522 = mfrc522(I2C_SCL, I2C_SDA, RFID_ADDR) | ||
| rc522.PCD_Init() | rc522.PCD_Init() | ||
| rc522.ShowReaderDetails() | rc522.ShowReaderDetails() | ||
| - | # ====== Variables | + | # DHT Sensor setup |
| - | data = 0 | + | DHT_SENSOR |
| - | doorOpened | + | # === STEAM SETUP === |
| - | openTime | + | STEAM_SENSOR |
| + | STEAM_SENSOR.atten(ADC.ATTN_11DB) | ||
| + | STEAM_THRESHOLD | ||
| + | |||
| + | current_user | ||
| + | |||
| + | |||
| + | async def move_servo(position): | ||
| + | servo = PWM(Pin(SERVO_PIN)) | ||
| + | servo.freq(50) | ||
| + | servo.duty(position) | ||
| + | await asyncio.sleep(0.5) | ||
| + | | ||
| + | |||
| + | async def open_door(): | ||
| + | global door_opened, | ||
| + | print(" | ||
| + | await move_servo(SERVO_OPEN) | ||
| + | open_time = time.time() | ||
| + | door_opened = True | ||
| + | |||
| + | async def close_door(): | ||
| + | global door_opened | ||
| + | print(" | ||
| + | await move_servo(SERVO_CLOSE) | ||
| + | door_opened | ||
| + | |||
| + | |||
| + | async def play_alarm(): | ||
| + | print(" | ||
| + | buzzer.duty(512) | ||
| + | end_time | ||
| + | while time.ticks_ms() < end_time: | ||
| + | buzzer.freq(BUZZER_FREQ1) | ||
| + | await asyncio.sleep(ALARM_DURATION) | ||
| + | buzzer.freq(BUZZER_FREQ2) | ||
| + | await asyncio.sleep(ALARM_DURATION) | ||
| + | buzzer.duty(0) | ||
| + | |||
| + | |||
| + | async def scroll_text(text, | ||
| + | if len(text) <= 16: | ||
| + | lcd.move_to(0, | ||
| + | lcd.putstr(text + ' ' * (16 - len(text))) | ||
| + | return | ||
| + | for i in range(len(text) - 15): | ||
| + | lcd.move_to(0, | ||
| + | lcd.putstr(text[i: | ||
| + | await asyncio.sleep(delay) | ||
| + | |||
| + | async def message_handler(): | ||
| + | while True: | ||
| + | upper, lower = await message_queue.get() | ||
| + | lcd.clear() | ||
| + | await scroll_text(upper, | ||
| + | await scroll_text(lower, | ||
| + | |||
| + | # --- ASYNC TASKS --- | ||
| + | |||
| + | async def monitor_rfid(): | ||
| + | global door_opened, | ||
| + | while True: | ||
| + | buzzer.duty(0) | ||
| + | if rc522.PICC_IsNewCardPresent(): | ||
| + | if rc522.PICC_ReadCardSerial(): | ||
| + | data = sum(rc522.uid.uidByte[0: | ||
| + | print(" | ||
| + | current_user = data | ||
| + | print(" | ||
| + | |||
| + | if data == AUTHORIZED_ID: | ||
| + | if door_opened: | ||
| + | print(" | ||
| + | duration = time.time() - open_time | ||
| + | print(" | ||
| + | await close_door() | ||
| + | if duration > 15: | ||
| + | await play_alarm() | ||
| + | await message_queue.put((" | ||
| + | print(" | ||
| + | |||
| + | else: | ||
| + | await message_queue.put((" | ||
| + | else: | ||
| + | await open_door() | ||
| + | |||
| + | # Time-based snacking roast | ||
| + | current_hour = time.localtime()[3] | ||
| + | if current_hour >= 23 or current_hour < 5: | ||
| + | await message_queue.put((" | ||
| + | print(" | ||
| + | else: | ||
| + | await message_queue.put((" | ||
| + | |||
| + | else: | ||
| + | print(" | ||
| + | await message_queue.put((" | ||
| + | await asyncio.sleep(1) | ||
| + | |||
| + | def monitor_steam_sensor(): | ||
| + | print(" | ||
| + | while True: | ||
| + | try: | ||
| + | analog_value = STEAM_SENSOR.read() | ||
| + | print(" | ||
| + | |||
| + | if analog_value > STEAM_THRESHOLD: | ||
| + | await message_queue.put((" | ||
| + | print(" | ||
| + | |||
| + | await asyncio.sleep(2) | ||
| + | |||
| + | except Exception as e: | ||
| + | print(" | ||
| + | await asyncio.sleep(2) | ||
| + | |||
| + | async def monitor_humidity(): | ||
| + | while True: | ||
| + | try: | ||
| + | DHT_SENSOR.measure() # Start DHT11 to measure data once. | ||
| + | # Call the built-in function of DHT to obtain temperature | ||
| + | # and humidity data and print them in “Shell”. | ||
| + | temperature_value = DHT_SENSOR.temperature() | ||
| + | humidity_value = DHT_SENSOR.humidity() | ||
| + | print(' | ||
| + | if temperature_value > TEMP_THRESHOLD: | ||
| + | await message_queue.put((" | ||
| + | print(" | ||
| + | elif humidity_value > HUMIDITY_THRESHOLD: | ||
| + | await message_queue.put((" | ||
| + | print(" | ||
| + | except Exception as e: | ||
| + | print(" | ||
| + | await asyncio.sleep(2) | ||
| + | |||
| + | async def monitor_compartments(): | ||
| + | button1 = Pin(16, Pin.IN, Pin.PULL_UP) | ||
| + | |||
| + | button2 = Pin(27, Pin.IN, Pin.PULL_UP) | ||
| + | |||
| + | #Nest two for loops to make the module repeatedly display five states of red, green, blue, white and OFF. | ||
| + | |||
| + | while True: | ||
| + | try: | ||
| + | btnVal1 = button1.value() | ||
| - | # ====== Servo Setup (Fridge Door Simulation) | + | |
| - | servo = PWM(Pin(5)) | + | |
| - | servo.freq(50) | + | |
| - | # ====== Buzzer Setup ====== | + | if(btnVal1 |
| - | buzzer = PWM(Pin(25)) | + | await message_queue.put(("Those vitamins won’t drink themselves.", |
| - | buzzer.duty(0) | + | |
| - | # Warning tone settings | + | print(" |
| - | freq1 = 1000 # First tone frequency | + | |
| - | freq2 = 1500 # Second tone frequency | + | |
| - | alarmDuration | + | |
| - | # ====== Main Loop ====== | + | if(btnVal2 |
| - | while True: | + | await message_queue.put(("Food compartment opened.", "")) |
| - | if rc522.PICC_IsNewCardPresent(): | + | |
| - | if rc522.PICC_ReadCardSerial(): | + | |
| - | print("Card UID:" | + | |
| - | for i in rc522.uid.uidByte[0 : rc522.uid.size]: | + | |
| - | data += i | + | |
| - | print("Card ID:", data) | + | |
| - | if data == 547: # Authorized card ID (example) | + | print(" |
| - | if doorOpened: | + | |
| - | # Closing the door | + | |
| - | duration = time.time() | + | await asyncio.sleep(0.5) |
| - | print(" | + | |
| - | print(" | + | |
| - | doorOpened = False | + | |
| - | # If door was left open too long, trigger warning | + | async def monitor_gas(): |
| - | if duration > 3: | + | while True: |
| - | | + | try: |
| - | | + | |
| - | while time.ticks_ms() < end_time: | + | print("Gas Level:", |
| - | | + | if not gas_level: |
| - | time.sleep(alarmDuration) | + | await message_queue.put(("You really like cultivating diseases, huh?", "Did your fruit die?")) |
| - | | + | |
| - | time.sleep(alarmDuration) | + | |
| - | buzzer.duty(0) # Turn buzzer off | + | print("Gas sensor error:", |
| + | await asyncio.sleep(3) | ||
| - | servo.duty(28) | + | # --- MAIN --- |
| - | else: | + | async def main(): |
| - | # Opening the door | + | await asyncio.gather( |
| - | buzzer.duty(0) | + | monitor_rfid(), |
| - | | + | |
| - | | + | |
| - | | + | |
| - | print(" | + | |
| - | | + | |
| - | print("Card not authorized" | + | |
| - | data = 0 # Reset for next read | + | asyncio.run(main()) |
| - | time.sleep(0.5) | + | |
| </ | </ | ||