loading
In this instructable (my first instructable) we will create a temperature and humidity datalogger adding the posibility to access the data by web.

The new arduino ethernet makes everything sooooooo easy that it looks like magic. In the same board you get: an ATMega 328, ethernet conectivity, sd card

Only need a RTC (Real Time Clock) in order to have a full datalogger. I will plan to make another instructable about how to conect a RTC to this board.

You can connect to my own arduino server in order to see my server room temperature.

Step 1: The Basic Stuff


Lets me show how easy is to make a datalogger that saves sensor data in a SD card and allow remote access by web using any browser.

We will use three DHT11 sensor as source of data. Every DHT11 give us temperature and humidity data. They are really cheap (2€ iin ebay) and more or less acurrate ;-) : 2 Celsius degree and 5% of humidity. In the case you want more acurrate data, the DHT22 could be your election.

I apologize for using Celsius degrees. That is because I radicate in Spain. Changing the units to Fahrenheit degrees it is really easy.

Step 2: Connect Arduino to the Sensor

The sensor use a proper protocol, using one wire transmisition, mudulating the value in time, first you get the temperature, then the humidity value. It's something similar to pwm. The orthers used pins are Vdd and Gnd.

In order to facilitate the code we are going to use a library for DHT11 comunication. You can download the library from arduino-info.

To connect the sensors, you only have to connect all the Vdd pins to the 5+ and the Gnd pins to Gnd of arduino. In this example the data of every sensor is connected to the pins 2,3 and 4.

A basic program could be this one:

#include

dht11 DHT11;


void setup()
{
Serial.begin(9600);
}

void getdata(int iPuerto)
{
int chk = DHT11.read(iPuerto);

Serial.print("Sensor ");
Serial.print(iPuerto);
Serial.print(" ");
switch (chk)
{
case 0:
Serial.print((float)DHT11.humidity, 2);
Serial.print(" % ");
Serial.print((float)DHT11.temperature, 2);
Serial.println(" o C");
break;
case -1: Serial.println(" Checksum error"); break;
case -2: Serial.println(" Time out error"); break;
default: Serial.println(" Unknown error"); break;
}


}

void loop()
{
getdata(2);
getdata(3);
getdata(4);

delay(200);
}

I have trouble downloading the program using the current Arduino IDE 0022 under ubuntu. In order to solve then I have to modify the boards.txt file. An bug have been reported to the arduino comunity.

Step 3: Connect Arduino to Internet

Using the webserver example it is really easy to put your data on internet.

The previous Sketch modified could be in order to acept http request:


#include
#include
#include


dht11 DHT11;

#define nSensores 3
int puertos[nSensores];
float fHumedades[nSensores];
float fTemperaturas[nSensores];

int iNVisitas=0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xEE, 0xEE };
byte ip[] = { 192,168,1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(666);
void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();

Serial.begin(115200);
puertos={2,3,4};

}

void getdata(int iIndice)
{
int chk = DHT11.read(puertos[iIndice]);
fHumedades[iIndice]=-1;
fTemperaturas[iIndice]=-1;

Serial.print("Sensor ");
Serial.print(iIndice);
Serial.print(" ");
switch (chk)
{
case 0:
fHumedades[iIndice]=(float)DHT11.humidity;
Serial.print(fHumedades[iIndice], 2);
Serial.print(" % ");
fTemperaturas[iIndice]=(float)DHT11.temperature;
Serial.print(fTemperaturas[iIndice], 2);
Serial.println(" o C");
break;
case -1: Serial.println(" Checksum error"); break;
case -2: Serial.println(" Time out error"); break;
default: Serial.println(" Unknown error"); break;
}


}


