loading

When I return to my home I make ever a cup of tea, And when I go to my home I do not see the key of my door, because there isn't light.
I'm really determined to remedy the situation! :-)

I will use a Raspberry Pi Zero, connected to the internet, and a Cayenne app for Smartphone an Tablet. I will connect the Raspberry Pi to the relay shield, and to the PIR sensor. When the PIR sensor read the presence of a person out of my door, Cayenne switch on the light outside the door, and also switch on the Kettle in my kitchen.

Cayenne also send me an email informing me that someone has arrived home.

Now I see the keys, and I have a hot cup of tea whe I return to my home.

Step 1: Buy the Materials

For this project I've used:

Step 2: Install Cayenne on You Raspberry Pi

Go to Cayenne site and Sign Up.

After download the file and install the Cayenne system on your Raspberry Pi.

Cayenne IoT Simple

Download the app on your Smartphone or tablet by using the follows link

Cayenne on Apple Store

Cayenne on Play Store

Install on your Raspberry Pi the Raspbian system. For this step download NOOBS from Raspberripi.org: https://www.raspberrypi.org/downloads/

Copy the package on your SD, and start the Raspbian installation. For the raspbian installation I recomend to use a HDMI screen, a USB mouse and a USB keyboard.

Do you need a Raspberry Pi?

After this, connect your Raspberry at your LAN by cable. Then open your Cayenne app and install the library on your device. The next step.

After this, connect your Raspberry at your LAN by cable. Then open your Cayenne app and install the library on your device.

OR

Install manually Cayenne on your Raspberry Pi by using Terminal of Raspberry Pi:

wget https://cayenne.mydevices.com/dl/rpi_b8w8pn82i9.sh

sudo bash rpi_b8w8pn82i9.sh -v

Please be patient 10 minute to ultimate the installation process. After this reboot your Raspberry.

Step 3: Connect the Sensor and Relays

Now you can connect the pir sensor and the relay.

You can use the Raspberry for give the power to the components, but the better is use a breadboard like the power supply for the components.

See the fritzing project.

Step 4: Make Your Dashboard

By using Computer you can see your device on: https://cayenne.mydevices.com/ like in photo.

Or use your tablet or smartphone with app.

Create your Dashboard.

Add twoRelay Switch. The Relay number 1 is on the channel No. 27, the second relay is on the channel No. 18.

Also add one PIR sensor. The channel of PIR sensor is No. 17.

Now you can try the relay and the pir. Try to touch the relay icon. Do you hear "click"? If you hear this sound, the relay is correctly connected to the Raspberry Pi.

Try also the PIR sensor. When the sensor "read" a movement, on the dashboard you can see number 1. Instead if there isn't movement in front of sensor, you can see number 0 in the dashboard.

Step 5: Setup Your PIR Sensor

The PIR sensor have two potentiometers (see figure). One of this is for the time, the other is for sensitivity. When you modify the position of potentiometer, you modify the time of signal goes "on", and when you modify the potentiometer for the sensitivity, you modify the sensibility of sensor. With a LOW sensitivity, the sensor detect only the movements very near, with a HIGH sensitivity, the sensor detect also a movement that are far away of it.

This is very important, because I want switch on the light and the kettle, only when I or somebody of my family is very near the door.
For this reason, I've adjusted the sensitivity sensor to minimum value, and the time medium value, like 10 seconds.

Step 6: Add the Trig

If you have mounted the hardware, installed the Cayenne, and tested the relay on Cayenne with the widget button, and the sensor pin with I/O widget sensor, it's the moment for the TRIGS.

The trig are rules that trigger an action when it happens another.

This is the classic IF construct. IF <--> ELSE

Open Trig and select IF. Inside IF select your platform, and also select the pir sensor.

Then select On value, and after click on then. In this position select Relay 1 or 2, and click ON.

Follow this step also for the second relay.

After this step, add an other rule. When the PIR goes OFF, switch OFF the light.

Open Trig and select IF. Inside IF select your platform, and also select the pir sensor.

Then select OFF value, and after click on then. In this position select Relay connected to the light, and click OFF.

You can also add a alert. When the PIR sensor goes ON, Cayenne send an email to an address that you specify in the app. Try to setup the email alert!

Step 7: Connect the Light and the Kettle

For the light I use a 12 V panel's led light.
This light is very smart, because is little, powerful and very cheap. There are 48 smd led on surface, and some resistences. The panel operates at 12 volts. See the image for the relay connections. For this panel I use a 12 V power supply.

The Relay

The relay have three connections for the output. NO-COM-NC. NO is like Normally Open. COM is like common. NC is like Normali Closed. When the relay is OFF, the pin COM and the pin Normally Open are disconnected. Instead, when the relay is OFF the pin COM and the pin Normally Closed are connected. When the relay goes to ON, the scenario changes. COM and NO are connected, and COM and NC are disconnected.

About This Instructable

2,677views

30favorites

License:

More by masteruan:Meteo Node IoT Smart Meteo Station O-Zone: DIY Bluetooth Battery Lamp Omega Onion2 OLED Screen Show IP and LAN Name 
Add instructable to: