Show Posts
Pages: [1] 2 3 ... 391
1  Using Arduino / Networking, Protocols, and Devices / Re: need help on dynamic dns on: Today at 06:55:21 am
I will post the code little later. Had anybody had the same problem. I m using arduino Uno with Ws5100 ethernet shield.
No problem here, but I don't use dynamic dns. Post your code.
2  Using Arduino / Networking, Protocols, and Devices / Re: I2C scanner finds devices but not I2C bus (??) on: July 27, 2014, 07:16:40 am
How long are the wires from the Arduino to the device? They should be as short as possible.
3  Using Arduino / Project Guidance / Re: Arduino UNO + Ethernet Shield + Temperature Sensor + Apache Server + SQL + PHP on: July 26, 2014, 06:57:28 am
Your network settings are not correct. The gateway is unreachable.

Also, you can't use www.localhost.com for the server. Use the IP of the server instead. Insure you have modified the server firewall to allow port 80 access from the localnet.

You should read the response from the server. That might help you debug your sketch.
4  Development / Other Software Development / Re: ethernet pings but webclient is not responding on: July 25, 2014, 11:36:55 am
OK, try these additions to your code. Also you might want to use the F() function to reduce your SRAM requirement. I added the F() function to the first few serial and client prints as examples, but I recommend using that on all your static strings.
Code:
void listenForEthernetClients()
{
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client)
  {
    Serial.println(F("Pedido de HTML / Consulta"));   
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
    {     
      if (client.available())
      {
        char c = client.read();
        // if you've gotten to the end of the line (received a newline character) and the line
        // is blank, the http request has ended, so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
            // Envio da resposta           

// Add this. If you don't see this, then you are not getting a blank line from the client
              Serial.println(F("Sending response"));

              client.println(F("HTTP/1.1 200 OK"));
              client.println(F("Content-Type: text/html"));
              client.println();
              // meta tag -> Faz refresh ao browser de 20 em 20 segundos
              // client.println(F("<meta http-equiv=\"refresh\" content=\"120\">"));
              // print the current readings, in HTML format:
             
              client.print("<table align=center width=100%><tr><td>Identificacao do sistema </td><td>Brimarel-001</td><td>");
              client.print( "  Ciclo : </td><td>" );
              client.print( String(ciclo) );
              client.print("</td></tr></table>");
              client.print("<table border=1 align=center width=100%><tr><td>Temperatura(TE)</td><td>Humidade(HU)");
              client.print("</td><td>Luminosidade(LU)");
              client.print("</td><td>Nivel do Tanque(NT)</td></tr><tr><td><div id='TE'>");                   
              client.print( String(Temperatura));
              client.print("</div></td><td><div id='HU'>");
              client.print( String(Humidade) );
              client.print("</div></td><td><div id='LU'>");
              client.print(String(Luminosidad));
              client.print("</div></td><td><div id='NT'>");
              client.print(String(NivelTanque));
              client.print("</div>");                                 
              // Informação de controlo             
              /*
              client.print(" Distancia : ");
              client.print(String(distancia));
              client.print(" - Pin ");
              client.print(String(Pin_sai));
              client.print(" ligado a : ");
              client.print(String(Pin_out));
              client.print(" Stibs");
              */             
              // Informação de Controlo             
              client.print("</td></tr></table>");                   
         // Fim da resposta
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(20);
    // close the connection:
    client.stop();

// Add this. If you don't see this, then you are not finishing the response send to the client
    Serial.println(F("disconnected"));
  }
}
Then run the sketch again and post the last message on the serial monitor when the server quits responding.
5  Using Arduino / Project Guidance / Re: Ethernet Library on: July 25, 2014, 08:22:26 am
I am using a Freetronics Ethermega and use all of its functionality including interupts, ethernet, SD card, etc.

Cheers

Catweazle NZ
You do not call any ethernet functions in the ISR function, do you? Many ethernet functions require the delay() function, and it doesn't work while in an ISR.

edit: At least last time I checked. If this is not correct, please let me know.
6  Development / Other Software Development / Re: ethernet pings but webclient is not responding on: July 25, 2014, 07:53:21 am
Is this the last thing displayed on the serial monitor when it stops responding?
Quote
Pedido de HTML / Consulta

Networking would have been a better place to post this thread.
7  Using Arduino / Programming Questions / Re: Gsm shield and SD card on: July 25, 2014, 07:38:27 am
It appears you may be running out of SRAM. The symptoms could range from garbage on the serial monitor to a reboot of the Arduino.

Try adding this function and call it before calling each device setup function.
Code:
int freeRam() {
  extern int __heap_start,*__brkval;
  int v;
  return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);  
}