void loop()
{
// listen for incoming clients
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 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 == ' ' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
// output the value of each analog input pin
for(int i=0;i // for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("sensor ");
client.print(i);
client.print(": ");
if(fHumedades[i]==-1)
client.print(" error leyendo el sensor");
else
{
client.print(fHumedades[i], 2);
client.print(" % ");
client.print(fTemperaturas[i], 2);
client.println(" o C");
}
client.println("
");
}
client.print((iNVisitas++)/2);
client.println(" visitas
");

break;
}
if (c == ' ') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != ' ') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
else
{
for(int i=0;i getdata(i);
delay(200);
}
}

Where I am using my proper network configuration. In order to use your configuration, only change the mac and ip values.

You can connect to my own arduino server in order to see my server room temperature

Step 4: Save Data to a Sd Card

Saving the data to a sd card is really easy for the ehternet arduino.

The SD must be fat16 or fat32 formated

Only need to Including the sd library, initialize the sd library and open and write to a file

Here is the code:

#include
#include
#include
#include


dht11 DHT11;

#define nSensores 3
int puertos[nSensores];
float fHumedades[nSensores];
float fTemperaturas[nSensores];

int nFilas=0;
int nFiles=0;

File file;

int iNVisitas=0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xEE, 0xEE };
byte ip[] = { 192,168,1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(666);
void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();

Serial.begin(115200);
puertos={2,3,4};

pinMode(10, OUTPUT);
if (!SD.begin(4))
{
Serial.println("Error inicializando SD");
nFiles=-1;
}
else
{
nFiles=0;
Serial.println("SD initializada.");
}

}

void getdata(int iIndice)
{
int chk = DHT11.read(puertos[iIndice]);
fHumedades[iIndice]=-1;
fTemperaturas[iIndice]=-1;

Serial.print("Sensor ");
Serial.print(iIndice);
Serial.print(" ");
switch (chk)
{
case 0:
fHumedades[iIndice]=(float)DHT11.humidity;
Serial.print(fHumedades[iIndice], 2);
Serial.print(" % ");
fTemperaturas[iIndice]=(float)DHT11.temperature;
Serial.print(fTemperaturas[iIndice], 2);
Serial.println(" o C");
break;
case -1: Serial.println(" Checksum error"); break;
case -2: Serial.println(" Time out error"); break;
default: Serial.println(" Unknown error"); break;
}


}


