LaFonera Hardware Controlling AC-Loads via webinterface

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 00:59, 5 August 2007 (edit)
Labeey (Talk | contribs)
m
← Previous diff
Current revision (22:34, 22 November 2011) (edit) (undo)
Sboger (Talk | contribs)
(A Different Method)
 
(33 intermediate revisions not shown.)
Line 1: Line 1:
-<br>+[[Category:LaFonera_Hardware_(en)]]
-<br>+You are here: '''[[Main_Page|DD-WRT wiki mainpage]] / [[LaFonera_(en)|LaFonera]] / [[:Category:LaFonera_Hardware_(en)|Hardware]] / Controlling AC-loads via web-interface'''
-'''+
-== Turn a switch ON/OFF using WEB INTERFACE ==+
-'''+
-<br>+
-'''+
-=== PARTS NEEDED ===+
-'''+
--NPN transistor (2N3055) - $2.29 <br>+= Turn a switch on/off using the web-interface =
--One 10k Resistor - 99 cents<br>+
--One 1k Resistor - 99 cents<br>+
--1 LED<br>+
-<br>+
 +== ! Attention ! ==
 +'''You will destroy the original Web-interface with this startup-script!'''
 +'''Do this only if you are familar with some rescue commands on the linux command-line on ssh!'''
- +== Uses ==
-=== '''SCHEMATICS''' ===+
- +
 +* Hook it up to your car's door switch and open your car with your wifi enabled cellphone.
 +* If you have Remote Start System installed on your car you can hook up the remote control of the system to your f.i.c.s. (fonera internet controlled switch) and turn ON/OFF your car from the internet
-[[Image:crypto1.jpg]] <br>+* Open your house/garage door.
-[[Image:crypto2.jpg]] <br>+
-[[Image:crypto3.jpg]] <br>+
-[[Image:crypto4.jpg]] <br>+
-<br>+* Turn ON/OFF your POOL PUMP.
-<br>+
-=== '''ROUTER CONFIGURATION''' ===+* Restart additional routers with f.i.c.s.
-<br> 
-- Log on to your router (ex: http:192.168.1.1) <br>+== Parts needed ==
-- Go to Administration > Management <br>+
-- JFFS2 Enable <br>+
-- Go to '''Services'''<br>+*New/Safer circuit will be posted soon.
-- Enable SSH<br>+
-- Go to '''Administration > Commands '''<br>+== Schematics ==
-- type:<br>+
-'''echo 1 > /proc/gpio/3_dir'''<br> 
-'''rmdir /tmp/www; ln -s /jffs/www /tmp'''<br> 
-- Click '''Save Startup'''+: [[Image:LaFonera_Hardware_Controlling_AC-Loads_via_webinterface_-_04_overview.jpg|thumbnail|none|overview]]
-<br> 
-<br> 
 +== Router configuration ==
 +* Log on to your router (192.168.1.1)
 +* Go to '''Administration > Management'''
 +: enable '''jffs2'''
-- Now log on to your router using ssh<br>+: [[Image:LaFonera_Hardware_Controlling_AC-Loads_via_webinterface_-_05_web-interface_jffs2.png|thumbnail|none|web-interface - jffs2]]
-'''ssh root@192.168.1.1'''<br> 
--then type:<br>+* Go to '''Administration > Services'''
 +: enable '''ssh'''
-'''cd /jffs<br>+: [[Image:LaFonera_Hardware_Controlling_AC-Loads_via_webinterface_-_06_web-interface_ssh.png|thumbnail|none|web-interface - ssh]]
-'''mkdir www<br>+
-'''cd www<br>+
-'''wget http://cryptonoid.googlepages.com/index.sh'''<br>+
-'''wget http://cryptonoid.googlepages.com/on.sh'''<br>+
-'''wget http://cryptonoid.googlepages.com/off.sh'''<br>+
-'''wget http://cryptonoid.googlepages.com/blink.sh'''<br>+
-'''chmod +x on.sh off.sh index.sh blink.sh'''<br>+
-<br> 
-<br> 
--then go to '''http://192.168.1.1/user/index.sh'''<br> 
-<br> 
-[[Image:crypto5.jpg]] <br> 
-Web Interface <br>+* Go to '''Administration > Commands'''
-<br>+: type:
-<br>+
--Now you can control the switch simply by clickin ON or OFF from your favorite browser (i use my cell phone to activate the switch thru the web interface). Since my linux kung-fu skills are not developed yet, it took me some time to get familiar with .sh scripts.+
-<br>+
-<br>+
-<br>+
-=== '''USES''' ===+<pre>
 +echo 1 > /proc/gpio/3_dir
 +rmdir /tmp/www; ln -s /jffs/www /tmp
 +</pre>
