Open Sesame

by univership in Circuits > Remote Control

5523 Views, 31 Favorites, 0 Comments

Open Sesame

Open Sesame (Univership)
main_photo.JPG
interface.png
Operation_principle.png

The user flashes a QR Code (or accesses a website) to ring a door bell in a remote location.

++++++

Operation Principle:

When the user accesses the website, an ajax call is performed which changes the contents of a .txt file to "on". The Raspberry Pi checks this file every second. If it detects a change, it plays the sound and changes the contents of the .txt file to "off". The web interface then updates to tell the user that the bell has rung.

Created @ ICAH

Get Your Material.

BOM.JPG

You will need a:

- Raspberry Pi

- wifi dongle (e.g. Edimax EW-7811Un)

- speakers

- a sheet of mdf (4mm)

- A web hosting service (e.g. GoDaddy, Hostgator, etc)

- A laser cutter

Web File Upload

interface.png

Create a directory on your web server & add the files in the folder "web.zip". You can use an FTP client (e.g. Filezilla).

When visiting http://yourwebsite/directory you should see the interface.

++++++

The folder web.zip contains 6 files:

- index.html : the main entry point. contains the DOM structure

- style.css: the css

- status.txt: a text file storing the values "on" or "off" depending on whether the sound has been played

- ajax.php: php scripts to check the status.txt file

- script.js: js scripts to perform ajax calls

- doorbell.svg: icon to display on the screen

Downloads

Configure the Wifi on the Raspberry Pi

To configure the wifi:

1. Boot the Raspberry Pi and run: sudo nano etc/network/interfaces

Edit the file so that it looks like:

etc/network/interfaces 
auto lo
iface lo inet loopback iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf 
iface default inet dhcp

2. Run the command: sudo nano etc/wpa_suppilicant/wpa_suppilicant.conf

- If you are on a WPA-EAP network, edit the file so that it looks like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev<br>update_config=1</p><p>network {ssid=""     
key_mgmt=WPA-EAP     
password=""     
identity="" }

- If you are on a WPA-PSK network, edit the file so that it looks like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev<br>update_config=1</p><p>network {ssid=""      
key_mgmt=WPA-PSK
psk=""}

Add the Files to the Raspberry Pi

python.png

You can clone all files to the raspberry pi from my github by using:

git clone https://github.com/gcool-info/connected-doorbell.git

(if you haven't installed git on your Pi, you can run: sudo apt-get install git)


Otherwise, just copy the files main.py, launcher.sh, audio.mp3 in some directory on your Pi.

Make sure to change the lines:

response = http_request(http://yourURL/status.txt")

and

http_request("http://yourURM/ajax.php?cmd=turn_off")

so that they point to your URL.


Downloads

Run Program on Pi Boot

To run the program immediately when the Pi boots up, we use a crontab. A crontab is a background (daemon) process that lets you execute scripts at specific times. It's essential to Python and Raspberry Pi. To do this, open the file launcher.sh

nano connected-doorbell/pi/launcher.sh

Make sure that the line

cd home/pi/connected-doorbell/pi

is pointing to the directory containing your main.py program.

Then, follow this excellent tutorial:

https://www.instructables.com/id/Raspberry-Pi-Launc...

(starting from step 2)

Create the Poster

poster.png

Generate a QR code for your url by visiting this website: http://www.qrstuff.com/

Open the poster.svg file & edit it with your favorite vector editing software (e.g. illustrator, inkscape, etc)

Downloads

Laser Cut and Assemble!

laser_cutter.JPG
assembly.JPG
topview.JPG

Laser cut the house & the case for the raspberry pi.

Done!