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.)
My various Arduservers WORK!
To the left: A screenshot of what someone out on the net sees when he accesses the server. (The globe is a visitor monitor powered by a plug-in on the code generated by the Arduino/ Teensy.)
At the bottom of the page there is a big "stop press" message with warnings that some stuff may be wrong.
That "wrong stuff" is mostly some rough edges in my advice on what pins to use, what pins to avoid. It needs work. But the various Arduservers described here DO WORK. And have been working, on and off, for years in some cases.
Of course, networks, modems, routers go down from time to time. Email me if an Arduserver that "ought" to work seems down.
An Arduserver serves up pages to the internet. The pages have on them readings from sensors attached to the Arduserver. Arduservers are descendants of my FarWatch products. In January 2017 I released a new "Far Watch Watcher".... it is a program that runs in a Windows pc and "watches" an Arduserver or FarWatch installation, across the internet, drawing graphs of the numbers fetched, and recording the numbers in a data file.
Too cool! There is now a little micro-processor-with-WiFi which can "do" all of the basic Arduserver stuff... and only cost you $16!! (You'll have to add a few resistors and a light sensor. Big deal. All the Arduservers need them. You DON'T have to supply an internet controllable LED. There's one on the board, and a demo program for creating a web-server that only needs minor tweaking to make an Arduserver out of the device.)
It has been around for a while, even the specific "complete product" which has me all excited, built around the Wonder Chip that makes it all possible, the ESP8266.
Some time ago, Sparkfun created what they call the ESP8266 Thing. (It comes in two versions. Both $16. I opted for the "Dev Board" version.)
It isn't "an Arduino", but, with one of the increasingly common "add on" packages, you can use the basic Arduino IDE to program the Thing. I've used such add-on packages without grief.
And, oh by the way, it runs at EIGHTY megahertz! (An Arduino Pro Mini runs at 8 or 16 megahertz, depending on the voltage variant you are using.
I have prepared the software to run an Arduserver in an ESP8266. It uses slightly different commands to turn the LED on or off, and there's a separate command to read the value on the analog input, but the basic "ArduServer" features are there. The code also includes software to read a 1-Wire temperature sensor. (I've tested it with a DS18B20. It "should" also work with DS18S20 or DS1822.)
Oh.. and it does crude "pulse counting"... adequate for a wind speed sensor.
The web-page generated is "machine friendly", so if you have the Arduserver running in one place, you can have a "check the Arduserver" program running elsewhere which will draw a graph of the temperatures seen, and the values in the pulse counter. The same "Arduserver watcher" program can sound an alarm if, say, the temperature the Arduserver is watching falls below a certain level.
Besides the Arduserver software, which you pretty well have to figure out for yourself... I provide the code, but not a lot in the way of tutorial, I've written more for you on the Sparkfun Thing on a dedicated page.
N.B.: The analog input to the Thing should not be subjected to more than 1.0 volts. Not a deal breaker, but you'll have to set the light sensor up accordingly.
I've added an ArduWatcher program to the system. It harvests data from Arduservers, across 'net of LAN, saves it in a CSV file for easy further processing.
I first started playing with the wonderful Teensy in early November 2014. Within a few days, I had Arduserver 3 up and running... the best Arduserver to date. Some problems I'd run into previously with pages being severely limited as to size... and the development environment responding very badly if a page was a tiny bit to big... seem to be GONE, in the Teensy world. Of course, they may also, by now (Nov '14) be gone in the general Arduino world... it is a while since I was last working on Arduservers. But no time just now to investigate that!
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!
(This page was started in 2011. Please see my "March 2015 ENC28J60 update" page before buying or using one of them! (That page will open in a new tab. Just close it to come back here.))
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. (This section was written before I'd "met" the Teensy and Wiz820io. See Arduserver3 (below) for what, Dec 2014, I think is even better than an Uno, etc, and a W5100)
One of the "Wiznet" boards is probably "the way to go" for a beginner... even though it is a little more expensive. I'd avoid the ENC28J60 boards... there's a reason they're cheap!
Taking your first steps into this territory? One answer would be an 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.
Arduserver2 was retired, still working, November 11th, 2014. It's place on the web was given to...
3) Arduserver3... Built in a Teensy, with a Wiz820io ethernet module.
The complete code for the ArduServer3 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. Although I was using a Teensy 3.1, the code should need little, if any, tweaking to work in a regular Arduino.
The code the link above takes you to does work, and has been "tidied up" for reading. It is presented in a web page. Alternatively, the Teensy code I am actually using in Arduserver3 as of early December 2013 is available in the zip file the link will take you to. It hasn't been "prettied up" for reading. But a few odds and ends of the functioning of Arduserver3 have been tidied.
I enjoy the challenge of Making It Work. Writing it all up is less enthralling, and sometimes I wonder if anyone even reads these things. I give away the sourcecode... you don't even have to "register", etc. So it would be NICE if SOMEONE, anyone, would "vote" for the YouTube video, "Like" the Arduserver Facebook page, mention Arduserver in a forum, etc, etc???
Special note applying to Teensies: This is a fairly esoteric issue, so don't let it worry you if you don't want to fuss with it. Every Teensy 3 has a unique Ethernet media access (MAC) address burnt into it. The number will be different on every Teensy 3. It isn't overwritten by the bootloader flashing process. If you want to access this, to ensure that you don't get MAC address conflicts on your LAN (unlikely, unless you have more than one "home made" device on the LAN, but possible, if you are using the "set in code" method used in my ArduServer3 software), see the Teensy MAC address thread at the PJRC forum. Be sure to read past the first post, to see the suggestions for improvements which were given.
Arduserver 3 support circuits:
(A small point: I believe that the Wiz820io probably needs about 175mA of 3v3 available to it. So don't try to power it from the 3v3 pin on a Teensy.. at best, that should not be asked to supply more than 100mA. The PJRC.com shield ($6) includes a voltage regulator to power the Wiz820io, from the general 5v supplied to the Teensy.
4) 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.
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??
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 - - -