void loop()
{
// listen for incoming clients
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 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 == ' ' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
// output the value of each analog input pin
for(int i=0;i // for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("sensor ");
client.print(i);
client.print(": ");
if(fHumedades[i]==-1)
client.print(" error leyendo el sensor");
else
{
client.print(fHumedades[i], 2);
client.print(" % ");
client.print(fTemperaturas[i], 2);
client.println(" o C");
}
client.println("
");
}
client.print((iNVisitas++)/2);
client.println(" visitas
");

break;
}
if (c == ' ') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != ' ') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
else
{
//if(nFiles>=0 && file)
{
file= SD.open("datalog.txt", FILE_WRITE);
}
String data="";
for(int i=0;i {
getdata(i);

data+=String(nFilas)+";"+String(i)+";"+String((int)fHumedades[i])+";"+String((int)fTemperaturas[i])+" ";
}
if(file)
{
file.print(data);
Serial.print(data);
file.close();
nFilas++;
}
delay(200);
}
}
<p>awsm to start.</p>
is there a way that file savings are made to different files and max size ~1M?
I'm it almost worked. The delay could be due to some config or hardwareissues. Please, check the ip and the ethernet wire.
thnx now its working:) i added to the end some sd card lines , now its saving data to sd card but web browsing is very very slow or noting at all.. , where should i put some delay s for that browser can makes connections in time ? <br> <br> <br> <br> <br> // close the connection: <br> client.stop(); <br> } <br> else <br> <br>{ <br>//if(nFiles&gt;=0 &amp;&amp; file) <br>{ <br>file= SD.open(&quot;datalog.txt&quot;, FILE_WRITE); <br>} <br>String data=&quot;&quot;; <br>for(int i=0;i <br>} <br> <br> <br>if(file) <br>{ <br>file.println(data); <br>Serial.println(data); <br>file.close(); <br>nFilas++; <br>} <br>delay(1000); <br> <br> for(int i=0;i getdataDHT(i); <br> delay(1000); <br> getdataOneWire(); <br> } <br>}
I'll try to reproduce again the circuit and test again the code.<br> This is the code I'm using now in a bit more complex project. You can remove the OneWire part<br> I hope this helps<br> <br> #include &lt;SPI.h&gt;<br> #include &lt;Ethernet.h&gt;<br> #include &lt;OneWire.h&gt;<br> #include &lt;dht11.h&gt;&nbsp; // Descargamos la librer&iacute;a desde http://arduino-info.wikispaces.com/DHT11-Humidity-TempSensor<br> <br> dht11 DHT11;&nbsp;<br> #define nSensoresDHT 6<br> #define nSensoresOneWire 3<br> int puertosDHT[]={2,3,5,6,7,8}; // &iquest;Por qu&eacute; nos saltamos el 4?<br> int puertoOneWire=9;<br> OneWire&nbsp; ds(puertoOneWire);&nbsp;<br> <br> float fHumedades[nSensoresDHT];<br> float fTemperaturas[nSensoresDHT+nSensoresOneWire];<br> <br> int iNVisitas=0;<br> <br> // Enter a MAC address and IP address for your controller below.<br> // The IP address will be dependent on your local network:<br> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xEE, 0xEE };<br> byte ip[] = { 192,168,1, 177 };<br> <br> // Initialize the Ethernet server library<br> // with the IP address and port you want to use<br> // (port 80 is default for HTTP):<br> EthernetServer server(666);<br> void setup()<br> {<br> &nbsp; // start the Ethernet connection and the server:<br> &nbsp; Ethernet.begin(mac, ip);<br> &nbsp; server.begin();<br> <br> &nbsp; Serial.begin(115200);<br> <br> <br> }<br> float tMin=100;<br> float tMax=0;<br> float tMedia=0;<br> int contador=0;<br> void getdataOneWire()<br> {<br> &nbsp; byte i;<br> &nbsp; byte present = 0;<br> &nbsp; byte type_s;<br> &nbsp; byte data[12];<br> &nbsp; byte addr[8];<br> &nbsp; float celsius;<br> &nbsp;<br> &nbsp; if ( !ds.search(addr)) {<br> &nbsp;&nbsp;&nbsp; Serial.print(contador);<br> &nbsp;&nbsp;&nbsp; Serial.println(&quot; DS18x20 encontrados&quot;);<br> &nbsp;&nbsp;&nbsp; Serial.print(&quot;Tmax=&quot;);<br> &nbsp;&nbsp;&nbsp; Serial.print(tMax);<br> &nbsp;&nbsp;&nbsp; Serial.print(&quot; Tmin=&quot;);<br> &nbsp;&nbsp;&nbsp; Serial.print(tMin);<br> &nbsp;&nbsp;&nbsp; Serial.print(&quot; tmedia=&quot;);<br> &nbsp;&nbsp;&nbsp; Serial.println( tMedia/contador);<br> &nbsp;&nbsp;&nbsp; ds.reset_search();<br> &nbsp;&nbsp;&nbsp; contador=0;<br> &nbsp;&nbsp;&nbsp; tMedia=0;<br> &nbsp;&nbsp;&nbsp; delay(250);<br> &nbsp;&nbsp;&nbsp; return;<br> &nbsp; }<br> <br> &nbsp; Serial.print(&quot;ROM =&quot;);<br> &nbsp; for( i = 0; i &lt; 8; i++) {<br> &nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp; if(addr[i]&lt;16)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot; 0&quot;);<br> &nbsp;&nbsp;&nbsp; else<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.write(' ');<br> &nbsp;&nbsp;&nbsp; Serial.print(addr[i], HEX);<br> &nbsp; }<br> <br> &nbsp; if (OneWire::crc8(addr, 7) != addr[7]) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;CRC is not valid!&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br> &nbsp; }<br> // Serial.println();<br> <br> &nbsp; // the first ROM byte indicates which chip<br> &nbsp; switch (addr[0]) {<br> &nbsp;&nbsp;&nbsp; case 0x10:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot; DS18S20&quot;);&nbsp; // or old DS1820<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type_s = 1;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br> &nbsp;&nbsp;&nbsp; case 0x28:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot; DS18B20&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type_s = 0;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br> &nbsp;&nbsp;&nbsp; case 0x22:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot; DS1822&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type_s = 0;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br> &nbsp;&nbsp;&nbsp; default:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot;Not a DS18x20&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br> &nbsp; }<br> <br> &nbsp; ds.reset();<br> &nbsp; ds.select(addr);<br> &nbsp; ds.write(0x44,1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // start conversion, with parasite power on at the end<br> &nbsp;<br> &nbsp; delay(1000);&nbsp;&nbsp;&nbsp;&nbsp; // maybe 750ms is enough, maybe not<br> &nbsp; // we might do a ds.depower() here, but the reset will take care of it.<br> &nbsp;<br> &nbsp; present = ds.reset();<br> &nbsp; ds.select(addr);&nbsp;&nbsp;&nbsp;<br> &nbsp; ds.write(0xBE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Read Scratchpad<br> <br> &nbsp; for ( i = 0; i &lt; 9; i++) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // we need 9 bytes<br> &nbsp;&nbsp;&nbsp; data[i] = ds.read();<br> <br> &nbsp; }<br> <br> <br> &nbsp; // convert the data to actual temperature<br> <br> &nbsp; unsigned int raw = (data[1] &lt;&lt; 8) | data[0];<br> &nbsp; if (type_s) {<br> &nbsp;&nbsp;&nbsp; raw = raw &lt;&lt; 3; // 9 bit resolution default<br> &nbsp;&nbsp;&nbsp; if (data[7] == 0x10) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // count remain gives full 12 bit resolution<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raw = (raw &amp; 0xFFF0) + 12 - data[6];<br> &nbsp;&nbsp;&nbsp; }<br> &nbsp; } else {<br> &nbsp;&nbsp;&nbsp; byte cfg = (data[4] &amp; 0x60);<br> &nbsp;&nbsp;&nbsp; if (cfg == 0x00) raw = raw &lt;&lt; 3;&nbsp; // 9 bit resolution, 93.75 ms<br> &nbsp;&nbsp;&nbsp; else if (cfg == 0x20) raw = raw &lt;&lt; 2; // 10 bit res, 187.5 ms<br> &nbsp;&nbsp;&nbsp; else if (cfg == 0x40) raw = raw &lt;&lt; 1; // 11 bit res, 375 ms<br> &nbsp;&nbsp;&nbsp; // default is 12 bit resolution, 750 ms conversion time<br> &nbsp; }<br> &nbsp; celsius = (float)raw / 16.0;<br> &nbsp; fTemperaturas[nSensoresDHT+contador]=celsius;<br> &nbsp; if(tMin&gt;celsius)<br> &nbsp;&nbsp;&nbsp; tMin=celsius;<br> &nbsp; if(tMax&lt;celsius)<br> &nbsp;&nbsp;&nbsp; tMax=celsius;<br> &nbsp; tMedia+=celsius;<br> &nbsp; Serial.print(&quot;&nbsp; Temp.= &quot;);<br> &nbsp; Serial.print(celsius);<br> &nbsp; Serial.println(&quot;C&quot;);<br> &nbsp; contador++;<br> }<br> <br> <br> void getdataDHT(int iIndice)<br> {<br> &nbsp; int chk = DHT11.read(puertosDHT[iIndice]);<br> &nbsp; fHumedades[iIndice]=-1;<br> &nbsp; fTemperaturas[iIndice]=-1;<br> <br> &nbsp; Serial.print(&quot;Sensor &quot;);<br> &nbsp; Serial.print(iIndice);<br> &nbsp; Serial.print(&quot; &quot;);<br> &nbsp; switch (chk)<br> &nbsp; {<br> &nbsp;&nbsp;&nbsp; case 0:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fHumedades[iIndice]=(float)DHT11.humidity;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(fHumedades[iIndice], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(&quot; % &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fTemperaturas[iIndice]=(float)DHT11.temperature;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.print(fTemperaturas[iIndice], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot; o C&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br> &nbsp;&nbsp;&nbsp; case -1: Serial.println(&quot; Checksum error&quot;); break;<br> &nbsp;&nbsp;&nbsp; case -2: Serial.println(&quot; Time out error&quot;); break;<br> &nbsp;&nbsp;&nbsp; default: Serial.println(&quot; Unknown error&quot;); break;<br> &nbsp; }<br> <br> }<br> <br> void loop()<br> {<br> &nbsp; // listen for incoming clients<br> &nbsp; EthernetClient client = server.available();<br> &nbsp; String sURL;<br> &nbsp; if (client) {<br> &nbsp;&nbsp;&nbsp; // an http request ends with a blank line<br> &nbsp;&nbsp;&nbsp; boolean currentLineIsBlank = true;<br> &nbsp;&nbsp;&nbsp; while (client.connected()) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (client.available()) {<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char c = client.read();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if you've gotten to the end of the line (received a newline<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // character) and the line is blank, the http request has ended,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // so you can send a reply<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (c == '\n' &amp;&amp; currentLineIsBlank) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sURL=sURL.substring(0,9);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(sURL);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(sURL.endsWith(&quot;csv &quot;))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;nSensoresDHT;i++){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fHumedades[i], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;;&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fTemperaturas[i], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;;&quot;);<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;nSensoresOneWire;i++){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fTemperaturas[nSensoresDHT+i]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;;&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot;&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // send a standard http response header<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot;HTTP/1.1 200 OK&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot;Content-Type: text/html&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // client.println(&quot;&lt;meta http-equiv=\&quot;refresh\&quot; content=\&quot;1\&quot; /&gt;&quot;); //Autorefresh de la p&aacute;gina<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // output the value of each analog input pin<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;nSensoresDHT;i++){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;sensorDHT &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(i);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;: &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(fHumedades[i]==-1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot; error leyendo el sensor&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fHumedades[i], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot; % &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fTemperaturas[i], 2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot; C&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot;&lt;br /&gt;&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;nSensoresOneWire;i++){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;sensorOneWire &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(i);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(&quot;: &quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print(fTemperaturas[nSensoresDHT+i]);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot; C&lt;br /&gt;&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.print((iNVisitas++)/2);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.println(&quot; visitas &lt;br /&gt;&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (c == '\n') {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // you're starting a new line<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentLineIsBlank = true;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (c != '\r') {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // you've gotten a character on the current line<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sURL+=c;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentLineIsBlank = false;<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; // give the web browser time to receive the data<br> &nbsp;&nbsp;&nbsp; delay(1);<br> &nbsp;&nbsp;&nbsp; // close the connection:<br> &nbsp;&nbsp;&nbsp; client.stop();<br> &nbsp; }<br> &nbsp; else<br> &nbsp; {<br> &nbsp;&nbsp;&nbsp; for(int i=0;i&lt;nSensoresDHT;i++)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getdataDHT(i);<br> &nbsp;&nbsp;&nbsp; delay(100);<br> &nbsp;&nbsp;&nbsp; getdataOneWire();<br> &nbsp; }<br> }<br> <br>
its ok now in program , no errors but there is no readings from sensors <br>sensor 0: error leyendo el sensor <br>sensor 1: error leyendo el sensor <br>sensor 2: error leyendo el sensor <br> <br>i think there are much more differences between old and new versions <br>
i am using newer version yes. there are some other things that must be changed like &quot;Server&quot; is now &quot;EthernetServer&quot; and Client is EthernetClient, but i cant understand what is wrong with this &quot;puertos={2,3,4}; &quot;
I don't know why doesn't work in 1.0 IDE<br><br>You can fix it changing the declaration of puertos with this one<br><br>int puertos[]={2,3,4};<br><br>I hope this helps
hi <br>can you say why does line <br>puertos={2,3,4}; <br>give me an error? <br>expected primary expression before { token
Which arduino version are you using? <br>Maybe my code need a revision for arduino 1.0
Gracias tio! me ha venido de lujo. <br>No ser&aacute;s forococheros verdad? te encontrarias un monton de cosas en la plataforma...
i like it. <br>so nice. <br>i can try =)
The code can be downloaded from my <a href="http://blog.elcacharreo.com" rel="nofollow">blog</a>&nbsp;
When I put up some asm, my includes were lost also. You may want to include the source code as a download.
Thanks a lot for your info.<br><br>I'll check it

About This Instructable

82,940views

80favorites

More by javacasm:Temperature and Humidity Datalogger + Webserver 
Add instructable to: