The "Walk-in Talkin' Closet" is a tool that will help you in the mornings by taking events from your Google Calendar then tell you the weather at that event using OpenWeather API.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather the Materials Needed
1) Raspberry Pi - This is needed because the programs run on this mini-computer. Any model should work - the model we used was this.
2) Speakers - This is needed to tell the user the info when they trigger the motion sensor. Again, any speakers that have a headphone jack should work, but we used this.
3) Monitor - This is needed to edit the code on the Raspberry Pi. Anything will work.
4) Mouse - Needed to use the Raspberry Pi.
5) Keyboard - Needed to use the Raspberry Pi.
6) Motion Sensor - THIS IS A VERY SPECIFIC PART OF THIS PROJECT. PLEASE GET THIS.
7) Python and pip (should be on your Raspberry Pi already).
8) You will need a DVB dongle and antenna to connect wirelessly to the motion sensor on your Raspberry Pi. We recommend this.
9) You will need a power outlet or a way to get a power outlet into your closet. This is to plug in the Raspberry Pi.
Step 2: Set Up Google API (Optional)
- Go here, select "Create a Project," and click "Continue"
- Click "Go to Credentials"
- On the "Add Credentials to Project" page, scroll down and click "Cancel"
- Go to the "OAuth consent screen"
- While there, select an email address, enter the product name, and press "save"
- Go back to the "Credentials" tab, click on "Create credentials," and select "OAuth Client ID"
- Select "Other" and type in your project name ("Talking Closet") and click on "Create."
- Press "OK" in the dialog that pops up.
- Click the download button next to the client ID.
- After downloading it, rename it to "client_secret.json"
Step 3: Download the Required Files
In the Terminal:
Connect your monitor and keyboard to your raspberry pi and start it up. Log in, and type the following in the terminal to update your packages (This could take 30-60 min):
sudo apt-get update sudo apt-get upgrade
Now, install the google API, as well as the text to speech and audio packages.
sudo pip install --upgrade google-api-python-client sudo apt-get install libttspico-utils sudo apt-get install alsa-utils sudo apt-get install mplayer
and now edit your modules file by typing:
sudo nano /etc/modules
and add the following to the file, if it isn't there already:
Finally, change the default audio output to the headphone jack:
sudo amixer cset numid=3 1
Cloning with Git:
Install git if you haven't already:
sudo apt-get install git
Now clone the repository for this project by typing the following under pi/home:
sudo git clone https://github.com/MVHSiot/MotionToSpeaker.git
This repository contains code we wrote that extracts data from the user's Google Calendar and reports them: time, location, weather, and temperature. If you would like to customize it, edit main.py.
Copy the .json file you downloaded in step 2 into this same directory and replace the already-existing client_secret.json, or keep the client_secret.json if you would like to use ours (and you skipped step 2).
Step 4: Setting Up Motion Sensor
First you will need to install the rtl_sdr program on your Pi under pi/home directory. This program reads the radio waves sent by the motion sensor. Under home/pi, you will need to type in:
git clone git://git.osmocom.org/rtl-sdr.git
Then, the only instructions from the link above you need to follow are the ones under "Building the Software", shown above. Before, install the following libraries:
sudo apt-get install libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr
Under "Building the Software", either use cmake or autotools to build the software.
Then also under pi/home directory install rtl_433. This is the program that decodes the radio waves. Follow the instructions under "Installation Instructions", shown above as well.
You will run all following commands from this folder. Move all files from our Git repository into this folder. It is essential that all files from our Git repository are directly inside the rtl_433 folder. Do not keep the folder from our Git repository, just move the files from that folder into the rtl_433 folder.
Step 5: Scheduling Program to Run Every Day
On your Pi's command prompt, type in
Make an empty line just above the last #. Onto this, type in the minute that you would like the program to run, followed by the hour in 24 hour time, followed by 3 asterisks followed by the path to the rtl_433 folder followed by the command rtl_433 -a -t|sudo python main.py. For example, it should look like:
0 6 * * * pi/home/rtl_433 -a -t|sudo python main.py
This will make the Pi start scanning the area for motion at 6 am every day.
Step 6: Putting Everything Together
- Plug power supply into Raspberry Pi.
- Connect RPi to monitor
- Optional because the device will not need a monitor once it is all set up; it will run automatically at the time that you set. Connecting a monitor, though, is good for debugging.
- Connect Speakers to RPi
- If using the speakers that we used, be sure to plug in both the audio jack and usb - one provides the audio input, while the other provides the power.
- Connect antennae for the motion sensor to the RPi
- This makes it so RPi can communicate with the motion sensor wirelessly
- Set up your motion sensor at the doorway of your walk-in closet
- Enables detection of motion when you walk into your closet
Leave your Pi on, and expect to hear your schedule and the weather there upon waking up tomorrow!
Participated in the
IoT Builders Contest