Since the wireless router is in my bedroom and I think like "better safe than sorry", I built a device to switch on or off my wireless feature from my router.
It was a lot easier if the router has a button to do that, but unfortunately it doesn't have!
I read about some way to control wireless feature through 'telnet' on 23 port. But again,unfortunately, my router doesn't allow any incoming connection unless on port 80 which is the default port browsers use to HTTP.
So, let's create a HTTP bot to simulate a human to enter the router web site and switch the wireless option
What we need:
- Ethernet shield
Obviously, we can create the bot on our computer but this will limiting the switch.
With Arduino, the change can be made even if the pc is off.
Another feature that i want to add to this project is the capability to switch the router with a common InfraRed remote control ( from my tv for example).
- A IR Receiver ( I choose one of the TSOP22 family)
- 100ohm resistor
- Status led
This project is too simple:
Pick an example of IRemote from Arduino libraries.From IR Receiver connect pin 2 to 5V with the 100ohm resistor to prevent over current, pin 3 to GND and pint 1 will be our RECv pin for Arduino example code.Test it! It should work at first!Then do the changes you like!
Now,just pick a client example of Ethernet from Arduino libraries see how this works. Connect it to port:80 as I said before, and ip address from your router and let's send to router some code!
What is the code do we need to send to router?
In the router web page, to change the option of wireless feature I need to check or uncheck a check box inside a form and click on submit button to post the form.Ok, let's sniff the connection and search for a HTTP POST command.
I installed a HTTP sniffer "HTTPAnalyzer from IEInspector" and start recording while I perform the task of switch on and off. I got two different codes under the HTTP Header.I copy them to arduino and send through the example from the ethernet library.
It Worked, but not in the first try!. Now just we need to join the codes from iRemote and ethernet together and test pressing the button from remote control.
It is the best for me, now every time i want wlan I just need to pick up my remote control and when I'm done I pick it up again.
Hope you enjoy