I DONE A CODE only for sensor readings(totally 3 sensors)
here is the code:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 bmp;
const int mq135Pin = A0;
void setup() {
Serial.begin(9600);
dht.begin();
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP180 sensor, check wiring!");
while (1);
}
Serial.println("Sensor Reading - BMP180, DHT11, and MQ-135:");
}
void loop() {
// Read DHT11 sensor data
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Read BMP180 sensor data
float pressure = bmp.readPressure() / 100.0;
// Read MQ-135 sensor data
int mq135Value = analogRead(mq135Pin);
// Calculate gas resistance (you may need to calibrate this according to your MQ-135 datasheet)
float rs_gas = 10000.0 * ((1023.0 / (float)mq135Value) - 1.0);
// Print data to serial monitor
Serial.print("Temperature (C): "); Serial.print(temperature); Serial.print(" | ");
Serial.print("Humidity (%): "); Serial.print(humidity); Serial.print(" | ");
Serial.print("Pressure (hPa): "); Serial.print(pressure); Serial.print(" | ");
Serial.print("MQ-135 Value: "); Serial.print(mq135Value); Serial.print(" | ");
Serial.print("Gas Resistance (Ω): "); Serial.println(rs_gas);
// Wait for a few seconds before reading again
delay(5000);
}
i need data logging for it