Solar powered Temperature corrected PH meter with Ambient Temperature and Humidity.
Display Shows Outside Temp and Humidity on top with PH and Water temp on bottom.
Moderators: adafruit_support_bill, adafruit
/*
Sketch combining DHT22, DS18B20 OneWire, LCD I2C and Analog PH 5V
Nothing very creative, but they all coexist no problem.
Make sure you visit each of these sensor's tutorials and get the required libraries.
*/
#include <Wire.h>
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHT.h"
#define DHTPIN 11
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
#define ONE_WIRE_BUS 10
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int sensorPinPH = A0;
LiquidCrystal lcd(0);
void setup() {
dht.begin();
lcd.begin(16, 2);
lcd.setBacklight(HIGH);
lcd.setCursor(8, 0);
sensors.begin();
}
void loop() {
float h = dht.readHumidity();
float t = (dht.readTemperature()*9.0/5.0)+32.0;
float sensorValue = 0;
lcd.setCursor(0, 0);
lcd.print(t);
lcd.setCursor(8, 0);
lcd.print(h);
lcd.setCursor(0, 1);
sensors.requestTemperatures();
sensorValue = 7.0 - (2.5 - analogRead(sensorPinPH) / 204.8) / (0.257179 + 0.000941468 * sensors.getTempCByIndex(0));
lcd.print(sensorValue);
lcd.setCursor(8, 1);
lcd.print((sensors.getTempCByIndex(0)*9.0/5.0)+32.0);
delay(500);
}
sensorValue = 7.0 - (2.5 - analogRead(sensorPinPH) / 204.8 ) / (0.257179 + 0.000941468 * sensors.getTempCByIndex(0));
lcd.print(sensorValue);
Return to General Project help
Users browsing this forum: No registered users and 9 guests