Introduction: ServDuino - Build Your Own Arduino Web Server

Picture of ServDuino - Build Your Own Arduino Web Server

The Arduino Ethernet Shield is a sweet toy!!!  Everybody, from the beginner who got their Arduino yesterday and hasn't slept since, to the hard core pro who learned c as a second language, can learn how to use the Ethernet Shield and have lots of fun with it.  Its that awesome! As soon as I earned enough to get one, it was mine, but it took a while for me to figure out how to get my site running and on the web, and I had some trouble with the software, but once I got started, I designed a whole web server, which included a traffic meter, LCD screen, and SD card storage!

This instructable is going to show you how you can make your own "ServDuino" web server, and get it on the web without some of the roadblocks that I, and many others have faced.

Some of this instructable is a work in progress - specifically the code on the programming step.  Not all of the code was released as of the publishing of this instructable because I am always improving or writing new code for my projects.  I am also seeking help from the instructables community in writing code, not because I am lazy, but because I know that I don't have the most efficient code, as I have been programming in c for only a few years, most of which is spent in the world of Arduino.

Don't forget to rate!
I entered this into the Microcontroller contest, so if you think its awesome, or it helps you off the ground with the ethernet shield, vote for it! :)

Step 1: What You Will Need

Picture of What You Will Need

For this project, you need only 2 things minimum to make it work.  Everything else is extras that you can include if you want to.

The Required Parts are:
An Arduino
An Arduino Ethernet Shield - Note:  If you have an older shield, you will not be able to use an SD card with it.  If you don't have a shield, get the newest version!!!

Optional Parts:
A box to put it in - Recommended
A Servo
An LCD Screen
Some LEDs
An SD Card

Even More Optional Parts - These are for external controls and/or sensors:
A Second Arduino
Whatever sonsers and controllers you want
Either a Long Cable or a wireless Transciever (like an Xbee)

Step 2: Getting Started on the Web

Picture of Getting Started on the Web

The first thing you will need to do is put the Ethernet shield on the arduino.  If you need help, line up the pin names on the shield to those of the Arduino.  Then plug it in to your computer and connect an ethernet cable from your router to the Arduino.  Open up Arduino IDE and run the WebServer example under arduino-00xx -> libraries -> Ethernet.

Open up your favorite web browser and type .  You should see something like the image below.  If it does not work, DO NOT PANIC!!!   You probably have an Internet Service Provider the blocks port 80, the standard http port.

To test this, we will try one of the following ports 8080 or 8081.  Go to the WebServer sketch and find the line that reads: Server server(80);  It is at the begining of the sketch.  Change 80 to 8080 or 8081.  Now upload.  To get on your site, however you will need to type: or .  If it works, Great now you can move on to the next step!!!  A great place to look at for forwarding help is .

Before you get excited and call up your friend to get on, we have a problem.  The IP address you site has can only be accessed by a computer connected to your router.  Nobody else can access it.  How do we solve this??? We use port forwarding.  This can be easy or hard, depending on how you and your router make it.  You will need to access you router's settings page and search until you see a link or tab or whatever that is named port forwarding, or port forwarding/port triggering, or similar.  Go to that page, and select a new http service.  Type the IP of your webserver, and set the starting and ending ports to 8080 or 8081.  Save changes and now people can access you website from outside your router.  But you will need a new IP. Your router's IP.   Go to .  No go to your IP at or With this and is and my and ip being the respective numbers of your address.

Now call your closest friends up and have them look at it.  But wait!!! There is still a problem, remembering all of those numbers can be a pain! We are not very good at remembering strings of numbers, but we are good at remembering words and names.

To fix this you will probably want to get an actual domain name, like  The easiest way to do this is to go to and sign up for a free account and choose a free domain name.  These include yourname .dyndns-something .com or yourname .dyndns.some2or3letterending .  Now set this domain to your router's ip.  To go to your site, you will type http://yourname.dyndns.whatever:8080 or 8081, depending on your server port. The http:// is needed in Internet Explorer, but not Firefox for ports other than 80.

The last step you can take (optional) is to make a webhop so that you don't have to type the :808x onto the end.  I have pointed to my router's ip, and set as a webhop to .  For websites on port 80, the http:// is not necessary.

