Varada RathnakaranSurya DevAnura Vismaya RANGEL MARY MATHEW
Published

Posture Corrector

The project mainly deals with a posture correcting hardware system using esp8266.

IntermediateFull instructions provided213
Posture Corrector

Things used in this project

Hardware components

ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
6 DOF Sensor - MPU6050
DFRobot 6 DOF Sensor - MPU6050
×1
Solar Cockroach Vibrating Disc Motor
Brown Dog Gadgets Solar Cockroach Vibrating Disc Motor
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin

Story

Read more

Schematics

Working prototype of posture Corrector

Here according the video the buzzer beeps when the bad posture is detected.

Circuit of posture Corrector

The components used are MPU 6050,Buzzer,Esp 8266,mini breadboard

Old circuit of posture Corrector

The components used are MPU 6050, vibration motor,esp 8266,breadboard

Old Working prototype of posture Corrector

Vibration motor was used instead of buzzer

Code

Final code

C/C++
#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>

Adafruit_MPU6050 mpu;

#define BUZZER_PIN 12
#define POSTURE_ANGLE 25
#define BAD_POSTURE_DURATION 2000

unsigned long badPostureStart = 0;
bool inBadPosture = false;

void setup() {
  Serial.begin(115200);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(BUZZER_PIN, LOW);

  if (!mpu.begin()) {
    Serial.println("MPU6050 not detected. Check wiring!");
    while (1);
  }

  Serial.println("MPU6050 initialized.");
  delay(1000);
}

void loop() {
  sensors_event_t a, g, temp;
  mpu.getEvent(&a, &g, &temp);

  // Adjusted pitch calculation using X and Z axes
  float pitch = atan2(-a.acceleration.x, a.acceleration.z) * 180 / PI;

  Serial.print("Pitch: ");
  Serial.println(pitch);

  if (abs(pitch) > POSTURE_ANGLE) {
    Serial.println("Bad Posture");

    if (!inBadPosture) {
      inBadPosture = true;
      badPostureStart = millis();
    } else if (millis() - badPostureStart > BAD_POSTURE_DURATION) {
      digitalWrite(BUZZER_PIN, HIGH);
    }

  } else {
    Serial.println("Good Posture");
    inBadPosture = false;
    digitalWrite(BUZZER_PIN, LOW);
  }

  delay(200);
}

Credits

Varada Rathnakaran
1 project • 2 followers
Surya Dev
1 project • 1 follower
Anura Vismaya R
1 project • 2 followers
I am a btech student of Electronics and Communication branch.
ANGEL MARY MATHEW
1 project • 1 follower

Comments