Hello,
I have a problem during my project. Project is composed by:
Solar panel 133X73
Li-ion battery 3,7V
TP 4056 Charging Board
Arduino Uno
Power switch
LCD display, I2C module
DT22
When I use Arduino connected to laptop via USB, everything works, but when I disconnect, the display lights less than on USB and doesn't show the Temperature and Humidity values like on USB.
Code:
#include <dht.h>;
//I2C LCD:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display,Pls check your lcd.
//Constants
#define DHTPIN 8 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
//Variables
//int chk;
float h; //Stores humidity value
float t; //Stores temperature value
void setup()
{
Serial.begin(9600);
dht.begin();
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
}
void loop()
{
//Read data and store it to variables h (humidity) and t (temperature)
// Reading temperature or humidity takes about 250 milliseconds!
delay(2000);
h = dht.readHumidity();
t = dht.readTemperature();
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %, Temp: ");
Serial.print(t);
Serial.println(" Celsius");
// set the cursor to (0,0):
// print from 0 to 9:
// Temperature
lcd.setCursor(0, 0);
lcd.print("Teplota = ");
lcd.print(t);
lcd.print(" C");
// Humidity
lcd.setCursor(0, 1);
lcd.print("Vlhkost = ");
lcd.print(h);
lcd.print(" %");
delay(10000); //Delay 2 sec.
}
TK