The Arduino is a hobbyist-friendly microprocessor. For $10 you can own a computer more capable than the one on-board the Apollo spacecraft. And the software to program it costs nothing.
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.
Some of 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! (Latest, greatest Arduserver (Esp8266 based) costs $20. See "New December 2016", below. (An "expensive" ESP8266 costs $15. I added $5 for a few discretes.)
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.
Some of the other Arduserver described here are mainly intended post readings from sensors attached to the Arduserver to the internet, for use from anywhere.
And then there's the ArduSimpSrv (my term). It 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.)
If parts of this page seem "dated", well, maybe they are! But I hope that they will reassure you that the idea of an Arduserver has stood the test of time!?
Today, you can build one more easily than the early ones were built. For the same money, you will have more power. Or build one for less than $20. Imagine having a simple computer for $20, not so long ago. Let alone a webserver.
There were already ways to do a minimal Arduserver quite inexpensively in October 2017 when I am gave this page an overhaul.Now, in February 2019, what we had in 2017 seems crude.
Today? I would "go with" the ESP8266 "answer". That means using a wireless connection to your LAN, which I don't particularly like, and it would mean "installing" the support material for the ESP8266 in your Arduino IDE, which you may be reluctant to do. Fair enough (!)... but, although I was reluctant to do that sort of thing long ago, I've done it numerous times since without regrets. But, even with a "poor" and "expensive" ESP8266 (from Sparkfun... which is what I would do, for reasons explained elsewhere), it would be $17 (plus p&p, Oct 17)
(By the way: If you have added boards, such as the 8266, to your Arduino IDE's capabilities, remember: It is best to set the IDE for the sort of board you are going to work with "today" before connecting the Arduino to your development system.)
If I didn't want to go the ESP8266/ wireless route? Though I haven't tried it, I would be very surprised if the following wouldn't support an Arduserver well...
Ummm... as I started researching this, October 2017, I found that wired alternatives seem to be falling out of the marketplace! Bah, humbug! But you can find them... but be prepared for having to dig around a bit. Sorry!
On option: the Arduino of your choice, connected to an Arduino Ethernet Shield 2. Sparkfun sell them as their "DEV-11166". ($25, Feb 1019. (It was $45, Oct 17) Plus p&p). Sparkfun won't be your cheapest option.. but they are reliable, and give you support. (Something nominally similar was on sale, eBay, for $5!) Speaking of "support", note, for instance, the information about the "Arduino.cc"/"Arduino.org" "war" which was causing nuisance for people using this shield in Oct 17.
The Teensy, which I HAVE used, details below, allows you a WizNet820 wired connection to the LAN... (£36 (plus p&p, Oct 17) from HobbyElectronics, plus a Teensy. Get the Teensy WIZ820IO Ethernet & Micro SD Card Adaptor, which was part of my "£36", too.) but, like the ESP8266, would require an enhanced IDE. As I said... that enhancement is NOT a big deal... and going that route would save you money over the Ethernet Shield+ Arduino route.
Enough about hardware! Moving on...
I would like to tell you that anyone can create and set up an Arduserver on the internet after reading just a few tutorial pages. (If you just want to use one made by me, you can "just plug it in"... practically!)
I'm afraid, though, that an Arduserver is a full blown web server. No webserver can "just be plugged in" to a LAN, let alone to a LAN in a way that makes it (safely) visible from anywhere on the internet.
If you haven't already learned "all about" the basic elements of putting anything on the internet, I invite you to the series of pages I've written for you. (The early pages in that series take you through the less complicated issues of getting a server visible inside your LAN... a necessary first step.)
If you haven't worked much with IP addresses, DDNS, ports, servers: Scan what is below, and say to yourself "That sounds fun"... and then go off to the pages about putting things on the internet. You will thank me, in the long run! Or waste a lot of time learning the ropes the hard way, as I did... gathering "scraps" of knowledge in the wrong order!
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.
A new version of FarWatchWatcher, to go with the software I created for my 8266 Arduserver... or with the IOT device of your choice, if you can insert a line into the output the IOT device produces. (That software would "fit" in other IP/TCP capable Arduinos, too.)
The 8266 Arduserver isn't new, and most of the code for it would run in any IP/TCP capable Arduino. But I hadn't given you a like to its page before now.
All of the various "FarWatchWatcher" applications let you gather data from IOT devices and use the data. "Gather" across your LAN (easy) or the internet, depending on how widely visible your IOT device is. Most will build graphs of the data in real time. Most will save the data gathered in a machine readable file.
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.
Arduserver in an ESP8266!
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.
Use the link at the top of this section for all the software, etc, to create an Arduserver in an ESP8266, including an explanation of how to use an ESP8266 for an Arduserver. That Arduserver 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 by that Arduserver 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 tutorial pages about IP addresses, the DNS, dynamic addresses, etc., several times! The set of pages I mentioned earlier is my "latest and greatest" at October 2017. However, an earlier guide to TCP/IP stuff may be more to your taste. (If you happen to read both, I'd be interested in your views.) Both try to help you see how you can set a server up on a LAN or even to serve the internet. There are also 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! (NuElectronics is no longer with us, and for a minimal (but quite adequate!) Arduserver today, you would spend less than $40.
(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) ArduServer2... 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 have been 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". (But hat product has been retired. Sigh.) 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.) www.coolcomponents.co.uk used to offer something nice. And notes. Gone, Oct 17. Then there's the Freetronics EtherTen (was$70... Oct 2011... But "now", October 17: $45!! With micro SD card carrier!)... and it even has a PoE ("Power over Ethernet") option.)
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.
This page used to... and the "main", "current" copy of it still does!... have a RevolverMap here. They are very cool! If you have your own web-pages, get one! I've had several for years with no regrets.
What I had to say about RevolverMaps when I first installed it. (I feel the same way today!)....
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. At one point, you can track individual pages or page sets... I'm not sure that "page sets" is still supported.
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.
Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes.
- - - Page ends - - -