Automatic Toilet Flusher

A distance sensor senses if someone is present. Once they leave, a servo pulls a fishing line which flushes the toilet.

This is a proof of concept version 1.0, it could be made to look prettier.
Ingredients:
1 servo
30 lb test fishing line
IR distance sensor http://www.sparkfun.com/commerce/product_info.php?products_id=242

Here’s a different version that inspired me, it was made with legos: http://www.dexterindustries.com/Project-eFlush.html#

Tips if you make your own:
I made the end of the lever towards the handle a bit shorter so that the force would be spread out over a greater distance, resulting in less strain on the servo.
The mechanism has to be secured, because it wants to push upwards and to the side. I put a piece of wood underneath the lip of the lid to keep it from moving upwards. I also have a piece going down in the back to keep it stable. Maybe you could use a strap from front to back to hold it in place.

#include <ServoTimer1.h>
ServoTimer1 servo1;

int sensor=0;
int sensorPin=5; //distance sensor on analog pin 5

int PreparingToFlush=0;

void setup() {
  Serial.begin(9600);          
  servo1.attach(10); //servo data line on pin 10
  servo1.write(3);
}


void loop() {
sensor=analogRead(sensorPin); 



if (sensor > 100){ //if distance sensor detects someone
  delay(2000);  // wait
  sensor=analogRead(sensorPin);
  if (sensor > 100){ // check again to make sure someone is actually there
  PreparingToFlush=1; 
  }
}

if (PreparingToFlush==1){ //if a person has been detected
  if (sensor < 100){ // if the person has now left
  
  servo1.write(175); //FLUSH
  delay(5000);
  servo1.write(3);
  delay(1000);
  
  PreparingToFlush=0;  //reset the trigger
}
}  
  
  delay(10);
}

Someone ALWAYS beats me to it!!! I was going to do this, but never got around to it... Good work!

Probably needs some refining; but you did it ;)

The place of Aduino is definitly ... anywhere ;D ;D ;D

Looking good, sir. Where will the ass wiping mechanism be attached?

Where will the ass wiping mechanism be attached?

That's stage 2. Here's a demo version being tuned in the lab:

Korman

Sigh.

Nice.

We definitely need to see a video of this working - with suitable editing of course.

for version 2 you should just have the servo string pull sideways/up on the middle/bottom of the chain that hangs down inside the toilet off the handle arm so you can't see it and can still use the handle as normal but the servo could also flush it

