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

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

ASU 2017 Computer Science | Engineering Intern at Octoblu

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

Similar projects you might like

Chromebook Enrollment
Easy
  • 523
  • 9

Work in progress

For work every now and then I have to enroll up to 200 Chromebooks/Chromebits/Chromeboxes, so I wrote a script that does just that.

Particle Photon and Electron shield
Easy
  • 275
  • 3

Work in progress

I was tired of using push-in boards and jumpers for my projects, so I developed a shield for the Particle Electron.

Echo Kill Switch
Easy
  • 4,379
  • 21

Full instructions

Use Amazon Alexa to trigger an IFTTT applet that causes a Particle Photon to remove power from an Echo.

Particle + Raspberry Pi
Easy
  • 3,164
  • 19

Protip

The world's favorite low-cost computer now connects to the world's most popular IoT platform.

How to Command a RS485 Relays
Easy
  • 316
  • 3

Protip

Easy way to command a RS485 Relay boards with our Rotilio board.

Internet-connected Festive Tree
Easy
  • 244
  • 4

Full instructions

Spruce up your desk or home with an Internet-controlled 3D printed Holiday tree!

Add projectSign up / Login
Respect project