Charles PeroulasDaniel Law
Published

Lane Tech HS - PCL - Toilet seat Closer

Senses the vibration of the toilet flushing, and closes the toilet seat

IntermediateFull instructions provided206
Lane Tech HS - PCL - Toilet seat Closer

Things used in this project

Hardware components

Stepper Motor
Digilent Stepper Motor
×1
Argon
Particle Argon
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Adafruit vibration sensor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Wire Stripper & Cutter, 32-20 AWG / 0.05-0.5mm² Solid & Stranded Wires
Wire Stripper & Cutter, 32-20 AWG / 0.05-0.5mm² Solid & Stranded Wires

Story

Read more

Code

Toilet Closer Code

C/C++
When a vibration is sensed, the stepper motor will turn and turn back
#include <Stepper.h>

const int stepsPerRevolution = 2000;
int sense = 7;

#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5
int count = 0;
Stepper myStepper(stepsPerRevolution, IN1, IN3 , IN2, IN4);


void setup() {
  myStepper.setSpeed(17);
 pinMode(sense, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {
 int sensor = digitalRead(sense);
  

	if ( sensor == LOW)
	{
	    if(count==0){
	    	Serial.println("clockwise");
         myStepper.step(stepsPerRevolution);
        delay(500);
         Serial.println("counterclockwise");
        myStepper.step(-stepsPerRevolution);
        delay(500);
        count = 1;

	    }
	}
	else
	{
		delay(500);
		count=0;
    }
  

}

Credits

Charles Peroulas

Charles Peroulas

1 project • 0 followers
Daniel Law

Daniel Law

16 projects • 8 followers
Teacher. Maker. Citizen of the planet.

Comments

Add projectSign up / Login