Local web server is using for php page, which receives command from Web Browser (or from Phone Apps), then control GPIO.
1. Make Web server & php page
2. Make simple circuit
3. Control GPIO from Web Browser
4. Control GPIO from Phone Apps (Android)
1. Make Web server & php page
1.1. Install WiringPI
WiringPI is used to control GPIO
$ sudo apt-get install git-core
$ sudo apt-get update
$ sudo apt-get upgrade
$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ git pull origin
$ cd wiringPi
$ ./build
$ sudo apt-get update
$ sudo apt-get upgrade
$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ git pull origin
$ cd wiringPi
$ ./build
Checking after installation WiringPI
$ gpio mode 0 out
->If nothing special appears, everything's fine.Sample command, write and read pin 1
$ gpio write 1 0
$ gpio read 1
$ gpio read 1
1.2. Install web server:
Install Apache HTTP server and PHP5 extension
$ sudo apt-get install apache2 php5 libapache2-mod-php5
If everything is OK, local web will display in Web Browser as following: in which: 192.168.1.71 is Raspberry IP address
the file page index.html is store in /var/www/html/
1.3. Make PHP page to interface GPIO
PHP page helps to receive command from Web Browser, then send control command GPIO to board through WiringPI (install in step 1.1)
Following is php code for ON/OFF GPIO7
PHP page code
<?php //engineer2you.blogspot.com //Getting and using values if (isset ( $_GET["pin"] )) { $pin = strip_tags ($_GET["pin"]); //test if value is a number if ( is_numeric($pin)) { //set the gpio's mode to output if($pin==70){ system("gpio mode 7 out"); //GPIO7 system("gpio write 7 0"); echo('finish pin7 = off'); } if($pin==71) { system("gpio mode 7 out"); //GPIO7 system("gpio write 7 1"); echo('finish pin7 = on'); } if($pin==80){ system("gpio mode 8 out"); //GPIO8 system("gpio write 8 0"); echo('finish pin8 = off'); } if($pin==81) { system("gpio mode 8 out"); //GPIO8 system("gpio write 8 1"); echo('finish pin8 = on'); } if($pin==90){ system("gpio mode 9 out"); //GPIO9 system("gpio write 9 0"); echo('finish pin9 = off'); } if($pin==91) { system("gpio mode 9 out"); //GPIO9 system("gpio write 9 1"); echo('finish pin9 = on'); } } else { echo ("fail, it's not number".$pin); } } //print fail if cannot use values else { echo ("fail"); } ?>
Complete php file for controlling GPIO7, GPIO8, GPIO9. Download from this link
2. Make simple circuit
Connect LEDs to GPIO7, GPIO8, GPIO9
3. Control GPIO from Web Browser
For example, to make GPIO7 off, put the address in Web Brower: http://192.168.1.71/io.php?pin=70
To make GPIO7 on, put http://192.168.1.71/io.php?pin=71
4. Control GPIO from Phone Apps (Android)
There is an Android Application can be used to send command to php page.
The App can be downloaded from link Google Play or search by keyword Data2Server
Following is setting for php address, pin:
can we send a feedback from raspberry pi to android app b using current sensor at output of bulb if bulb is on then current sensor give high signal to raspberry pi gpio pin and then raspberry sends feedback to android app
ReplyDeleteWe can do it. However, it will make system quiet complicated. So i don't make it.
DeleteI am trying to make this, If it will be done , I will share with you.
ReplyDeletewaiting for that :)
Deletereally appreciate that its working thank you.
ReplyDeletei have some question regarding homeautomation can you mail me
2492vishalsingh@gmail.com
Hi, we can discuss here in comment box, or go to discussion board in this blog. I love finding solution after discussion.
Deleteneed source code for android application..??
ReplyDeleteunfortunately we can't give you that. It's not complicate, just send command like "http://192.168.1.71/io.php?pin=71"
DeleteThis comment has been removed by the author.
ReplyDeleteMe too!
Delete
ReplyDeletePlease click on this post if you wanna paly with online casino.Thank you.
ทางเข้าจีคลับ
โกลเด้นสล็อต
Please click on this post if you wanna paly with online casino.Thank you.
ReplyDeleteบาคาร่า online
goldenslot
gclub online
Wow its a very good post. The information provided by you is really very good and helpful for me. Keep sharing good information.I bookmark your blog because I found very good information on your blog
ReplyDeleteดูหนังออนไลน์
bonjour.
ReplyDeleteJ'ai un raspberry Pi 3.
je n'arrive pas à installer git clone git://git.drogon.net/wiringPi.
A chaque fois, il me dit temps trop longue. donc erreur fatal.
Qui peut m'aider
Hi, I think we don't need install WiringPi. Probably, there is an app already installed in Raspberry Pi to control GPIO -> to check it, please test with command to see if exist or not:
Delete"$ gpio mode 0 out"
If no error after this command, you don't need to install "wiringPi"
how can i code make with python?
ReplyDeleteHi. Thanks for visit. Unfortunately, i didn't make it with Python.
DeleteGreat Article
ReplyDeleteInternet of Things Final Year Project
Final Year Project Centers in Chennai
I d like to add about 100 switches w leds// how can I expand this? also would like to make the switches wireless
ReplyDeleteif up to 100 switches with LEDs, you can use I2c or serial communication to another micro-controller (PIC, Atmega) to extend I/O
DeleteI am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. KVB Customer Care
ReplyDeleteI have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. How to spy a phone
ReplyDeleteThis is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. mobile phone security
ReplyDeleteThis is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work spy phone app
ReplyDeleteIt is truly irritating experience for any cell phone client to stay away from the gadget. Handy reparatur Kiel
ReplyDeleteThis is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. Whatsapp GB
ReplyDeleteYour blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. best iPhone 12 iPhone screen protector
ReplyDelete