hai ragione... scusa per le poche informazioni, provo a migliorare:
Il progettino e' un "termostato" che accende e spegne un frigorifero e un cavo riscaldante (posto nel frigo) in modo da mantenere un certo range di temperatura che imposto. In piu' con lo shield ethernet (W5100) mi avvia un server web che mi dice la temperatura e mi fa impostare il range.
C'e' anche una funzione "salva frigorifero" che fa si che il frigo non si riaccenda prima di un toto di secondi dall'ultimo spegnimento.
Lo schema di collegamento e' il seguente:

La resistenza e' 4,7K
la scheda a 2 rele che ho usato e' questa (scusa se posto il link ad ebay, spero che si capisca qual'e'):

il codice per arduino e' il seguente:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <secTimer.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,177);
EthernetServer server(80);
String receivedText = String(255);
int cold = 7;
int hot = 6;
char floatbuf[32];
int MIN = 23;
int MAX = 30;
int time;
secTimer myTimer;
byte state=1;
unsigned long seconds=0;
const int chipSelect = 4;
#define CALDO 0
#define FREDDO 1
int ultimostato = NULL;
int ultimoff = 0;
int secure_time = 120;
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup(void)
{
// start serial port
Serial.begin(9600);
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
// if the file opened okay, write to it:
myTimer.startTimer();
seconds=myTimer.readTimer();
pinMode(cold, OUTPUT);
pinMode(hot, OUTPUT);
// Start up the library
sensors.begin();
}
void loop(void)
{
EthernetClient client = server.available();
if (client) {
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (receivedText.length() < 55) {
receivedText += c;
}
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.print("<html><head><title>Arduino Webserver</title></head><body>");
client.print("La temperatura del sensore e':");
client.println(sensors.getTempCByIndex(0));
client.print("</br>");
client.print("La temperatura impostata e':");
client.print("Min: ");
client.print(MIN);
client.print(" Max: ");
client.print(MAX);
client.println("<h1>Controllo Temperatura!</h1>");
client.print("<form method=get>Inserisci la temperatura (MAX=? oppure MIN=?): <input type=text size=10 name=temp> <input type=submit></form>");
//client.print("<form method=get>Inserisci la temperatura Massima: <input type=text size=10 name=max> <input type=submit></form>");
client.println("</body></html>");
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;
}
}
}
delay(1);
Serial.println("questo e' il received text");
Serial.println(receivedText); // uncomment this line to debug ;-)
// do something with the text
int firstPos = receivedText.indexOf("?");
if (firstPos > -1) {
int lastPos = receivedText.indexOf(" ", firstPos);
String theText = receivedText.substring(firstPos+12, lastPos); // 10 is the length of "?the_text="
String theTextScelta = receivedText.substring(firstPos+6, firstPos+9); // 10 is the length of "?the_text="
// if your text contains spaces they will be replaced with "+"
Serial.println("***********************");
Serial.println(theTextScelta);
Serial.println(theText);
Serial.println("***********************");
theText.toCharArray(floatbuf, sizeof(floatbuf));
int TheTextINT = atoi(floatbuf);
if (theTextScelta == "MIN")
MIN = TheTextINT;
if (theTextScelta == "MAX")
MAX = TheTextINT;
}
receivedText = "";
client.stop();
Serial.println("client disonnected");
}
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
Serial.print("Temperature for the device 1 (index 0) is: ");
Serial.println(sensors.getTempCByIndex(0));
time=myTimer.readTimer();
if (sensors.getTempCByIndex(0) < MIN)
{
digitalWrite(hot, LOW);
digitalWrite(cold, HIGH);
Serial.print("Riscaldamento...");
ultimostato = CALDO;
}
else if (sensors.getTempCByIndex(0) > MAX && (time-=secure_time) > ultimoff)
{
digitalWrite(hot, HIGH);
digitalWrite(cold, LOW);
Serial.print("Raffreddamento...");
ultimostato = FREDDO;
}
else if (sensors.getTempCByIndex(0) > MIN || sensors.getTempCByIndex(0) < MAX)
{
digitalWrite(hot, HIGH);
digitalWrite(cold, HIGH);
Serial.print("Temperatura OK!");
if (ultimostato == FREDDO)
{
ultimoff = myTimer.readTimer();
ultimostato = NULL;
}
}/*
Serial.println();
Serial.print("ULTIMOSTATO: ");
Serial.println(ultimostato);
Serial.print("ULTIMOFF: ");
Serial.println(ultimoff);
Serial.print("Timer: ");
Serial.println(myTimer.readTimer());
Serial.print("secure Timer: ");
Serial.println(secure_time);
Serial.print("MIN: ");
Serial.println(MIN);
Serial.print("MAX: ");
Serial.println(MAX); */
}
Purtroppo non ho le specifiche dell'alimentatore qui' con me ora.
Spero che le informazioni aggiunte siano leggermente utili.
Ciao e grazie ancora.
Mario