Arduino Forum

Forum 2005-2010 (read only) => General => Exhibition => Topic started by: physic.dude on Jan 17, 2011, 03:54 am

Title: My Arduino Web Server
Post by: physic.dude on Jan 17, 2011, 03:54 am
I went a little overboard on this project, at first it was just a basic "Hello World" type of sketch, and then it turned into this.
   http://physicsdude.dyndns.tv/
Keep in mind that this is an Arduino. So,if the web pages start to load very slowly, its probably because you are not the only one viewing the site.

Thanks to everyone who helped me on these and other forums, it was a fun project. ;D

Don't hesitate to ask me questions, I was thinking about adding an FAQ section in the future.
Title: Re: My Arduino Web Server
Post by: marklar on Jan 17, 2011, 01:51 pm
I have been looking to do something similar but no time yet, so your project may be a good starting point.

Thanks for posting your working CS card reading web server code - good stuff.
Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 18, 2011, 03:38 am
470 hits in 24 hours, cool.

I have a question though, is there a way I can change files on the SD card without removing it? Its a pain to take apart everything when I need to do so.

Title: Re: My Arduino Web Server
Post by: Glass on Jan 18, 2011, 03:29 pm
Very Cool !
like the poster above, a web server may be in a future project, and i'm sure your info will be helpful then.
Thanks !
Title: Re: My Arduino Web Server
Post by: marklar on Jan 18, 2011, 05:01 pm
Yes you should be able to change the files.  I have done test read and write to the SD card (not the same one, but same library I think).

So you could basically send from the computer to the arduino, via serial, a command that says "update file" and provides the filename and content.  The arduino would then write the file content to the SD card.

Naturally you have to program both sides of that (arduino and PC code).


Title: Re: My Arduino Web Server
Post by: arduinomstr on Jan 18, 2011, 09:51 pm
Very impressive! Thanks for posting physics-dude. You can learn a lot from doing projects like this  :)
Title: Re: My Arduino Web Server
Post by: Soapy29 on Jan 19, 2011, 12:06 am
How do you do the hit counter?
Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 19, 2011, 01:35 am
Quote
How do you do the hit counter?

If you are hosting a web page from HTML files on the SD card you are going to make the Arduino send out data 2 times, one of the HTML file and one from the hit counter and/or other HTML code written directly on to the Arduino which is not part of the requested HTML file.
I have the source on the site already but here are the hit counter sections:

First define the variables:
Code: [Select]
int hits = 0;
int bangs = 0;

The following code should come after the main HTML content is sent out,
Code: [Select]
        //Hit counter
         if(bangs >= 2)
         {  
           hits ++;
           bangs = 0;
         }
         bangs +=1;

         client.print("Hits: ");  
         client.print(hits);  
         //End hit counter

"Bangs" is simply a random variable I came up with. I'll be uploading new code soon and I changed it to something a little more understandable, "SentItems". It really doesn't matter what it is though.

Title: Re: My Arduino Web Server
Post by: klz327 on Jan 19, 2011, 01:44 am
Very nice project, and that box looks elite!
Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 19, 2011, 01:49 am
Quote
Very impressive! Thanks for posting physics-dude. You can learn a lot from doing projects like this  Smiley

Your right arduinomstr, besides learning more about the Arduino, I actually had to teach myself HTML since I decided to build most of the web site through a text editor. ;D

Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 19, 2011, 02:06 am
Quote
Very nice project, and that box looks elite!

Thanks,
The case was originally a really old 2 way parallel port selector box. Here is what it looked like before.
http://www.national-tech.com/hires/40d3-17602.jpg

Title: Re: My Arduino Web Server
Post by: barx on Jan 19, 2011, 07:10 pm
I think its broken mate. I keep pressing refresh but the hit counter isn't going up in the picture.

Only joking by the way. Awsome project, very well put together. I think that 1 should go down as a success.  ;)
Title: Re: My Arduino Web Server
Post by: barx on Jan 19, 2011, 07:10 pm
I think its broken mate. I keep pressing refresh but the hit counter isn't going up in the picture.

Only joking by the way. Awsome project, very well put together. I think that 1 should go down as a success.  ;)
Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 19, 2011, 07:26 pm
This project is not finished, I'm still working on it.
If I wanted to give it a version number it would be v0.83.

One think I really want to try to do is set it up where I can edit the SD card contents without removing the SD card, perhaps over the Ethernet or serial.
Any Ideas?
Title: Re: My Arduino Web Server
Post by: physic.dude on Jan 23, 2011, 09:01 pm
Just to keep things organized,
When the New Arduino forums are up, I will remake this topic over there.

Don't bother to post in this thread anymore, I'll be asking more questions on the new forum. :)