Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Shubham Thanekar
Published

Self Alerting Bin

Get an alert about your dustbin status when it gets fulled using mail notification and Node-RED.

IntermediateFull instructions provided1,191
Self Alerting Bin

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Node-RED
Node-RED

Story

Read more

Schematics

Nodered Flow

This the flow created for this project.

Pi SRF

This node is used for ultrasonic hcsr04 sensor. It can be downloaded from the nodered->Manage palette->Install->node-red-node-pisrf

Alert Switch

used to give condition of less than 10 cm. i:e if the bin is full then the distance must be less than 10 to trigger an mail event

Mail Controller

Used to give delay between the time interval to send a mail.

Message node

This is a function node from nodered. Javascript function is written for adding the content for sending a mail.

mail node

This node is actually sends an mail to the particular person's mail address.

Raspberry pi connection

Connect Sensor VCC pin to raspberry pi 5 volt vcc pin that is pin 2.
Connect Sensor ground pin to raspberry pi grounf pin 6.
Connect Sensor Trig pin to raspberry pi pin 7.
Connect Sensor Echo pin to raspberry pi pin 11, but use 1 kohm resister in between echo pin from sensor to the raspberry pi using breadboard.

Code

Nodered Flow Exported Script

JSON
After formation of the flow this script is created which you can import in your nodered
[{"id":"66b417f5.2b1868","type":"rpi-srf","z":"dae13560.49d1a8","name":"","topic":"SRF","pulse":"10","pins":"7,11","x":121.16667938232422,"y":136.00000667572021,"wires":[["f68e599e.fe7d28","f85740fe.3270e"]]}]

Nodered Function node

JavaScript
This code is used to write a javascript function. In this code the alert message and the topic for the mail is written.
msg= {
   payload : "Self Alerting Bin Status : BIN IS FULL!! Please take a action.!!\n" + Date().toString(),
   Topic : "Bin Status!"
};
return msg;

Credits

Shubham Thanekar

Shubham Thanekar

1 project • 1 follower
Working IOT Depeartment Nokia Solutions and Networks, Chennai. Developed few IoT Projects.

Comments