Go Down

Topic: My Arduino Web Server (Read 9275 times) previous topic - next topic

physics-dude

Jan 17, 2011, 03:54 am Last Edit: Jan 17, 2011, 04:03 am by physic.dude Reason: 1
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.

marklar

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.

physics-dude

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.


Glass

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 !

marklar

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).



arduniomstr

Very impressive! Thanks for posting physics-dude. You can learn a lot from doing projects like this  :)

AKSoapy29

How do you do the hit counter?
Andrew K.

physics-dude

#7
Jan 19, 2011, 01:35 am Last Edit: Jan 19, 2011, 01:37 am by physic.dude Reason: 1
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.


klz327

#8
Jan 19, 2011, 01:44 am Last Edit: Jan 19, 2011, 01:45 am by klz327 Reason: 1
Very nice project, and that box looks elite!

physics-dude

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


physics-dude

#10
Jan 19, 2011, 02:06 am Last Edit: Jan 19, 2011, 02:07 am by physic.dude Reason: 1
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


Barx

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.  ;)

Barx

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.  ;)

physics-dude

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?

physics-dude

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. :)

Go Up