Introduction: ForgetMeNot - Smart Home Notification Platform

As busy college students, running around between classes, jobs and family obligations, we tend to forget the little things. A birthday comes and goes without us noticing, an important deadline is missed due to sheer forgetfulness and sometimes, just sometimes, fire breaks out and burns down your room because you forgot the space heater on.

Worry not, dear friends - we come to the rescue.

ForgetMeNot is a Smart Home Notification Platform, created out of a real need we encountered in our daily lives (and, if we're totally honest, slightly driven by a final project in a Computer Science class).

In essence, it's a combination of hardware and software. It makes sure you're aware (and can act!) on things you forgot to do when leaving the house.

Remix?

While we only use a few sensors (things that observe) and activators (things that do), the generality of each component makes it suitable for a various use cases with minimal hardware and software changes. Let us know if you remixed some (or all!) of the project - we're crazy about collabs!

Who?

Proudly created by (a subset of) team Red Panda from IDC Herzliya in McCann Valley, Mizpe Ramon. A literal bag of gratitudes goes to Zvika Markfeld, of ForRealTeam, for going with us to the desert to build amazing things in the middle of the most beautiful part of our country.

Special Thanks

To the folks at Random Nerd Tutorials for their never-ending flow of interesting, new concepts we can test out with Node-RED and our ESP8266s, specifically in here.

Supplies

Woah, so many stuff....

This is quite an extensive project, and we made some early design choices as to the hardware, software and other goodies we use.

While we recommend the list below if you plan to follow along, a lot of the parts can be swapped for more easily obtained items. One example is the WeMos boards - whatever cheap version of the board you have sitting around, you could probably make it work without making many changes.

An example of a different kind is the casing for the Smart Outlet. While pretty and sturdy, any (non-metal) box will do. We just happened to have access to a laser cutter, and everybody who has access to a laser cutter suddenly has many, many uses for laser-cutting thing. ALL THE THINGS. Same goes for our 3D-Printed parts.

So - just rock your own gear, and leave a comment below if you need assistance with substituting some part for another.

Micro-Controllers, boards and shields

  • 4 x ESP8266 boards (we used LoLin-made WeMos D1 minis)
  • 1 x D1 Mini Relay Shield
  • 1 x L293N Hbridge (used for the Door Activator's DC engine)

Power

  • 50 x Arduino-style jumper cables (depending on the board you're using, you might need more female-male or more male-male. Just get a bunch of each, they always come in handy) - note that some of them will be stripped for the Door Activator
  • 3 x 10 Ohm resistors
  • 1 x Xuanshi XS-XB6 16A ~250v max. 3500W power strip + extension cord (any extension cord + splitter for 220V sockets should do) - note that it will be stripped for the Smart Outlet
  • 3 x Micro-USB Cables
  • 3 x USB Wall Chargers
  • 1 x DY-0120200 (Input: 100-240V, 50-60Hz Output: 12V---2A) AC/DC Adapter with DC barrel male head (or equivalent adapter)
  • 1 x female DC barrel jack
  • 1 x 220V to 5V transformer (for providing power to the Smart Outlet board directly from the power strip, without an additional power source)

Sensors

  • 1 x LDR Light Sensor
  • 1 x Reed Relay (acting as a sensor for the window)
  • 1 x DHT Temperature sensor

Motors

  • 1 x DC motor (we used a coreless metal-brush motor, but any motor that fits your 3D-printed door activator casing will do)
  • 1 x Servo motor (any size will probably do, but make sure to use a strong enough one to flip the required switch)

Laser-Cut Parts

  • 1 x Smart Outlet Box

3D-Printed Parts

  • 1 x Door activator casing

Mobile phone

This tutorial was built with Android phones in mind, and for now it seems Integromat does not support iOS devices. Therefore, unfortunately, this instructable requires an Android phone.

Software

  • Arduino IDE (Integrated Development Environment - basically a fancy code editor)
    • Have your board loaded in the IDE for easy uploading
    • See attached sketches for all the relevant libraries
  • Node-RED Integration Platform
    • We use mostly stock nodes, with a few exceptions - see attached flow for all the relevant nodes
  • Integromat.com (service connector, allowing the linking of multiple services together - in our case, and Android app and our Node-RED server)
    • We used the free tier, which should suffice for daily use of the platform
  • PushBullet.com (push notification service)
    • We used the free version, which should suffice for daily use of the platform
  • ngrok (secure tunneling service)
    • We use this free tunneling software to expose a link from our locally-running dashboard to the world, so we can access the dashboard from a URL In the push notification
  • Mosquitto MQTT Broker
    • MQTT is a protocol used to transfer messages between our connected devices and Node-RED. Since Node-RED does not have a built-in MQTT server, we have to use an external one.

Step 1: Understand the Flow

Consult the video above for a demonstration of the system. Note that the general flow of the system (after which the Node-RED flow is constructed) is as follows:

  1. You leave your house
  2. Your phone disconnects from your house's WiFi
  3. Integromat gets word, and notifies Node-RED
  4. Node-RED checks what is the status of the sensors in your house and the switches in your dashboard
  5. If anything is left on or open, it notifies PushBullet
  6. PushBullet sends a notification to your phone, with a link the Node-RED Dashboard
  7. You can go to the Dashboard and close/turn off the relevant things

In essence, we offer a centralized approach to managing various objects in your house and validating that they are in the correct status when you leave your house.

In practice, we have the following capabilities in this project:

  1. Status of Window - open/closed (indicated by Reed Relay status)
  2. Status of Lights - on/off (indicated by LDR status)
  3. Status of Space Heater - on/off (indicated by DHT temperature sensor)
  4. Door Activator - open/closed (custom-made 3D-casing for a DC motor)
  5. Smart Outlet Activator - on/off (a D1 relay connected to a power strip)
  6. Switch Press Activator - on/off (a Servo connected to a board)

This is sufficient, in our book, to show the capabilities of the platform. It can be easily extensible (using Node-RED) to add more status indicators / activators, if need be.

Step 2: Ngrok

ngrok is a tunneling service. It allows us to expose a locally running service (in our case, Node-RED) to the outside world - without the hassle of setting up a server or dealing with DNS records. You simply run Node-RED on your computer, and then run ngrok on the same port Node-RED is running on. That's it - you'll get a URL that you can use to access Node-RED from anywhere in the world, regardless of what network it's connected to.

Installation & Configuration

  1. Download ngrok for your operating system from here.
  2. Follow the step on the download page, up until the "Fire it up" step.
  3. In the "Fire it up step", swap the 80 for 1880 - as in, ./ngrok http 1880 or ngrok http 1880, depending on your operating system.
  4. Make note of the http URL you'll see in your command line - we'll need it for later. See the image for an example.

Step 3: Node-RED

Installation & Configuration

The main logic controller of the project, Node-RED is a visual programming environment that allows you to connect various software (and hardware!) services together to create a unified application. As a bonus, it allows generation of beautiful dashboards that can get information from and even control the various services.

If you're familiar with Node-RED, just get our flow from this Gist, and add your ngrok id from step 8 below.

If you're not familiar with Node-RED or you don't have it installed, follow the following steps to load our Node-RED flow on your local computer:

  1. Node-RED requires Node.js, which is a programming language with its own special development environment. Grab the installer relevant to your operating system from here, then follow the instructions.
  2. You can now install Node-RED itself using the instructions here. Please take note of the location Node-RED was installed in, as you'd need it for the next step.
  3. Now that you have Node-RED installed, run it using the instructions on the step above and validate you can see an empty canvas page. It should be located in http://127.0.0.1:1880.
  4. You'll now need to install a few additional nodes (which is what Node-RED calls its extensions or modules) used in this project. Please follow the instructions here and here and install both of these modules.
  5. Now that the nodes are installed, restart the node-red server (simply killing the service and re-starting it should do the trick). You should now have both nodes available in your flow.
  6. Download this project's Node-RED flow from here, and follow the instructions here to import it into your Node-RED installation.
  7. Make sure you can see the picture of the flow as it looks above in your screen.
  8. Remember the ngrok URL from the last step? Enter it into the Build Push Notification node. This will allow us to see a live link of the dashboard (that's running on our local machine) in any device that we use to get notifications on.

Explanation of Flow

Notice the flow is separated into two parts - the upper one is the main logic, and the bottom one is the component logic.

The main logic takes care of finding out whether you have left the house (by receiving a GET request from Integromat in the Integromat WiFi Leave Endpoint node), sending back a success response (so Integromat does not hang, inside the Send Success Message To Integromat), and then running a check of all the sensors and activators to check their current status (this happens inside the Build Push Notification function node, using the global context store to get the information). If that check detects that something is on or open, it triggers a PushBullet push notification (in the upper-most Send Push Notification node). The lower-most Send Push Notification node takes care of sending belated push notifications (for the space heater - see its step for more information on the logic behind it). Note that there's also a debug node there (called Get Request) that logs all the requests coming through, so we can catch any problem's on Integromat's side of the fence.

The component logic flow takes care of updating the global context store with the state of each activator/sensor, so we can decide what (if any) information we need to send in our push notification. Note that there are two distinct variants of these flows:

Activator Flows (Switch Press/Door/Smart Outlet) - These are flows that need to update the dasboard after a switch has been flipped in the dashboard + trigger some activity in the real world. Specifically, both of them wait for an action to happen on the dashboard (in the Switch nodes), then flips the state inside the State Logic function nodes, and updates the dashboard according to the flipped switch (turn the LED on/off in the State LED nodes, and change the text in the State Indicator nodes). In addition, after the switch is flipped an MQTT message is sent to the WeMos controllers controlling the activators (using the MQTT-out Activator nodes) to create an action in the physical world (i.e. open/close a door or kill/enable the Smart Outlet).

Sensor Flows (Light/Window/Space Heater) - These are flows that need to update the dashboard after a sensor message came in over MQTT. Specifically, both of them wait for an MQTT message to come in (using the MQTT-in Sensor nodes), then parses the information and flips the state inside the State Logic function nodes. After that, they update the dashboard according to the incoming message (turn the LED on/off in the State LED nodes, and change the text in the State Indicator nodes).

See the injector nodes attached to each component? These take care of providing sane defaults for the dasboard when it's spun up the first time, to ensure no funny business happens on first load.

Note:Node-RED has two "modes": canvas and UI. Canvas is where you create and edit the nodes (it's on http://127.0.0.1:1880 or http://YOUR_NGROK_ID.ngrok.io) and UI is where you see your dashboards (it's on http://127.0.0.1:1880/ui or http://YOUR_NGROK_ID.ngrok.io/ui).

Step 4: Integromat

Sign-Up

Integromat, self-described as the "Glue of the Internet", is a service that connects various pieces of software together in interesting ways. In our case, we use its Android app to check when you disconnected from your house's WiFi, then trigger an HTTP request to our Node-Red Server. This request will trigger the entire flow depicted in the previous step.

  1. Sign up for an Integromat account in here.
  2. Download the Android app from here.
  3. In the Integromat web console (you should see it once you've signed up to Integromat), open the Devices tab on the left hand side, in the middle.
  4. Add your device by clicking "Add a device" on the top left and following the steps shown.
  5. After you're done authorizing the app with the web console, open it and go into settings on the bottom right.
  6. Click WiFi, and then check (under Events) the box for WiFi disconnected event. This will allow the app to see when your phone has disconnected from a WiFi network.

Creating Our Scenario

Flows of actions in Integromat are called Scenarios. We're going to create a scenario that waits for any WiFi network to disconnect, then filters only the ones that match our home's WiFi network.

  1. See the image above for the Scenario description.
  2. Create each of the nodes ("bubbles") by clicking on the bottom "+" sign near Favorites, and adding the three required nodes - Android (WiFi Disconnection), JSON (Create JSON) and HTTP (Make a Request).
  3. Connect the Android node to the JSON node, and the JSON node to the HTTP node.
  4. Configure the filter between the Android and the JSON nodes according to the image above.
  5. Configure each node according to the images above. Note the use of the ngrok URL created in the previous step for the HTTP node. If your ngrok URL is http://ac72hs.ngrok.io, then your ngrok id is ac72hs.


Step 5: Mosquitto

Since Node-RED does not have its own MQTT broker, and we will need to communicated with our sensors and activators over MQTT, we'll use a dedicated MQTT broker. Since Node-RED recommends Mosquitto, this is the one we will use. See here for some information about MQTT and why it's often used in IoT project.

Installation & Configuration

  1. Download Mosquitto from here and install it, all according to your operating system.
  2. Normally, you'd need to follow the instructions here to connect Node-RED to Mosquitto. However, if you used our flow, it's already pre-configured for you. As long as you install the flow and Mosquitrro properly, and Mosquitto runs on port 1883 (on which it runs by default), it should work out of the box.
  3. Note that this means that the MQTT broker and your Node-RED server run on the same machine. This is useful for simplifying communication inside the system. See the note below for more information.

Note about local networking

In order for your devices to function properly with Node-RED, you need them to have access to the broker. While we could define a proxy and use that to communicate with Mosquitto, to avid complications we suggest a simple solution: make sure your computer (running Node-RED and Mosquitto) and your ESP8266 boards are connected to the same WiFi. That way your devices can communicate with your broker directly, without any middleman.

One might ask why not use ngrok for this, in the same way that we use it for browsing the dashboard from another device. The simple answer is that you can - but ngrok is limited (in the free version) to one tunnel from each user. This means you can only open one port to the outside world, which in our case is used for exposing Node-RED. So, instead, we use local networking to bypass this.

This means that in each sketch you will need to modify the IP address of the broker to fit your computer's IP address on the local network. This address can be accessed by running ipconfig (on Windows) and ifconfig (on Mac / Linux) and looking for the relevant WiFi interface. It should be listed under inet address.

However, you might still face some MQTT problems along the way. For that sake, it's useful to monitor all the inbound and outbound MQTT traffic.

Monitoring MQTT traffic

While Mosquitto provides this functionality out of the box using mosuitto_sub, for the more GUI-oriented people out there a client with a graphical interface might be easier to use. MQTTfx is a great tool that we used extensively throughout work on this project, and we recommend it from the bottom of our hearts. Thank you Jens Deters for this awesome tool!

Step 6: Pushbullet

Pushbullet is a push notification service. It allows you to subscribe your device to the service, and then pushed notifications to it based on quite a few possible integrations. We will use it to notify our device when one of the things at home was left on or open, and add a link to the dashboard so we can close or turn off the things we forgot to take care of before leaving the house.

Sign-Up & Configuration

  1. Sign up for a Pushbullet account in here using your Google account.
  2. Download the Pushbullet Android app from here.
  3. After logging into Pusbullet, click here and add your device using the button to the left.
  4. Then go here and select Create Access Token. Make note of this token, we'll need it in the next step.
  5. Go to Node-RED, and click the Send Push Notification node.
  6. In the sidebar (see picture) select "PushBullet Config", and then the pencil icon.
  7. Add the Access Token from step 4 into the "API Key" field.
  8. You should now be able to get push notifications on your phone.

Step 7: Arduino IDE

We use ESP8266 boards in this tutorial to control the various hardware we use. In order to upload our software to the boards, we'll need to flash them using a USB cable. The process is very simple: You connect the board to your computer, and then press a button. However, to get there, we'll need to do some preliminary setup.

Installation & Configuration

  1. Follow the guide here to install Arduino IDE.
  2. Follow the guide here to install the relevant "drivers" for the ESP8266 boards to your Arduino IDE.
  3. Make sure you're using a proper USB cable (not a power one, a data one) when uploading the sketches (the .ino files) to your boards.

Uploading sketches to boards

In the next steps - which will deal with connecting the hardware to our existing software interface - we will just say "upload the sketch to the board". In order to keep each of the following steps more about the hardware and less about the software, we're detailing the upload flow one time in here:

  1. Connect the board to your computer using the USB cable.
  2. Open the Arudiono IDE.
  3. Open the sketch you downloaded for the relevant step.
  4. In the "Tools" Menu, select the relevant board under the "Board" option.
  5. In the same menu, make sure the "Port" option selects the port that your board is connected to. it should do so by default, but if not just ensure that it does. If you're not sure which port on your computer is which, see the next step.
  6. Upload the sketch to the board by clicking the arrow button in the top right of the screen (right next to the checkmark icon). This will compile and attempt to upload the sketch to the board.
  7. If the following step failed, try selecting another port or another board in the tools menu.
  8. If you're still stuck, try taking a look at this Quora answer for follow-up steps.

Step 8: The Dashboard

The image above shows how the eventual dashboard will look like. Note the switches? They activate various pieces of hardware we'll set up in the next steps. The LEDs are status indicators that change when a sensor sensed some sort of change, as well as when we flip the switches.

Step 9: Light Sensor

This light sensor will enable you to tell whether you left the light on or off in one of the rooms in your house. When properly encased in a box and put close to the light, it can be no larger than two matchboxes stuck together.

Assmebly + Configuration

  1. Wire the circuit according to the included Fritzing schematic.
  2. Open the sketch, and change the following variables:
    • mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)
    • ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to
    • password - The password of said WiFi network
  3. Upload the included sketch to your board.
  4. Test it out on the dashboard!

Dashboard
Look at the "Light" tab's LED - it will indicate whether the light is turned on or off.

Step 10: Smart Outlet Activator

The Smart Outlet takes a regular power strip (with a decent length extension cord) and transforms it into a Smart Object - namely, a WiFi-enabled relay takes care of switching it on and off with the click of a button from the Node-RED dashboard. That way, if you forgot to turn off something that is plugged into the outlet, you will be able to turn it off manually!

Assembly + Configuration

  1. Cut the power cord in the middle, and strip the wires.
  2. Insert the stripped wires in the screw terminal according to the Fritzing Schematic.
  3. Open the sketch, and change the following variables:
  4. mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)
  5. ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to

  6. password - The password of said WiFi network

  7. Upload the sketch to the board.
  8. Connect the relay shield to the board.
  9. Assemble the circuit according to the Fritzing schema.
  10. Test it out on the dashboard!

Bonus points - Casing

  1. If you can, laser-cut the casing using the SmartOutletCasing image attached. If low on laser cutters, take a cardboard box, paste the image on one side of it, and cut the pieces out.
  2. Cut two holes in the side of the box, and slide in the power strip like in the attached image.
  3. Tie off the ends of the strip inside the box, to ensure the circuit will not get pulled through the holes.

Dashboard

Look at the "Smart Outlet" tab's LED - it will indicate whether the Smart Outlet is turned on or off. In addition, flick the switch on and off for fun and profit!

Step 11: Door Activator

This nice mechanism twists a key back and forth, enabling us to lock and unlock a door. Specifically, if you left your door unlocked when you left your home, you can lock it remotely! :)

Assembly + Configuration

  1. Open the sketch, and change the following variables:

  2. mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)

  3. ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to

  4. password - The password of said WiFi network

  5. Upload the sketch to the ESP8266 board.
  6. Assemble the circuit according to the schematic. Note that we used an external power source to control the (relatively strong) DC motor. This required an L298-N HBridge and the external power source. We did not require any soldering since both the female barrel jack and the HBridge had nice screw terminals we could use - we stripped one end of a few jumper cables for the sake of those connections. May they rest in peace.
  7. Test it out on the dashboard!

Bonus Points - Casing

We used an existing design by Jack Lew. If you have access to a 3D printer, it's an awesome case you can stick on your door and fasten with bolts or hot-glue.

Dashboard
Look at the "Door" tab's LED - it will indicate whether the door is open or closed. In addition, flick the switch on and off for fun and profit!

Step 12: Window Sensor

Don't let the cat get out! This sensor uses a Reed Relay to check whether a window is open or closed. Note that we chose a window just for the sake of the example - it can be used for many other things, including checking whether a door is open or not, including house, room and fridge doors.

Assembly & Configuration

  1. Assemble the circuit according to the Fritzing schematic above.
  2. Open the sketch, and change the following variables:

  3. mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)

  4. ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to

  5. password - The password of said WiFi network

  6. Upload your sketch to the board.
  7. Attach one part of the Reed Relay to the window sill, and another one to the window itself (or whatever opening you decided to attach the sensor to).
  8. Test out on the dashboard!

Dashboard

Look at the "Window" tab's LED - it will indicate whether the window is open or closed.

Step 13: Space Heater Sensor

Leaving a space heater on is a guaranteed fire hazard! Stay safe and monitor your space heater from afar, using this circuit. Specifically, the heat sensor on the circuit monitors heat for a prolonged period of time - hard-coded to 5 minutes for a sane default - and it's still steaming after that period of time, flips the LED in the dashboard. This is done to prevent dissipating heat (like after you turned the space heater off) from turning on the LED in accident.

Assembly & Configuration

  1. Assemble the circuit according to the attached Fritzing schematic.
  2. Open the sketch, and change the following variables:

  3. mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)

  4. ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to

  5. password - The password of said WiFi network

  6. Upload the attached sketch to your board.
  7. Put near a space heater, wait for 5 minutes and check the dashboard!

Dashboard

Look at the "Space Heater" tab's LED - it will indicate whether the space heater is turned on or off.

Step 14: Switch Press Activator

This is a very simple Servo engine that can flip a physical switch on or off (a light switch, a water boiler switch, a power strip switch etc.). If you left one of the switch-controlled items in your house on - for example a light or a water boiler - you can switch it off remotely.

Assembly & Configuration

  1. Open the sketch, and change the following variables:
  2. mqtt_server - Your computer's local IP address (as its running Mosquitto, the MQTT broker)
  3. ssid - The name of the WiFi network your computer is connected to, and you'd like your board to be connected to
  4. password - The password of said WiFi network
  5. Upload the sketch to your board.
  6. Assemble the circuit according to the Fritzing schematic.
  7. Attach the Servo to the relevant switch using hotglue or a proper casing you made yourself. Send us a picture if you made one!
  8. Test out the dashboard!

Dashboard

Look at the "Switch Press" tab's LED - it will indicate whether the switch press is turned on or off. In addition, flick the switch on and off for fun and profit!