Andrew Steinheiser
Published © MIT

Stinker Blinker (IoT Bathroom Detector)

The Stinker Blinker will detect whether the bathroom door is closed/open and will turn a siren on/off to indicate vacancy.

EasyFull instructions provided2 hours575
Stinker Blinker (IoT Bathroom Detector)

Things used in this project

Hardware components

Siren
×1
Belkin Wemo Switch
×1
Photon
Particle Photon
×1
Keyes Mini Magnetic Sensor
×1
Magnet
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Meshblu
Octoblu Meshblu
Particle Build Platform

Story

Read more

Custom parts and enclosures

Photon Case Body

Use a 3D printer to create this case for your Photon

Photon Case Cap

Use a 3D printer to create this cap for your Photon Case

Magnetic Sensor Case Body

Use a 3D printer to create this case for your magnetic sensor

Magnetic Sensor Case Cap

Use a 3D printer to create this cap for your magnetic sensor case

Schematics

Photon Magnetic Sensor

This is how to wire the magnetic sensor to the Particle Photon, which should be mounted on the door, along with a magnet.
S5n7aefhgwym7nn1prr5

Code

Particle Photon Firmware

C/C++
This code should be pasted into build.particle.io
int led = D7;
int sensor = D6;
int magnet;
int lastRead;

void setup() {
    pinMode(led, OUTPUT);
    pinMode(sensor, INPUT);

    magnet = digitalRead(sensor);
    lastRead = magnet;
}

void loop() {
    magnet = digitalRead(sensor);
    
    if(magnet != lastRead) {
        if(magnet == 0) {
            digitalWrite(led, HIGH);
        }
        if(magnet == 1) {
            digitalWrite(led, LOW);
        }
        
        lastRead = magnet;
        Particle.publish("magnet_change", String(magnet));
    }
}

Credits

Andrew Steinheiser

Andrew Steinheiser

17 projects • 21 followers
I enjoy Javascript, React.js, Robotics, and Internet of Things!! Former Octoblu Hacker | Developer at Fyresite
Contact

Comments

Add projectSign up / Login