I am not able to get the ouput in the serail monitor

Any help me to connect this and get the output in the serial monitor

Connections:

  1. DS18B20 (Body Temperature)

VCC → 5V
GND→ GND
DATA → Digital pin 2 (with a 4.7kΩ pull-up resistor between DATA and VCC)

  1. DHT11 (Atmospheric Temperature and Humidity)

VCC → 5V
GND → GND
DATA→ Digital pin 3

  1. AD8232 (Heart Rate and ECG)

GND → GND
3.3V → 3.3V
OUT → Analog pin A0
LO+ → Connect electrode
LO- → Connect electrode
RA/LA/RL → Connect electrodes (as per AD8232 datasheet)

  1. MPU6050 (Fall Detection)**

VCC → 3.3V (or 5V if compatible)
GND → GND
SCL→ A5 (SCL on Arduino Uno)
SDA → A4 (SDA on Arduino Uno)

  1. TCS3200 (Urine Color Detection)

VCC → 5V
GND → GND
S0, S1 → Digital pin 4, 5 (frequency scaling)
S2, S3 → Digital pin 6, 7 (color filter selection)
OUT → Digital pin 8

code:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <DHT.h>
#include <MPU6050_light.h>

// DS18B20 Setup (Body Temperature)
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// DHT11 Setup (Atmospheric Temperature and Humidity)
#define DHTPIN 3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

// MPU6050 Setup (Fall Detection)
MPU6050 mpu(Wire);

// TCS3200 Setup (Urine Color Detection)
#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define OUT 8

// ECG Setup (AD8232)
#define ECG_PIN A0

void setup() {
Serial.begin(9600);

// DS18B20 Initialization
sensors.begin();

// DHT11 Initialization
dht.begin();

// MPU6050 Initialization
Wire.begin();
mpu.begin();
mpu.calcGyroOffsets(true);

// TCS3200 Initialization
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(OUT, INPUT);
digitalWrite(S0, HIGH);
digitalWrite(S1, LOW);

// ECG AD8232 Initialization
pinMode(ECG_PIN, INPUT);
}

void loop() {
// DS18B20 Body Temperature
sensors.requestTemperatures();
float bodyTemp = sensors.getTempCByIndex(0);
Serial.print("Body Temperature (DS18B20): ");
Serial.print(bodyTemp);
Serial.println("°C");

// DHT11 Atmospheric Temperature and Humidity
float temp = dht.readTemperature();
float humidity = dht.readHumidity();
if (isnan(temp) || isnan(humidity)) {
Serial.println("Failed to read from DHT sensor!");
} else {
Serial.print("Atmospheric Temperature (DHT11): ");
Serial.print(temp);
Serial.println("°C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
}

// AD8232 ECG Monitoring (Heart Rate)
int ecgValue = analogRead(ECG_PIN);
Serial.print("ECG Value (AD8232): ");
Serial.println(ecgValue);

// MPU6050 Fall Detection (Accelerometer and Gyroscope)
mpu.update();
Serial.print("Accelerometer: X=");
Serial.print(mpu.getAccX());
Serial.print(", Y=");
Serial.print(mpu.getAccY());
Serial.print(", Z=");
Serial.println(mpu.getAccZ());

// TCS3200 Urine Color Detection (RGB Frequency Detection)
digitalWrite(S2, LOW);
digitalWrite(S3, LOW);
int redFrequency = pulseIn(OUT, LOW);

digitalWrite(S2, HIGH);
digitalWrite(S3, HIGH);
int greenFrequency = pulseIn(OUT, LOW);

digitalWrite(S2, LOW);
digitalWrite(S3, HIGH);
int blueFrequency = pulseIn(OUT, LOW);

Serial.print("Color Frequency - Red: ");
Serial.print(redFrequency);
Serial.print(", Green: ");
Serial.print(greenFrequency);
Serial.print(", Blue: ");
Serial.println(blueFrequency);

// Delay for readability
delay(1000);
}

Does the serial monitor work with sample programs from the IDE? Did the serial monitor work at any point while developing your program?

I suggest you go back to your other post which seems similar and read @UKHeliBob suggestions.

with the single sensor it is working

Then that is telling you to begin with that program and add a SINGLE additional sensor and get that to work so both sensors are showing!!!

1 Like

See post #3

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.