3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Home automation server with router

Step 4Setup the web page

Setup the web page
Upload the /HomeAutomation/ folder structure into the root directory.

Set permissions for the script files located here:
/HomeAutomation/www/cgi-bin
 Select all of them -> F9 Properties -> set the execution rights (X) for everyone (Owner, Group, Others)

Close WinSCP, restart router (e.g. recycle power).
 Now the web server is ready. Try it out:
 Open up a web browser, type in: http://192.168.1.1:81
 You should see your custom web page.

If you press a button on the included web page, the router will send out serial commands through the previously attached serial cable.

 We need to intercept these commands and process them. For that purpose we need to build a microcontroller board (like Arduino).

The included web site is very basic. If you make good CGI/AJAX based web sites please share it with us.

How does the web site work
  When you click on a button, the browser loads a script file, the router executes the shell commands (serial outputs) located in each cgi file. The script file then redirects the browser back to the index page (takes about ~1sec).

 If you want to output custom serial commands, modify the .cgi files.
Serial commands are sent out like this:

echo -e "\x9B\x11\x08\x22\xC5\x0D" > /dev/ttyS0
 (the \x modifier is used to output data in HEX instead of ASCII)

Protocol detail
I made this simple as possible. One package contains:

 Byte#    Function:
 1.        Synchronization (0x9B)
 2.        Message type, use 0x00 or 0x01 for now (check firmware for details)
 3.        Data1
 4.        Data2
 5.        Checksum (calculated from Byte#2-4)
 6.        End character (, 0x0D)

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
17
Followers
1
Author:mrx23dot