Tag Archives: HTTP

Arduino Web Server

IMG_0244

Winter break means plenty of time to toy around with something new. I’m not sure what inspired this project, perhaps the ethernet driver we designed for our Operating Systems course, but I’ve decided to explore the field of embedded networking. And you can’t get much more embedded than a 16 MHz Arduino Uno with 32K of memory.

Goals

I want to create an Arduino-based web server, but with a few twists, because the idea already exists and has been implemented. The first link points to Lady Ada’s quick and dirty Arduino file server, which can serve up character-based files stored on micro SD. The second link offers a more functional server called Webduino, which claims to offer image support (ie. binary transfers). However, reading through the code, it looks like the developer took the easy way out by re-encoding a PNG as hex values, and then sending those values byte-by-byte over the network. That’s not image support! Also, both implementations seem to suffer from the limitation that only one client can connect at a time.

Because the Arduino has no formal notion of threads, it would make sense that multiple clients just won’t work. But I’ve been reading up on a project called Protothreads, which adds the most basic threading you can imagine. No separate stacks. No pre-emptive scheduling. Just a way to give the appearance that two computations are concurrent. I’m hoping that I can use protothreading to allow multiple clients to connect.

Additionally, it would be nice to find a way to do binary transfers. Glancing at the EthernetClient and EthernetServer API, it looks like they’re both set up for byte transfers. I wonder if there’s a way I can trick it into sending binary information. We’ll see.

Update – 26 January 2012:

I found an easy way (untested) to get the Arduino to send non-text content over the EthernetClient interface. When a client requests a file of a certain type, say, PNG, you can send a response indicating that you will be sending PNG binary data byte by byte as follows:

I hope to test this technique soon. Admittedly, I still have a long way to go on this project, but other projects (iPhone app, stay tuned) keep arising.

Webcrawler and Search Engine

Screen shot 2010-10-26 at 1.22.52 AM_1

We first designed a webcrawler in C++ using a provided HTTP interface to “crawl” a list of initial URLs to a maximum depth. Along with archiving URLs, the crawler stored the textual words on a webpage for searching purposes and a 100-word description of every page.

Next, we designed a search engine that preprocessed the results of the webcrawler to store data in one of three data structures:

• Array
• Hash Table
• AVL Dictionary
• Binary Search Dictionary

We used an HTTP server provided to format HTML pages to display results of queries, as well as display search times to compare the different data structures’ efficiency. We called the search engine Boogle, as a combination of “Boilermaker” (Purdue Boilermakers) and Google.