Are you sitting yourself to death? (Arduino Measuring Device – Julia & Dave)

Project Description

To start this assignment, we brainstormed interesting things to measure, interesting ways to measure them, and possible locations for our measurement device.  We came up with all kinds of ideas—from a person’s repetitive thoughts (through self report) to boredom in class (seeing if we could look at network data and count how many people were on facebook.) In the end, we narrowed our ideas down to these 3:

  1. Measuring light in dark areas where plants grow nonetheless—seeing how much light is actually there.

  2. Measuring the effect of an installation piece on altruism—if we had a countdown that would motivate people to be aware of or donate to distant issues.

  3. (on the quantitative self side of things) measuring how long we spent sitting during the day. This was inspired by a study that indicated that excessive sitting increases health risks and decreases lifespan.

We chose to measure sitting as our final idea because it fit better with the assignment—measuring something that existed already—rather than idea 2, which was very deliberately changing people’s behavior. We also chose to measure sitting because we felt the measurement could be a provocative one, encouraging a wearer to think about their lifestyle choices.

Sensors Used

We used a pressure sensor (a.k.a. round force-sensitive resistor) placed in a back pocket to tell if a person was sitting.


Photo Nov 11, 3 37 54 PM




Github repo:

#include  Wire.h
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// initialize the 7 segment number display
Adafruit_7segment matrix = Adafruit_7segment();

// pressure sensor
const int sensorPin = 0;
int pressureReading; // the analog reading from the FSR resistor driver
int sittingThreshold = 900;

// cell phone vibrator
int vibratorPin = 7;

#define minutesToMillisFactor 60000

boolean currentlySitting = false;
float overallTimeSitting = 360*minutesToMillisFactor;
float sitStartTime = 0;
float timeBefore = 0;

boolean warningNow;

// 0.1 minutes for testing, but this would really be about 30 minutes (for practical use)
const float sitWarningThresholdInMinutes = 0.1;

void setup() {
  // get the serial port running for debugging

  // setup the 7 segment number display

  // initialize vibratorPin
  pinMode(vibratorPin, OUTPUT);

void loop() {
  pressureReading = analogRead(sensorPin);


  // how long have I currently been sitting?
  float currentSitDurationInMillis = millis() - sitStartTime;

  // warn if I've been sitting too long
  if ((currentSitDurationInMillis > sitWarningThresholdInMinutes * minutesToMillisFactor) 
     && currentlySitting) {
       warningNow = true;

  if (warningNow == true) {
    digitalWrite(vibratorPin, HIGH);

  // if I'm sitting, update the display, adding the time delta

  matrix.print((long)overallTimeSitting/minutesToMillisFactor, DEC);

void checkSitting() {
  Serial.print("pressure: ");

  float timeNow = millis();
  // are you sitting?
  if (pressureReading < sittingThreshold) {       // were you sitting last time I checked?       if (currentlySitting == false) {         sitStartTime = millis();         currentlySitting = true;         Serial.println("started sitting");       }       else {         Serial.println("still sitting");         // update overall sitting time         float thisSitDuration = timeNow - timeBefore;         overallTimeSitting += thisSitDuration;                }   }   // are you sitting now   if (pressureReading > sittingThreshold) {
    // did you just get up?
    if (currentlySitting == true) {
      currentlySitting = false; 
      Serial.println("got up");
      warningNow = false;
      digitalWrite(vibratorPin, LOW);
  timeBefore = timeNow;


Comments are closed.