Sharks and Sticky Tape

Okay so to get started with I had to rewire the ethereten to the breadboard because I had to disconnect it when the etherten failed. I realized that I’ll probably use my etherten a lot even after I finish this server so I used some sticky tape to secure the pins in place in order. This means I can unplug the board easily.

Sticky tape

The slightly more secure wiring

The second cool thing that I want to show you before we delve into the server’s code is this awesome old shark pen that I found in my room. It’s got an awesome LED that lights up all different colors automatically.

Here’s a short demonstration showing what I mean:

shark light

A very cool pen

So that basically solves the problem of making my server look awesome at night. And the best thing is that it doesn’t need any PWM or any other fancy stuff because it has it’s own internal chip and acts just like a normal LED in circuit so I can just plug it straight into digital pin 8.


Set it up

Let’s start with the arduino configuration (setup) code:

void setup(){

  /*Analog pin configurations*/

/* LED number display control*/

  /*Digital pin configurations*/  

/*Digital pin 8 is not in use at the moment being left spare 
so it can serve as an ethernet
host for other arduino devices in my room. 
Or to turn on and off the cool LED that I found in an old pen.*/
pinMode(9, OUTPUT);//PIEZO
pinMode(8,OUTPUT); //awesome shark pen.

So that stuff basically tells the chip what each pin on the chip is going to do. I also added what is connected to each chip for easy reference when writing the code.


This part was pretty easy to do as I have experience in web development. Here’s what the output of the server looks like:

Screenshot of the server

Screenshot of the server's HTML output

As you can see I went for a very “hacker” kind of look because the thing is 8 bit and primitive. I’m not going to claim I can play flash games on an arduino like this guy:

I mean all he did was use iframe HTML tags. Meh.

And here’s the code that powers the server output:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ardu Server</title>
	<style type=text/css>
		font-family: Courier;
		color: green;
		background-color: black;
		font-size: 30px;
		font-family: Courier;
		color: green;
		background-color: black;
		font-size: 60px;
		<h1>Welcome to ardu serve v1.0</h1>
		<p>Server has not been stolen recently</p>
		<p>Lighting is on</p>
		<p>Temp = 36.15 degrees celsius</p>


But to simplify things when we are putting our HTML into our arduino code I deleted all the indents. There’s not much point repeating that here.

I tried to unindent my code and it didn’t quite work as planned. Don’t just try cramming the webpage into on a line because the Arduino IDE only allows certain number of characters in a line before it cuts them off. I’m not about to write client.println() for every line in my HTML. So I guess I might have to go and do it like this guy.

// HTTP Request message
PROGMEM prog_char content_404[] = "HTTP/1.1 404 Not Found\nServer: arduino\nContent-Type: text/html\n\n<html><head><title>You Fail</title></head><body><h1>Looks like Lochie Ferrier has failed in his duty to maintain the arduserver</h1></body>";
PGM_P page_404[] PROGMEM = { content_404 }; // table with 404 page

// HTML Header for pages
PROGMEM prog_char content_main_header[] = "HTTP/1.0 200 OK\nServer: arduino\nCache-Control: no-store, no-cache, must-revalidate\nPragma: no-cache\nConnection: close\nContent-Type: text/html\n";
PROGMEM prog_char content_main_top[] = "<html><head><title>Arduino Web Server</title><style type=\"text/css\">table{border-collapse:collapse;}td{padding:0.25em 0.5em;border:0.5em solid #C8C8C8;}</style></head><body><h1>Lochie Ferrier's arduserver</h1>";
PROGMEM prog_char content_main_menu[] = "<table width=\"500\"><tr><td align=\"center\"><a href=\"/\">Home</a></td><td align=\"center\"><a href=\"page2\">Page 2</a></td><td align=\"center\"><a href=\"page3\">Page 3</a></td><td align=\"center\"><a href=\"page4\">Page 4</a></td></tr></table>";
PROGMEM prog_char content_main_footer[] = "</body></html>";
PGM_P contents_main[] PROGMEM = { content_main_header, content_main_top, content_main_menu, content_main_footer }; // table with 404 page
#define CONT_HEADER 0
#define CONT_TOP 1
#define CONT_MENU 2
#define CONT_FOOTER 3

// Page 1
PROGMEM prog_char http_uri1[] = "/";
PROGMEM prog_char content_title1[] = "<h2>Page 1</h2>";
PROGMEM prog_char content_page1[] = "<hr /><h3>Content of Page 1</h3><p>Nothing... yet.</p><br /><input type=\"text\" name=\"prova\">";

Basically he stores the webpages as part of the chip’s program memory. He has a five page system that even has get and post functions. When it gets a request it does some freaky deaky stuff that I don’t understand and gets the requested webpage along with a template (headers etc) and spits it out to the user. This was the original server infrastructure that I was going with but I wanted to try and build my own but now I think I’m just going to try and extend his masterpiece. Here’s the full version:

That guy is a god.

And I’ve still got to test that the circuit is even working……


Okay so seeing as I gave away my ebay arduino to my electronics teacher and my etherten is kind of going to be occupied I’ve started looking around for some new silicon.

Here’s the first cool one:

Chipkit uno32

Chipkit uno32

PIC32 board that's compatible with all things Arduino. Enough said.

This handy little board costs the same as a regular arduino, has a lot mor outputs and costs $32. That’s pretty good. But it’s worth mentioning that this board doesn’t run a full PIC32. It only runs a limited one that doesn’t have Ethernet, USB hosting or CAN. So you get 32bit and a lot of inputs but not much else.,892,893&Prod=CHIPKIT-UNO32


  • Microchip® PIC32MX320F128 processor
    • 80 Mhz 32-bit MIPS
    • 128K Flash, 16K SRAM
  • Compatible with existing Arduino™ code examples, reference materials and other resources
  • Can also be programmed using Microchip’s MPLAB® IDE (along with a PICkit 3 and our PICkit3 Programming Cable Kit, seen below)
  • Arduino™ “Uno” form factor
  • Compatible with Arduino™ shields
  • 42 available I/O
  • User LED
  • Connects to a PC using a USB A -> mini B cable (not included)

The good news is that this thing has a big brother that is predictably named the Chipkit max32

Chipkit max32

Chipkit max32

This one has ethernet and a lot of outputs.

How is this one worth $20 more? It has ethernet and USB hosting and everything else you need. And Arduino compatibility. This thing could run a disco with ease. I want one.,892,894&Prod=CHIPKIT-MAX32


  • Microchip® PIC32MX795F512 processor
    • 80 Mhz 32-bit MIPS
    • 512K Flash, 128K RAM
    • USB 2.0 OTG controller
    • 10/100 Ethernet MAC
    • Dual CAN controllers
  • Provides additional memory and advanced communications peripherals
  • Compatible with existing Arduino code examples, reference materials and other resources
  • Can also be programmed using Microchip’s MPLAB® IDE (along with a PICkit 3 and our PICkit3 Programming Cable Kit, seen below)
  • Arduino™ “Mega” form factor
  • Compatible with Arduino™ shields
  • 83 available I/O
  • User LED
  • Connects to a PC using a USB A -> mini B cable (not included)

So those are the digilent pic32 boards.

I’ll show you some more tomorrow that I have been pondering over like the mbed, cool ebay boards, chumby, beagle and the Cerebot 32MX7.


I haven’t really had time to check all this over because I did all this in half an hour so don’t kill me for spelling or factual errors.


2 thoughts on “Sharks and Sticky Tape

  1. Hi, Neat post. There is an issue with your site in internet explorer, would test this? IE nonetheless is the market chief and a big portion of other folks will omit your wonderful writing because of this problem.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s