SmartHome base on web-server with Raspberry Pi

SmartHome base on web-server with Raspberry Pi

My project is about how to make a smart home with IoT.

  • 16,305 views
  • 0 comments
  • 24 respects

Components and supplies

Apps and online services

Ide web
Arduino IDE
XAMPP
Adobe Dreamwe

About this project

Have you ever questioned yourself: "Can we control our house from anywhere"? So now, I say "We totally can!" My project is about how to make a smart home with IoT. I decided to make this project because I liked it.

Description

Our simple idea is about a smart home system with a Raspberry Pi (used as a web server), some Arduino (used as a microcontroller to collect values about switch of lamps, switch of fans, temperature, pH, etc.), and a website to take on the role of a GUI.

Step 1: Part

Hardware:

  • Raspberry Pi (I choose RP3 model B)
  • Arduino (I choose Arduino Uno).
  • ESP8266v7
  • Some sensors and some switches or buttons.
  • Some devices such as: lights, fans, etc.

Software:

  • Arduino IDE
  • XAMPP
  • Adobe DreamWeaver.

Step 2: Web-server setup on Raspberry Pi

First install the apache2 package by typing the following command into the terminal:

sudo apt-get install apache2 -y

By default, Apache puts a test HTML file in the web folder. This default web page is served when you browse to http://localhost/ on the Pi itself, or http://192.168.1.10 (whatever the Pi's IP address is) from another computer on the network. To find the Pi's IP address, type hostname -I at the command line (or read more about finding your IP address).

Browse to the default web page either on the Pi or from another computer on the network and you should see the following:

CHANGING THE DEFAULT WEB PAGE

This default web page is just a HTML file on the file-system. It is located at /var/www/html/index.html.

Note: The directory was /var/www in Raspbian Wheezy but is now /var/www/html in Raspbian Jessie.

Navigate to this directory in the terminal and have a look at what's inside:

cd /var/www/html ls -al

This will show you:

total 12 drwxr-xr-x  2 root root 4096 Jan  8 01:29 . drwxr-xr-x 12 root root 4096 Jan  8 01:28 .. -rw-r--r--  1 root root  177 Jan  8 01:29 index.html

This shows that there is one file in /var/www/html/ called index.html. The . refers to the directory itself /var/www/html and the .. refers to the parent directory /www/.

WHAT THE COLUMNS MEAN

  • The permissions of the file or directory
  • The number of files in the directory (or 1 if it's a file).
  • The user which owns the file or directory
  • The group which owns the file or directory
  • The file size
  • The last modification date & time

As you can see, by default the html directory and index.html file are both owned by the root user. In order to edit the file, you must gain root permissions. Change the owner to your own user with sudo chown pi: index.html before editing.

Try editing this file and refreshing the browser to see the web page change.

YOUR OWN WEBSITE

If you know HTML you can put your own HTML files and other assets in this directory and serve them as a website on your local network.

ADDITIONAL - INSTALL PHP

To allow your Apache server to process PHP files, you'll need to install PHP5 and the PHP5 module for Apache. Type the following command to install these:

sudo apt-get install php5 libapache2-mod-php5 -y

Now remove the index.html file:

sudo rm index.html

Create the file index.php:

sudo leafpad index.php

Note: Leafpad is a graphical editor. Alternatively, use nano if you're restricted to the command line.

Put some PHP content in it:

<?php echo "hello world"; ?>

Now save and refresh your browser. You should see "hello world". This is not dynamic but still served by PHP. Try something dynamic:

<?php echo date('Y-m-d H:i:s'); ?>

Or show your PHP info:

<?php phpinfo(); ?>

Step 3: Connect hardware

Step 4: Create a database, website

Make a website with Adobe DW by HTML, CSS, Javascript, PHP and MySQL.

Step 5: Setup ESP8266v7 with AT

Link (VN): http://mcu.banlinhkien.vn/threads/giao-tiep-voi-module-wifi-esp8266.4267/

Comments

IUHTeam

14495369 1740271346236513 8068836373865509226 n
Tuấn Nhân
  • 1 project
  • 4 followers
1926927 476927882494075 1114060999936139895 n
Trần Thành Đạt
  • 1 project
  • 5 followers

Additional contributors

Published on

November 14, 2016

Members who respect this project

Default25172 1387077713667 6006013 nDefaultPhotoDefault14520513 10154603590833023 195770730938107087 nDefaultDefault

and 16 others

Project replicated by

Bulentk
See similar projects
you might like

Similar projects you might like

Arduino + Raspberry Pi + Ubidots Made Easy

Project tutorial by David Escobar

  • 13,119 views
  • 4 comments
  • 38 respects

Raspberry Pi - Powered Candy Dispenser

Project tutorial by Arduino “having11” Guy

  • 5,283 views
  • 1 comment
  • 12 respects

Alexa Controlled LEDs Through Raspberry Pi

Project tutorial by vincent wong

  • 5,280 views
  • 5 comments
  • 23 respects

Interfacing Arduino with Raspberry Pi

by Sankar Cheppali

  • 85,001 views
  • 9 comments
  • 25 respects

Web-Controlled LED Animations with Raspberry Pi and Arduino

Project tutorial by Bruno Portaluri

  • 12,069 views
  • 15 comments
  • 44 respects
Add projectSign up / Login