Hi
I have got a problem with operating my typical 2x16 LCD with PCF8574AP. I have read the eniter internet about that, other topics etc but none of them can relate to my problem. The thing is that my circuit works for a limited time only. It varies, it may be 15 mintues, sometimes 5 minutes. Here are the pictures how it looks like:
- perfectly working
- still good enough
- well at least humidity, almost...
- are you kidding me?
I belive the connections are right as I get what I want at the beggining. I used pull up resistors between SDA/+5V and SCL/+5V. Here is the used code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"
#define DHTPIN 8
#define DHTTYPE DHT22
LiquidCrystal_I2C lcd(0x38, 6, 5, 4, 0, 1, 2, 3, 7, POSITIVE);
DHT dht(DHTPIN,DHTTYPE);
// Creat a set of new characters
const uint8_t charBitmap[][8] = {
{ 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
{ 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
{ 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
{ 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
{ 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
{ 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
{ 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
{ 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
};
void setup()
{
int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));
lcd.begin(16,2); // initialize the lcd
dht.begin();
for ( int i = 0; i < charBitmapSize; i++ )
{
lcd.createChar ( i, (uint8_t *)charBitmap[i] );
}
lcd.home (); // go home
lcd.print("Hello, ARDUINO! ");
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print (" YO ");
delay ( 1000 );
}
void loop()
{
delay(1000);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
lcd.home();
lcd.print("Humidity: ");
lcd.print(h);
lcd.setCursor(0,1);
lcd.print("Temp: ");
lcd.print(t);
lcd.home();
}
What is going on in here? Is this arduino's fault or pcf's? I used this library for LCD: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
EDIT: interesting thing is that when I put LCD out of breadboard and insert it again it starts to work again.