Introduction:
The NYU library at peak hours , especially during the midterm week, turns into a Sunday bazaar with students pulling all nighters and some attending just for the vibes. It has been the case, that the number of students wanting to study always exceeds the number of study desks available. To address this, the library administration devised a policy – 25 minutes of unattended desk would result in transfer of that study place to another student. Many students toss in there belongings and go away. While the desk is not being used, it ends up not being utilized for studying. This way of booking and occupying places, is not only selfish but unethical. To address this issue, I wanted to resort to ‘out of the box thinking’. This is where I found a switch mechanism, apparently an usual one more befitting!

Working:

In order to be the switch to be unusual, it cannot be operated by hand. One of the indicators could have been the desk, but then I realized, that the chairs can be even more useful in the sense that it is definite that you have to sit down to work, compared to putting pressure over the desk with your items. Hence, as shown in the sketch, I utilized the pressure sensor, which has inverse relationship between its resistance and pressure applied onto its plate. Pressure decrease increases resistance. I added two leds, with one connected to pin-8 being red – indicating that the seat is occupied, and the other one connected to pin-12 indicating that the seat/workplace is free. The 10k resistors help prevent LEDs from burning and third resistor is connected to the pressure plate, to ground unnecessary voltage flux by the plate to 0V. This prevents anomaly and stops any non-necessary trigger sent over to A0 input. Since digitalRead had to be used, the simple ON or OFF state from the sensor was extracted and the state was sent over to the input ‘A0’. This input measures for 0s and 1s. When 1 detected, it triggers the logic inside the code.
Here is the schematic for the circuit:

Demo:
Code:
//alinoor // declare variables int sensorpin = A0; // sensor pin int sensor; // sensor readings // LED pins int led1 = 8; int led2 = 12; bool person_was_sitting; // to check if it is still in use while person away void setup() { // set LED pins as outputs pinMode(led1,OUTPUT); pinMode(led2,OUTPUT); // initialize serial communication Serial.begin(9600); } void loop() { // read sensor value sensor = digitalRead(sensorpin); // print sensor value Serial.println(sensor); // turn on the red led and keep it on until the person is pressing against it // against it or its been 25 minutes since the last press. if(sensor>0){ digitalWrite(led2,LOW); //green led turns off digitalWrite(led1,HIGH); //red led turns on person_was_sitting = true; } else if(sensor < 1 && person_was_sitting == true){ //checks out only if now seat is idle and person is away for less than 25 min digitalWrite(led1,HIGH); delay (1500000); // delay for 25 minutes digitalWrite(led1,LOW); // red led turns off digitalWrite(led2,HIGH); //green LED turns on person_was_sitting = false; } }
The code is pretty much self-explanatory with the aid of the comments. To further explain the logic, the two LEDs are connected to pin 8 and 12. The sensor value store the digitalRead value measured for input to A0 pin. That value, either 0 or 1 (printed inside serial monitor as well for debugging), is used in if-else condition to perform certain task. The delay in else is in milliseconds equivalent of 25 minutes. For debugging 5000 millisecond was used which is equivalent to 5 seconds. If the sensor returns 1, bright red LED lights up to show ‘occupied’. It also sets the state of ‘person_was_sitting’ to true. When person no longer sitting, then else-if triggers and checks for both conditions. In the case that its been more than 25 minutes, and there hasn’t been any one sitting on the chair, then else-if isn’t checked for, and it continues to power the green LED. However, if a person just left, then a delay of 25 minutes is set in place, after which red light is turned off and the green one is toggled.
Future Improvements:
Potentially a brighter LED coupled with weight sensor to make it fool-proof. Students can swap chairs to prolong booking, which in my opinion would self-contradict their on idea of staying away from desk as they will have to comeback to swap again, but even then, adding in weight sensor can help monitor and record for previous weight. If someone else sits to prolong or to takeover someones space, an added buzzer can beep and notify the librarian of such act.