Now that you have the site on the web, you can build the server, and design your site!!

Step 3: Building the Web Server

Picture of Building the Web Server

While I am going to show you my web server design, it is totally up to you how you would like to layout and design it, but here are some guidelines.

I would suggest putting the arduino in a corner, so that there is access to the power, usb, and ethernet port and the SD card slot.

I would also reccomend using a sturdy box, the one I used wasn't very sturdy, and now the weight of the servo is making it sag in the middle.

If you plan to attach an lcd screen, solder wires to it, and connect them to the ethernet shield before putting it in the box, 8 wires are a lot to connect inside of the box!!

Step 4: Connecting Your Devices

Picture of Connecting Your Devices

As with everything else with this project, you have a choice in what other stuff you want to add to your ServDuino.  I have a few suggestions and rules that you should follow to make this a successful build.

The Servo.
The servo is simple to connect, attach the red wire to +5, the black to gnd and the yellow (or third wire) to a pwm pin.  On the main board the pwm pins include 3,5,6,9,10,11.  Pins 10 and 11 CANNOT be used, however, because they are used for the SPI communication with the ethernet shield and SD card.  I would reccomend not using pins 5 or 6 either if you are using a delay or millis() because there is a jitter that can be annoying if your ServDuino is next to the computer!

The LCD Screen.
 A character LCD screen can be connected with as few as 6 data pins.  Which is good because there are exactly 6 digital pins left over. Now before you comment and tell me that there is actually 9 pins, let me explain.  We've used pins 13,12,11,10 and our choice of 9,6,5 or 3.  Thisl leaves 9 pins. BUT, we need a pin for the SPI communication to the SD card, which is pin 4.  Next, we must remember that the Arduino uses the UART to upload its sketches, so we don't want to use pins 0 or 1, just in case.  Now how do we connect the LCD screen with only 6 pins, like this:

Vss is tied to ground.
Vcc is tied to +5 volts.
Vo can be tied to ground, or you can attach a potentiometer to it.
RS is tied to a data pin. Remember what pin!!! Or better yet, write it down!
R/W is tied to ground.
E is tied to a data pin.  Write it down!
DB0-DB3 are not connected.
DB4-DB7 are tied to data pins.  Write it down!!
Backlight pins can be tied to their respective voltage source.

Analog Sensors:
Analog Sensors are very straight forward, but on the newer ethernet shield, and maybe the older ones too, there is 10K ohm resistors tied to +5v on analog pins 0 and 1.  Watch out!!

Xbee and Serial communications:
Well, I don't have very much to offer here, I don't have any Xbees...yet...but I would like to offer some suggestions.  Anytime you need to upload a sketch, you will need to either switch out the xbee jumper or disconnect the serial wires (if you are not going wireless), so you may want to try putting a jumper select on the server box.  If you don't you will have to rip it apart to upload a sketch. That's not fun, trust me.

Step 5: Designing Your Site

Picture of Designing Your Site

Here is where you have to start thinking about what you want your site to look like and do, so that you can choose how you want to store your site's information.

If you want to have a very basic site, maybe only one page, or you want to be able to control some led's or light switches or whatever your heart desires, you should go with a site saved in the Arduino's ram.

If you want to have similar capabilities, but you want to have more than 1 page, you will want to consider using the code with PROGMEM.

If you want a regular site with pictures and videos and lots of pages, or whatever, you will want to look into using an SD card.

Limitations and features:
With the ram option, the site can be only like 1500 characters (of html codes, not of actual text) which is very limited, but it is good for a simple led (the led could be anything actually) controller.

With the PROGMEM option, you are much less limited.  With an atmega328, you can store up to 12,000-13,000 html characters!!!  This is suited for home automation or a multipage site w/o an SD card, but you cannot store pictures or files on it, and you are still limited to 12k characters.

The SD card is the best choice for a large site, with lots of scripting, pictures, pages, etc. But as of now, it cannot be used to control leds over the web, but I'm working on it though! I am also working on directories and using the SD library instead of the sdfatlib (but don't expect it for a while because my main focus is on a led controller and directories, unless the 'ibles community would like to help!)

