Embedded Electronics Tutorials, Coding and lot more

Control your home over WiFi

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. Screenshot from 2014-10-31 09:35:20 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-specs 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:

  • Ubuntu
  • Android
  • Fedora

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 Screenshot from 2014-10-31 09:18:42 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

Screenshot from 2014-10-31 09:33:20

Screenshot from 2014-10-31 09:33:59 test Then similarly create 3 files as

led0_off.py
led1_on.py
led1_off.py

Then in the directory /wwww/pages/ create a PHP webpage using below code. I named this file as Sample.php

Screenshot from 2014-10-31 09:32:48
Screenshot from 2014-10-31 09:31:47

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

Screenshot from 2014-10-31 09:35:20

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

article-2013september-beaglebone-black-brings-arduino-fig3

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.

HeaderP9

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.

relay

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/

Sharing is caring

1 Comment

  1. CherrieKLeconey

    You actually make it seem so easy together with your presentation but I in finding this topic to
    be actually one thing that I believe I would never understand.
    It kind of feels too complex and extremely huge for me.
    I’m taking a look forward on your subsequent publish,
    I’ll try to get the cling of it!

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2023 EMBEDDED TWEAKS

Theme by Anders NorenUp ↑

Follow Me

Get the latest posts right delivered in you mailbox

%d bloggers like this: