Monday, November 28, 2011

Tank level + arduino + scada

Today we install a new on-line level sensor for one of our tank. Hardware involve are ultrasonic sensor, arduino uno, ethernet shield and 3g modem.


Picture above show staff installing the arduino board beside the tank which are connected to the ultrasonic sensor in the tank.


This is how we construct the system, very simple. The arduno board will send the data to modem which then will send to mysql sever.




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);
  server.begin();
}
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 = client.read();
        if (c == '\n' && currentLineIsBlank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(analogRead(analogChannel));
            client.println("<br />");
          }
          break;
        }
        if (c == '\n') {
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    delay(1);
    client.stop();
  }
}

Upload it to microprocessor by clicking upload button inside arduino application. Type the IP you write in the code, in this example 10.34.248.177. 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.. :)