0

$USD

$USD
PROJECTS Arduino

A Seat to Save Your Cervical Vertebra

DFRobot Apr 25 2016 1017

Recently my cervical vertebra is sending alarm so I decide to correct my sitting posture.
Right sitting posture is as follows:


Are you sitting like this while reading this information?

If you are sitting like this, please continue to read this. 
I decide to create a small gadget to remind myself.
Materials:
Ultrasonic distance sensor x1
Beetle x1
Infrared distance sensor x1
Buzzer x1
Mobile chargerx1
Vibrative motor (optional)
Wire, galvanized wire, welding tools

Fix the galvanized wire which is to measure the distance to the back of the chair. It is better to keep it horizontal to the back of your head.

Tie all the components to the side of the chair. Please be noticed that the infrared distance sensor (the yellow part on upper right) should be kept within effective distance to measure whether people are sitting on the chair.

 Put buzzer, vibrative motor, battery and beetle together. When do we still need vibrative motor? Isn’t a buzzer enough? We are setting it up for the scenario of office. The buzzer will be too noisy for the coworkers.

If you do not want to use mobile charger, one wire connected to the computer will also work.

I heard that someone wants a video. Sorry we do not have it.

Therefore I draw a picture.

If no one sits on the chair, it will not send alarm. There is no picture.

If you sits straight on it,it will not send alarm either as shown in following picture


If you change your posture, it will send out alarm as shown in the picture.

The codes are generally as shown here. The parameters can be adjusted.
#define trigPin 4
#define echoPin 5
#define irPin 3
#define warnPin 2

int count = 0;
int countThreshold = 5;
int warnTime = 200;

int postureDistance = 20; //cm
int maxDistance = 3000;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(irPin, INPUT);
  pinMode(warnPin, OUTPUT);
}

void loop() {

  long duration, distance;

  // for ultra sound distance sensor
  digitalWrite(trigPin, LOW);  
  delayMicroseconds(2); 
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); 
  digitalWrite(trigPin, LOW);


  // head position
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;

  Serial.print(distance);
  Serial.println(" cm");

  // ir 0 means object detected, so someone is sitting
  int ir = !digitalRead(irPin);
  digitalWrite(13, ir);
  Serial.print("ir: ");
  Serial.println(ir);

  if (ir && distance > postureDistance && distance < maxDistance) {
    // accumulate count when person detected
    count++;
  } else {
    // cool down
      count = 0;
  }

  Serial.print("count:");
  Serial.println(count);
  
  delay(1000);

  if ( count >= countThreshold ) {
    // need to warn you
    digitalWrite(warnPin, HIGH);
    Serial.println("###########Warning!!#############");
    count = 0;
    delay(warnTime);
    digitalWrite(warnPin, LOW);
  } else {
    digitalWrite(warnPin, LOW);
  }
}