on the sketch I have awebserver that it's showinf the reading of the temp sensor (and also shows it on the serial terminal) and also have a button on the web where I can wsiwtch the led on and off
(my setup is planned to be a remote thermostat where I'll replace the led by a relay)
all is powered trough the usb
my problem is that the temp sensor gives me very strange readings, and they vary a lot when I power on the led.
I suspect this is due the USB power can not power the arduino board, the led and the ethernet adapter. Am I wrong?
(I could not test my theory because I still do no have any expernal power source, and even I do not know the voltage...)
Hi, do you have a multimeter to measure the voltages around your project.
Have you got a current limit resistor in series with the LED.
A picture of your project will help, as well as a circuit diagram as to how you have connected the sensor and a copy of your sketch.
A pic of a hand drawn circuit would be okay.
Did you try just writing a sketch for the sensor without the ethernet module first to see if you had it reading correctly?
That set up is literally identical to mine.... well not literally, since mine has an RTC too.
I do notice odd changes in temp.... like today it was hovering around high 20s C (summer here ) and for a short while it was in the 40s. I put this down to transient issues on the analog pin.... I have a mains 3-way extension lurking nearby. But usually the LM35 agrees with my Fluke thermocouple to a degree or three. Right now they are both hovering around 26-27C.
Matter of interest, I held the Fluke thermocouple on the 5100 chip earlier... it's warm to the touch, not too hot to touch though, and it Flukes at about 42C.
I'll "steal" a multimeter from the office today to check voltages, I understand that I should check voltage arriving to TMP35 and it should be 3,3v (I readed somewhere that it's better 3.3V than 5v for this it will produce more accurate readings)
I'll check some other places for the 5v.
thanks for the hint.
BTW, on the DC in of the arduino board, what voltage can I supply? also, what's the recocmended amperage?
I just redo my sketch just to check temperature, nothig about the webserver to make it more simple to find the problem.
I connected a bareboard, and on it, TMP35 to analog pin 1, and voltage from 5V and ground.
int sensorPin = 5;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int reading = analogRead(sensorPin);
float voltage = reading * 5;
voltage /= 1024.0;
float temperatureC = (voltage) * 100 ; //converting from 10 mv per degree
serial.print(temperatureC); Serial.println(" C");
delay(0); //waiting 0 second
}
with this setup I get correct reading on the serial terminal. 21.51 ºc voltage on the bareboard is right (powering form usb) 5V
so to here, all is ok.
now, I connect the ethernet power to the bareboard, and, powering the Arduino from USB I get 4,55V (30,27ºc on the temp sensor); if I poer arduino with some batteries rechargable batteries (that are forming an array of 7,2, 8V in the multimeter) I get on the bareboard; 4,70V; and readings from temp sensor give me now 34,8ºc.
so seems that the ethernet controller is drawing lots of current, bringing my voltage down, thus making the temp sensor go nuts