Ever thought to control your home over WiFi? Here’s a tutorial through which you can control across many devices like Laptops, Smartphones, tablets anything.Here i am presenting a tutorial to do this with simple steps. I am using a BeagleBone Black as my main board for controlling. I have Linux installed it. The version is Debian. To know about beaglebone black click here. BeagleBone Black is a low-cost, open source, community-supported development platform for ARM® Cortex™-A8 processor developers and hobbyists. It is powered by Sitara™ AM335x ARM Cortex-A8 processor from Texas Instruments. Boots Linux in under 10-seconds and get started on Sitara™ AM335x processor development in less than 5 minutes with just a single USB cable. BeagleBone Black ships with the Debian GNU/Linux™ in onboard FLASH to start evaluation and development. Many other Linux distributions and operating systems are also supported on BeagleBone Black including:
To start first connect your BeagleBone to your Linux host PC. On PC open terminal. Login to your BeagleBone via its IP address as follows. For my case address of my beaglebone is 192.168.7.2 so i am writting following code Later on you need to install some plugins for php, https server. opkg update opkg install lighttpd lighttpd-module-fastcgi opkg install php php-cgi php-cli Then you need to configure this module. Open the congfig file and remove comments in this portion. In the server.modules section Remove ‘#’ before “mod_fastcgi”,
Also remove # in the fast cgi section in that file.
So it should looks like this:
fastcgi.server=(".php"=> ( "localhost" => ( "socket" => "/tmp/php.socket", "bin-path" => "/usr/bin/php-cgi" ) ) )
After configuring it restart this moudule.
systemctl restart lighttpd &
Here for demo is have 4 buttons to turn on and off two devices. So i have created 4 python files which i will call from the browser when the user presses the button. You can use vi editor for this.Create and write first file name it as led0_on.py
Then in the directory /wwww/pages/ create a PHP webpage using below code. I named this file as Sample.php
Save it by pressing :wq Go to your browser any type your beaglebone ip address and PHP file name. You will see screen as below
This was procedure to control user leds using that. But to control our appliances in realtime, we need to do the same task on GIPO pins. You need to export the pins which you want use.It has two headers P8 and P9
You can see that pin 1 in the P9 header is Ground. LED’s negative lead is to be connected there. The positive lead is to be attached to pin 12 which, is attached to gpio1_28 as shown in the figure above. The gpio pins are in banks of 32 each, so to find the gpio number to use on the BeagleBone, use 1*32+28=60.
Later on you can connect a relay board and then your all 230 V appliances like TV,Lights ,fans etc.. Here a schematic for the relays is shown. Here 3 relays are driven by ULN2803 IC. The GPIO pins of beaglebone should be connected to the inputs of ULN2803.
With this you can turn on or off any device. But if you want to control brightness of light or speed of fan then you need to use a triac based Dimmer module. You can connect 4 gpio pins to dimmer module to get 16 stages of control sample dimmer module from Sunrom Technologies is shown here: http://sunrom.com/p/dimmer-module-digital-control-16-steps Thats it. Done all. 🙂
I am thankful to “Martin’s blog” for Configuration and installation part of PHP and Httpd. I respect his efforts and give credits to his article http://www.berriman.co.uk/beaglebone-black-bbb-simple-web-io/