DEBIAN PRO

DEBIAN PRO
DEBIAN

martes, 14 de enero de 2014

Medidor Arduino

Medidor de humedad temperatura y ruido. 
Conectado a la red.

Para servidores btc y ltc......


http://dx.com/es/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696

http://dx.com/es/p/lm393-sound-detection-sensor-module-black-221267

http://dx.com/es/p/arduino-digital-temperature-humidity-sensor-module-121350

2 comentarios:

  1. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  2. CODIGO FINAL CON EL MEDIDOR DE DISTANCIA...
    para detectar visitas cerca de los servidores....


    // mega con ethernet
    // web sdrever, devuelve informacion de tiempo encendido,
    // medicion del sonido ambiente
    // medicion temp y humedad
    // medidor de distancia

    #include

    #include
    #define dht_dpin A1
    dht DHT;

    #include
    #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
    #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
    #define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);


    int valor = 0;
    int valor1 = 0;
    int valor2 = 0;
    int valor3 = 0;


    // ethernet interface mac address, must be unique on the LAN
    static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
    static byte myip[] = { 192,168,10,199 };

    byte Ethernet::buffer[600];
    BufferFiller bfill;

    // DEFINE THE , 53 to use it in MEGA
    void setup () {
    if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
    Serial.println( "Failed to access Ethernet controller");
    ether.staticSetup(myip);


    }

    static word homePage() {
    long t = millis() / 1000;
    word h = t / 3600;
    byte m = (t / 60) % 60;
    byte s = t % 60;
    bfill = ether.tcpOffset();
    bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "< m eta http-equiv='refresh' content='1'/>"
    "< t itle>TIME CHECK server< / title>"
    "< b ody>"
    "< h 3>Arduino 192.168.10.100"
    "< h 3>$D$D:$D$D:$D$D"
    "Ruido $D
    "
    "Tem/Hum $D/$D
    "
    "Distancia $D
    "
    "< b ody>"
    ),
    h/10, h%10, m/10, m%10, s/10, s%10,
    valor, valor1, valor2, valor3);
    return bfill.position();
    }

    void loop () {
    word len = ether.packetReceive();
    word pos = ether.packetLoop(len);

    DHT.read11(dht_dpin);
    valor = analogRead(0);
    valor1 = DHT.temperature;
    valor2 = DHT.humidity;

    unsigned int uS = sonar.ping();

    valor3 = uS / US_ROUNDTRIP_CM;

    if (pos) // check if valid tcp data is received
    ether.httpServerReply(homePage()); // send web page data

    }

    ResponderEliminar