Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano ESP32-Based Multi-Sensor Health Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino Nano ESP32-Based Multi-Sensor Health Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

The circuit in question is a multifunctional embedded system that integrates various sensors and microcontrollers to perform tasks such as heart rate monitoring, temperature sensing, motion detection, and real-time clock tracking. The primary microcontroller is an Arduino Nano ESP32, which interfaces with an ESP8266 NodeMCU, an AD8232 Heart Rate Monitor, an MPU6050 Accelerometer and Gyroscope, an IR sensor, a Temperature Sensor (LM35), an ESP32-CAM, an ESP32 Mini, and a DS3231 Real-Time Clock (RTC).

Component List

Arduino Nano ESP32

ESP8266 NodeMCU

AD8232 Heart Rate Monitor

MPU6050 Accelerometer + Gyroscope

IR Sensor

Temperature Sensor (LM35)

ESP32-CAM

ESP32 Mini

DS3231 RTC

Wiring Details

Arduino Nano ESP32

ESP8266 NodeMCU

AD8232 Heart Rate Monitor

MPU6050 Accelerometer + Gyroscope

IR Sensor

Temperature Sensor (LM35)

ESP32-CAM

ESP32 Mini

DS3231 RTC

Documented Code

Arduino Nano ESP32 Code

#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>

#define IR_PIN 2 // Pin connected to the IR sensor

RTC_DS3231 rtc;
Adafruit_MPU6050 mpu;

void setup() {
  Serial.begin(115200);
  Wire.begin(); // Initialize I2C
  pinMode(IR_PIN, INPUT);

  // Initialize RTC
  if (!rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  if (rtc.lostPower()) {
    Serial.println("RTC lost power, setting the time!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }

  // Initialize MPU6050
  if (!mpu.begin()) {
    Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
    while (1);
  }
  mpu.setAccelerometerRange(MPU6050_RANGE_2_G);
  mpu.setGyroRange(MPU6050_RANGE_250_DEG);
  mpu.setFilterBandwidth(MPU6050_BAND_5_HZ);
}

void loop() {
  // Read the IR sensor
  int irValue = digitalRead(IR_PIN);
  Serial.print("IR Sensor Value: ");
  Serial.println(irValue);

  // Get current time from RTC
  DateTime now = rtc.now();
  Serial.print("Current Time: ");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();

  // Read accelerometer and gyroscope data
  sensors_event_t a, g, temp;
  mpu.getEvent(&a, &g, &temp);

  Serial.print("Accel X: "); Serial.print(a.acceleration.x);
  Serial.print(", Y: "); Serial.print(a.acceleration.y);
  Serial.print(", Z: "); Serial.println(a.acceleration.z);

  Serial.print("Gyro X: "); Serial.print(g.gyro.x);
  Serial.print(", Y: "); Serial.print(g.gyro.y);
  Serial.print(", Z: "); Serial.println(g.gyro.z);

  delay(1000);
}

ESP8266 NodeMCU Code

#include <Wire.h>
#include <RTClib.h>

#define RX_PIN D5  // Pin for receiving data from Arduino

void setup() {
  Serial.begin(115200);
  Serial.println("NodeMCU Ready");
}

void loop() {
  if (Serial.available()) {
    String data = Serial.readStringUntil('\n'); // Read incoming data
    Serial.println("Received: " + data); // Print received data
  }

  // You can add additional functionality here, such as connecting to Wi-Fi, sending data to the cloud, etc.

  delay(1000);
}

(Note: The code for other microcontrollers is not included in this documentation as it was not provided in the input. If additional code is available for other microcontrollers, it should be documented in a similar fashion.)