Step 6: Storage Options

Picture of Storage Options

This is a more in depth view of the storage options I explained in the previous step.

The first option is to store the site in the Arduino's ram.  This is the simplest way because you simply call the client.print() function and write your html code inside it.  It is limited to about 1500 characters, because the Arduino only has 2048 bytes of ram.* 
Ex: client.print("<html>...</html>");

Program Memory:
Wouldn't it be great if you could store the code in the program memory instead of the ram.  Well, actually, the above option does that, but the compiler then makes the micro read all of that out into the ram upon start up.  How do we fix that? We use the PROGMEM Library, pgmspace.h.  This tells the compiler that we want to leave the data in the program memory.  Now we are able to have 12k characters.*  The only problem is that the micro tends to freeze up easily, but I have a workaround for that in the Going further step.

The SD Card:
When It comes to storage amount, the SD card is definitely the best choice.  You can have up to 64GB of memory!!  The biggest problem is that it is not recommended for the Duemilanove with ATMEGA168 or older, because it compiles at about 16000 bytes at minimum.  I rarely have freezing problem with the SD Card, unlike with the PROGMEM code, and I am very close to getting a working led controller code.

Step 7: Programming!!

Picture of Programming!!

Here is where the fun - or frustration - begins!!  You are now ready to upload the sketch of your choice and test your web server!!!

I have a bunch of sketches here for download.  I will be listing them in the following categories: RAM, PROGMEM, SD.  I will give a quick rundown of each sketch and what its functions are. I will provide a sketch with each new function.  It is up to you to combined them in whatever combination you want.

RAMWebServer_Basic - Basic Ram WebServer Sketch.
RAMWebServer_Control - Code to control and LED included.
*More coming soon!!

*More Coming Soon!!

IMPORTANT:  The SDFat Files will not compile if you don't have SDFatLib and/or you have the SD.h library (included in Arduino-0022)
SDFatWebServer_Normal - Basic SD Card WebServer Sketch
SDFatWebServer_Fast - Contains a buffer between SD card read and Client write functions, making uploading much faster
SDFatWebServer_Normal_404 - Has code for a customized 404-file not found page, called 404error.htm
SDFatWebServer_Fast_404 - Has code for the 404 page and the buffer
SDFatWebServer_Normal_LCD - Has code for an LCD screen hit counter
SDFatWebServer_Fast_LCD - Has code for the LCD and the buffer
SDFatWebServer_Normal_Servo - Support for a web traffic servo meter.
SDFatWebServer_Fast_Servo - Servos and Buffers, what better?
*More coming soon!!

Step 8: Going Farther

Picture of Going Farther

If all went well, you now have a working ServDuino web server of your own!!  Now you can try different codes, and even write your own, and if it is good, send it to me and I will post it on the instructable and credit you for it!!!

The server likes to freeze up a lot when running using the PROGMEM storage.  An easy fix would be to use the watchdog timer, but the problem with that is that when it resets, the Arduino goes into an infinite loop, because there is something messed up in the bootloader.  The easiest thing is too make an external watchdog with a 555 timer, but if you want to keep it software based, you will need the ladyada bootloader .  This enables you to use the watchdog timer to reset the frozen Arduino.  Now you have another problem with going software though.  You still need to reset the ethernet shield.  How? Cut the reset pin off of the shield then run a wire from it to a pin of your choice.  Now you just set the pin high in setup() then bring it low for a few microseconds before you initialize the ethernet chip later on in setup().  A watchdog can also be useful in the RAM and SD options.

SD Card favicon.ico:
When I was testing the SD Card codes, I had the USB cable plugged into a computer and had a terminal monitoring the incoming serial.  When somebody gets on the site, the Arduino sends what page they just requested.  I noticed that whenever somebody went to the homepage, there was also a request for a favicon.ico.  The favicon.ico is the little icon in the address bar, on the tab, and in the favorites folder next to the site.  To get your own favicon.ico, you will need to find an online favicon generator, (google that) make your icon, then download it and put it on your sd card, in the root directory (not in any folders).  If you have the site saved as a favorite, delete the favorite, and go to your site.  You should see it appear.  Note:  If you go into paint and make one and save it as an .ico, internet explorer will reject your favicon.  It will work in firefox and chrome, but not in ie.  If you want you can also make the browser request the favicon by putting this into your homepage html file(index.htm): <link rel=shortcut icon type=image/x-icon href=favicon.ico>

