user61917: I'am making a temperature monitor using an IC2 Interface and a dht11 sensor connected to an arduino uno, it works great when it´s plugged to the computer but whenever i plug it to a 9v battery the humidity goes to "0" and the temperature to "2", it only works when i resend the code through the ide to the arduino.
What could be the problem?
Code :
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <DHT.h>


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
DHT dht;


void setup()
{
  lcd.begin(16,2);
  lcd.clear();
  dht.setup(7); // Pino 7



}

void loop(){



  float humidade = dht.getHumidity();
  float temperatura = dht.getTemperature();

  lcd.setCursor(0,0);
  lcd.print("Humidade: ");
  lcd.print(humidade);
  lcd.print("%");

  lcd.setCursor(0,1);
  lcd.print("Temp: ");
  lcd.print(temperatura);
  lcd.print("C");

  delay(1000);

}


user313: The 9v sort of "cube shaped" batteries have a notoriously limited current output, resulting in falling voltage as the current demand rises. The Arduino's voltage regulator is not very effecient either, plus the battery gives only 2v of "headroom" over the minimum Vin voltage of 7v. Your system is probably starving. Try a different source.

61917: <p>I'am making a temperature monitor using an IC2 Interface and a dht11 sensor connected to an arduino uno, it works great when it´s plugged to the computer but whenever i plug it to a 9v battery the humidity goes to "0" and the temperature to "2", it only works when i resend the code through the ide to the arduino.</p>

<p>What could be the problem?</p>

<p>Code :</p>

<pre><code>#include &lt;Wire.h&gt; 
#include &lt;LiquidCrystal_I2C.h&gt;
#include &lt;DHT.h&gt;


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
DHT dht;


void setup()
{
  lcd.begin(16,2);
  lcd.clear();
  dht.setup(7); // Pino 7



}

void loop(){



  float humidade = dht.getHumidity();
  float temperatura = dht.getTemperature();

  lcd.setCursor(0,0);
  lcd.print("Humidade: ");
  lcd.print(humidade);
  lcd.print("%");

  lcd.setCursor(0,1);
  lcd.print("Temp: ");
  lcd.print(temperatura);
  lcd.print("C");

  delay(1000);

}
</code></pre>
 313: <p>The 9v sort of "cube shaped" batteries have a notoriously limited current output, resulting in falling voltage as the current demand rises. The Arduino's voltage regulator is not very effecient either, plus the battery gives only 2v of "headroom" over the minimum Vin voltage of 7v. Your system is probably starving. Try a different source.</p>
