Smart Trash Bin - Email Notifier When Full (Wifi IoT)
by TechMartian in Circuits > Wireless
4480 Views, 5 Favorites, 0 Comments
Smart Trash Bin - Email Notifier When Full (Wifi IoT)
![ZFyOHNwORB2Uxvt8%1QGDg_thumb_b28.jpg](/proxy/?url=https://content.instructables.com/F3E/NLXM/J6WGMBWU/F3ENLXMJ6WGMBWU.jpg&filename=ZFyOHNwORB2Uxvt8%1QGDg_thumb_b28.jpg)
![MXuqQbVIR2yGsdhaZbltew_thumb_b26.jpg](/proxy/?url=https://content.instructables.com/F6P/LV34/J6WGM9KT/F6PLV34J6WGM9KT.jpg&filename=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](/proxy/?url=https://content.instructables.com/FKO/3NK1/J6WGMA3I/FKO3NK1J6WGMA3I.jpg&filename=NAcDZsEYSCKYIZdTpXfaxg_thumb_b20.jpg)
* ESP32
* Ultrasonic Sensor - HC-SR04
* Female-Female Jumper Cable
* Trash bin
Tools:
Hot Glue Gun
Wiring
![+v2BMnvqR76K4MAq0FU3lw_thumb_b21.jpg](/proxy/?url=https://content.instructables.com/FO0/ATFP/J6WGM9BF/FO0ATFPJ6WGM9BF.jpg&filename=+v2BMnvqR76K4MAq0FU3lw_thumb_b21.jpg)
![od9OFePfT52B+TGOVVUV0g_thumb_b22.jpg](/proxy/?url=https://content.instructables.com/FD2/ZUAW/J6WGMAPQ/FD2ZUAWJ6WGMAPQ.jpg&filename=od9OFePfT52B+TGOVVUV0g_thumb_b22.jpg)
![z3gB6OXCTqKXK2u16dKOHw_thumb_b23.jpg](/proxy/?url=https://content.instructables.com/FLM/NUN5/J6WGMBOH/FLMNUN5J6WGMBOH.jpg&filename=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](/proxy/?url=https://content.instructables.com/FT8/LH6J/J6WGMBHB/FT8LH6JJ6WGMBHB.jpg&filename=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](/proxy/?url=https://content.instructables.com/F7R/7DRL/J6WGMKR4/F7R7DRLJ6WGMKR4.png&filename=Screen Shot 2017-08-29 at 9.23.22 PM.png)
![Screen Shot 2017-08-29 at 9.23.20 PM.png](/proxy/?url=https://content.instructables.com/FZK/CL4X/J6WGMKXI/FZKCL4XJ6WGMKXI.png&filename=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](/proxy/?url=https://content.instructables.com/FX1/INQM/J6WGM9FQ/FX1INQMJ6WGM9FQ.jpg&filename=BDnige8jTyC95IQKlaFOvA_thumb_b2a.jpg)
Plug it in to an outlet and enjoy a clean trash bin!