SWAYM – A Sustainable Urban Initiative, that combines modern technologies like smart dustbin (S), waste segregator (W), air purifier (A), yard green space management (Y), and mobile hospital (M). This holistic approach aims to encourage eco-friendly practices, cleaner air, well-maintained green spaces, and accessible healthcare in cities. By merging these innovative systems, SWAYM leads the way toward a healthier and more sustainable future globally. Swyam A Smart CityProject, It’s an exciting project for students to delve into, helping them grasp the significance of environmental care and technological advancements in urban planning and development.
Components:
- Ultrasonic Sensor: Detects the presence of objects or people near the smart dustbin, enabling automated lid opening.
- Servo Motor: Mechanically operates the dustbin lid for automated opening and closing.
- LEDs: Indicators for various system statuses, such as bin full, medium level, and empty.
- Soil Moisture Sensor: Measures the moisture level in soil, useful for managing urban green spaces.
- DHT11: Measures temperature and humidity, contributing to environmental monitoring and air purification.
- MQ-135: Air quality sensor to detect harmful gases, ensuring cleaner and healthier air.
- Pulse Rate Sensor: Monitors heart rate, aiding in mobile healthcare initiatives.
- Arduino: Acts as the main controller for integrating and processing data from all sensors and components.
- I2C LCD Display: Displays real-time data from various sensors for easy monitoring.
CIRCUIT FOR SMART DUSTBIN
CODE FOR SMART DUSTBIN
#include <Servo.h>
#define trigPin1 3
#define echoPin1 2
#define trigPin2 7
#define echoPin2 4
#define servoPin 8
#define fullLed 9
#define mediumLed 5
#define lowLed 6
Servo servo;
void setup() {
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
pinMode(trigPin2, OUTPUT);
pinMode(echoPin2, INPUT);
pinMode(servoPin, OUTPUT);
pinMode(fullLed, OUTPUT);
pinMode(mediumLed, OUTPUT);
pinMode(lowLed, OUTPUT);
servo.attach(servoPin);
servo.write(0); // close the lid initially
}
void loop() {
// Check if someone is approaching the dustbin
long duration1, distance1;
digitalWrite(trigPin1, LOW);
delayMicroseconds(2);
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
duration1 = pulseIn(echoPin1, HIGH);
distance1 = duration1 * 0.034 / 2;
if (distance1 < 10) { // Adjust this threshold according to your setup
openLid();
delay(5000); // Keep the lid open for 5 seconds
closeLid();
}
// Check the fill level of the dustbin
long duration2, distance2;
digitalWrite(trigPin2, LOW);
delayMicroseconds(2);
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin2, LOW);
duration2 = pulseIn(echoPin2, HIGH);
distance2 = duration2 * 0.034 / 2;
if (distance2 <= 5) { // Full
digitalWrite(fullLed, HIGH);
digitalWrite(mediumLed, LOW);
digitalWrite(lowLed, LOW);
} else if (distance2 > 5 && distance2 <= 10) { // Medium
digitalWrite(fullLed, LOW);
digitalWrite(mediumLed, HIGH);
digitalWrite(lowLed, LOW);
} else { // Low
digitalWrite(fullLed, LOW);
digitalWrite(mediumLed, LOW);
digitalWrite(lowLed, HIGH);
}
delay(1000); // Adjust delay as needed
}
void openLid() {
servo.write(90); // Open the lid
}
void closeLid() {
servo.write(0); // Close the lid
}
CIRCUIT FOR WASTE SEGREGATOR
CODE FOR WASTE SEGREGATOR
#include <Servo.h>
Servo servo1; // Servo motor for compartment 1
Servo servo2; // Servo motor for compartment 2
int trigPin = 2; // Ultrasonic sensor trigger pin
int echoPin = 3; // Ultrasonic sensor echo pin
int moisturePin = A0; // Soil moisture sensor pin
int thresholdMoisture = 500; // Threshold for organic waste detection
void setup() {
servo1.attach(9); // Attach servo1 to pin 9
servo2.attach(10); // Attach servo2 to pin 10
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
}
void loop() {
// Measure distance using ultrasonic sensor
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1; // Convert duration to distance in cm
// Read soil moisture sensor
int moistureValue = analogRead(moisturePin);
// Segregate waste based on distance and moisture level
if (distance < 20) { // Object detected within 20cm
if (moistureValue > thresholdMoisture) {
// Organic waste detected, open compartment 1
servo1.write(90); // Open compartment 1
delay(2000); // Wait for waste to be deposited
servo1.write(0); // Close compartment 1
} else {
// Inorganic waste detected, open compartment 2
servo2.write(90); // Open compartment 2
delay(2000); // Wait for waste to be deposited
servo2.write(0); // Close compartment 2
}
delay(1000); // Delay before next cycle
}
}
CIRCUIT FOR AIR PURIFIER
CODE FOR AIR PURIFIER
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int mq135Pin = A0;
const int dhtPin = 2;
DHT dht(dhtPin, DHT11);
void setup() {
lcd.begin(16, 2);
lcd.backlight();
Serial.begin(9600);
dht.begin();
}
void loop() {
int mq135Value = analogRead(mq135Pin);
int humidity = dht.readHumidity();
int temperature = dht.readTemperature();
// Calculate pollution level based on MQ-135 value
String pollutionLevel;
if (mq135Value < 200) {
pollutionLevel = "Low";
} else if (mq135Value >= 200 && mq135Value < 400) {
pollutionLevel = "Moderate";
} else if (mq135Value >= 400 && mq135Value < 600) {
pollutionLevel = "High";
} else {
pollutionLevel = "Very High";
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Air Pollution");
lcd.setCursor(0, 1);
lcd.print("Level: ");
lcd.print(pollutionLevel);
lcd.setCursor(10, 1);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print("%");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temperature");
lcd.setCursor(0, 1);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print("C");
delay(1000);
}
CIRCUIT FOR HEALTH VENDING MACHINE
CODE FOR HEALTH VENDING MACHINE
#include <DHT.h>
#include <PulseSensorPlayground.h>
#define DHT_PIN 2 // Pin connected to DHT11 sensor
#define PULSE_SENSOR_PIN A3 // Pin connected to pulse rate sensor
#define DHT_TYPE DHT11 // Type of DHT sensor (DHT11 or DHT22)
#define DHT_REFRESH_TIME 2000 // Refresh interval for DHT sensor (milliseconds)
DHT dht(DHT_PIN, DHT_TYPE);
PulseSensorPlayground pulseSensor;
unsigned long previousMillis = 0;
void setup() {
Serial.begin(9600);
dht.begin();
pulseSensor.analogInput(PULSE_SENSOR_PIN);
pulseSensor.setThreshold(550); // Adjust threshold as needed
pulseSensor.begin();
}
void loop() {
unsigned long currentMillis = millis();
// Read pulse rate sensor data
if (pulseSensor.sawNewSample()) {
int bpm = pulseSensor.getBeatsPerMinute();
Serial.print("Heart Rate (BPM): ");
Serial.println(bpm);
}
// Read DHT11 sensor data
if (currentMillis - previousMillis >= DHT_REFRESH_TIME) {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
Serial.print("Temperature (C): ");
Serial.println(temperature);
Serial.print("Humidity (%): ");
Serial.println(humidity);
previousMillis = currentMillis;
}
delay(100); // Adjust delay as needed
}
How it Works:
- Smart Dustbin (S): Automatically collects and disposes of waste, promoting cleanliness.
- Waste Segregator (W): Enhances recycling efforts by sorting waste for eco-friendly disposal.
- Air Purification (A): Purifies air to combat pollution, ensuring better air quality for residents.
- Green Space Management (Y): Maintains urban green spaces, fostering biodiversity and aesthetics.
- Mobile Hospital (M): Offers essential medical facilities and services to urban populations.
Benefits:
- Cleaner Environment: Reduces waste and pollution, contributing to a healthier city environment.
- Sustainable Practices: Promotes recycling and green initiatives for long-term sustainability.
- Improved Air Quality: Filters pollutants to provide cleaner and fresher air for residents.
- Enhanced Urban Aesthetics: Manages green spaces and landscapes for a visually appealing cityscape.
- Accessible Healthcare: Provides timely medical assistance and services through mobile healthcare units.