In the era of smart homes, enhancing household appliances with IoT capabilities has become essential for convenience, efficiency, and safety. One such innovation is the development of a smart refrigerator that can detect and notify the user of its door status. This project aims to create a proof of concept for a smart refrigerator lighting system using the Bolt IoT platform. The system will utilize data from a Light Dependent Resistor (LDR) and a push button to determine and communicate the state of the refrigerator door.
ObjectiveTo design and implement a smart lighting system for a refrigerator that:
- Detects whether the refrigerator door is open or closed using an LDR and a push button.
- Sends an SMS notification to the user whenever the state of the door changes.
- Data Collection:Use the LDR to measure light intensity inside the refrigerator.Use the push button to determine if the door is physically pressed (closed) or released (open).
- State Determination:Door Open: High light intensity (bright) and button released.Door Closed: Low light intensity (dark) and button pressed.
- Notification System:Send an SMS with the current state of the door whenever there is a change in its status.
These are the components required
1. Bolt WiFi Module
2. LDR (Light Dependent Resistor)
3. PushButton
4. Resistor 10K
- Ensure that the Bolt Module is not powered on while connecting the circuit to prevent short circuits.
- Connect the LDR:
- One end to the A0 (analog) pin.
- The other end to the 3.3V pin.
- Place a 10K ohm resistor between the GND and A0 pin, forming a series connection with the LDR.
- Connect the Push Button:
- One end to the 1 (digital) pin.
- The other end to the 3.3V pin.
- Place a 10K ohm resistor between the GND and 1 pin, forming a series connection with the push button.
To test the circuit, we need to import the required libraries and check the functionality of the LDR and push button.
Create conf.py with Bolt IoT configurationsAPI_KEY = 'Your_Bolt_Cloud_API_Key'
DEVICE_ID = 'Your_Bolt_Device_ID'
Import LibrariesFirst, import the necessary libraries in your Python script.
from boltiot import Bolt, Email
import conf
import json, time
Initialize Boltmybolt = Bolt(credentials.API_KEY, credentials.DEVICE_ID)
Testing LDRRead the value from the LDR connected to the A0 pin and print it.
ldr_response = mybolt.analogRead('A0')
ldr_data = json.loads(ldr_response)
print(ldr_data['value'])
ldr_value = int(ldr_data['value'])
Testing Push ButtonRead the value from the push button connected to the digital pin 1 and print it.
pb_response = mybolt.digitalRead('1')
pb_data = json.loads(pb_response)
print(pb_data['value'])
pb_value = int(pb_data['value'])
Step 3: Software Programming- Log in to Bolt Cloud and note the ID of your Bolt WiFi Module.
- Click on the API Tab, and under the "Generate Key" section, click on Enable to get your API Key.
- Sign up on Twilio and generate an API Key, SID, and a Twilio phone number.
- Use Repl.it for running the Python script.Alternatively, you can run Python files on a Digital Ocean droplet or an Ubuntu server virtual machine.
- Store all credentials related to Twilio and Bolt IoT in conf.py
SID = 'You can find SID in your Twilio Dashboard'
AUTH_TOKEN = 'You can find on your Twilio Dashboard'
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning'
API_KEY = 'This is your Bolt Cloud accout API key'
DEVICE_ID = 'This is the ID of your Bolt device'
Replace placeholder values with your actual credentials.
- Implement the logic in main.py.
- Create dtree.py and implement the decision tree model.You can find the code and dataset in the provided GitHub link.
- The script will send an SMS through the Twilio API when the door state changes from closed to open and vice versa.
- Run main.py on Repl.it or your chosen environment to start monitoring the refrigerator door and receiving SMS notifications.
This system designed to predict the state of a refrigerator door using machine learning techniques. Initially, essential dependencies such as pandas, numpy, and scikit-learn are installed. The core of the system lies in a machine learning model, Decision Tree classifier, trained on a dataset containing sensor readings and door states. The model's predictions are then used to determine the state of the door in real-time.
The system incorporates a logical flow to handle various scenarios. If a push button is pressed, indicating the door is closed, the system reacts accordingly. Otherwise, the predicted door state from the machine learning model is considered. When a change in door state is detected, appropriate actions are taken, including printing messages, and sending sms alerts using the Twilio API. Exception handling ensures graceful handling of errors, if any, during the process.
This integration of machine learning with real-time monitoring and response mechanisms demonstrates an effective approach to anomaly detection and control in IoT applications like refrigerator door monitoring.
ConclusionThis project will deliver a smart refrigerator lighting system that enhances user awareness and interaction with their appliance. By leveraging the Bolt IoT platform and simple sensors, the system will effectively monitor the refrigerator door status and provide real-time notifications, ensuring users are promptly informed of any changes. It provides crucial monitoring for cold storage units, particularly in drug manufacturing industries, ensuring precise oversight of refrigerator activities and enhancing storage operations' reliability.
Comments
Please log in or sign up to comment.