Open the Gate, Wicket or Door With Your Smartphone and Raspberry PI

by pzygmunt in Circuits > Raspberry Pi

4772 Views, 54 Favorites, 0 Comments

Open the Gate, Wicket or Door With Your Smartphone and Raspberry PI

projectimage.png
RASPBERRY PI & YwRobot Relay module & SUPLA

This time I would like to demonstrate how to change your Smartphone into a „remote controller” to open the gate/wicket or door using Raspberry PI.

We will need:

  1. Smartphone with Android (3.1.x version or higher) or an iPhone with iOS (6.1 or higher).
  2. Any Raspberry PI, I have used B+ version.
  3. SD card 3GB (or more).
  4. Relay module. I have used „YwRobot 4 relay”.
  5. Connecting wiring.
  6. Bread board.
  7. Three (3) BC547 transistors.

Let’s start.

Hook Up the Relay Module to Raspberry

schemat.png
Raspberry-Pi-GPIO-pinouts.png
polaczenia-przewody.png
polaczenia.png

At the beginning we need to hook up the relay module to Raspberry. The software used by me is default set to operate 3 relays, however, if we do not have such, we can also use one and leave the other out. The relays can be connected to electric locks opening wickets/doors or to the gate controller. Relays functions as well as each relay operation time can be later changed at cloud.supla.org. Below you can find the scheme on how to connect Raspberry PI with the relay module.

Create Supla Account

In order to have it all working correctly, we need to start a free account on https://cloud.supla.org/account/create

When we sign in and logon, we need to read location settings which are required in Step 3 as well as access identifier settings required in Step4 below.

Prepare SD Card

diskimager1a_en.png
diskimager2a_en.png
wysuwanie karty_en.png
boot1a_en.png
cloudnotepad_en.png
cloud_en.png

Now we need to prepare the SD card (I have been working on a Windows 7 based PC).

  • Download and unzip SD card image https://www.supla.org/download/rbpiext01.zip
  • Insert the SD card into your computer’s card reader.
  • Using Administrator account run the DiskImager program. You can download it from: http://sourceforge.net/projects/win32diskimager/
  • Point the downloaded and unzipped file in the „File image” field and select the device (the disc with SD card) and click “Save”
  • We can now safely remove the card with the „Safely remove hardware and eject media” tool, remove it and place it back again in the reader
  • We need to open the disc labeled on the SD card as „boot” partition
  • Open the location.txt file and enter the location data read from https://cloud.supla.org. The most recent connection status can be read in the file last_state.txt, e.g. an invalid password’s information will be saved here
  • We can now safely remove the card with the „Safely remove hardware and eject media” tool, remove it and place in the Raspberry PI SD card slot
  • Connect Raspberry PI to LAN and turn the device on (you can also reconfigure it to connect with network via WiFi)
  • Raspberry should be included on the list of devices in cloud.supla.org when properly launched

Smartphone Configuration

ustawienia-smartfona_en.png
czujnik.png

First of all, you need to download the application on your phone from AppStore or Google Play. Application is free of charge.

Install and start the application. Right after you start it, a window will appear, where all the settings from cloud.supla.org must be entered.

Ready!
Further information:

  • Configuration: /etc/supla-dev/supla.cfg
  • Relay: GPIO27, GPIO22, GPIO17
  • Ports of entry (e.g. opening sensor): GPIO24, GPIO23, GPIO18.

When setting each port in a high status, we can inform the system, whether the doors/wicket/gate are locked. Temperature sensor 1-WIRE: DS18B20

When you connect the sensor, you only need to restart the Raspberry to have it detected and visible on your Smartphone. You can parallel connect a few temperature sensors at once.