Smart Trash Bin - Email Notifier When Full (Wifi IoT)

by TechMartian in Circuits > Wireless

4733 Views, 5 Favorites, 0 Comments

Smart Trash Bin - Email Notifier When Full (Wifi IoT)

ZFyOHNwORB2Uxvt8%1QGDg_thumb_b28.jpg
MXuqQbVIR2yGsdhaZbltew_thumb_b26.jpg

This is a smart trash bin that senses if the trash is full and sends a notification to you to let you know its time to empty it!

BoM

NAcDZsEYSCKYIZdTpXfaxg_thumb_b20.jpg

* ESP32

* Ultrasonic Sensor - HC-SR04

* Female-Female Jumper Cable

* Trash bin

Tools:

Hot Glue Gun

Wiring

+v2BMnvqR76K4MAq0FU3lw_thumb_b21.jpg
od9OFePfT52B+TGOVVUV0g_thumb_b22.jpg
z3gB6OXCTqKXK2u16dKOHw_thumb_b23.jpg

* Connect the VCC pin on the Ultrasonic sensor to 3.3V on the ESP32

* Connect the GND pin on the Ultrasonic sensor to the GND pin on the ESP32

* Connect the Trig Pin on the Ultrasonic sensor to D4 on the ESP32

* Connect the Echo Pin on the Ultrasonic sensor to D5 on the ESP32

Mount

s3hKORjDQTq9QdEA%xI0Og_thumb_b25.jpg

Glue the ultrasonic sensor such that it is facing downward towards the trash bin.

Upload Code to ESP32

Screen Shot 2017-08-29 at 9.23.22 PM.png
Screen Shot 2017-08-29 at 9.23.20 PM.png
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */ //#define BLYNK_MAX_SENDBYTES 128

#include "WiFi.h"
#include "WiFiClient.h" #include "BlynkSimpleEsp32.h"

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
void emailOnButtonPress()
{
  // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS! ***
  // Let's send an e-mail when you press the button
  // connected to digital pin 2 on your Arduino
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
float duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
 
  if (distance<2)
  {
     Blynk.email("techmartian@techmartian.com", "Clean your Trash!");
    
  }
}
void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
void loop()
{
  Blynk.run();
}

Plug in and Enjoy!

BDnige8jTyC95IQKlaFOvA_thumb_b2a.jpg

Plug it in to an outlet and enjoy a clean trash bin!