I have searched google and have looked through the forums with no results. I have two FS200-SHT10 senors. I currently have one of them (OAT) working and displaying data on my LCD screen. I bought another sensor to monitor the greenhouse inside temp/hum. Is this possible? After looking at the code,even if i change the terminals that the sensor is wired to (10 and 11). The code gets its readings from the same library (OAT = sht1x.readTemperatureF();).
In the end my question is, How do I wire up two of the senors and have it displayed on the LCD screen?
#include <SHT1x.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
//SET INPUTS
int GHAIRHEATON = 74; //GREENHOUSE AIR HEATING SETPOINT TO TURN ON
int GHAIRHEATOFF = 75; //GREENHOUSE AIR HEATING SETPOINT TO TURN OFF
int GHAIRCOOLON = 75; //GREENHOUSE AIR COOLING SETPOINT TO TURN ON
int GHAIRCOOLOFF = 73; //GREENHOUSE AIR COOLING SETPOINT TO TURN OFF
int GHHUMPF;
int GHHEATPF; //GREENHOUSE HEATING PROOF
int GHCOOLINGPF; //GREEN HOUSE COOLING PROOF
int GHDAMPS; //
int ALARM;
int GHLIGHT;
int GHDAMPSS;
int GHAIRHEAT = 49; //TURN ON GREENHOUSE HEATER
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7); // 0x27 is the I2C bus address for an unmodified backpack
void setup()
{
// activate LCD module
lcd.begin (20, 4); // for 20 x 4 LCD module
lcd.setBacklightPin(3, POSITIVE);
lcd.setBacklight(HIGH);
//set pin state
pinMode(50, INPUT); //HEATER PROOF
digitalWrite(GHHEATPF, LOW); //HEATER START OFF
pinMode(49, OUTPUT); //HEATER ENABLE
digitalWrite(GHAIRHEAT, HIGH); //HEATER START OFF
pinMode(48, INPUT); //GREENHOUSE COOOLER
digitalWrite(GHCOOLINGPF, LOW); //GREENHOUSE COOLER START OFF
pinMode(47, INPUT); //GREENHOUSE DAMPERS
digitalWrite(GHDAMPS, LOW); //GREENHOUSE DAMPERS START OFF
pinMode(46, OUTPUT);
digitalWrite(GHDAMPSS, LOW); //GREENHOUSE DAMPERS START OFF
pinMode(45, INPUT);
digitalWrite(GHDAMPSS, LOW); //GREENHOUSE DAMPERS START OFF
//SET UP THE LCD SCREEN WHEN FIRST TURNED ON
lcd.home (); // set cursor to 0,0
lcd.setCursor (5, 0);
lcd.print("AQUAPONICS"); // go to LINE 5,0 AND PRINT THIS
lcd.setCursor (2, 1);
lcd.print(" CONTROLLER 1.0"); // go to LINE 2,1 AND PRINT THIS
lcd.setCursor (6, 2);
lcd.print("BY LUCAS"); // go to LINE 2,1 AND PRINT THIS
delay(5000);
lcd.noDisplay(); // Turn off the display:
}
void loop()
{
float GHTEMP;
float GHHUM;
float GHLUX;
float OAT;
float OAH;
float GHWT;
float GHPH;
float GHDO;
// Read values from the sensor
OAT = sht1x.readTemperatureF();
OAH = sht1x.readHumidity();
//READ PIN STATE
GHHEATPF = digitalRead (50); // heater proof gets wired to pin 50
GHCOOLINGPF = digitalRead (48); // heater proof gets wired to pin 48
//AIR HEATING ENABLE
if (OAT > GHAIRHEATON)
{
digitalWrite(GHAIRHEAT, HIGH);
}
else if (OAT < GHAIRHEATOFF)
{
digitalWrite(GHAIRHEAT, LOW);
}
//DISPLAY GREENHOUSE STATE
lcd.clear(); //CLEAR OFF THE ABOVE TEXT
lcd.display();
lcd.setCursor (5, 0);
lcd.print("GREEN HOUSE"); //DISPLAY GREEN HOUSE DATA
lcd.setCursor (0, 1);
lcd.print("TEMP:"); //DISPLAY THE WORD TEMP THEN THE VALUE
lcd.setCursor (5, 1);
lcd.print(GHTEMP, 1);
lcd.print("F");
lcd.setCursor (0, 2); //DISPLAY STATE OF HEATER
lcd.print("HEAT:");
if (GHHEATPF == HIGH) { //IF HEATER IS ON THEN DISPLAY ON
lcd.setCursor (5, 2);
lcd.print("ON");
}
else
{
lcd.setCursor (5, 2); //IF COOLING IS OFF THEN DISPLAY OFF
lcd.print("OFF");
}
lcd.setCursor (0, 3); //DISPLAY STATE OF COOLING IN GREEN HOUSE
lcd.print("COOLING:");
if (GHCOOLINGPF == HIGH) { //IF COOLING IS ON THEN DISPLAY ON
lcd.setCursor (8, 3);
lcd.print("ON");
}
else
{
lcd.setCursor (8, 3); //IF COOLING IS OFF THEN DISPLAY OFF
lcd.print("OFF");
}
lcd.setCursor (11, 2); //DISPLAY STATE OF DAMPER
lcd.print("DAMP:");
if (GHDAMPS == HIGH) { //IF DAMPER IS OPEN THEN DISPLAY OPN
lcd.setCursor (16, 2);
lcd.print("OPN");
}
else
{
lcd.setCursor (16, 2); //IF DAMPER IS CLOSED THEN DISPLAY CLO
lcd.print("CLO");
}
lcd.setCursor (11, 1);
lcd.print("OAT:"); //DISPLAY THE WORD TEMP THEN THE OUTSIDE AIR TEMP VALUE
lcd.setCursor (15, 1);
lcd.print(OAT, 1);
lcd.print("F");
//MAKE A 2ND PAGE
delay(5000);
lcd.clear(); //CLEAR OFF THE ABOVE TEXT
lcd.display();
lcd.setCursor (5, 0);
lcd.print("GREEN HOUSE"); //DISPLAY GREEN HOUSE DATA
lcd.setCursor (0, 1);
//GREEN HOUSE HUM DISTPLAY
lcd.setCursor (0, 1);
lcd.print("HUM:"); //DISPLAY THE HUM THEN THE VALUE
lcd.setCursor (4, 1);
lcd.print(GHHUM);
lcd.print("%");
//OUTSIDE HUM DISPLAY
lcd.setCursor (11, 1);
lcd.print("OAH:"); //DISPLAY THE HUM THEN THE VALUE
lcd.setCursor (15, 1);
lcd.print(OAH, 1);
lcd.print("%");
//HUM STATE
lcd.setCursor (11, 2); //DISPLAY STATE OF HUM
lcd.print("HUM:");
if (GHHUMPF == HIGH) { //IF HUM IS ON THEN DISPLAY ON
lcd.setCursor (17, 2);
lcd.print("ON");
}
else
{
lcd.setCursor (17, 2); //IF HUM IS OFF THEN DISPLAY OFF
lcd.print("OFF");
}
delay (5000);
//DISPLAY 3 LIGHT CONTROLLS
lcd.clear(); //CLEAR OFF THE ABOVE TEXT
lcd.display();
lcd.setCursor (5, 0);
lcd.print("GREEN HOUSE"); //DISPLAY GREEN HOUSE DATA
lcd.setCursor (0, 1);
lcd.print("LUX:"); //DISPLAY THE LUMES THEN THE VALUE
lcd.setCursor (4, 1);
lcd.print(GHLUX);
lcd.print("");
lcd.setCursor (0, 3); //DISPLAY STATE OF lights
lcd.print("LIGHT:");
if (GHLIGHT == HIGH) { //IF lights are ON THEN DISPLAY ON
lcd.setCursor (5, 3);
lcd.print("ON");
}
else
{
lcd.setCursor (6, 3); //IF lights are OFF THEN DISPLAY OFF
lcd.print("OFF");
}
lcd.setCursor (0, 2);
lcd.print("HOURS NEEDED:"); //DISPLAY THE NUMBER OF HOURS NEEDED OF LIGHT
lcd.setCursor (5, 1);
lcd.print("");
lcd.print("");
//DISPLAY 3 FISH SIDE
delay(5000);
lcd.clear(); //CLEAR OFF THE ABOVE TEXT
lcd.display();
lcd.setCursor (8, 0);
lcd.print("FISH"); //DISPLAY FISH DATA
lcd.setCursor (0, 1);
lcd.print("TEMP:"); //DISPLAY THE WATER TEMP THEN THE VALUE
lcd.setCursor (5, 1);
lcd.print(GHWT);
lcd.print("F");
//WATER PH
lcd.setCursor (0, 2);
lcd.print("PH:"); //DISPLAY THE WATER TEMP THEN THE VALUE
lcd.setCursor (3, 2);
lcd.print(GHPH);
//WATER DO
lcd.setCursor (0, 3);
lcd.print("DO:"); //DISPLAY THE WATER TEMP THEN THE VALUE
lcd.setCursor (3, 3);
lcd.print(GHDO);
/*
(OAT >= GHAIRHEATON);
digitalWrite(GHAIRHEAT, HIGH);
(OAT <= GHAIRHEATOFF);
digitalWrite(GHAIRHEAT, LOW);
*/
delay(5000);
}