ClutterBuddy was made out of my frustration with my roommates after drinking a few beers.
I like a clean kitchen, preferably with almost NOTHING on the counters. My roommates, however, find it convenient to place their empty cans on the counter until they're done. But guess what?
They NEVER clean them up the next day. Shocker!
So, I made this little contraption using an Ultrasonic Sensor, an LCD Screen, some LEDs, and an Arduino Mini.
It checks to see if there's anything within 5 inches of the Ultrasonic sensor. If so, it alerts whoever placed something there to put it in the trash.
If not, then it let's them know that all is well.
I used some online tutorials for the LCD screen since I've never used one of these before.
I checked out Elegoo's website, and found some good tutorials, but honestly I just wanted results as fast as possible.
So, I bounced over to YouTube and watched this video from How To Mechatronics and got a circuit diagram, the basics of the LiquidCrystal constructor and methods, and a rundown of the different pins on the LCD.
Then, I scraped together some basic jumper cables, a breadboard, and an Arduino Micro that I had laying around, as well as my sensors and LEDs from a college kit.
I started slapping together all the components until I had a working prototype, which I refined by some trial-and-error of the values to find the right distance for my application.
Then, I quickly mocked up a little stand for this thing to sit on, sent it to my 3D printer, and moved on.
I used your standard Arduino sketch to whip up this little guy from some code I found online.
Nothing too special about it, just some checks, initializing some pins, and doing a little math. But good practice!
I used some leftover Acrylic plates that I had laying around at home and were initially scrapped.
I used a 3/4" bit to cut holes for the Ultrasonic sensor to poke through and used man's best friend to fasten the breadboard, sensor, and LCD screen to the Acrylic -- electrical tape.
Works like a charm. 😊
#include <LiquidCrystal.h>
#define trigPin 6
#define echoPin 5
#define gled 2
#define rled 3
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 12, 11, 10, 9);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(gled, OUTPUT);
pinMode(rled, OUTPUT);
// Testing LEDs
digitalWrite(rled, HIGH);
delay(1000);
digitalWrite(rled, LOW);
digitalWrite(gled, HIGH);
delay(1000);
digitalWrite(gled, LOW);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}
void loop() {
lcd.clear();
long duration, distance;
// Signal to Sensor to start reading
digitalWrite(trigPin, LOW); // Sets trigger LOW and waits
delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH); // Now throws trigger HIGH
delayMicroseconds(10); // Back to low to start the readings!
digitalWrite(trigPin, LOW);
// Read from sensor
duration = pulseIn(echoPin, HIGH);
distance = (duration / 148); // gives us distance in INCHES
// Check conditions and write to LEDs
if (distance < 5) { // CHECKS IF LESS THAN 4 INCHES
digitalWrite(rled,HIGH); // When the Red condition is met, light up LED
digitalWrite(gled,LOW);
lcd.print("Hey jerk! Put");
lcd.setCursor(0,2);
lcd.print("it in the trash!");
}
else {
digitalWrite(rled,LOW);
digitalWrite(gled,HIGH);
lcd.print("All clear, folks.");
}
delay(1000);
}