Things used in this project

Hardware components:
Belkin Wemo Switch
Photon new
Particle Photon
Keyes Mini Magnetic Sensor
11026 02
Jumper wires (generic)
Software apps and online services:
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


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.


Particle Photon FirmwareC/C++
This code should be pasted into
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));


Andrew Steinheiser

ASU 2017 Computer Science | Engineering Intern at Octoblu



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


Similar projects you might like

Control Adafruit NeoPixels using Python and JQWidgets
  • 932
  • 8

Full instructions

In this tutorial, we'll see how to control an Adafruit NeoPixel ring via mobile using Python and JQWidgets.

What's My I2C Address?
  • 244
  • 4

The story of how to make a clock through using a LCD 1602 or LCD 2004 over I2C.

I Keep My Cucumber Growing Conditions Moist - Part 3
  • 266
  • 3

Full instructions

This is the next step with an Particle Photon and softAP integration: cucumbers go online.

MyHumidity Controlled by BME280 and Photon
  • 521
  • 6

Full instructions

Checks if humidity threshold is reached and informs the user by using Blynk/IFTTT-services with softAP integration.

Study Buddy
  • 2,848
  • 141

Full instructions

Know when an assignment is coming up!

Study Buddy

Team Alexa and Shannon

MyLCD20x4 clock with value-added information
  • 40
  • 0

Full instructions

Use a Particle Photon, a BME280 sensor and a cheap LCD20x4 to start your own clock-project.

Add projectSign up / Login