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

ESP32-Based Multi-Sensor Health and GPS Tracker

View and Edit Project In Cirkit DesignerImage of ESP32-Based Multi-Sensor Health and GPS Tracker

Circuit Documentation

Summary

The circuit in question is designed to interface various sensors and modules with an ESP32 microcontroller for the purpose of data acquisition and processing. The sensors include an MPU6050 accelerometer and gyroscope, a MAX30100 pulse oximeter and heart-rate sensor, a temperature sensor (LM35), and a NEO-6M GPS module. The circuit also includes a buzzer and an LED for user interaction. The ESP32 is responsible for reading data from the sensors, processing it, and potentially sending it to an external system or displaying it. The circuit is powered by a 3.3V supply, which is distributed to the sensors and modules that require it.

Component List

Wiring Details

ESP32 (30 pin)

MPU6050 Accelerometer + Gyroscope (Wokwi Compatible)

MAX30100

Temperature Sensor (LM35)

NEO 6M GPS

Buzzer

LED (Two Pin, red)

Documented Code

#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_MAX30100.h>
#include <TinyGPS++.h>

Adafruit_MPU6050 mpu;
Adafruit_MAX30100 max30100;
TinyGPSPlus gps;

void setup() {
  Serial.begin(115200);
  Wire.begin();

  // Initialize MPU6050
  if (!mpu.begin()) {
    Serial.println("Failed to find MPU6050 chip");
    while (1) { delay(10); }
  }
  mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
  mpu.setGyroRange(MPU6050_RANGE_500_DEG);
  mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);

  // Initialize MAX30100
  if (!max30100.begin()) {
    Serial.println("Failed to find MAX30100 chip");
    while (1) { delay(10); }
  }
  max30100.setMode(MAX30100_MODE_SPO2_HR);
  max30100.setLedsCurrent(50, 50);

  // Initialize GPS
  Serial2.begin(9600, SERIAL_8N1, 16, 17);

  // Initialize other components
  pinMode(5, OUTPUT); // Buzzer
  pinMode(4, OUTPUT); // LED
}

void loop() {
  // Read MPU6050
  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);

  // Read MAX30100
  float hr = max30100.getHeartRate();
  float spo2 = max30100.getSpO2();
  Serial.print("Heart Rate: "); Serial.print(hr); Serial.print(", SpO2: "); Serial.println(spo2);

  // Read LM35
  int lm35Value = analogRead(VP);
  float temperature = (lm35Value / 1024.0) * 330.0;
  Serial.print("Temperature: "); Serial.println(temperature);

  // Read GPS
  while (Serial2.available() > 0) {
    gps.encode(Serial2.read());
  }
  if (gps.location.isUpdated()) {
    Serial.print("Latitude: "); Serial.print(gps.location.lat(), 6);
    Serial.print(", Longitude: "); Serial.println(gps.location.lng(), 6);
  }

  // Add fall detection, alert logic, etc.

  delay(1000);
}

This code is designed to run on the ESP32 microcontroller. It initializes and reads data from the MPU6050, MAX30100, and LM35 sensors, as well as from the NEO 6M GPS module. The data is then printed to the serial monitor. The code also includes setup for a buzzer and an LED, which can be used for alerts or status indications.