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!

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

Give feedback

Comments

Similar projects you might like

Direct Photon to TP-Link Device Control
Easy
  • 291
  • 7

Full instructions

Add this small file to your project to control TP-Link bulbs and plugs directly with simple subroutine calls.

Poor Man's CAN Bus
Easy
  • 163
  • 4

Protip

Learn how to connect microcontrollers together using the CAN bus by using a simple AND gate

Internet Connected Bubble Machine
Easy
  • 34
  • 2

Full instructions

Make it possible to activate a bubble machine from anywhere using a Particle Photon

MyPIR-Sensor activate analog RGB Stripe controlled by Photon
Easy
  • 92
  • 2

Full instructions

At my age you have to get up at night and get tired on the way to the bathroom. Using a PIR-Sensor to trigger light on!

Weather Box
Easy
  • 2,185
  • 11

Full instructions

Small weather station that uploads to Weather Underground with a NeoPixel ring for visualization.

Washer/Dryer Monitor
Easy
  • 582
  • 5

Full instructions

Monitor your appliance's power indicator with a photocell for easy notifications without high voltage wiring.

Add projectSign up / Login
Respect project