Introduction:
I am obsessed with privacy. My dorm is my safe haven from the pressure of school work and socializing, so I am obviously annoyed when that peace is disturbed. It is from this that I had the idea of a Do-Not-Disturb button. An automatic version of the signs you hang on hotel room doors, to signal to roommates and visitors that I am not to be disturbed.
Procedure:
My initial idea was to have a simple circuit like we built last week. When I close my door, the circuit is closed, and if I pushed a button, a red LED would light up, and maintain state after the button was pushed. If I pushed it again, the LED would turn off, signaling that I am available. If my door was open, then the light would be off, as the circuit was broken.
However, in order to make this more hands-free, the Professor suggested that I use some other signal besides a push button to indicate that I was not to be disturbed. He suggested that I put conductive material on my pillow and the bed below the pillow, so when I was asleep the circuit would close and the light would come on. The circuit itself is very simple. I made a diagram of it in tinkerCAD, and attached a screenshot here.
The small breadboard off to the side represents the conductive material attached to the pillow. (I don’t know how to put conductive material in tinkerCAD). In this diagram, the circuit is closed. The code for this is also quite simple, with the Arduino reading the state of the “pillowPin” and writing that to the LED pin.
The procedure is relatively simple. When the conductive material on the bed and the pillow comes into contact, the circuit is closed.
When the circuit is closed, the Arduino will read the current state of the LED pin and change it. (The LED is always off to start). When the circuit is broken, the LED will turn off.
Demonstration:
const int ledPin = 3; const int pillowPin = 2; bool sleepWake = LOW; void setup() { // put your setup code here, to run once: pinMode(ledPin, OUTPUT); pinMode(pillowPin, INPUT); } void loop() { // put your main code here, to run repeatedly: bool currentState = digitalRead(pillowPin); if(currentState == HIGH){ sleepWake = !sleepWake; } }