Now go have fun, and rule the web!!


marco_righe (author)2015-05-16

Thank you !!! the code :

if (c == '\n' && currentLineIsBlank) {

// send a standard http response header

client.println("HTTP/1.1 200 OK");

client.println("Content-Type: text/html");


client.println("your html code will go here. You cannot have any double quotes in it, however, because that will end the client print function "like this");



if (c == '\n') {

// you're starting a new line

currentLineIsBlank = true;


else if (c != '\r') {

// you've gotten a character on the current line

currentLineIsBlank = false;




make my project a lot more fast and reactive!!!!

haduvokone (author)2015-02-08

can i host a blog on this? And use php?

Amol AshokraoG (author)2015-01-22

I have already completed the controlling of devices through internet using buttons.I used Arduino Uno+ SD CARD+ Ethernet sheild. Now I want to modify it so that used can send text commands through form submission to control the same.

I could do it when I was using the Arduino Uno Memory for HTML code but now facing problems when I am using SD Card for HTML. Expecting the code module for the same.

rinksrides (author)2014-12-13

I had something similar to this working earlier this year (March), but ran out of time to finish it till this winter it used the SEED ethernet 1.1 without SD. Boy that was interesting to figure out how to share the ISP header with two conflicting shields, but I got it to work reliably with some external logic (looked like a rats nest). Home automation at it's best. 70m/150W of LED strip lights, under cabinet lighgting, oh, and controlled HUGHES lights also from a webpage with a colormap. What a PIA that was to figure out, needed two separate maps cuz hughes doesnt use standard RGB colors in their lights. the green is more lime green, the blue is more like teal, even the red is a bit washed out. Nice writeup though. Side note, If you have a MEGA ADK, you can use the USB lib's to access an external HDD/SSD, so you wont be limited to an 64GB SD..

Topcam (author)2013-02-02

Hello, my English is not so perfect. (GOOGLE German ->ENGLISCH)
Catch just me with the Arduino and its potential deal.

Since I need a web server that reads all data from the SD card
I have the script on my Arduino SDWEBSERVER_FAST_LCD.

Running with the DYNDNS perfect.
Only when I: http://NAME.DYDNS.COM/test/ (here in directory there is an index.htm) write, appears donload windows.
I give but a http://NAME.DYDNS.COM/test/ index.htm
goes to the page.

There's an error in your script?

My question 2:

I would now like Led and power switch on the Web, but the code is not in the store Adruino special embed in the HTML file.
Adjust so I just need to code the HTML and not always in the code Ardoino.

Is that how and when do you do that?

Thank you.

Krayzi99 (author)2012-11-29

Just a thought, is this compatible with custom 404 error pages?

Teslaling (author)Krayzi992012-12-03

Yes. In the _404 sketches, there is the option to have a custom 404 page. You just have to make the page and either name it 404error.htm like what is in the sketch or put the name of your 404 page as the name to replace 404error.htm. The line has a comment after explaining what it is. Look for that then find the filename and replace it with your file's name.

Teslaling (author)Teslaling2012-12-03

I should note that the custom 404 pages are only available with the SD card sketches.

charlesfries (author)2012-11-18

Just for people receiving errors when using the SD sketches, "Server" must be renamed to "EthernetServer" and "Client" must be renamed to "EthernetClient"

Teslaling (author)charlesfries2012-12-03

Yeah, sorry. I need to update some of this instructable when I get the chance, including making the sketches work with the new ethernet libraries.

botronics (author)2012-10-28

DealExtreame has a low cost Arduino Ethernet shield. Has anyone got it to work?

botronics (author)botronics2012-11-04

I got a report from someone that the DX one doesn't work well. They use a different chip than the Arduino standard chip. The drivers don't work with Arduino 1.01. The Arduino-brand ethernet shield works perfectly. Newark has them:
Newark Part Number: 65T3485

Vee20 (author)2012-10-11

My server just won't work. I'm using google chrome. I changed the port to 8081. Is there anything else that I should check? I have already disabled MAC filtering on my router. Need help urgently as I can't get any further with my project without this step.
Thank you so much for the helpful Instructable.

N.fletch (author)2012-09-16

Hello, I am a follower of yours and I wanted to say thank you for this Instructable you posted. I used this quite a bit with a wireless bridge to create my latest robot!

salvocanna (author)2012-07-29

I made something like this but with arduino and a relay... very easy and cheap (enc28j60 is something around 6$) ... check it:

Krayzi99 (author)2012-07-14

Great Ible! This is EXACTLY what i have been looking for! on a side note, if you want the website to appear like instead of something like then go to, and they'll redirect people to your ip. Thats what I'm gonna do when I build my server XD.

Krayzi99 (author)Krayzi992012-07-14

just noticed you had something from dynds... no-ip is also good, so choose that if ya dont like dynds.

Teslaling (author)Krayzi992012-07-17

actually, dyndns doesn't provide that service anymore :( I am going to rewrite that set anyway since it can be confusing and misleading.

Good luck with your server! Glad you found this 'ible helpful!

Krayzi99 (author)2012-07-14

Is there a way to combine 2 of these for faster connection? I would be willing to make 3 of these if i could. I'm thinking it could be as easy as having all 3 having the same ip, but I don't know. Any suggestions?

Teslaling (author)Krayzi992012-07-17

I don't know how or if you could combined them for a faster connection. All having the same IP would NOT work though. If all three tried to respond to a request, there would be a network collision. It would be like 3 cars pulling up to a 4 way intersection and all turning onto the same road at the same time :)

Unfortunately, I think the only way to speed up the connection would be to use parallel communication with the wiznet chip. That would require a rewrite of the ethernet libraries.

As to the FTP, I don't think it would be possible. The Arduino libraries only allow 1 open port, and to have http plus ftp would require 3 ports (ftp takes 20 and 21). Plus you would need a way to store the files to the card...Things would become very complicated very quickly.

Krayzi99 (author)Krayzi992012-07-14

also, is there a way to edit the file contents vis FTP? i know i ask alot of questions... thanks for all your time in advance!

j1nai (author)2012-06-02

Helloo.. I have question, Can I reload/refresh reading analog sensor without using html meta tag like , because I think this is client side script. I need server side functions maybe like continuously timer or looping function in every time to call analogRead(i); and print to web browser..

anyone have idea to give me an example, thanx...

nmg196 (author)2012-03-30

I think step 2 is very misleading for the reader. The examples use internal IP addresses and yet the article implies that if its not working then your ISP might be blocking ports. These are internal IP addresses which your ISP cannot touch or affect in any way (in fact you do not need internet access or an ISP for this to work). It also fails to mention the vastly more likely reason for it to not work which is that the default IP address used in the example might not be an IP address routable on your LAN (ie if the example uses 192.168.1.x addresses, but your own LAN uses 10.0.0.x addresses). The article should advise the user to change the IP address in the example to an IP address on their own subnet (which you can find by running ipconfig). In that paragraph it also mentions which is irrelevant for testing this project on your internal network.

I think all the right text is there but the stuff about blocking ports and port forwarding should be moved to the relevant paragraph instead of sending people on a wild goose chase when trying to sort out a problem in their LAN :)

The line which says " Somebody could get into your router through your firewall and access personal information" when all they have is your IP address just makes me angry. IP addresses are public information - you reveal it to everyone every time you send them an email or give out the domain name. This statement is totally wrong and just confusing for the user and the author clearly doesn't understand the basics of the Internet. You cannot get through a firewall and access personal information (that's the entire point of a firewall). Similarly, if you give them a domain name, then that obviously reveals the IP address too as you can see if you "ping" the domain name and see the IP - it doesn't hide anything.

Teslaling (author)nmg1962012-05-11

Thanks for the feedback.

I now realize that this step is misleading and incomplete. When I find the time, I plan on rewriting it to be much more organized and systematic.

As to the firewall and ip issue, I feel stupid and ignorant now having wrote that a while ago. I understand that that is false and confusing information. I have replaced it with a more reasonable substitute: We are not very good at remembering strings of numbers, but we are good at remembering words and names.

I hope that this comment and future work will help to clarify the process.

nmg196 (author)Teslaling2012-05-11

Thanks, but although I can see you've made a few corrections, the article still seems to treat internal IP addresses as though they were external and still places the blame on the ISP. This is still very misleading. It seems you didn't understand anything I was saying so there is little point in me commenting further if you do not understand my explanations. I will simply caution the reader that the majority of the text on this page is incorrect and actively misleading.

Teslaling (author)nmg1962012-05-11

Yes I know that, I said that when I can find the time I will fix it up. I am actually really bogged down right now with such things as the Intel International Science and Engineering Fair this coming week, school work and finals, and an upcoming trip to Germany (during what should be finals week).

I understand the issues and I understand perfectly what you are trying to say, believe me. Basically I will break the step down into a few main paragraphs. The first being about finding out the router's ip range and testing the server with the default program. The second being about port forwarding and alternate ports. And the third paragraph being on finding the external ip and testing the server from it. If I find three paragraphs to be too crowded or misleading, I will break it up even further.

Trust that at some point I will fix the issues but also understand that they are of little concern to me as of present.

iApple guy (author)2012-03-30

What is your site address, I want to visit it!!!

Teslaling (author)iApple guy2012-05-11

its currently however, it is not served by the duino anymore. I needed more speed and I wanted to try some other things with the duino and ethernet shield.

crackHacker (author)2012-04-01

dyndns no longer offers free dns service.

Teslaling (author)crackHacker2012-05-11

yup just found that out a few weeks ago

Piobel (author)2012-05-11


Sdwebserver fast don't work With arduino UNO.

Client.write(buf,maxbyte) don't send data.

Tanks for attention!!!

diy_bloke (author)2012-04-26

You could actually store a (small) picture in your atmega eeprom, but it would not be a very efficient way of using memory. Also retrieving it from that eprom to display on a webpage might be less than straightforward and no doubt a bit slow

diy_bloke (author)2012-04-26

Tend to agree with nmg 196. The 192 series of ip numbers are internal numbers and have nothing to do with your provider blocking your port 80.

indeed, better to change tje ip address in the program to one that is available on yr network and that depends on the router you may be using. Some go in the range, others in the range, or even the adress range as mentioned earlier.

If someone had my -external- ip address and I have a webserver running, then indeed by typing in that ip address, they could have a look at the main page of that websever, provided I had forwarded port 80. But that is still a far cry from being able to access my personal information, unless I would put that on that particular webserver.

As most arduino / ethernet adepts will probably use it to read out temperatures and put that on a web page, All the culprit wld be able to see is how warm your house or garden is.

It would be different ofcourse if you set up a webserver ro control functions, then any passer by (provided you have an open webserver) could alter functions in your house, like switch the lights on or off :-)

Timoteo_Mendes (author)2012-03-08

Very good tutorial.
Is what i have been looking for.
Thanks for sharing.


Teslaling (author)Timoteo_Mendes2012-03-08

Thank You. I'm glad it helped.

doby162 (author)2011-06-23

This looks really cool! I can't download your code files though, when I try I just get .tmp files. I can read them by converting them into text documents but they are still a little jumbled. How much control does one have with a server like this? You mentioned using exbee to control devices over the web, but would those devices be able to simultaneously upload significant sensor information? (live video for instance) Thanks for sharing! I might have to make one of these. :oD

Teslaling (author)doby1622011-06-23

Thanks! That weird with the files though, I might put them in text documents then. You can control quite a bit with the arduino, assuming you can run all of the connections. I had it controlling an rgb led with 8 bit pwm (0-255) control for all 3. You could have it sending sensor data simultaneously (well, it would appear to be, but it would have to run through all of the sensors in quick succession), but it couldn't be a significant amount, like live video, that would swamp the ethernet controller. As long as you have the hardware (and enough program memory) you could probably automate every light switch, thermostat, and door in your house!!!

Rainbowjeremy (author)Teslaling2012-02-29

Great instructable! Can you post the code for the web controlled RGB LED? I'm not to familiar with programing and I am getting a message that says "sd2Card does not name a type" when trying to compile the "SDWebServer normal.txt." file. any ideas?

Teslaling (author)Teslaling2011-06-23

The Code is now in text document form

Daniel Deacon (author)2012-02-03

Can you help me please, i need this code made so it works with arduino website



// variables for input pin and control LED
int analogInput = 1;
int LEDpin = 13;
int prev = LOW;
int refresh = 1000;
float vout = 0.0;
float vin = 0.0;
float R1 = 45000.0; // !! resistance of R1 !!
float R2 = 4500.0; // !! resistance of R2 !!

// variable to store the value
int value = 0;

void setup(){

// declaration of pin modes
pinMode(analogInput, INPUT);
pinMode(LEDpin, OUTPUT);

// begin sending over serial port

void loop(){
// read the value on analog input
value = analogRead(analogInput);

if (value >= 1023) {
else if (value <= 0) {

// blink the LED
if (prev == LOW) {
prev = HIGH;
} else {
prev = LOW;
digitalWrite(LEDpin, prev);

// print result over the serial port
vout = (value * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));


Serial.println(" volt");

// sleep...

Teslaling (author)Daniel Deacon2012-02-04

Hi Daniel,

In order to help you get this working, can you please give me some insight on what you are trying to do? I would like to know what this code is supposed to do and how you want me to get it working with the webserver programs. If you could please, can you tell me if you are trying to make this work along side the code or make all of the information in the Serial.print lines be displayed on the webpage? If you get back to me with some information I will gladly give assistance as best as I can.

Daniel Deacon (author)Teslaling2012-02-05


I would like to make a web server with a voltmeter it doesn't have to be anything fancy just something like 'Solar Panel Battery Voltage' '12.24 Volts'. The code I posted was an example of how the volt meter works. I don't know how to add a code along side the main bit that runs the server.

Thanks for your help! :)

I meant to add I wish to have it displayed in the web page all the serial communications :D thanks

Teslaling (author)Daniel Deacon2012-02-06

Thank you for providing that information, it really helps.

I must apologize for I am really busy right now so I probably won't be able to get the code running and tested until later in the week. If you need it before Friday please let me know and I will do my best.

Sorry once again,

Teslaling (author)Teslaling2012-02-10

Hi Daniel,

I wrote and tested the code and it works. If you have any question about it or need help with anything else, please ask.


Gelfling6 (author)2012-01-19

Making a page-dump of the entire project. It may be exactly the thing I need for a WiFi Controlled robot I've been working on, based on the Arduino, and using a mini WiFi router.. Thanks!

Teslaling (author)Gelfling62012-01-19

Cool! I hope you can get it up and running. I would like to see pictures of even a video if you can get it working!

cinezaster (author)2011-11-22

Have you tried multi html pages, with images stored on the sd card and js or css files loaded from the arduino.
Because I'm going to make my office controlled by a ethernet arduino.
Controlling lights and powersources and showing some enviromental data on a webpage.
I was thinking to pull and push the data and controls by ajax.
Arduino by itself is no problem but I never tried the ethernet shield and/or the SD libraries.
And I'm going to use the ENC28J60 ethernet module.
I hope there is enough space on the arduino chip.

Teslaling (author)cinezaster2011-11-22

Actually, I have successfully had multiple html pages with images and css files, but they were all loaded from the SD card. The Arduino has no filesystem so all pages have to be loaded from the SD card. I had my website being served by the Arduino, which included images and videos. The only reason it doesn't anymore is because i just had too much content for it to handle. Be careful because it is very slow at loading files larger than 1MB.

tatazm (author)2011-07-26

Nice works. I am trying to build a small robot controlled wireless via xbee and ethernet shield.

About This Instructable




Bio: I like to make things that move, sense, calculate, compute, blink, and make noise. I like making things that create high voltages, electrical arcs, and ... More »
More by Teslaling:The Valve Caster 2.0: Tube Boost and OverdriveBuild Your Own 555 TimerHelios 3: Homemade Rocket Candy Powered Rocket
Add instructable to: