Home monitoring/control across internet

I should know better... apologies... I asked the following in the wrong forum a few days ago.

In the "Transistor Trouble" thread at the Hardware Interfacing forum, the author describes something neat: A set-up where, if I understand things right, he sends something from an internet terminal into an IRC session. That message is received at a Windows PC connected and on and waiting in his home. That PC then sends a message to an Arduino (using a simple serial link between the two), and the Arduino does something.

Please: For the purposes of this thread, leave the idea that the Arduino will be a "slave", "hanging off" a big PC, connected via a serial link "set in stone"?? I KNOW there are many ways to skin these cats, but I would really like to learn more about the OTHER parts of doing things THIS WAY. In particular, I hope this thread will not go down into the world of using an Arduino as a web server... nor get involved with what is sensed, what is sent back in the Arduino.

I have a "WAMP" server on my always-on internet connection... but it is under-used at the moment... it just serves up a static page of HTML.

What do you think, experts?.... what's the best course for me to take in trying to go further? The one with the least overhead, and the greatest general application is the one that interests me the most. I don't mind a steep early learning curve, if the work will repay me in the long run.

I'd love to learn enough so that the page my WAMP server presents to the public has a button that when clicked causes the WAMP server to send, say, "ButtonClicked" to the Arduino over the serial connection between WAMP and Arduino.

If whatever powers the above could also arrange for the following, so much the better....

Let's say that my Arduino has a temperature sensor connected to it.

Could things be arranged so that when someone "out there" on the internet asked theWAMP server to serve up a particular page of HTML, then before that page was sent, the WAMP server would send "TellMeTture" to the Arduino (over serial link), wait for answer, and incorporate answer in page served?

FOR NOW (Please?): Answers, but not on a postcard, to "what set-ups/ software, etc" could solve both of the problems above? (I'll start separate threads later for "How do I...?" after coming to a decision about the tools I want to use for solving the problems.)

Hoping this thread won't fray too much....

Tom

PS: If you think the idea of home control with the web and an Arduino is fun, have a look at...

http://bld-live.dk/arduino/control/

Login is:

arduino control

Discussed at...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278347111/135#135

Could things be arranged so that when someone "out there" on the internet asked theWAMP server to serve up a particular page of HTML, then before that page was sent, the WAMP server would send "TellMeTture" to the Arduino (over serial link), wait for answer, and incorporate answer in page served?

Sure. What you need to make that work is some pre-processing at the web server end of things to dynamically generate the page that gets sent back. Since you're running WAMP you should have PHP available to you, so rather than placing a static HTML page in the webroot you can put in a PHP script that communicates with the Arduino to fetch the temperature value before sending the page back to the user.

However, there are a couple of gotchas. Firstly it's not so easy to use PHP to open a serial connection to do the communication: in that situation what I typically do (including in my home automation system, which you can see a little of at www.superhouse.tv) is use a serial-to-TCP proxy (I use ser2net on Linux, but there are equivalent programs on Windows) to expose the serial port as a network socket. Then it's a piece of cake to have your PHP open the socket to talk to the Arduino and get the temperature.

Secondly, doing it this way will introduce some latency. Fetching the data live will hold up the page from being sent back to the user, and even if it's only a few hundred milliseconds that can still make the system feel really slow. You may be better off running a separate process that periodically polls the Arduino to get the temperature (perhaps every 30 seconds) and writes the value into some common location such as into a textfile or a database. Then it's a simpler job for your PHP script to fetch it whenever a page is requested rather than talking directly to the Arduino.

Jon Freetronics: www.freetronics.com

If your “WAMP” setup inclides the apache web server, then for a simple solution you can make a small cgi file to do serial I/O with the arduino. My pan/tilt cam below is controlled via apache cgi just using several lines in a batch file.

http://web.comporium.net/~shb/wc2000-PT-script.htm

Yes! Thank you. "WAMP" is the name a project is using for an integrated Windows/ Apache/ MySQL/ Php install/setup package for server-admin newbies.

For me, as a beginner, it has worked well. I set up Apache and MySQL "by hand" before disovering WAMP. I've used WAMP twice since then. Like it!

(Details of my newbie adventures at...

http://www.arunet.co.uk/tkboyd/hh50.htm

But! Back to things "Arduino"... thank you for the PHP and CGI suggestions. Otehr options? Pros/ cons of the two routes mentioned so far? I'd heard that CGI was seen as somewhat a) old fashioned? b) insecure?

As someone who still uses Paradox for any database work not yet moved to OpenOffice, and Delphi for programming.... and who's burglar alarm is still running under DOS(!), I can't complain if something is "old fashioned"... but maybe I wouldn't use DOS for a NEW job, today...

:-)

Pros/ cons of the two routes mentioned so far? I'd heard that CGI was seen as somewhat a) old fashioned? b) insecure?

Probably the main selling point of CGI is that it works. Others seem to like other approaches that are clunky and seem to barely work at best (aka "sweet lemon"). I think apache has provisions for login and such. You can try both approaches and find the one that works for you.