// Define sensor pins
const int tempSensorPin = 34; // Analog temperature sensor pin (LM35 or similar)
const int phSensorPin = 35; // Analog pH sensor pin
const int gasSensorPin = 32; // Analog gas sensor pin
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
// Initialize ADC pins
pinMode(tempSensorPin, INPUT);
pinMode(phSensorPin, INPUT);
pinMode(gasSensorPin, INPUT);
}
void loop() {
// Read raw analog values from the sensors
int tempValue = analogRead(tempSensorPin);
int phValue = analogRead(phSensorPin);
int gasValue = analogRead(gasSensorPin);
// Convert the analog readings to meaningful units
// Assuming 10mV per degree Celsius for LM35 temperature sensor
float temperature = (tempValue * 3.3 / 4095.0) * 100; // Convert ADC value to temperature (assuming 10mV/°C)
// You may need to calibrate the pH and gas sensor for your specific sensors
float ph = (phValue * 3.3 / 4095.0) * 14; // Map the pH value to a range of 0-14
float gasConcentration = (gasValue * 3.3 / 4095.0) * 100; // Example mapping for gas concentration (in percentage or ppm)
// Print sensor values to serial monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("pH Value: ");
Serial.print(ph);
Serial.println();
Serial.print("Gas Concentration: ");
Serial.print(gasConcentration);
Serial.println(" ppm"); // Modify based on sensor documentation
// Wait before taking another reading
delay(1000);
}