an-wemo-leading

This is a tutorial for building a heat-activated switch for a Wi-Fi outlet. In this demo, we will create a switch that starts charging your computer when you sit in front of it. Other project ideas include using the thermal switch to turn on a fan when you sit in front of it, a Lepton-based thermostat that turns on a heater when water pipes get too cold, or activate a horn that sounds when a person walks by.

What You Need

  1. Raspberry Pi
  2. FLIR Lepton
  3. Belkin WeMo Switch
  4. Wireless Router
  5. Ouimeaux Open Source Library

Raspberry Pi


Belkin WeMo Switch


Router

Setup for the Belkin WeMo Switch

Follow the instructions on this website.
If you have a basic knowledge of how to set up a wifi network, this step won’t be too difficult.

Setup for the Raspberry Pi

Step 0:

Make sure you have the latest version of Python-dev by running:

sudo apt-get install python-dev

Install Python

Step 1:

Run the following command to install the Ouimeaux library:

 sudo easy_install ouimeaux

Install Ouimeaux Library

Step 2:

After the previous command has finished, ensure that you can find your WeMo device by running:

wemo list

You should get a return of something along the lines of:

Switch: My Switch

WeMo List

If you do not, you may be on the wrong network. Make sure your Raspberry Pi is connected to the same router as the WeMo.

Step 3:

Attach a Lepton to your Raspberry Pi’s breadboard. If you don’t know how to successfully set up a Lepton with Raspberry Pi, I encourage you to look at this tutorial.

Lepton Breadboard

Running the Program

Step 1:

Download the latest version of the code by running:

git clone https://github.com/Chilliam/LeptonModule-Wemo/

Step 2:

In the same Terminal window, navigate into the video folder by typing:

cd /LeptonModule-Wemo/software/raspberrypi_video

Step 3:

Compile the project by typing:

make

Steps to compile the project.

Step 4:

Run the project using the following command:

./raspberrypi_video

Running the Program

Usage

Once you have your setup running, two things should happen. In one window, you will see the image drawn from the Lepton on the screen. Simultaneously, the terminal window will begin outputting a value every second.

Under the incoming Lepton video, there is a button to force a flat field correction (Perform FFC) and a small text box displaying “Presence Detected” or “No Presence Detected.” This indicates if it detects a person in the frame or not.

The terminal window will output a value every second. This value shows the average 16 pixels around the hottest pixel detected in the frame. Whenever this value goes over the default threshold of 8000, the program will trigger the WeMo switch, toggling it to the on position.

With this program running, you can now set your WeMo switch to toggle any device you plug into it. Here’s our laptop charger powering on after the Lepton has detected a warm human body:

Laptop charging