The Arduino is a hobbyist friendly microprocessor.
An ArduServer (my term) is a web server built in an Arduino. The only client software you require is an ordinary web browser, e.g. Firefox. The demo servers described in these pages feature an LED and a light sensor. With an ArduServer you only need a browser to turn the LED on or off, and you can "see" what the light sensor sees... from anywhere in the world!
The LEDs and light sensors are just "stand ins" for whatever effectors and sensors you want to access across a LAN, or across the internet.
An ArduSimpSrv (my term) is easier to make... so the Arduino is not as "stressed" by the serving, and thus more other things can be done in it than if the Arduino has to be a web server. It also has an LED and light sensor, again as "stand ins". But an ArduSimpSrv needs "bespoke" client software. I provide some for Windows, and would be very happy to provide publicity for an equivalent program for Linux. (See my ArduSimpSrv page for details.)
It may be a bad idea to use any of the following at the same time as a W5100 based shield....
... and D13, but this last one only if you "care" that on the shield it goes to an LED, and from there through a resistor to ground. (This merely parallels the same thing on many Arduino and clone boards... BUT, to digress from the digression, BE AWARE that the software behind "setup()" and "loop()" pulse D13 high briefly before executing whatever you specified in "setup()".)
Of course, I unwittingly used some of those lines in my designs. The designs SEEM to work, but it would be a good idea to take what I've put on those lines and move them elsewhere. I will gradually be revising my designs as follows....
In every case, to modify the software is easy... but you will need to look carefully to see whether what is currently online has been modified or not.
To change the line used for, say, the phototransistor watching the LED in, say, ArduServer2, the line....
client.print("<br>Analog input 0 reads: <b>"); client.print(analogRead(0));
... must be changed to...
client.print("<br>Analog input 1 reads: <b>"); client.print(analogRead(1));
... and you are done! (You'll have to move one wire on your breadboard, too, if you had it wired for the original design.)
(Digression: Is nothing every easy? In 99.0% of my code, such a change would merely have been a matter of changing something like the "const byte bLEDpin=8;" at the start of the program. But in this case, to avoid fighting with... not hard... getting the prompt to identify the channel, I took a shortcut and specified the channel explicitly instead of a global variable. Sigh.)
Sorry! I could have done without this, too! When will the Official Arduino Site have proper documentation of the ethernet shield and library??
Want to see one in action? The following page describes specific servers which are usually online for you, and has links to them. Directory of online ArduServers.
I have written a general introduction to IP addresses, the DNS, dynamic addresses, etc. for you. It should help you see how your can set a server up on a LAN or even to serve the internet. There are many details in various pages about my different ArduServers and ArduSimpSrv... and in my FarWatch pages. The sorts of things you will find out about there....
1) The original "ArduServer" is inexpensive! (But if you don't have a ENC28J60 interface already, skip over this to the next item, unless you are working on a very tight budget, or curious!)
The original ArduServers was built for $40 with a Microchip ENC28J60 chip on a NuElectronics shield and a ModernDevice RBBB with just a little Atmega168, which has only 16k of storage!
The RBBBs will take more modern chips, and are, October 2011, supplied with Atmega 328s, your choice of 5v or 3v3 versions. Kits (easy): $13. Kit with USB one-cable/ many Arduinos "BUB": $25.) (You will need a BUB or equivalent with RBBBs and similar.)
Although a Wiznet W5100 interface is probably worth the slightly greater expense, the SheepdogGuides tutorial for the original ArduServer has information on general issues which you may find resolves one or more mysteries for you.
The complete code for the ArduServer, first version, is on a page of it's own, if you want to "skip to the answer". The tutorial explaining the design and development of the ArduServer will help you understand what is there.
2) AdruServer2... I've written notes, with Arduino code, on my second ArduServer, "ArduServer2", but they (at the moment) are intertwined with general ArduServer notes... sorry. I am working on untangling them.
The Arduserver2 is Wiznet W5100 based.... probably "the way to go" for a beginner... even though it is a little more expensive. Taking your first steps into this territory? I'd go with a Uno + Shield, or the Sparkfun Ethernet Pro ($55, Oct 11 (no SD card carrier)) which gives you the two of them on one PCB, if you are ready to commit "an Arduino" which always has an ethernet shield "attached". There's also the "official" "Arduino Ethernet", with or without PoE module, as suits your needs. (You can retrofit one). (About $60 , Oct 11, for one without PoE.) (Excellent notes at the UK distributor "CoolComponents") And then there's also the Freetronics EtherTen ($70, Oct 11, with micro SD card carrier)... again with PoE options.)
The complete code for the ArduServer2 is on a page of it's own, if you want to "skip to the answer". The tutorial explaining the design and development of the ArduServer will help you understand what is there.
3) ArduSimpSrv... HTML-less TCP/IP client / server work: Going a step further, I have produced Arduino and Windows code for what I call ArduSimpSrv. This is still an Arduino server, but it is not a web server, it is a more Simple S(e)rver. Good because it demands less of the Arduino, leaving space for more code to do things besides communicating with clients. Bad because you will have to adapt the client software I provide, to meet your wants regarding access to your ArduSimpSrv.
The complete code for the ArduSimpServer is on a page of it's own, if you want to "skip to the answer". The tutorial explaining the design and development of the ArduSimpSrv will help you understand what is there.
A wise person once said "If you want to be safe, do nothing."
I want to do something, so I've given up being completely safe... but I try to avoid being reckless. (Another saying for you, from the world of aviation: "There are old pilots, and there are bold pilots. But there are no old bold pilots."
Putting a server on your LAN creates new ways for things to go wrong. Putting a server on the internet will, if you aren't careful, give the Bad Guys a way into parts of your system which you don't want them in.
I've written more on the safety aspects of putting a server on your system. I'm afraid I don't have "the answer"... but maybe I can make you aware of some of the questions you need to ask?
With the things you can learn in these tutorials, you are 90% of the way to a system with a web cam or IP cam mounted on a pan and tilt bracket which can be controlled from across the internet! (Arranging to view, across the net, what the camera sees is another matter... which you will have half solved along the way to getting your ArduServer or ArduSimpSrv working.)
That's just one of many, many possibilities. How about a system which allows you to control the setting of your home's thermostat? I'd combine that with your alarm system. When you go out, and set the alarm on your home, it would automatically set the thermostat back to a lower setting. On days when you return home at a fixed time, the Arduino handling the alarm would turn the heat back up ahead of your arrival, just in time for the house to be warm when you arrive. And on other days, a quick visit to a webpage served by the ArduServer in your home could turn the thermostat up in advance of your earlier- than- usual return.
So many ideas... so little time! With the basic tools explained in these tutorials, a whole world of new projects become (almost) trivial.
In MArch 2013, I had a new burst of energy, and wrote some "new" pages, pulling together many things I've learned about client/ server computing. (The Arduserver is an example of client/ server computing, as are the IP cams I was speaking about a moment ago.) I hope you will find useful my March 2013 pages about client/ server computing. I hope the enthusiastic hobbyist/ student will find them accessible that they (hobbyist/ enthusiast) will not have (undue!) trouble accomplishing the things described in the pages.
Once you have an Arduserver working, consider the following...
A program like my FarWatchWatcher could be written with very litter more trouble than writing the basic FarWatchWatch entails. Call it "ArduserverWatcher" if you do write it, please. (And tell me where it is.)
I know that FarWatchWatcher is very "do-able". And I know that it would be trivial to extend it, very slightly, to make it record the data harvested in a machine readable file. (Just have it write a .csv file, and you can import it into a database at your leisure.)
A "better", but less trivial answer would be to have ArduserverWatcher write the data it collects directly to a database. The only impediment to that solution is that you not only need an Arduserver and an ArduserverWatcher, but also something like an always on MySQL server, and the ability to put database access into your ArduserverWatcher code. (The latter should be possible with Lazarus/ Piette's ICS/ MySQL... all free).
The last two requirements are not an insuperable barriers... just "little extras" which may leave you content at the "Arduserver writes to .csv file for eventual integration into database" solution. But the "bigger" solution really is "better". I just wish I had time to implement it myself! So many projects, so little time. Sigh.
Sorry, folks... couldn't resist! I hope you find this widget as cool as I do. Play with it... See what happens when you drag on it with your mouse. You can easily add one to your site, free. Just visit www.revolvermaps.com. You have many options on the widget design page, which is a paragon of user-friendliness. You can track individual pages or page sets. A RevolverMap also gives you access to lists of what countries you were visited from. More at my page for web page authors. On modest devices... Kindles and iPads, for instance... you won't see the revolving globe that others see, but you still see something. (Don't you?)
If you are prepared to give up the space required for the RevolverMap in the HTML for the page served by your Arduino, you can even have one on your Arduino-served-page. This is demonstrated in the ArduServer2. The original ArduServer, running as it does in very limited hardware, does not have the space to run a RevolverMap. <;-;>
(There are search tools, etc., in the page footer, after the scraps.)
A device for serving a webpage to LAN or internet, using just....
You don't need to leave your "big computer" connected to the Arduino, or switched on, once you've used it to program the Arduino... if your router can handle DynDNS updating.. as many can. (If your's can't, your PC can do the job, but then it will need to be left on.)
For one of the ArduServers presented here, you don't need more than...
All of my Arduservers monitor some inputs of the Arduino, and present information about what has been seen on the webpage served. What input you monitor, what reports you generate are easily modified.
All of my Arduservers allow users of the page served to "issue commands" (by clicking buttons on the webpage returned by the webserver). The Arduino, in response to the command, changes the state of one of its outputs. This behavior can be modified easily, too.
Not because it is useful, but because it is cute, and illustrates everything, in my ArduServer demos, the output turns an LED on or off, and the sensor is a light sensor the LED is up against. So on the web page you can "see" the LED turned on or off.
Solved for you: the problems of overcoming the fact that you probably don't have a static IP address for your internet connection.
Solved for you: how to present data collected from inputs to the Arduino as part of the material on the webpage.
Solved for you: how to put buttons on the webpage which allow people viewing the webpage change the state of outputs from the Arduino. That also works if the computer viewing the page and the Arduino are on the same LAN.
Have you heard of Flattr? Great new idea to make it easy for you to send small thank you$ to people who provide Good Stuff on the web. If you want to send $$erious thank yous, there are better ways, but for a small "tip" here and there, Flattr ticks a lot of boxes which no one else has found a way to do yet. Please at least check out my introduction to Flattr, if you haven't heard of it? "No obligation", as they say!
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code. Sigh.
- - - Page ends - - -