edit: Then use it like this:
Code:
Serial.print(F("Free RAM: "));
Serial.println(freeRam());

It will not show zero if you run out of SRAM. It will show a negative or an unrealistic large value.
8  Using Arduino / Networking, Protocols, and Devices / Re: GSM.h and WiFi.h conflict on: July 25, 2014, 07:18:40 am
I don't use those together, but it seems they both use pin D7. The GSM uses D7 for its reset, and the WiFi uses D7 for its handshake pin. I don't know how you are going to fix that.
9  Using Arduino / Networking, Protocols, and Devices / Re: wifi udp write is truncating packets to 29 bytes on: July 24, 2014, 03:09:57 pm
I send 48 bytes all the time. 64 bytes works good for me. I use the WiFiUdpNtpClient sketch in the WiFi examples as a test. It sends and receives 48 byte packets, at least the last time I checked.

How are you determining it is sending only 29 bytes?

edit: Are you still using wireshark to determine that?

10  Using Arduino / Networking, Protocols, and Devices / Re: wifi udp write is truncating packets to 29 bytes on: July 24, 2014, 01:49:19 pm
The limit is around 90 bytes if you have upgraded the firmware.
http://forum.arduino.cc/index.php?topic=242255.0

Have you upgraded the wifi shield firmware?
11  Using Arduino / Networking, Protocols, and Devices / Re: ethernet connect request message issue on: July 24, 2014, 01:08:26 pm
I don't put any SPI device calls in in interrupt handler. Many require interrupts to be enabled for timing.

I don't call any Serial functions in the interrupt handler either.
12  Using Arduino / Networking, Protocols, and Devices / Re: Long wires i2c with MPU6050 on: July 24, 2014, 09:21:12 am
Is it this board?
https://www.sparkfun.com/products/11028

Maybe you need a lower value pullup resistor from the SDC and SCL pins to Vcc (V+). The schematic link on that page shows 10K resistors. I would try about a 2.2K resistor as a test.
13  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Sending Individual Bytes on: July 24, 2014, 08:30:13 am
I don't know what ethernet protocol you can use that doesn't need a header.
14  Using Arduino / Project Guidance / Re: Ethernet Library on: July 24, 2014, 08:14:47 am
I haven't used the interrupt feature, but I know where the jumper is. The INT jumper pads are not marked on my ethernet shield. They are the two pads on the bottom of the shield between pin D0 and the ICSP connector.
15  Using Arduino / Networking, Protocols, and Devices / Re: ethernet connect request message issue on: July 24, 2014, 07:58:54 am
The server.available() function depends on receiving something from the client. Just establishing a connection is not enough.

This code will get the status of all the sockets. It will show connections without the client sending any characters.
Code:
#include <utility/w5100.h>

byte socketStat[MAX_SOCK_NUM];

void ShowSockStatus()
{
  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    Serial.print(F("Socket#"));
    Serial.print(i);
    uint8_t s = W5100.readSnSR(i);
    socketStat[i] = s;
    Serial.print(F(":0x"));
    Serial.print(s,16);
    Serial.print(F(" "));
    Serial.print(W5100.readSnPORT(i));
    Serial.print(F(" D:"));
    uint8_t dip[4];
    W5100.readSnDIPR(i, dip);
    for (int j=0; j<4; j++) {
      Serial.print(dip[j],10);
      if (j<3) Serial.print(".");
    }
    Serial.print(F("("));
    Serial.print(W5100.readSnDPORT(i));
    Serial.println(F(")"));
  }
}
A socket status list:
0x0 = available.
0x14 = socket waiting for a connection
0x17 = socket connected to a client if a server, or a server if a client.
0x22 = UDP socket.
Pages: [1] 2 3 ... 391