The purpose of this project was to automate closing the toilet seat. It is meant to close the toilet seat every time the toilet is flushed. I had the idea for this project because I am often in trouble for leaving the toilet seat open, so I decided having it close automatically might be nice. The project uses a vibration sensor and a stepper motor to sense the vibration of the toilet flushing and push the toilet seat closed.
Here is the final product:
At first, I was envisioning a motion sensor sensing the toilet flusher moving, but the reason that might not work is that a motion sensor will detect all motion, like people moving in the room or the lights turning on and off, and I couldn't have the motor going off randomly. After talking to my teacher, I settled on a vibration sensor to sense the flushing.
One of the things I had to consider when choosing a vibration sensor was choosing the right sensitivity, so that it would not detect too much, but also will detect the bowl flushing. I also ran numerous tests using the vibration sensor to make sure that it would work before incorporating it into my final product.
The sensor I used was the adafruit medium vibration sensor, and I taped it to the side of my toilet bowl as pictured below:
I started with a very rough sketch so that I had a way I knew things were going to be set up.
I then spent some time learning about the stepper functions in the particle stepper libraries, and I included the stepper.h library in my project. The coding was simple after that, as I just used a few if statements along with code for the vibration sensor and stepper motor to create code that turns the motor back and force one time after it senses a flush.
Something that I struggled with for a bit was finding the right attachment for the stepper motor to push the seat. I tried many different things including taping on toothpicks and pieces of wood, and Legos, but I ended up finding a piece of rubber in my basement, and attached a piece of wood to it as a way of pushing the seat. I attached the motor to the side of the toilet, just above the seat. The piece of wood came from a larger piece, and I used a jigsaw to cut off the shape I needed.
Now that I had all of my parts ready, I wired the breadboard and connected everything together.
After getting everything working and testing the project many times, I decided that it was a good idea to keep it from getting wet and from falling into the toilet, both of which could happen easily in a bathroom. I used a hot glue gun to create a simple cover for all of the electronics and I used heavy duty sticky Velcro to keep all of the parts stuck to the toilet.
The final product turned out well and I was happy with the results, despite struggling with a few parts of the project. Now I have a working toilet seat closer!\
Code pictured below...
Comments