In this project we used windows and Arduino and we started out with high hopes and big plans. We began brainstorming ideas for the project and originally planned to use a load sensor or another proximity sensor of some sort to be able to weigh, or ultimately tell when you were out of toilet paper. We decided that a load cell was too hard to incorporate mechanically and even if it was it wouldn’t be accurate enough to sense a few sheets of toilet paper. After we trashed that idea, we decided we would still have a sensor for when it was empty but we would use a interrupt sensor and a series of pullies tied in with the motor to show that the motor was turning but no more toilet paper was coming out. Well this plan also failed due to lack of time and mechanical availability. So we decided to try to perfect the simple action of automated toilet paper dispensing.
The hardware of this project was mostly recycled from other projects. The Styrofoam casing and motors came from a previous project that was about RC cars using DC motors. Our hardware was fed through the existing and new holes and the board and wiring was all implemented on the opposite side to what the user would see. The motor was wired through a transistor and diode to protect the DC motor in case of feedback. We originally had a 5V power source but the output was too low for the motor to turn with the toilet paper attached. The PWM ports on the Arduino were used to change the power used for the DC motor. The photo infrared sensor acts as a trigger to activate the toilet paper dispenser for 3 seconds.
The code for this project is a mixture of checking for interrupts in the PIR and if there are changes then the toilet paper dispensing is triggered and then resets after it is done. It is very similar code for paper towel dispensers that you would see in almost all public bathrooms. Our PIR was very sensitive so often the it would trigger multiple times in a row, but otherwise the code worked perfectly. There were plans to add a buzzer to the rig as shown in the code, but it never made it to the final product. Everything was coded in Arduino.