Sensored Chair Alarm

This project was inspired by the 'Time to Get Out of Your Chair' Alarm project. This device sets off an alarm every 15 minutes that the sensor has been consistently pressed (someone has been sitting in the same position for 15 minutes). When the alarm plays to the tune "happy birthday" a red light will also turn on to indicate that the user needs to stand up or reposition.

A box was made using 3-D printing in order to hold the device which can then be placed on the back of the chair or wheelchair.

Getting up and repositioning is crucial for those who sit frequently as it can create bruising.

Step 1: Step 1: Aquire Proper Materials

Redboard Platform and Breadboard

11 jumper wires

1 LED light

2 330 resistors

1 Piezo Buzzer

1 Potentiometer

1 sensor strip

Battery pack

Step 2: Step 2: Connections

Potentiometer: A1 to A3

Led: B9 to B10

Piezo Buzzer: I1 to I3

Resistor: E10 to G10

Resistor: E29 to G29

Jumper wire: A29 to pressure sensor

Jumper wire: B30 to pressure sensor

Jumper wire: D29 to A0 on red board

Jumper wire: E30 to 5V on red board

Jumper wire: J29 to 30 (-)

Jumper wire: J10 to 13 on red board

Jumper wire: E1 to E2

Jumper wire: F1 to 10 on red board

Jumper Wire: 1 (-) to GND on red board

Jumper Wire: E2 to 5 (-)

Jumper Wire: E9 to GND on red board

Step 3: Step 3: Code

const int FSR_PIN = A0; // Pin connected to FSR/resistor divider // Measure the voltage at 5V and resistance of your 3.3k resistor, and enter
// their value's below:
const float VCC = 4.98; // Measured voltage of Ardunio 5V line
const float R_DIV = 3230.0; // Measured resistance of 3.3k resistor
int speakerPin = 10; //the pin that buzzer is connected to
int sittingcount =0;


void setup()
{
serial.begin(9600);
pinMode(FSR_PIN, INPUT);
int speakerPin = 10; //the pin that buzzer is connected to
pinMode(speakerPin, OUTPUT); //set the output pin for the speaker
pinMode(13, OUTPUT); // Set pin 13 to output
}


void loop()
{
int fsrADC = analogRead(FSR_PIN);
//Serial.println("sitting count = " + String(sittingcount));
// If the FSR has no pressure, the resistance will be
// near infinite. So the voltage should be near 0.
if (fsrADC != 0) // If the analog reading is non-zero
{

// Use ADC reading to calculate voltage:

float fsrV = fsrADC * VCC / 1023.0;

// Use voltage and static resistor value to
// calculate FSR resistance:
float fsrR = R_DIV * (VCC / fsrV - 1.0);
Serial.println("Resistance: " + String(fsrR) + " ohms");
// Guesstimate force based on slopes in figure 3 of
// FSR datasheet:
float force;
float fsrG = 1.0 / fsrR; // Calculate conductance
// Break parabolic curve down into two linear slopes:
if (fsrR <= 600)
force= (fsrG - 0.00075) / 0.00000032639;
else
force = fsrG / 0.000000642857;
Serial.println("Force: " + String(force) + " g");
Serial.println();
// add one to sitting count
sittingcount = sittingcount + 1;
// is sitting count > 100?
if (sittingcount > 100) {
// Alarm!
digitalWrite(13, HIGH);
// Turn on the LED delay(2000);
// Wait for two seconds digitalWrite(13, LOW); // Turn off the LED
delay(500);
play('g', 2); //ha
play('g', 1); //ppy
play('a', 4); //birth
play('g', 4); //day
play('C', 4) //to
play('b', 4); //you
}
}

else // no pressure detected

{
sittingcount = 0;
}
}
void play( char note, int beats)
{ int numNotes = 14; // number of notes in our note and frequency array (there are 15 values, but arrays start at 0)
//Note: these notes are C major (there are no sharps or flats)
//this array is used to look up the notes char notes[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', 'D', 'E', 'F', 'G', 'A', 'B', ' '}; //this array matches frequencies with each letter (e.g. the 4th note is 'f', the 4th frequency is 175) int frequencies[] = {131, 147, 165, 175, 196, 220, 247, 262, 294, 330, 349, 392, 440, 494, 0};
int currentFrequency = 0; //the frequency that we find when we look up a frequency in the arrays
int beatLength = 15000; //the length of one beat (changing this will speed up or slow down the tempo of the song)
//look up the frequency that corresponds to the note
for (int i = 0; i < numNotes; i++) // check each value in notes from 0 to 14
{


if (notes[i] == note) // does the letter passed to the play function match the letter in the array?

{

currentFrequency = frequencies[i]; // Yes! Set the current frequency to match that note
}
}
//play the frequency that matched our letter for the number of beats passed to the play function
tone(speakerPin, currentFrequency, beats * beatLength);
delay(beats* beatLength); //wait for the length of the tone so that it has time to play
delay(50); //a little delay between the notes makes the song sound more natural
}

Step 4: Step 4: Make Box on Tinkered to Be 3-D Printed

Step 5: Step 5: Place on Back of Chair and Enjoy!

Share

    Recommendations

    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure

    Discussions

    0
    None
    randofo

    20 days ago

    Why did you choose to play Happy Birthday?