Monday, June 6, 2011

Introducing Arduino ( Arduino Uno with ethernet shield and rotation sensor )

I just bought arduino for a project. Here I am testing it to see it usability and effectiveness before placing it on the project site. 

Picture above show arduino connecting to a rotation sensor, to PC and to the internet.

In the picture above ardunio is place on top of the other, on the bottom is arduino UNO and on top is arduino ethernet shield. Arduino UNO is a microprocessor where all the programming in controling input and output(I/O) are done.

After connecting all the hardware, download arduino driver from it website and install it into your PC.

Then start arduino application bundle together with the driver file, like this;-

write this code into the application;-

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10,34,248, 177 };
Server server(80);

void setup()
 Ethernet.begin(mac, ip);
void loop()
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c =;
        if (c == '\n' && currentLineIsBlank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(" is ");
            client.println("<br />");
        if (c == '\n') {
          currentLineIsBlank = true;
        else if (c != '\r') {
          currentLineIsBlank = false;

Upload it to microprocessor by clicking upload button inside arduino application. Type the IP you write in the code, in this example The result display in the browser should be like this:-

analog input 0 is 464
analog input 1 is 423
analog input 2 is 880
analog input 3 is 769
analog input 4 is 693
analog input 5 is 673
Try adjusting the rotation sensor, input 2 will change base on the direction you change. This is because we had wire it to input 2. Other input value show  "floating" and are picking up all sorts of interference. If you want them to read zero, short the unused pins to ground.

We have proven that Ethernet work and microprocessor work. So we are ready to install it on site, to measure the river level. We are planning on doing  that next week. So stay tune.. :)


  1. Hello, nice to meet you.
    I'm WIZnet Engineer.
    Thank you to use the posting WIZnet products.
    If you ever need my help, send an e-mail to
    Can I share your posts on my blog?

  2. hello,here i m using ether-net cable to connect ether-net shield.That is work or not?please give me answer