make sure your board is rust proof and the wood is water proof just in case of any splash diarrhea explosion damage. it would suck to have poo marks everywhere :(

Other than that, looks good

Good thinking wediggers. I saw that someone did something like that: http://toolex.blogspot.com/2008/05/arduino-flush-o-matic.html

I was concerned that the moisture might disable the servo. I'll try it anyway and put my servo on the line for the sake of progress. I think I'll replace their wire mounting setup because it lifts the lid up a bit, some strong fishing line would lay flat and keep the lid tight.

I think I’ve made this project as simple as possible. There is no apparatus needed to flush it. I mounted the servo inside the toilet tank by just tying a knot in the servo wire.

The knot is outside the porcelain lid so that the servo does not fall into the tank.
The fishing line is connected to a hook, which you can use to hook onto the chain inside the toilet tank. If you need the line to be tighter you can just hook lower down on the chain.
I wrapped the servo wire around the servo and taped it so that the wire wouldn’t pull out or damage something internally, but maybe that part is not even necessary.
I have had the servo inside the tank for about a week now and so far it is still working fine, despite the moisture.
Here it is hanging in the tank:

I have also made some adjustments to the code:

#include <ServoTimer1.h>
ServoTimer1 servo1;

int sensor=0;
int sensorPin=5; //distance sensor on pin 5

int PreparingToFlush=0;

void setup() {
  Serial.begin(9600);          
  servo1.attach(10); //servo data line on pin 10
  servo1.write(3);
  
 // digitalWrite(3,HIGH);
}


void loop() {
sensor=analogRead(sensorPin); 

Serial.println(sensor);


  
 if (sensor > 90){ //if distance sensor detects someone
  delay(2000);  // wait
  sensor=analogRead(sensorPin);
  Serial.println("Sensing");
  if (sensor > 90){ // check again to make sure someone is actually there
  PreparingToFlush=1; 
  digitalWrite(13, HIGH);
  
  Serial.println(sensor);
  }
}

if (PreparingToFlush==1){ //if a person has been detected
  if (sensor < 60){ // if the person has now left
  delay(1000);
  sensor=analogRead(sensorPin); 
  if (sensor < 60){
  
  servo1.write(175); //FLUSH
  digitalWrite(13, LOW);
  delay(9000);
  servo1.write(3);
  delay(1000);
  
  PreparingToFlush=0;  //reset the trigger
}
}   
}  
  
  
  delay(10);
}

What does the misses say?

Looks cool by the way!

I know my wife will like it. She is quite tired of the children forgetting to flush. They are very lazy.

But seriously, has anyone ever had trouble with an overflowing toilet? The float shut-off value in the tank failed and the water overflowed from the top of the tank. It was clean water, but the flood caused over $10k in damage. I was thinking about building some kind of moisture alarm.

The toilets I now (here in the Netherlands) have a hollow tube which is pulled up by lever to flush. But when the water level rises to much, the water will go over the top of the tube and into toilet. So you can not get an overflowing toilet.

This concept with the hole at the top to prevent overflows seems to be too modern for our brothers in the United States of America. After all, it has been invented and pretty standard in continental Europe for only the past 70 years.

Korman

I’ve made another adjustment to the code. If you’re not using a capacitor to smooth out the data from the IR sensor it might randomly falsely trigger it, so now it will take 4 data samples and average them to make sure someone is actually standing there. Right now there is a 1 second delay, then a 1 second sample time. If the toilet is next to a bathtub you might want to make that triggering delay longer, because someone might stand there for 5 seconds before getting into the tub.
If you haven’t seen the pictures of the non-wooden apparatus at the bottom of page 1 check that out.
Wortlesoft- no misses yet. Andy R, let me know how it goes. You could also make a fun button with lights for the kids, or a clapper (clap twice).

#include <ServoTimer1.h>
ServoTimer1 servo1;

int sensor=0;
int sensorPin=5; //distance sensor on analog pin 5

int PreparingToFlush=0;
int sample1;
int sample2;
int sample3;
int sample4;

void setup() {
  Serial.begin(9600);          
  servo1.attach(10); //servo data line on pin 10
  servo1.write(3);
  
 // digitalWrite(3,HIGH);
}


void loop() {
sensor=analogRead(sensorPin); 

Serial.println(sensor);


if (PreparingToFlush==0){  
 if (sensor > 90){ //if distance sensor detects someone
  delay(1000);  // wait
  sample1=analogRead(sensorPin); //take a sample of the data
  Serial.println("Sensing");
  delay(300);
  sample2=analogRead(sensorPin);
  delay(300);
  sample3=analogRead(sensorPin);
  delay(400);
  sample4=analogRead(sensorPin);
  
  sensor= (sample1 + sample2 + sample3 + sample4)/4;
  if (sensor > 90){ // check again to make sure someone is actually there
  PreparingToFlush=1; 
  digitalWrite(13, HIGH);
  
  Serial.println(sensor);
  }
}
}

if (PreparingToFlush==1){ //if a person has been detected
  if (sensor < 60){ // if the person has now left
  delay(1000);
  sensor=analogRead(sensorPin); 
  if (sensor < 60){
  Serial.println("Flushing");
  servo1.write(175); //FLUSH
  digitalWrite(13, LOW);
  delay(9000);
  servo1.write(3);
  delay(1000);
  
  PreparingToFlush=0;  //reset the trigger
}
}   
}  
  
  
  delay(10);
}

I saw the picture but didn't realise this was a new situation. That sure is a lot better. I'm surprised that such a servo is powerfull enough.

LOL that is awesome... it made my day haha