Introduction: Modify 100ーyen Stores Products to IoT

About: I like 100 yen shop. I like home improvement center. I like IKEA. I like motor sports.

There is LED lighting installed in the closet with products of 100-yen store such as The Daiso.

A magnet type opening and closing sensor is attached to the door of the closet, it lights up when the door opens, and turns off when closing it. I cut this opening and closing sensor with scissors and attached it to Raspberry PI, I tried creating a mechanism to monitor the opening and closing of the door and notify it to the smartphone.

Sorry for bad english. I use Google machine translation.

Overview

1. Install opening and closing sensor to Raspberry PI.

2. Create a Node-RED Flow to read the open and close sensor value on the Raspberry PI and send it to Microsoft Flow.

3. Create a flow to notify the smartphone by receiving the open and close sensor status on the Microsoft Flow.

4. Try to move.

Step 1: Attach Opening and Closing Sensor to Raspberry PI

Magnet type opening and closing sensor of 100 average LED lighting cut part with scissors, crimp the pin to make it easy to use with bread board etc.

Open and close sensor to Raspberry PI, 40 GPIO - 21 with connect to "39th GND" with "internal" Pull UP (Pull UP with about 10 KΩ if you want to attach external resistor).

Step 2: Setting Up Node-RED on Raspberry PI

1. Set the GPIO input node as shown in the figure (event changes occur when the value changes).

2. Edit values entered by GPIO into JSON format.

3. Call Microsoft Flow.

Step 3: Microsoft Flow Settings

Flow account acquisition method is omitted.

Create a flow on microsoft flow and call the flow from Node-RED on Raspberry PI with https (POST).

1. Send JSON data to Flow with Node-RED via https POST method.

2. microsoft Flow will receive the request. Then parse based on the preset JSON schema.

3. Make a response that processed the data a little, and return it to Node-RED.

The JSON schema is as follows.

{ "title": "test",

"type": "object",

"properties": { "a": { "type": "integer" } }

}

Step 4: Execution

Install the Microsoft Flow application on the smartphone and set the same account as Flow (After setting, you can end the application). When bringing the opening and closing sensor closer or away, an icon is displayed in the notification field of the smartphone.

Open and check the contents.



## At the end
IFTT is also good, but Microsoft Flow is also useful. Node-RED is more convenient! Thank you very much for seeing it to the end.

Internet of Things Contest 2017

Participated in the
Internet of Things Contest 2017