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
- Raspberry Pi
- FLIR Lepton
- Belkin WeMo Switch
- Wireless Router
- Ouimeaux Open Source Library
Belkin WeMo Switch
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
Make sure you have the latest version of Python-dev by running:
sudo apt-get install python-dev
Run the following command to install the Ouimeaux library:
sudo easy_install ouimeaux
After the previous command has finished, ensure that you can find your WeMo device by running:
You should get a return of something along the lines of:
Switch: My Switch
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.
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.
Running the Program
Download the latest version of the code by running:
git clone https://github.com/Chilliam/LeptonModule-Wemo/
In the same Terminal window, navigate into the video folder by typing:
Compile the project by typing:
Run the project using the following command:
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: