Arduino Web Server

Hello, I don't have an ardiono yet but I'm hoping to get one. It would help if you could point me in the right direction for setting up a web server on arduino that can write code in html, php, javascript, flash and maybe ruby and I also want to be abile to setup a mysql database. I understand this might take many units but I jest want to know if this is one, possabile and two, more cost effective then getting a old desktop computer. Thank you you help will be appreciated.

The size of the page that the Arduino can serve up is limited by the amount of memory that the Arduino has. If can serve up pages that have php statements or javascript code in them, but serving flash or hosting a MySQL database on an Arduino are completely outside the realm of reasonable.

Okay how would you do that and what would be the limit on traffic?

The limit of traffic will be determined by the connection speed of the WiFi or ethernet and the speed of the microcontroller’s CPU.

If you use a WiFi chip, you’ll be limited to the 802.11 speed on the chip you buy. The WiFi chip I looked at bragged a “Host Data Rate Up to 100 Mbps for SDIO, 44 Mbps for SPI and 2.7 Mbps for UART”

Converted into comparable terms:
SDIO = ~12 MegaBytes/sec
SPI = ~5 MegaBytes/sec
UART = ~330 KiloBytes/sec

Likewise for an ethernet shield. The ethernet shield I looked at supported 100BaseTX communication, so it can ideally provide 100Mbit/sec. (~12 MegaBytes / sec). However, like all things in the engineering world, the ideal is never the reality.

The microcontrollers commonly run at 16Mhz, so that may be a limitation if you have lots of web requests, but 16Mhz is plenty fast for processing most data.

Suppose for a moment that you reserve half of the CPU time for receiving and processing requests, and the other half of the time is used for transmitting data. I don’t think that’s terribly unreasonable.

8,000,000 hz = 8,000,000 cycles per second.
If we suppose that sending one bit is a single-cycle operation, then you’d be able to send 8 Megabits per second (ie: 1,000,000 bytes / sec). That equates to 976 KiloBytes per second (1KB = 1024 Bytes).

If sending one bit is a two-cycle operation, then you can half the output, and you get 488 KB/sec.

Likewise, if sending a bit is a 4-cycle operation, you end up with 244 KB / sec.

Even with the worst case scenario, most ISPs aren’t giving internet connections much better than 500 KB/sec unless you’re paying through the nose for it. And even then, the rate is partly determined by the remote host… how fast is their ISP letting them transfer from you?

On average, you’re probably looking at somewhere between 150 and 200 KB/sec for the run-of-the-mill internet connection, which it appears the microcontroller should be able to dish out fairly easily.

How much data are you planning on serving from the microcontroller? If you’re serving a regular text HTML page, that’s proabably 20 KiloBytes or less, so that would transfer very fast, even with several people requesting it at the same time. However, if you’re hosting 100 KB - 500 KB pages, it might take a few seconds to load, and longer if you have multiple people accessing it.

Well idk I might try to jam as many php pages as i can. I dont think you answered my question which was what was the limit on many users can to one arduino with with enthernet shield (sorry for my spelling)

I'm using a Pogoplug (running Plugapps linux) for exactly this purpose.

The Arduino with Ethernet shield is limited to 4 simultaneous connections.

I might try to jam as many php pages as i can.

With a 2K memory limit, much of which is taken up by the server code, that won't be very many pages.

Thank you for your help I might come back later if I have any problems.

If I'm correct php pages are interpreted on the server and generate data (most of the times HTML ++) to be send to the browser. Don't think an Arduino has a php interpreter (yet?).

I might try to jam as many php pages as i can. With a 2K memory limit, much of which is taken up by the server code, that won't be very many pages.

Think you can only serve HTML pages , but by adding an SDcard there is virtual no limit how many of them you can serve ..

Arent the ethernet shields limited to 4 active connections?

http://arduino.cc/en/Main/ArduinoEthernetShield

The first paragraph confirms 4 simultanious socket connections.

True, you only have 2KB of ram in which to store the page, but it could be stored in program memory too... up to 32KB that way. But if you're really wanting to display much more than that, you can get an SPI ram chip, or an SD card.