Project showcase
Monitoring the Fill Height of Paper Shredder

Monitoring the Fill Height of Paper Shredder © LGPL

When paper shredder is filled by paper trash, Arduino notifies someone via Gmail that the trash bin is full and it should be taken out.

  • 1,495 views
  • 5 comments
  • 18 respects

Components and supplies

About this project

If you are a beginner, you can learn about Arduino - Ultrasonic Sensor and Arduino - Wifi.

Introduction

In this tutorial, I am going to show you how to detect the fullness of a paper shredder and send a notification via Gmail using Arduino Uno.

I made this tutorial for beginners! It is really easy!

Let's get started!

Detecting the Fill Height of Paper Shredder

Ultrasonic Sensor - HC-SR04 is used to detect the fullness of paper shredder. When the distance between sensor and paper trash is at a threshold, paper shredder is considered to be full.

Handling Event

In this project, when an event occurs, a notification is sent via Gmail.


Code

Source CodeArduino
You only need to replace your Gmail account's information

To get Gmail library, visit here https://create.arduino.cc/projecthub/phpoc_man/gmail-arduino-uno-ipv6-01ecc0?ref=user&ref_id=160147&offset=3
#define PIN_TRIG 5
#define PIN_ECHO 6
#define BIN_HEIGHT 20 // maximum containable height of bin in centimeters

#include "SPI.h"
#include "Phpoc.h"

long ultrasonicGetDistance();
boolean dustbinSendGmail();

PhpocEmail email;
boolean isSent = false;

void setup() {
	Serial.begin(9600);
	while(!Serial)
	;
	pinMode(PIN_TRIG, OUTPUT);
	pinMode(PIN_ECHO, INPUT);
	
	Phpoc.begin(PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP);
	
}

void loop() {
	long distance = 0;
	// read 10 time and get average value to eliminate noises
	for(int i = 0; i < 100; i++)
	{
		long temp = 0;
		do
		{
			temp = ultrasonicGetDistance();
		}
		while(temp > BIN_HEIGHT);
		
		distance += temp;
		delay(10);
	}
	distance /= 100;
	
	Serial.print(distance);
	Serial.println(" cm");
	
	if(distance <= 5)
	{
		if(!isSent)
		{
			Serial.println("Dustbin is almost full");
			isSent = dustbinSendGmail();
		}
	}
	else if(isSent && distance > 8) // avoid send alot of email when the distance is oscillated around 5cm 
		isSent = false;
		
	delay(500);
}

long ultrasonicGetDistance(){
	long duration, distance;
	digitalWrite(PIN_TRIG, LOW); 
	delayMicroseconds(2); 
	digitalWrite(PIN_TRIG, HIGH);
	delayMicroseconds(10); 
	digitalWrite(PIN_TRIG, LOW);
	duration = pulseIn(PIN_ECHO, HIGH);
	distance = (duration/2) / 29.1;
	return distance;
}

boolean dustbinSendGmail(){
	// setup outgoing relay server - gmail.com
	email.setOutgoingServer("smtp.gmail.com", 587);
	email.setOutgoingLogin("your_login_id", "your_login_password");
	
	// setup From/To/Subject
	email.setFrom("from_email_address", "from_user_name");
	email.setTo("to_email_address", "to_user_name");
	
	email.setSubject("Your dustbin is almost full");
	
	// write email message
	email.beginMessage();
	email.println("Location: Planet Earth.");
	email.println("");
	email.println("Your dustbin is almost full.");
	email.println("");
	email.println("Prepare to through it out.");
	
	email.endMessage();
	
	// send email
	if(email.send() > 0)
	{
		Serial.println("Email send ok");
		return true;
	}
	else
	{
		Serial.println("Email send failed");
		return false;
	}
}

Schematics

Assembly
Assembly
1. Stack PHPoC Shield on Arduino
2. Connect LAN cable or USB wifi Dongle to the shield for Ethernet
3. Pin wiring between Arduino and Sensor.
P1010763 qn4mktim1k
Pin wiring between Arduino and Sensor
Fritzing estklapyoe
All system
P1010752 ph2vpst7xl

Comments

Similar projects you might like

Arduino, Monitoring Door-Opening via Gmail

Project tutorial by phpoc_man

  • 37,206 views
  • 41 comments
  • 124 respects

Cardiac Monitoring System - EKG

Project showcase by Zorzonel Vlad

  • 16,626 views
  • 8 comments
  • 43 respects

Arduino - Monitoring Door Open via Facebook Messenger

Project tutorial by phpoc_man

  • 13,244 views
  • 6 comments
  • 45 respects

Plant Moisture Monitoring and Watering with LED Indicator

Project showcase by Rich Noordam

  • 7,553 views
  • 0 comments
  • 16 respects

Arduino-based Obstacle Monitoring System

Project showcase by Boaz Lawnce

  • 3,742 views
  • 0 comments
  • 5 respects

Real time LPG monitoring system

Project showcase by TEAM DIY

  • 3,695 views
  • 2 comments
  • 4 respects
Add projectSign up / Login