--Hook it up to your car's door switch and open your car with your wifi enabled cellphone.<br>+* Click '''Save Startup'''
--If you have Remote Start System installed on your car you can hook up the remote control of the system to your f.i.c.s. (fonera internet controlled switch) and turn ON/OFF your car from the internet <br>+: [[Image:LaFonera_Hardware_Controlling_AC-Loads_via_webinterface_-_07_web-interface_save_startup.png|thumbnail|none|web-interface - save startup]]
--Open your house/garage door.<br> 
--Turn ON/OFF your POOL PUMP. <br>+* Now log on to your router using ssh
--Restart additional routers with f.i.c.s. <br>+<pre>
 +ssh root@192.168.1.1
 +</pre>
 +* type:
 +<pre>
 +cd /jffs
 +mkdir www
 +cd www
 +mkdir cgi-bin
 +cd cgi-bin
 +wget http://wildblue.de/fonera/controlling_ac-loads/index
 +wget http://wildblue.de/fonera/controlling_ac-loads/on
 +wget http://wildblue.de/fonera/controlling_ac-loads/off
 +wget http://wildblue.de/fonera/controlling_ac-loads/blink
 +chmod +x on off index blink
 +</pre>
 +* go to http://192.168.1.1/user/cgi-bin/index
 +
 +: [[Image:LaFonera_Hardware_Controlling_AC-Loads_via_webinterface_-_08_new_web-interface.png|thumbnail|none|new web-interface]]
 +
 +: Now you can control the switch simply by clickin ON or OFF from your favorite browser (i use my cell phone to activate the switch thru the web interface). Since my linux kung-fu skills are not developed yet, it took me some time to get familiar with .sh scripts.
 +
 +== Original Idea ==
 +: http://www.cryptonoid.blogspot.com (f.i.c.s. Fonera Internet Controlled Switch)
 +
 +: http://www.youtube.com/watch?v=wKPsH34InMo (Watch the f.i.s.c in action - video)
 +
 +== Development ==
 +since im not very good in programming shell scripts can someone write a Shell script where the user will be able to schedule the f.i.c.s. to go ON/OFF at certain times thru the web interface.
 +
 +----
 +
 +this page was made by [[User:wildblue|wildblue!]]
 +
 +
 +
 +
 +== A Different Method ==
 +
 +The original author was on the right track. The easiest way to do this is with a solid state relay (SSR). Please note, relaying DC is VERY DIFFERENT from relaying AC.
 +
 +Note, there are mechanical relays that can do DC or (BE CAREFUL, ONLY IF YOU KNOW WHAT YOU ARE DOING) AC. SSR's can only do AC, and will not switch DC current.
 +
 +The diagram below shows how to connect an AC load, a AC LAMP to a solid state relay, and the relay to your FON. Substitute the FONs i/o pins (1,2,5,6) for "pin 12" in the picture.
 +
 +[[Image:Relay lamp.gif]]
 +
 +Here is an example of a solid state relay. It can be purchased directly from Mouser, etc. [http://www.mouser.com/Search/Refine.aspx?Keyword=558-D2W203F].
 +
 +[[Image:Crydom-D2W203F.gif]]
 +
 +===GPIO matrix list===
 +
 +
 + /proc/GPIO Pin on LaFonera
 + 0_dir TP3
 + '''1_dir pin 5 of SW1'''
 + 2_dir WLAN LED
 + '''3_dir pin 1 of SW1'''
 + '''4_dir pin 2 of SW1'''
 + 5_dir RESET (!)
 + 6_dir RESET button
 + '''7_dir pin 6 of SW1'''
 +So, if you connected your relay to SW1 pin 1 (the 'pin' with the arrow above it in the picture below) on the Fonera, you could run this command in DD-WRT to turn it on and off.:
 +[assuming you have telneted into your DD-WRT running Fonera]
 +echo 1 > /proc/gpio/3_dir #on
 +echo 0 > /proc/gpio/3_dir #off
-=== '''check out [http://www.cryptonoid.blogspot.com f.i.c.s. Fonera Internet Controlled Switch]''' ===+===Fonera SW1 pinout===
- <br>+
 +[[Image:pins.jpg]]
-'''since im not very good in programming shell scripts can someone write a Shell script where the user will be able to schedule the f.i.c.s. to go ON/OFF at certain times thru the web interface.'''+--[[User:Sboger|Sboger]]

Current revision

You are here: DD-WRT wiki mainpage / LaFonera / Hardware / Controlling AC-loads via web-interface

Contents

[edit] Turn a switch on/off using the web-interface

[edit]  ! Attention !

You will destroy the original Web-interface with this startup-script!

Do this only if you are familar with some rescue commands on the linux command-line on ssh!

[edit] Uses

  • Hook it up to your car's door switch and open your car with your wifi enabled cellphone.
  • If you have Remote Start System installed on your car you can hook up the remote control of the system to your f.i.c.s. (fonera internet controlled switch) and turn ON/OFF your car from the internet
  • Open your house/garage door.
  • Turn ON/OFF your POOL PUMP.
  • Restart additional routers with f.i.c.s.


[edit] Parts needed

  • New/Safer circuit will be posted soon.

[edit] Schematics

overview
overview


[edit] Router configuration

  • Log on to your router (192.168.1.1)
  • Go to Administration > Management
enable jffs2
web-interface - jffs2
web-interface - jffs2


  • Go to Administration > Services
enable ssh
web-interface - ssh
web-interface - ssh


  • Go to Administration > Commands
type:
echo 1 > /proc/gpio/3_dir
rmdir /tmp/www; ln -s /jffs/www /tmp
  • Click Save Startup
web-interface - save startup
web-interface - save startup


  • Now log on to your router using ssh
ssh root@192.168.1.1
  • type:
cd /jffs
mkdir www
cd www
mkdir cgi-bin
cd cgi-bin
wget http://wildblue.de/fonera/controlling_ac-loads/index
wget http://wildblue.de/fonera/controlling_ac-loads/on
wget http://wildblue.de/fonera/controlling_ac-loads/off
wget http://wildblue.de/fonera/controlling_ac-loads/blink
chmod +x on off index blink
new web-interface
new web-interface
Now you can control the switch simply by clickin ON or OFF from your favorite browser (i use my cell phone to activate the switch thru the web interface). Since my linux kung-fu skills are not developed yet, it took me some time to get familiar with .sh scripts.

[edit] Original Idea

http://www.cryptonoid.blogspot.com (f.i.c.s. Fonera Internet Controlled Switch)
http://www.youtube.com/watch?v=wKPsH34InMo (Watch the f.i.s.c in action - video)

[edit] Development

since im not very good in programming shell scripts can someone write a Shell script where the user will be able to schedule the f.i.c.s. to go ON/OFF at certain times thru the web interface.


this page was made by wildblue!



[edit] A Different Method

The original author was on the right track. The easiest way to do this is with a solid state relay (SSR). Please note, relaying DC is VERY DIFFERENT from relaying AC.

Note, there are mechanical relays that can do DC or (BE CAREFUL, ONLY IF YOU KNOW WHAT YOU ARE DOING) AC. SSR's can only do AC, and will not switch DC current.

The diagram below shows how to connect an AC load, a AC LAMP to a solid state relay, and the relay to your FON. Substitute the FONs i/o pins (1,2,5,6) for "pin 12" in the picture.

Image:Relay lamp.gif

Here is an example of a solid state relay. It can be purchased directly from Mouser, etc. [1].

Image:Crydom-D2W203F.gif

[edit] GPIO matrix list

/proc/GPIO       Pin on LaFonera
0_dir		TP3	
1_dir		pin 5 of SW1
2_dir		WLAN LED
3_dir		pin 1 of SW1
4_dir		pin 2 of SW1
5_dir		RESET (!)
6_dir		RESET button
7_dir		pin 6 of SW1


So, if you connected your relay to SW1 pin 1 (the 'pin' with the arrow above it in the picture below) on the Fonera, you could run this command in DD-WRT to turn it on and off.:

[assuming you have telneted into your DD-WRT running Fonera]

echo 1 > /proc/gpio/3_dir #on

echo 0 > /proc/gpio/3_dir #off

[edit] Fonera SW1 pinout

Image:pins.jpg

--Sboger