Things used in this project

Hardware components:
Siren
×1
Belkin Wemo Switch
×1
Photon new
Particle Photon
×1
Keyes Mini Magnetic Sensor
×1
Magnet
×1
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Meshblu
Octoblu Meshblu
Particle Build Platform

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 FirmwareC/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

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

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login