A Smart House Based On A Router
Brief historyFirst there was chaos... Let us pass the stage of the creation of peace and the era of dinosaurs and move immediately to the 21st century. With wireless technology, electronics everywhere, space ships flying to Mars...
By opening up Chinese Internet stores for different products, I bought all kinds. In particular, remote light-bulb-control kits were purchased: remote-control bullets and several boxes. As a result, I made four houses run by pinks, and now, lying on the couch tonight and reading Habr, it's possible to light or extinguish light in the room and in the corridor without getting off the couch. Suitable.
There were some wonderful little cheap WiFi-rooters. One of them was used as a " patron " for wireless Internet, while the other remained in reserve. By the way, I recommend that very good characteristics for less than 600 roubles.
There were many different good things in the " close of Rodina " and there were big new weekends. And there was a project...
Purpose and meansIt's decided that what is absolutely necessary in my “smart house" is an electric rod which can be managed via the Internet. To this end, the necessary details were collected:
- Micro Controller atMega16 from old project
- solid relay
- 2-strength RHS
- wires and other consumables
Technical assignmentThe device was named MZ-switch and should have done the following:
- take commands from the master via the Internet.
- work as a load management relay and as a time frame
- to work as a " ping " and to be able to reload the router and disable the load without pings
- programme the performance parameters from the command line and keep them in their memory
- display status
- To enjoy the master ' s existence
Router code injectionWhen I got the router, of course I went straight inside. First, I didn't go there mechanically, but metaphysically through the veal.
Turns out he's got Linux's neon inside, and even if you want to write and run his own violin. You can even keep it in the mouth, but that's how to make a violin start automatically at the start?
A few days were killed to find a way to launch a violin. The main idea was "code injections" in the launch of some kind of start-up violin, and it was found! The injection looks like:
Now my router retrievs from his memory the cricket stored there and launches them. Consequently, it is possible to realize its algorithm of interaction with the surrounding world.
Getting from the violin roller, I got into it mechanically. There's a sequential port inside that can access the consoles. With three pins to the right points of payment, I was able to control the router through a sequential port with a micro-controller.
Micro Controller and Management ProgrammeThe micro Controller should be able to communicate through a consistent port with the router, manage the load, display the results of the work and do all the dirty work at all. AtMega16, which had the necessary functionality, remained a microchief charge from the previous project. She's on her way.
The basic algorithm of microcompany looks like getting a line with the team, analysing, doing, returning the line with the answer. It reminded me of the logic of analog modems: S-registers with data and AT commanders control.
The algorithm operates the concepts of R-registration and MZ-Comanda by respecting the co-piers and for diversity in general. The registers store numbers and rows, and the teams allow for the change of registers and the management of the logic of work.
Example of the counterfeiting team:MZ+R0=200♪