Freetronics Etherten

From Hamsterworks Wiki!

Jump to: navigation, search

This is an Arduino board with an onboard MicroSD socket and 10/100 Ethernet. It also support a none-standard version of PoE, or an additional POE module can be added for standard POE.

Etherten.png

I got mine from Jaycar (http://www.jaycar.co.nz), and it was cheaper then any Arduino + Ethernet shield I've seen locally.

So far all I've used it for is to web-enable a TMP36 sensor - just because I could. I might also ethernet enable my Arduino Basic project too.

Here's the sketch, based on the standard Arduino web server code:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,212, 177 };

Server server(80);

void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  Client client = server.available();
  if (client) {
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if (c == '\n' && currentLineIsBlank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.print("And the temprature is ");
          client.print(analogRead(0)*(5.0/1024*100)-50.0), //0.75v = 25C, +- 0.01V per degree, 10 bits for 5v sample
          client.println("<br />");   
          break;
        }
        if (c == '\n') {
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    delay(1);
    client.stop();
  }
}

Personal tools