Keypad Shield and Sensors

Hi,

I have the Arduino Uno. The Keypadshield is a noname from ebay its like the DFRobot LCD Keypad Shield. The i have 2 DHT22.
Everything works fine, until a use a lcd command like lcd.clear(); the i get no information from one of the sensors (-999.,00).
Does someone knows the reason?
Thanks

My first code is:

#include <dht.h>
#include <LiquidCrystal.h>
#include <LCDKeypad.h>

dht DHT;
LCDKeypad lcd;

#define dhtA 6
#define dhtI 5

int localKey = 0;
String keyString = "";

double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}

float dewI = 0;
float dewA = 0;
float tempI = 0;
float tempA = 0;
float humI = 0;
float humA = 0;

void setup()
{
Serial.begin(115200); //Verbindung Computer
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("0.01 by Jules");
delay(2500);
}

void loop()
{
DHT.read22(dhtI); //Sensor Innen auslesen
delay(500);
float humI = DHT.humidity;
float tempI = DHT.temperature;
float dewI = (dewPointFast(DHT.temperature, DHT.humidity));

DHT.read22(dhtA); //Sensor Aussen auslesen
delay(500);
float humA = DHT.humidity;
float tempA = DHT.temperature;
float dewA = (dewPointFast(DHT.temperature, DHT.humidity));

Serial.println ("Innensensor:");
Serial.print ("humI: ");
Serial.println (humI);
Serial.print ("tempI: ");
Serial.println (tempI);
Serial.print ("dewI: ");
Serial.println (dewI);
Serial.println ("");

Serial.println ("Aussensensor:");
Serial.print ("humA: ");
Serial.println (humA);
Serial.print ("tempA: ");
Serial.println (tempA);
Serial.print ("dewA: ");
Serial.println (dewA);
Serial.println ("____________________");

}

Everything works fine, until a use a lcd command like lcd.clear(); the i get no information from one of the sensors (-999.,00).

From which one?

Hi,

the problem is with the dhtA

ill get this wehen i run it without any lcd command: (first run gets the -999.00 problem)

Innensensor:
humI: 56.00
tempI: 25.70
dewI: 16.25

Aussensensor:
humA: -999.00
tempA: -999.00
dewA: nan


Innensensor:
humI: 56.50
tempI: 25.70
dewI: 16.39

Aussensensor:
humA: 53.70
tempA: 25.80
dewA: 15.69


When i use a lcd command like lcd.clear() at the end of the script i get:

Innensensor:
humI: 54.80
tempI: 25.90
dewI: 16.10

Aussensensor:
humA: -999.00
tempA: -999.00
dewA: nan


Innensensor:
humI: 55.40
tempI: 25.90
dewI: 16.27

Aussensensor:
humA: -999.00
tempA: -999.00
dewA: nan


Innensensor:
humI: 54.80
tempI: 25.90
dewI: 16.10

Aussensensor:
humA: -999.00
tempA: -999.00
dewA: nan


Innensensor:
humI: 55.40
tempI: 25.90
dewI: 16.27

Aussensensor:
humA: -999.00
tempA: -999.00
dewA: nan


So, when you actually use the LCD, pin 6 is interfered with, and no longer can be used to read from the temperature sensor.

You need to determine if the LCD is using pin 6. If so, then you'll need to use some other pin for the temperature sensor.

No thats not the problem, when ich change dhtA to 5 and dhtI to 6, its the same problem

So it works it was a problem reading the sensors, what exactly i dont know:

#include <dht.h>
#include <LiquidCrystal.h>
#include <DFR_Key.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

dht DHT;
DFR_Key keypad;

#define dhtA 5
#define dhtI 6

int localKey = 0;
String keyString = "";

double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;
}

float dewI = 0;
float dewA = 0;
float tempI = 0;
float tempA = 0;
float humI = 0;
float humA = 0;

void setup()
{
//Serial.begin(115200); //Verbindung Computer
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("0.01 by Jules");
delay(2500);
}

void loop()
{
DHT.read22(dhtI); //Sensor Innen auslesen
delay(500);
DHT.read22(dhtI);
float humI = DHT.humidity;
float tempI = DHT.temperature;
float dewI = (dewPointFast(DHT.temperature, DHT.humidity));

DHT.read22(dhtA); //Sensor Aussen auslesen
delay(500);
DHT.read22(dhtA);
float humA = DHT.humidity;
float tempA = DHT.temperature;
float dewA = (dewPointFast(DHT.temperature, DHT.humidity));

// Serial.println ("Innensensor:");
// Serial.print ("humI: ");
// Serial.println (humI);
// Serial.print ("tempI: ");
// Serial.println (tempI);
// Serial.print ("dewI: ");
// Serial.println (dewI);
// Serial.println ("");
//
//
// Serial.println ("Aussensensor:");
// Serial.print ("humA: ");
// Serial.println (humA);
// Serial.print ("tempA: ");
// Serial.println (tempA);
// Serial.print ("dewA: ");
// Serial.println (dewA);
// Serial.println ("____________________");

//Anzeige Daten Keller

//Erste Zeile
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Keller: ");

lcd.print(dewI);
lcd.print((char)223);
lcd.print("C");

//Zweite Zeile
lcd.setCursor(0, 1);

lcd.print(tempI);
lcd.print((char)223);
lcd.print("C ");

lcd.print(humI);
lcd.print((char)0x25);

delay(5000);

//Anzeige Daten Aussen

//Erste Zeile
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Aussen: ");

lcd.print(dewA);
lcd.print((char)223);
lcd.print("C");

//Zweite Zeile
lcd.setCursor(0, 1);

lcd.print(tempA);
lcd.print((char)223);
lcd.print("C ");

lcd.print(humA);
lcd.print((char)0x25);

delay(5000);

}

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


dht DHT;
DFR_Key keypad;

#define dhtA 5
#define dhtI 6

This looks to me like you are using pins 5 and 6 for the LCD and for the temperature sensors. That's not smart.

When i understand this List right, this pins are directly connected to the arduino:

http://www.sainsmart.com/sainsmart-1602-lcd-keypad-shield-for-arduino-duemilanove-uno-mega2560-mega1280.html

Digital 4 -- DB4

and so on....

Ok i looked a the backsite of the shield, and yes they are directly connected.
My Problem is, that this Ports are defined in the liquidcrystal lib, how can i change?

My Problem is, that this Ports are defined in the liquidcrystal lib, how can i change?

The example code on that page includes a PDF file that shows the LCD is connected to pins 4,5, 6, 7, 8, and 9. The only way to change the pins that the LCD uses is going to involve a soldering iron.

Changing the pins that the temperature sensors use is a matter of pulling two wires, plugging them in elsewhere, and changing 2 lines of code.

I know which I'd tackle.

So here is the Schematic: http://sainsmart.com/zen/documents/20-011-901/schematic.pdf

What can i Do to change the Pins?

But its a shield, i can plug them nowhere else?!

But its a shield, i can plug them nowhere else?!

The shield, no. Stuff connected to pins that the shield doesn't use? Yes, you can.

The Shield fills all Digital Pins...

The Shield fills all Digital Pins...

Covers and uses are two different things. If that shield doesn't pass the unused pins to the top, send it back.